diff --git a/assets/scripts/leaflet.js b/assets/scripts/leaflet.js deleted file mode 100644 index a3bf693..0000000 --- a/assets/scripts/leaflet.js +++ /dev/null @@ -1,6 +0,0 @@ -/* @preserve - * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com - * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade - */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).leaflet={})}(this,function(t){"use strict";function l(t){for(var e,i,n=1,o=arguments.length;n=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=_(t);var e=this.min,i=this.max,n=t.min,t=t.max,o=t.x>=e.x&&n.x<=i.x,t=t.y>=e.y&&n.y<=i.y;return o&&t},overlaps:function(t){t=_(t);var e=this.min,i=this.max,n=t.min,t=t.max,o=t.x>e.x&&n.xe.y&&n.y=n.lat&&i.lat<=o.lat&&e.lng>=n.lng&&i.lng<=o.lng},intersects:function(t){t=g(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),t=t.getNorthEast(),o=t.lat>=e.lat&&n.lat<=i.lat,t=t.lng>=e.lng&&n.lng<=i.lng;return o&&t},overlaps:function(t){t=g(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),t=t.getNorthEast(),o=t.lat>e.lat&&n.late.lng&&n.lng","http://www.w3.org/2000/svg"===(Wt.firstChild&&Wt.firstChild.namespaceURI));function y(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var b={ie:pt,ielt9:mt,edge:n,webkit:ft,android:gt,android23:vt,androidStock:yt,opera:xt,chrome:wt,gecko:bt,safari:Pt,phantom:Lt,opera12:o,win:Tt,ie3d:Mt,webkit3d:zt,gecko3d:_t,any3d:Ct,mobile:Zt,mobileWebkit:St,mobileWebkit3d:Et,msPointer:kt,pointer:Ot,touch:Bt,touchNative:At,mobileOpera:It,mobileGecko:Rt,retina:Nt,passiveEvents:Dt,canvas:jt,svg:Ht,vml:!Ht&&function(){try{var t=document.createElement("div"),e=(t.innerHTML='',t.firstChild);return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),inlineSvg:Wt,mac:0===navigator.platform.indexOf("Mac"),linux:0===navigator.platform.indexOf("Linux")},Ft=b.msPointer?"MSPointerDown":"pointerdown",Ut=b.msPointer?"MSPointerMove":"pointermove",Vt=b.msPointer?"MSPointerUp":"pointerup",qt=b.msPointer?"MSPointerCancel":"pointercancel",Gt={touchstart:Ft,touchmove:Ut,touchend:Vt,touchcancel:qt},Kt={touchstart:function(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&O(e);ee(t,e)},touchmove:ee,touchend:ee,touchcancel:ee},Yt={},Xt=!1;function Jt(t,e,i){return"touchstart"!==e||Xt||(document.addEventListener(Ft,$t,!0),document.addEventListener(Ut,Qt,!0),document.addEventListener(Vt,te,!0),document.addEventListener(qt,te,!0),Xt=!0),Kt[e]?(i=Kt[e].bind(this,i),t.addEventListener(Gt[e],i,!1),i):(console.warn("wrong event specified:",e),u)}function $t(t){Yt[t.pointerId]=t}function Qt(t){Yt[t.pointerId]&&(Yt[t.pointerId]=t)}function te(t){delete Yt[t.pointerId]}function ee(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var i in e.touches=[],Yt)e.touches.push(Yt[i]);e.changedTouches=[e],t(e)}}var ie=200;function ne(t,i){t.addEventListener("dblclick",i);var n,o=0;function e(t){var e;1!==t.detail?n=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||((e=Ne(t)).some(function(t){return t instanceof HTMLLabelElement&&t.attributes.for})&&!e.some(function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement})||((e=Date.now())-o<=ie?2===++n&&i(function(t){var e,i,n={};for(i in t)e=t[i],n[i]=e&&e.bind?e.bind(t):e;return(t=n).type="dblclick",n.detail=2,n.isTrusted=!1,n._simulated=!0,n}(t)):n=1,o=e))}return t.addEventListener("click",e),{dblclick:i,simDblclick:e}}var oe,se,re,ae,he,le,ue=we(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ce=we(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),de="webkitTransition"===ce||"OTransition"===ce?ce+"End":"transitionend";function _e(t){return"string"==typeof t?document.getElementById(t):t}function pe(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];return"auto"===(i=i&&"auto"!==i||!document.defaultView?i:(t=document.defaultView.getComputedStyle(t,null))?t[e]:null)?null:i}function P(t,e,i){t=document.createElement(t);return t.className=e||"",i&&i.appendChild(t),t}function T(t){var e=t.parentNode;e&&e.removeChild(t)}function me(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function fe(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ge(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ve(t,e){return void 0!==t.classList?t.classList.contains(e):0<(t=xe(t)).length&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(t)}function M(t,e){var i;if(void 0!==t.classList)for(var n=F(e),o=0,s=n.length;othis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),t=this._limitCenter(i,this._zoom,g(t));return i.equals(t)||this.panTo(t,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=m((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=m(e.paddingBottomRight||e.padding||[0,0]),o=this.project(this.getCenter()),t=this.project(t),s=this.getPixelBounds(),i=_([s.min.add(i),s.max.subtract(n)]),s=i.getSize();return i.contains(t)||(this._enforcingBounds=!0,n=t.subtract(i.getCenter()),i=i.extend(t).getSize().subtract(s),o.x+=n.x<0?-i.x:i.x,o.y+=n.y<0?-i.y:i.y,this.panTo(this.unproject(o),e),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=l({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize(),i=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),n=e.divideBy(2).round(),o=i.divideBy(2).round(),n=n.subtract(o);return n.x||n.y?(t.animate&&t.pan?this.panBy(n):(t.pan&&this._rawPanBy(n),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(a(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){var e,i;return t=this._locateOptions=l({timeout:1e4,watch:!1},t),"geolocation"in navigator?(e=a(this._handleGeolocationResponse,this),i=a(this._handleGeolocationError,this),t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e;this._container._leaflet_id&&(e=t.code,t=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e,i,n=new v(t.coords.latitude,t.coords.longitude),o=n.toBounds(2*t.coords.accuracy),s=this._locateOptions,r=(s.setView&&(e=this.getBoundsZoom(o),this.setView(n,s.maxZoom?Math.min(e,s.maxZoom):e)),{latlng:n,bounds:o,timestamp:t.timestamp});for(i in t.coords)"number"==typeof t.coords[i]&&(r[i]=t.coords[i]);this.fire("locationfound",r)}},addHandler:function(t,e){return e&&(e=this[t]=new e(this),this._handlers.push(e),this.options[t]&&e.enable()),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),T(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(r(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)T(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){e=P("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new s(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=g(t),i=m(i||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),t=t.getSouthEast(),i=this.getSize().subtract(i),t=_(this.project(t,n),this.project(r,n)).getSize(),r=b.any3d?this.options.zoomSnap:1,a=i.x/t.x,i=i.y/t.y,t=e?Math.max(a,i):Math.min(a,i),n=this.getScaleZoom(t,n);return r&&(n=Math.round(n/(r/100))*(r/100),n=e?Math.ceil(n/r)*r:Math.floor(n/r)*r),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new p(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){t=this._getTopLeftPoint(t,e);return new f(t,t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs,t=(e=void 0===e?this._zoom:e,i.zoom(t*i.scale(e)));return isNaN(t)?1/0:t},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(w(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(m(t),e)},layerPointToLatLng:function(t){t=m(t).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(t){return this.project(w(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(w(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(g(t))},distance:function(t,e){return this.options.crs.distance(w(t),w(e))},containerPointToLayerPoint:function(t){return m(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return m(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){t=this.containerPointToLayerPoint(m(t));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(w(t)))},mouseEventToContainerPoint:function(t){return De(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){t=this._container=_e(t);if(!t)throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");S(t,"scroll",this._onScroll,this),this._containerId=h(t)},_initLayout:function(){var t=this._container,e=(this._fadeAnimated=this.options.fadeAnimation&&b.any3d,M(t,"leaflet-container"+(b.touch?" leaflet-touch":"")+(b.retina?" leaflet-retina":"")+(b.ielt9?" leaflet-oldie":"")+(b.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),pe(t,"position"));"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Z(this._mapPane,new p(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(M(t.markerPane,"leaflet-zoom-hide"),M(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,i){Z(this._mapPane,new p(0,0));var n=!this._loaded,o=(this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset"),this._zoom!==e);this._moveStart(o,i)._move(t,e)._moveEnd(o),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i,n){void 0===e&&(e=this._zoom);var o=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?i&&i.pinch&&this.fire("zoom",i):((o||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return r(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Z(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var e=t?k:S;e((this._targets[h(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),b.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){r(this._resizeRequest),this._resizeRequest=x(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],o="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,r=!1;s;){if((i=this._targets[h(s)])&&("click"===e||"preclick"===e)&&this._draggableMoved(i)){r=!0;break}if(i&&i.listens(e,!0)){if(o&&!We(s,t))break;if(n.push(i),o)break}if(s===this._container)break;s=s.parentNode}return n=n.length||r||o||!this.listens(e,!0)?n:[this]},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e,i=t.target||t.srcElement;!this._loaded||i._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(i)||("mousedown"===(e=t.type)&&Me(i),this._fireDOMEvent(t,e))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){"click"===t.type&&((a=l({},t)).type="preclick",this._fireDOMEvent(a,a.type,i));var n=this._findEventTargets(t,e);if(i){for(var o=[],s=0;sthis.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),n=this._getCenterOffset(t)._divideBy(1-1/n);if(!0!==i.animate&&!this.getSize().contains(n))return!1;x(function(){this._moveStart(!0,i.noMoveStart||!1)._animateZoom(t,e,!0)},this)}return!0},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,M(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(a(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&z(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Ue(t){return new B(t)}var B=et.extend({options:{position:"topright"},initialize:function(t){c(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),t=t._controlCorners[i];return M(e,"leaflet-control"),-1!==i.indexOf("bottom")?t.insertBefore(e,t.firstChild):t.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(T(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",e=document.createElement("div");return e.innerHTML=t,e.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer),n=(t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers_"+h(this),n),this._layerControlInputs.push(e),e.layerId=h(t.layer),S(e,"click",this._onInputClick,this),document.createElement("span")),o=(n.innerHTML=" "+t.name,document.createElement("span"));return i.appendChild(o),o.appendChild(e),o.appendChild(n),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){if(!this._preventClick){var t,e,i=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=i.length-1;0<=s;s--)t=i[s],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||o.push(e);for(s=0;se.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section,e=(this._preventClick=!0,S(t,"click",O),this.expand(),this);setTimeout(function(){k(t,"click",O),e._preventClick=!1})}})),qe=B.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=P("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,o){i=P("a",i,n);return i.innerHTML=t,i.href="#",i.title=e,i.setAttribute("role","button"),i.setAttribute("aria-label",e),Ie(i),S(i,"click",Re),S(i,"click",o,this),S(i,"click",this._refocusOnMap,this),i},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";z(this._zoomInButton,e),z(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(M(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(M(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}}),Ge=(A.mergeOptions({zoomControl:!0}),A.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new qe,this.addControl(this.zoomControl))}),B.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=P("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=P("div",e,i)),t.imperial&&(this._iScale=P("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,t=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(t)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t);this._updateScale(this._mScale,e<1e3?e+" m":e/1e3+" km",e/t)},_updateImperial:function(t){var e,i,t=3.2808399*t;5280'+(b.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){c(this,t),this._attributions={}},onAdd:function(t){for(var e in(t.attributionControl=this)._container=P("div","leaflet-control-attribution"),Ie(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,e=[];for(t in this._attributions)this._attributions[t]&&e.push(t);var i=[];this.options.prefix&&i.push(this.options.prefix),e.length&&i.push(e.join(", ")),this._container.innerHTML=i.join(' ')}}}),n=(A.mergeOptions({attributionControl:!0}),A.addInitHook(function(){this.options.attributionControl&&(new Ke).addTo(this)}),B.Layers=Ve,B.Zoom=qe,B.Scale=Ge,B.Attribution=Ke,Ue.layers=function(t,e,i){return new Ve(t,e,i)},Ue.zoom=function(t){return new qe(t)},Ue.scale=function(t){return new Ge(t)},Ue.attribution=function(t){return new Ke(t)},et.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}})),ft=(n.addTo=function(t,e){return t.addHandler(e,this),this},{Events:e}),Ye=b.touch?"touchstart mousedown":"mousedown",Xe=it.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){c(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(S(this._dragStartTarget,Ye,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Xe._dragging===this&&this.finishDrag(!0),k(this._dragStartTarget,Ye,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var e,i;this._enabled&&(this._moved=!1,ve(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?Xe._dragging===this&&this.finishDrag():Xe._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((Xe._dragging=this)._preventOutline&&Me(this._element),Le(),re(),this._moving||(this.fire("down"),i=t.touches?t.touches[0]:t,e=Ce(this._element),this._startPoint=new p(i.clientX,i.clientY),this._startPos=Pe(this._element),this._parentScale=Ze(e),i="mousedown"===t.type,S(document,i?"mousemove":"touchmove",this._onMove,this),S(document,i?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var e;this._enabled&&(t.touches&&1e&&(i.push(t[n]),o=n);oe.max.x&&(i|=2),t.ye.max.y&&(i|=8),i}function ri(t,e,i,n){var o=e.x,e=e.y,s=i.x-o,r=i.y-e,a=s*s+r*r;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(l=!l);return l||yi.prototype._containsPoint.call(this,t,!0)}});var wi=ci.extend({initialize:function(t,e){c(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,o=d(t)?t:t.features;if(o){for(e=0,i=o.length;es.x&&(r=i.x+a-s.x+o.x),i.x-r-n.x<(a=0)&&(r=i.x-n.x),i.y+e+o.y>s.y&&(a=i.y+e-s.y+o.y),i.y-a-n.y<0&&(a=i.y-n.y),(r||a)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([r,a]))))},_getAnchor:function(){return m(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),Ii=(A.mergeOptions({closePopupOnClick:!0}),A.include({openPopup:function(t,e,i){return this._initOverlay(Bi,t,e,i).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),o.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Bi,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof ci||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e;this._popup&&this._map&&(Re(t),e=t.layer||t.target,this._popup._source!==e||e instanceof fi?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}}),Ai.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Ai.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Ai.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Ai.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=P("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+h(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,i=this._map,n=this._container,o=i.latLngToContainerPoint(i.getCenter()),i=i.layerPointToContainerPoint(t),s=this.options.direction,r=n.offsetWidth,a=n.offsetHeight,h=m(this.options.offset),l=this._getAnchor(),i="top"===s?(e=r/2,a):"bottom"===s?(e=r/2,0):(e="center"===s?r/2:"right"===s?0:"left"===s?r:i.xthis.options.maxZoom||nthis.options.maxZoom||void 0!==this.options.minZoom&&oi.max.x)||!e.wrapLat&&(t.yi.max.y))return!1}return!this.options.bounds||(e=this._tileCoordsToBounds(t),g(this.options.bounds).overlaps(e))},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),i=n.add(i);return[e.unproject(n,t.z),e.unproject(i,t.z)]},_tileCoordsToBounds:function(t){t=this._tileCoordsToNwSe(t),t=new s(t[0],t[1]);return t=this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var t=t.split(":"),e=new p(+t[0],+t[1]);return e.z=+t[2],e},_removeTile:function(t){var e=this._tiles[t];e&&(T(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){M(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=u,t.onmousemove=u,b.ielt9&&this.options.opacity<1&&C(t,this.options.opacity)},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),a(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&x(a(this._tileReady,this,t,null,o)),Z(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(C(i.el,0),r(this._fadeFrame),this._fadeFrame=x(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(M(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),b.ielt9||!this._map._fadeAnimated?x(this._pruneTiles,this):setTimeout(a(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new p(this._wrapX?H(t.x,this._wrapX):t.x,this._wrapY?H(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new f(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var Di=Ni.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=c(this,e)).detectRetina&&b.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),zt={_initContainer:function(){this._container=P("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Wi.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Vi("shape");M(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Vi("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;T(e),t.removeInteractiveTarget(e),delete this._layers[h(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(e=e||(t._stroke=Vi("stroke")),o.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=d(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(o.removeChild(e),t._stroke=null),n.fill?(i=i||(t._fill=Vi("fill")),o.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(o.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){fe(t._container)},_bringToBack:function(t){ge(t._container)}},qi=b.vml?Vi:ct,Gi=Wi.extend({_initContainer:function(){this._container=qi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=qi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){T(this._container),k(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,e,i;this._map._animatingZoom&&this._bounds||(Wi.prototype._update.call(this),e=(t=this._bounds).getSize(),i=this._container,this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),Z(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update"))},_initPath:function(t){var e=t._path=qi("path");t.options.className&&M(e,t.options.className),t.options.interactive&&M(e,"leaflet-interactive"),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){T(t._path),t.removeInteractiveTarget(t._path),delete this._layers[h(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,t=t.options;e&&(t.stroke?(e.setAttribute("stroke",t.color),e.setAttribute("stroke-opacity",t.opacity),e.setAttribute("stroke-width",t.weight),e.setAttribute("stroke-linecap",t.lineCap),e.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?e.setAttribute("stroke-dasharray",t.dashArray):e.removeAttribute("stroke-dasharray"),t.dashOffset?e.setAttribute("stroke-dashoffset",t.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),t.fill?(e.setAttribute("fill",t.fillColor||t.color),e.setAttribute("fill-opacity",t.fillOpacity),e.setAttribute("fill-rule",t.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,dt(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",e=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(t,e)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){fe(t._path)},_bringToBack:function(t){ge(t._path)}});function Ki(t){return b.svg||b.vml?new Gi(t):null}b.vml&&Gi.include(zt),A.include({getRenderer:function(t){t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer());return this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){var e;return"overlayPane"!==t&&void 0!==t&&(void 0===(e=this._paneRenderers[t])&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e)},_createRenderer:function(t){return this.options.preferCanvas&&Ui(t)||Ki(t)}});var Yi=xi.extend({initialize:function(t,e){xi.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=g(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Gi.create=qi,Gi.pointsToPath=dt,wi.geometryToLayer=bi,wi.coordsToLatLng=Li,wi.coordsToLatLngs=Ti,wi.latLngToCoords=Mi,wi.latLngsToCoords=zi,wi.getFeature=Ci,wi.asFeature=Zi,A.mergeOptions({boxZoom:!0});var _t=n.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){S(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){k(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){T(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),re(),Le(),this._startPoint=this._map.mouseEventToContainerPoint(t),S(document,{contextmenu:Re,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=P("div","leaflet-zoom-box",this._container),M(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var t=new f(this._point,this._startPoint),e=t.getSize();Z(this._box,t.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(T(this._box),z(this._container,"leaflet-crosshair")),ae(),Te(),k(document,{contextmenu:Re,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(a(this._resetState,this),0),t=new s(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),Ct=(A.addInitHook("addHandler","boxZoom",_t),A.mergeOptions({doubleClickZoom:!0}),n.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,i=t.originalEvent.shiftKey?i-n:i+n;"center"===e.options.doubleClickZoom?e.setZoom(i):e.setZoomAround(t.containerPoint,i)}})),Zt=(A.addInitHook("addHandler","doubleClickZoom",Ct),A.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),n.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new Xe(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),M(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){z(this._map._container,"leaflet-grab"),z(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,e=this._map;e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=g(this._map.options.maxBounds),this._offsetLimit=_(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var e,i;this._map.options.inertia&&(e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(i),this._times.push(e),this._prunePositions(e)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-e+i)%t+e-i,n=(n+e+i)%t-e-i,t=Math.abs(o+i)e.getMaxZoom()&&1 { + var Yt = Object.defineProperty; + var xi = Object.getOwnPropertyDescriptor; + var Ui = Object.getOwnPropertyNames; + var Ei = Object.prototype.hasOwnProperty; + var o = (n, e) => Yt(n, "name", { value: e, configurable: !0 }); + var Si = (n, e) => { + for (var i in e) Yt(n, i, { get: e[i], enumerable: !0 }); + }, + Ci = (n, e, i, c) => { + if ((e && typeof e == "object") || typeof e == "function") + for (let m of Ui(e)) + !Ei.call(n, m) && + m !== i && + Yt(n, m, { + get: () => e[m], + enumerable: !(c = xi(e, m)) || c.enumerable, + }); + return n; + }; + var Ai = (n) => Ci(Yt({}, "__esModule", { value: !0 }), n); + var wr = (() => { + for (var n = new Uint8Array(128), e = 0; e < 64; e++) + n[e < 26 ? e + 65 : e < 52 ? e + 71 : e < 62 ? e - 4 : e * 4 - 205] = e; + return (i) => { + for ( + var c = i.length, + m = new Uint8Array( + (((c - (i[c - 1] == "=") - (i[c - 2] == "=")) * 3) / 4) | 0 + ), + p = 0, + P = 0; + p < c; + + ) { + var I = n[i.charCodeAt(p++)], + j = n[i.charCodeAt(p++)], + y = n[i.charCodeAt(p++)], + X = n[i.charCodeAt(p++)]; + (m[P++] = (I << 2) | (j >> 4)), + (m[P++] = (j << 4) | (y >> 2)), + (m[P++] = (y << 6) | X); + } + return m; + }; + })(); + var uo = {}; + Si(uo, { default: () => ao }); + function Ge(n) { + return (n * Math.PI) / 180; + } + o(Ge, "deg2rad"); + function ot(n) { + return (n * 180) / Math.PI; + } + o(ot, "rad2deg"); + function Le(n, e, i) { + return e > i ? Le(n, i, e) : Math.min(Math.max(n, e), i); + } + o(Le, "clamp"); + function Ve(n, e, i) { + if (typeof n == "number" && typeof e == "number") return n + (e - n) * i; + if (n instanceof v && e instanceof v) return n.lerp(e, i); + if (n instanceof W && e instanceof W) return n.lerp(e, i); + throw new Error( + `Bad value for lerp(): ${n}, ${e}. Only number, Vec2 and Color is supported.` + ); + } + o(Ve, "lerp"); + function _e(n, e, i, c, m) { + return c + ((n - e) / (i - e)) * (m - c); + } + o(_e, "map"); + function vr(n, e, i, c, m) { + return Le(_e(n, e, i, c, m), c, m); + } + o(vr, "mapc"); + var v = class n { + static { + o(this, "Vec2"); + } + x = 0; + y = 0; + constructor(e = 0, i = e) { + (this.x = e), (this.y = i); + } + static fromAngle(e) { + let i = Ge(e); + return new n(Math.cos(i), Math.sin(i)); + } + static LEFT = new n(-1, 0); + static RIGHT = new n(1, 0); + static UP = new n(0, -1); + static DOWN = new n(0, 1); + clone() { + return new n(this.x, this.y); + } + add(...e) { + let i = T(...e); + return new n(this.x + i.x, this.y + i.y); + } + sub(...e) { + let i = T(...e); + return new n(this.x - i.x, this.y - i.y); + } + scale(...e) { + let i = T(...e); + return new n(this.x * i.x, this.y * i.y); + } + dist(...e) { + let i = T(...e); + return this.sub(i).len(); + } + sdist(...e) { + let i = T(...e); + return this.sub(i).slen(); + } + len() { + return Math.sqrt(this.dot(this)); + } + slen() { + return this.dot(this); + } + unit() { + let e = this.len(); + return e === 0 ? new n(0) : this.scale(1 / e); + } + normal() { + return new n(this.y, -this.x); + } + reflect(e) { + return this.sub(e.scale(2 * this.dot(e))); + } + project(e) { + return e.scale(e.dot(this) / e.len()); + } + reject(e) { + return this.sub(this.project(e)); + } + dot(e) { + return this.x * e.x + this.y * e.y; + } + cross(e) { + return this.x * e.y - this.y * e.x; + } + angle(...e) { + let i = T(...e); + return ot(Math.atan2(this.y - i.y, this.x - i.x)); + } + angleBetween(...e) { + let i = T(...e); + return ot(Math.atan2(this.cross(i), this.dot(i))); + } + lerp(e, i) { + return new n(Ve(this.x, e.x, i), Ve(this.y, e.y, i)); + } + slerp(e, i) { + let c = this.dot(e), + m = this.cross(e), + p = Math.atan2(m, c); + return this.scale(Math.sin((1 - i) * p)) + .add(e.scale(Math.sin(i * p))) + .scale(1 / m); + } + isZero() { + return this.x === 0 && this.y === 0; + } + toFixed(e) { + return new n(Number(this.x.toFixed(e)), Number(this.y.toFixed(e))); + } + transform(e) { + return e.multVec2(this); + } + eq(e) { + return this.x === e.x && this.y === e.y; + } + bbox() { + return new de(this, 0, 0); + } + toString() { + return `vec2(${this.x.toFixed(2)}, ${this.y.toFixed(2)})`; + } + }; + function T(...n) { + if (n.length === 1) { + if (n[0] instanceof v) return new v(n[0].x, n[0].y); + if (Array.isArray(n[0]) && n[0].length === 2) return new v(...n[0]); + } + return new v(...n); + } + o(T, "vec2"); + var W = class n { + static { + o(this, "Color"); + } + r = 255; + g = 255; + b = 255; + constructor(e, i, c) { + (this.r = Le(e, 0, 255)), + (this.g = Le(i, 0, 255)), + (this.b = Le(c, 0, 255)); + } + static fromArray(e) { + return new n(e[0], e[1], e[2]); + } + static fromHex(e) { + if (typeof e == "number") + return new n((e >> 16) & 255, (e >> 8) & 255, (e >> 0) & 255); + if (typeof e == "string") { + let i = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e); + return new n( + parseInt(i[1], 16), + parseInt(i[2], 16), + parseInt(i[3], 16) + ); + } else throw new Error("Invalid hex color format"); + } + static fromHSL(e, i, c) { + if (i == 0) return new n(255 * c, 255 * c, 255 * c); + let m = o( + (X, S, q) => ( + q < 0 && (q += 1), + q > 1 && (q -= 1), + q < 1 / 6 + ? X + (S - X) * 6 * q + : q < 1 / 2 + ? S + : q < 2 / 3 + ? X + (S - X) * (2 / 3 - q) * 6 + : X + ), + "hue2rgb" + ), + p = c < 0.5 ? c * (1 + i) : c + i - c * i, + P = 2 * c - p, + I = m(P, p, e + 1 / 3), + j = m(P, p, e), + y = m(P, p, e - 1 / 3); + return new n( + Math.round(I * 255), + Math.round(j * 255), + Math.round(y * 255) + ); + } + static RED = new n(255, 0, 0); + static GREEN = new n(0, 255, 0); + static BLUE = new n(0, 0, 255); + static YELLOW = new n(255, 255, 0); + static MAGENTA = new n(255, 0, 255); + static CYAN = new n(0, 255, 255); + static WHITE = new n(255, 255, 255); + static BLACK = new n(0, 0, 0); + clone() { + return new n(this.r, this.g, this.b); + } + lighten(e) { + return new n(this.r + e, this.g + e, this.b + e); + } + darken(e) { + return this.lighten(-e); + } + invert() { + return new n(255 - this.r, 255 - this.g, 255 - this.b); + } + mult(e) { + return new n( + (this.r * e.r) / 255, + (this.g * e.g) / 255, + (this.b * e.b) / 255 + ); + } + lerp(e, i) { + return new n(Ve(this.r, e.r, i), Ve(this.g, e.g, i), Ve(this.b, e.b, i)); + } + toHSL() { + let e = this.r / 255, + i = this.g / 255, + c = this.b / 255, + m = Math.max(e, i, c), + p = Math.min(e, i, c), + P = (m + p) / 2, + I = P, + j = P; + if (m == p) P = I = 0; + else { + let y = m - p; + switch (((I = j > 0.5 ? y / (2 - m - p) : y / (m + p)), m)) { + case e: + P = (i - c) / y + (i < c ? 6 : 0); + break; + case i: + P = (c - e) / y + 2; + break; + case c: + P = (e - i) / y + 4; + break; + } + P /= 6; + } + return [P, I, j]; + } + eq(e) { + return this.r === e.r && this.g === e.g && this.b === e.b; + } + toString() { + return `rgb(${this.r}, ${this.g}, ${this.b})`; + } + toHex() { + return ( + "#" + + ((1 << 24) + (this.r << 16) + (this.g << 8) + this.b) + .toString(16) + .slice(1) + ); + } + }; + function J(...n) { + if (n.length === 0) return new W(255, 255, 255); + if (n.length === 1) { + if (n[0] instanceof W) return n[0].clone(); + if (typeof n[0] == "string") return W.fromHex(n[0]); + if (Array.isArray(n[0]) && n[0].length === 3) return W.fromArray(n[0]); + } + return new W(...n); + } + o(J, "rgb"); + var yr = o((n, e, i) => W.fromHSL(n, e, i), "hsl2rgb"), + oe = class n { + static { + o(this, "Quad"); + } + x = 0; + y = 0; + w = 1; + h = 1; + constructor(e, i, c, m) { + (this.x = e), (this.y = i), (this.w = c), (this.h = m); + } + scale(e) { + return new n( + this.x + this.w * e.x, + this.y + this.h * e.y, + this.w * e.w, + this.h * e.h + ); + } + pos() { + return new v(this.x, this.y); + } + clone() { + return new n(this.x, this.y, this.w, this.h); + } + eq(e) { + return ( + this.x === e.x && this.y === e.y && this.w === e.w && this.h === e.h + ); + } + toString() { + return `quad(${this.x}, ${this.y}, ${this.w}, ${this.h})`; + } + }; + function ce(n, e, i, c) { + return new oe(n, e, i, c); + } + o(ce, "quad"); + var Ue = class n { + static { + o(this, "Mat4"); + } + m = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; + constructor(e) { + e && (this.m = e); + } + static translate(e) { + return new n([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, e.x, e.y, 0, 1]); + } + static scale(e) { + return new n([e.x, 0, 0, 0, 0, e.y, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); + } + static rotateX(e) { + e = Ge(-e); + let i = Math.cos(e), + c = Math.sin(e); + return new n([1, 0, 0, 0, 0, i, -c, 0, 0, c, i, 0, 0, 0, 0, 1]); + } + static rotateY(e) { + e = Ge(-e); + let i = Math.cos(e), + c = Math.sin(e); + return new n([i, 0, c, 0, 0, 1, 0, 0, -c, 0, i, 0, 0, 0, 0, 1]); + } + static rotateZ(e) { + e = Ge(-e); + let i = Math.cos(e), + c = Math.sin(e); + return new n([i, -c, 0, 0, c, i, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); + } + translate(e) { + return ( + (this.m[12] += this.m[0] * e.x + this.m[4] * e.y), + (this.m[13] += this.m[1] * e.x + this.m[5] * e.y), + (this.m[14] += this.m[2] * e.x + this.m[6] * e.y), + (this.m[15] += this.m[3] * e.x + this.m[7] * e.y), + this + ); + } + scale(e) { + return ( + (this.m[0] *= e.x), + (this.m[4] *= e.y), + (this.m[1] *= e.x), + (this.m[5] *= e.y), + (this.m[2] *= e.x), + (this.m[6] *= e.y), + (this.m[3] *= e.x), + (this.m[7] *= e.y), + this + ); + } + rotate(e) { + e = Ge(-e); + let i = Math.cos(e), + c = Math.sin(e), + m = this.m[0], + p = this.m[1], + P = this.m[4], + I = this.m[5]; + return ( + (this.m[0] = m * i + p * c), + (this.m[1] = -m * c + p * i), + (this.m[4] = P * i + I * c), + (this.m[5] = -P * c + I * i), + this + ); + } + mult(e) { + let i = []; + for (let c = 0; c < 4; c++) + for (let m = 0; m < 4; m++) + i[c * 4 + m] = + this.m[0 * 4 + m] * e.m[c * 4 + 0] + + this.m[1 * 4 + m] * e.m[c * 4 + 1] + + this.m[2 * 4 + m] * e.m[c * 4 + 2] + + this.m[3 * 4 + m] * e.m[c * 4 + 3]; + return new n(i); + } + multVec2(e) { + return new v( + e.x * this.m[0] + e.y * this.m[4] + this.m[12], + e.x * this.m[1] + e.y * this.m[5] + this.m[13] + ); + } + getTranslation() { + return new v(this.m[12], this.m[13]); + } + getScale() { + if (this.m[0] != 0 || this.m[1] != 0) { + let e = this.m[0] * this.m[5] - this.m[1] * this.m[4], + i = Math.sqrt(this.m[0] * this.m[0] + this.m[1] * this.m[1]); + return new v(i, e / i); + } else if (this.m[4] != 0 || this.m[5] != 0) { + let e = this.m[0] * this.m[5] - this.m[1] * this.m[4], + i = Math.sqrt(this.m[4] * this.m[4] + this.m[5] * this.m[5]); + return new v(e / i, i); + } else return new v(0, 0); + } + getRotation() { + if (this.m[0] != 0 || this.m[1] != 0) { + let e = Math.sqrt(this.m[0] * this.m[0] + this.m[1] * this.m[1]); + return ot( + this.m[1] > 0 ? Math.acos(this.m[0] / e) : -Math.acos(this.m[0] / e) + ); + } else if (this.m[4] != 0 || this.m[5] != 0) { + let e = Math.sqrt(this.m[4] * this.m[4] + this.m[5] * this.m[5]); + return ot( + Math.PI / 2 - + (this.m[5] > 0 + ? Math.acos(-this.m[4] / e) + : -Math.acos(this.m[4] / e)) + ); + } else return 0; + } + getSkew() { + if (this.m[0] != 0 || this.m[1] != 0) { + let e = Math.sqrt(this.m[0] * this.m[0] + this.m[1] * this.m[1]); + return new v( + Math.atan(this.m[0] * this.m[4] + this.m[1] * this.m[5]) / (e * e), + 0 + ); + } else if (this.m[4] != 0 || this.m[5] != 0) { + let e = Math.sqrt(this.m[4] * this.m[4] + this.m[5] * this.m[5]); + return new v( + 0, + Math.atan(this.m[0] * this.m[4] + this.m[1] * this.m[5]) / (e * e) + ); + } else return new v(0, 0); + } + invert() { + let e = [], + i = this.m[10] * this.m[15] - this.m[14] * this.m[11], + c = this.m[9] * this.m[15] - this.m[13] * this.m[11], + m = this.m[9] * this.m[14] - this.m[13] * this.m[10], + p = this.m[8] * this.m[15] - this.m[12] * this.m[11], + P = this.m[8] * this.m[14] - this.m[12] * this.m[10], + I = this.m[8] * this.m[13] - this.m[12] * this.m[9], + j = this.m[6] * this.m[15] - this.m[14] * this.m[7], + y = this.m[5] * this.m[15] - this.m[13] * this.m[7], + X = this.m[5] * this.m[14] - this.m[13] * this.m[6], + S = this.m[4] * this.m[15] - this.m[12] * this.m[7], + q = this.m[4] * this.m[14] - this.m[12] * this.m[6], + E = this.m[5] * this.m[15] - this.m[13] * this.m[7], + K = this.m[4] * this.m[13] - this.m[12] * this.m[5], + Q = this.m[6] * this.m[11] - this.m[10] * this.m[7], + te = this.m[5] * this.m[11] - this.m[9] * this.m[7], + k = this.m[5] * this.m[10] - this.m[9] * this.m[6], + pe = this.m[4] * this.m[11] - this.m[8] * this.m[7], + C = this.m[4] * this.m[10] - this.m[8] * this.m[6], + Ae = this.m[4] * this.m[9] - this.m[8] * this.m[5]; + (e[0] = this.m[5] * i - this.m[6] * c + this.m[7] * m), + (e[4] = -(this.m[4] * i - this.m[6] * p + this.m[7] * P)), + (e[8] = this.m[4] * c - this.m[5] * p + this.m[7] * I), + (e[12] = -(this.m[4] * m - this.m[5] * P + this.m[6] * I)), + (e[1] = -(this.m[1] * i - this.m[2] * c + this.m[3] * m)), + (e[5] = this.m[0] * i - this.m[2] * p + this.m[3] * P), + (e[9] = -(this.m[0] * c - this.m[1] * p + this.m[3] * I)), + (e[13] = this.m[0] * m - this.m[1] * P + this.m[2] * I), + (e[2] = this.m[1] * j - this.m[2] * y + this.m[3] * X), + (e[6] = -(this.m[0] * j - this.m[2] * S + this.m[3] * q)), + (e[10] = this.m[0] * E - this.m[1] * S + this.m[3] * K), + (e[14] = -(this.m[0] * X - this.m[1] * q + this.m[2] * K)), + (e[3] = -(this.m[1] * Q - this.m[2] * te + this.m[3] * k)), + (e[7] = this.m[0] * Q - this.m[2] * pe + this.m[3] * C), + (e[11] = -(this.m[0] * te - this.m[1] * pe + this.m[3] * Ae)), + (e[15] = this.m[0] * k - this.m[1] * C + this.m[2] * Ae); + let $ = + this.m[0] * e[0] + + this.m[1] * e[4] + + this.m[2] * e[8] + + this.m[3] * e[12]; + for (let Te = 0; Te < 4; Te++) + for (let ye = 0; ye < 4; ye++) e[Te * 4 + ye] *= 1 / $; + return new n(e); + } + clone() { + return new n([...this.m]); + } + toString() { + return this.m.toString(); + } + }; + function Ln(n, e, i, c = (m) => -Math.cos(m)) { + return n + ((c(i) + 1) / 2) * (e - n); + } + o(Ln, "wave"); + var Ti = 1103515245, + Oi = 12345, + br = 2147483648, + bt = class { + static { + o(this, "RNG"); + } + seed; + constructor(e) { + this.seed = e; + } + gen() { + return (this.seed = (Ti * this.seed + Oi) % br), this.seed / br; + } + genNumber(e, i) { + return e + this.gen() * (i - e); + } + genVec2(e, i) { + return new v(this.genNumber(e.x, i.x), this.genNumber(e.y, i.y)); + } + genColor(e, i) { + return new W( + this.genNumber(e.r, i.r), + this.genNumber(e.g, i.g), + this.genNumber(e.b, i.b) + ); + } + genAny(...e) { + if (e.length === 0) return this.gen(); + if (e.length === 1) { + if (typeof e[0] == "number") return this.genNumber(0, e[0]); + if (e[0] instanceof v) return this.genVec2(T(0, 0), e[0]); + if (e[0] instanceof W) return this.genColor(J(0, 0, 0), e[0]); + } else if (e.length === 2) { + if (typeof e[0] == "number" && typeof e[1] == "number") + return this.genNumber(e[0], e[1]); + if (e[0] instanceof v && e[1] instanceof v) + return this.genVec2(e[0], e[1]); + if (e[0] instanceof W && e[1] instanceof W) + return this.genColor(e[0], e[1]); + } + } + }, + Fn = new bt(Date.now()); + function xr(n) { + return n != null && (Fn.seed = n), Fn.seed; + } + o(xr, "randSeed"); + function xt(...n) { + return Fn.genAny(...n); + } + o(xt, "rand"); + function Vn(...n) { + return Math.floor(xt(...n)); + } + o(Vn, "randi"); + function Ur(n) { + return xt() <= n; + } + o(Ur, "chance"); + function Er(n) { + return n[Vn(n.length)]; + } + o(Er, "choose"); + function Sr(n, e) { + return ( + n.pos.x + n.width > e.pos.x && + n.pos.x < e.pos.x + e.width && + n.pos.y + n.height > e.pos.y && + n.pos.y < e.pos.y + e.height + ); + } + o(Sr, "testRectRect"); + function Ri(n, e) { + if ( + (n.p1.x === n.p2.x && n.p1.y === n.p2.y) || + (e.p1.x === e.p2.x && e.p1.y === e.p2.y) + ) + return null; + let i = + (e.p2.y - e.p1.y) * (n.p2.x - n.p1.x) - + (e.p2.x - e.p1.x) * (n.p2.y - n.p1.y); + if (i === 0) return null; + let c = + ((e.p2.x - e.p1.x) * (n.p1.y - e.p1.y) - + (e.p2.y - e.p1.y) * (n.p1.x - e.p1.x)) / + i, + m = + ((n.p2.x - n.p1.x) * (n.p1.y - e.p1.y) - + (n.p2.y - n.p1.y) * (n.p1.x - e.p1.x)) / + i; + return c < 0 || c > 1 || m < 0 || m > 1 ? null : c; + } + o(Ri, "testLineLineT"); + function it(n, e) { + let i = Ri(n, e); + return i + ? T(n.p1.x + i * (n.p2.x - n.p1.x), n.p1.y + i * (n.p2.y - n.p1.y)) + : null; + } + o(it, "testLineLine"); + function Cr(n, e) { + if (vt(n, e.p1) || vt(n, e.p2)) return !0; + let i = n.points(); + return ( + !!it(e, new Ie(i[0], i[1])) || + !!it(e, new Ie(i[1], i[2])) || + !!it(e, new Ie(i[2], i[3])) || + !!it(e, new Ie(i[3], i[0])) + ); + } + o(Cr, "testRectLine"); + function vt(n, e) { + return ( + e.x > n.pos.x && + e.x < n.pos.x + n.width && + e.y > n.pos.y && + e.y < n.pos.y + n.height + ); + } + o(vt, "testRectPoint"); + function Ar(n, e) { + let i = e.sub(n.p1), + c = n.p2.sub(n.p1); + if (Math.abs(i.cross(c)) > Number.EPSILON) return !1; + let m = i.dot(c) / c.dot(c); + return m >= 0 && m <= 1; + } + o(Ar, "testLinePoint"); + function _n(n, e) { + let i = n.p2.sub(n.p1), + c = i.dot(i), + m = n.p1.sub(e.center), + p = 2 * i.dot(m), + P = m.dot(m) - e.radius * e.radius, + I = p * p - 4 * c * P; + if (c <= Number.EPSILON || I < 0) return !1; + if (I == 0) { + let j = -p / (2 * c); + if (j >= 0 && j <= 1) return !0; + } else { + let j = (-p + Math.sqrt(I)) / (2 * c), + y = (-p - Math.sqrt(I)) / (2 * c); + if ((j >= 0 && j <= 1) || (y >= 0 && y <= 1)) return !0; + } + return Tr(e, n.p1); + } + o(_n, "testLineCircle"); + function Tr(n, e) { + return n.center.sdist(e) < n.radius * n.radius; + } + o(Tr, "testCirclePoint"); + function Or(n, e) { + let i = e.pts[e.pts.length - 1]; + for (let c of e.pts) { + if (_n(new Ie(i, c), n)) return !0; + i = c; + } + return Tr(n, e.pts[0]) ? !0 : kn(e, n.center); + } + o(Or, "testCirclePolygon"); + function kn(n, e) { + let i = !1, + c = n.pts; + for (let m = 0, p = c.length - 1; m < c.length; p = m++) + c[m].y > e.y != c[p].y > e.y && + e.x < + ((c[p].x - c[m].x) * (e.y - c[m].y)) / (c[p].y - c[m].y) + c[m].x && + (i = !i); + return i; + } + o(kn, "testPolygonPoint"); + var Ie = class n { + static { + o(this, "Line"); + } + p1; + p2; + constructor(e, i) { + (this.p1 = e.clone()), (this.p2 = i.clone()); + } + transform(e) { + return new n(e.multVec2(this.p1), e.multVec2(this.p2)); + } + bbox() { + return de.fromPoints(this.p1, this.p2); + } + area() { + return this.p1.dist(this.p2); + } + clone() { + return new n(this.p1, this.p2); + } + }, + de = class n { + static { + o(this, "Rect"); + } + pos; + width; + height; + constructor(e, i, c) { + (this.pos = e.clone()), (this.width = i), (this.height = c); + } + static fromPoints(e, i) { + return new n(e.clone(), i.x - e.x, i.y - e.y); + } + center() { + return new v(this.pos.x + this.width / 2, this.pos.y + this.height / 2); + } + points() { + return [ + this.pos, + this.pos.add(this.width, 0), + this.pos.add(this.width, this.height), + this.pos.add(0, this.height), + ]; + } + transform(e) { + return new Ke(this.points().map((i) => e.multVec2(i))); + } + bbox() { + return this.clone(); + } + area() { + return this.width * this.height; + } + clone() { + return new n(this.pos.clone(), this.width, this.height); + } + distToPoint(e) { + return Math.sqrt(this.sdistToPoint(e)); + } + sdistToPoint(e) { + let i = this.pos, + c = this.pos.add(this.width, this.height), + m = Math.max(i.x - e.x, 0, e.x - c.x), + p = Math.max(i.y - e.y, 0, e.y - c.y); + return m * m + p * p; + } + }, + yt = class n { + static { + o(this, "Circle"); + } + center; + radius; + constructor(e, i) { + (this.center = e.clone()), (this.radius = i); + } + transform(e) { + return new In(this.center, this.radius, this.radius).transform(e); + } + bbox() { + return de.fromPoints( + this.center.sub(T(this.radius)), + this.center.add(T(this.radius)) + ); + } + area() { + return this.radius * this.radius * Math.PI; + } + clone() { + return new n(this.center, this.radius); + } + }, + In = class n { + static { + o(this, "Ellipse"); + } + center; + radiusX; + radiusY; + constructor(e, i, c) { + (this.center = e.clone()), (this.radiusX = i), (this.radiusY = c); + } + transform(e) { + return new n( + e.multVec2(this.center), + e.m[0] * this.radiusX, + e.m[5] * this.radiusY + ); + } + bbox() { + return de.fromPoints( + this.center.sub(T(this.radiusX, this.radiusY)), + this.center.add(T(this.radiusX, this.radiusY)) + ); + } + area() { + return this.radiusX * this.radiusY * Math.PI; + } + clone() { + return new n(this.center, this.radiusX, this.radiusY); + } + }, + Ke = class n { + static { + o(this, "Polygon"); + } + pts; + constructor(e) { + if (e.length < 3) + throw new Error("Polygons should have at least 3 vertices"); + this.pts = e; + } + transform(e) { + return new n(this.pts.map((i) => e.multVec2(i))); + } + bbox() { + let e = T(Number.MAX_VALUE), + i = T(-Number.MAX_VALUE); + for (let c of this.pts) + (e.x = Math.min(e.x, c.x)), + (i.x = Math.max(i.x, c.x)), + (e.y = Math.min(e.y, c.y)), + (i.y = Math.max(i.y, c.y)); + return de.fromPoints(e, i); + } + area() { + let e = 0, + i = this.pts.length; + for (let c = 0; c < i; c++) { + let m = this.pts[c], + p = this.pts[(c + 1) % i]; + (e += m.x * p.y * 0.5), (e -= p.x * m.y * 0.5); + } + return Math.abs(e); + } + clone() { + return new n(this.pts.map((e) => e.clone())); + } + }; + function Rr(n, e) { + let i = Number.MAX_VALUE, + c = T(0); + for (let m of [n, e]) + for (let p = 0; p < m.pts.length; p++) { + let P = m.pts[p], + j = m.pts[(p + 1) % m.pts.length].sub(P).normal().unit(), + y = Number.MAX_VALUE, + X = -Number.MAX_VALUE; + for (let K = 0; K < n.pts.length; K++) { + let Q = n.pts[K].dot(j); + (y = Math.min(y, Q)), (X = Math.max(X, Q)); + } + let S = Number.MAX_VALUE, + q = -Number.MAX_VALUE; + for (let K = 0; K < e.pts.length; K++) { + let Q = e.pts[K].dot(j); + (S = Math.min(S, Q)), (q = Math.max(q, Q)); + } + let E = Math.min(X, q) - Math.max(y, S); + if (E < 0) return null; + if (E < Math.abs(i)) { + let K = q - y, + Q = S - X; + (i = Math.abs(K) < Math.abs(Q) ? K : Q), (c = j.scale(i)); + } + } + return c; + } + o(Rr, "sat"); + var Ut = class extends Map { + static { + o(this, "Registry"); + } + lastID; + constructor(...e) { + super(...e), (this.lastID = 0); + } + push(e) { + let i = this.lastID; + return this.set(i, e), this.lastID++, i; + } + pushd(e) { + let i = this.push(e); + return () => this.delete(i); + } + }, + ke = class n { + static { + o(this, "EventController"); + } + paused = !1; + cancel; + constructor(e) { + this.cancel = e; + } + static join(e) { + let i = new n(() => e.forEach((c) => c.cancel())); + return ( + Object.defineProperty(i, "paused", { + get: () => e[0].paused, + set: (c) => e.forEach((m) => (m.paused = c)), + }), + (i.paused = !1), + i + ); + } + }, + be = class { + static { + o(this, "Event"); + } + handlers = new Ut(); + add(e) { + let i = this.handlers.pushd((...m) => { + c.paused || e(...m); + }), + c = new ke(i); + return c; + } + addOnce(e) { + let i = this.add((...c) => { + i.cancel(), e(...c); + }); + return i; + } + next() { + return new Promise((e) => this.addOnce(e)); + } + trigger(...e) { + this.handlers.forEach((i) => i(...e)); + } + numListeners() { + return this.handlers.size; + } + clear() { + this.handlers.clear(); + } + }, + Ne = class { + static { + o(this, "EventHandler"); + } + handlers = {}; + on(e, i) { + return ( + this.handlers[e] || (this.handlers[e] = new be()), + this.handlers[e].add(i) + ); + } + onOnce(e, i) { + let c = this.on(e, (...m) => { + c.cancel(), i(...m); + }); + return c; + } + next(e) { + return new Promise((i) => { + this.onOnce(e, (...c) => i(c[0])); + }); + } + trigger(e, ...i) { + this.handlers[e] && this.handlers[e].trigger(...i); + } + remove(e) { + delete this.handlers[e]; + } + clear() { + this.handlers = {}; + } + numListeners(e) { + return this.handlers[e]?.numListeners() ?? 0; + } + }; + function Xt(n, e) { + if (n === e) return !0; + let i = typeof n, + c = typeof e; + if (i !== c) return !1; + if (i === "object" && c === "object" && n !== null && e !== null) { + if (Array.isArray(n) !== Array.isArray(e)) return !1; + let m = Object.keys(n), + p = Object.keys(e); + if (m.length !== p.length) return !1; + for (let P of m) { + let I = n[P], + j = e[P]; + if (!Xt(I, j)) return !1; + } + return !0; + } + return !1; + } + o(Xt, "deepEq"); + function Pi(n) { + let e = window.atob(n), + i = e.length, + c = new Uint8Array(i); + for (let m = 0; m < i; m++) c[m] = e.charCodeAt(m); + return c.buffer; + } + o(Pi, "base64ToArrayBuffer"); + function Dr(n) { + return Pi(n.split(",")[1]); + } + o(Dr, "dataURLToArrayBuffer"); + function Jt(n, e) { + let i = document.createElement("a"); + (i.href = e), (i.download = n), i.click(); + } + o(Jt, "download"); + function Nn(n, e) { + Jt(n, "data:text/plain;charset=utf-8," + e); + } + o(Nn, "downloadText"); + function Mr(n, e) { + Nn(n, JSON.stringify(e)); + } + o(Mr, "downloadJSON"); + function jn(n, e) { + let i = URL.createObjectURL(e); + Jt(n, i), URL.revokeObjectURL(i); + } + o(jn, "downloadBlob"); + var Hn = o((n) => n.match(/^data:\w+\/\w+;base64,.+/), "isDataURL"); + var Gr = o((n) => n.split(".").slice(0, -1).join("."), "getFileName"); + function Ee(n, e) { + return (...i) => { + let c = i.length; + if (c === n.length) return n(...i); + if (c === e.length) return e(...i); + }; + } + o(Ee, "overload2"); + var Br = (() => { + let n = 0; + return () => n++; + })(), + Fr = o( + (n) => (n instanceof Error ? n.message : String(n)), + "getErrorMessage" + ); + var Wt = class { + static { + o(this, "BinaryHeap"); + } + _items; + _compareFn; + constructor(e = (i, c) => i < c) { + (this._compareFn = e), (this._items = []); + } + insert(e) { + this._items.push(e), this.moveUp(this._items.length - 1); + } + remove() { + if (this._items.length === 0) return null; + let e = this._items[0], + i = this._items.pop(); + return ( + this._items.length !== 0 && ((this._items[0] = i), this.moveDown(0)), e + ); + } + clear() { + this._items.splice(0, this._items.length); + } + moveUp(e) { + for (; e > 0; ) { + let i = Math.floor((e - 1) / 2); + if ( + !this._compareFn(this._items[e], this._items[i]) && + this._items[e] >= this._items[i] + ) + break; + this.swap(e, i), (e = i); + } + } + moveDown(e) { + for (; e < Math.floor(this._items.length / 2); ) { + let i = 2 * e + 1; + if ( + (i < this._items.length - 1 && + !this._compareFn(this._items[i], this._items[i + 1]) && + ++i, + this._compareFn(this._items[e], this._items[i])) + ) + break; + this.swap(e, i), (e = i); + } + } + swap(e, i) { + [this._items[e], this._items[i]] = [this._items[i], this._items[e]]; + } + get length() { + return this._items.length; + } + }; + var Di = Object.freeze([ + 776, 2359, 2367, 2984, 3007, 3021, 3633, 3635, 3648, 3657, 4352, 4449, 4520, + ]); + function Ir(n) { + if (typeof n != "string") + throw new TypeError("string cannot be undefined or null"); + let e = [], + i = 0, + c = 0; + for (; i < n.length; ) { + if ( + ((c += Mi(i + c, n)), + _i(n[i + c]) && c++, + Ii(n[i + c]) && c++, + Li(n[i + c]) && c++, + ki(n[i + c])) + ) { + c++; + continue; + } + e.push(n.substring(i, i + c)), (i += c), (c = 0); + } + return e; + } + o(Ir, "runes"); + function Mi(n, e) { + let i = e[n]; + if (!Gi(i) || n === e.length - 1) return 1; + let c = i + e[n + 1], + m = e.substring(n + 2, n + 5); + return Pr(c) && Pr(m) + ? 4 + : Bi(c) && Vi(m) + ? e.slice(n).indexOf(String.fromCodePoint(917631)) + 2 + : Fi(m) + ? 4 + : 2; + } + o(Mi, "nextUnits"); + function Gi(n) { + return n && tt(n[0].charCodeAt(0), 55296, 56319); + } + o(Gi, "isFirstOfSurrogatePair"); + function Pr(n) { + return tt(qn(n), 127462, 127487); + } + o(Pr, "isRegionalIndicator"); + function Bi(n) { + return tt(qn(n), 127988, 127988); + } + o(Bi, "isSubdivisionFlag"); + function Fi(n) { + return tt(qn(n), 127995, 127999); + } + o(Fi, "isFitzpatrickModifier"); + function Ii(n) { + return typeof n == "string" && tt(n.charCodeAt(0), 65024, 65039); + } + o(Ii, "isVariationSelector"); + function Li(n) { + return typeof n == "string" && tt(n.charCodeAt(0), 8400, 8447); + } + o(Li, "isDiacriticalMark"); + function Vi(n) { + let e = n.codePointAt(0); + return ( + typeof n == "string" && typeof e == "number" && tt(e, 917504, 917631) + ); + } + o(Vi, "isSupplementarySpecialpurposePlane"); + function _i(n) { + return typeof n == "string" && Di.includes(n.charCodeAt(0)); + } + o(_i, "isGrapheme"); + function ki(n) { + return typeof n == "string" && n.charCodeAt(0) === 8205; + } + o(ki, "isZeroWidthJoiner"); + function qn(n) { + let e = n.charCodeAt(0) - 55296, + i = n.charCodeAt(1) - 56320; + return (e << 10) + i + 65536; + } + o(qn, "codePointFromSurrogatePair"); + function tt(n, e, i) { + return n >= e && n <= i; + } + o(tt, "betweenInclusive"); + var $n = { + "Joy-Con L+R (STANDARD GAMEPAD Vendor: 057e Product: 200e)": { + buttons: { + 0: "south", + 1: "east", + 2: "west", + 3: "north", + 4: "lshoulder", + 5: "rshoulder", + 6: "ltrigger", + 7: "rtrigger", + 8: "select", + 9: "start", + 10: "lstick", + 11: "rstick", + 12: "dpad-up", + 13: "dpad-down", + 14: "dpad-left", + 15: "dpad-right", + 16: "home", + 17: "capture", + }, + sticks: { left: { x: 0, y: 1 }, right: { x: 2, y: 3 } }, + }, + "Joy-Con (L) (STANDARD GAMEPAD Vendor: 057e Product: 2006)": { + buttons: { + 0: "south", + 1: "east", + 2: "west", + 3: "north", + 4: "lshoulder", + 5: "rshoulder", + 9: "select", + 10: "lstick", + 16: "start", + }, + sticks: { left: { x: 0, y: 1 } }, + }, + "Joy-Con (R) (STANDARD GAMEPAD Vendor: 057e Product: 2007)": { + buttons: { + 0: "south", + 1: "east", + 2: "west", + 3: "north", + 4: "lshoulder", + 5: "rshoulder", + 9: "start", + 10: "lstick", + 16: "select", + }, + sticks: { left: { x: 0, y: 1 } }, + }, + "Pro Controller (STANDARD GAMEPAD Vendor: 057e Product: 2009)": { + buttons: { + 0: "south", + 1: "east", + 2: "west", + 3: "north", + 4: "lshoulder", + 5: "rshoulder", + 6: "ltrigger", + 7: "rtrigger", + 8: "select", + 9: "start", + 10: "lstick", + 11: "rstick", + 12: "dpad-up", + 13: "dpad-down", + 14: "dpad-left", + 15: "dpad-right", + 16: "home", + 17: "capture", + }, + sticks: { left: { x: 0, y: 1 }, right: { x: 2, y: 3 } }, + }, + default: { + buttons: { + 0: "south", + 1: "east", + 2: "west", + 3: "north", + 4: "lshoulder", + 5: "rshoulder", + 6: "ltrigger", + 7: "rtrigger", + 8: "select", + 9: "start", + 10: "lstick", + 11: "rstick", + 12: "dpad-up", + 13: "dpad-down", + 14: "dpad-left", + 15: "dpad-right", + 16: "home", + }, + sticks: { left: { x: 0, y: 1 }, right: { x: 2, y: 3 } }, + }, + }; + var at = class { + static { + o(this, "ButtonState"); + } + pressed = new Set([]); + pressedRepeat = new Set([]); + released = new Set([]); + down = new Set([]); + update() { + this.pressed.clear(), this.released.clear(), this.pressedRepeat.clear(); + } + press(e) { + this.pressed.add(e), this.pressedRepeat.add(e), this.down.add(e); + } + pressRepeat(e) { + this.pressedRepeat.add(e); + } + release(e) { + this.down.delete(e), this.pressed.delete(e), this.released.add(e); + } + }, + zn = class { + static { + o(this, "GamepadState"); + } + buttonState = new at(); + stickState = new Map(); + }, + Kn = class { + static { + o(this, "FPSCounter"); + } + dts = []; + timer = 0; + fps = 0; + tick(e) { + this.dts.push(e), + (this.timer += e), + this.timer >= 1 && + ((this.timer = 0), + (this.fps = Math.round( + 1 / (this.dts.reduce((i, c) => i + c) / this.dts.length) + )), + (this.dts = [])); + } + }, + Lr = o((n) => { + if (!n.canvas) throw new Error("Please provide a canvas"); + let e = { + canvas: n.canvas, + loopID: null, + stopped: !1, + dt: 0, + time: 0, + realTime: 0, + fpsCounter: new Kn(), + timeScale: 1, + skipTime: !1, + numFrames: 0, + mousePos: new v(0), + mouseDeltaPos: new v(0), + keyState: new at(), + mouseState: new at(), + mergedGamepadState: new zn(), + gamepadStates: new Map(), + gamepads: [], + charInputted: [], + isMouseMoved: !1, + lastWidth: n.canvas.offsetWidth, + lastHeight: n.canvas.offsetHeight, + events: new Ne(), + }; + function i() { + return e.dt * e.timeScale; + } + o(i, "dt"); + function c() { + return e.time; + } + o(c, "time"); + function m() { + return e.fpsCounter.fps; + } + o(m, "fps"); + function p() { + return e.numFrames; + } + o(p, "numFrames"); + function P() { + return e.canvas.toDataURL(); + } + o(P, "screenshot"); + function I(l) { + e.canvas.style.cursor = l; + } + o(I, "setCursor"); + function j() { + return e.canvas.style.cursor; + } + o(j, "getCursor"); + function y(l) { + if (l) + try { + let x = e.canvas.requestPointerLock(); + x.catch && x.catch((R) => console.error(R)); + } catch (x) { + console.error(x); + } + else document.exitPointerLock(); + } + o(y, "setCursorLocked"); + function X() { + return !!document.pointerLockElement; + } + o(X, "isCursorLocked"); + function S(l) { + l.requestFullscreen + ? l.requestFullscreen() + : l.webkitRequestFullscreen && l.webkitRequestFullscreen(); + } + o(S, "enterFullscreen"); + function q() { + document.exitFullscreen + ? document.exitFullscreen() + : document.webkitExitFullScreen && document.webkitExitFullScreen(); + } + o(q, "exitFullscreen"); + function E() { + return document.fullscreenElement || document.webkitFullscreenElement; + } + o(E, "getFullscreenElement"); + function K(l = !0) { + l ? S(e.canvas) : q(); + } + o(K, "setFullscreen"); + function Q() { + return !!E(); + } + o(Q, "isFullscreen"); + function te() { + e.stopped = !0; + for (let l in se) e.canvas.removeEventListener(l, se[l]); + for (let l in le) document.removeEventListener(l, le[l]); + for (let l in ae) window.removeEventListener(l, ae[l]); + ge.disconnect(); + } + o(te, "quit"); + function k(l) { + e.loopID !== null && cancelAnimationFrame(e.loopID); + let x = 0, + R = o((L) => { + if (e.stopped) return; + if (document.visibilityState !== "visible") { + e.loopID = requestAnimationFrame(R); + return; + } + let he = L / 1e3, + z = he - e.realTime, + Oe = n.maxFPS ? 1 / n.maxFPS : 0; + (e.realTime = he), + (x += z), + x > Oe && + (e.skipTime || + ((e.dt = x), (e.time += i()), e.fpsCounter.tick(e.dt)), + (x = 0), + (e.skipTime = !1), + e.numFrames++, + ft(), + l(), + yn()), + (e.loopID = requestAnimationFrame(R)); + }, "frame"); + R(0); + } + o(k, "run"); + function pe() { + return "ontouchstart" in window || navigator.maxTouchPoints > 0; + } + o(pe, "isTouchscreen"); + function C() { + return e.mousePos.clone(); + } + o(C, "mousePos"); + function Ae() { + return e.mouseDeltaPos.clone(); + } + o(Ae, "mouseDeltaPos"); + function $(l = "left") { + return e.mouseState.pressed.has(l); + } + o($, "isMousePressed"); + function Te(l = "left") { + return e.mouseState.down.has(l); + } + o(Te, "isMouseDown"); + function ye(l = "left") { + return e.mouseState.released.has(l); + } + o(ye, "isMouseReleased"); + function Se() { + return e.isMouseMoved; + } + o(Se, "isMouseMoved"); + function st(l) { + return l === void 0 + ? e.keyState.pressed.size > 0 + : e.keyState.pressed.has(l); + } + o(st, "isKeyPressed"); + function an(l) { + return l === void 0 + ? e.keyState.pressedRepeat.size > 0 + : e.keyState.pressedRepeat.has(l); + } + o(an, "isKeyPressedRepeat"); + function Tt(l) { + return l === void 0 ? e.keyState.down.size > 0 : e.keyState.down.has(l); + } + o(Tt, "isKeyDown"); + function Ot(l) { + return l === void 0 + ? e.keyState.released.size > 0 + : e.keyState.released.has(l); + } + o(Ot, "isKeyReleased"); + function Rt(l) { + return l === void 0 + ? e.mergedGamepadState.buttonState.pressed.size > 0 + : e.mergedGamepadState.buttonState.pressed.has(l); + } + o(Rt, "isGamepadButtonPressed"); + function Ye(l) { + return l === void 0 + ? e.mergedGamepadState.buttonState.down.size > 0 + : e.mergedGamepadState.buttonState.down.has(l); + } + o(Ye, "isGamepadButtonDown"); + function un(l) { + return l === void 0 + ? e.mergedGamepadState.buttonState.released.size > 0 + : e.mergedGamepadState.buttonState.released.has(l); + } + o(un, "isGamepadButtonReleased"); + function cn(l) { + return e.events.on("resize", l); + } + o(cn, "onResize"); + let hn = Ee( + (l) => e.events.on("keyDown", l), + (l, x) => e.events.on("keyDown", (R) => R === l && x(l)) + ), + ln = Ee( + (l) => e.events.on("keyPress", l), + (l, x) => e.events.on("keyPress", (R) => R === l && x(l)) + ), + dn = Ee( + (l) => e.events.on("keyPressRepeat", l), + (l, x) => e.events.on("keyPressRepeat", (R) => R === l && x(l)) + ), + fn = Ee( + (l) => e.events.on("keyRelease", l), + (l, x) => e.events.on("keyRelease", (R) => R === l && x(l)) + ), + Pt = Ee( + (l) => e.events.on("mouseDown", (x) => l(x)), + (l, x) => e.events.on("mouseDown", (R) => R === l && x(R)) + ), + Dt = Ee( + (l) => e.events.on("mousePress", (x) => l(x)), + (l, x) => e.events.on("mousePress", (R) => R === l && x(R)) + ), + Mt = Ee( + (l) => e.events.on("mouseRelease", (x) => l(x)), + (l, x) => e.events.on("mouseRelease", (R) => R === l && x(R)) + ); + function Gt(l) { + return e.events.on("mouseMove", () => l(C(), Ae())); + } + o(Gt, "onMouseMove"); + function Bt(l) { + return e.events.on("charInput", l); + } + o(Bt, "onCharInput"); + function mn(l) { + return e.events.on("touchStart", l); + } + o(mn, "onTouchStart"); + function ct(l) { + return e.events.on("touchMove", l); + } + o(ct, "onTouchMove"); + function pn(l) { + return e.events.on("touchEnd", l); + } + o(pn, "onTouchEnd"); + function gn(l) { + return e.events.on("scroll", l); + } + o(gn, "onScroll"); + function Ft(l) { + return e.events.on("hide", l); + } + o(Ft, "onHide"); + function wn(l) { + return e.events.on("show", l); + } + o(wn, "onShow"); + function It(l, x) { + if (typeof l == "function") return e.events.on("gamepadButtonDown", l); + if (typeof l == "string" && typeof x == "function") + return e.events.on("gamepadButtonDown", (R) => R === l && x(l)); + } + o(It, "onGamepadButtonDown"); + function Lt(l, x) { + if (typeof l == "function") return e.events.on("gamepadButtonPress", l); + if (typeof l == "string" && typeof x == "function") + return e.events.on("gamepadButtonPress", (R) => R === l && x(l)); + } + o(Lt, "onGamepadButtonPress"); + function bn(l, x) { + if (typeof l == "function") + return e.events.on("gamepadButtonRelease", l); + if (typeof l == "string" && typeof x == "function") + return e.events.on("gamepadButtonRelease", (R) => R === l && x(l)); + } + o(bn, "onGamepadButtonRelease"); + function ht(l, x) { + return e.events.on("gamepadStick", (R, L) => R === l && x(L)); + } + o(ht, "onGamepadStick"); + function vn(l) { + e.events.on("gamepadConnect", l); + } + o(vn, "onGamepadConnect"); + function lt(l) { + e.events.on("gamepadDisconnect", l); + } + o(lt, "onGamepadDisconnect"); + function Pe(l) { + return e.mergedGamepadState.stickState.get(l) || new v(0); + } + o(Pe, "getGamepadStick"); + function dt() { + return [...e.charInputted]; + } + o(dt, "charInputted"); + function Vt() { + return [...e.gamepads]; + } + o(Vt, "getGamepads"); + function ft() { + e.events.trigger("input"), + e.keyState.down.forEach((l) => e.events.trigger("keyDown", l)), + e.mouseState.down.forEach((l) => e.events.trigger("mouseDown", l)), + He(); + } + o(ft, "processInput"); + function yn() { + e.keyState.update(), + e.mouseState.update(), + e.mergedGamepadState.buttonState.update(), + e.mergedGamepadState.stickState.forEach((l, x) => { + e.mergedGamepadState.stickState.set(x, new v(0)); + }), + (e.charInputted = []), + (e.isMouseMoved = !1), + e.gamepadStates.forEach((l) => { + l.buttonState.update(), + l.stickState.forEach((x, R) => { + l.stickState.set(R, new v(0)); + }); + }); + } + o(yn, "resetInput"); + function _t(l) { + let x = { + index: l.index, + isPressed: (R) => + e.gamepadStates.get(l.index).buttonState.pressed.has(R), + isDown: (R) => e.gamepadStates.get(l.index).buttonState.down.has(R), + isReleased: (R) => + e.gamepadStates.get(l.index).buttonState.released.has(R), + getStick: (R) => e.gamepadStates.get(l.index).stickState.get(R), + }; + return ( + e.gamepads.push(x), + e.gamepadStates.set(l.index, { + buttonState: new at(), + stickState: new Map([ + ["left", new v(0)], + ["right", new v(0)], + ]), + }), + x + ); + } + o(_t, "registerGamepad"); + function ne(l) { + (e.gamepads = e.gamepads.filter((x) => x.index !== l.index)), + e.gamepadStates.delete(l.index); + } + o(ne, "removeGamepad"); + function He() { + for (let l of navigator.getGamepads()) + l && !e.gamepadStates.has(l.index) && _t(l); + for (let l of e.gamepads) { + let x = navigator.getGamepads()[l.index], + L = (n.gamepads ?? {})[x.id] ?? $n[x.id] ?? $n.default, + he = e.gamepadStates.get(l.index); + for (let z = 0; z < x.buttons.length; z++) + x.buttons[z].pressed + ? (he.buttonState.down.has(L.buttons[z]) || + (e.mergedGamepadState.buttonState.press(L.buttons[z]), + he.buttonState.press(L.buttons[z]), + e.events.trigger("gamepadButtonPress", L.buttons[z])), + e.events.trigger("gamepadButtonDown", L.buttons[z])) + : he.buttonState.down.has(L.buttons[z]) && + (e.mergedGamepadState.buttonState.release(L.buttons[z]), + he.buttonState.release(L.buttons[z]), + e.events.trigger("gamepadButtonRelease", L.buttons[z])); + for (let z in L.sticks) { + let Oe = L.sticks[z], + $e = new v(x.axes[Oe.x], x.axes[Oe.y]); + he.stickState.set(z, $e), + e.mergedGamepadState.stickState.set(z, $e), + e.events.trigger("gamepadStick", z, $e); + } + } + } + o(He, "processGamepad"); + let se = {}, + le = {}, + ae = {}, + Be = n.pixelDensity || window.devicePixelRatio || 1; + se.mousemove = (l) => { + let x = new v(l.offsetX, l.offsetY), + R = new v(l.movementX, l.movementY); + if (Q()) { + let L = e.canvas.width / Be, + he = e.canvas.height / Be, + z = window.innerWidth, + Oe = window.innerHeight, + $e = z / Oe, + kt = L / he; + if ($e > kt) { + let De = Oe / he, + Ce = (z - L * De) / 2; + (x.x = _e(l.offsetX - Ce, 0, L * De, 0, L)), + (x.y = _e(l.offsetY, 0, he * De, 0, he)); + } else { + let De = z / L, + Ce = (Oe - he * De) / 2; + (x.x = _e(l.offsetX, 0, L * De, 0, L)), + (x.y = _e(l.offsetY - Ce, 0, he * De, 0, he)); + } + } + e.events.onOnce("input", () => { + (e.isMouseMoved = !0), + (e.mousePos = x), + (e.mouseDeltaPos = R), + e.events.trigger("mouseMove"); + }); + }; + let We = ["left", "middle", "right", "back", "forward"]; + (se.mousedown = (l) => { + e.events.onOnce("input", () => { + let x = We[l.button]; + x && (e.mouseState.press(x), e.events.trigger("mousePress", x)); + }); + }), + (se.mouseup = (l) => { + e.events.onOnce("input", () => { + let x = We[l.button]; + x && (e.mouseState.release(x), e.events.trigger("mouseRelease", x)); + }); + }); + let xn = new Set([ + " ", + "ArrowLeft", + "ArrowRight", + "ArrowUp", + "ArrowDown", + "Tab", + ]), + qe = { + ArrowLeft: "left", + ArrowRight: "right", + ArrowUp: "up", + ArrowDown: "down", + " ": "space", + }; + (se.keydown = (l) => { + xn.has(l.key) && l.preventDefault(), + e.events.onOnce("input", () => { + let x = qe[l.key] || l.key.toLowerCase(); + x.length === 1 + ? (e.events.trigger("charInput", x), e.charInputted.push(x)) + : x === "space" && + (e.events.trigger("charInput", " "), e.charInputted.push(" ")), + l.repeat + ? (e.keyState.pressRepeat(x), + e.events.trigger("keyPressRepeat", x)) + : (e.keyState.press(x), + e.events.trigger("keyPressRepeat", x), + e.events.trigger("keyPress", x)); + }); + }), + (se.keyup = (l) => { + e.events.onOnce("input", () => { + let x = qe[l.key] || l.key.toLowerCase(); + e.keyState.release(x), e.events.trigger("keyRelease", x); + }); + }), + (se.touchstart = (l) => { + l.preventDefault(), + e.events.onOnce("input", () => { + let x = [...l.changedTouches], + R = e.canvas.getBoundingClientRect(); + n.touchToMouse !== !1 && + ((e.mousePos = new v(x[0].clientX - R.x, x[0].clientY - R.y)), + e.mouseState.press("left"), + e.events.trigger("mousePress", "left")), + x.forEach((L) => { + e.events.trigger( + "touchStart", + new v(L.clientX - R.x, L.clientY - R.y), + L + ); + }); + }); + }), + (se.touchmove = (l) => { + l.preventDefault(), + e.events.onOnce("input", () => { + let x = [...l.changedTouches], + R = e.canvas.getBoundingClientRect(); + n.touchToMouse !== !1 && + ((e.mousePos = new v(x[0].clientX - R.x, x[0].clientY - R.y)), + e.events.trigger("mouseMove")), + x.forEach((L) => { + e.events.trigger( + "touchMove", + new v(L.clientX - R.x, L.clientY - R.y), + L + ); + }); + }); + }), + (se.touchend = (l) => { + e.events.onOnce("input", () => { + let x = [...l.changedTouches], + R = e.canvas.getBoundingClientRect(); + n.touchToMouse !== !1 && + ((e.mousePos = new v(x[0].clientX - R.x, x[0].clientY - R.y)), + e.mouseState.release("left"), + e.events.trigger("mouseRelease", "left")), + x.forEach((L) => { + e.events.trigger( + "touchEnd", + new v(L.clientX - R.x, L.clientY - R.y), + L + ); + }); + }); + }), + (se.touchcancel = (l) => { + e.events.onOnce("input", () => { + let x = [...l.changedTouches], + R = e.canvas.getBoundingClientRect(); + n.touchToMouse !== !1 && + ((e.mousePos = new v(x[0].clientX - R.x, x[0].clientY - R.y)), + e.mouseState.release("left"), + e.events.trigger("mouseRelease", "left")), + x.forEach((L) => { + e.events.trigger( + "touchEnd", + new v(L.clientX - R.x, L.clientY - R.y), + L + ); + }); + }); + }), + (se.wheel = (l) => { + l.preventDefault(), + e.events.onOnce("input", () => { + e.events.trigger("scroll", new v(l.deltaX, l.deltaY)); + }); + }), + (se.contextmenu = (l) => l.preventDefault()), + (le.visibilitychange = () => { + document.visibilityState === "visible" + ? ((e.skipTime = !0), e.events.trigger("show")) + : e.events.trigger("hide"); + }), + (ae.gamepadconnected = (l) => { + let x = _t(l.gamepad); + e.events.onOnce("input", () => { + e.events.trigger("gamepadConnect", x); + }); + }), + (ae.gamepaddisconnected = (l) => { + let x = Vt().filter((R) => R.index === l.gamepad.index)[0]; + ne(l.gamepad), + e.events.onOnce("input", () => { + e.events.trigger("gamepadDisconnect", x); + }); + }); + for (let l in se) e.canvas.addEventListener(l, se[l]); + for (let l in le) document.addEventListener(l, le[l]); + for (let l in ae) window.addEventListener(l, ae[l]); + let ge = new ResizeObserver((l) => { + for (let x of l) + if (x.target === e.canvas) { + if ( + e.lastWidth === e.canvas.offsetWidth && + e.lastHeight === e.canvas.offsetHeight + ) + return; + (e.lastWidth = e.canvas.offsetWidth), + (e.lastHeight = e.canvas.offsetHeight), + e.events.onOnce("input", () => { + e.events.trigger("resize"); + }); + } + }); + return ( + ge.observe(e.canvas), + { + dt: i, + time: c, + run: k, + canvas: e.canvas, + fps: m, + numFrames: p, + quit: te, + setFullscreen: K, + isFullscreen: Q, + setCursor: I, + screenshot: P, + getGamepads: Vt, + getCursor: j, + setCursorLocked: y, + isCursorLocked: X, + isTouchscreen: pe, + mousePos: C, + mouseDeltaPos: Ae, + isKeyDown: Tt, + isKeyPressed: st, + isKeyPressedRepeat: an, + isKeyReleased: Ot, + isMouseDown: Te, + isMousePressed: $, + isMouseReleased: ye, + isMouseMoved: Se, + isGamepadButtonPressed: Rt, + isGamepadButtonDown: Ye, + isGamepadButtonReleased: un, + getGamepadStick: Pe, + charInputted: dt, + onResize: cn, + onKeyDown: hn, + onKeyPress: ln, + onKeyPressRepeat: dn, + onKeyRelease: fn, + onMouseDown: Pt, + onMousePress: Dt, + onMouseRelease: Mt, + onMouseMove: Gt, + onCharInput: Bt, + onTouchStart: mn, + onTouchMove: ct, + onTouchEnd: pn, + onScroll: gn, + onHide: Ft, + onShow: wn, + onGamepadButtonDown: It, + onGamepadButtonPress: Lt, + onGamepadButtonRelease: bn, + onGamepadStick: ht, + onGamepadConnect: vn, + onGamepadDisconnect: lt, + events: e.events, + } + ); + }, "default"); + var Re = class n { + static { + o(this, "Texture"); + } + ctx; + src = null; + glTex; + width; + height; + constructor(e, i, c, m = {}) { + this.ctx = e; + let p = e.gl; + (this.glTex = e.gl.createTexture()), + e.onDestroy(() => this.free()), + (this.width = i), + (this.height = c); + let P = + { linear: p.LINEAR, nearest: p.NEAREST }[ + m.filter ?? e.opts.texFilter + ] ?? p.NEAREST, + I = + { repeat: p.REPEAT, clampToEadge: p.CLAMP_TO_EDGE }[m.wrap] ?? + p.CLAMP_TO_EDGE; + this.bind(), + i && + c && + p.texImage2D( + p.TEXTURE_2D, + 0, + p.RGBA, + i, + c, + 0, + p.RGBA, + p.UNSIGNED_BYTE, + null + ), + p.texParameteri(p.TEXTURE_2D, p.TEXTURE_MIN_FILTER, P), + p.texParameteri(p.TEXTURE_2D, p.TEXTURE_MAG_FILTER, P), + p.texParameteri(p.TEXTURE_2D, p.TEXTURE_WRAP_S, I), + p.texParameteri(p.TEXTURE_2D, p.TEXTURE_WRAP_T, I), + this.unbind(); + } + static fromImage(e, i, c = {}) { + let m = new n(e, i.width, i.height, c); + return m.update(i), (m.src = i), m; + } + update(e, i = 0, c = 0) { + let m = this.ctx.gl; + this.bind(), + m.texSubImage2D(m.TEXTURE_2D, 0, i, c, m.RGBA, m.UNSIGNED_BYTE, e), + this.unbind(); + } + bind() { + this.ctx.pushTexture2D(this.glTex); + } + unbind() { + this.ctx.popTexture2D(); + } + free() { + this.ctx.gl.deleteTexture(this.glTex); + } + }, + rt = class { + static { + o(this, "FrameBuffer"); + } + ctx; + tex; + glFramebuffer; + glRenderbuffer; + constructor(e, i, c, m = {}) { + this.ctx = e; + let p = e.gl; + e.onDestroy(() => this.free()), + (this.tex = new Re(e, i, c, m)), + (this.glFramebuffer = p.createFramebuffer()), + (this.glRenderbuffer = p.createRenderbuffer()), + this.bind(), + p.renderbufferStorage(p.RENDERBUFFER, p.DEPTH_STENCIL, i, c), + p.framebufferTexture2D( + p.FRAMEBUFFER, + p.COLOR_ATTACHMENT0, + p.TEXTURE_2D, + this.tex.glTex, + 0 + ), + p.framebufferRenderbuffer( + p.FRAMEBUFFER, + p.DEPTH_STENCIL_ATTACHMENT, + p.RENDERBUFFER, + this.glRenderbuffer + ), + this.unbind(); + } + get width() { + return this.tex.width; + } + get height() { + return this.tex.height; + } + toImageData() { + let e = this.ctx.gl, + i = new Uint8ClampedArray(this.width * this.height * 4); + this.bind(), + e.readPixels( + 0, + 0, + this.width, + this.height, + e.RGBA, + e.UNSIGNED_BYTE, + i + ), + this.unbind(); + let c = this.width * 4, + m = new Uint8Array(c); + for (let p = 0; p < ((this.height / 2) | 0); p++) { + let P = p * c, + I = (this.height - p - 1) * c; + m.set(i.subarray(P, P + c)), i.copyWithin(P, I, I + c), i.set(m, I); + } + return new ImageData(i, this.width, this.height); + } + toDataURL() { + let e = document.createElement("canvas"), + i = e.getContext("2d"); + return ( + (e.width = this.width), + (e.height = this.height), + i.putImageData(this.toImageData(), 0, 0), + e.toDataURL() + ); + } + draw(e) { + this.bind(), e(), this.unbind(); + } + bind() { + this.ctx.pushFramebuffer(this.glFramebuffer), + this.ctx.pushRenderbuffer(this.glRenderbuffer), + this.ctx.pushViewport({ x: 0, y: 0, w: this.width, h: this.height }); + } + unbind() { + this.ctx.popFramebuffer(), + this.ctx.popRenderbuffer(), + this.ctx.popViewport(); + } + free() { + let e = this.ctx.gl; + e.deleteFramebuffer(this.glFramebuffer), + e.deleteRenderbuffer(this.glRenderbuffer), + this.tex.free(); + } + }, + Qt = class { + static { + o(this, "Shader"); + } + ctx; + glProgram; + constructor(e, i, c, m) { + (this.ctx = e), e.onDestroy(() => this.free()); + let p = e.gl, + P = p.createShader(p.VERTEX_SHADER), + I = p.createShader(p.FRAGMENT_SHADER); + p.shaderSource(P, i), + p.shaderSource(I, c), + p.compileShader(P), + p.compileShader(I); + let j = p.createProgram(); + if ( + ((this.glProgram = j), + p.attachShader(j, P), + p.attachShader(j, I), + m.forEach((y, X) => p.bindAttribLocation(j, X, y)), + p.linkProgram(j), + !p.getProgramParameter(j, p.LINK_STATUS)) + ) { + let y = p.getShaderInfoLog(P); + if (y) throw new Error("VERTEX SHADER " + y); + let X = p.getShaderInfoLog(I); + if (X) throw new Error("FRAGMENT SHADER " + X); + } + p.deleteShader(P), p.deleteShader(I); + } + bind() { + this.ctx.pushProgram(this.glProgram); + } + unbind() { + this.ctx.popProgram(); + } + send(e) { + let i = this.ctx.gl; + for (let c in e) { + let m = e[c], + p = i.getUniformLocation(this.glProgram, c); + typeof m == "number" + ? i.uniform1f(p, m) + : m instanceof Ue + ? i.uniformMatrix4fv(p, !1, new Float32Array(m.m)) + : m instanceof W + ? i.uniform3f(p, m.r, m.g, m.b) + : m instanceof v && i.uniform2f(p, m.x, m.y); + } + } + free() { + this.ctx.gl.deleteProgram(this.glProgram); + } + }, + Zt = class { + static { + o(this, "BatchRenderer"); + } + ctx; + glVBuf; + glIBuf; + vqueue = []; + iqueue = []; + stride; + maxVertices; + maxIndices; + vertexFormat; + numDraws = 0; + curPrimitive = null; + curTex = null; + curShader = null; + curUniform = {}; + constructor(e, i, c, m) { + let p = e.gl; + (this.vertexFormat = i), + (this.ctx = e), + (this.stride = i.reduce((P, I) => P + I.size, 0)), + (this.maxVertices = c), + (this.maxIndices = m), + (this.glVBuf = p.createBuffer()), + e.pushArrayBuffer(this.glVBuf), + p.bufferData(p.ARRAY_BUFFER, c * 4, p.DYNAMIC_DRAW), + e.popArrayBuffer(), + (this.glIBuf = p.createBuffer()), + e.pushElementArrayBuffer(this.glIBuf), + p.bufferData(p.ELEMENT_ARRAY_BUFFER, m * 4, p.DYNAMIC_DRAW), + e.popElementArrayBuffer(); + } + push(e, i, c, m, p = null, P = {}) { + (e !== this.curPrimitive || + p !== this.curTex || + m !== this.curShader || + !Xt(this.curUniform, P) || + this.vqueue.length + i.length * this.stride > this.maxVertices || + this.iqueue.length + c.length > this.maxIndices) && + this.flush(); + let I = this.vqueue.length / this.stride; + for (let j of i) this.vqueue.push(j); + for (let j of c) this.iqueue.push(j + I); + (this.curPrimitive = e), + (this.curShader = m), + (this.curTex = p), + (this.curUniform = P); + } + flush() { + if ( + !this.curPrimitive || + !this.curShader || + this.vqueue.length === 0 || + this.iqueue.length === 0 + ) + return; + let e = this.ctx.gl; + this.ctx.pushArrayBuffer(this.glVBuf), + e.bufferSubData(e.ARRAY_BUFFER, 0, new Float32Array(this.vqueue)), + this.ctx.pushElementArrayBuffer(this.glIBuf), + e.bufferSubData( + e.ELEMENT_ARRAY_BUFFER, + 0, + new Uint16Array(this.iqueue) + ), + this.ctx.setVertexFormat(this.vertexFormat), + this.curShader.bind(), + this.curShader.send(this.curUniform), + this.curTex?.bind(), + e.drawElements( + this.curPrimitive, + this.iqueue.length, + e.UNSIGNED_SHORT, + 0 + ), + this.curTex?.unbind(), + this.curShader.unbind(), + this.ctx.popArrayBuffer(), + this.ctx.popElementArrayBuffer(), + (this.vqueue = []), + (this.iqueue = []), + this.numDraws++; + } + free() { + let e = this.ctx.gl; + e.deleteBuffer(this.glVBuf), e.deleteBuffer(this.glIBuf); + } + }; + function nt(n) { + let e = [], + i = o((p) => { + e.push(p), n(p); + }, "push"), + c = o(() => { + e.pop(), n(m() ?? null); + }, "pop"), + m = o(() => e[e.length - 1], "cur"); + return [i, c, m]; + } + o(nt, "genStack"); + function Yn(n, e = {}) { + let i = []; + function c($) { + i.push($); + } + o(c, "onDestroy"); + function m() { + i.forEach(($) => $()), n.getExtension("WEBGL_lose_context").loseContext(); + } + o(m, "destroy"); + let p = null; + function P($) { + if (Xt($, p)) return; + p = $; + let Te = $.reduce((ye, Se) => ye + Se.size, 0); + $.reduce( + (ye, Se, st) => ( + n.vertexAttribPointer(st, Se.size, n.FLOAT, !1, Te * 4, ye), + n.enableVertexAttribArray(st), + ye + Se.size * 4 + ), + 0 + ); + } + o(P, "setVertexFormat"); + let [I, j] = nt(($) => n.bindTexture(n.TEXTURE_2D, $)), + [y, X] = nt(($) => n.bindBuffer(n.ARRAY_BUFFER, $)), + [S, q] = nt(($) => n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, $)), + [E, K] = nt(($) => n.bindFramebuffer(n.FRAMEBUFFER, $)), + [Q, te] = nt(($) => n.bindRenderbuffer(n.RENDERBUFFER, $)), + [k, pe] = nt(({ x: $, y: Te, w: ye, h: Se }) => { + n.viewport($, Te, ye, Se); + }), + [C, Ae] = nt(($) => n.useProgram($)); + return ( + k({ x: 0, y: 0, w: n.drawingBufferWidth, h: n.drawingBufferHeight }), + { + gl: n, + opts: e, + onDestroy: c, + destroy: m, + pushTexture2D: I, + popTexture2D: j, + pushArrayBuffer: y, + popArrayBuffer: X, + pushElementArrayBuffer: S, + popElementArrayBuffer: q, + pushFramebuffer: E, + popFramebuffer: K, + pushRenderbuffer: Q, + popRenderbuffer: te, + pushViewport: k, + popViewport: pe, + pushProgram: C, + popProgram: Ae, + setVertexFormat: P, + } + ); + } + o(Yn, "initGfx"); + var ve = class n { + static { + o(this, "Asset"); + } + loaded = !1; + data = null; + error = null; + onLoadEvents = new be(); + onErrorEvents = new be(); + onFinishEvents = new be(); + constructor(e) { + e.then((i) => { + (this.data = i), this.onLoadEvents.trigger(i); + }) + .catch((i) => { + if (((this.error = i), this.onErrorEvents.numListeners() > 0)) + this.onErrorEvents.trigger(i); + else throw i; + }) + .finally(() => { + this.onFinishEvents.trigger(), (this.loaded = !0); + }); + } + static loaded(e) { + let i = new n(Promise.resolve(e)); + return (i.data = e), (i.loaded = !0), i; + } + onLoad(e) { + return ( + this.loaded && this.data ? e(this.data) : this.onLoadEvents.add(e), + this + ); + } + onError(e) { + return ( + this.loaded && this.error ? e(this.error) : this.onErrorEvents.add(e), + this + ); + } + onFinish(e) { + return this.loaded ? e() : this.onFinishEvents.add(e), this; + } + then(e) { + return this.onLoad(e); + } + catch(e) { + return this.onError(e); + } + finally(e) { + return this.onFinish(e); + } + }, + je = class { + static { + o(this, "AssetBucket"); + } + assets = new Map(); + lastUID = 0; + add(e, i) { + let c = e ?? this.lastUID++ + "", + m = new ve(i); + return this.assets.set(c, m), m; + } + addLoaded(e, i) { + let c = e ?? this.lastUID++ + "", + m = ve.loaded(i); + return this.assets.set(c, m), m; + } + get(e) { + return this.assets.get(e); + } + progress() { + if (this.assets.size === 0) return 1; + let e = 0; + return ( + this.assets.forEach((i) => { + i.loaded && e++; + }), + e / this.assets.size + ); + } + }; + function Wn(n) { + return fetch(n).then((e) => { + if (!e.ok) throw new Error(`Failed to fetch "${n}"`); + return e; + }); + } + o(Wn, "fetchURL"); + function Et(n) { + return Wn(n).then((e) => e.json()); + } + o(Et, "fetchJSON"); + function Vr(n) { + return Wn(n).then((e) => e.text()); + } + o(Vr, "fetchText"); + function _r(n) { + return Wn(n).then((e) => e.arrayBuffer()); + } + o(_r, "fetchArrayBuffer"); + function St(n) { + let e = new Image(); + return ( + (e.crossOrigin = "anonymous"), + (e.src = n), + new Promise((i, c) => { + (e.onload = () => i(e)), + (e.onerror = () => c(new Error(`Failed to load image from "${n}"`))); + }) + ); + } + o(St, "loadImg"); + var en = 2.5949095, + kr = 1.70158 + 1, + Nr = (2 * Math.PI) / 3, + jr = (2 * Math.PI) / 4.5, + tn = { + linear: (n) => n, + easeInSine: (n) => 1 - Math.cos((n * Math.PI) / 2), + easeOutSine: (n) => Math.sin((n * Math.PI) / 2), + easeInOutSine: (n) => -(Math.cos(Math.PI * n) - 1) / 2, + easeInQuad: (n) => n * n, + easeOutQuad: (n) => 1 - (1 - n) * (1 - n), + easeInOutQuad: (n) => + n < 0.5 ? 2 * n * n : 1 - Math.pow(-2 * n + 2, 2) / 2, + easeInCubic: (n) => n * n * n, + easeOutCubic: (n) => 1 - Math.pow(1 - n, 3), + easeInOutCubic: (n) => + n < 0.5 ? 4 * n * n * n : 1 - Math.pow(-2 * n + 2, 3) / 2, + easeInQuart: (n) => n * n * n * n, + easeOutQuart: (n) => 1 - Math.pow(1 - n, 4), + easeInOutQuart: (n) => + n < 0.5 ? 8 * n * n * n * n : 1 - Math.pow(-2 * n + 2, 4) / 2, + easeInQuint: (n) => n * n * n * n * n, + easeOutQuint: (n) => 1 - Math.pow(1 - n, 5), + easeInOutQuint: (n) => + n < 0.5 ? 16 * n * n * n * n * n : 1 - Math.pow(-2 * n + 2, 5) / 2, + easeInExpo: (n) => (n === 0 ? 0 : Math.pow(2, 10 * n - 10)), + easeOutExpo: (n) => (n === 1 ? 1 : 1 - Math.pow(2, -10 * n)), + easeInOutExpo: (n) => + n === 0 + ? 0 + : n === 1 + ? 1 + : n < 0.5 + ? Math.pow(2, 20 * n - 10) / 2 + : (2 - Math.pow(2, -20 * n + 10)) / 2, + easeInCirc: (n) => 1 - Math.sqrt(1 - Math.pow(n, 2)), + easeOutCirc: (n) => Math.sqrt(1 - Math.pow(n - 1, 2)), + easeInOutCirc: (n) => + n < 0.5 + ? (1 - Math.sqrt(1 - Math.pow(2 * n, 2))) / 2 + : (Math.sqrt(1 - Math.pow(-2 * n + 2, 2)) + 1) / 2, + easeInBack: (n) => kr * n * n * n - 1.70158 * n * n, + easeOutBack: (n) => + 1 + kr * Math.pow(n - 1, 3) + 1.70158 * Math.pow(n - 1, 2), + easeInOutBack: (n) => + n < 0.5 + ? (Math.pow(2 * n, 2) * ((en + 1) * 2 * n - en)) / 2 + : (Math.pow(2 * n - 2, 2) * ((en + 1) * (n * 2 - 2) + en) + 2) / 2, + easeInElastic: (n) => + n === 0 + ? 0 + : n === 1 + ? 1 + : -Math.pow(2, 10 * n - 10) * Math.sin((n * 10 - 10.75) * Nr), + easeOutElastic: (n) => + n === 0 + ? 0 + : n === 1 + ? 1 + : Math.pow(2, -10 * n) * Math.sin((n * 10 - 0.75) * Nr) + 1, + easeInOutElastic: (n) => + n === 0 + ? 0 + : n === 1 + ? 1 + : n < 0.5 + ? -(Math.pow(2, 20 * n - 10) * Math.sin((20 * n - 11.125) * jr)) / 2 + : (Math.pow(2, -20 * n + 10) * Math.sin((20 * n - 11.125) * jr)) / 2 + + 1, + easeInBounce: (n) => 1 - tn.easeOutBounce(1 - n), + easeOutBounce: (n) => + n < 1 / 2.75 + ? 7.5625 * n * n + : n < 2 / 2.75 + ? 7.5625 * (n -= 1.5 / 2.75) * n + 0.75 + : n < 2.5 / 2.75 + ? 7.5625 * (n -= 2.25 / 2.75) * n + 0.9375 + : 7.5625 * (n -= 2.625 / 2.75) * n + 0.984375, + easeInOutBounce: (n) => + n < 0.5 + ? (1 - tn.easeOutBounce(1 - 2 * n)) / 2 + : (1 + tn.easeOutBounce(2 * n - 1)) / 2, + }, + Ct = tn; + var At = class { + static { + o(this, "TexPacker"); + } + textures = []; + canvas; + c2d; + x = 0; + y = 0; + curHeight = 0; + gfx; + constructor(e, i, c) { + (this.gfx = e), + (this.canvas = document.createElement("canvas")), + (this.canvas.width = i), + (this.canvas.height = c), + (this.textures = [Re.fromImage(e, this.canvas)]), + (this.c2d = this.canvas.getContext("2d")); + } + add(e) { + if (e.width > this.canvas.width || e.height > this.canvas.height) + throw new Error( + `Texture size (${e.width} x ${e.height}) exceeds limit (${this.canvas.width} x ${this.canvas.height})` + ); + this.x + e.width > this.canvas.width && + ((this.x = 0), (this.y += this.curHeight), (this.curHeight = 0)), + this.y + e.height > this.canvas.height && + (this.c2d.clearRect(0, 0, this.canvas.width, this.canvas.height), + this.textures.push(Re.fromImage(this.gfx, this.canvas)), + (this.x = 0), + (this.y = 0), + (this.curHeight = 0)); + let i = this.textures[this.textures.length - 1], + c = new v(this.x, this.y); + return ( + (this.x += e.width), + e.height > this.curHeight && (this.curHeight = e.height), + e instanceof ImageData + ? this.c2d.putImageData(e, c.x, c.y) + : this.c2d.drawImage(e, c.x, c.y), + i.update(this.canvas), + [ + i, + new oe( + c.x / this.canvas.width, + c.y / this.canvas.height, + e.width / this.canvas.width, + e.height / this.canvas.height + ), + ] + ); + } + free() { + for (let e of this.textures) e.free(); + } + }; + var Hr = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAA1CAYAAADyMeOEAAAAAXNSR0IArs4c6QAAAoVJREFUaIHdm7txwkAQhheGAqACiCHzOKQDQrqgILpwSAeEDBnEUAF0gCMxZ7G72qce/mec2Lpf9+3unaS78wgSNZ8uX5729+d1FNWXUuGmXlBOUUEIMckEpeQJgBu6C+BSFngztBR2vd+ovY+7g+p6LbgaWgJrAeUkDYIUXgXdBBwNi6kpABJwMTQH3AZsXRR8GHTfgEth8E3gjdAUcNewpbTgY85sCMCUuOokozE0YM0YRzM9NGAAXd8+omAF5h4lnmBRvpSnZHyLoLEbaN+aKB9KWv/KWw0tAbbANnlG+UvB2dm77NxxdwgBpjrF/d7rW9cbmpvio2A5z8iAYpVU8pGZlo6/2+MSco2lHfd3rv9jAP038e1xef9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mCIqUepxWxerj7iIyNZ7SgiKmJhJw7NJpRgiKmLuHl3KnReA4UIaU+y+WkcbzHQ1DEzMGQ9aJH0BDK6RE0y9wlTDp2HuppERQxc0FFBaZGUMTMB5UlQG/fHyk1odJEaBUUMXWh4oSoFRQxtaHyxMi2uBseQwUKciUoYuaAShTlkaCImQcqUph7QREzF/8DSS/2GZ2/N/sAAAAASUVORK5CYII="; + var zi = "3000.1.17", + Kr = + " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", + nn = "topleft", + Yr = 64, + Ki = "monospace", + rn = "monospace", + Yi = 36, + sn = 64, + on = 256, + Wr = 2048, + Xr = 2048, + Jr = 2048, + Qr = 2048, + Zr = 0.1, + Wi = 64, + Xn = "linear", + Xi = 8, + Ji = 4, + Zn = [ + { name: "a_pos", size: 2 }, + { name: "a_uv", size: 2 }, + { name: "a_color", size: 4 }, + ], + Qi = Zn.reduce((n, e) => n + e.size, 0), + es = 2048, + Zi = es * 4 * Qi, + eo = es * 6, + to = ` +attribute vec2 a_pos; +attribute vec2 a_uv; +attribute vec4 a_color; + +varying vec2 v_pos; +varying vec2 v_uv; +varying vec4 v_color; + +vec4 def_vert() { + return vec4(a_pos, 0.0, 1.0); +} + +{{user}} + +void main() { + vec4 pos = vert(a_pos, a_uv, a_color); + v_pos = a_pos; + v_uv = a_uv; + v_color = a_color; + gl_Position = pos; +} +`, + no = ` +precision mediump float; + +varying vec2 v_pos; +varying vec2 v_uv; +varying vec4 v_color; + +uniform sampler2D u_tex; + +vec4 def_frag() { + return v_color * texture2D(u_tex, v_uv); +} + +{{user}} + +void main() { + gl_FragColor = frag(v_pos, v_uv, v_color, u_tex); + if (gl_FragColor.a == 0.0) { + discard; + } +} +`, + Jn = ` +vec4 vert(vec2 pos, vec2 uv, vec4 color) { + return def_vert(); +} +`, + Qn = ` +vec4 frag(vec2 pos, vec2 uv, vec4 color, sampler2D tex) { + return def_frag(); +} +`, + ro = new Set(["id", "require"]), + so = new Set([ + "add", + "update", + "draw", + "destroy", + "inspect", + "drawInspect", + ]); + function ut(n) { + switch (n) { + case "topleft": + return new v(-1, -1); + case "top": + return new v(0, -1); + case "topright": + return new v(1, -1); + case "left": + return new v(-1, 0); + case "center": + return new v(0, 0); + case "right": + return new v(1, 0); + case "botleft": + return new v(-1, 1); + case "bot": + return new v(0, 1); + case "botright": + return new v(1, 1); + default: + return n; + } + } + o(ut, "anchorPt"); + function io(n) { + switch (n) { + case "left": + return 0; + case "center": + return 0.5; + case "right": + return 1; + default: + return 0; + } + } + o(io, "alignPt"); + function oo(n) { + return n.createBuffer(1, 1, 44100); + } + o(oo, "createEmptyAudioBuffer"); + var ao = o((n = {}) => { + let e = n.root ?? document.body; + e === document.body && + ((document.body.style.width = "100%"), + (document.body.style.height = "100%"), + (document.body.style.margin = "0px"), + (document.documentElement.style.width = "100%"), + (document.documentElement.style.height = "100%")); + let i = + n.canvas ?? + (() => { + let t = document.createElement("canvas"); + return e.appendChild(t), t; + })(), + c = n.scale ?? 1, + m = n.width && n.height && !n.stretch && !n.letterbox; + m + ? ((i.width = n.width * c), (i.height = n.height * c)) + : ((i.width = i.parentElement.offsetWidth), + (i.height = i.parentElement.offsetHeight)); + let p = ["outline: none", "cursor: default"]; + if (m) { + let t = i.width, + r = i.height; + p.push(`width: ${t}px`), p.push(`height: ${r}px`); + } else p.push("width: 100%"), p.push("height: 100%"); + n.crisp && + (p.push("image-rendering: pixelated"), + p.push("image-rendering: crisp-edges")), + (i.style.cssText = p.join(";")); + let P = n.pixelDensity || window.devicePixelRatio; + (i.width *= P), (i.height *= P), (i.tabIndex = 0); + let I = document.createElement("canvas"); + (I.width = on), (I.height = on); + let j = I.getContext("2d", { willReadFrequently: !0 }), + y = Lr({ + canvas: i, + touchToMouse: n.touchToMouse, + gamepads: n.gamepads, + pixelDensity: n.pixelDensity, + maxFPS: n.maxFPS, + }), + X = [], + S = y.canvas.getContext("webgl", { + antialias: !0, + depth: !0, + stencil: !0, + alpha: !0, + preserveDrawingBuffer: !0, + }), + q = Yn(S, { texFilter: n.texFilter }), + E = (() => { + let t = ht(Jn, Qn), + r = Re.fromImage( + q, + new ImageData(new Uint8ClampedArray([255, 255, 255, 255]), 1, 1) + ), + s = + n.width && n.height + ? new rt(q, n.width * P * c, n.height * P * c) + : new rt(q, S.drawingBufferWidth, S.drawingBufferHeight), + u = null, + a = 1; + n.background && + ((u = J(n.background)), + (a = Array.isArray(n.background) ? n.background[3] : 1), + S.clearColor(u.r / 255, u.g / 255, u.b / 255, a ?? 1)), + S.enable(S.BLEND), + S.blendFuncSeparate( + S.SRC_ALPHA, + S.ONE_MINUS_SRC_ALPHA, + S.ONE, + S.ONE_MINUS_SRC_ALPHA + ); + let h = new Zt(q, Zn, Zi, eo), + f = Re.fromImage( + q, + new ImageData( + new Uint8ClampedArray([ + 128, 128, 128, 255, 190, 190, 190, 255, 190, 190, 190, 255, 128, + 128, 128, 255, + ]), + 2, + 2 + ), + { wrap: "repeat", filter: "nearest" } + ); + return { + lastDrawCalls: 0, + defShader: t, + defTex: r, + frameBuffer: s, + postShader: null, + postShaderUniform: null, + renderer: h, + transform: new Ue(), + transformStack: [], + bgTex: f, + bgColor: u, + bgAlpha: a, + width: n.width ?? S.drawingBufferWidth / P / c, + height: n.height ?? S.drawingBufferHeight / P / c, + viewport: { + x: 0, + y: 0, + width: S.drawingBufferWidth, + height: S.drawingBufferHeight, + }, + fixed: !1, + }; + })(); + class K { + static { + o(this, "SpriteData"); + } + tex; + frames = [new oe(0, 0, 1, 1)]; + anims = {}; + slice9 = null; + constructor(r, s, u = {}, a = null) { + (this.tex = r), + s && (this.frames = s), + (this.anims = u), + (this.slice9 = a); + } + get width() { + return this.tex.width * this.frames[0].w; + } + get height() { + return this.tex.height * this.frames[0].h; + } + static from(r, s = {}) { + return typeof r == "string" + ? K.fromURL(r, s) + : Promise.resolve(K.fromImage(r, s)); + } + static fromImage(r, s = {}) { + let [u, a] = k.packer.add(r), + h = s.frames + ? s.frames.map( + (f) => + new oe(a.x + f.x * a.w, a.y + f.y * a.h, f.w * a.w, f.h * a.h) + ) + : Tt(s.sliceX || 1, s.sliceY || 1, a.x, a.y, a.w, a.h); + return new K(u, h, s.anims, s.slice9); + } + static fromURL(r, s = {}) { + return St(r).then((u) => K.fromImage(u, s)); + } + } + class Q { + static { + o(this, "SoundData"); + } + buf; + constructor(r) { + this.buf = r; + } + static fromArrayBuffer(r) { + return new Promise((s, u) => te.ctx.decodeAudioData(r, s, u)).then( + (s) => new Q(s) + ); + } + static fromURL(r) { + return Hn(r) + ? Q.fromArrayBuffer(Dr(r)) + : _r(r).then((s) => Q.fromArrayBuffer(s)); + } + } + let te = (() => { + let t = new (window.AudioContext || window.webkitAudioContext)(), + r = t.createGain(); + r.connect(t.destination); + let s = new Q(oo(t)); + return ( + t + .decodeAudioData(qr.buffer.slice(0)) + .then((u) => { + s.buf = u; + }) + .catch((u) => { + console.error("Failed to load burp: ", u); + }), + { ctx: t, masterNode: r, burpSnd: s } + ); + })(), + k = { + urlPrefix: "", + sprites: new je(), + fonts: new je(), + bitmapFonts: new je(), + sounds: new je(), + shaders: new je(), + custom: new je(), + packer: new At(q, Jr, Qr), + loaded: !1, + }; + function pe(t) { + return typeof t != "string" || Hn(t) ? t : k.urlPrefix + t; + } + o(pe, "fixURL"); + let C = { + events: new Ne(), + objEvents: new Ne(), + root: En([]), + gravity: 0, + scenes: {}, + logs: [], + cam: { + pos: null, + scale: new v(1), + angle: 0, + shake: 0, + transform: new Ue(), + }, + }; + C.root.use(Tn()); + function Ae(t) { + return k.custom.add(null, t); + } + o(Ae, "load"); + function $() { + let t = [ + k.sprites, + k.sounds, + k.shaders, + k.fonts, + k.bitmapFonts, + k.custom, + ]; + return t.reduce((r, s) => r + s.progress(), 0) / t.length; + } + o($, "loadProgress"); + function Te(t) { + return t !== void 0 && (k.urlPrefix = t), k.urlPrefix; + } + o(Te, "loadRoot"); + function ye(t, r) { + return k.custom.add(t, Et(r)); + } + o(ye, "loadJSON"); + class Se { + static { + o(this, "FontData"); + } + fontface; + filter = Xn; + outline = null; + size = sn; + constructor(r, s = {}) { + if ( + ((this.fontface = r), + (this.filter = s.filter ?? Xn), + (this.size = s.size ?? sn), + this.size > on) + ) + throw new Error(`Max font size: ${on}`); + s.outline && + ((this.outline = { width: 1, color: J(0, 0, 0) }), + typeof s.outline == "number" + ? (this.outline.width = s.outline) + : typeof s.outline == "object" && + (s.outline.width && (this.outline.width = s.outline.width), + s.outline.color && (this.outline.color = s.outline.color))); + } + } + function st(t, r, s = {}) { + let u = new FontFace(t, typeof r == "string" ? `url(${r})` : r); + return ( + document.fonts.add(u), + k.fonts.add( + t, + u + .load() + .catch((a) => { + throw new Error(`Failed to load font from "${r}": ${a}`); + }) + .then((a) => new Se(a, s)) + ) + ); + } + o(st, "loadFont"); + function an(t, r, s, u, a = {}) { + return k.bitmapFonts.add( + t, + St(r).then((h) => vn(Re.fromImage(q, h, a), s, u, a.chars ?? Kr)) + ); + } + o(an, "loadBitmapFont"); + function Tt(t = 1, r = 1, s = 0, u = 0, a = 1, h = 1) { + let f = [], + b = a / t, + g = h / r; + for (let d = 0; d < r; d++) + for (let w = 0; w < t; w++) f.push(new oe(s + w * b, u + d * g, b, g)); + return f; + } + o(Tt, "slice"); + function Ot(t, r) { + return ( + (t = pe(t)), + Ae( + typeof r == "string" + ? new Promise((s, u) => { + Et(r).then((a) => { + Ot(t, a).then(s).catch(u); + }); + }) + : K.from(t).then((s) => { + let u = {}; + for (let a in r) { + let h = r[a], + f = s.frames[0], + b = Jr * f.w, + g = Qr * f.h, + d = h.frames + ? h.frames.map( + (A) => + new oe( + f.x + ((h.x + A.x) / b) * f.w, + f.y + ((h.y + A.y) / g) * f.h, + (A.w / b) * f.w, + (A.h / g) * f.h + ) + ) + : Tt( + h.sliceX || 1, + h.sliceY || 1, + f.x + (h.x / b) * f.w, + f.y + (h.y / g) * f.h, + (h.width / b) * f.w, + (h.height / g) * f.h + ), + w = new K(s.tex, d, h.anims); + k.sprites.addLoaded(a, w), (u[a] = w); + } + return u; + }) + ) + ); + } + o(Ot, "loadSpriteAtlas"); + function Rt(t, r = {}) { + let s = document.createElement("canvas"), + u = t[0].width, + a = t[0].height; + (s.width = u * t.length), (s.height = a); + let h = s.getContext("2d"); + t.forEach((b, g) => { + b instanceof ImageData + ? h.putImageData(b, g * u, 0) + : h.drawImage(b, g * u, 0); + }); + let f = h.getImageData(0, 0, t.length * u, a); + return K.fromImage(f, { ...r, sliceX: t.length, sliceY: 1 }); + } + o(Rt, "createSpriteSheet"); + function Ye(t, r, s = { sliceX: 1, sliceY: 1, anims: {} }) { + return ( + (r = pe(r)), + Array.isArray(r) + ? r.some((u) => typeof u == "string") + ? k.sprites.add( + t, + Promise.all( + r.map((u) => + typeof u == "string" ? St(u) : Promise.resolve(u) + ) + ).then((u) => Rt(u, s)) + ) + : k.sprites.addLoaded(t, Rt(r, s)) + : typeof r == "string" + ? k.sprites.add(t, K.from(r, s)) + : k.sprites.addLoaded(t, K.fromImage(r, s)) + ); + } + o(Ye, "loadSprite"); + function un(t, r) { + return ( + (r = pe(r)), + k.sprites.add( + t, + new Promise(async (s) => { + let u = typeof r == "string" ? await Et(r) : r, + a = await Promise.all(u.frames.map(St)), + h = document.createElement("canvas"); + (h.width = u.width), (h.height = u.height * u.frames.length); + let f = h.getContext("2d"); + a.forEach((g, d) => { + f.drawImage(g, 0, d * u.height); + }); + let b = await Ye(null, h, { + sliceY: u.frames.length, + anims: u.anims, + }); + s(b); + }) + ) + ); + } + o(un, "loadPedit"); + function cn(t, r, s) { + (r = pe(r)), + (s = pe(s)), + typeof r == "string" && !s && (s = Gr(r) + ".json"); + let u = typeof s == "string" ? Et(s) : Promise.resolve(s); + return k.sprites.add( + t, + u.then((a) => { + let h = a.meta.size, + f = a.frames.map( + (g) => + new oe( + g.frame.x / h.w, + g.frame.y / h.h, + g.frame.w / h.w, + g.frame.h / h.h + ) + ), + b = {}; + for (let g of a.meta.frameTags) + g.from === g.to + ? (b[g.name] = g.from) + : (b[g.name] = { + from: g.from, + to: g.to, + speed: 10, + loop: !0, + pingpong: g.direction === "pingpong", + }); + return K.from(r, { frames: f, anims: b }); + }) + ); + } + o(cn, "loadAseprite"); + function hn(t, r, s) { + return k.shaders.addLoaded(t, ht(r, s)); + } + o(hn, "loadShader"); + function ln(t, r, s) { + (r = pe(r)), (s = pe(s)); + let u = o((h) => (h ? Vr(h) : Promise.resolve(null)), "resolveUrl"), + a = Promise.all([u(r), u(s)]).then(([h, f]) => ht(h, f)); + return k.shaders.add(t, a); + } + o(ln, "loadShaderURL"); + function dn(t, r) { + return ( + (r = pe(r)), + k.sounds.add( + t, + typeof r == "string" ? Q.fromURL(r) : Q.fromArrayBuffer(r) + ) + ); + } + o(dn, "loadSound"); + function fn(t = "bean") { + return Ye(t, Hr); + } + o(fn, "loadBean"); + function Pt(t) { + return k.sprites.get(t); + } + o(Pt, "getSprite"); + function Dt(t) { + return k.sounds.get(t); + } + o(Dt, "getSound"); + function Mt(t) { + return k.fonts.get(t); + } + o(Mt, "getFont"); + function Gt(t) { + return k.bitmapFonts.get(t); + } + o(Gt, "getBitmapFont"); + function Bt(t) { + return k.shaders.get(t); + } + o(Bt, "getShader"); + function mn(t) { + return k.custom.get(t); + } + o(mn, "getAsset"); + function ct(t) { + if (typeof t == "string") { + let r = Pt(t); + if (r) return r; + if ($() < 1) return null; + throw new Error(`Sprite not found: ${t}`); + } else { + if (t instanceof K) return ve.loaded(t); + if (t instanceof ve) return t; + throw new Error(`Invalid sprite: ${t}`); + } + } + o(ct, "resolveSprite"); + function pn(t) { + if (typeof t == "string") { + let r = Dt(t); + if (r) return r; + if ($() < 1) return null; + throw new Error(`Sound not found: ${t}`); + } else { + if (t instanceof Q) return ve.loaded(t); + if (t instanceof ve) return t; + throw new Error(`Invalid sound: ${t}`); + } + } + o(pn, "resolveSound"); + function gn(t) { + if (!t) return E.defShader; + if (typeof t == "string") { + let r = Bt(t); + if (r) return r.data ?? r; + if ($() < 1) return null; + throw new Error(`Shader not found: ${t}`); + } else if (t instanceof ve) return t.data ? t.data : t; + return t; + } + o(gn, "resolveShader"); + function Ft(t) { + if (!t) return Ft(n.font ?? Ki); + if (typeof t == "string") { + let r = Gt(t), + s = Mt(t); + if (r) return r.data ?? r; + if (s) return s.data ?? s; + if (document.fonts.check(`${sn}px ${t}`)) return t; + if ($() < 1) return null; + throw new Error(`Font not found: ${t}`); + } else if (t instanceof ve) return t.data ? t.data : t; + return t; + } + o(Ft, "resolveFont"); + function wn(t) { + return ( + t !== void 0 && (te.masterNode.gain.value = t), te.masterNode.gain.value + ); + } + o(wn, "volume"); + function It(t, r = {}) { + let s = te.ctx, + u = r.paused ?? !1, + a = s.createBufferSource(), + h = new be(), + f = s.createGain(), + b = r.seek ?? 0, + g = 0, + d = 0, + w = !1; + (a.loop = !!r.loop), + (a.detune.value = r.detune ?? 0), + (a.playbackRate.value = r.speed ?? 1), + a.connect(f), + (a.onended = () => { + N() >= a.buffer?.duration && h.trigger(); + }), + f.connect(te.masterNode), + (f.gain.value = r.volume ?? 1); + let A = o((M) => { + (a.buffer = M.buf), + u || ((g = s.currentTime), a.start(0, b), (w = !0)); + }, "start"), + D = pn(t); + D instanceof ve && D.onLoad(A); + let N = o(() => { + if (!a.buffer) return 0; + let M = u ? d - g : s.currentTime - g, + O = a.buffer.duration; + return a.loop ? M % O : Math.min(M, O); + }, "getTime"), + _ = o((M) => { + let O = s.createBufferSource(); + return ( + (O.buffer = M.buffer), + (O.loop = M.loop), + (O.playbackRate.value = M.playbackRate.value), + (O.detune.value = M.detune.value), + (O.onended = M.onended), + O.connect(f), + O + ); + }, "cloneNode"); + return { + stop() { + (this.paused = !0), this.seek(0); + }, + set paused(M) { + if (u !== M) + if (((u = M), M)) w && (a.stop(), (w = !1)), (d = s.currentTime); + else { + a = _(a); + let O = d - g; + a.start(0, O), (w = !0), (g = s.currentTime - O), (d = 0); + } + }, + get paused() { + return u; + }, + play(M = 0) { + this.seek(M), (this.paused = !1); + }, + seek(M) { + a.buffer?.duration && + (M > a.buffer.duration || + (u + ? ((a = _(a)), (g = d - M)) + : (a.stop(), + (a = _(a)), + (g = s.currentTime - M), + a.start(0, M), + (w = !0), + (d = 0)))); + }, + set speed(M) { + a.playbackRate.value = M; + }, + get speed() { + return a.playbackRate.value; + }, + set detune(M) { + a.detune.value = M; + }, + get detune() { + return a.detune.value; + }, + set volume(M) { + f.gain.value = Math.max(M, 0); + }, + get volume() { + return f.gain.value; + }, + set loop(M) { + a.loop = M; + }, + get loop() { + return a.loop; + }, + duration() { + return a.buffer?.duration ?? 0; + }, + time() { + return N() % this.duration(); + }, + onEnd(M) { + return h.add(M); + }, + then(M) { + return this.onEnd(M); + }, + }; + } + o(It, "play"); + function Lt(t) { + return It(te.burpSnd, t); + } + o(Lt, "burp"); + function bn(t, r) { + return new rt(q, t, r); + } + o(bn, "makeCanvas"); + function ht(t = Jn, r = Qn) { + let s = to.replace("{{user}}", t ?? Jn), + u = no.replace("{{user}}", r ?? Qn); + try { + return new Qt( + q, + s, + u, + Zn.map((a) => a.name) + ); + } catch (a) { + let f = /(?^\w+) SHADER ERROR: 0:(?\d+): (?.+)/, + b = Fr(a).match(f), + g = Number(b.groups.line) - 14, + d = b.groups.msg.trim(), + w = b.groups.type.toLowerCase(); + throw new Error(`${w} shader line ${g}: ${d}`); + } + } + o(ht, "makeShader"); + function vn(t, r, s, u) { + let a = t.width / r, + h = {}, + f = u.split("").entries(); + for (let [b, g] of f) + h[g] = new oe((b % a) * r, Math.floor(b / a) * s, r, s); + return { tex: t, map: h, size: s }; + } + o(vn, "makeFont"); + function lt(t, r, s, u = E.defTex, a = E.defShader, h = {}) { + let f = gn(a); + if (!f || f instanceof ve) return; + let b = E.fixed || s ? E.transform : C.cam.transform.mult(E.transform), + g = []; + for (let d of t) { + let w = yn(b.multVec2(d.pos)); + g.push( + w.x, + w.y, + d.uv.x, + d.uv.y, + d.color.r / 255, + d.color.g / 255, + d.color.b / 255, + d.opacity + ); + } + E.renderer.push(S.TRIANGLES, g, r, f, u, h); + } + o(lt, "drawRaw"); + function Pe() { + E.renderer.flush(); + } + o(Pe, "flush"); + function dt() { + S.clear(S.COLOR_BUFFER_BIT), + E.frameBuffer.bind(), + S.clear(S.COLOR_BUFFER_BIT), + E.bgColor || + Ce(() => { + Be({ + width: we(), + height: xe(), + quad: new oe(0, 0, we() / Yr, xe() / Yr), + tex: E.bgTex, + fixed: !0, + }); + }), + (E.renderer.numDraws = 0), + (E.fixed = !1), + (E.transformStack.length = 0), + (E.transform = new Ue()); + } + o(dt, "frameStart"); + function Vt(t, r) { + (E.postShader = t), (E.postShaderUniform = r ?? null); + } + o(Vt, "usePostEffect"); + function ft() { + Pe(), + (E.lastDrawCalls = E.renderer.numDraws), + E.frameBuffer.unbind(), + S.viewport(0, 0, S.drawingBufferWidth, S.drawingBufferHeight); + let t = E.width, + r = E.height; + (E.width = S.drawingBufferWidth / P), + (E.height = S.drawingBufferHeight / P), + We({ + flipY: !0, + tex: E.frameBuffer.tex, + pos: new v(E.viewport.x, E.viewport.y), + width: E.viewport.width, + height: E.viewport.height, + shader: E.postShader, + uniform: + typeof E.postShaderUniform == "function" + ? E.postShaderUniform() + : E.postShaderUniform, + fixed: !0, + }), + Pe(), + (E.width = t), + (E.height = r); + } + o(ft, "frameEnd"); + function yn(t) { + return new v((t.x / we()) * 2 - 1, (-t.y / xe()) * 2 + 1); + } + o(yn, "screen2ndc"); + function _t(t) { + E.transform = t.clone(); + } + o(_t, "pushMatrix"); + function ne(...t) { + if (t[0] === void 0) return; + let r = T(...t); + (r.x === 0 && r.y === 0) || E.transform.translate(r); + } + o(ne, "pushTranslate"); + function He(...t) { + if (t[0] === void 0) return; + let r = T(...t); + (r.x === 1 && r.y === 1) || E.transform.scale(r); + } + o(He, "pushScale"); + function se(t) { + t && E.transform.rotate(t); + } + o(se, "pushRotate"); + function le() { + E.transformStack.push(E.transform.clone()); + } + o(le, "pushTransform"); + function ae() { + E.transformStack.length > 0 && (E.transform = E.transformStack.pop()); + } + o(ae, "popTransform"); + function Be(t) { + if (t.width === void 0 || t.height === void 0) + throw new Error('drawUVQuad() requires property "width" and "height".'); + if (t.width <= 0 || t.height <= 0) return; + let r = t.width, + s = t.height, + a = ut(t.anchor || nn).scale(new v(r, s).scale(-0.5)), + h = t.quad || new oe(0, 0, 1, 1), + f = t.color || J(255, 255, 255), + b = t.opacity ?? 1, + g = t.tex ? Zr / t.tex.width : 0, + d = t.tex ? Zr / t.tex.height : 0, + w = h.x + g, + A = h.y + d, + D = h.w - g * 2, + N = h.h - d * 2; + le(), + ne(t.pos), + se(t.angle), + He(t.scale), + ne(a), + lt( + [ + { + pos: new v(-r / 2, s / 2), + uv: new v(t.flipX ? w + D : w, t.flipY ? A : A + N), + color: f, + opacity: b, + }, + { + pos: new v(-r / 2, -s / 2), + uv: new v(t.flipX ? w + D : w, t.flipY ? A + N : A), + color: f, + opacity: b, + }, + { + pos: new v(r / 2, -s / 2), + uv: new v(t.flipX ? w : w + D, t.flipY ? A + N : A), + color: f, + opacity: b, + }, + { + pos: new v(r / 2, s / 2), + uv: new v(t.flipX ? w : w + D, t.flipY ? A : A + N), + color: f, + opacity: b, + }, + ], + [0, 1, 3, 1, 2, 3], + t.fixed, + t.tex, + t.shader, + t.uniform + ), + ae(); + } + o(Be, "drawUVQuad"); + function We(t) { + if (!t.tex) throw new Error('drawTexture() requires property "tex".'); + let r = t.quad ?? new oe(0, 0, 1, 1), + s = t.tex.width * r.w, + u = t.tex.height * r.h, + a = new v(1); + if (t.tiled) { + let h = Math.ceil((t.width || s) / s), + f = Math.ceil((t.height || u) / u), + g = ut(t.anchor || nn) + .add(new v(1, 1)) + .scale(0.5) + .scale(h * s, f * u); + for (let d = 0; d < h; d++) + for (let w = 0; w < f; w++) + Be( + Object.assign({}, t, { + pos: (t.pos || new v(0)).add(new v(s * d, u * w)).sub(g), + scale: a.scale(t.scale || new v(1)), + tex: t.tex, + quad: r, + width: s, + height: u, + anchor: "topleft", + }) + ); + } else + t.width && t.height + ? ((a.x = t.width / s), (a.y = t.height / u)) + : t.width + ? ((a.x = t.width / s), (a.y = a.x)) + : t.height && ((a.y = t.height / u), (a.x = a.y)), + Be( + Object.assign({}, t, { + scale: a.scale(t.scale || new v(1)), + tex: t.tex, + quad: r, + width: s, + height: u, + }) + ); + } + o(We, "drawTexture"); + function xn(t) { + if (!t.sprite) throw new Error('drawSprite() requires property "sprite"'); + let r = ct(t.sprite); + if (!r || !r.data) return; + let s = r.data.frames[t.frame ?? 0]; + if (!s) throw new Error(`Frame not found: ${t.frame ?? 0}`); + We( + Object.assign({}, t, { + tex: r.data.tex, + quad: s.scale(t.quad ?? new oe(0, 0, 1, 1)), + }) + ); + } + o(xn, "drawSprite"); + function qe(t, r, s, u, a, h = 1) { + (u = Ge(u % 360)), (a = Ge(a % 360)), a <= u && (a += Math.PI * 2); + let f = [], + b = Math.ceil(((a - u) / Ge(8)) * h), + g = (a - u) / b; + for (let d = u; d < a; d += g) + f.push(t.add(r * Math.cos(d), s * Math.sin(d))); + return f.push(t.add(r * Math.cos(a), s * Math.sin(a))), f; + } + o(qe, "getArcPts"); + function ge(t) { + if (t.width === void 0 || t.height === void 0) + throw new Error('drawRect() requires property "width" and "height".'); + if (t.width <= 0 || t.height <= 0) return; + let r = t.width, + s = t.height, + a = ut(t.anchor || nn) + .add(1, 1) + .scale(new v(r, s).scale(-0.5)), + h = [new v(0, 0), new v(r, 0), new v(r, s), new v(0, s)]; + if (t.radius) { + let f = Math.min(Math.min(r, s) / 2, t.radius); + h = [ + new v(f, 0), + new v(r - f, 0), + ...qe(new v(r - f, f), f, f, 270, 360), + new v(r, f), + new v(r, s - f), + ...qe(new v(r - f, s - f), f, f, 0, 90), + new v(r - f, s), + new v(f, s), + ...qe(new v(f, s - f), f, f, 90, 180), + new v(0, s - f), + new v(0, f), + ...qe(new v(f, f), f, f, 180, 270), + ]; + } + z( + Object.assign({}, t, { + offset: a, + pts: h, + ...(t.gradient + ? { + colors: t.horizontal + ? [t.gradient[0], t.gradient[1], t.gradient[1], t.gradient[0]] + : [ + t.gradient[0], + t.gradient[0], + t.gradient[1], + t.gradient[1], + ], + } + : {}), + }) + ); + } + o(ge, "drawRect"); + function l(t) { + let { p1: r, p2: s } = t; + if (!r || !s) + throw new Error('drawLine() requires properties "p1" and "p2".'); + let u = t.width || 1, + a = s + .sub(r) + .unit() + .normal() + .scale(u * 0.5), + h = [r.sub(a), r.add(a), s.add(a), s.sub(a)].map((f) => ({ + pos: new v(f.x, f.y), + uv: new v(0), + color: t.color ?? W.WHITE, + opacity: t.opacity ?? 1, + })); + lt(h, [0, 1, 3, 1, 2, 3], t.fixed, E.defTex, t.shader, t.uniform); + } + o(l, "drawLine"); + function x(t) { + let r = t.pts; + if (!r) throw new Error('drawLines() requires property "pts".'); + if (!(r.length < 2)) + if (t.radius && r.length >= 3) { + let s = r[0].sdist(r[1]); + for (let a = 1; a < r.length - 1; a++) + s = Math.min(r[a].sdist(r[a + 1]), s); + let u = Math.min(t.radius, Math.sqrt(s) / 2); + l(Object.assign({}, t, { p1: r[0], p2: r[1] })); + for (let a = 1; a < r.length - 2; a++) { + let h = r[a], + f = r[a + 1]; + l(Object.assign({}, t, { p1: h, p2: f })); + } + l(Object.assign({}, t, { p1: r[r.length - 2], p2: r[r.length - 1] })); + } else + for (let s = 0; s < r.length - 1; s++) + l(Object.assign({}, t, { p1: r[s], p2: r[s + 1] })), + t.join !== "none" && + L(Object.assign({}, t, { pos: r[s], radius: t.width / 2 })); + } + o(x, "drawLines"); + function R(t) { + if (!t.p1 || !t.p2 || !t.p3) + throw new Error( + 'drawTriangle() requires properties "p1", "p2" and "p3".' + ); + return z(Object.assign({}, t, { pts: [t.p1, t.p2, t.p3] })); + } + o(R, "drawTriangle"); + function L(t) { + if (typeof t.radius != "number") + throw new Error('drawCircle() requires property "radius".'); + t.radius !== 0 && + he( + Object.assign({}, t, { + radiusX: t.radius, + radiusY: t.radius, + angle: 0, + }) + ); + } + o(L, "drawCircle"); + function he(t) { + if (t.radiusX === void 0 || t.radiusY === void 0) + throw new Error( + 'drawEllipse() requires properties "radiusX" and "radiusY".' + ); + if (t.radiusX === 0 || t.radiusY === 0) return; + let r = t.start ?? 0, + s = t.end ?? 360, + u = ut(t.anchor ?? "center").scale(new v(-t.radiusX, -t.radiusY)), + a = qe(u, t.radiusX, t.radiusY, r, s, t.resolution); + a.unshift(u); + let h = Object.assign({}, t, { + pts: a, + radius: 0, + ...(t.gradient + ? { + colors: [ + t.gradient[0], + ...Array(a.length - 1).fill(t.gradient[1]), + ], + } + : {}), + }); + if (s - r >= 360 && t.outline) { + t.fill !== !1 && z(Object.assign(h, { outline: null })), + z(Object.assign(h, { pts: a.slice(1), fill: !1 })); + return; + } + z(h); + } + o(he, "drawEllipse"); + function z(t) { + if (!t.pts) throw new Error('drawPolygon() requires property "pts".'); + let r = t.pts.length; + if (!(r < 3)) { + if ( + (le(), + ne(t.pos), + He(t.scale), + se(t.angle), + ne(t.offset), + t.fill !== !1) + ) { + let s = t.color ?? W.WHITE, + u = t.pts.map((h, f) => ({ + pos: new v(h.x, h.y), + uv: new v(0, 0), + color: t.colors && t.colors[f] ? t.colors[f].mult(s) : s, + opacity: t.opacity ?? 1, + })), + a = [...Array(r - 2).keys()].map((h) => [0, h + 1, h + 2]).flat(); + lt(u, t.indices ?? a, t.fixed, E.defTex, t.shader, t.uniform); + } + t.outline && + x({ + pts: [...t.pts, t.pts[0]], + radius: t.radius, + width: t.outline.width, + color: t.outline.color, + join: t.outline.join, + uniform: t.uniform, + fixed: t.fixed, + opacity: t.opacity, + }), + ae(); + } + } + o(z, "drawPolygon"); + function Oe(t, r, s) { + Pe(), + S.clear(S.STENCIL_BUFFER_BIT), + S.enable(S.STENCIL_TEST), + S.stencilFunc(S.NEVER, 1, 255), + S.stencilOp(S.REPLACE, S.REPLACE, S.REPLACE), + r(), + Pe(), + S.stencilFunc(s, 1, 255), + S.stencilOp(S.KEEP, S.KEEP, S.KEEP), + t(), + Pe(), + S.disable(S.STENCIL_TEST); + } + o(Oe, "drawStenciled"); + function $e(t, r) { + Oe(t, r, S.EQUAL); + } + o($e, "drawMasked"); + function kt(t, r) { + Oe(t, r, S.NOTEQUAL); + } + o(kt, "drawSubtracted"); + function De() { + return (E.viewport.width + E.viewport.height) / (E.width + E.height); + } + o(De, "getViewportScale"); + function Ce(t) { + Pe(); + let r = E.width, + s = E.height; + (E.width = E.viewport.width), + (E.height = E.viewport.height), + t(), + Pe(), + (E.width = r), + (E.height = s); + } + o(Ce, "drawUnscaled"); + function er(t, r) { + r.pos && (t.pos = t.pos.add(r.pos)), + r.scale && (t.scale = t.scale.scale(T(r.scale))), + r.angle && (t.angle += r.angle), + r.color && t.ch.length === 1 && (t.color = t.color.mult(r.color)), + r.opacity && (t.opacity *= r.opacity); + } + o(er, "applyCharTransform"); + let tr = /\[(?