@openspecui/web 1.6.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/assets/{BufferResource-BFEntdoN.js → BufferResource-WPSrP4iZ.js} +1 -1
  2. package/dist/assets/{CanvasRenderer-ZQxN8ITJ.js → CanvasRenderer-yL0hHLLA.js} +1 -1
  3. package/dist/assets/{Filter-trCu1CQG.js → Filter-MPAI5-Oj.js} +1 -1
  4. package/dist/assets/{RenderTargetSystem-DHoDBu3v.js → RenderTargetSystem-D4qtRaUW.js} +1 -1
  5. package/dist/assets/{WebGLRenderer-DYS9LSzA.js → WebGLRenderer-BHfrXEBc.js} +1 -1
  6. package/dist/assets/{WebGPURenderer-CDj9ZzDs.js → WebGPURenderer-DE5Q1Ilu.js} +1 -1
  7. package/dist/assets/{browserAll-B8FBs1Rt.js → browserAll-qg0ACMg1.js} +1 -1
  8. package/dist/assets/{ghostty-web-C6hNf21K.js → ghostty-web-D1cPLYOq.js} +1 -1
  9. package/dist/assets/{index-Cq8vn29r.js → index-B2AIdjev.js} +1 -1
  10. package/dist/assets/{index-Dj2t_cJN.js → index-BEpMDdcu.js} +1 -1
  11. package/dist/assets/{index-YEDqrGu6.js → index-BLmH2_gh.js} +221 -216
  12. package/dist/assets/{index-vJWwTEOs.js → index-BM_5Tg9c.js} +1 -1
  13. package/dist/assets/{index-CxF-jUR9.js → index-BQWvXpvf.js} +1 -1
  14. package/dist/assets/{index-BByfw4ws.js → index-BTEmB46j.js} +1 -1
  15. package/dist/assets/{index-Cja7GFdu.js → index-C8igR5_C.js} +1 -1
  16. package/dist/assets/{index-CLKNqdA1.js → index-CQRaC2Gn.js} +1 -1
  17. package/dist/assets/{index-FMaDFama.js → index-CSledjj-.js} +1 -1
  18. package/dist/assets/index-D1IhiEyy.css +1 -0
  19. package/dist/assets/{index-CFiXnV5n.js → index-D7oe-Hg-.js} +1 -1
  20. package/dist/assets/{index-CqDTsKqD.js → index-DBI0U-_m.js} +1 -1
  21. package/dist/assets/{index-CxCFae0J.js → index-DMpt0Kcu.js} +1 -1
  22. package/dist/assets/{index-BDu-q_RJ.js → index-DYz8XhtF.js} +1 -1
  23. package/dist/assets/{index-Drwn-PWd.js → index-DfNI0fNY.js} +1 -1
  24. package/dist/assets/{index-hID85NKg.js → index-DlK0frtF.js} +1 -1
  25. package/dist/assets/{index-BRrJSB9v.js → index-Gknjn7E7.js} +1 -1
  26. package/dist/assets/{webworkerAll-Pgv9S8Bp.js → webworkerAll-iHUuedbL.js} +1 -1
  27. package/dist/index.html +2 -2
  28. package/dist-ssg/client/.vite/ssr-manifest.json +3127 -616
  29. package/dist-ssg/client/assets/BufferResource-D81lYMLT.js +185 -0
  30. package/dist-ssg/client/assets/CanvasRenderer-BYIOuB-u.js +1 -0
  31. package/dist-ssg/client/assets/Filter-CeoA-Hyu.js +1 -0
  32. package/dist-ssg/client/assets/RenderTargetSystem-DXG3rON5.js +172 -0
  33. package/dist-ssg/client/assets/WebGLRenderer-C8QtcPPE.js +156 -0
  34. package/dist-ssg/client/assets/WebGPURenderer-TSulBBlS.js +41 -0
  35. package/dist-ssg/client/assets/browserAll-wG5chgko.js +14 -0
  36. package/dist-ssg/client/assets/gemini-Bk-V9kKu.png +0 -0
  37. package/dist-ssg/client/assets/{index-CbqRKbpG.js → index-BGCX0p5r.js} +1 -1
  38. package/dist-ssg/client/assets/{index-DYyM8Ux0.js → index-BPcWtlCR.js} +1 -1
  39. package/dist-ssg/client/assets/index-BRKO5Axs.js +7 -0
  40. package/dist-ssg/client/assets/{index-CuIbO-WR.js → index-BW2CaBe9.js} +1 -1
  41. package/dist-ssg/client/assets/{index-pf4chBPZ.js → index-C8IGL6vM.js} +1 -1
  42. package/dist-ssg/client/assets/{index-CNv54Jfz.js → index-Cj5wOcC4.js} +1 -1
  43. package/dist-ssg/client/assets/index-CjyblKoL.css +1 -0
  44. package/dist-ssg/client/assets/{index-C86U3e7F.js → index-CtoDt3iY.js} +1 -1
  45. package/dist-ssg/client/assets/{index-BuwmGUA3.js → index-D4YbeFcQ.js} +1 -1
  46. package/dist-ssg/client/assets/{index-8QkEUJki.js → index-DK_U1_Lh.js} +1 -1
  47. package/dist-ssg/client/assets/{index-BvdsW-5R.js → index-DMCE4Kkm.js} +1 -1
  48. package/dist-ssg/client/assets/{index-DTr_ZBFY.js → index-DRGqIcc0.js} +1 -1
  49. package/dist-ssg/client/assets/index-DqMkjeUD.js +1 -0
  50. package/dist-ssg/client/assets/{index-BNet68GQ.js → index-DuZ0AKLC.js} +1 -1
  51. package/dist-ssg/client/assets/{index-DGZn6OuM.js → index-bGllGkV0.js} +1 -1
  52. package/dist-ssg/client/assets/{index-qnT8Vltq.js → index-rbH3brrb.js} +1 -1
  53. package/dist-ssg/client/assets/index.ssg-BCAZPCWG.js +1535 -0
  54. package/dist-ssg/client/assets/webworkerAll-DisB_v8s.js +83 -0
  55. package/dist-ssg/client/index.ssg.html +2 -2
  56. package/dist-ssg/server/assets/BufferResource-BXrsGVSz.js +592 -0
  57. package/dist-ssg/server/assets/CanvasRenderer-D9aMd7WV.js +1530 -0
  58. package/dist-ssg/server/assets/Filter-ClU0-pLL.js +80 -0
  59. package/dist-ssg/server/assets/RenderTargetSystem-CVz6i60H.js +3037 -0
  60. package/dist-ssg/server/assets/WebGLRenderer-B0I5TP5d.js +3887 -0
  61. package/dist-ssg/server/assets/WebGPURenderer-DCgUFny7.js +2146 -0
  62. package/dist-ssg/server/assets/browserAll-BixK1BYs.js +2691 -0
  63. package/dist-ssg/server/assets/{index-nz5WUxV1.js → index-3uSTc-o9.js} +1 -1
  64. package/dist-ssg/server/assets/{index-CmaTLdHp.js → index-8uE7RyRi.js} +1 -1
  65. package/dist-ssg/server/assets/{index-Uo0092kH.js → index-BkJYfA64.js} +1 -1
  66. package/dist-ssg/server/assets/{index-B4YlAmAc.js → index-BvGNqnLD.js} +1 -1
  67. package/dist-ssg/server/assets/{index-8B1WJzeR.js → index-BvURgefh.js} +1 -1
  68. package/dist-ssg/server/assets/{index-DEVS1pbk.js → index-C2CuXbSQ.js} +1 -1
  69. package/dist-ssg/server/assets/{index-85lrvP9c.js → index-C3RtR5EA.js} +1 -1
  70. package/dist-ssg/server/assets/{index-Dr8hGWNq.js → index-CZtnphnE.js} +1 -1
  71. package/dist-ssg/server/assets/{index-cD9YNBBl.js → index-D0DRToHj.js} +1 -1
  72. package/dist-ssg/server/assets/{index-p0cUlQgG.js → index-D5MdLWau.js} +1 -1
  73. package/dist-ssg/server/assets/{index-BGh-0lci.js → index-DBYODvy4.js} +1 -1
  74. package/dist-ssg/server/assets/{index-Cv9QdO7F.js → index-DL23PkQi.js} +1 -1
  75. package/dist-ssg/server/assets/{index-MmnHcNid.js → index-DfcLdBOi.js} +1 -1
  76. package/dist-ssg/server/assets/{index-gsGirPQZ.js → index-O2XMojWG.js} +1 -1
  77. package/dist-ssg/server/assets/init-CnkBvt-J.js +666 -0
  78. package/dist-ssg/server/assets/webworkerAll-DNiMFaVV.js +12 -0
  79. package/dist-ssg/server/entry-server.js +47493 -11822
  80. package/dist-ssg/ssg-cli.mjs +0 -0
  81. package/package.json +25 -20
  82. package/LICENSE +0 -21
  83. package/dist/assets/index-DzNp3fwv.css +0 -1
  84. package/dist-ssg/client/assets/index-BPSmIo9z.css +0 -1
  85. package/dist-ssg/client/assets/index-CD7IUwmF.js +0 -1
  86. package/dist-ssg/client/assets/index-CtCbaXu2.js +0 -7
  87. package/dist-ssg/client/assets/index.ssg-BCf4nYjB.js +0 -633
