import{A as e,H as t,X as n}from"./C9tvkk7Y2.js";var r=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(t,n){let r=e.get().createCanvas();return r.width=t,r.height=n,{canvas:r,context:r.getContext(`2d`)}}getOptimalCanvasAndContext(e,n,r=1){e=Math.ceil(e*r-1e-6),n=Math.ceil(n*r-1e-6),e=t(e),n=t(n);let i=(e<<17)+(n<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let a=this._canvasPool[i].pop();return a||=this._createCanvasAndContext(e,n),a}returnCanvasAndContext(e){let{width:t,height:n}=e.canvas,r=(t<<17)+(n<<1);e.context.resetTransform(),e.context.clearRect(0,0,t,n),this._canvasPool[r].push(e)}clear(){this._canvasPool={}}},i=new r;n.register(i);export{r as n,i as t};