@@ -1,4 +1,4 @@
1
- import{y as U,z as g,A as c,B as S,D as _,F as m,H as I,J as p}from"./index-YEDqrGu6.js";const x={name:"local-uniform-bit",vertex:{header:`
1
+ import{y as U,z as g,A as c,B as S,D as _,F as m,H as I,J as p}from"./index-BLmH2_gh.js";const x={name:"local-uniform-bit",vertex:{header:`
2
2
 
3
3
  struct LocalUniforms {
4
4
  uTransformMatrix:mat3x3<f32>,
@@ -1 +1 @@
1
- import{K as U,M as A,O as K,P as be,Q as ne,R as O,T as S,U as qe,y as Le,V as we,W as Ye,X as Ne,Y as Xe,Z as je,_ as $e,$ as Ke,a0 as Qe,a1 as ze,a2 as se}from"./index-YEDqrGu6.js";import{R as Je,S as Ze,B as et,a as tt,b as nt,c as at,A as st,C as ot}from"./RenderTargetSystem-DHoDBu3v.js";import"./Filter-trCu1CQG.js";let $;function Me(s){const e=U.get().createCanvas(6,1),t=e.getContext("2d");return t.fillStyle=s,t.fillRect(0,0,6,1),e}function Se(){if($!==void 0)return $;try{const s=Me("#ff00ff"),e=Me("#ffff00"),a=U.get().createCanvas(6,1).getContext("2d");a.globalCompositeOperation="multiply",a.drawImage(s,0,0),a.drawImage(e,2,0);const n=a.getImageData(2,0,1,1);if(!n)$=!1;else{const o=n.data;$=o[0]===255&&o[1]===0&&o[2]===0}}catch{$=!1}return $}const d={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:Se(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:s=>{const e=s.source,t=e?.resource;if(!t)return null;const a=e.alphaMode==="premultiplied-alpha",n=e.resourceWidth??e.pixelWidth,o=e.resourceHeight??e.pixelHeight,r=n!==e.pixelWidth||o!==e.pixelHeight;if(a){if((t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)&&!r)return t;const i=d._unpremultipliedCache.get(e);if(i?.resourceId===e._resourceId)return i.canvas}if(t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Uint32Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof ArrayBuffer){const i=d._canvasSourceCache.get(e);if(i?.resourceId===e._resourceId)return i.canvas;const c=U.get().createCanvas(e.pixelWidth,e.pixelHeight),h=c.getContext("2d"),l=h.createImageData(e.pixelWidth,e.pixelHeight),u=l.data,m=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(e.format==="bgra8unorm")for(let v=0;v<u.length&&v+3<m.length;v+=4)u[v]=m[v+2],u[v+1]=m[v+1],u[v+2]=m[v],u[v+3]=m[v+3];else u.set(m.subarray(0,u.length));return h.putImageData(l,0,0),d._canvasSourceCache.set(e,{canvas:c,resourceId:e._resourceId}),c}if(a){const i=U.get().createCanvas(e.pixelWidth,e.pixelHeight),c=i.getContext("2d",{willReadFrequently:!0});i.width=e.pixelWidth,i.height=e.pixelHeight,c.drawImage(t,0,0);const h=c.getImageData(0,0,i.width,i.height),l=h.data;for(let u=0;u<l.length;u+=4){const m=l[u+3];if(m>0){const v=255/m;l[u]=Math.min(255,l[u]*v+.5),l[u+1]=Math.min(255,l[u+1]*v+.5),l[u+2]=Math.min(255,l[u+2]*v+.5)}}return c.putImageData(h,0,0),d._unpremultipliedCache.set(e,{canvas:i,resourceId:e._resourceId}),i}if(r){const i=d._canvasSourceCache.get(e);if(i?.resourceId===e._resourceId)return i.canvas;const c=U.get().createCanvas(e.pixelWidth,e.pixelHeight),h=c.getContext("2d");return c.width=e.pixelWidth,c.height=e.pixelHeight,h.drawImage(t,0,0),d._canvasSourceCache.set(e,{canvas:c,resourceId:e._resourceId}),c}return t},getTintedCanvas:(s,e)=>{const t=s.texture,a=K.shared.setValue(e).toHex(),n=t.tintCache||(t.tintCache={}),o=n[a],r=t.source._resourceId;if(o?.tintId===r)return o;const i=o&&"getContext"in o?o:U.get().createCanvas();return d.tintMethod(t,e,i),i.tintId=r,n[a]=i,n[a]},getTintedPattern:(s,e)=>{const t=K.shared.setValue(e).toHex(),a=s.patternCache||(s.patternCache={}),n=s.source._resourceId;let o=a[t];return o?.tintId===n||(d.canvas||(d.canvas=U.get().createCanvas()),d.tintMethod(s,e,d.canvas),o=d.canvas.getContext("2d").createPattern(d.canvas,"repeat"),o.tintId=n,a[t]=o),o},applyPatternTransform:(s,e,t=!0)=>{if(!e)return;const a=s;if(!a.setTransform)return;const n=globalThis.DOMMatrix;if(!n)return;const o=new n([e.a,e.b,e.c,e.d,e.tx,e.ty]);a.setTransform(t?o.inverse():o)},tintWithMultiply:(s,e,t)=>{const a=t.getContext("2d"),n=s.frame.clone(),o=s.source._resolution??s.source.resolution??1,r=s.rotate;n.x*=o,n.y*=o,n.width*=o,n.height*=o;const i=A.isVertical(r),c=i?n.height:n.width,h=i?n.width:n.height;t.width=Math.ceil(c),t.height=Math.ceil(h),a.save(),a.fillStyle=K.shared.setValue(e).toHex(),a.fillRect(0,0,c,h),a.globalCompositeOperation="multiply";const l=d.getCanvasSource(s);if(!l){a.restore();return}r&&d._applyInverseRotation(a,r,n.width,n.height),a.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),a.globalCompositeOperation="destination-atop",a.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),a.restore()},tintWithOverlay:(s,e,t)=>{const a=t.getContext("2d"),n=s.frame.clone(),o=s.source._resolution??s.source.resolution??1,r=s.rotate;n.x*=o,n.y*=o,n.width*=o,n.height*=o;const i=A.isVertical(r),c=i?n.height:n.width,h=i?n.width:n.height;t.width=Math.ceil(c),t.height=Math.ceil(h),a.save(),a.globalCompositeOperation="copy",a.fillStyle=K.shared.setValue(e).toHex(),a.fillRect(0,0,c,h),a.globalCompositeOperation="destination-atop";const l=d.getCanvasSource(s);if(!l){a.restore();return}r&&d._applyInverseRotation(a,r,n.width,n.height),a.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),a.restore()},tintWithPerPixel:(s,e,t)=>{const a=t.getContext("2d"),n=s.frame.clone(),o=s.source._resolution??s.source.resolution??1,r=s.rotate;n.x*=o,n.y*=o,n.width*=o,n.height*=o;const i=A.isVertical(r),c=i?n.height:n.width,h=i?n.width:n.height;t.width=Math.ceil(c),t.height=Math.ceil(h),a.save(),a.globalCompositeOperation="copy";const l=d.getCanvasSource(s);if(!l){a.restore();return}r&&d._applyInverseRotation(a,r,n.width,n.height),a.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),a.restore();const u=e>>16&255,m=e>>8&255,v=e&255,k=a.getImageData(0,0,c,h),T=k.data;for(let C=0;C<T.length;C+=4)T[C]=T[C]*u/255,T[C+1]=T[C+1]*m/255,T[C+2]=T[C+2]*v/255;a.putImageData(k,0,0)},_applyInverseRotation:(s,e,t,a)=>{const n=A.inv(e),o=A.uX(n),r=A.uY(n),i=A.vX(n),c=A.vY(n),h=-Math.min(0,o*t,i*a,o*t+i*a),l=-Math.min(0,r*t,c*a,r*t+c*a);s.transform(o,r,i,c,h,l)}};d.tintMethod=d.canUseMultiply?d.tintWithMultiply:d.tintWithPerPixel;const fe=class L{static _getPatternRepeat(e,t){const a=e&&e!=="clamp-to-edge",n=t&&t!=="clamp-to-edge";return a&&n?"repeat":a?"repeat-x":n?"repeat-y":"no-repeat"}start(e,t,a){}execute(e,t){const a=t.elements;if(!a||!a.length)return;const n=e.renderer,o=n.canvasContext,r=o.activeContext;for(let i=0;i<a.length;i++){const c=a[i];if(!c.packAsQuad)continue;const h=c,l=h.texture,u=l?d.getCanvasSource(l):null;if(!u)continue;const m=l.source.style,v=o.smoothProperty,k=m.scaleMode!=="nearest";r[v]!==k&&(r[v]=k),o.setBlendMode(t.blendMode);const T=n.globalUniforms.globalUniformData?.worldColor??4294967295,C=h.color,B=(T>>>24&255)/255,P=(C>>>24&255)/255,H=n.filter?.alphaMultiplier??1,V=B*P*H;if(V<=0)continue;r.globalAlpha=V;const J=T&16777215,b=C&16777215,F=be(ne(b,J)),W=l.frame,Q=m.addressModeU??m.addressMode,Y=m.addressModeV??m.addressMode,g=L._getPatternRepeat(Q,Y),y=l.source._resolution??l.source.resolution??1,x=h.renderable?.renderGroup?.isCachedAsTexture,G=W.x*y,N=W.y*y,w=W.width*y,E=W.height*y,_=h.bounds,I=n.renderTarget.renderTarget.isRoot,R=_.minX,z=_.minY,q=_.maxX-_.minX,D=_.maxY-_.minY,M=l.rotate,p=l.uvs,oe=Math.min(p.x0,p.x1,p.x2,p.x3,p.y0,p.y1,p.y2,p.y3),Ee=Math.max(p.x0,p.x1,p.x2,p.x3,p.y0,p.y1,p.y2,p.y3),ge=g!=="no-repeat"&&(oe<0||Ee>1),re=M&&!(!ge&&(F!==16777215||M));re?(L._tempPatternMatrix.copyFrom(h.transform),A.matrixAppendRotationInv(L._tempPatternMatrix,M,R,z,q,D),o.setContextTransform(L._tempPatternMatrix,h.roundPixels===1,void 0,x&&I)):o.setContextTransform(h.transform,h.roundPixels===1,void 0,x&&I);const Z=re?0:R,ee=re?0:z,ie=q,ce=D;if(ge){let le=u;const X=F!==16777215&&!M,j=W.width<=l.source.width&&W.height<=l.source.height;X&&j&&(le=d.getTintedCanvas({texture:l},F));const he=r.createPattern(le,g);if(!he)continue;const me=ie,ve=ce;if(me===0||ve===0)continue;const ye=1/me,Ce=1/ve,xe=(p.x1-p.x0)*ye,Te=(p.y1-p.y0)*ye,Pe=(p.x3-p.x0)*Ce,_e=(p.y3-p.y0)*Ce,Ve=p.x0-xe*Z-Pe*ee,Fe=p.y0-Te*Z-_e*ee,de=l.source.pixelWidth,pe=l.source.pixelHeight;L._tempPatternMatrix.set(xe*de,Te*pe,Pe*de,_e*pe,Ve*de,Fe*pe),d.applyPatternTransform(he,L._tempPatternMatrix),r.fillStyle=he,r.fillRect(Z,ee,ie,ce)}else{const X=F!==16777215||M?d.getTintedCanvas({texture:l},F):u,j=X!==u;r.drawImage(X,j?0:G,j?0:N,j?X.width:w,j?X.height:E,Z,ee,ie,ce)}}}};fe._tempPatternMatrix=new O;fe.extension={type:[S.CanvasPipesAdaptor],name:"batch"};let rt=fe;class ke{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,a){this._renderer.renderPipes.batch.break(a);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;const o=this._colorStack[this._colorStackIndex];o!==this._currentColor&&(this._currentColor=o,a.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1})),this._colorStackIndex++}pop(e,t,a){this._renderer.renderPipes.batch.break(a);const n=this._colorStack;this._colorStackIndex--;const o=n[this._colorStackIndex-1];o!==this._currentColor&&(this._currentColor=o,a.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}ke.extension={type:[S.CanvasPipes],name:"colorMask"};function it(s,e,t,a,n,o){o=Math.max(0,Math.min(o,Math.min(a,n)/2)),s.moveTo(e+o,t),s.lineTo(e+a-o,t),s.quadraticCurveTo(e+a,t,e+a,t+o),s.lineTo(e+a,t+n-o),s.quadraticCurveTo(e+a,t+n,e+a-o,t+n),s.lineTo(e+o,t+n),s.quadraticCurveTo(e,t+n,e,t+n-o),s.lineTo(e,t+o),s.quadraticCurveTo(e,t,e+o,t)}function Ie(s,e){switch(e.type){case"rectangle":{const t=e;s.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;it(s,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;s.moveTo(t.x+t.radius,t.y),s.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;s.ellipse?(s.moveTo(t.x+t.halfWidth,t.y),s.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2)):(s.save(),s.translate(t.x,t.y),s.scale(t.halfWidth,t.halfHeight),s.moveTo(1,0),s.arc(0,0,1,0,Math.PI*2),s.restore());break}case"triangle":{const t=e;s.moveTo(t.x,t.y),s.lineTo(t.x2,t.y2),s.lineTo(t.x3,t.y3),s.closePath();break}default:{const t=e,a=t.points;if(!a?.length)break;s.moveTo(a[0],a[1]);for(let n=2;n<a.length;n+=2)s.lineTo(a[n],a[n+1]);t.closePath&&s.closePath();break}}}function ct(s,e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(!a?.shape)continue;const n=a.transform,o=n&&!n.isIdentity();o&&(s.save(),s.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),Ie(s,a.shape),o&&s.restore()}return!0}class Re{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,a){this._renderer.renderPipes.batch.break(a),a.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,a){this._renderer.renderPipes.batch.break(a),a.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){if(e.action!=="pushMaskBegin"&&e.action!=="popMaskEnd")return;const t=this._renderer,a=t.canvasContext,n=a?.activeContext;if(!n)return;if(e.action==="popMaskEnd"){this._canvasMaskStack.pop()&&n.restore();return}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const o=e.mask.mask;if(!(o instanceof qe)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const r=o,i=r.context?.instructions;if(!i?.length){this._canvasMaskStack.push(!1);return}n.save(),a.setContextTransform(r.groupTransform,(t._roundPixels|r._roundPixels)===1),n.beginPath();let c=!1,h=!1;for(let l=0;l<i.length;l++){const u=i[l],m=u.action;if(m!=="fill"&&m!=="stroke")continue;const k=u.data?.path?.shapePath;if(!k?.shapePrimitives?.length)continue;const T=k.shapePrimitives;for(let C=0;C<T.length;C++){const B=T[C];if(!B?.shape)continue;const P=B.transform,H=P&&!P.isIdentity();H&&(n.save(),n.transform(P.a,P.b,P.c,P.d,P.tx,P.ty)),Ie(n,B.shape),h=ct(n,B.holes)||h,c=!0,H&&n.restore()}}if(!c){n.restore(),this._canvasMaskStack.push(!1);return}h?n.clip("evenodd"):n.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(e,t){this._warnedMaskTypes.has(e)||(this._warnedMaskTypes.add(e),Le(t))}}Re.extension={type:[S.CanvasPipes],name:"stencilMask"};const f="source-over";function lt(){const s=Se(),e=Object.create(null);return e.inherit=f,e.none=f,e.normal="source-over",e.add="lighter",e.multiply=s?"multiply":f,e.screen=s?"screen":f,e.overlay=s?"overlay":f,e.darken=s?"darken":f,e.lighten=s?"lighten":f,e["color-dodge"]=s?"color-dodge":f,e["color-burn"]=s?"color-burn":f,e["hard-light"]=s?"hard-light":f,e["soft-light"]=s?"soft-light":f,e.difference=s?"difference":f,e.exclusion=s?"exclusion":f,e.saturation=s?"saturation":f,e.color=s?"color":f,e.luminosity=s?"luminosity":f,e["linear-burn"]=s?"color-burn":f,e["linear-dodge"]=s?"color-dodge":f,e["linear-light"]=s?"hard-light":f,e["pin-light"]=s?"hard-light":f,e["vivid-light"]=s?"hard-light":f,e["hard-mix"]=f,e.negation=s?"difference":f,e["normal-npm"]=e.normal,e["add-npm"]=e.add,e["screen-npm"]=e.screen,e.erase="destination-out",e.subtract=f,e.divide=f,e.min=f,e.max=f,e}const ht=new O;class Ae{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=lt(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=e}resolutionChange(e){this.activeResolution=e}init(){const e=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:e}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const t=this.rootContext;t.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":t.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":t.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":t.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,a,n){const o=n?O.IDENTITY:this._renderer.globalUniforms.globalUniformData?.worldTransformMatrix||O.IDENTITY;let r=ht;r.copyFrom(o),r.append(e);const i=this._projTransform,c=this.activeResolution;if(a=a||c,i){const h=O.shared;h.copyFrom(r),h.prepend(i),r=h}t?this.activeContext.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*c|0,r.ty*c|0):this.activeContext.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*c,r.ty*c)}clear(e,t){const a=this.activeContext,n=this._renderer;if(a.clearRect(0,0,n.width,n.height),e){const o=K.shared.setValue(e);a.globalAlpha=t??o.alpha,a.fillStyle=o.toHex(),a.fillRect(0,0,n.width,n.height),a.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t){this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}Ae.extension={type:[S.CanvasSystem],name:"canvasContext"};class Be{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}Be.extension={type:[S.CanvasSystem],name:"limits"};const dt="#808080",te=new O,pt=new O,ut=new O,ue=new O;function ft(s,e,t){s.beginPath();for(let a=0;a<t.length;a+=3){const n=t[a]*2,o=t[a+1]*2,r=t[a+2]*2;s.moveTo(e[n],e[n+1]),s.lineTo(e[o],e[o+1]),s.lineTo(e[r],e[r+1]),s.closePath()}s.fill()}function gt(s){return`#${(s&16777215).toString(16).padStart(6,"0")}`}function mt(s,e,t,a,n,o){o=Math.max(0,Math.min(o,Math.min(a,n)/2)),s.moveTo(e+o,t),s.lineTo(e+a-o,t),s.quadraticCurveTo(e+a,t,e+a,t+o),s.lineTo(e+a,t+n-o),s.quadraticCurveTo(e+a,t+n,e+a-o,t+n),s.lineTo(e+o,t+n),s.quadraticCurveTo(e,t+n,e,t+n-o),s.lineTo(e,t+o),s.quadraticCurveTo(e,t,e+o,t)}function ae(s,e){switch(e.type){case"rectangle":{const t=e;s.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;mt(s,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;s.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;s.ellipse?s.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2):(s.save(),s.translate(t.x,t.y),s.scale(t.halfWidth,t.halfHeight),s.arc(0,0,1,0,Math.PI*2),s.restore());break}case"triangle":{const t=e;s.moveTo(t.x,t.y),s.lineTo(t.x2,t.y2),s.lineTo(t.x3,t.y3),s.closePath();break}default:{const t=e,a=t.points;if(!a?.length)break;s.moveTo(a[0],a[1]);for(let n=2;n<a.length;n+=2)s.lineTo(a[n],a[n+1]);t.closePath&&s.closePath();break}}}function vt(s,e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(!a?.shape)continue;const n=a.transform,o=n&&!n.isIdentity();o&&(s.save(),s.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),ae(s,a.shape),o&&s.restore()}return!0}function yt(s,e,t,a){const n=s.fill;if(n instanceof je){n.buildGradient();const r=n.texture;if(r){const i=d.getTintedPattern(r,e),c=t?ue.copyFrom(t).scale(r.source.pixelWidth,r.source.pixelHeight):ue.copyFrom(n.transform);return a&&!s.textureSpace&&c.append(a),d.applyPatternTransform(i,c),i}}if(n instanceof $e){const r=d.getTintedPattern(n.texture,e);return d.applyPatternTransform(r,n.transform),r}const o=s.texture;if(o&&o!==we.WHITE){if(!o.source.resource)return dt;const r=d.getTintedPattern(o,e),i=t?ue.copyFrom(t).scale(o.source.pixelWidth,o.source.pixelHeight):s.matrix;return d.applyPatternTransform(r,i),r}return gt(e)}class He{constructor(){this.shader=null}contextChange(e){}execute(e,t){const a=e.renderer,n=a.canvasContext,o=n.activeContext,r=t.groupTransform,i=a.globalUniforms.globalUniformData?.worldColor??4294967295,c=t.groupColorAlpha,h=(i>>>24&255)/255,l=(c>>>24&255)/255,u=a.filter?.alphaMultiplier??1,m=h*l*u;if(m<=0)return;const v=i&16777215,k=c&16777215,T=be(ne(k,v)),C=a._roundPixels|t._roundPixels;o.save(),n.setContextTransform(r,C===1),n.setBlendMode(t.groupBlendMode);const B=t.context.instructions;for(let P=0;P<B.length;P++){const H=B[P];if(H.action==="texture"){const g=H.data,y=g.image,x=y?d.getCanvasSource(y):null;if(!x)continue;const G=g.alpha*m;if(G<=0)continue;const N=ne(g.style,T);o.globalAlpha=G;let w=x;N!==16777215&&(w=d.getTintedCanvas({texture:y},N));const E=y.frame,_=y.source._resolution??y.source.resolution??1;let I=E.x*_,R=E.y*_;const z=E.width*_,q=E.height*_;w!==x&&(I=0,R=0);const D=g.transform,M=D&&!D.isIdentity(),p=y.rotate;M||p?(te.copyFrom(r),M&&te.append(D),p&&A.matrixAppendRotationInv(te,p,g.dx,g.dy,g.dw,g.dh),n.setContextTransform(te,C===1)):n.setContextTransform(r,C===1),o.drawImage(w,I,R,w===x?z:w.width,w===x?q:w.height,p?0:g.dx,p?0:g.dy,g.dw,g.dh),(M||p)&&n.setContextTransform(r,C===1);continue}const V=H.data,J=V?.path?.shapePath;if(!J?.shapePrimitives?.length)continue;const b=V.style,F=ne(b.color,T),W=b.alpha*m;if(W<=0)continue;const Q=H.action==="stroke";if(o.globalAlpha=W,Q){const g=b;o.lineWidth=g.width,o.lineCap=g.cap,o.lineJoin=g.join,o.miterLimit=g.miterLimit}const Y=J.shapePrimitives;if(!Q&&V.hole?.shapePath?.shapePrimitives?.length){const g=Y[Y.length-1];g.holes=V.hole.shapePath.shapePrimitives}for(let g=0;g<Y.length;g++){const y=Y[g];if(!y?.shape)continue;const x=y.transform,G=x&&!x.isIdentity(),N=b.texture&&b.texture!==we.WHITE,w=b.textureSpace==="global"?x:null,E=N?Ye(pt,b,y.shape,w):null,_=G?ut.copyFrom(r).append(x):r,I=yt(b,F,E,_);if(G&&(o.save(),o.transform(x.a,x.b,x.c,x.d,x.tx,x.ty)),Q){const R=b;if(R.alignment!==.5&&!R.pixelLine){const q=[],D=[],M=[];if(Ne[y.shape.type]?.build(y.shape,q)){const oe=y.shape.closePath??!0;Xe(q,R,!1,oe,D,M),o.fillStyle=I,ft(o,D,M)}else o.strokeStyle=I,o.beginPath(),ae(o,y.shape),o.stroke()}else o.strokeStyle=I,o.beginPath(),ae(o,y.shape),o.stroke()}else o.fillStyle=I,o.beginPath(),ae(o,y.shape),vt(o,y.holes)?o.fill("evenodd"):o.fill();G&&o.restore()}}o.restore()}destroy(){this.shader=null}}He.extension={type:[S.CanvasPipesAdaptor],name:"graphics"};class Ct{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:a,context:n}=this._ensureCanvas(t);return{canvas:a,context:n,width:a.width,height:a.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:a}=this._ensureCanvas(t);a.width=e.pixelWidth,a.height=e.pixelHeight}startRenderPass(e,t,a,n){const o=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=o.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,a,n)}clear(e,t,a,n){const r=this._renderTargetSystem.getGpuRenderTarget(e).context,i=n||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(r.setTransform(1,0,0,1,0,0),r.clearRect(i.x,i.y,i.width,i.height),a){const c=K.shared.setValue(a);c.alpha>0&&(r.globalAlpha=c.alpha,r.fillStyle=c.toHex(),r.fillRect(i.x,i.y,i.width,i.height),r.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,a,n,o){const i=this._renderTargetSystem.getGpuRenderTarget(e).canvas,c=t.source,{context:h}=this._ensureCanvas(c),l=o?.x??0,u=o?.y??0;return h.drawImage(i,a.x,a.y,n.width,n.height,l,u,n.width,n.height),c.update(),t}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;(!t||!Ke.test(t))&&(t=U.get().createCanvas(e.pixelWidth,e.pixelHeight),e.resource=t),(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(t.width=e.pixelWidth,t.height=e.pixelHeight);const a=t.getContext("2d");return{canvas:t,context:a}}}class We extends Je{constructor(e){super(e),this.adaptor=new Ct,this.adaptor.init(e,this)}}We.extension={type:[S.CanvasSystem],name:"renderTarget"};class De{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=U.get().createCanvas(),a=t.getContext("2d"),n=d.getCanvasSource(e);if(!n)return t;const o=e.frame,r=e.source._resolution??e.source.resolution??1,i=o.x*r,c=o.y*r,h=o.width*r,l=o.height*r;return t.width=Math.ceil(h),t.height=Math.ceil(l),a.drawImage(n,i,c,h,l,0,0,h,l),t}getPixels(e){const t=this.generateCanvas(e);return{pixels:t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}destroy(){}}De.extension={type:[S.CanvasSystem],name:"texture"};const xt=[...Ze,Ae,Be,De,We],Tt=[et,tt,nt,at,st,Re,ke,ot],Pt=[rt,He],Ue=[],Oe=[],Ge=[];se.handleByNamedList(S.CanvasSystem,Ue);se.handleByNamedList(S.CanvasPipes,Oe);se.handleByNamedList(S.CanvasPipesAdaptor,Ge);se.add(...xt,...Tt,...Pt);class St extends Qe{constructor(){const e={name:"canvas",type:ze.CANVAS,systems:Ue,renderPipes:Oe,renderPipeAdaptors:Ge};super(e)}}export{St as CanvasRenderer};
1
+ import{K as U,M as A,O as K,P as be,Q as ne,R as O,T as S,U as qe,y as Le,V as we,W as Ye,X as Ne,Y as Xe,Z as je,_ as $e,$ as Ke,a0 as Qe,a1 as ze,a2 as se}from"./index-BLmH2_gh.js";import{R as Je,S as Ze,B as et,a as tt,b as nt,c as at,A as st,C as ot}from"./RenderTargetSystem-D4qtRaUW.js";import"./Filter-MPAI5-Oj.js";let $;function Me(s){const e=U.get().createCanvas(6,1),t=e.getContext("2d");return t.fillStyle=s,t.fillRect(0,0,6,1),e}function Se(){if($!==void 0)return $;try{const s=Me("#ff00ff"),e=Me("#ffff00"),a=U.get().createCanvas(6,1).getContext("2d");a.globalCompositeOperation="multiply",a.drawImage(s,0,0),a.drawImage(e,2,0);const n=a.getImageData(2,0,1,1);if(!n)$=!1;else{const o=n.data;$=o[0]===255&&o[1]===0&&o[2]===0}}catch{$=!1}return $}const d={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:Se(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:s=>{const e=s.source,t=e?.resource;if(!t)return null;const a=e.alphaMode==="premultiplied-alpha",n=e.resourceWidth??e.pixelWidth,o=e.resourceHeight??e.pixelHeight,r=n!==e.pixelWidth||o!==e.pixelHeight;if(a){if((t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)&&!r)return t;const i=d._unpremultipliedCache.get(e);if(i?.resourceId===e._resourceId)return i.canvas}if(t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Uint32Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof ArrayBuffer){const i=d._canvasSourceCache.get(e);if(i?.resourceId===e._resourceId)return i.canvas;const c=U.get().createCanvas(e.pixelWidth,e.pixelHeight),h=c.getContext("2d"),l=h.createImageData(e.pixelWidth,e.pixelHeight),u=l.data,m=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(e.format==="bgra8unorm")for(let v=0;v<u.length&&v+3<m.length;v+=4)u[v]=m[v+2],u[v+1]=m[v+1],u[v+2]=m[v],u[v+3]=m[v+3];else u.set(m.subarray(0,u.length));return h.putImageData(l,0,0),d._canvasSourceCache.set(e,{canvas:c,resourceId:e._resourceId}),c}if(a){const i=U.get().createCanvas(e.pixelWidth,e.pixelHeight),c=i.getContext("2d",{willReadFrequently:!0});i.width=e.pixelWidth,i.height=e.pixelHeight,c.drawImage(t,0,0);const h=c.getImageData(0,0,i.width,i.height),l=h.data;for(let u=0;u<l.length;u+=4){const m=l[u+3];if(m>0){const v=255/m;l[u]=Math.min(255,l[u]*v+.5),l[u+1]=Math.min(255,l[u+1]*v+.5),l[u+2]=Math.min(255,l[u+2]*v+.5)}}return c.putImageData(h,0,0),d._unpremultipliedCache.set(e,{canvas:i,resourceId:e._resourceId}),i}if(r){const i=d._canvasSourceCache.get(e);if(i?.resourceId===e._resourceId)return i.canvas;const c=U.get().createCanvas(e.pixelWidth,e.pixelHeight),h=c.getContext("2d");return c.width=e.pixelWidth,c.height=e.pixelHeight,h.drawImage(t,0,0),d._canvasSourceCache.set(e,{canvas:c,resourceId:e._resourceId}),c}return t},getTintedCanvas:(s,e)=>{const t=s.texture,a=K.shared.setValue(e).toHex(),n=t.tintCache||(t.tintCache={}),o=n[a],r=t.source._resourceId;if(o?.tintId===r)return o;const i=o&&"getContext"in o?o:U.get().createCanvas();return d.tintMethod(t,e,i),i.tintId=r,n[a]=i,n[a]},getTintedPattern:(s,e)=>{const t=K.shared.setValue(e).toHex(),a=s.patternCache||(s.patternCache={}),n=s.source._resourceId;let o=a[t];return o?.tintId===n||(d.canvas||(d.canvas=U.get().createCanvas()),d.tintMethod(s,e,d.canvas),o=d.canvas.getContext("2d").createPattern(d.canvas,"repeat"),o.tintId=n,a[t]=o),o},applyPatternTransform:(s,e,t=!0)=>{if(!e)return;const a=s;if(!a.setTransform)return;const n=globalThis.DOMMatrix;if(!n)return;const o=new n([e.a,e.b,e.c,e.d,e.tx,e.ty]);a.setTransform(t?o.inverse():o)},tintWithMultiply:(s,e,t)=>{const a=t.getContext("2d"),n=s.frame.clone(),o=s.source._resolution??s.source.resolution??1,r=s.rotate;n.x*=o,n.y*=o,n.width*=o,n.height*=o;const i=A.isVertical(r),c=i?n.height:n.width,h=i?n.width:n.height;t.width=Math.ceil(c),t.height=Math.ceil(h),a.save(),a.fillStyle=K.shared.setValue(e).toHex(),a.fillRect(0,0,c,h),a.globalCompositeOperation="multiply";const l=d.getCanvasSource(s);if(!l){a.restore();return}r&&d._applyInverseRotation(a,r,n.width,n.height),a.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),a.globalCompositeOperation="destination-atop",a.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),a.restore()},tintWithOverlay:(s,e,t)=>{const a=t.getContext("2d"),n=s.frame.clone(),o=s.source._resolution??s.source.resolution??1,r=s.rotate;n.x*=o,n.y*=o,n.width*=o,n.height*=o;const i=A.isVertical(r),c=i?n.height:n.width,h=i?n.width:n.height;t.width=Math.ceil(c),t.height=Math.ceil(h),a.save(),a.globalCompositeOperation="copy",a.fillStyle=K.shared.setValue(e).toHex(),a.fillRect(0,0,c,h),a.globalCompositeOperation="destination-atop";const l=d.getCanvasSource(s);if(!l){a.restore();return}r&&d._applyInverseRotation(a,r,n.width,n.height),a.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),a.restore()},tintWithPerPixel:(s,e,t)=>{const a=t.getContext("2d"),n=s.frame.clone(),o=s.source._resolution??s.source.resolution??1,r=s.rotate;n.x*=o,n.y*=o,n.width*=o,n.height*=o;const i=A.isVertical(r),c=i?n.height:n.width,h=i?n.width:n.height;t.width=Math.ceil(c),t.height=Math.ceil(h),a.save(),a.globalCompositeOperation="copy";const l=d.getCanvasSource(s);if(!l){a.restore();return}r&&d._applyInverseRotation(a,r,n.width,n.height),a.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),a.restore();const u=e>>16&255,m=e>>8&255,v=e&255,k=a.getImageData(0,0,c,h),T=k.data;for(let C=0;C<T.length;C+=4)T[C]=T[C]*u/255,T[C+1]=T[C+1]*m/255,T[C+2]=T[C+2]*v/255;a.putImageData(k,0,0)},_applyInverseRotation:(s,e,t,a)=>{const n=A.inv(e),o=A.uX(n),r=A.uY(n),i=A.vX(n),c=A.vY(n),h=-Math.min(0,o*t,i*a,o*t+i*a),l=-Math.min(0,r*t,c*a,r*t+c*a);s.transform(o,r,i,c,h,l)}};d.tintMethod=d.canUseMultiply?d.tintWithMultiply:d.tintWithPerPixel;const fe=class L{static _getPatternRepeat(e,t){const a=e&&e!=="clamp-to-edge",n=t&&t!=="clamp-to-edge";return a&&n?"repeat":a?"repeat-x":n?"repeat-y":"no-repeat"}start(e,t,a){}execute(e,t){const a=t.elements;if(!a||!a.length)return;const n=e.renderer,o=n.canvasContext,r=o.activeContext;for(let i=0;i<a.length;i++){const c=a[i];if(!c.packAsQuad)continue;const h=c,l=h.texture,u=l?d.getCanvasSource(l):null;if(!u)continue;const m=l.source.style,v=o.smoothProperty,k=m.scaleMode!=="nearest";r[v]!==k&&(r[v]=k),o.setBlendMode(t.blendMode);const T=n.globalUniforms.globalUniformData?.worldColor??4294967295,C=h.color,B=(T>>>24&255)/255,P=(C>>>24&255)/255,H=n.filter?.alphaMultiplier??1,V=B*P*H;if(V<=0)continue;r.globalAlpha=V;const J=T&16777215,b=C&16777215,F=be(ne(b,J)),W=l.frame,Q=m.addressModeU??m.addressMode,Y=m.addressModeV??m.addressMode,g=L._getPatternRepeat(Q,Y),y=l.source._resolution??l.source.resolution??1,x=h.renderable?.renderGroup?.isCachedAsTexture,G=W.x*y,N=W.y*y,w=W.width*y,E=W.height*y,_=h.bounds,I=n.renderTarget.renderTarget.isRoot,R=_.minX,z=_.minY,q=_.maxX-_.minX,D=_.maxY-_.minY,M=l.rotate,p=l.uvs,oe=Math.min(p.x0,p.x1,p.x2,p.x3,p.y0,p.y1,p.y2,p.y3),Ee=Math.max(p.x0,p.x1,p.x2,p.x3,p.y0,p.y1,p.y2,p.y3),ge=g!=="no-repeat"&&(oe<0||Ee>1),re=M&&!(!ge&&(F!==16777215||M));re?(L._tempPatternMatrix.copyFrom(h.transform),A.matrixAppendRotationInv(L._tempPatternMatrix,M,R,z,q,D),o.setContextTransform(L._tempPatternMatrix,h.roundPixels===1,void 0,x&&I)):o.setContextTransform(h.transform,h.roundPixels===1,void 0,x&&I);const Z=re?0:R,ee=re?0:z,ie=q,ce=D;if(ge){let le=u;const X=F!==16777215&&!M,j=W.width<=l.source.width&&W.height<=l.source.height;X&&j&&(le=d.getTintedCanvas({texture:l},F));const he=r.createPattern(le,g);if(!he)continue;const me=ie,ve=ce;if(me===0||ve===0)continue;const ye=1/me,Ce=1/ve,xe=(p.x1-p.x0)*ye,Te=(p.y1-p.y0)*ye,Pe=(p.x3-p.x0)*Ce,_e=(p.y3-p.y0)*Ce,Ve=p.x0-xe*Z-Pe*ee,Fe=p.y0-Te*Z-_e*ee,de=l.source.pixelWidth,pe=l.source.pixelHeight;L._tempPatternMatrix.set(xe*de,Te*pe,Pe*de,_e*pe,Ve*de,Fe*pe),d.applyPatternTransform(he,L._tempPatternMatrix),r.fillStyle=he,r.fillRect(Z,ee,ie,ce)}else{const X=F!==16777215||M?d.getTintedCanvas({texture:l},F):u,j=X!==u;r.drawImage(X,j?0:G,j?0:N,j?X.width:w,j?X.height:E,Z,ee,ie,ce)}}}};fe._tempPatternMatrix=new O;fe.extension={type:[S.CanvasPipesAdaptor],name:"batch"};let rt=fe;class ke{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,a){this._renderer.renderPipes.batch.break(a);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;const o=this._colorStack[this._colorStackIndex];o!==this._currentColor&&(this._currentColor=o,a.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1})),this._colorStackIndex++}pop(e,t,a){this._renderer.renderPipes.batch.break(a);const n=this._colorStack;this._colorStackIndex--;const o=n[this._colorStackIndex-1];o!==this._currentColor&&(this._currentColor=o,a.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}ke.extension={type:[S.CanvasPipes],name:"colorMask"};function it(s,e,t,a,n,o){o=Math.max(0,Math.min(o,Math.min(a,n)/2)),s.moveTo(e+o,t),s.lineTo(e+a-o,t),s.quadraticCurveTo(e+a,t,e+a,t+o),s.lineTo(e+a,t+n-o),s.quadraticCurveTo(e+a,t+n,e+a-o,t+n),s.lineTo(e+o,t+n),s.quadraticCurveTo(e,t+n,e,t+n-o),s.lineTo(e,t+o),s.quadraticCurveTo(e,t,e+o,t)}function Ie(s,e){switch(e.type){case"rectangle":{const t=e;s.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;it(s,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;s.moveTo(t.x+t.radius,t.y),s.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;s.ellipse?(s.moveTo(t.x+t.halfWidth,t.y),s.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2)):(s.save(),s.translate(t.x,t.y),s.scale(t.halfWidth,t.halfHeight),s.moveTo(1,0),s.arc(0,0,1,0,Math.PI*2),s.restore());break}case"triangle":{const t=e;s.moveTo(t.x,t.y),s.lineTo(t.x2,t.y2),s.lineTo(t.x3,t.y3),s.closePath();break}default:{const t=e,a=t.points;if(!a?.length)break;s.moveTo(a[0],a[1]);for(let n=2;n<a.length;n+=2)s.lineTo(a[n],a[n+1]);t.closePath&&s.closePath();break}}}function ct(s,e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(!a?.shape)continue;const n=a.transform,o=n&&!n.isIdentity();o&&(s.save(),s.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),Ie(s,a.shape),o&&s.restore()}return!0}class Re{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,a){this._renderer.renderPipes.batch.break(a),a.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,a){this._renderer.renderPipes.batch.break(a),a.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){if(e.action!=="pushMaskBegin"&&e.action!=="popMaskEnd")return;const t=this._renderer,a=t.canvasContext,n=a?.activeContext;if(!n)return;if(e.action==="popMaskEnd"){this._canvasMaskStack.pop()&&n.restore();return}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const o=e.mask.mask;if(!(o instanceof qe)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const r=o,i=r.context?.instructions;if(!i?.length){this._canvasMaskStack.push(!1);return}n.save(),a.setContextTransform(r.groupTransform,(t._roundPixels|r._roundPixels)===1),n.beginPath();let c=!1,h=!1;for(let l=0;l<i.length;l++){const u=i[l],m=u.action;if(m!=="fill"&&m!=="stroke")continue;const k=u.data?.path?.shapePath;if(!k?.shapePrimitives?.length)continue;const T=k.shapePrimitives;for(let C=0;C<T.length;C++){const B=T[C];if(!B?.shape)continue;const P=B.transform,H=P&&!P.isIdentity();H&&(n.save(),n.transform(P.a,P.b,P.c,P.d,P.tx,P.ty)),Ie(n,B.shape),h=ct(n,B.holes)||h,c=!0,H&&n.restore()}}if(!c){n.restore(),this._canvasMaskStack.push(!1);return}h?n.clip("evenodd"):n.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(e,t){this._warnedMaskTypes.has(e)||(this._warnedMaskTypes.add(e),Le(t))}}Re.extension={type:[S.CanvasPipes],name:"stencilMask"};const f="source-over";function lt(){const s=Se(),e=Object.create(null);return e.inherit=f,e.none=f,e.normal="source-over",e.add="lighter",e.multiply=s?"multiply":f,e.screen=s?"screen":f,e.overlay=s?"overlay":f,e.darken=s?"darken":f,e.lighten=s?"lighten":f,e["color-dodge"]=s?"color-dodge":f,e["color-burn"]=s?"color-burn":f,e["hard-light"]=s?"hard-light":f,e["soft-light"]=s?"soft-light":f,e.difference=s?"difference":f,e.exclusion=s?"exclusion":f,e.saturation=s?"saturation":f,e.color=s?"color":f,e.luminosity=s?"luminosity":f,e["linear-burn"]=s?"color-burn":f,e["linear-dodge"]=s?"color-dodge":f,e["linear-light"]=s?"hard-light":f,e["pin-light"]=s?"hard-light":f,e["vivid-light"]=s?"hard-light":f,e["hard-mix"]=f,e.negation=s?"difference":f,e["normal-npm"]=e.normal,e["add-npm"]=e.add,e["screen-npm"]=e.screen,e.erase="destination-out",e.subtract=f,e.divide=f,e.min=f,e.max=f,e}const ht=new O;class Ae{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=lt(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=e}resolutionChange(e){this.activeResolution=e}init(){const e=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:e}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const t=this.rootContext;t.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":t.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":t.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":t.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,a,n){const o=n?O.IDENTITY:this._renderer.globalUniforms.globalUniformData?.worldTransformMatrix||O.IDENTITY;let r=ht;r.copyFrom(o),r.append(e);const i=this._projTransform,c=this.activeResolution;if(a=a||c,i){const h=O.shared;h.copyFrom(r),h.prepend(i),r=h}t?this.activeContext.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*c|0,r.ty*c|0):this.activeContext.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*c,r.ty*c)}clear(e,t){const a=this.activeContext,n=this._renderer;if(a.clearRect(0,0,n.width,n.height),e){const o=K.shared.setValue(e);a.globalAlpha=t??o.alpha,a.fillStyle=o.toHex(),a.fillRect(0,0,n.width,n.height),a.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t){this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}Ae.extension={type:[S.CanvasSystem],name:"canvasContext"};class Be{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}Be.extension={type:[S.CanvasSystem],name:"limits"};const dt="#808080",te=new O,pt=new O,ut=new O,ue=new O;function ft(s,e,t){s.beginPath();for(let a=0;a<t.length;a+=3){const n=t[a]*2,o=t[a+1]*2,r=t[a+2]*2;s.moveTo(e[n],e[n+1]),s.lineTo(e[o],e[o+1]),s.lineTo(e[r],e[r+1]),s.closePath()}s.fill()}function gt(s){return`#${(s&16777215).toString(16).padStart(6,"0")}`}function mt(s,e,t,a,n,o){o=Math.max(0,Math.min(o,Math.min(a,n)/2)),s.moveTo(e+o,t),s.lineTo(e+a-o,t),s.quadraticCurveTo(e+a,t,e+a,t+o),s.lineTo(e+a,t+n-o),s.quadraticCurveTo(e+a,t+n,e+a-o,t+n),s.lineTo(e+o,t+n),s.quadraticCurveTo(e,t+n,e,t+n-o),s.lineTo(e,t+o),s.quadraticCurveTo(e,t,e+o,t)}function ae(s,e){switch(e.type){case"rectangle":{const t=e;s.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;mt(s,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;s.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;s.ellipse?s.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2):(s.save(),s.translate(t.x,t.y),s.scale(t.halfWidth,t.halfHeight),s.arc(0,0,1,0,Math.PI*2),s.restore());break}case"triangle":{const t=e;s.moveTo(t.x,t.y),s.lineTo(t.x2,t.y2),s.lineTo(t.x3,t.y3),s.closePath();break}default:{const t=e,a=t.points;if(!a?.length)break;s.moveTo(a[0],a[1]);for(let n=2;n<a.length;n+=2)s.lineTo(a[n],a[n+1]);t.closePath&&s.closePath();break}}}function vt(s,e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(!a?.shape)continue;const n=a.transform,o=n&&!n.isIdentity();o&&(s.save(),s.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),ae(s,a.shape),o&&s.restore()}return!0}function yt(s,e,t,a){const n=s.fill;if(n instanceof je){n.buildGradient();const r=n.texture;if(r){const i=d.getTintedPattern(r,e),c=t?ue.copyFrom(t).scale(r.source.pixelWidth,r.source.pixelHeight):ue.copyFrom(n.transform);return a&&!s.textureSpace&&c.append(a),d.applyPatternTransform(i,c),i}}if(n instanceof $e){const r=d.getTintedPattern(n.texture,e);return d.applyPatternTransform(r,n.transform),r}const o=s.texture;if(o&&o!==we.WHITE){if(!o.source.resource)return dt;const r=d.getTintedPattern(o,e),i=t?ue.copyFrom(t).scale(o.source.pixelWidth,o.source.pixelHeight):s.matrix;return d.applyPatternTransform(r,i),r}return gt(e)}class He{constructor(){this.shader=null}contextChange(e){}execute(e,t){const a=e.renderer,n=a.canvasContext,o=n.activeContext,r=t.groupTransform,i=a.globalUniforms.globalUniformData?.worldColor??4294967295,c=t.groupColorAlpha,h=(i>>>24&255)/255,l=(c>>>24&255)/255,u=a.filter?.alphaMultiplier??1,m=h*l*u;if(m<=0)return;const v=i&16777215,k=c&16777215,T=be(ne(k,v)),C=a._roundPixels|t._roundPixels;o.save(),n.setContextTransform(r,C===1),n.setBlendMode(t.groupBlendMode);const B=t.context.instructions;for(let P=0;P<B.length;P++){const H=B[P];if(H.action==="texture"){const g=H.data,y=g.image,x=y?d.getCanvasSource(y):null;if(!x)continue;const G=g.alpha*m;if(G<=0)continue;const N=ne(g.style,T);o.globalAlpha=G;let w=x;N!==16777215&&(w=d.getTintedCanvas({texture:y},N));const E=y.frame,_=y.source._resolution??y.source.resolution??1;let I=E.x*_,R=E.y*_;const z=E.width*_,q=E.height*_;w!==x&&(I=0,R=0);const D=g.transform,M=D&&!D.isIdentity(),p=y.rotate;M||p?(te.copyFrom(r),M&&te.append(D),p&&A.matrixAppendRotationInv(te,p,g.dx,g.dy,g.dw,g.dh),n.setContextTransform(te,C===1)):n.setContextTransform(r,C===1),o.drawImage(w,I,R,w===x?z:w.width,w===x?q:w.height,p?0:g.dx,p?0:g.dy,g.dw,g.dh),(M||p)&&n.setContextTransform(r,C===1);continue}const V=H.data,J=V?.path?.shapePath;if(!J?.shapePrimitives?.length)continue;const b=V.style,F=ne(b.color,T),W=b.alpha*m;if(W<=0)continue;const Q=H.action==="stroke";if(o.globalAlpha=W,Q){const g=b;o.lineWidth=g.width,o.lineCap=g.cap,o.lineJoin=g.join,o.miterLimit=g.miterLimit}const Y=J.shapePrimitives;if(!Q&&V.hole?.shapePath?.shapePrimitives?.length){const g=Y[Y.length-1];g.holes=V.hole.shapePath.shapePrimitives}for(let g=0;g<Y.length;g++){const y=Y[g];if(!y?.shape)continue;const x=y.transform,G=x&&!x.isIdentity(),N=b.texture&&b.texture!==we.WHITE,w=b.textureSpace==="global"?x:null,E=N?Ye(pt,b,y.shape,w):null,_=G?ut.copyFrom(r).append(x):r,I=yt(b,F,E,_);if(G&&(o.save(),o.transform(x.a,x.b,x.c,x.d,x.tx,x.ty)),Q){const R=b;if(R.alignment!==.5&&!R.pixelLine){const q=[],D=[],M=[];if(Ne[y.shape.type]?.build(y.shape,q)){const oe=y.shape.closePath??!0;Xe(q,R,!1,oe,D,M),o.fillStyle=I,ft(o,D,M)}else o.strokeStyle=I,o.beginPath(),ae(o,y.shape),o.stroke()}else o.strokeStyle=I,o.beginPath(),ae(o,y.shape),o.stroke()}else o.fillStyle=I,o.beginPath(),ae(o,y.shape),vt(o,y.holes)?o.fill("evenodd"):o.fill();G&&o.restore()}}o.restore()}destroy(){this.shader=null}}He.extension={type:[S.CanvasPipesAdaptor],name:"graphics"};class Ct{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:a,context:n}=this._ensureCanvas(t);return{canvas:a,context:n,width:a.width,height:a.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:a}=this._ensureCanvas(t);a.width=e.pixelWidth,a.height=e.pixelHeight}startRenderPass(e,t,a,n){const o=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=o.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,a,n)}clear(e,t,a,n){const r=this._renderTargetSystem.getGpuRenderTarget(e).context,i=n||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(r.setTransform(1,0,0,1,0,0),r.clearRect(i.x,i.y,i.width,i.height),a){const c=K.shared.setValue(a);c.alpha>0&&(r.globalAlpha=c.alpha,r.fillStyle=c.toHex(),r.fillRect(i.x,i.y,i.width,i.height),r.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,a,n,o){const i=this._renderTargetSystem.getGpuRenderTarget(e).canvas,c=t.source,{context:h}=this._ensureCanvas(c),l=o?.x??0,u=o?.y??0;return h.drawImage(i,a.x,a.y,n.width,n.height,l,u,n.width,n.height),c.update(),t}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;(!t||!Ke.test(t))&&(t=U.get().createCanvas(e.pixelWidth,e.pixelHeight),e.resource=t),(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(t.width=e.pixelWidth,t.height=e.pixelHeight);const a=t.getContext("2d");return{canvas:t,context:a}}}class We extends Je{constructor(e){super(e),this.adaptor=new Ct,this.adaptor.init(e,this)}}We.extension={type:[S.CanvasSystem],name:"renderTarget"};class De{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=U.get().createCanvas(),a=t.getContext("2d"),n=d.getCanvasSource(e);if(!n)return t;const o=e.frame,r=e.source._resolution??e.source.resolution??1,i=o.x*r,c=o.y*r,h=o.width*r,l=o.height*r;return t.width=Math.ceil(h),t.height=Math.ceil(l),a.drawImage(n,i,c,h,l,0,0,h,l),t}getPixels(e){const t=this.generateCanvas(e);return{pixels:t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}destroy(){}}De.extension={type:[S.CanvasSystem],name:"texture"};const xt=[...Ze,Ae,Be,De,We],Tt=[et,tt,nt,at,st,Re,ke,ot],Pt=[rt,He],Ue=[],Oe=[],Ge=[];se.handleByNamedList(S.CanvasSystem,Ue);se.handleByNamedList(S.CanvasPipes,Oe);se.handleByNamedList(S.CanvasPipesAdaptor,Ge);se.add(...xt,...Tt,...Pt);class St extends Qe{constructor(){const e={name:"canvas",type:ze.CANVAS,systems:Ue,renderPipes:Oe,renderPipeAdaptors:Ge};super(e)}}export{St as CanvasRenderer};
@@ -1 +1 @@
1
- import{S as n,r as u,G as o,u as f}from"./index-YEDqrGu6.js";const s=class i extends n{constructor(e){e={...i.defaultOptions,...e},super(e),this.enabled=!0,this._state=u.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1),e.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,t,a,r){e.applyFilter(this,t,a,r)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){const{gpu:t,gl:a,...r}=e;let l,d;return t&&(l=o.from(t)),a&&(d=f.from(a)),new i({gpuProgram:l,glProgram:d,...r})}};s.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let b=s;export{b as F};
1
+ import{S as n,r as u,G as o,u as f}from"./index-BLmH2_gh.js";const s=class i extends n{constructor(e){e={...i.defaultOptions,...e},super(e),this.enabled=!0,this._state=u.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1),e.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,t,a,r){e.applyFilter(this,t,a,r)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){const{gpu:t,gl:a,...r}=e;let l,d;return t&&(l=o.from(t)),a&&(d=f.from(a)),new i({gpuProgram:l,glProgram:d,...r})}};s.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let b=s;export{b as F};
@@ -1,4 +1,4 @@
1
- import{al as Ve,af as oe,R as m,G as Ne,u as je,r as $e,am as le,T as l,a2 as W,an as w,ao as qe,ap as z,aq as T,a1 as V,ar as de,as as Ke,V as f,A as g,ad as D,at as ue,y as ce,au as ee,av as he,aw as pe,ax as fe,ay as me,a7 as P,az as Ye,O as E,K as N,ae as y,aA as G,aB as Je,a5 as Xe,aC as Qe,ab as Ze,a3 as te,aD as re,aE as p,J as et,$ as O,aF as tt,aG as rt,aH as st,aI as nt}from"./index-YEDqrGu6.js";import{F as at}from"./Filter-trCu1CQG.js";var it=`in vec2 vMaskCoord;
1
+ import{al as Ve,af as oe,R as m,G as Ne,u as je,r as $e,am as le,T as l,a2 as W,an as w,ao as qe,ap as z,aq as T,a1 as V,ar as de,as as Ke,V as f,A as g,ad as D,at as ue,y as ce,au as ee,av as he,aw as pe,ax as fe,ay as me,a7 as P,az as Ye,O as E,K as N,ae as y,aA as G,aB as Je,a5 as Xe,aC as Qe,ab as Ze,a3 as te,aD as re,aE as p,J as et,$ as O,aF as tt,aG as rt,aH as st,aI as nt}from"./index-BLmH2_gh.js";import{F as at}from"./Filter-MPAI5-Oj.js";var it=`in vec2 vMaskCoord;
2
2
  in vec2 vTextureCoord;
3
3
 
4
4
  uniform sampler2D uTexture;
@@ -1,4 +1,4 @@
1
- import{K as R,r as F,T as d,a9 as P,F as B,y as b,z,u as Be,S as O,V as S,aJ as ye,ae as q,aK as Ne,A as g,aA as V,$ as y,ad as N,af as M,R as Z,aL as J,aM as Ce,aN as De,aO as Q,aP as Ie,a0 as Ge,a1 as Ue,a2 as A}from"./index-YEDqrGu6.js";import{e as Fe,G as Pe,c as Oe,b as Me,U as Le,B as ee,d as C,f as te,g as we}from"./BufferResource-BFEntdoN.js";import{R as He,S as Ve,d as Xe}from"./RenderTargetSystem-DHoDBu3v.js";import"./Filter-trCu1CQG.js";function ke(){const{userAgent:t}=R.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}class re{constructor(){this._tempState=F.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,r,n){const s=e.renderer,a=this._didUploadHash[n.uid];s.shader.bind(n,a),a||(this._didUploadHash[n.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(r,n.glProgram)}execute(e,r){const n=e.renderer;this._tempState.blendMode=r.blendMode,n.state.set(this._tempState);const s=r.textures.textures;for(let a=0;a<r.textures.count;a++)n.texture.bind(s[a],a);n.geometry.draw(r.topology,r.size,r.start)}}re.extension={type:[d.WebGLPipesAdaptor],name:"batch"};var v=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(v||{});class We{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class ne{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new P({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,n=this.getGlBuffer(e);r.bindBuffer(n.type,n.buffer)}bindBufferBase(e,r){const{_gl:n}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,n.bindBufferBase(n.UNIFORM_BUFFER,r,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let n=0,s=this._nextBindBaseIndex;for(;n<2;){s>=this._maxBindings&&(s=this._minBaseLocation,n++);const a=this._boundBufferBases[s];if(a&&a._lastBindCallId===this._bindCallId){s++;continue}break}return r=s,this._nextBindBaseIndex=s+1,n>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,n,s){const{_gl:a}=this;n||(n=0),r||(r=0),this._boundBufferBases[r]=null,a.bindBufferRange(a.UNIFORM_BUFFER,r||0,e.buffer,n*256,s||256)}updateBuffer(e){const{_gl:r}=this,n=this.getGlBuffer(e);if(e._updateID===n.updateID)return n;n.updateID=e._updateID,r.bindBuffer(n.type,n.buffer);const s=e.data,a=e.descriptor.usage&B.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return s?n.byteLength>=s.byteLength?r.bufferSubData(n.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(n.byteLength=s.byteLength,r.bufferData(n.type,s,a)):(n.byteLength=e.descriptor.size,r.bufferData(n.type,n.byteLength,a)),n}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||this._gl.deleteBuffer(n.buffer))}createGLBuffer(e){const{_gl:r}=this;let n=v.ARRAY_BUFFER;e.descriptor.usage&B.INDEX?n=v.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&B.UNIFORM&&(n=v.UNIFORM_BUFFER);const s=new We(r.createBuffer(),n);return e._gpuData[this._renderer.uid]=s,this._managedBuffers.add(e),s}resetState(){this._boundBufferBases=Object.create(null)}}ne.extension={type:[d.WebGLSystem],name:"buffer"};const L=class se{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...se.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(b("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=R.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const n=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,a=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:n,premultipliedAlpha:s,antialias:a,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&b("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width<e.width||r.height<e.height)&&(r.width=Math.max(e.width,e.width),r.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof R.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const r=this._renderer.view.canvas;r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,r){let n;const s=this.canvas;if(e===2&&(n=s.getContext("webgl2",r)),!n&&(n=s.getContext("webgl",r),!n))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=n,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,r={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...r,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...r,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const n=e.getExtension("WEBGL_provoking_vertex");n&&n.provokingVertexWEBGL(n.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&b("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=this.supports,s=this.webGLVersion===2,a=this.extensions;n.uint32Indices=s||!!a.uint32ElementIndex,n.uniformBufferObject=s,n.vertexArrayObject=s||!!a.vertexArrayObject,n.srgbTextures=s||!!a.srgb,n.nonPowOf2wrapping=s,n.nonPowOf2mipmaps=s,n.msaa=s,n.uint32Indices||b("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};L.extension={type:[d.WebGLSystem],name:"context"};L.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let je=L;var G=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(G||{}),w=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(w||{}),l=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(l||{});const X={uint8x2:l.UNSIGNED_BYTE,uint8x4:l.UNSIGNED_BYTE,sint8x2:l.BYTE,sint8x4:l.BYTE,unorm8x2:l.UNSIGNED_BYTE,unorm8x4:l.UNSIGNED_BYTE,snorm8x2:l.BYTE,snorm8x4:l.BYTE,uint16x2:l.UNSIGNED_SHORT,uint16x4:l.UNSIGNED_SHORT,sint16x2:l.SHORT,sint16x4:l.SHORT,unorm16x2:l.UNSIGNED_SHORT,unorm16x4:l.UNSIGNED_SHORT,snorm16x2:l.SHORT,snorm16x4:l.SHORT,float16x2:l.HALF_FLOAT,float16x4:l.HALF_FLOAT,float32:l.FLOAT,float32x2:l.FLOAT,float32x3:l.FLOAT,float32x4:l.FLOAT,uint32:l.UNSIGNED_INT,uint32x2:l.UNSIGNED_INT,uint32x3:l.UNSIGNED_INT,uint32x4:l.UNSIGNED_INT,sint32:l.INT,sint32x2:l.INT,sint32x3:l.INT,sint32x4:l.INT};function Ke(t){return X[t]??X.float32}const $e={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class Ye{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class ae{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new P({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s));const n=this._renderer.context.extensions.vertexAttribDivisorANGLE;n&&(e.drawArraysInstanced=(s,a,i,o)=>{n.drawArraysInstancedANGLE(s,a,i,o)},e.drawElementsInstanced=(s,a,i,o,c)=>{n.drawElementsInstancedANGLE(s,a,i,o,c)},e.vertexAttribDivisor=(s,a)=>n.vertexAttribDivisorANGLE(s,a)),this._activeGeometry=null,this._activeVao=null}bind(e,r){const n=this.gl;this._activeGeometry=e;const s=this.getVao(e,r);this._activeVao!==s&&(this._activeVao=s,n.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let n=0;n<e.buffers.length;n++){const s=e.buffers[n];r.updateBuffer(s)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,r){const n=e.attributes,s=r._attributeData;for(const a in s)if(!n[a])throw new Error(`shader and geometry incompatible, geometry missing the "${a}" attribute`)}getSignature(e,r){const n=e.attributes,s=r._attributeData,a=["g",e.uid];for(const i in n)s[i]&&a.push(i,s[i].location);return a.join("-")}getVao(e,r){return e._gpuData[this._renderer.uid]?.vaoCache[r._key]||this.initGeometryVao(e,r)}initGeometryVao(e,r,n=!0){const s=this._renderer.gl,a=this._renderer.buffer;this._renderer.shader._getProgramData(r),this.checkCompatibility(e,r);const i=this.getSignature(e,r);let o=e._gpuData[this._renderer.uid];o||(o=new Ye,e._gpuData[this._renderer.uid]=o,this._managedGeometries.add(e));const c=o.vaoCache;let u=c[i];if(u)return c[r._key]=u,u;Fe(e,r._attributeData);const _=e.buffers;u=s.createVertexArray(),s.bindVertexArray(u);for(let f=0;f<_.length;f++){const h=_[f];a.bind(h)}return this.activateVao(e,r),c[r._key]=u,c[i]=u,s.bindVertexArray(null),u}onGeometryUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];if(!n)return;const s=n.vaoCache;if(!r)for(const a in s)this._activeVao!==s[a]&&this.resetState(),this.gl.deleteVertexArray(s[a])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,r){const n=this._renderer.gl,s=this._renderer.buffer,a=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let i=null;for(const o in a){const c=a[o],u=c.buffer,_=s.getGlBuffer(u),f=r._attributeData[o];if(f){i!==_&&(s.bind(u),i=_);const h=f.location;n.enableVertexAttribArray(h);const m=z(c.format),p=Ke(c.format);if(f.format?.substring(1,4)==="int"?n.vertexAttribIPointer(h,m.size,p,c.stride,c.offset):n.vertexAttribPointer(h,m.size,p,m.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const E=c.divisor??1;n.vertexAttribDivisor(h,E)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,n,s){const{gl:a}=this._renderer,i=this._activeGeometry,o=$e[e||i.topology];if(s??(s=i.instanceCount),i.indexBuffer){const c=i.indexBuffer.data.BYTES_PER_ELEMENT,u=c===2?a.UNSIGNED_SHORT:a.UNSIGNED_INT;s!==1?a.drawElementsInstanced(o,r||i.indexBuffer.data.length,u,(n||0)*c,s):a.drawElements(o,r||i.indexBuffer.data.length,u,(n||0)*c)}else s!==1?a.drawArraysInstanced(o,n||0,r||i.getSize(),s):a.drawArrays(o,n||0,r||i.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ae.extension={type:[d.WebGLSystem],name:"geometry"};const ze=new ye({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),H=class ie{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:n}={...ie.defaultOptions,...e};this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(b("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=F.for2d();const s=new Be({vertex:`
1
+ import{K as R,r as F,T as d,a9 as P,F as B,y as b,z,u as Be,S as O,V as S,aJ as ye,ae as q,aK as Ne,A as g,aA as V,$ as y,ad as N,af as M,R as Z,aL as J,aM as Ce,aN as De,aO as Q,aP as Ie,a0 as Ge,a1 as Ue,a2 as A}from"./index-BLmH2_gh.js";import{e as Fe,G as Pe,c as Oe,b as Me,U as Le,B as ee,d as C,f as te,g as we}from"./BufferResource-WPSrP4iZ.js";import{R as He,S as Ve,d as Xe}from"./RenderTargetSystem-D4qtRaUW.js";import"./Filter-MPAI5-Oj.js";function ke(){const{userAgent:t}=R.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}class re{constructor(){this._tempState=F.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,r,n){const s=e.renderer,a=this._didUploadHash[n.uid];s.shader.bind(n,a),a||(this._didUploadHash[n.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(r,n.glProgram)}execute(e,r){const n=e.renderer;this._tempState.blendMode=r.blendMode,n.state.set(this._tempState);const s=r.textures.textures;for(let a=0;a<r.textures.count;a++)n.texture.bind(s[a],a);n.geometry.draw(r.topology,r.size,r.start)}}re.extension={type:[d.WebGLPipesAdaptor],name:"batch"};var v=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(v||{});class We{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class ne{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new P({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,n=this.getGlBuffer(e);r.bindBuffer(n.type,n.buffer)}bindBufferBase(e,r){const{_gl:n}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,n.bindBufferBase(n.UNIFORM_BUFFER,r,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let n=0,s=this._nextBindBaseIndex;for(;n<2;){s>=this._maxBindings&&(s=this._minBaseLocation,n++);const a=this._boundBufferBases[s];if(a&&a._lastBindCallId===this._bindCallId){s++;continue}break}return r=s,this._nextBindBaseIndex=s+1,n>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,n,s){const{_gl:a}=this;n||(n=0),r||(r=0),this._boundBufferBases[r]=null,a.bindBufferRange(a.UNIFORM_BUFFER,r||0,e.buffer,n*256,s||256)}updateBuffer(e){const{_gl:r}=this,n=this.getGlBuffer(e);if(e._updateID===n.updateID)return n;n.updateID=e._updateID,r.bindBuffer(n.type,n.buffer);const s=e.data,a=e.descriptor.usage&B.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return s?n.byteLength>=s.byteLength?r.bufferSubData(n.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(n.byteLength=s.byteLength,r.bufferData(n.type,s,a)):(n.byteLength=e.descriptor.size,r.bufferData(n.type,n.byteLength,a)),n}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||this._gl.deleteBuffer(n.buffer))}createGLBuffer(e){const{_gl:r}=this;let n=v.ARRAY_BUFFER;e.descriptor.usage&B.INDEX?n=v.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&B.UNIFORM&&(n=v.UNIFORM_BUFFER);const s=new We(r.createBuffer(),n);return e._gpuData[this._renderer.uid]=s,this._managedBuffers.add(e),s}resetState(){this._boundBufferBases=Object.create(null)}}ne.extension={type:[d.WebGLSystem],name:"buffer"};const L=class se{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...se.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(b("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=R.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const n=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,a=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:n,premultipliedAlpha:s,antialias:a,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&b("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width<e.width||r.height<e.height)&&(r.width=Math.max(e.width,e.width),r.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof R.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const r=this._renderer.view.canvas;r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,r){let n;const s=this.canvas;if(e===2&&(n=s.getContext("webgl2",r)),!n&&(n=s.getContext("webgl",r),!n))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=n,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,r={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...r,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...r,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const n=e.getExtension("WEBGL_provoking_vertex");n&&n.provokingVertexWEBGL(n.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&b("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=this.supports,s=this.webGLVersion===2,a=this.extensions;n.uint32Indices=s||!!a.uint32ElementIndex,n.uniformBufferObject=s,n.vertexArrayObject=s||!!a.vertexArrayObject,n.srgbTextures=s||!!a.srgb,n.nonPowOf2wrapping=s,n.nonPowOf2mipmaps=s,n.msaa=s,n.uint32Indices||b("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};L.extension={type:[d.WebGLSystem],name:"context"};L.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let je=L;var G=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(G||{}),w=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(w||{}),l=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(l||{});const X={uint8x2:l.UNSIGNED_BYTE,uint8x4:l.UNSIGNED_BYTE,sint8x2:l.BYTE,sint8x4:l.BYTE,unorm8x2:l.UNSIGNED_BYTE,unorm8x4:l.UNSIGNED_BYTE,snorm8x2:l.BYTE,snorm8x4:l.BYTE,uint16x2:l.UNSIGNED_SHORT,uint16x4:l.UNSIGNED_SHORT,sint16x2:l.SHORT,sint16x4:l.SHORT,unorm16x2:l.UNSIGNED_SHORT,unorm16x4:l.UNSIGNED_SHORT,snorm16x2:l.SHORT,snorm16x4:l.SHORT,float16x2:l.HALF_FLOAT,float16x4:l.HALF_FLOAT,float32:l.FLOAT,float32x2:l.FLOAT,float32x3:l.FLOAT,float32x4:l.FLOAT,uint32:l.UNSIGNED_INT,uint32x2:l.UNSIGNED_INT,uint32x3:l.UNSIGNED_INT,uint32x4:l.UNSIGNED_INT,sint32:l.INT,sint32x2:l.INT,sint32x3:l.INT,sint32x4:l.INT};function Ke(t){return X[t]??X.float32}const $e={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class Ye{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class ae{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new P({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s));const n=this._renderer.context.extensions.vertexAttribDivisorANGLE;n&&(e.drawArraysInstanced=(s,a,i,o)=>{n.drawArraysInstancedANGLE(s,a,i,o)},e.drawElementsInstanced=(s,a,i,o,c)=>{n.drawElementsInstancedANGLE(s,a,i,o,c)},e.vertexAttribDivisor=(s,a)=>n.vertexAttribDivisorANGLE(s,a)),this._activeGeometry=null,this._activeVao=null}bind(e,r){const n=this.gl;this._activeGeometry=e;const s=this.getVao(e,r);this._activeVao!==s&&(this._activeVao=s,n.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let n=0;n<e.buffers.length;n++){const s=e.buffers[n];r.updateBuffer(s)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,r){const n=e.attributes,s=r._attributeData;for(const a in s)if(!n[a])throw new Error(`shader and geometry incompatible, geometry missing the "${a}" attribute`)}getSignature(e,r){const n=e.attributes,s=r._attributeData,a=["g",e.uid];for(const i in n)s[i]&&a.push(i,s[i].location);return a.join("-")}getVao(e,r){return e._gpuData[this._renderer.uid]?.vaoCache[r._key]||this.initGeometryVao(e,r)}initGeometryVao(e,r,n=!0){const s=this._renderer.gl,a=this._renderer.buffer;this._renderer.shader._getProgramData(r),this.checkCompatibility(e,r);const i=this.getSignature(e,r);let o=e._gpuData[this._renderer.uid];o||(o=new Ye,e._gpuData[this._renderer.uid]=o,this._managedGeometries.add(e));const c=o.vaoCache;let u=c[i];if(u)return c[r._key]=u,u;Fe(e,r._attributeData);const _=e.buffers;u=s.createVertexArray(),s.bindVertexArray(u);for(let f=0;f<_.length;f++){const h=_[f];a.bind(h)}return this.activateVao(e,r),c[r._key]=u,c[i]=u,s.bindVertexArray(null),u}onGeometryUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];if(!n)return;const s=n.vaoCache;if(!r)for(const a in s)this._activeVao!==s[a]&&this.resetState(),this.gl.deleteVertexArray(s[a])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,r){const n=this._renderer.gl,s=this._renderer.buffer,a=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let i=null;for(const o in a){const c=a[o],u=c.buffer,_=s.getGlBuffer(u),f=r._attributeData[o];if(f){i!==_&&(s.bind(u),i=_);const h=f.location;n.enableVertexAttribArray(h);const m=z(c.format),p=Ke(c.format);if(f.format?.substring(1,4)==="int"?n.vertexAttribIPointer(h,m.size,p,c.stride,c.offset):n.vertexAttribPointer(h,m.size,p,m.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const E=c.divisor??1;n.vertexAttribDivisor(h,E)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,n,s){const{gl:a}=this._renderer,i=this._activeGeometry,o=$e[e||i.topology];if(s??(s=i.instanceCount),i.indexBuffer){const c=i.indexBuffer.data.BYTES_PER_ELEMENT,u=c===2?a.UNSIGNED_SHORT:a.UNSIGNED_INT;s!==1?a.drawElementsInstanced(o,r||i.indexBuffer.data.length,u,(n||0)*c,s):a.drawElements(o,r||i.indexBuffer.data.length,u,(n||0)*c)}else s!==1?a.drawArraysInstanced(o,n||0,r||i.getSize(),s):a.drawArrays(o,n||0,r||i.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ae.extension={type:[d.WebGLSystem],name:"geometry"};const ze=new ye({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),H=class ie{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:n}={...ie.defaultOptions,...e};this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(b("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=F.for2d();const s=new Be({vertex:`
2
2
  attribute vec2 aPosition;
3
3
  out vec2 vUv;
4
4
 
@@ -1,4 +1,4 @@
1
- import{r as L,a8 as A,T as l,a9 as D,J as ce,aa as de,K as B,A as C,F as T,D as he,ab as k,ac as w,y as v,ad as y,$ as pe,ae as le,af as z,ag as M,R as F,ah as O,ai as fe,aj as ge,ak as I,S as W,V as R,a0 as me,a1 as _e,a2 as S}from"./index-YEDqrGu6.js";import{c as be,u as ye,U as xe,B as Ge,G as Pe,e as Be,l as Se,a as Te,t as Ce}from"./BufferResource-BFEntdoN.js";import{R as ve,S as Ue,d as we}from"./RenderTargetSystem-DHoDBu3v.js";import"./Filter-trCu1CQG.js";const G=L.for2d();class H{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),G.blendMode="normal",s.pipeline.getPipeline(t,n,G);const a=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,a,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=A(u.textures,u.count,s.limits.maxBatchableTextures)}G.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,G,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(a),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}H.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class V{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],a=this._renderer;for(const g in i){const h=e.resources[g]??e.resources[i[g]];let p;if(h._resourceType==="uniformGroup"){const d=h;a.ubo.updateUniformGroup(d);const f=d.buffer;p={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(h._resourceType==="buffer"){const d=h;p={buffer:a.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(h._resourceType==="bufferResource"){const d=h;p={buffer:a.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(h._resourceType==="textureSampler"){const d=h;p=a.texture.getGpuSampler(d)}else if(h._resourceType==="textureSource"){const d=h;p=a.texture.getTextureView(d)}n.push({binding:i[g],resource:p})}const u=a.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}V.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Me{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class N{constructor(e){this._renderer=e,this._managedBuffers=new D({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=ce("resource"),e.data&&(de(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Me(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}N.extension={type:[l.WebGPUSystem],name:"buffer"};class Re{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class j{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}j.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await B.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class K{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:a,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,a||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const a in r)this._setVertexBuffer(a,r[a]);for(const a in i)this.setBindGroup(a,i[a],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}K.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class q{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}q.extension={type:[l.WebGPUSystem],name:"limits"};class ${constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:C.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}$.extension={type:[l.WebGPUSystem],name:"stencil"};const P={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function Ee(o){const e=o.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=P[s.data.type].size;const n=P[s.data.type].align;if(!P[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Le(o,e){const{size:t,align:r}=P[o.data.type],s=(r-t)/4,i=o.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
1
+ import{r as L,a8 as A,T as l,a9 as D,J as ce,aa as de,K as B,A as C,F as T,D as he,ab as k,ac as w,y as v,ad as y,$ as pe,ae as le,af as z,ag as M,R as F,ah as O,ai as fe,aj as ge,ak as I,S as W,V as R,a0 as me,a1 as _e,a2 as S}from"./index-BLmH2_gh.js";import{c as be,u as ye,U as xe,B as Ge,G as Pe,e as Be,l as Se,a as Te,t as Ce}from"./BufferResource-WPSrP4iZ.js";import{R as ve,S as Ue,d as we}from"./RenderTargetSystem-D4qtRaUW.js";import"./Filter-MPAI5-Oj.js";const G=L.for2d();class H{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),G.blendMode="normal",s.pipeline.getPipeline(t,n,G);const a=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,a,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=A(u.textures,u.count,s.limits.maxBatchableTextures)}G.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,G,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(a),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}H.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class V{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],a=this._renderer;for(const g in i){const h=e.resources[g]??e.resources[i[g]];let p;if(h._resourceType==="uniformGroup"){const d=h;a.ubo.updateUniformGroup(d);const f=d.buffer;p={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(h._resourceType==="buffer"){const d=h;p={buffer:a.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(h._resourceType==="bufferResource"){const d=h;p={buffer:a.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(h._resourceType==="textureSampler"){const d=h;p=a.texture.getGpuSampler(d)}else if(h._resourceType==="textureSource"){const d=h;p=a.texture.getTextureView(d)}n.push({binding:i[g],resource:p})}const u=a.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}V.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Me{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class N{constructor(e){this._renderer=e,this._managedBuffers=new D({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=ce("resource"),e.data&&(de(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Me(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}N.extension={type:[l.WebGPUSystem],name:"buffer"};class Re{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class j{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}j.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await B.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class K{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:a,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,a||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const a in r)this._setVertexBuffer(a,r[a]);for(const a in i)this.setBindGroup(a,i[a],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}K.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class q{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}q.extension={type:[l.WebGPUSystem],name:"limits"};class ${constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:C.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}$.extension={type:[l.WebGPUSystem],name:"stencil"};const P={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function Ee(o){const e=o.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=P[s.data.type].size;const n=P[s.data.type].align;if(!P[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Le(o,e){const{size:t,align:r}=P[o.data.type],s=(r-t)/4,i=o.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
2
2
  v = uv.${o.data.name};
3
3
  ${e!==0?`offset += ${e};`:""}
4
4
 
@@ -1,4 +1,4 @@
1
- import{a3 as M,a4 as Z,a5 as m,a6 as Q,T,H as ee,y as _,a2 as A,a7 as V}from"./index-YEDqrGu6.js";import"./webworkerAll-Pgv9S8Bp.js";import"./Filter-trCu1CQG.js";class te{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class P{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=P.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,S=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,y=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,w=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,Y=/BlackBerry/i,H=/BB10/i,F=/Opera Mini/i,N=/\b(CriOS|Chrome)(?:.+)Mobile/i,K=/Mobile(?:.+)Firefox\b/i,j=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ie(a){return function(e){return e.test(a)}}function $(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ie(t),s={apple:{phone:n(I)&&!n(v),ipod:n(S),tablet:!n(I)&&(n(C)||j(e))&&!n(v),universal:n(U),device:(n(I)||n(S)||n(C)||n(U)||j(e))&&!n(v)},amazon:{phone:n(y),tablet:!n(y)&&n(w),device:n(y)||n(w)},android:{phone:!n(v)&&n(y)||!n(v)&&n(k),tablet:!n(v)&&!n(y)&&!n(k)&&(n(w)||n(R)),device:!n(v)&&(n(y)||n(w)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(Y),blackberry10:n(H),opera:n(F),firefox:n(K),chrome:n(N),device:n(Y)||n(H)||n(F)||n(K)||n(N)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const ne=$.default??$,se=ne(globalThis.navigator),oe=9,G=100,re=0,ae=0,W=2,z=1,he=-1e3,le=-1e3,ce=2,B=class q{constructor(e,t=se){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${le}px`,e.style.zIndex=ce.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${re}px`,this._div.style.left=`${ae}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=W.toString(),this._canvasObserver=new te({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...q.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,Q(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
1
+ import{a3 as M,a4 as Z,a5 as m,a6 as Q,T,H as ee,y as _,a2 as A,a7 as V}from"./index-BLmH2_gh.js";import"./webworkerAll-iHUuedbL.js";import"./Filter-MPAI5-Oj.js";class te{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class P{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=P.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,S=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,y=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,w=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,Y=/BlackBerry/i,H=/BB10/i,F=/Opera Mini/i,N=/\b(CriOS|Chrome)(?:.+)Mobile/i,K=/Mobile(?:.+)Firefox\b/i,j=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ie(a){return function(e){return e.test(a)}}function $(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ie(t),s={apple:{phone:n(I)&&!n(v),ipod:n(S),tablet:!n(I)&&(n(C)||j(e))&&!n(v),universal:n(U),device:(n(I)||n(S)||n(C)||n(U)||j(e))&&!n(v)},amazon:{phone:n(y),tablet:!n(y)&&n(w),device:n(y)||n(w)},android:{phone:!n(v)&&n(y)||!n(v)&&n(k),tablet:!n(v)&&!n(y)&&!n(k)&&(n(w)||n(R)),device:!n(v)&&(n(y)||n(w)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(Y),blackberry10:n(H),opera:n(F),firefox:n(K),chrome:n(N),device:n(Y)||n(H)||n(F)||n(K)||n(N)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const ne=$.default??$,se=ne(globalThis.navigator),oe=9,G=100,re=0,ae=0,W=2,z=1,he=-1e3,le=-1e3,ce=2,B=class q{constructor(e,t=se){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${le}px`,e.style.zIndex=ce.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${re}px`,this._div.style.left=`${ae}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=W.toString(),this._canvasObserver=new te({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...q.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,Q(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
2
2
  color: transparent;
3
3
  pointer-events: none;
4
4
  padding: 0;