@snabcentr/vue-ui-lib 4.22.3 → 4.22.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,7 +37,7 @@
37
37
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38
38
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
39
  PERFORMANCE OF THIS SOFTWARE.
40
- ***************************************************************************** */var co=function(){return co=Object.assign||function(e){for(var i,r=1,o=arguments.length;r<o;r++){i=arguments[r];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},co.apply(this,arguments)},jp={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},On={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Ns=500,qp=(function(){function t(e,i){return this.core=e,this.$LG=i,this.settings=co(co({},jp),this.core.settings),this}return t.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},t.prototype.enableZoom=function(e){var i=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){i.isImageSlide(i.core.index)&&(i.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===i.core.index&&i.setZoomEssentials())},r+30)},t.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(On.slideItemLoad+".zoom",this.enableZoom.bind(this))},t.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},t.prototype.getSwipeCords=function(e){var i=e.touches[0].pageX,r=e.touches[0].pageY;return{x:i,y:r}},t.prototype.getDragAllowedAxises=function(e,i){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),o=0,s=0,l=r.getBoundingClientRect();e?(o=r.offsetHeight*e,s=r.offsetWidth*e):i?(o=l.height+i*l.height,s=l.width+i*l.width):(o=l.height,s=l.width);var a=o>this.containerRect.height,c=s>this.containerRect.width;return{allowX:c,allowY:a}},t.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},t.prototype.zoomImage=function(e,i,r,o){if(!(!this.containerRect||Math.abs(i)<=0)){var s=this.containerRect.width/2+this.containerRect.left,l=this.containerRect.height/2+this.containerRect.top+this.scrollTop,a,c;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,i),u=d.allowY,f=d.allowX;this.positionChanged&&(a=this.left/(this.scale-i),c=this.top/(this.scale-i),this.pageX=s-a,this.pageY=l-c,this.positionChanged=!1);var h=this.getPossibleSwipeDragCords(i),m,p,g=s-this.pageX,b=l-this.pageY;if(e-i>1){var y=(e-i)/Math.abs(i);g=(i<0?-g:g)+this.left*(y+(i<0?-1:1)),b=(i<0?-b:b)+this.top*(y+(i<0?-1:1)),m=g/y,p=b/y}else{var y=(e-i)*i;m=g*y,p=b*y}r&&(f?this.isBeyondPossibleLeft(m,h.minX)?m=h.minX:this.isBeyondPossibleRight(m,h.maxX)&&(m=h.maxX):e>1&&(m<h.minX?m=h.minX:m>h.maxX&&(m=h.maxX)),u?this.isBeyondPossibleTop(p,h.minY)?p=h.minY:this.isBeyondPossibleBottom(p,h.maxY)&&(p=h.maxY):e>1&&(p<h.minY?p=h.minY:p>h.maxY&&(p=h.maxY))),this.setZoomStyles({x:m,y:p,scale:e}),this.left=m,this.top=p,o&&this.setZoomImageSize()}},t.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var i=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,i.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),i.css("width","auto").css("height","auto"),setTimeout(function(){i.removeClass("no-transition")},10)}},t.prototype.setZoomImageSize=function(){var e=this,i=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(i.addClass("no-transition"),e.imageReset=!0)},Ns),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var o=e.getDragAllowedAxises(e.scale);i.css("width",i.get().naturalWidth+"px").css("height",i.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),o.allowX&&o.allowY?i.addClass("reset-transition"):o.allowX&&!o.allowY?i.addClass("reset-transition-x"):!o.allowX&&o.allowY&&i.addClass("reset-transition-y")}},Ns+50)},t.prototype.setZoomStyles=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var s="translate3d("+e.x+"px, "+e.y+"px, 0)";i.css("transform",s)},t.prototype.setActualSize=function(e,i){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var o=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!o.src||r.core.outer.hasClass("lg-first-slide-loading"))){var s=r.getCurrentImageActualSizeScale(),l=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(s),r.setPageCords(i),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-l,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},Ns+110)}},t.prototype.getNaturalWidth=function(e){var i=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):i.get().naturalWidth},t.prototype.getActualSizeScale=function(e,i){var r,o;return e>=i?(r=e/i,o=r||2):o=1,o},t.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),i=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||i;return this.getActualSizeScale(r,i)},t.prototype.getPageCords=function(e){var i={};if(e)i.x=e.pageX||e.touches[0].pageX,i.y=e.pageY||e.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();i.x=r.width/2+r.left,i.y=r.height/2+this.scrollTop+r.top}return i},t.prototype.setPageCords=function(e){var i=this.getPageCords(e);this.pageX=i.x,this.pageY=i.y},t.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},t.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},t.prototype.getScale=function(e){var i=this.getCurrentImageActualSizeScale();return e<1?e=1:e>i&&(e=i),e},t.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var i=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var o=e.$LG(r.target);r.touches.length===1&&o.hasClass("lg-image")&&(i?(clearTimeout(i),i=null,r.preventDefault(),e.setActualSize(e.core.index,r)):i=setTimeout(function(){i=null},300))}),this.core.LGel.on(On.containerResize+".zoom "+On.rotateRight+".zoom "+On.rotateLeft+".zoom "+On.flipHorizontal+".zoom "+On.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var o=e.scale-e.settings.scale;o<1&&(o=1),e.beginZoom(o),e.zoomImage(o,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(On.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(On.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(On.afterSlide+".zoom",function(r){var o=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(o),e.resetImageTranslate(o),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},t.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},t.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var i=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e:this.core.index);i.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),r.find(".lg-img-wrap").first().removeAttr("style"),r.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},t.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},t.prototype.pinchZoom=function(){var e=this,i=0,r=!1,o=1,s=0,l=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(a){if(l=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&a.touches.length===2){if(a.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;o=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(a),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",i=e.getTouchDistance(a)}}),this.core.$inner.on("touchmove.lg",function(a){if(a.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(a.target).hasClass("lg-item")||l.get().contains(a.target))){a.preventDefault();var c=e.getTouchDistance(a),d=i-c;if(!r&&Math.abs(d)>5&&(r=!0),r){s=e.scale;var u=Math.max(1,o+-d*.02);e.scale=Math.round((u+Number.EPSILON)*100)/100;var f=e.scale-s;e.zoomImage(e.scale,Math.round((f+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(a){if(e.core.touchAction==="pinch"&&(e.$LG(a.target).hasClass("lg-item")||l.get().contains(a.target))){if(r=!1,i=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},t.prototype.touchendZoom=function(e,i,r,o,s){var l=i.x-e.x,a=i.y-e.y,c=Math.abs(l)/s+1,d=Math.abs(a)/s+1;c>2&&(c+=1),d>2&&(d+=1),l=l*c,a=a*d;var u=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),f={};f.x=this.left+l,f.y=this.top+a;var h=this.getPossibleSwipeDragCords();(Math.abs(l)>15||Math.abs(a)>15)&&(o&&(this.isBeyondPossibleTop(f.y,h.minY)?f.y=h.minY:this.isBeyondPossibleBottom(f.y,h.maxY)&&(f.y=h.maxY)),r&&(this.isBeyondPossibleLeft(f.x,h.minX)?f.x=h.minX:this.isBeyondPossibleRight(f.x,h.maxX)&&(f.x=h.maxX)),o?this.top=f.y:f.y=this.top,r?this.left=f.x:f.x=this.left,this.setZoomSwipeStyles(u,f),this.positionChanged=!0)},t.prototype.getZoomSwipeCords=function(e,i,r,o,s){var l={};if(o){if(l.y=this.top+(i.y-e.y),this.isBeyondPossibleTop(l.y,s.minY)){var a=s.minY-l.y;l.y=s.minY-a/6}else if(this.isBeyondPossibleBottom(l.y,s.maxY)){var c=l.y-s.maxY;l.y=s.maxY+c/6}}else l.y=this.top;if(r){if(l.x=this.left+(i.x-e.x),this.isBeyondPossibleLeft(l.x,s.minX)){var d=s.minX-l.x;l.x=s.minX-d/6}else if(this.isBeyondPossibleRight(l.x,s.maxX)){var u=l.x-s.maxX;l.x=s.maxX+u/6}}else l.x=this.left;return l},t.prototype.isBeyondPossibleLeft=function(e,i){return e>=i},t.prototype.isBeyondPossibleRight=function(e,i){return e<=i},t.prototype.isBeyondPossibleTop=function(e,i){return e>=i},t.prototype.isBeyondPossibleBottom=function(e,i){return e<=i},t.prototype.isImageSlide=function(e){var i=this.core.galleryItems[e];return this.core.getSlideType(i)==="image"},t.prototype.getPossibleSwipeDragCords=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,o=i.get().getBoundingClientRect(),s=o.height,l=o.width;e&&(s=s+e*s,l=l+e*l);var a=(s-this.containerRect.height)/2,c=(this.containerRect.height-s)/2+r,d=(l-this.containerRect.width)/2,u=(this.containerRect.width-l)/2,f={minY:a,maxY:c,minX:d,maxX:u};return f},t.prototype.setZoomSwipeStyles=function(e,i){e.css("transform","translate3d("+i.x+"px, "+i.y+"px, 0)")},t.prototype.zoomSwipe=function(){var e=this,i={},r={},o=!1,s=!1,l=!1,a=new Date,c=new Date,d,u,f=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(h){if(e.isImageSlide(e.core.index)&&(f=e.core.getSlideItem(e.core.index),(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))&&h.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){h.preventDefault(),a=new Date,e.core.touchAction="zoomSwipe",u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var m=e.getDragAllowedAxises(0);l=m.allowY,s=m.allowX,(s||l)&&(i=e.getSwipeCords(h)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(h){if(h.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){h.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(h);var m=e.getZoomSwipeCords(i,r,s,l,d);(Math.abs(r.x-i.x)>15||Math.abs(r.y-i.y)>15)&&(o=!0,e.setZoomSwipeStyles(u,m))}}),this.core.$inner.on("touchend.lg",function(h){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){if(h.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!o)return;o=!1,c=new Date;var m=c.valueOf()-a.valueOf();e.touchendZoom(i,r,s,l,m)}})},t.prototype.zoomDrag=function(){var e=this,i={},r={},o=!1,s=!1,l=!1,a=!1,c,d,u,f;this.core.outer.on("mousedown.lg.zoom",function(h){if(e.isImageSlide(e.core.index)){var m=e.core.getSlideItem(e.core.index);if(e.$LG(h.target).hasClass("lg-item")||m.get().contains(h.target)){c=new Date,f=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var p=e.getDragAllowedAxises(0);a=p.allowY,l=p.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(h.target).hasClass("lg-object")&&(l||a)&&(h.preventDefault(),i=e.getDragCords(h),u=e.getPossibleSwipeDragCords(),o=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(h){if(o){s=!0,r=e.getDragCords(h);var m=e.getZoomSwipeCords(i,r,l,a,u);e.setZoomSwipeStyles(f,m)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(h){if(o){if(d=new Date,o=!1,e.core.outer.removeClass("lg-zoom-dragging"),s&&(i.x!==r.x||i.y!==r.y)){r=e.getDragCords(h);var m=d.valueOf()-c.valueOf();e.touchendZoom(i,r,l,a,m)}s=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},t.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},t.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},t})();const Xp={ref:"gallery-container",class:"lightgallery-wrapper"},Yp={},Za=n.defineComponent({...Yp,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(t){const e=t,i={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=n.useTemplateRef("gallery-container"),o=n.ref(null);return n.onMounted(async()=>{if(!r.value)return;const s=await import("lightgallery");o.value=s.default(r.value,{...e.settings}),A.forOwn(i,(l,a)=>{var c;l&&((c=r.value)==null||c.addEventListener(a,l))})}),n.onBeforeUnmount(()=>{var s;o.value&&((s=o.value)==null||s.destroy(),o.value=null)}),(s,l)=>(n.openBlock(),n.createElementBlock("div",Xp,[n.renderSlot(s.$slots,"default")],512))}}),yt=class yt{static init(){yt.isInitialized||(yt.isInitialized=!0,yt.windowResizeHandler(),window.addEventListener("resize",yt.windowResizeHandler))}static destroy(){window.removeEventListener("resize",yt.windowResizeHandler),yt.isInitialized=!1}static getDeviceTypeByResolution(){const e=H.useBaseConfigStateStore().config.deviceTypeByResolution;return window.innerWidth<e.tablet?Xe.phone:window.innerWidth<e.laptop?Xe.tablet:Xe.laptop}static initRefDependingOnDeviceResolution(e,i,r){const o=n.ref(r);return yt.setRefValueDependingOnDeviceResolution(o,e,i,r),yt.refsDependingOnDeviceResolution.push({r:o,phoneValue:e,tabletValue:i,defaultValue:r}),o}static isPhoneDevice(){return yt.getDeviceTypeByResolution()===Xe.phone}static isTabletDevice(){return yt.getDeviceTypeByResolution()===Xe.tablet}static isLaptopDevice(){return yt.getDeviceTypeByResolution()===Xe.laptop}static setRefValueDependingOnDeviceResolution(e,i,r,o){switch(yt.getDeviceTypeByResolution()){case Xe.phone:e.value=i;break;case Xe.tablet:e.value=r;break;default:e.value=o;break}}static windowResizeHandler(){A.forEach(yt.refsDependingOnDeviceResolution,e=>{yt.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};B(yt,"isInitialized",!1),B(yt,"refsDependingOnDeviceResolution",[]);let Ye=yt;const Up=["href"],Kp=["src","alt"],Gp={},Qa=n.defineComponent({...Gp,__name:"image-gallery",props:{images:{}},setup(t,{expose:e}){const i=n.ref(!1),r=n.ref(!1),o=n.ref({plugins:[Wp,qp],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),s=()=>window.innerWidth*(Ye.getDeviceTypeByResolution()===Xe.phone?.7:.8),l=n.ref(s()),a=()=>{l.value=s()},c=()=>{i.value=!0};return n.onUnmounted(()=>{window.removeEventListener("resize",a)}),e({show:c}),window.addEventListener("resize",a),(d,u)=>{const f=Ga,h=F.NPopover;return n.openBlock(),n.createBlock(h,{trigger:"manual",show:i.value,class:"sc-image",placement:"top-start",onClickoutside:u[3]||(u[3]=()=>{r.value||(i.value=!1)})},{trigger:n.withCtx(()=>[n.createElementVNode("div",{class:"inline-flex",onClick:u[0]||(u[0]=m=>i.value=!i.value)},[n.renderSlot(d.$slots,"default",{},()=>[n.createVNode(f)])])]),default:n.withCtx(()=>[n.createVNode(Za,{settings:o.value,style:n.normalizeStyle(`max-width: ${l.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:u[1]||(u[1]=()=>{r.value=!0}),onAfterClose:u[2]||(u[2]=()=>{r.value=!1,i.value=!1})},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.images,(m,p)=>(n.openBlock(),n.createElementBlock("a",{key:p,href:m.image},[n.createElementVNode("img",{src:m.preview,alt:`Изображение #${p+1}`},null,8,Kp)],8,Up))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),Zp={class:"text-sm grid grid-cols-[auto_auto] gap-x-3 gap-y-1 items-baseline"},Qp={class:"pr-3"},Jp={class:"text-right"},eg={},tg=n.defineComponent({...eg,__name:"product-stock-count",props:{product:{}},setup(t){return(e,i)=>{const r=lo,o=F.NPopover;return n.openBlock(),n.createBlock(o,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:n.withCtx(()=>[n.renderSlot(e.$slots,"default",{},()=>[n.createVNode(r)])]),default:n.withCtx(()=>[n.createElementVNode("div",Zp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.product.stockCount,(s,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:l},[n.createElementVNode("span",Qp,n.toDisplayString(s.warehouse.name),1),n.createElementVNode("span",Jp,[n.createTextVNode(n.toDisplayString(s.count??"В наличии")+" ",1),s.count?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(t.product.unit.name),1)],64)):n.createCommentVNode("",!0)])],64))),128))])]),_:3})}}}),ng=["innerHTML"],ig=["innerHTML"],rg={class:"m-0 flex list-none flex-col gap-1 p-0 text-sm"},og=["href"],sg={key:1,class:"text-sm text-gray-500"},lg={},Ts=n.defineComponent({...lg,__name:"product-info-content",props:{product:{},size:{default:"medium"},maxHeight:{default:void 0},activeTab:{default:void 0}},setup(t){const e=t,i=n.computed(()=>e.maxHeight?{maxHeight:e.maxHeight}:void 0),r=n.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.description)??""}),o=n.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.specification)??""}),s=n.computed(()=>Ss(e.product)),l=n.computed(()=>[r.value?"description":null,o.value?"specification":null,s.value.length>0?"files":null].filter(c=>c!==null)),a=n.ref(e.activeTab&&l.value.includes(e.activeTab)?e.activeTab:l.value[0]);return(c,d)=>{const u=F.NScrollbar,f=F.NTabPane,h=F.NTabs;return l.value.length>0?(n.openBlock(),n.createBlock(h,{key:0,value:a.value,"onUpdate:value":d[0]||(d[0]=m=>a.value=m),size:t.size,type:"line",class:"sc-product-info-content"},{default:n.withCtx(()=>[r.value?(n.openBlock(),n.createBlock(f,{key:0,name:"description",tab:"Описание"},{default:n.withCtx(()=>[n.createVNode(u,{style:n.normalizeStyle(i.value)},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"sc-product-info-html",innerHTML:r.value},null,8,ng)]),_:1},8,["style"])]),_:1})):n.createCommentVNode("",!0),o.value?(n.openBlock(),n.createBlock(f,{key:1,name:"specification",tab:"Характеристики"},{default:n.withCtx(()=>[n.createVNode(u,{style:n.normalizeStyle(i.value)},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"sc-product-info-html",innerHTML:o.value},null,8,ig)]),_:1},8,["style"])]),_:1})):n.createCommentVNode("",!0),s.value.length>0?(n.openBlock(),n.createBlock(f,{key:2,name:"files",tab:`Файлы (${s.value.length})`},{default:n.withCtx(()=>[n.createVNode(u,{style:n.normalizeStyle(i.value)},{default:n.withCtx(()=>[n.createElementVNode("ul",rg,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,m=>(n.openBlock(),n.createElementBlock("li",{key:m.id},[n.createElementVNode("a",{href:m.url,target:"_blank",rel:"noopener"},n.toDisplayString(m.typeName),9,og)]))),128))])]),_:1},8,["style"])]),_:1},8,["tab"])):n.createCommentVNode("",!0)]),_:1},8,["value","size"])):(n.openBlock(),n.createElementBlock("span",sg," Описание, характеристики и файлы не заданы. "))}}}),ag={key:0,class:"flex flex-row gap-2.5"},cg={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},dg={},$s=n.defineComponent({...dg,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},modalWidth:{default:void 0},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})},trapFocus:{type:Boolean,default:!0}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(t,{expose:e,emit:i}){const r=t,o=i,s=n.ref(r.show),l=n.ref(r.processing),a=Ye.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=Ye.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=n.computed(()=>r.modalWidth??window.innerWidth*c.value),u=()=>{o("opening"),s.value=!0,o("update:show",s.value)},f=(m="other",p=!1)=>{if(l.value&&!p){o("processing:cancel",_=>{l.value=_});return}let g=!1;o("closing",m,()=>{g=!0}),g||(s.value=!1,o("update:show",s.value))},h=()=>{o("accept",p=>{l.value=p})};return n.watch(()=>r.show,m=>{m?u():f("other",!0)}),n.watch(()=>r.processing,m=>{l.value=m}),e({open:u,close:f,acceptHandler:h}),(m,p)=>{const g=F.NButton,b=F.NModal;return n.openBlock(),n.createBlock(b,{loading:l.value,show:s.value,"show-icon":!1,size:n.unref(a),style:n.normalizeStyle(`width: ${d.value}px`),title:t.title,"trap-focus":t.trapFocus??!0,"action-class":m.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:p[1]||(p[1]=y=>f("header")),onEsc:p[2]||(p[2]=y=>f("esc")),onMaskClick:p[3]||(p[3]=y=>f("mask"))},n.createSlots({default:n.withCtx(()=>[n.renderSlot(m.$slots,"default")]),_:2},[m.$slots.header?{name:"header",fn:n.withCtx(()=>[n.renderSlot(m.$slots,"header")]),key:"0"}:void 0,m.$slots.action||m.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:n.withCtx(()=>[m.$slots["extra-action"]?(n.openBlock(),n.createElementBlock("div",ag,[n.renderSlot(m.$slots,"extra-action")])):n.createCommentVNode("",!0),m.$slots.action||t.acceptButton.show||t.cancelButton.show?(n.openBlock(),n.createElementBlock("div",cg,[n.renderSlot(m.$slots,"action",{disabled:l.value}),t.acceptButton.show??!0?(n.openBlock(),n.createBlock(g,{key:0,disabled:l.value||!t.valid,loading:l.value,size:n.unref(a),type:"primary",onClick:h},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","loading","size"])):n.createCommentVNode("",!0),t.cancelButton.show??!0?(n.openBlock(),n.createBlock(g,{key:1,disabled:l.value,size:n.unref(a),type:"default",onClick:p[0]||(p[0]=y=>f("footer"))},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["disabled","size"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),ug={class:"flex flex-col gap-3"},fg={class:"text-xs text-gray-500"},hg={},Ja=n.defineComponent({...hg,__name:"product-info-dialog",props:{product:{},show:{type:Boolean,default:!1},activeTab:{default:void 0}},emits:["update:show"],setup(t,{emit:e}){const i=e,r=()=>{i("update:show",!1)};return(o,s)=>(n.openBlock(),n.createBlock($s,{show:t.show,title:t.product.name,"accept-button":{show:!1},"cancel-button":{show:!0,text:"Закрыть"},"trap-focus":!1,onClosing:r},{default:n.withCtx(()=>[n.createElementVNode("div",ug,[n.createElementVNode("span",fg,"Артикул: "+n.toDisplayString(t.product.code),1),n.createVNode(Ts,{product:t.product,"active-tab":t.activeTab,"max-height":"60vh"},null,8,["product","active-tab"])])]),_:1},8,["show","title"]))}}),mg={class:"flex flex-col gap-2"},pg={class:"flex justify-end border-0 border-t border-solid border-gray-200 pt-2"},gg={},ec=n.defineComponent({...gg,__name:"product-info-popover",props:{product:{}},setup(t){const e=n.ref(!1),i=n.ref(!1),r=n.ref(!1),o=()=>{e.value=!1,i.value=!0,r.value=!0};return(s,l)=>{const a=lo,c=F.NButton,d=F.NPopover;return n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(d,{show:e.value,"onUpdate:show":l[0]||(l[0]=u=>e.value=u),width:560,style:{maxWidth:"calc(100vw - 2rem)"},trigger:"click",placement:"bottom-start",class:"sc-product-info-popover"},{trigger:n.withCtx(()=>[n.renderSlot(s.$slots,"default",{},()=>[n.createVNode(a,{title:"Описание и характеристики",class:"cursor-pointer"})])]),default:n.withCtx(()=>[n.createElementVNode("div",mg,[n.createVNode(Ts,{product:t.product,size:"small","max-height":"16rem"},null,8,["product"]),n.createElementVNode("div",pg,[n.createVNode(c,{text:"",type:"info",size:"small",onClick:o},{default:n.withCtx(()=>[...l[2]||(l[2]=[n.createTextVNode(" Открыть полностью ",-1)])]),_:1})])])]),_:3},8,["show"]),i.value?(n.openBlock(),n.createBlock(Ja,{key:0,show:r.value,"onUpdate:show":l[1]||(l[1]=u=>r.value=u),product:t.product},null,8,["show","product"])):n.createCommentVNode("",!0)],64)}}}),yg={class:"flex flex-row justify-between"},bg={key:0,class:"inline-flex flex-row gap-0.5 mr-2 align-sub"},_g={key:1},wg={class:"ml-2 align-sub"},xg={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},kg={key:2,class:"ml-2 align-sub"},Cg={class:"@container"},vg={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},Sg={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Bg={class:"text-sc-dark-grey"},Ng={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},Tg={class:"text-gray-600"},$g={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},Eg={key:3,class:"underline decoration-dashed"},Rg={key:4,class:"sc-product-pack whitespace-nowrap"},Pg={class:"text-gray-600"},Fg={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},Vg={class:"text-gray-600"},Mg={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},Ig={key:0},Ag={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Og={},Nr=n.defineComponent({...Og,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showAdditionalSaleIcon:{type:Boolean,default:!1},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(t,{expose:e}){const i=t,r=n.computed(()=>A.isFunction(i.showProductCosts)?i.showProductCosts(i.product):i.showProductCosts),o=n.computed(()=>A.sortBy(i.product.priceCoefficients,["coefficient.slug"])),s=n.computed(()=>{var h,m;return(m=(h=i.product)==null?void 0:h.properties)==null?void 0:m.planingIncomingDate}),l=n.useTemplateRef("image-gallery"),a=()=>{var h;(h=l.value)==null||h.show()},c=n.computed(()=>A.isFunction(i.allowNameClick)?i.allowNameClick(i.product):i.allowNameClick),d=n.computed(()=>(A.isFunction(i.showProductInfoButton)?i.showProductInfoButton(i.product):i.showProductInfoButton)&&Wa(i.product)),u=n.computed(()=>{var h;return i.showProductAddToCartButton||i.showProductEditButton||i.showProductRequiredButton||(((h=i.productContextButtonsConfig)==null?void 0:h.length)??0)>0}),f=()=>{var h;c.value&&((h=i.eventEmitter)==null||h.emit("product:name-click",{product:i.product,exposedMethods:{showProductImagesPreview:a}}))};return e({showProductImagesPreview:a}),(h,m)=>{var w,T,C,$;const p=Lp,g=F.NTooltip,b=Ua,y=Op,_=Ga,k=F.NText,x=Ka,v=lo,N=F.NScrollbar;return n.openBlock(),n.createElementBlock("div",null,[n.createElementVNode("div",yg,[n.createVNode(k,{type:"info",class:"sc-product-name text-balance text-base font-medium text-black"},{default:n.withCtx(()=>{var E,V,P,I;return[(E=t.product)!=null&&E.isFavorite||(V=t.product)!=null&&V.isPreviouslyOrdered||t.showAdditionalSaleIcon?(n.openBlock(),n.createElementBlock("div",bg,[((P=t.product)==null?void 0:P.isFavorite)??!1?(n.openBlock(),n.createBlock(g,{key:0,placement:"bottom",trigger:"hover"},{trigger:n.withCtx(()=>[n.createVNode(p,{class:"!text-yellow-300"})]),default:n.withCtx(()=>[m[0]||(m[0]=n.createTextVNode(" Избранный товар ",-1))]),_:1})):n.createCommentVNode("",!0),((I=t.product)==null?void 0:I.isPreviouslyOrdered)??!1?(n.openBlock(),n.createBlock(g,{key:1,placement:"bottom",trigger:"hover"},{trigger:n.withCtx(()=>[n.createVNode(b,{class:"!text-green-700"})]),default:n.withCtx(()=>[m[1]||(m[1]=n.createTextVNode(" Ранее заказанный товар ",-1))]),_:1})):n.createCommentVNode("",!0),t.showAdditionalSaleIcon?(n.openBlock(),n.createBlock(g,{key:2,placement:"bottom",trigger:"hover"},{trigger:n.withCtx(()=>[n.createVNode(y,{class:"!text-green-500"})]),default:n.withCtx(()=>[m[2]||(m[2]=n.createTextVNode(" Дополнительная продажа ",-1))]),_:1})):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("span",{class:n.normalizeClass({"cursor-pointer":c.value&&t.eventEmitter}),onClick:f},n.toDisplayString(t.product.name),3),t.product.onOrder?(n.openBlock(),n.createElementBlock("span",_g," [Под заказ] ")):n.createCommentVNode("",!0),n.createElementVNode("span",wg,[t.product.images&&t.product.images.length>0?(n.openBlock(),n.createBlock(Qa,{key:0,ref:"image-gallery",images:t.product.images},{default:n.withCtx(()=>[n.createElementVNode("div",xg,[n.createVNode(_)])]),_:1},8,["images"])):n.createCommentVNode("",!0)]),d.value?(n.openBlock(),n.createElementBlock("span",kg,[n.createVNode(ec,{product:t.product},null,8,["product"])])):n.createCommentVNode("",!0)]}),_:1}),u.value?(n.openBlock(),n.createBlock(x,{key:0,product:t.product,"event-emitter":t.eventEmitter,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-edit-button":t.showProductEditButton,"show-product-required-button":t.showProductRequiredButton,"product-context-buttons-config":t.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",Cg,[n.createElementVNode("div",vg,[t.product.supplierSku?(n.openBlock(),n.createElementBlock("div",Sg,[m[3]||(m[3]=n.createTextVNode(" Артикул производителя/поставщика: ",-1)),n.createElementVNode("span",Bg,n.toDisplayString(t.product.supplierSku),1)])):n.createCommentVNode("",!0),t.showCode?(n.openBlock(),n.createElementBlock("span",Ng,[m[4]||(m[4]=n.createTextVNode(" Артикул: ",-1)),n.createElementVNode("span",Tg,n.toDisplayString(t.product.code),1)])):n.createCommentVNode("",!0),t.product.stockCount&&t.product.stockCount.length>0?(n.openBlock(),n.createBlock(tg,{key:2,product:t.product},{default:n.withCtx(()=>[n.createElementVNode("span",$g,[m[5]||(m[5]=n.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),n.createVNode(v,{class:"mt-0.5"})])]),_:1},8,["product"])):(n.openBlock(),n.createElementBlock("span",Eg," Нет в наличии ")),t.product.pack??((T=(w=t.product)==null?void 0:w.properties)==null?void 0:T.pack)?(n.openBlock(),n.createElementBlock("span",Rg,[m[6]||(m[6]=n.createTextVNode(" Норма упаковки: ",-1)),n.createElementVNode("span",Pg,n.toDisplayString(t.product.pack??(($=(C=t.product)==null?void 0:C.properties)==null?void 0:$.pack)),1)])):n.createCommentVNode("",!0),t.showPlanningDates&&s.value?(n.openBlock(),n.createElementBlock("span",Fg,[m[7]||(m[7]=n.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),n.createElementVNode("span",Vg,n.toDisplayString(s.value),1)])):n.createCommentVNode("",!0)])]),n.createVNode(N,{"x-scrollable":""},{default:n.withCtx(()=>[r.value?(n.openBlock(),n.createElementBlock("div",Mg,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,E=>(n.openBlock(),n.createBlock(ii,{key:E.coefficient.slug,product:t.product,"cost-field-name":E.coefficient.slug??"","event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),n.createVNode(ii,{product:t.product,"event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":t.showCostDate,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):n.createCommentVNode("",!0)]),_:1}),t.showSlugs||t.showProperties?(n.openBlock(),n.createElementBlock("div",Ig,[n.createElementVNode("ul",Ag,[t.showSlugs?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList({id:t.product.id,slug:t.product.slug},(E,V)=>(n.openBlock(),n.createElementBlock("li",{key:V}," ("+n.toDisplayString(V)+"): "+n.toDisplayString(E),1))),128)):n.createCommentVNode("",!0),t.showProperties?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:1},n.renderList(t.product.properties,(E,V)=>(n.openBlock(),n.createElementBlock("li",{key:V}," ("+n.toDisplayString(V)+"): "+n.toDisplayString(E),1))),128)):n.createCommentVNode("",!0)])])):n.createCommentVNode("",!0)])}}}),zg=(t,e,i)=>({key:t,title:e,className:"align-top",resizable:!0,render:r=>n.h(ii,{product:r,costFieldName:t,eventEmitter:i.eventEmitter,allowPriceClick:i.allowPriceClick,currencyRates:i.currencyRates})}),Dg=(t,e)=>{if(t.length===0)return[];const i=[],r={};switch(A.isNil(e.isProductItemSelected)||i.push({key:"checkbox",title:"",className:"align-top",width:"32",render:o=>{var s,l;return n.h(F.NCheckbox,{checked:!!((s=e.isProductItemSelected)!=null&&s.call(e,o)),disabled:((l=e.isProductItemSelected)==null?void 0:l.call(e,o))==="disabled",onUpdateChecked:a=>{e.eventEmitter.emit("product:checked",{product:o,checked:a})}})}}),Ye.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:i.push({key:"name",title:"Наименование",className:"align-top",render:o=>n.h(Nr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:i.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:o=>n.h(Nr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,currencyRates:e.currencyRates})}),e.showProductCosts&&(A.forEach(t,o=>{A.forEach(o.priceCoefficients,s=>{r[s.coefficient.slug??""]||(r[s.coefficient.slug??""]=s.coefficient)})}),A.forEach(A.sortBy(r,["slug"]),o=>{i.push(zg(o.slug??"",o.name,e))}),i.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:o=>n.h(ii,{product:o,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!A.isNil(e.productContextButtonsConfig))&&i.push({key:"actions",title:"",className:"align-top",width:"50",render:o=>n.h(Ka,{product:o,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return i},Lg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Hg(t,e){return n.openBlock(),n.createElementBlock("svg",Lg,[...e[0]||(e[0]=[n.createElementVNode("path",{fill:"none",d:"M296 64h-80a7.91 7.91 0 0 0-8 8v24h96V72a7.91 7.91 0 0 0-8-8"},null,-1),n.createElementVNode("path",{fill:"currentColor",d:"M432 96h-96V72a40 40 0 0 0-40-40h-80a40 40 0 0 0-40 40v24H80a16 16 0 0 0 0 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 0 0 0-32M192.57 416H192a16 16 0 0 1-16-15.43l-8-224a16 16 0 1 1 32-1.14l8 224A16 16 0 0 1 192.57 416M272 400a16 16 0 0 1-32 0V176a16 16 0 0 1 32 0Zm32-304h-96V72a7.91 7.91 0 0 1 8-8h80a7.91 7.91 0 0 1 8 8Zm32 304.57A16 16 0 0 1 320 416h-.58A16 16 0 0 1 304 399.43l8-224a16 16 0 1 1 32 1.14Z"},null,-1)])])}const uo=n.markRaw({name:"ion-trash",render:Hg}),Wg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jg(t,e){return n.openBlock(),n.createElementBlock("svg",Wg,[...e[0]||(e[0]=[n.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const tc=n.markRaw({name:"ion-plus",render:jg}),qg={key:0,class:"flex w-fit items-center gap-2"},Xg={key:1,class:"flex flex-wrap gap-1"},Yg={key:0},Ug={key:2},Kg={},Tr=n.defineComponent({...Kg,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0},validation:{default:void 0}},setup(t){const e=t,i=n.computed(()=>{var r,o;return(o=(r=e.product)==null?void 0:r.properties)==null?void 0:o.planingProductionDate});return(r,o)=>{const s=F.NSpin,l=F.NText;return t.isProductSearching?(n.openBlock(),n.createElementBlock("div",qg,[n.createVNode(s,{size:17,class:"w-fit"}),o[0]||(o[0]=n.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):t.product&&!t.product.isNewRec()?(n.openBlock(),n.createElementBlock("div",Xg,[n.createElementVNode("div",null,n.toDisplayString(t.product.code)+" - "+n.toDisplayString(t.product.name)+" - "+n.toDisplayString(t.product.costRub.toLocaleString())+" ₽ / "+n.toDisplayString(t.product.unit.name),1),i.value?(n.openBlock(),n.createElementBlock("div",Yg,"(Планируемая дата производства: "+n.toDisplayString(i.value)+")",1)):n.createCommentVNode("",!0)])):t.validation?(n.openBlock(),n.createElementBlock("div",Ug,[n.createVNode(l,{type:t.validation.validationStatus},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.validation.feedback),1)]),_:1},8,["type"])])):n.createCommentVNode("",!0)}}}),Gg={class:"flex flex-col gap-4"},Zg={class:"flex flex-col gap-2"},Qg={class:"mt-8 font-bold"},Jg={class:"grid grow grid-cols-2 items-start gap-2"},ey={key:2,class:"text-red-500 text-sm"},ty={key:3,class:"text-red-500 text-sm mb-2"},ny={class:"flex flex-col gap-4"},iy={key:1},ry={class:"text-lg font-semibold"},oy={class:"flex gap-3"},sy={},ly=n.defineComponent({...sy,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(t,{expose:e,emit:i}){var b;const r=t,o=i,s=n.useTemplateRef("form-reference"),l=n.ref(!1),a=n.ref(A.cloneDeep(r.value)),c=n.computed(()=>{var _,k,x;const y={"configuratorParams.length":[ae.required,ae.min(r.settings.stripMinLength),ae.max(r.settings.stripMaxLength||Number.MAX_VALUE),ae.step(r.settings.lengthStep),We.serverValidation((_=r.validation.length)==null?void 0:_.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation((k=r.validation.quantity)==null?void 0:k.feedback)],marker:[We.serverValidation((x=r.validation.marker)==null?void 0:x.feedback)]};return A.forEach(a.value.configuratorParams.linesWidths,(v,N)=>{var C;const T=a.value.configuratorParams.linesWidths.length>1?r.settings.minLineWidth:r.settings.stripMinWidth;y[`configuratorParams.linesWidths.${N}`]=[ae.required,ae.min(T),ae.max(r.settings.maxLineWidth),ae.step(r.settings.lineWidthStep),We.serverValidation((C=r.validation[`lines_widths[${N+1}]`])==null?void 0:C.feedback)]}),A.forEach(a.value.configuratorParams.linesAngles,(v,N)=>{var w;y[`configuratorParams.linesAngles.${N}`]=[ae.required,ae.min(r.settings.minLineAngle),ae.max(r.settings.maxLineAngle),ae.step(r.settings.lineAngleStep),We.serverValidation((w=r.validation[`lines_angles[${N+1}]`])==null?void 0:w.feedback)]}),y}),d=n.ref(r.settings.canSetDopProdaga??!1),u=n.computed(()=>{var v;const{length:y}=a.value.configuratorParams,{quantity:_}=a.value,k=((v=a.value.product)==null?void 0:v.costRub)||0;if(!y||!_||k===0)return null;const x=y/1e3;return(k*_*x).toLocaleString("ru-ru",{maximumFractionDigits:2,minimumFractionDigits:2})}),f=n.computed(()=>A.reduce(a.value.configuratorParams.linesWidths,(y,_)=>y+(_||0),0)),h=n.computed(()=>{const y=f.value;return y>=r.settings.stripMinWidth&&y<=r.settings.stripMaxWidth}),m=n.computed(()=>{const{configuratorParams:y}=a.value,_=A.every(y.linesWidths,N=>!!(N&&N>0)),k=A.every(y.linesAngles,N=>!A.isNil(N)),x=!!(a.value.quantity&&a.value.quantity>0),v=y.length>0&&y.length>0;return _&&k&&x&&v&&h.value}),p=()=>{n.nextTick(()=>{var y;(y=s.value)==null||y.validate(_=>{_||(o("update:params",a.value.configuratorParams),g("configuratorParams",a.value.configuratorParams))}).catch(A.noop)})},g=(y,_)=>{const k=new H.OrderItemBase(a.value);k[y]=_,y==="configuratorParams"&&(k.product=new H.ClientProduct),o("update:value",k)};return n.watch(()=>r.previewParams,y=>{a.value.configuratorParams.linesWidths=y.linesWidths,a.value.configuratorParams.linesAngles=y.linesAngles},{deep:!0}),n.watch(()=>r.value,y=>{a.value=A.cloneDeep(y)},{deep:!0}),e({validate:(b=s.value)==null?void 0:b.validate,formReference:s}),(y,_)=>{const k=tc,x=uo,v=F.NCheckbox;return n.withDirectives((n.openBlock(),n.createBlock(n.unref(F.NForm),{ref:"form-reference",model:a.value,rules:c.value,class:"flex flex-col gap-4 sc-hide-empty-feedback-message"},{default:n.withCtx(()=>{var N;return[n.createElementVNode("div",Gg,[_[21]||(_[21]=n.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),t.settings.startTailConfigs&&t.settings.startTailConfigs.length>0?(n.openBlock(),n.createBlock(n.unref(F.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NSelect),{value:a.value.configuratorParams.startTailType,"onUpdate:value":[_[0]||(_[0]=w=>a.value.configuratorParams.startTailType=w),p],options:t.settings.startTailConfigs.map(({label:w},T)=>({label:w,value:T})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):n.createCommentVNode("",!0),n.createElementVNode("div",Zg,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.configuratorParams.linesAngles,(w,T)=>(n.openBlock(),n.createElementBlock("div",{key:T,class:"flex items-start gap-2"},[n.createElementVNode("div",Qg,n.toDisplayString(T+1),1),n.createElementVNode("div",Jg,[n.createVNode(n.unref(F.NFormItem),{path:`configuratorParams.linesWidths.${T}`,label:"Ширина, мм"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInputNumber),{value:a.value.configuratorParams.linesWidths[T],"onUpdate:value":[C=>a.value.configuratorParams.linesWidths[T]=C,_[2]||(_[2]=C=>p())],parse:n.unref(ct),"show-button":!1,class:"w-full",onKeydown:_[1]||(_[1]=C=>n.unref(lt)(C)),onInput:C=>n.unref(rt)(t.validation,`lines_widths[${T+1}]`),onFocus:n.unref(He)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"]),n.createVNode(n.unref(F.NFormItem),{path:`configuratorParams.linesAngles.${T}`,label:"Угол сгиба, °"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInputNumber),{value:a.value.configuratorParams.linesAngles[T],"onUpdate:value":[C=>a.value.configuratorParams.linesAngles[T]=C,_[4]||(_[4]=C=>p())],parse:n.unref(ct),"show-button":!1,class:"w-full",onKeydown:_[3]||(_[3]=C=>n.unref(lt)(C,!0)),onInput:C=>n.unref(rt)(t.validation,`lines_angles[${T+1}]`),onFocus:n.unref(He)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"])]),n.createVNode(n.unref(F.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:n.withCtx(()=>[t.settings.showOnlyTemplates?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(n.unref(F.NButton),{key:0,size:"medium",onClick:C=>o("click:add-line",T)},{default:n.withCtx(()=>[n.createVNode(k)]),_:1},8,["onClick"])),t.settings.showOnlyTemplates?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(n.unref(F.NButton),{key:1,disabled:a.value.configuratorParams.linesWidths.length===1,size:"medium",class:"ml-2",onClick:C=>o("click:remove-line",T)},{default:n.withCtx(()=>[n.createVNode(x)]),_:1},8,["disabled","onClick"]))]),_:2},1024)]))),128))]),t.settings.endTailConfigs&&t.settings.endTailConfigs.length>0?(n.openBlock(),n.createBlock(n.unref(F.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NSelect),{value:a.value.configuratorParams.endTailType,"onUpdate:value":[_[5]||(_[5]=w=>a.value.configuratorParams.endTailType=w),p],options:t.settings.endTailConfigs.map(({label:w},T)=>({label:w,value:T})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(Tr,{"is-product-searching":t.isProductSearching,product:a.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),h.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",ey," Суммарная ширина участков гиба должна быть от "+n.toDisplayString(t.settings.stripMinWidth)+" до "+n.toDisplayString(t.settings.stripMaxWidth)+" мм., текущая ширина: "+n.toDisplayString(f.value)+" мм. ",1)),m.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",ty," Пожалуйста, заполните все обязательные поля корректно. ")),t.settings.allowSaveTemplates&&t.selectTemplateIndex===((N=t.settings.allTemplates)==null?void 0:N.length)-1?(n.openBlock(),n.createBlock(n.unref(F.NButton),{key:4,type:"tertiary",class:"self-start",loading:l.value,onClick:_[6]||(_[6]=w=>o("click:save-template"))},{default:n.withCtx(()=>[..._[20]||(_[20]=[n.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",ny,[n.createVNode(n.unref(F.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NSelect),{value:a.value.configuratorParams.colorSide,"onUpdate:value":[_[7]||(_[7]=w=>a.value.configuratorParams.colorSide=w),p],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),n.createVNode(n.unref(F.NFormItem),{path:"configuratorParams.length",label:`Метраж${t.settings.stripMinLength?" от "+t.settings.stripMinLength:""}${t.settings.stripMaxLength?" до "+t.settings.stripMaxLength:""} мм`},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInputNumber),{value:a.value.configuratorParams.length,"onUpdate:value":[_[8]||(_[8]=w=>a.value.configuratorParams.length=w),_[11]||(_[11]=w=>p())],parse:n.unref(ct),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:_[9]||(_[9]=w=>n.unref(lt)(w)),onInput:_[10]||(_[10]=w=>n.unref(rt)(t.validation,"length")),onFocus:n.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),n.createVNode(n.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInputNumber),{value:a.value.quantity,"onUpdate:value":[_[12]||(_[12]=w=>a.value.quantity=w),_[15]||(_[15]=w=>g("quantity",w??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:_[13]||(_[13]=w=>n.unref(lt)(w,!1)),onInput:_[14]||(_[14]=w=>n.unref(rt)(t.validation,"quantity")),onFocus:n.unref(He)},null,8,["value","onFocus"])]),_:1}),n.createVNode(n.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInput),{value:a.value.marker??null,placeholder:"Введите маркировку",onInput:_[16]||(_[16]=w=>n.unref(rt)(t.validation,"marker")),"onUpdate:value":_[17]||(_[17]=w=>{a.value.marker=w??null,g("marker",w??null)}),onFocus:n.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(n.openBlock(),n.createBlock(v,{key:0,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":_[18]||(_[18]=w=>{a.value.isAdditionalSale=w??!1,g("isAdditionalSale",w??!1)})},{default:n.withCtx(()=>[..._[22]||(_[22]=[n.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):n.createCommentVNode("",!0),u.value?(n.openBlock(),n.createElementBlock("div",iy,[_[23]||(_[23]=n.createTextVNode(" ИТОГО: ",-1)),n.createElementVNode("span",ry,n.toDisplayString(u.value)+" ₽",1)])):n.createCommentVNode("",!0),n.createElementVNode("div",oy,[n.createVNode(n.unref(F.NButton),{loading:t.isSubmitProcessing,disabled:!m.value||a.value.product.isNewRec(),type:"primary",class:"self-start",onClick:_[19]||(_[19]=w=>o("submit",a.value))},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1},8,["model","rules"])),[[n.unref(ti),()=>o("submit",a.value)]])}}}),nc=wn(ly,[["__scopeId","data-v-ac7f1192"]]);var ic=Object.defineProperty,ay=Object.defineProperties,cy=Object.getOwnPropertyDescriptors,rc=Object.getOwnPropertySymbols,dy=Object.prototype.hasOwnProperty,uy=Object.prototype.propertyIsEnumerable,oc=t=>{throw TypeError(t)},Es=(t,e,i)=>e in t?ic(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$r=(t,e)=>{for(var i in e||(e={}))dy.call(e,i)&&Es(t,i,e[i]);if(rc)for(var i of rc(e))uy.call(e,i)&&Es(t,i,e[i]);return t},Rs=(t,e)=>ay(t,cy(e)),sc=(t,e)=>{for(var i in e)ic(t,i,{get:e[i],enumerable:!0})},S=(t,e,i)=>Es(t,typeof e!="symbol"?e+"":e,i),lc=(t,e,i)=>e.has(t)||oc("Cannot "+i),Dt=(t,e,i)=>(lc(t,e,"read from private field"),i?i.call(t):e.get(t)),ac=(t,e,i)=>e.has(t)?oc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),fy=(t,e,i,r)=>(lc(t,e,"write to private field"),e.set(t,i),i),Pt={Image:null,isHeadless:!1,shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(i){return this[i]},t.setAttribute=function(i,r){return this[i]=r,this},t},polyfill:function(t,e){return Pt.shim(t),typeof e<"u"&&(Pt.Image=e),Pt.isHeadless=!0,t}},cc={};sc(cc,{Curve:()=>Zi,getAnchorsFromArcData:()=>py,getComponentOnCubicBezier:()=>Er,getControlPoints:()=>wc,getCurveBoundingBox:()=>yc,getCurveFromPoints:()=>_c,getCurveLength:()=>gc,getReflection:()=>Ms,integrate:()=>bc,subdivide:()=>Vs});var dc={};sc(dc,{HALF_PI:()=>dt,NumArray:()=>xn,TWO_PI:()=>tt,decomposeMatrix:()=>wi,getComputedMatrix:()=>Ps,getEffectiveStrokeWidth:()=>kn,getPoT:()=>hc,lerp:()=>Ft,mod:()=>ot,setMatrix:()=>fc,toFixed:()=>ze});var Ke;typeof window<"u"?Ke=window:typeof global<"u"?Ke=global:typeof self<"u"&&(Ke=self);var uc,tt=Math.PI*2,dt=Math.PI*.5;function wi(t,e,i,r,o,s){let l;return arguments.length<=1?(l=t.a,e=t.b,i=t.c,r=t.d,o=t.e,s=t.f):l=t,{translateX:o,translateY:s,scaleX:Math.sqrt(l*l+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,l)/Math.PI}}function fc(t){uc=t}function Ps(t,e){e=e&&e.identity()||new uc;let i=t;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const l=r[o].elements;e.multiply(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],l[8])}return e}function Ft(t,e,i){return i*(e-t)+t}var Fs=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function hc(t){let e=0;for(;Fs[e]&&Fs[e]<t;)e++;return Fs[e]}function ot(t,e){for(;t<0;)t+=e;return t%e}var xn=Ke.Float32Array||Array,hy=Math.floor;function ze(t){return hy(t*1e6)/1e6}function kn(t,e){const i=t._linewidth;if(t.strokeAttenuation)return i;e||(e=t.worldMatrix||Ps(t));const r=wi(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),o=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return o>0?i/o:i}var ie={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},ee=class{constructor(){S(this,"_events",{}),S(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let l=this._events[e];if(l){let a=[];if(i)for(let c=0,d=l.length;c<d;c++){let u=l[c];u=u.handler?u.handler:u,i!==u&&a.push(u)}this._events[e]=a}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}};S(ee,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(ee,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var mc={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(ee.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(ee.Types.change))}}},cn=class _r extends ee{constructor(e=0,i=0){super(),S(this,"_x",0),S(this,"_y",0);for(let r in mc)Object.defineProperty(this,r,mc[r]);this.x=e,this.y=i}static add(e,i){return new _r(e.x+i.x,e.y+i.y)}static sub(e,i){return new _r(e.x-i.x,e.y-i.y)}static subtract(e,i){return _r.sub(e,i)}static ratioBetween(e,i){return(e.x*i.x+e.y*i.y)/(e.length()*i.length())}static angleBetween(e,i){if(arguments.length>=4){const s=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,s)}const r=e.x-i.x,o=e.y-i.y;return Math.atan2(o,r)}static distanceBetween(e,i){return Math.sqrt(_r.distanceBetweenSquared(e,i))}static distanceBetweenSquared(e,i){const r=e.x-i.x,o=e.y-i.y;return r*r+o*o}set(e,i){return this.x=e,this.y=i,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new _r(this.x,this.y)}add(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=i),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,r=this.y-e.y;return i*i+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(e)<i}lerp(e,i){const r=(e.x-this.x)*i+this.x,o=(e.y-this.y)*i+this.y;return this.set(r,o)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:ze(this.x),y:ze(this.y)}}rotate(e){const i=this.x,r=this.y,o=Math.cos(e),s=Math.sin(e);return this.x=i*o-r*s,this.y=i*s+r*o,this}};S(cn,"zero",new cn),S(cn,"left",new cn(-1,0)),S(cn,"right",new cn(1,0)),S(cn,"up",new cn(0,-1)),S(cn,"down",new cn(0,1));var re=cn,$e=class _s extends re{constructor(e=0,i=0,r=0,o=0,s=0,l=0,a=ie.move){super(e,i),S(this,"controls",{left:new re,right:new re}),S(this,"_command",ie.move),S(this,"_relative",!0),S(this,"_rx",0),S(this,"_ry",0),S(this,"_xAxisRotation",0),S(this,"_largeArcFlag",0),S(this,"_sweepFlag",1);for(let d in pc)Object.defineProperty(this,d,pc[d]);this.command=a,this.relative=!0;const c=_s.makeBroadcast(this);this.controls.left.set(r,o).addEventListener(ee.Types.change,c),this.controls.right.set(s,l).addEventListener(ee.Types.change,c)}static makeBroadcast(e){return i;function i(){e._bound&&e.dispatchEvent(ee.Types.change)}}static fromObject(e){return new _s().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new _s().copy(this)}toObject(){return{x:ze(this.x),y:ze(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:ze(this.rx),ry:ze(this.ry),xAxisRotation:ze(this.xAxisRotation),largeArcFlag:ze(this.largeArcFlag),sweepFlag:ze(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},pc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(ee.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(ee.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(ee.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(ee.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(ee.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(ee.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(ee.Types.change))}}},my=0,kt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.23",PublishDate:"2025-12-22T19:59:24.486Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return my++}},Zi={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Er(t,e,i,r,o){const s=1-t;return s*s*s*e+3*s*s*t*i+3*s*t*t*r+t*t*t*o}function Vs(t,e,i,r,o,s,l,a,c){c=c||Zi.RecursionLimit;const d=c+1;if(Math.abs(t-l)<.001&&Math.abs(e-a)<.001)return[new $e(l,a)];const u=[];for(let f=0;f<d;f++){const h=f/d,m=Er(h,t,i,o,l),p=Er(h,e,r,s,a);u.push(new $e(m,p))}return u}function gc(t,e,i,r,o,s,l,a,c){if(t===i&&e===r&&o===l&&s===a){const b=l-t,y=a-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(l-t),u=6*(t+o)-12*i,f=3*(i-t),h=9*(r-s)+3*(a-e),m=6*(e+s)-12*r,p=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+m)*b+p;return Math.sqrt(y*y+_*_)}return bc(g,0,1,c||Zi.RecursionLimit)}function yc(t,e,i,r,o,s,l,a){const c=[],d=[[],[]];let u,f,h,m,p,g,b,y;for(let v=0;v<2;++v){if(v===0?(f=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*l,h=3*i-3*t):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*a,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;m=-h/f,0<m&&m<1&&c.push(m);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(p=(-f+y)/(2*u),0<p&&p<1&&c.push(p),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)m=c[_],x=1-m,d[0][_]=x*x*x*t+3*x*x*m*i+3*x*m*m*o+m*m*m*l,d[1][_]=x*x*x*e+3*x*x*m*r+3*x*m*m*s+m*m*m*a;return d[0][k]=t,d[1][k]=e,d[0][k+1]=l,d[1][k+1]=a,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function bc(t,e,i,r){let o=Zi.abscissas[r-2],s=Zi.weights[r-2],l=.5*(i-e),a=l+e,c=0,d=r+1>>1,u=r&1?s[c++]*t(a):0;for(;c<d;){const f=l*o[c];u+=s[c++]*(t(a+f)+t(a-f))}return l*u}function _c(t,e){const i=t.length,r=i-1;for(let o=0;o<i;o++){const s=t[o],l=e?ot(o-1,i):Math.max(o-1,0),a=e?ot(o+1,i):Math.min(o+1,r),c=t[l],d=s,u=t[a];wc(c,d,u),d.command=o===0?ie.move:ie.curve}}function wc(t,e,i){const r=re.angleBetween(t,e),o=re.angleBetween(i,e);let s=re.distanceBetween(t,e),l=re.distanceBetween(i,e),a=(r+o)/2;return s<.001||l<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,l*=.33,o<r?a+=dt:a-=dt,e.controls.left.x=Math.cos(a)*s,e.controls.left.y=Math.sin(a)*s,a-=Math.PI,e.controls.right.x=Math.cos(a)*l,e.controls.right.y=Math.sin(a)*l,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function Ms(t,e,i){return new re(2*t.x-(e.x+t.x)-(i?t.x:0),2*t.y-(e.y+t.y)-(i?t.y:0))}function py(t,e,i,r,o,s,l){const a=kt.Resolution;for(let c=0;c<a;c++){let d=(c+1)/a;l&&(d=1-d);const u=d*s+o,f=i*Math.cos(u),h=r*Math.sin(u),m=new $e(f,h);m.command=ie.line}}var xc=Array.prototype.slice;function gy(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}var oe={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=xc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)t[o]=r[o]}return t},defaults:function(t){const e=xc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)t[o]===void 0&&(t[o]=r[o])}return t},each:function(t,e,i){const r=i||this,o=!gy(t)&&Object.keys(t),s=(o||t).length;for(let l=0;l<s;l++){const a=o?o[l]:l;e.call(r,t[a],a,t)}return t},performance:Ke.performance&&Ke.performance.now?Ke.performance:Date},Ut={hasEventListeners:typeof Ke.addEventListener=="function",bind:function(t,e,i,r){return this.hasEventListeners?t.addEventListener(e,i,!!r):t.attachEvent("on"+e,i),Ut},unbind:function(t,e,i,r){return Ut.hasEventListeners?t.removeEventListeners(e,i,!!r):t.detachEvent("on"+e,i),Ut},getRequestAnimationFrame:function(){const t=["ms","moz","webkit","o"];let e=0,i=Ke.requestAnimationFrame;if(!i){for(let o=0;o<t.length;o++)i=Ke[t[o]+"RequestAnimationFrame"]||i;i=i||r}function r(o,s){const l=new Date().getTime(),a=Math.max(0,16-(l-e)),c=Ke.setTimeout(d,a);e=l+a;function d(){o(l+a)}return c}return i}},Qi=Ke.document?Ke.document.createElement("div"):{};Qi.id="help-two-load",Object.defineProperty(Ut,"temp",{enumerable:!0,get:function(){return oe.isElement(Qi)&&!Ke.document.head.contains(Qi)&&(Qi.style.display="none",Ke.document.head.appendChild(Qi)),Qi}});var Lt=class extends Error{constructor(e){super(),S(this,"name","Two.js"),S(this,"message"),this.message=e}},yy=Ke.devicePixelRatio||1;function by(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1}function Is(t){return yy/by(t)}var fo=class{constructor(){S(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},Ct,ri=class extends Array{constructor(){super(),ac(this,Ct,new ee),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Dt(this,Ct)}set _events(e){fy(this,Ct,e)}get _bound(){return Dt(this,Ct)._bound}set _bound(e){Dt(this,Ct)._bound=e}addEventListener(){var e;return(e=Dt(this,Ct).addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=Dt(this,Ct).on)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=Dt(this,Ct).bind)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=Dt(this,Ct).removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=Dt(this,Ct).off)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=Dt(this,Ct).unbind)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=Dt(this,Ct).dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=Dt(this,Ct).trigger)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=Dt(this,Ct).listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=Dt(this,Ct).ignore)==null?void 0:e.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(ee.Types.remove,e),arguments.length>2){const i=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ee.Types.insert,i),this.trigger(ee.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(ee.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ee.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,i){const r=[];for(let o=0;o<this.length;o++){const s=this[o];let l;i?l=e.call(i,s,o):l=e(s,o),r.push(l)}return r}};Ct=new WeakMap;var kc=class _m extends ee{constructor(){super(),S(this,"_flagId",!1),S(this,"_flagClassName",!1),S(this,"_renderer",{}),S(this,"_id",kt.Identifier+kt.uniqueId()),S(this,"_className",""),S(this,"classList",[]);for(let e in Cc)Object.defineProperty(this,e,Cc[e])}static fromObject(e){const i=new _m().copy(e);return"id"in e&&(i.id=e.id),i}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const i=this.renderer.ctx;this._renderer.texture&&(i.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(i.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const e=this._renderer.type;return this._renderer={type:e},this}};S(kc,"Properties",["renderer","id","className"]);var Ji=kc,Cc={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}},ho,vc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Ke.document&&(ho=document.createElement("a"));var dn=class Jt extends Ji{constructor(e,i){super(),S(this,"_flagSrc",!1),S(this,"_flagImage",!1),S(this,"_flagVideo",!1),S(this,"_flagLoaded",!1),S(this,"_flagRepeat",!1),S(this,"_flagOffset",!1),S(this,"_flagScale",!1),S(this,"_src",""),S(this,"_image",null),S(this,"_loaded",!1),S(this,"_repeat","no-repeat"),S(this,"_scale",1),S(this,"_offset",null);for(let r in Sc)Object.defineProperty(this,r,Sc[r]);if(this._renderer.type="texture",this._renderer.flagOffset=_y.bind(this),this._renderer.flagScale=wy.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new re,typeof i=="function"){const r=(function(){this.unbind(ee.Types.load,r),typeof i=="function"&&i()}).bind(this);this.bind(ee.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const i=new Jt().copy(e);return"id"in e&&(i.id=e.id),i}static getAbsoluteURL(e){return ho?(ho.href=e,ho.href):e}static loadHeadlessBuffer(e,i){e.image.onload=i,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const i=Jt.getAbsoluteURL(e);if(Jt.ImageRegistry.contains(i))return Jt.ImageRegistry.get(i);let r;return Pt.Image?(r=new Pt.Image,Pt.shim(r,"img")):Ke.document?vc.video.test(i)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,i){let r=e.image,o=Jt.getTag(r);e._flagImage&&(/canvas/i.test(o)?Jt.Register.canvas(e,i):(e._src=!Pt.isHeadless&&r.getAttribute("two-src")||r.src,Jt.Register[o](e,i))),e._flagSrc&&(r||(r=Jt.getImage(e.src),e.image=r),o=Jt.getTag(r),Jt.Register[o](e,i))}clone(){const e=new Jt(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof re?e.offset:new re().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re().copy(e.scale),this}toObject(){const e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ee.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Jt.load(this,(function(){this.loaded=!0,this.trigger(ee.Types.change).trigger(ee.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(dn,"Properties",["src","loaded","repeat","scale","offset","image"]),S(dn,"RegularExpressions",vc),S(dn,"ImageRegistry",new fo),S(dn,"Register",{canvas:function(t,e){t._src="#"+t.id,dn.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){const i=t.image,r=function(s){!Pt.isHeadless&&i.removeEventListener&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),typeof e=="function"&&e()},o=function(s){throw!Pt.isHeadless&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),new Lt("unable to load "+t.src)};typeof i.width=="number"&&i.width>0&&typeof i.height=="number"&&i.height>0?r():!Pt.isHeadless&&typeof i.addEventListener=="function"&&(i.addEventListener("load",r,!1),i.addEventListener("error",o,!1)),t._src=dn.getAbsoluteURL(t._src),!(!Pt.isHeadless&&i&&i.getAttribute("two-src"))&&(Pt.isHeadless||i.setAttribute("two-src",t.src),dn.ImageRegistry.add(t.src,i),Pt.isHeadless?dn.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(Pt.isHeadless)throw new Lt("video textures are not implemented in headless environments.");const i=function(o){t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof e=="function"&&e()},r=function(o){throw t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",r,!1),new Lt("unable to load "+t.src)};t._src=dn.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),dn.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?i():(t.image.addEventListener("canplaythrough",i,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var De=dn,Sc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=De.getTag(t);let i;switch(e){case"canvas":i="#"+t.id;break;default:i=t.src}De.ImageRegistry.contains(i)?this._image=De.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(ee.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(ee.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function _y(){this._flagOffset=!0}function wy(){this._flagScale=!0}var As=class _n extends Ji{constructor(e,i,r){super(),S(this,"_flagOffset",!0),S(this,"_flagOpacity",!0),S(this,"_flagColor",!0),S(this,"_offset",0),S(this,"_opacity",1),S(this,"_color","#fff");for(let o in Bc)Object.defineProperty(this,o,Bc[o]);this._renderer.type="stop",this.offset=typeof e=="number"?e:_n.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof i=="string"?i:_n.Index<=0?"#fff":"#000",_n.Index=(_n.Index+1)%2}static fromObject(e){const i=new _n().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<_n.Properties.length;i++){const r=_n.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new _n;return oe.each(_n.Properties,function(r){i[r]=this[r]},this),e&&e.stops&&e.stops.push(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",oe.each(_n.Properties,i=>{e[i]=this[i]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(As,"Index",0),S(As,"Properties",["offset","opacity","color"]);var oi=As,Bc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Os=class Wi extends Ji{constructor(e){super(),S(this,"_flagStops",!1),S(this,"_flagSpread",!1),S(this,"_flagUnits",!1),S(this,"_spread",""),S(this,"_units","");for(let i in Nc)Object.defineProperty(this,i,Nc[i]);this._renderer.type="gradient",this._renderer.flagStops=xy.bind(this),this._renderer.bindStops=ky.bind(this),this._renderer.unbindStops=Cy.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let i=e.stops;i&&i.length>0&&(i=i.map(o=>o instanceof oi?o:new oi().copy(o)));const r=new Wi(i).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const i=this.stops.map(o=>o.clone()),r=new Wi(i);return oe.each(Wi.Properties,o=>{r[o]=this[o]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let i=0;i<Wi.Properties.length;i++){const r=Wi.Properties[i];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(i=>i.toObject())};return oe.each(Wi.Properties,i=>{e[i]=this[i]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Os,"Stop",oi),S(Os,"Properties",["spread","stops","units"]);var ut=Os,Nc={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._stops=new ri((t||[]).slice(0)),this._stops.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._stops)}}};function xy(){this._flagStops=!0}function ky(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Cy(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}var zs=class eo extends ut{constructor(e,i,r,o,s){super(s),S(this,"_flagEndPoints",!1),S(this,"_left",null),S(this,"_right",null);for(let l in Tc)Object.defineProperty(this,l,Tc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=vy.bind(this),this.left=new re,this.right=new re,typeof e=="number"&&(this.left.x=e),typeof i=="number"&&(this.left.y=i),typeof r=="number"&&(this.right.x=r),typeof o=="number"&&(this.right.y=o)}static fromObject(e){const i=new eo().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<eo.Properties.length;i++){const r=eo.Properties[i];r in e&&(this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new eo(this.left._x,this.left._y,this.right._x,this.right._y,i);return oe.each(ut.Properties,function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(zs,"Stop",oi),S(zs,"Properties",["left","right"]);var Ge=zs,Tc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof re&&this._left.unbind(ee.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof re&&this._right.unbind(ee.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function vy(){this._flagEndPoints=!0}var Ds=class ji extends ut{constructor(e,i,r,o,s,l){super(o),S(this,"_flagRadius",!1),S(this,"_flagCenter",!1),S(this,"_flagFocal",!1),S(this,"_radius",0),S(this,"_center",null),S(this,"_focal",null);for(let a in $c)Object.defineProperty(this,a,$c[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Sy.bind(this),this._renderer.flagFocal=By.bind(this),this.center=new re,this.radius=typeof r=="number"?r:1,this.focal=new re,typeof e=="number"&&(this.center.x=e),typeof i=="number"&&(this.center.y=i),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof l=="number"&&(this.focal.y=l)}static fromObject(e){const i=new ji().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<ji.Properties.length;i++){const r=ji.Properties[i];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new ji(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return oe.each(ut.Properties.concat(ji.Properties),function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return oe.each(ji.Properties,function(i){e[i]=this[i]},this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Ds,"Stop",oi),S(Ds,"Properties",["center","radius","focal"]);var Ze=Ds,$c={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(ee.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(ee.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(ee.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(ee.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Sy(){this._flagCenter=!0}function By(){this._flagFocal=!0}function Ec(t,e){if(e===0||e===1)return!0;const r=t._length*e;let o=0;for(let s=0;s<t._lengths.length;s++){const l=t._lengths[s];if(o>=r)return r-o>=0;o+=l}return!1}function mo(t,e){const i=t._length;if(e<=0)return 0;if(e>=i)return t._lengths.length-1;for(let r=0,o=0;r<t._lengths.length;r++){if(o+t._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/t._lengths[r];o+=t._lengths[r]}return-1}function Rc(t,e,i){let r,o,s,l,a,c,d,u;const f=e.controls&&e.controls.right,h=t.controls&&t.controls.left;return r=e.x,a=e.y,o=(f||e).x,c=(f||e).y,s=(h||t).x,d=(h||t).y,l=t.x,u=t.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&t._relative&&(s+=t.x,d+=t.y),gc(r,a,o,c,s,d,l,u,i)}function Ls(t,e,i){let r,o,s,l,a,c,d,u;const f=e.controls&&e.controls.right,h=t.controls&&t.controls.left;return r=e.x,a=e.y,o=(f||e).x,c=(f||e).y,s=(h||t).x,d=(h||t).y,l=t.x,u=t.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&t._relative&&(s+=t.x,d+=t.y),Vs(r,a,o,c,s,d,l,u,i)}function xi(t){switch(t.renderer.type){case"texture":return De.fromObject(t);case"gradient":return ut.fromObject(t);case"linear-gradient":return Ge.fromObject(t);case"radial-gradient":return Ze.fromObject(t)}return t}var Ny=Math.cos,Ty=Math.sin,Pc=Math.tan,Hs=[],Fc=class en extends ee{constructor(e,i,r,o,s,l){super(),S(this,"elements",new xn(9)),S(this,"manual",!1);let a=e;Array.isArray(a)||(a=Array.prototype.slice.call(arguments)),this.identity(),a.length>0&&this.set(a)}static Multiply(e,i,r){if(i.length<=3){const N=e;let w,T,C;const $=i[0]||0,E=i[1]||0,V=i[2]||0;return w=N[0]*$+N[1]*E+N[2]*V,T=N[3]*$+N[4]*E+N[5]*V,C=N[6]*$+N[7]*E+N[8]*V,[w,T,C]}const o=e[0],s=e[1],l=e[2],a=e[3],c=e[4],d=e[5],u=e[6],f=e[7],h=e[8],m=i[0],p=i[1],g=i[2],b=i[3],y=i[4],_=i[5],k=i[6],x=i[7],v=i[8];return r=r||new xn(9),r[0]=o*m+s*b+l*k,r[1]=o*p+s*y+l*x,r[2]=o*g+s*_+l*v,r[3]=a*m+c*b+d*k,r[4]=a*p+c*y+d*x,r[5]=a*g+c*_+d*v,r[6]=u*m+f*b+h*k,r[7]=u*p+f*y+h*x,r[8]=u*g+f*_+h*v,r}static fromObject(e){return new en().copy(e)}set(e,i,r,o,s,l,a,c,d){if(typeof i>"u"){const u=e;e=u[0],i=u[1],r=u[2],o=u[3],s=u[4],l=u[5],a=u[6],c=u[7],d=u[8]}return this.elements[0]=e,this.elements[1]=i,this.elements[2]=r,this.elements[3]=o,this.elements[4]=s,this.elements[5]=l,this.elements[6]=a,this.elements[7]=c,this.elements[8]=d,this.trigger(ee.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(ee.Types.change)}identity(){return this.elements[0]=en.Identity[0],this.elements[1]=en.Identity[1],this.elements[2]=en.Identity[2],this.elements[3]=en.Identity[3],this.elements[4]=en.Identity[4],this.elements[5]=en.Identity[5],this.elements[6]=en.Identity[6],this.elements[7]=en.Identity[7],this.elements[8]=en.Identity[8],this.trigger(ee.Types.change)}multiply(e,i,r,o,s,l,a,c,d){if(typeof i>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(ee.Types.change);if(typeof r>"u"&&(r=1),typeof o>"u"){e=e||0,i=i||0,r=r||0,s=this.elements;const I=s[0]*e+s[1]*i+s[2]*r,K=s[3]*e+s[4]*i+s[5]*r,J=s[6]*e+s[7]*i+s[8]*r;return[I,K,J]}const u=this.elements,f=[e,i,r,o,s,l,a,c,d],h=u[0],m=u[1],p=u[2],g=u[3],b=u[4],y=u[5],_=u[6],k=u[7],x=u[8],v=f[0],N=f[1],w=f[2],T=f[3],C=f[4],$=f[5],E=f[6],V=f[7],P=f[8];return this.elements[0]=h*v+m*T+p*E,this.elements[1]=h*N+m*C+p*V,this.elements[2]=h*w+m*$+p*P,this.elements[3]=g*v+b*T+y*E,this.elements[4]=g*N+b*C+y*V,this.elements[5]=g*w+b*$+y*P,this.elements[6]=_*v+k*T+x*E,this.elements[7]=_*N+k*C+x*V,this.elements[8]=_*w+k*$+x*P,this.trigger(ee.Types.change)}inverse(e){const i=this.elements;e=e||new en;const r=i[0],o=i[1],s=i[2],l=i[3],a=i[4],c=i[5],d=i[6],u=i[7],f=i[8],h=f*a-c*u,m=-f*l+c*d,p=u*l-a*d;let g=r*h+o*m+s*p;return g?(g=1/g,e.elements[0]=h*g,e.elements[1]=(-f*o+s*u)*g,e.elements[2]=(c*o-s*a)*g,e.elements[3]=m*g,e.elements[4]=(f*r-s*d)*g,e.elements[5]=(-c*r+s*l)*g,e.elements[6]=p*g,e.elements[7]=(-u*r+o*d)*g,e.elements[8]=(a*r-o*l)*g,e):null}scale(e,i){return arguments.length<=1&&(i=e),this.multiply(e,0,0,0,i,0,0,0,1)}rotate(e){const i=Ny(e),r=Ty(e);return this.multiply(i,-r,0,r,i,0,0,0,1)}translate(e,i){return this.multiply(1,0,e,0,1,i,0,0,1)}skewX(e){const i=Pc(e);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(e){const i=Pc(e);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(e){return Hs.length=0,this.toTransformArray(e,Hs),Hs.map(ze).join(" ")}toTransformArray(e,i){const r=this.elements,o=!!i,s=r[0],l=r[1],a=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],m=r[8];if(o){i[0]=s,i[1]=c,i[2]=f,i[3]=l,i[4]=d,i[5]=h,i[6]=a,i[7]=u,i[8]=m;return}return[s,c,f,l,d,h,a,u,m]}if(o){i[0]=s,i[1]=c,i[2]=l,i[3]=d,i[4]=a,i[5]=u;return}return[s,c,l,d,a,u]}toArray(e,i){const r=this.elements,o=!!i,s=r[0],l=r[1],a=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],m=r[8];if(o){i[0]=s,i[1]=l,i[2]=a,i[3]=c,i[4]=d,i[5]=u,i[6]=f,i[7]=h,i[8]=m;return}return[s,l,a,c,d,u,f,h,m]}if(o){i[0]=s,i[1]=l,i[2]=a,i[3]=c,i[4]=d,i[5]=u;return}return[s,l,a,c,d,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new en().copy(this)}};S(Fc,"Identity",[1,0,0,0,1,0,0,0,1]);var ki=Fc;fc(ki);var Vc=class Fa extends Ji{constructor(){super(),S(this,"_flagMatrix",!0),S(this,"_flagScale",!1),S(this,"_matrix",null),S(this,"_worldMatrix",null),S(this,"_position",null),S(this,"_rotation",0),S(this,"_scale",1),S(this,"_skewX",0),S(this,"_skewY",0);for(let e in po)Object.defineProperty(this,e,po[e]);this._renderer.flagMatrix=Mc.bind(this),this.isShape=!0,this.matrix=new ki,this.worldMatrix=new ki,this.position=new re,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const i=new Fa().copy(e);return"id"in e&&(i.id=e.id),i}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return po.position.get.apply(this,arguments)}set translation(e){po.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&"visible"in this&&this.visible===!1||!s&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const a=this.getBoundingClientRect();return a?e>=a.left-l&&e<=a.right+l&&i>=a.top-l&&i<=a.bottom+l:!1}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof re?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){const i=new Fa;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof re?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof re?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Vc,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var zn=Vc,po={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(ee.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(ee.Types.change,this._renderer.flagMatrix),Mc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Ps(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Mc(){this._flagMatrix=!0}var Ic=/^(?:none|transparent)$/i,$y=8,Ws=Number.EPSILON;function Dn(t,e){return{x:t,y:e}}function go(t,e,i=Ws){return Math.abs(t.x-e.x)<=i&&Math.abs(t.y-e.y)<=i}function Ac(t,e,i,r){const o=t*i+e*r,s=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+r*r)||1e-12;let l=Math.acos(Math.max(-1,Math.min(1,o/s)));return t*r-e*i<0&&(l=-l),l}function Ey(t,e,i){if(!t)return[Dn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Dn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,l=e.largeArcFlag?1:0,a=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=t.x,d=t.y,u=e.x,f=e.y,h=(c-u)/2,m=(d-f)/2,p=Math.cos(s),g=Math.sin(s);let b=p*h+g*m,y=-g*h+p*m,_=r*r,k=o*o;const x=b*b/_+y*y/k;if(x>1){const O=Math.sqrt(x);r*=O,o*=O,_=r*r,k=o*o}const v=_*y*y+k*b*b,N=v===0?0:(_*k-v)/v;let w=Math.sqrt(Math.max(0,N));l===a&&(w=-w);const T=w*r*y/o,C=-w*o*b/r,$=p*T-g*C+(c+u)/2,E=g*T+p*C+(d+f)/2,V=Ac(1,0,(b-T)/r,(y-C)/o),P=Ac((b-T)/r,(y-C)/o,(-b-T)/r,(-y-C)/o)%tt,I=V+P,K=a===0,J=(()=>{const O=I-V,z=Math.abs(O)<Number.EPSILON;let M=ot(O,tt);return M<Number.EPSILON&&(M=z?0:tt),K&&!z&&(M=M===tt?-tt:M-tt),M})(),Z=Math.max(kt.Resolution,Math.max(i*2,1)),L=[];for(let O=1;O<=Z;O++){const z=O/Z,M=V+z*J;let R=$+r*Math.cos(M),W=E+o*Math.sin(M);if(s!==0){const U=R-$,G=W-E,X=Math.cos(s),j=Math.sin(s);R=U*X-G*j+$,W=U*j+G*X+E}L.push(Dn(R,W))}return L}function Ry(t,e=$y){const i=[],r=[],o=t._renderer&&t._renderer.vertices&&t._renderer.vertices.length>0?t._renderer.vertices:t.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let l=null,a=null,c=null,d=null;const u=(h=!1)=>{if(l){if(h&&a&&c&&!go(a,c)){const m=Dn(a.x,a.y);r.push({a:c,b:m}),l.push(m),c=m}l.length>=3&&a&&c&&go(a,c)&&i.push(l),l=null,a=null,c=null}},f=h=>{if(!c){c=h,l&&l.push(h);return}go(c,h)||(r.push({a:c,b:h}),l&&l.push(h),c=h)};for(let h=0;h<o.length;h++){const m=o[h],p=m.command||(h===0?ie.move:ie.line);if(p===ie.move){u(!1);const g=Dn(m.x,m.y);l=[g],a=g,c=g,d=m;continue}if(d||(d=o[Math.max(h-1,0)]),p===ie.line)f(Dn(m.x,m.y));else if(p===ie.curve){const g=Ls(m,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Dn(y.x,y.y))}f(Dn(m.x,m.y))}else if(p===ie.arc){const g=Ey(d,m,s);for(let b=0;b<g.length;b++)f(g[b])}else if(p===ie.close){u(!0),d=m;continue}else f(Dn(m.x,m.y));d=m}if(l){const h=!!t._closed||!!t.closed||a&&c&&!go(a,c);u(h)}return{polygons:i,segments:r}}function Py(t,e,i){let r=!1;for(let o=0;o<t.length;o++){const s=t[o];if(!s||s.length<3)continue;let l=s.length-1;for(let a=0;a<s.length;a++){const c=s[l],d=s[a];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),l=a}}return r}function Fy(t,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<Ws&&Math.abs(s)<Ws){const h=t-i.x,m=e-i.y;return h*h+m*m}const l=((t-i.x)*o+(e-i.y)*s)/(o*o+s*s),a=Math.max(0,Math.min(1,l)),c=i.x+a*o,d=i.y+a*s,u=t-c,f=e-d;return u*u+f*f}function Vy(t,e,i){if(!t||t.length===0)return 1/0;let r=1/0;for(let o=0;o<t.length;o++){const s=t[o],l=Fy(e,i,s.a,s.b);l<r&&(r=l)}return Math.sqrt(r)}function My(t,e){if(typeof e=="boolean")return e;const i=t.fill;return!i&&i!==0?!1:typeof i=="string"?!Ic.test(i):!0}function Iy(t,e){const i=typeof t.linewidth=="number"?t.linewidth:t._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=t.stroke;return!r&&r!==0?!1:typeof r=="string"?!Ic.test(r):!0}function Ay(t,e,i,r=0){if(!t)return!1;const o=t.left-r,s=t.right+r,l=t.top-r,a=t.bottom+r;return e>=o&&e<=s&&i>=l&&i<=a}var yo=Number.EPSILON;function bo(t){return typeof t.relative!="boolean"||!!t.relative}function un(t,e,i,r){const o=t.controls;if(!(!o||!o[e])){if(Math.abs(i)<yo&&Math.abs(r)<yo){bo(t)?o[e].clear():o[e].set(t.x,t.y);return}bo(t)?o[e].set(i,r):o[e].set(t.x+i,t.y+r)}}function Ht(t,e){un(t,e,0,0)}function Oy(t,e){const i=t.controls;return!i||!i[e]?{x:0,y:0}:bo(t)?{x:i[e].x,y:i[e].y}:{x:i[e].x-t.x,y:i[e].y-t.y}}function er(t,e){const i=Oy(t,e);return Math.abs(i.x)>yo||Math.abs(i.y)>yo}function _o(t){t.command===ie.move||t.command===ie.close||(t.command=er(t,"left")||er(t,"right")?ie.curve:ie.line)}function Oc(t,e){typeof e.relative=="boolean"&&(t.relative=e.relative)}function zy(t,e){return er(e,"right")||er(t,"left")||er(t,"right")||er(e,"left")||t.command===ie.curve||e.command===ie.curve}function tr(t,e,i){return{x:Ft(t.x,e.x,i),y:Ft(t.y,e.y,i)}}function zc(t,e){const i=t.controls&&t.controls[e];return i?bo(t)?{x:t.x+i.x,y:t.y+i.y}:{x:i.x,y:i.y}:{x:t.x,y:t.y}}function Dy(t,e,i){const r=t.controls&&t.controls.right,o=e.controls&&e.controls.left,s={x:t.x,y:t.y},l=r?zc(t,"right"):$r({},s),a={x:e.x,y:e.y},c=o?zc(e,"left"):$r({},a),d=tr(s,l,i),u=tr(l,c,i),f=tr(c,a,i),h=tr(d,u,i),m=tr(u,f,i),p=tr(h,m,i),g=new $e(p.x,p.y);return Oc(g,t),un(g,"left",h.x-p.x,h.y-p.y),un(g,"right",m.x-p.x,m.y-p.y),g.command=ie.curve,{anchor:g,startOut:d,endIn:f}}function Ly(t,e,i,r,o,s){const l=t.length,a=i-e+1;let c=a-1,d=o?Math.min(a,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,l-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let w=0,T=e-u;w<=c;w+=1,T+=1){const C=ot(T,l);h[w]=t[C]}let m=h[0].x+2*h[1].x,p=h[0].y+2*h[1].y,g=2;const b=c-1,y=[m],_=[p],k=[g],x=new Array(c+1),v=new Array(c+1);for(let w=1;w<c;w+=1){const T=w<b,C=T||s?1:2,$=T?4:s?2:7,E=T?4:s?3:8,V=T?2:s?0:1,P=C/g;g=k[w]=$-P,m=y[w]=E*h[w].x+V*h[w+1].x-P*m,p=_[w]=E*h[w].y+V*h[w+1].y-P*p}x[b]=y[b]/k[b],v[b]=_[b]/k[b];for(let w=c-2;w>=0;w-=1)x[w]=(y[w]-x[w+1])/k[w],v[w]=(_[w]-v[w+1])/k[w];x[c]=(3*h[c].x-x[b])/2,v[c]=(3*h[c].y-v[b])/2;const N=c-f;for(let w=u,T=e;w<=N;w+=1,T+=1){const C=ot(T,l),$=t[C],E=x[w]-$.x,V=v[w]-$.y;o||w<N?un($,"right",E,V):Ht($,"right"),o||w>u?un($,"left",-E,-V):Ht($,"left"),_o($)}}function Hy(t,e,i,r,o,s){const l=e||t,a=t,c=i||t,d=re.distanceBetween(l,a),u=re.distanceBetween(a,c),f=r===void 0?.5:r,h=Math.pow(d,f),m=Math.pow(u,f),p=h*h,g=m*m;if(!o&&e){const b=2*g+3*m*h+p,y=3*m*(m+h);if(y!==0){const _=(g*l.x+b*a.x-p*c.x)/y-a.x,k=(g*l.y+b*a.y-p*c.y)/y-a.y;un(t,"left",_,k)}else Ht(t,"left")}else Ht(t,"left");if(!s&&i){const b=2*p+3*h*m+g,y=3*h*(h+m);if(y!==0){const _=(p*c.x+b*a.x-g*l.x)/y-a.x,k=(p*c.y+b*a.y-g*l.y)/y-a.y;un(t,"right",_,k)}else Ht(t,"right")}else Ht(t,"right");_o(t)}function Wy(t,e,i,r,o,s){if(!(e&&i)){e||Ht(t,"left"),i||Ht(t,"right"),_o(t);return}const l=e,a=t,c=i,d=re.distanceBetween(l,a),u=re.distanceBetween(a,c),f=d+u,h=r===void 0?.4:r,m={x:l.x-c.x,y:l.y-c.y};if(!o&&f!==0){const p=h*d/f;un(t,"left",m.x*p,m.y*p)}else Ht(t,"left");if(!s&&f!==0){const p=h*d/f-h;un(t,"right",m.x*p,m.y*p)}else Ht(t,"right");_o(t)}function jy(t,e,i,r,o,s){const l=s.type,a=s.factor,c=t.length;for(let d=e;d<=i;d+=1){const u=ot(d,c),f=t[u];if(f.command===ie.move){Ht(f,"left"),Ht(f,"right");continue}const h=d===e&&!o?null:d-1,m=d===i&&!o?null:d+1,p=h===null?null:t[ot(h,c)],g=m===null?null:t[ot(m,c)],b=h===null,y=m===null;l==="geometric"?Wy(f,p,g,a,b,y):Hy(f,p,g,a,b,y)}}var nr=Math.min,ir=Math.max,qy=Math.ceil,Xy=Math.floor,Yy=new re,Uy=new ki,js=class gi extends zn{constructor(e,i,r,o){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagCap",!0),S(this,"_flagJoin",!0),S(this,"_flagMiter",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in Dc)Object.defineProperty(this,s,Dc[s]);this._renderer.type="path",this._renderer.flagVertices=Lc.bind(this),this._renderer.bindVertices=Hc.bind(this),this._renderer.unbindVertices=Wc.bind(this),this._renderer.flagFill=jc.bind(this),this._renderer.flagStroke=qc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:xi(e.fill),r=typeof e.stroke=="string"?e.stroke:xi(e.stroke),o=new gi().copy(Rs($r({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof $e?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new $e().copy(r))}}for(let i=0;i<gi.Properties.length;i++){const r=gi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new gi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<gi.Properties.length;r++){const o=gi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(i=>i.toObject()),oe.each(gi.Properties,i=>{typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind(),i.controls&&(i.controls.left&&typeof i.controls.left.unbind=="function"&&i.controls.left.unbind(),i.controls.right&&typeof i.controls.right.unbind=="function"&&i.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),i=e.width/2,r=e.height/2,o=e.left+e.width/2,s=e.top+e.height/2;for(let l=0;l<this.vertices.length;l++){const a=this.vertices[l];a.x-=o,a.y-=s,a.x+=i,a.y+=r}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=i,this.mask.translation.y-=s,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o];s.x-=i,s.y-=r}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getBoundingClientRect(e){let i,r,o,s,l,a,c=1/0,d=-1/0,u=1/0,f=-1/0;if(this._update(!0),i=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:h,scaleY:m}=wi(i.elements[0],i.elements[3],i.elements[1],i.elements[4],i.elements[2],i.elements[5]);typeof h=="number"&&typeof m=="number"&&(r=Math.max(h,m)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(s=0;s<o;s++){a=this._renderer.vertices[s],l=this._renderer.vertices[(s+o-1)%o];const[h,m]=i.multiply(l.x,l.y),[p,g]=i.multiply(a.x,a.y);if(l.controls&&a.controls){let b=l.controls.right.x,y=l.controls.right.y;l.relative&&(b+=l.x,y+=l.y);let[_,k]=i.multiply(b,y),x=a.controls.left.x,v=a.controls.left.y;a.relative&&(x+=a.x,v+=a.y);let[N,w]=i.multiply(x,v);const T=yc(h,m,_,k,N,w,p,g);u=nr(T.min.y-r,u),c=nr(T.min.x-r,c),d=ir(T.max.x+r,d),f=ir(T.max.y+r,f)}else s<=1&&(u=nr(m-r,u),c=nr(h-r,c),d=ir(h+r,d),f=ir(m+r,f)),u=nr(g-r,u),c=nr(p-r,c),d=ir(p+r,d),f=ir(g+r,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&this.visible===!1||!s&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const a=this.getBoundingClientRect();if(!a||e<a.left-l||e>a.right+l||i<a.top-l||i>a.bottom+l)return!1;const c=this.worldMatrix,d=c&&c.inverse(Uy);if(!d)return super.contains(e,i,o);const[u,f]=d.multiply(e,i,1),h=typeof o.precision=="number"&&!Number.isNaN(o.precision)?Math.max(1,Math.floor(o.precision)):8,m=My(this,o.fill),p=Iy(this,o.stroke),{polygons:g,segments:b}=Ry(this,h);if(m&&g.length>0&&Py(g,u,f))return!0;if(p&&b.length>0){const y=typeof this.linewidth=="number"?this.linewidth:0;if(y>0&&Vy(b,u,f)<=y/2+l)return!0}return!m&&!p?super.contains(e,i,o):m&&g.length===0?super.contains(e,i,o):!1}getPointAt(e,i){let r,o,s,l,a,c,d,u,f,h,m,p,g,b,y,_=this.length*Math.min(Math.max(e,0),1);const k=this.vertices.length,x=k-1;let v=null,N=null;for(let Z=0,L=this._lengths.length,O=0;Z<L;Z++){if(O+this._lengths[Z]>=_){this._closed?(r=ot(Z,k),o=ot(Z-1,k),Z===0&&(r=o,o=Z)):(r=Z,o=Math.min(Math.max(Z-1,0),x)),v=this.vertices[r],N=this.vertices[o],_-=O,this._lengths[Z]!==0?e=_/this._lengths[Z]:e=0;break}O+=this._lengths[Z]}if(v===null||N===null)return null;if(v){if(!N)return v}else return N;y=N.controls&&N.controls.right,b=v.controls&&v.controls.left,a=N.x,h=N.y,c=(y||N).x,m=(y||N).y,d=(b||v).x,p=(b||v).y,u=v.x,g=v.y,y&&N.relative&&(c+=N.x,m+=N.y),b&&v.relative&&(d+=v.x,p+=v.y),l=Er(e,a,c,d,u),f=Er(e,h,m,p,g);const w=Ft(a,c,e),T=Ft(h,m,e),C=Ft(c,d,e),$=Ft(m,p,e),E=Ft(d,u,e),V=Ft(p,g,e),P=Ft(w,C,e),I=Ft(T,$,e),K=Ft(C,E,e),J=Ft($,V,e);return oe.isObject(i)?(i.x=l,i.y=f,i instanceof $e&&(i.controls.left.x=P,i.controls.left.y=I,i.controls.right.x=K,i.controls.right.y=J,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=l,i.controls.left.y-=f,i.controls.right.x-=l,i.controls.right.y-=f)),i.t=e,i):(s=new $e(l,f,P-l,I-f,K-l,J-f,this._curved?ie.curve:ie.line),s.t=e,s)}plot(){if(this.curved)return _c(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ie.move:ie.line;return this}smooth(e){const i=e||{},r=i.type||"continuous",o=this._collection,s=o.length;if(s<2)return this;const l=this._closed||s>0&&o[s-1]&&o[s-1].command===ie.close,a=(h,m)=>{if(h==null)return m;if(typeof h=="number"){if(l)return ot(h,s);let g=h;return g<0&&(g+=s),Math.min(Math.max(g,0),s-1)}const p=o.indexOf(h);return p!==-1?p:m},c=l&&i.from===void 0&&i.to===void 0;let d=a(i.from,0),u=a(i.to,s-1);if(d>u)if(l)d-=s;else{const h=d;d=u,u=h}const f=u-d+1;for(let h=0;h<f;h+=1){const m=ot(d+h,s),p=o[m],g=!l&&m===0;p.command===ie.move&&!g&&(p.command=ie.line)}if(r==="continuous"||r==="asymmetric")Ly(o,d,u,l,c,r==="asymmetric");else if(r==="catmull-rom"||r==="geometric"){const h={type:r,factor:i.factor};jy(o,d,u,l,c,h)}else throw new Error(`Path.smooth does not support type "${r}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(e){this._update();const i=this.vertices,r=i.length;if(r<2)return this;const o=[];let s=null,l=null;for(let a=0;a<r;a+=1){const c=i[a];if(!s||c.command===ie.move){const u=c.clone();o.push(u),s=c,l=c;continue}if(zy(c,s)){const f=Ls(c,s,e).length,h=o[o.length-1];let m=h.clone(),p=c.clone(),g=h,b=0;if(f<=1){const y=c.clone();o.push(y)}else{for(let _=1;_<f;_+=1){const k=_/f,x=1-b,v=x<=Number.EPSILON?k:(k-b)/x,N=Dy(m,p,v);un(g,"right",N.startOut.x-g.x,N.startOut.y-g.y);const w=N.anchor;o.push(w),g=w,m=w.clone(),b=k,un(p,"left",N.endIn.x-p.x,N.endIn.y-p.y)}const y=c.clone();y.controls.left.copy(p.controls.left),o.push(y)}}else{const u=Ls(c,s,e);for(let h=1;h<u.length;h+=1){const m=u[h];Oc(m,s),Ht(m,"left"),Ht(m,"right"),m.command=ie.line,o.push(m)}const f=c.clone();o.push(f)}s=c,c.command===ie.close&&(s=l)}return this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,i){i||this._update();const o=this.vertices.length-1;let s=this.vertices[o],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),oe.each(this.vertices,function(a,c){if(c<=0||a.command===ie.move){s=a,this._lengths[c]=0;return}this._lengths[c]=Rc(a,s,e),l+=this._lengths[c],s=a},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,i=this._closed,r=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),s=mo(this,r*this._length),l=mo(this,o*this._length),a=qy(s),c=Xy(l);let d,u,f,h,m,p;for(this._renderer.vertices.length=0,p=0;p<e;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new $e),p>c&&!u?(m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,m),m.command=this._renderer.collection[p].command,this._renderer.vertices.push(m),u=m,f=this._collection[p-1],f&&f.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),f.relative?this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(re.zero,1-m.t):this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(f,1-m.t))):p>=a&&p<=c&&(m=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(m),p===c&&Ec(this,o)?(u=m,!i&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):p===a&&Ec(this,r)&&(d=m,d.command=ie.move,!i&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));a>0&&!d&&(p=a-1,m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(r,m),m.command=ie.move,this._renderer.vertices.unshift(m),h=this._collection[p+1],h&&h.controls&&(m.controls.left.clear(),h.relative?this._renderer.collection[p+1].controls.left.copy(h.controls.left).lerp(re.zero,m.t):(Yy.copy(h),this._renderer.collection[p+1].controls.left.copy(h.controls.left).lerp(h,m.t))))}return zn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,zn.prototype.flagReset.call(this),this}};S(js,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(js,"Utils",{getCurveLength:Rc});var Re=js,Dc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";oe.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),t instanceof ri?this._collection=t:this._collection=new ri(t||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Lc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Hc(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Wc(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function jc(){this._flagFill=!0}function qc(){this._flagStroke=!0}var Xc=class to extends Re{constructor(e,i,r,o){const s=[new $e,new $e,new $e,new $e];super(s,!0,!1,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_origin",null),this._renderer.type="rectangle";for(let l in Yc)Object.defineProperty(this,l,Yc[l]);this.width=typeof r=="number"?r:1,this.height=typeof o=="number"?o:1,this.origin=new re,typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i),this._update()}static fromObject(e){const i=new to().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<to.Properties.length;i++){const r=to.Properties[i];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof re&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,i=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new $e),this.vertices[0].set(-e,-i).sub(this._origin).command=ie.move,this.vertices[1].set(e,-i).sub(this._origin).command=ie.line,this.vertices[2].set(e,i).sub(this._origin).command=ie.line,this.vertices[3].set(-e,i).sub(this._origin).command=ie.line,this.vertices[4]&&(this.vertices[4].set(-e,-i).sub(this._origin).command=ie.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=new to(0,0,this.width,this.height);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];i[o]instanceof re?i[o].copy(this[o]):i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="rectangle",e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}};S(Xc,"Properties",["width","height","origin"]);var si=Xc,Yc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(ee.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(ee.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Uc=class no extends si{constructor(e,i,r,o,s,l){super(i,r,0,0),S(this,"_flagTexture",!1),S(this,"_flagColumns",!1),S(this,"_flagRows",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_texture",null),S(this,"_columns",1),S(this,"_rows",1),S(this,"_frameRate",0),S(this,"_index",0),S(this,"_origin",null),this._renderer.type="sprite";for(let a in Kc)Object.defineProperty(this,a,Kc[a]);this.noStroke(),this.noFill(),e instanceof De?this.texture=e:typeof e=="string"&&(this.texture=new De(e)),this.origin=new re,this._update(),typeof o=="number"&&(this.columns=o),typeof s=="number"&&(this.rows=s),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(e){const i=new no().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<no.Properties.length;i++){const r=no.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const i=new no(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&i.play(this._firstFrame,this._lastFrame),i.loop=this.loop,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,i=this._columns,r=this._rows;let o,s,l,a,c,d,u,f,h;if(e&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=e),e.loaded)){u=e.image.width,f=e.image.height,o=u/i,s=f/r,a=this._amount,this.width!==o&&(this.width=o),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(oe.isNaN(this._lastFrame)&&(this._lastFrame=a-1),l=oe.performance.now()-this._startTime,h=this._lastFrame+1,c=1e3*(h-this._firstFrame)/this._frameRate,this._loop?l=l%c:l=Math.min(l,c),d=Ft(this._firstFrame,h,l/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%i,p=Math.floor(this._index/i),g=-o*m+(u-o)/2,b=-s*p+(f-s)/2;g!==e.offset.x&&(e.offset.x=g),b!==e.offset.y&&(e.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(Uc,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var wo=Uc,Kc={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},qs,Gc=class extends ri{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),ac(this,qs,{}),this.attach(e),this.on(ee.Types.insert,this.attach),this.on(ee.Types.remove,this.detach)}get ids(){return Dt(this,qs)}attach(e){for(let i=0;i<e.length;i++){const r=e[i];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let i=0;i<e.length;i++)delete this.ids[e[i].id];return this}};qs=new WeakMap;var Zc=class qi extends Re{constructor(e,i,r,o,s,l,a){const c=a||kt.Resolution*3,d=[];for(let u=0;u<c;u++)d.push(new $e);super(d,!0,!1,!0),S(this,"_flagStartAngle",!1),S(this,"_flagEndAngle",!1),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_startAngle",0),S(this,"_endAngle",tt),S(this,"_innerRadius",0),S(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let u in Qc)Object.defineProperty(this,u,Qc[u]);typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.startAngle=s),typeof l=="number"&&(this.endAngle=l),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new qi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<qi.Properties.length;i++){const r=qi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,i=this._endAngle,r=this._innerRadius,o=this._outerRadius,s=ot(e,tt)===ot(i,tt),l=r>0,a=this.vertices;let c=l?a.length/2:a.length,d,u=0,f,h,m,p,g,b,y,_,k;for(s?c--:l||(c-=2),f=0,h=c-1;f<c;f++){switch(m=f/h,p=a[u],g=m*(i-e)+e,b=(i-e)/c,y=o*Math.cos(g),_=o*Math.sin(g),f){case 0:d=ie.move;break;default:d=ie.curve}p.command=d,p.x=y,p.y=_,p.controls.left.clear(),p.controls.right.clear(),p.command===ie.curve&&(k=o*b/Math.PI,p.controls.left.x=k*Math.cos(g-dt),p.controls.left.y=k*Math.sin(g-dt),p.controls.right.x=k*Math.cos(g+dt),p.controls.right.y=k*Math.sin(g+dt),f===1&&p.controls.left.multiplyScalar(2),f===h&&p.controls.right.multiplyScalar(2)),u++}if(l){for(s?(a[u].command=ie.close,u++):(c--,h=c-1),f=0;f<c;f++)m=f/h,p=a[u],g=(1-m)*(i-e)+e,b=(i-e)/c,y=r*Math.cos(g),_=r*Math.sin(g),d=ie.curve,f<=0&&(d=s?ie.move:ie.line),p.command=d,p.x=y,p.y=_,p.controls.left.clear(),p.controls.right.clear(),p.command===ie.curve&&(k=r*b/Math.PI,p.controls.left.x=k*Math.cos(g+dt),p.controls.left.y=k*Math.sin(g+dt),p.controls.right.x=k*Math.cos(g-dt),p.controls.right.y=k*Math.sin(g-dt),f===1&&p.controls.left.multiplyScalar(2),f===h&&p.controls.right.multiplyScalar(2)),u++;a[u].copy(a[0]),a[u].command=ie.line}else s||(a[u].command=ie.line,a[u].x=0,a[u].y=0,u++,a[u].copy(a[0]),a[u].command=ie.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.startAngle,s=this.endAngle,l=this.vertices.length,a=new qi(0,0,i,r,o,s,l);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let c=0;c<Re.Properties.length;c++){const d=Re.Properties[c];a[d]=this[d]}return e&&e.add(a),a}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let i=0;i<qi.Properties.length;i++){const r=qi.Properties[i];e[r]=this[r]}return e}};S(Zc,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Xs=Zc,Qc={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},Ys=Math.cos,Us=Math.sin,Jc=class Xi extends Re{constructor(e,i,r,o){const s=o?Math.max(o,2):4,l=[];for(let a=0;a<s;a++)l.push(new $e(0,0,0,0,0,0));super(l,!0,!0,!0),S(this,"_flagRadius",!1),S(this,"_radius",0),this._renderer.type="circle";for(let a in ed)Object.defineProperty(this,a,ed[a]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Xi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Xi.Properties.length;i++){const r=Xi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,o=r*i;for(let s=0;s<this.vertices.length;s++){const a=s/e*tt,c=r*Ys(a),d=r*Us(a),u=o*Ys(a-dt),f=o*Us(a-dt),h=o*Ys(a+dt),m=o*Us(a+dt),p=this.vertices[s];p.command=s===0?ie.move:ie.curve,p.set(c,d),p.controls.left.set(u,f),p.controls.right.set(h,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=new Xi(0,0,this.radius,this.vertices.length);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let i=0;i<Xi.Properties.length;i++){const r=Xi.Properties[i];e[r]=this[r]}return e}};S(Jc,"Properties",["radius"]);var xo=Jc,ed={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Ks=Math.cos,Gs=Math.sin,td=class Yi extends Re{constructor(e,i,r,o,s){typeof o!="number"&&typeof r=="number"&&(o=r);const l=s?Math.max(s,2):4,a=[];for(let c=0;c<l;c++)a.push(new $e);super(a,!0,!0,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),this._renderer.type="ellipse";for(let c in nd)Object.defineProperty(this,c,nd[c]);typeof r=="number"&&(this.width=r*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Yi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Yi.Properties.length;i++){const r=Yi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,o=this._height/2;for(let s=0;s<this.vertices.length;s++){const a=s/e*tt,c=r*Ks(a),d=o*Gs(a),u=r*i*Ks(a-dt),f=o*i*Gs(a-dt),h=r*i*Ks(a+dt),m=o*i*Gs(a+dt),p=this.vertices[s];p.command=s===0?ie.move:ie.curve,p.set(c,d),p.controls.left.set(u,f),p.controls.right.set(h,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=this.width/2,r=this.height/2,o=this.vertices.length,s=new Yi(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let l=0;l<Re.Properties.length;l++){const a=Re.Properties[l];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let i=0;i<Yi.Properties.length;i++){const r=Yi.Properties[i];e[r]=this[r]}return e}};S(td,"Properties",["width","height"]);var ko=td,nd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},Ky=Math.ceil,Gy=Math.floor,id=class yi extends zn{constructor(e){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagSize",!0),S(this,"_flagSizeAttenuation",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_size",1),S(this,"_sizeAttenuation",!1),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0),S(this,"noFill",Re.prototype.noFill),S(this,"noStroke",Re.prototype.noStroke),S(this,"corner",Re.prototype.corner),S(this,"center",Re.prototype.center),S(this,"getBoundingClientRect",Re.prototype.getBoundingClientRect),S(this,"_updateLength",Re.prototype._updateLength);for(let i in rd)Object.defineProperty(this,i,rd[i]);this._renderer.type="points",this._renderer.flagVertices=Lc.bind(this),this._renderer.bindVertices=Hc.bind(this),this._renderer.unbindVertices=Wc.bind(this),this._renderer.flagFill=jc.bind(this),this._renderer.flagStroke=qc.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:xi(e.fill),r=typeof e.stroke=="string"?e.stroke:xi(e.stroke),o=new yi().copy(Rs($r({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof $e?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new $e().copy(r))}for(let i=0;i<yi.Properties.length;i++){const r=yi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new yi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<yi.Properties.length;r++){const o=yi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(i=>i.toObject()),oe.each(yi.Properties,function(i){typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(e){this._update();let i=[];for(let r=0;r<this.vertices.length;r++){const o=this.vertices[r],s=this.vertices[r-1];if(!s)continue;const l=o.x,a=o.y,c=s.x,d=s.y,u=Vs(l,a,l,a,c,d,c,d,e);i=i.concat(u)}return this.vertices=i,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),i=Math.max(this._beginning,this._ending),r=mo(this,e*this._length),o=mo(this,i*this._length),s=Ky(r),l=Gy(o);let a=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=s&&d<=l&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[a*2+0]=c.x,this._renderer.vertices[a*2+1]=c.y,a++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};S(id,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var Zs=id,rd={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),t instanceof ri?this._collection=t:this._collection=new ri(t||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},Zy=Math.cos,Qy=Math.sin,od=class Ui extends Re{constructor(e,i,r,o){o=Math.max(o||0,3),super(),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagSides",!1),S(this,"_radius",0),S(this,"_width",0),S(this,"_height",0),S(this,"_sides",0),this._renderer.type="polygon";for(let s in sd)Object.defineProperty(this,s,sd[s]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ui().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ui.Properties.length;i++){const r=Ui.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,l=tt*s+Math.PI/2,a=this._width*Zy(l)/2,c=this._height*Qy(l)/2;o>=r?this.vertices.push(new $e(a,c)):this.vertices[o].set(a,c),this.vertices[o].command=o===0?ie.move:ie.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=new Ui(0,0,0,this.sides);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.width=this.width,i.height=this.height,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let i=0;i<Ui.Properties.length;i++){const r=Ui.Properties[i];e[r]=this[r]}return e}};S(od,"Properties",["width","height","sides"]);var Qs=od,sd={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},ld=class Ki extends Re{constructor(e,i,r,o,s){typeof s>"u"&&typeof r=="number"&&typeof o=="number"&&(s=Math.floor(Math.min(r,o)/12));const l=[];for(let a=0;a<10;a++)l.push(new $e(0,0,0,0,0,0,a===0?ie.move:ie.curve));super(l),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagRadius",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let a in ad)Object.defineProperty(this,a,ad[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Jy.bind(this),typeof r=="number"&&(this.width=r),typeof o=="number"&&(this.height=o),(typeof s=="number"||s instanceof re)&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ki().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];if(r in e){const o=e[r];/radius/i.test(r)?this[r]=typeof o=="number"||o instanceof re?o:new re().copy(o):typeof o=="number"&&(this[r]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,i=this._height;let r,o;this._radius instanceof re?(r=this._radius.x,o=this._radius.y):(r=this._radius,o=this._radius);let s,l=e/2,a=i/2;s=this.vertices[0],s.x=-(l-r),s.y=-a,s=this.vertices[1],s.x=l-r,s.y=-a,s.controls.left.clear(),s.controls.right.x=r,s.controls.right.y=0,s=this.vertices[2],s.x=l,s.y=-(a-o),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=l,s.y=a-o,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=o,s=this.vertices[4],s.x=l-r,s.y=a,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(l-r),s.y=a,s.controls.left.clear(),s.controls.right.x=-r,s.controls.right.y=0,s=this.vertices[6],s.x=-l,s.y=a-o,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-l,s.y=-(a-o),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-o,s=this.vertices[8],s.x=-(l-r),s.y=-a,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[9],s.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=this.width,r=this.height,o=this.radius,s=new Ki(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let l=0;l<Re.Properties.length;l++){const a=Re.Properties[l];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};S(ld,"Properties",["width","height","radius"]);var Co=ld,ad={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof re&&this._radius.unbind(ee.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof re&&this._radius.bind(ee.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Jy(){this._flagRadius=!0}var e0=Math.cos,t0=Math.sin,cd=class Gi extends Re{constructor(e,i,r,o,s){arguments.length<=3&&(o=r,r=o/2),(typeof s!="number"||s<=0)&&(s=5),super(),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_flagSides",!1),S(this,"_innerRadius",0),S(this,"_outerRadius",0),S(this,"_sides",0),this._renderer.type="star";for(let l in dd)Object.defineProperty(this,l,dd[l]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Gi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,l=tt*s,a=(o%2?this._outerRadius:this._innerRadius)/2,c=a*e0(l),d=a*t0(l);o>=r?this.vertices.push(new $e(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?ie.move:ie.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.sides,s=new Gi(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let l=0;l<Re.Properties.length;l++){const a=Re.Properties[l];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];e[r]=this[r]}return e}};S(cd,"Properties",["innerRadius","outerRadius","sides"]);var Js=cd,dd={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},el,ud=Math.min,fd=Math.max;Ke.document&&(el=document.createElement("canvas"));var tl=class tn extends zn{constructor(e,i,r,o){super(),S(this,"_flagValue",!0),S(this,"_flagFamily",!0),S(this,"_flagSize",!0),S(this,"_flagLeading",!0),S(this,"_flagAlignment",!0),S(this,"_flagBaseline",!0),S(this,"_flagStyle",!0),S(this,"_flagWeight",!0),S(this,"_flagDecoration",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_flagDirection",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_value",""),S(this,"_family","sans-serif"),S(this,"_size",13),S(this,"_leading",17),S(this,"_alignment","center"),S(this,"_baseline","middle"),S(this,"_style","normal"),S(this,"_weight",500),S(this,"_decoration","none"),S(this,"_direction","ltr"),S(this,"_fill","#000"),S(this,"_stroke","none"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in hd)Object.defineProperty(this,s,hd[s]);if(this._renderer.type="text",this._renderer.flagFill=n0.bind(this),this._renderer.flagStroke=i0.bind(this),this.value=e,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!oe.isObject(o))return this;for(let s=0;s<tn.Properties.length;s++){const l=tn.Properties[s];l in o&&(this[l]=o[l])}}static Measure(e){if(el){const i=el.getContext("2d");i.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=i.measureText(e.value,0,0),o=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:o}}else{const i=this.value.length*this.size*tn.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:i,height:r}}}static fromObject(e){const i=typeof e.fill=="string"?e.fill:xi(e.fill),r=typeof e.stroke=="string"?e.stroke:xi(e.stroke),o=new tn().copy(Rs($r({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<tn.Properties.length;i++){const r=tn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new tn(this.value);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale;for(let r=0;r<tn.Properties.length;r++){const o=tn.Properties[r];i[o]=this[o]}return this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let i=0;i<tn.Properties.length;i++){const r=tn.Properties[i];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let i,r,o,s,l;this._update(!0),i=e?this.matrix:this.worldMatrix;const{width:a,height:c}=tn.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,o=a+d;break;case"right":r=-(a+d),o=d;break;default:r=-(a/2+d),o=a/2+d}switch(this.baseline){case"middle":s=-(c/2+d),l=c/2+d;break;default:s=-(c+d),l=d}const[u,f]=i.multiply(r,s),[h,m]=i.multiply(r,l),[p,g]=i.multiply(o,s),[b,y]=i.multiply(o,l);return s=ud(f,m,g,y),r=ud(u,h,p,b),o=fd(u,h,p,b),l=fd(f,m,g,y),{top:s,left:r,right:o,bottom:l,width:o-r,height:l-s}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};S(tl,"Ratio",.6),S(tl,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var Cn=tl,hd={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function n0(){this._flagFill=!0}function i0(){this._flagStroke=!0}var nl=class wr extends si{constructor(e,i,r,o){super(i,r,0,0),S(this,"_flagTextures",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_index",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_textures",null),S(this,"_frameRate",0),S(this,"_origin",null),this._renderer.type="image-sequence";for(let s in md)Object.defineProperty(this,s,md[s]);this._renderer.flagTextures=r0.bind(this),this._renderer.bindTextures=o0.bind(this),this._renderer.unbindTextures=s0.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(pd.bind(this)):typeof e=="string"&&(this.textures=[pd(e)]),this.origin=new re,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=wr.DefaultFrameRate,this.index=0}static fromObject(e){const i=new wr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<wr.Properties.length;i++){const r=wr.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const i=new wr(this.textures,this.translation.x,this.translation.y,this.frameRate);return i._loop=this._loop,this._playing&&i.play(),e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(i){return i.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const i=this.textures[e];typeof i.dispose=="function"?i.dispose():typeof i.unbind=="function"&&i.unbind()}return this}_update(){const e=this._textures;let i,r,o,s,l,a,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,oe.isNaN(this._lastFrame)&&(this._lastFrame=s-1),o=oe.performance.now()-this._startTime,d=this._lastFrame+1,l=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),c=Ft(this._firstFrame,d,o/l),c=Math.floor(c),c!==this._index&&(this._index=c,a=e[this._index],a.loaded&&(i=a.image.width,r=a.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r),this.fill=a,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof De))&&(a=e[this._index],a.loaded&&(i=a.image.width,r=a.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r)),this.fill=a)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(nl,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(nl,"DefaultFrameRate",30);var il=nl,md={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._textures=new ri((t||[]).slice(0)),this._textures.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function r0(){this._flagTextures=!0}function o0(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function s0(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function pd(t){if(t instanceof De)return t;if(typeof t=="string")return new De(t)}var vo=Math.min,So=Math.max,l0={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},rl=class an extends zn{constructor(e){super(),S(this,"_flagAdditions",!1),S(this,"_flagSubtractions",!1),S(this,"_flagOrder",!1),S(this,"_flagOpacity",!0),S(this,"_flagBeginning",!1),S(this,"_flagEnding",!1),S(this,"_flagLength",!1),S(this,"_flagMask",!1),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_length",0),S(this,"_mask",null),S(this,"_strokeAttenuation",!0);for(let i in gd)Object.defineProperty(this,i,gd[i]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let i=0;i<e.length;i++)yd.call(this,e[i],this)}static RemoveChildren(e){for(let i=0;i<e.length;i++)yd.call(this,e[i])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const i=new an;for(let o=0;o<an.Properties.length;o++){const s=an.Properties[o];s in e&&(/(fill|stroke)/i.test(s)?i[s]=typeof e[s]=="string"?e[s]:xi(e[s]):i[s]=e[s])}return"mask"in e&&(i.mask=r(e.mask)),"id"in e&&(i.id=e.id),i.children=e.children.map(r),i;function r(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return Xs.fromObject(o);case"circle":return xo.fromObject(o);case"element":return Ji.fromObject(o);case"ellipse":return ko.fromObject(o);case"group":return an.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return il.fromObject(o);case"path":return Re.fromObject(o);case"points":return Zs.fromObject(o);case"polygon":return Qs.fromObject(o);case"rectangle":return si.fromObject(o);case"rounded-rectangle":return Co.fromObject(o);case"shape":return zn.fromObject(o);case"sprite":return wo.fromObject(o);case"star":return Js.fromObject(o);case"text":return Cn.fromObject(o)}return o}}static IsVisible(e,i){if(!i)return!0;let r=e;for(;r;){if(typeof r.visible=="boolean"&&!r.visible||typeof r.opacity=="number"&&r.opacity<=0)return!1;r=r.parent}return!0}static VisitForHitTest(e,i,r,o,s,l,a){const c=e&&e.children;if(!c)return!1;const d=i.results;for(let u=c.length-1;u>=0;u--){const f=c[u];if(!f||!an.IsVisible(f,i.visibleOnly))continue;const h=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(h&&!Ay(h,i.x,i.y,l))){if(f instanceof an){if(r&&(!o||o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),a)||an.VisitForHitTest(f,i,r,o,s,l,a))return!0;continue}if(f instanceof zn&&!(o&&!o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),a))return!0}}return!1}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let i=0;i<an.Properties.length;i++){const r=an.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new an,r=this.children.map(function(o){return o.clone()});return i.add(r),i.opacity=this.opacity,this.mask&&(i.mask=this.mask),i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.className=this.className,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="group",e.children=[],e.opacity=this.opacity,e.className=this.className,e.mask=this.mask?this.mask.toObject():null,oe.each(this.children,(i,r)=>{e.children[r]=i.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const i=this.children[e];typeof i.dispose=="function"&&i.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(e,i,r){const o=r||{},{results:s,hitOptions:l,context:a,single:c,empty:d}=l0.getShapesAtPoint;s.length=0;const u=o.mode==="deepest"||o.deepest?"deepest":"all",f=o.visibleOnly!==!1,h=!!o.includeGroups,m=typeof o.filter=="function"?o.filter:null,p=typeof o.tolerance=="number"?o.tolerance:0;typeof o.precision=="number"?l.precision=o.precision:delete l.precision,typeof o.fill<"u"?l.fill=o.fill:delete l.fill,typeof o.stroke<"u"?l.stroke=o.stroke:delete l.stroke,l.tolerance=p,l.ignoreVisibility=!f;const g=u==="deepest";if(a.x=e,a.y=i,a.visibleOnly=f,a.results=s,an.VisitForHitTest(this,a,h,m,l,p,g),g){if(s.length>0){const y=s[0];return s.length=0,c[0]=y,c.length=1,c}return d.length=0,d}const b=s.slice();return s.length=0,b}corner(){const e=this.getBoundingClientRect(!0);for(let i=0;i<this.children.length;i++){const r=this.children[i];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const s=this.children[o];s.isShape&&(s.translation.x-=i,s.translation.y-=r)}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getById(e){let i=null;function r(o){if(o.id===e)return o;if(o.children){if(o.children.ids[e])return o.children.ids[e];for(let s=0;s<o.children.length;s++)if(i=r(o.children[s]),i)return i}return null}return r(this)}getByClassName(e){const i=[];function r(o){if(Array.prototype.indexOf.call(o.classList,e)>=0&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const l=o.children[s];r(l)}return i}return r(this)}getByType(e){const i=[];function r(o){if(o instanceof e&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const l=o.children[s];r(l)}return i}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let i=0;i<e.length;i++){const r=e[i];if(!(r&&r.id))continue;const o=Array.prototype.indexOf.call(this.children,r);o>=0&&this.children.splice(o,1),this.children.push(r)}return this}remove(e){const i=arguments.length,r=this.parent;if(i<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let o=0;o<e.length;o++){const s=e[o];if(!s||!this.children.ids[s.id])continue;const l=this.children.indexOf(s);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(e){let i,r,o,s,l,a;this._update(!0);let c=1/0,d=-1/0,u=1/0,f=-1/0;const h=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const p=this.children[m];if(!(!p.visible||h.test(p._renderer.type))&&(i=p.getBoundingClientRect(e),o=typeof i.top!="number"||oe.isNaN(i.top)||!isFinite(i.top),s=typeof i.left!="number"||oe.isNaN(i.left)||!isFinite(i.left),l=typeof i.right!="number"||oe.isNaN(i.right)||!isFinite(i.right),a=typeof i.bottom!="number"||oe.isNaN(i.bottom)||!isFinite(i.bottom),!(o||s||l||a)))if(e){const[g,b]=r.multiply(i.left,i.top),[y,_]=r.multiply(i.right,i.top),[k,x]=r.multiply(i.left,i.bottom),[v,N]=r.multiply(i.right,i.bottom);u=vo(b,_,x,N,u),c=vo(g,y,k,v,c),d=So(g,y,k,v,d),f=So(b,_,x,N,f)}else u=vo(i.top,u),c=vo(i.left,c),d=So(i.right,d),f=So(i.bottom,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}noFill(){return this.children.forEach(function(e){e.noFill()}),this}noStroke(){return this.children.forEach(function(e){e.noStroke()}),this}subdivide(){const e=arguments;return this.children.forEach(function(i){i.subdivide.apply(i,e)}),this}_update(){let e,i,r;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),l=this.length;let a=0;const c=o*l,d=s*l;for(e=0;e<this.children.length;e++)r=this.children[e],i=r.length,c>a+i?(r.beginning=1,r.ending=1):d<a?(r.beginning=0,r.ending=0):c>a&&c<a+i?(r.beginning=(c-a)/i,r.ending=1):d>a&&d<a+i?(r.beginning=0,r.ending=(d-a)/i):(r.beginning=0,r.ending=1),a+=i}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};S(rl,"Children",Gc),S(rl,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var pt=rl,gd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=pt.InsertChildren.bind(this),i=pt.RemoveChildren.bind(this),r=pt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new Gc(t),this._children.bind(ee.Types.insert,e),this._children.bind(ee.Types.remove,i),this._children.bind(ee.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=t)}}}};function yd(t,e){const i=t.parent;let r;if(i===e){o();return}if(i&&i.children.ids[t.id]&&(r=Array.prototype.indexOf.call(i.children,t),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete t.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,t),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,t),r<0&&(i.subtractions.push(t),i._flagSubtractions=!0)}}var Bo=class extends Re{constructor(e,i,r,o){const s=[new $e(e,i),new $e(r,o)];super(s);for(let l in bd)Object.defineProperty(this,l,bd[l]);this.vertices[0].command=ie.move,this.vertices[1].command=ie.line,this.automatic=!1}};S(Bo,"Properties",["left","right"]);var bd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(oe.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=ie.move;else{const e=new Lt("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(oe.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=ie.line;else{const e=new Lt("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},vn={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},a0={start:"left",middle:"center",end:"right"},_d=["id","class","transform","xmlns","viewBox"],c0=["x","y","width","height","href","xlink:href"];function d0(t){return a0[t]}function u0(t){const e=t.getAttribute("dominant-baseline"),i=t.getAttribute("alignment-baseline");return e||i}function Rr(t){return t.replace(/svg:/gi,"").toLowerCase()}function wd(t,e){if(e.x+=t.translateX,e.y+=t.translateY,e.x*=t.scaleX,e.y*=t.scaleY,t.rotation!==0){const i=e.length();e.x=i*Math.cos(t.rotation),e.y=i*Math.sin(t.rotation)}}function f0(t,e){e||(e={});const i=t.split(";");for(let r=0;r<i.length;r++){const o=i[r].split(":"),s=o[0],l=o[1];if(typeof s>"u"||typeof l>"u")continue;const a=s.replace(/\s/g,""),c=l.replace(/\s/g,"");e[a]=c}return e}function h0(t){const e={},i=m0(t),r=Math.max(i.length,t.style.length);for(let o=0;o<r;o++){const s=t.style[o],l=i[o];s&&(e[s]=t.style[s]),l&&(e[l]=t.getAttribute(l))}return e}function m0(t){const e=t.getAttributeNames();for(let i=0;i<_d.length;i++){const r=_d[i],o=Array.prototype.indexOf.call(e,r);o>=0&&e.splice(o,1)}return e}function p0(t,e){const i=e.split(/[\s,]/),r=-parseFloat(i[0]),o=-parseFloat(i[1]),s=parseFloat(i[2]),l=parseFloat(i[3]);if(r&&o)for(let f=0;f<t.children.length;f++){const h=t.children[f];"translation"in h?h.translation.add(r,o):"x"in h?h.x=r:"y"in h&&(h.y=o)}const a=typeof t.x=="number",c=typeof t.y=="number",d=typeof t.width=="number",u=typeof t.height=="number";return a&&(t.translation.x+=t.x),c&&(t.translation.y+=t.y),(d||u)&&(t.scale=new re(1,1)),d&&(t.scale.x=t.width/s),u&&(t.scale.y=t.height/l),t.mask=new si(0,0,s,l),t.mask.origin.set(-s/2,-l/2),t}function nn(t,e,i){const r={},o={},s={};let l,a,c,d,u,f,h,m,p,g,b,y,_,k,x,v,N;if(t===null)return r;if(Ke.getComputedStyle){const w=Ke.getComputedStyle(t);for(l=w.length;l--;)c=w[l],d=w[c],typeof d<"u"&&(r[c]=d)}for(l=0;l<t.attributes.length;l++)f=t.attributes[l],/style/i.test(f.nodeName)?f0(f.value,s):o[f.nodeName]=f.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),i&&oe.defaults(r,i),oe.extend(r,s,o),r.visible=!(typeof r.display>"u"&&/none/i.test(r.display))||typeof r.visibility>"u"&&/hidden/i.test(r.visibility);for(c in r)switch(d=r[c],c){case"gradientTransform":if(/none/i.test(d)||(a=t.gradientTransform&&t.gradientTransform.baseVal&&t.gradientTransform.baseVal.length>0?t.gradientTransform.baseVal[0].matrix:t.getCTM?t.getCTM():null,a===null))break;switch(h=wi(a),e._renderer.type){case"linear-gradient":wd(h,e.left),wd(h,e.right);break;case"radial-gradient":e.center.x+=h.translateX,e.center.y+=h.translateY,e.focal.x+=h.translateX,e.focal.y+=h.translateY,e.radius*=Math.max(h.scaleX,h.scaleY);break}break;case"transform":if(/none/i.test(d)||(a=t.transform&&t.transform.baseVal&&t.transform.baseVal.length>0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null,a===null))break;h=wi(a),e.translation.set(h.translateX,h.translateY),e.rotation=Math.PI*(h.rotation/180),e.scale=new re(h.scaleX,h.scaleY),m=parseFloat((r.x+"").replace("px")),p=parseFloat((r.y+"").replace("px")),m&&(e.translation.x=m),p&&(e.translation.y=p);break;case"visible":if(e instanceof pt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof pt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof pt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof pt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof pt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof pt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if(vn.cssBackgroundImage.test(d)&&(g=d.replace(vn.cssBackgroundImage,"$1"),Ue.defs.current&&Ue.defs.current.contains(g)&&(y=Ue.defs.current.get(g),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],_=Rr(y.nodeName),e.mask=Ue[_].call(this,y,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":u=(e instanceof pt?"_":"")+c,vn.cssBackgroundImage.test(d)?(g=d.replace(vn.cssBackgroundImage,"$1"),Ue.defs.current&&Ue.defs.current.contains(g)?(y=Ue.defs.current.get(g),y.object||(_=Rr(y.nodeName),y.object=Ue[_].call(this,y,{})),y=y.object):(b=y0(this),y=b.getById(g)),e[u]=y):e[u]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(k=e instanceof ut,x=e instanceof Ge,v=e instanceof Ze,k||x||v)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Lt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof Cn&&(e.family=d);break;case"font-size":e instanceof Cn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Lt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof Cn&&(e.weight=d);break;case"font-style":e instanceof Cn&&(e.style=d);break;case"text-decoration":e instanceof Cn&&(e.decoration=d);break;case"line-height":e instanceof Cn&&(e.leading=d);break}return Object.keys(t.dataset).length&&(e.dataset=t.dataset),r}function g0(t,e){for(let i=0,r=t.childNodes.length;i<r;i++){const o=t.childNodes[i];!o.id||Rr(t.nodeName)==="#text"||e.add(o.id,o)}}function y0(t){for(;t.parent;)t=t.parent;return t.scene}var Ue={svg:function(t){const e=Ue.defs.current=new fo,i=t.getElementsByTagName("defs");for(let p=0;p<i.length;p++)g0(i[p],e);const r=Ue.g.call(this,t),o=t.getAttribute("viewBox"),s=t.getAttribute("x"),l=t.getAttribute("y"),a=t.getAttribute("width"),c=t.getAttribute("height");r.defs=e;const d=o!==null,u=s!==null,f=l!==null,h=a!==null,m=c!==null;return u&&(r.x=parseFloat(s.replace(vn.unitSuffix,""))),f&&(r.y=parseFloat(l.replace(vn.unitSuffix,""))),h&&(r.width=parseFloat(a.replace(vn.unitSuffix,""))),m&&(r.height=parseFloat(c.replace(vn.unitSuffix,""))),d&&p0(r,o),delete Ue.defs.current,r},defs:function(t){return null},use:function(t,e){let i;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return i=new Lt("encountered <use /> with no href."),console.warn(i.name,i.message),null;const o=r.slice(1);if(!Ue.defs.current.contains(o))return i=new Lt("unable to find element for reference "+r+"."),console.warn(i.name,i.message),null;const l=Ue.defs.current.get(o).cloneNode(!0);for(let c=0;c<t.attributes.length;c++){const d=t.attributes[c],u=c0.includes(d.nodeName),f=!l.hasAttribute(d.nodeName);(u||f)&&l.setAttribute(d.nodeName,d.value)}const a=Rr(l.nodeName);return Ue[a].call(this,l,e)},g:function(t,e){const i=new pt;nn.call(this,t,i,e),this.add(i);const r=h0.call(this,t);for(let o=0,s=t.childNodes.length;o<s;o++){const l=t.childNodes[o],a=l.nodeName;if(!a)return;const c=Rr(a);if(c in Ue){const d=Ue[c].call(i,l,r);d&&!d.parent&&i.add(d)}}return i},polygon:function(t,e){let i;typeof t=="string"?i=t:i=t.getAttribute("points");const r=[];i.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(s,l,a){r.push(new $e(parseFloat(l),parseFloat(a)))});const o=new Re(r,!0);return o.stroke="none",o.fill="black",nn.call(this,t,o,e),o},polyline:function(t,e){const i=Ue.polygon.call(this,t,e);return i.closed=!1,i},path:function(t,e){let i;typeof t=="string"?(i=t,t=null):i=t.getAttribute("d");let r=[],o=!1,s=!1;if(i){let a=new $e,c,d,u=i.match(/[a-df-z][^a-df-z]*/gi);const f=u.length-1;oe.each(u.slice(0),function(h,m){const p=h.slice(1).trim().match(vn.path),g=h[0],b=g.toLowerCase();let y,_,k,x,v;const N=[];switch(m===0&&(u=[]),b){case"h":case"v":p.length>1&&(y=1);break;case"m":case"l":case"t":p.length>2&&(y=2);break;case"s":case"q":p.length>4&&(y=4);break;case"c":p.length>6&&(y=6);break;case"a":p.length>7&&(y=7);break}if(y){for(_=0,k=p.length,v=0;_<k;_+=y){if(x=g,v>0)switch(g){case"m":x="l";break;case"M":x="L";break}N.push(x+p.slice(_,_+y).join(" ")),v++}u=Array.prototype.concat.apply(u,N)}else u.push(h)}),oe.each(u,function(h,m){let p,g,b;const y=h[0],_=y.toLowerCase();d=h.slice(1).trim().match(vn.path),s=y===_;let k,x,v,N,w,T,C,$,E,V,P,I,K,J,Z,L,O;switch(_){case"z":if(m>=f)o=!0;else{g=a.x,b=a.y,p=new $e(g,b,void 0,void 0,void 0,void 0,ie.close);for(let z=r.length-1;z>=0;z--){const M=r[z];if(/m/i.test(M.command)){a=M;break}}}break;case"m":case"l":c=void 0,g=parseFloat(d[0]),b=parseFloat(d[1]),p=new $e(g,b,void 0,void 0,void 0,void 0,/m/i.test(_)?ie.move:ie.line),s&&p.addSelf(a),a=p;break;case"h":case"v":V=/h/i.test(_)?"x":"y",P=/x/i.test(V)?"y":"x",p=new $e(void 0,void 0,void 0,void 0,void 0,void 0,ie.line),p[V]=parseFloat(d[0]),p[P]=a[P],s&&(p[V]+=a[V]),a=p;break;case"c":case"s":k=a.x,x=a.y,c||(c=new re),/c/i.test(_)?(v=parseFloat(d[0]),N=parseFloat(d[1]),w=parseFloat(d[2]),T=parseFloat(d[3]),C=parseFloat(d[4]),$=parseFloat(d[5])):(E=Ms(a,c,s),v=E.x,N=E.y,w=parseFloat(d[0]),T=parseFloat(d[1]),C=parseFloat(d[2]),$=parseFloat(d[3])),s&&(v+=k,N+=x,w+=k,T+=x,C+=k,$+=x),a.controls.right.set(v-a.x,N-a.y),p=new $e(C,$,w-C,T-$,void 0,void 0,ie.curve),a=p,c=p.controls.left;break;case"t":case"q":k=a.x,x=a.y,c||(c=new re),/q/i.test(_)?(v=parseFloat(d[0]),N=parseFloat(d[1]),w=parseFloat(d[0]),T=parseFloat(d[1]),C=parseFloat(d[2]),$=parseFloat(d[3])):(E=Ms(a,c,s),v=E.x,N=E.y,w=E.x,T=E.y,C=parseFloat(d[0]),$=parseFloat(d[1])),s&&(v+=k,N+=x,w+=k,T+=x,C+=k,$+=x),a.controls.right.set((v-a.x)*.33,(N-a.y)*.33),p=new $e(C,$,w-C,T-$,void 0,void 0,ie.curve),a=p,c=p.controls.left;break;case"a":k=a.x,x=a.y,K=parseFloat(d[0]),J=parseFloat(d[1]),Z=parseFloat(d[2]),L=parseFloat(d[3]),O=parseFloat(d[4]),C=parseFloat(d[5]),$=parseFloat(d[6]),s&&(C+=k,$+=x),I=new $e(C,$),I.command=ie.arc,I.rx=K,I.ry=J,I.xAxisRotation=Z,I.largeArcFlag=L,I.sweepFlag=O,p=I,a=I,c=void 0;break}p&&(Array.isArray(p)?r=r.concat(p):r.push(p))})}i=new Re(r,o,void 0,!0),i.stroke="none",i.fill="black";const l=i.getBoundingClientRect(!0);return l.centroid={x:l.left+l.width/2,y:l.top+l.height/2},oe.each(i.vertices,function(a){a.subSelf(l.centroid)}),nn.call(this,t,i,e),i.translation.addSelf(l.centroid),i},circle:function(t,e){const i=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),o=parseFloat(t.getAttribute("r")),s=new xo(0,0,o);return s.stroke="none",s.fill="black",nn.call(this,t,s,e),s.translation.x=i,s.translation.y=r,s},ellipse:function(t,e){const i=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),o=parseFloat(t.getAttribute("rx")),s=parseFloat(t.getAttribute("ry")),l=new ko(0,0,o,s);return l.stroke="none",l.fill="black",nn.call(this,t,l,e),l.translation.x=i,l.translation.y=r,l},rect:function(t,e){const i=parseFloat(t.getAttribute("rx")),r=parseFloat(t.getAttribute("ry"));if(!oe.isNaN(i)||!oe.isNaN(r))return Ue["rounded-rect"](t);const o=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height")),l=o/2,a=s/2,c=new si(0,0,o,s);return c.stroke="none",c.fill="black",nn.call(this,t,c,e),c.translation.x+=l,c.translation.y+=a,c},"rounded-rect":function(t,e){const i=parseFloat(t.getAttribute("rx"))||0,r=parseFloat(t.getAttribute("ry"))||0,o=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height")),l=o/2,a=s/2,c=new re(i,r),d=new Co(0,0,o,s,c);return d.stroke="none",d.fill="black",nn.call(this,t,d,e),d.translation.x+=l,d.translation.y+=a,d},line:function(t,e){const i=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),o=parseFloat(t.getAttribute("x2")),s=parseFloat(t.getAttribute("y2")),l=new Bo(i,r,o,s).noFill();return nn.call(this,t,l,e),l},lineargradient:function(t,e){let i=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(t.getAttribute("x1")||0),s=parseFloat(t.getAttribute("y1")||0),l=parseFloat(t.getAttribute("x2")||0),a=parseFloat(t.getAttribute("y2")||0);const c=(l+o)/2,d=(a+s)/2;/userSpaceOnUse/i.test(i)&&(o-=c,s-=d,l-=c,a-=d);const u=[];for(let h=0;h<t.children.length;h++){const m=t.children[h];let p=m.getAttribute("offset");/%/gi.test(p)&&(p=parseFloat(p.replace(/%/gi,""))/100),p=parseFloat(p);let g=m.getAttribute("stop-color"),b=m.getAttribute("stop-opacity"),y=m.getAttribute("style"),_;g===null&&(_=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,g=_&&_.length>1?_[1]:void 0),b===null?(_=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=_&&_.length>1?parseFloat(_[1]):1):b=parseFloat(b),u.push(new oi(p,g,b))}const f=new Ge(o,s,l,a,u);return f.spread=r,f.units=i,nn.call(this,t,f,e),f},radialgradient:function(t,e){let i=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(t.getAttribute("cx"))||0,s=parseFloat(t.getAttribute("cy"))||0,l=parseFloat(t.getAttribute("r")),a=parseFloat(t.getAttribute("fx")),c=parseFloat(t.getAttribute("fy"));oe.isNaN(a)&&(a=o),oe.isNaN(c)&&(c=s);const d=Math.abs(o+a)/2,u=Math.abs(s+c)/2;/userSpaceOnUse/i.test(i)&&(o-=d,s-=u,a-=d,c-=u);const f=[];for(let m=0;m<t.children.length;m++){const p=t.children[m];let g=p.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let b=p.getAttribute("stop-color"),y=p.getAttribute("stop-opacity"),_=p.getAttribute("style"),k;b===null&&(k=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,b=k&&k.length>1?k[1]:void 0),y===null?(k=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=k&&k.length>1?parseFloat(k[1]):1):y=parseFloat(y),f.push(new oi(g,b,y))}const h=new Ze(o,s,l,f,a,c);return h.spread=r,h.units=i,nn.call(this,t,h,e),h},text:function(t,e){const i=d0(t.getAttribute("text-anchor"))||"left",r=u0(t)||"baseline";let o="";t.childNodes.length>0&&t.childNodes[0].tagName==="TSPAN"?o=t.childNodes[0].textContent:o=t.textContent;const s=new Cn(o);return nn.call(this,t,s,e),s.alignment=i,s.baseline=r,s},clippath:function(t,e){return Ue.defs.current&&!Ue.defs.current.contains(t.id)&&Ue.defs.current.add(t.id,t),null},image:function(t,e){let i;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return i=new Lt("encountered <image /> with no href."),console.warn(i.name,i.message),null;const o=parseFloat(t.getAttribute("x"))||0,s=parseFloat(t.getAttribute("y"))||0,l=parseFloat(t.getAttribute("width")),a=parseFloat(t.getAttribute("height")),c=new wo(r,o,s);return oe.isNaN(l)||(c.width=l),oe.isNaN(a)||(c.height=a),nn.call(this,t,c,e),c}};function xd(t,e){const i=new XMLHttpRequest;return i.open("GET",t),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&e(i.responseText)},i.send(),i}var ol=class An extends si{constructor(e,i,r,o,s,l){super(i,r,o||1,s||1),S(this,"_flagTexture",!1),S(this,"_flagMode",!1),S(this,"_texture",null),S(this,"_mode","fill"),this._renderer.type="image";for(let a in Cd)Object.defineProperty(this,a,Cd[a]);this.noStroke(),this.noFill(),e instanceof De?this.texture=e:typeof e=="string"&&(this.texture=new De(e)),typeof l=="string"&&(this.mode=l),this._update()}static fromObject(e){const i=new An().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<An.Properties.length;i++){const r=An.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new An(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const i=e.image.width,r=e.image.height,o=this.width,s=this.height,l=o/i,a=s/r;switch(this._mode){case An.Modes.fill:{const c=Math.max(l,a);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case An.Modes.fit:{const c=Math.min(l,a);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case An.Modes.crop:break;case An.Modes.tile:{e.offset.x=(i-o)/2,e.offset.y=(r-s)/2,e.repeat="repeat";break}case An.Modes.stretch:default:e.scale=new re(l,a),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};S(ol,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),S(ol,"Properties",["texture","mode"]);var kd=ol,Cd={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(t){this._mode=t,this._flagMode=!0}}},sl=[],ll=Math.max,b0=Math.min,vd=Math.abs,No=Math.sin,To=Math.cos,_0=Math.acos,$o=Math.sqrt,Fe={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(t){return t in Fe?t:"path"},group:{renderChild:function(t){const e=Fe.getRendererType(t._renderer.type);Fe[e].render.call(t,this.ctx,!0,this.clip)},render:function(t){if(!this._visible)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);const r=this._mask,o=Eo(e),s=!o||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,s&&(t.save(),o||t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const l=Fe.getRendererType(r._renderer.type);Fe[l].render.call(r,t,!0)}if(this._opacity>0&&this._scale!==0)for(let l=0;l<this.children.length;l++){const a=this.children[l],c=Fe.getRendererType(a._renderer.type);Fe[c].render.call(a,t)}return s&&t.restore(),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t,e,i){let r,o,s,l,a,c,d,u,f,h,m,p,g,b,y,_,k,x,v,N,w,T,C,$,E,V,P,I,K,J,Z,L,O,z;if(z=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,K=this._mask,J=this._clip,a=this._opacity*(z||1),c=this._visible,!e&&(!c||J||a===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,l=this._fill,d=this._cap,u=this._join,f=this._miter,h=this._closed,m=this._renderer.vertices,p=m.length,g=p-1,Z=Eo(r),O=this.dashes,Z||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),K){const q=Fe.getRendererType(K._renderer.type);Fe[q].render.call(K,t,!0)}if(l)if(typeof l=="string")t.fillStyle=l;else{const q=Fe.getRendererType(l._renderer.type);Fe[q].render.call(l,t,this),t.fillStyle=l._renderer.effect}if(o){if(typeof o=="string")t.strokeStyle=o;else{const q=Fe.getRendererType(o._renderer.type);Fe[q].render.call(o,t,this),t.strokeStyle=o._renderer.effect}s&&(t.lineWidth=kn(this)),f&&(t.miterLimit=f),u&&(t.lineJoin=u),!h&&d&&(t.lineCap=d)}typeof a=="number"&&(t.globalAlpha=a),O&&O.length>0&&(t.lineDashOffset=O.offset||0,t.setLineDash(O)),t.beginPath();let M,R,W,U,G,X,j;for(let q=0;q<p;q++)switch(_=m[q],P=_.x,I=_.y,_.command){case ie.close:t.closePath();break;case ie.arc:M=_.rx,R=_.ry,W=_.xAxisRotation,U=_.largeArcFlag,G=_.sweepFlag,b=h?ot(q-1,p):ll(q-1,0),y=m[b],X=y.x,j=y.y,Fe.renderSvgArcCommand(t,X,j,M,R,U,G,W,P,I);break;case ie.curve:b=h?ot(q-1,p):Math.max(q-1,0),y=m[b],C=y.controls&&y.controls.right||re.zero,$=_.controls&&_.controls.left||re.zero,y._relative?(w=C.x+y.x,T=C.y+y.y):(w=C.x,T=C.y),_._relative?(v=$.x+_.x,N=$.y+_.y):(v=$.x,N=$.y),t.bezierCurveTo(w,T,v,N,P,I),q>=g&&h&&(k=x,E=_.controls&&_.controls.right||re.zero,V=k.controls&&k.controls.left||re.zero,_._relative?(w=E.x+_.x,T=E.y+_.y):(w=E.x,T=E.y),k._relative?(v=V.x+k.x,N=V.y+k.y):(v=V.x,N=V.y),P=k.x,I=k.y,t.bezierCurveTo(w,T,v,N,P,I));break;case ie.line:t.lineTo(P,I);break;case ie.move:x=_,t.moveTo(P,I);break}return h&&t.closePath(),!J&&!i&&(Fe.isHidden.test(l)||(L=l._renderer&&l._renderer.offset,L&&(t.save(),t.translate(-l._renderer.offset.x,-l._renderer.offset.y),t.scale(l._renderer.scale.x,l._renderer.scale.y)),t.fill(),L&&t.restore()),Fe.isHidden.test(o)||(L=o._renderer&&o._renderer.offset,L&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y),t.lineWidth=s/o._renderer.scale.x),t.stroke(),L&&t.restore())),Z||t.restore(),J&&!i&&t.clip(),O&&O.length>0&&t.setLineDash(sl),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t,e,i){let r,o,s,l,a,c,d,u,f,h,m,p,g,b,y,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,a=this._opacity*(_||1),c=this._visible,!e&&(!c||a===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,l=this._fill,u=this._renderer.collection,f=u.length,g=Eo(r),y=this.dashes,d=this._size,g||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),l)if(typeof l=="string")t.fillStyle=l;else{const v=Fe.getRendererType(l._renderer.type);Fe[v].render.call(l,t,this),t.fillStyle=l._renderer.effect}if(o){if(typeof o=="string")t.strokeStyle=o;else{const v=Fe.getRendererType(o._renderer.type);Fe[v].render.call(o,t,this),t.strokeStyle=o._renderer.effect}s&&(t.lineWidth=kn(this))}typeof a=="number"&&(t.globalAlpha=a),y&&y.length>0&&(t.lineDashOffset=y.offset||0,t.setLineDash(y)),t.beginPath();let k=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=wi(x[0],x[3],x[1],x[4],x[2],x[5]),k/=Math.max(x.scaleX,x.scaleY));for(let v=0;v<f;v++)h=u[v],m=h.x,p=h.y,t.moveTo(m+k,p),t.arc(m,p,k,0,tt);return i||(Fe.isHidden.test(l)||(b=l._renderer&&l._renderer.offset,b&&(t.save(),t.translate(-l._renderer.offset.x,-l._renderer.offset.y),t.scale(l._renderer.scale.x,l._renderer.scale.y)),t.fill(),b&&t.restore()),Fe.isHidden.test(o)||(b=o._renderer&&o._renderer.offset,b&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y),t.lineWidth=s/o._renderer.scale.x),t.stroke(),b&&t.restore())),g||t.restore(),y&&y.length>0&&t.setLineDash(sl),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t,e,i){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*r,s=this._visible,l=this._mask,a=this._clip;if(!e&&(!s||a||o===0))return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,u=this._linewidth,f=this._fill,h=this._decoration,m=this._direction,p=Eo(c),g=f._renderer&&f._renderer.offset&&d._renderer&&d._renderer.offset,b=this.dashes,y=Fe.alignments[this._alignment]||this._alignment,_=Fe.baselines[this._baseline]||this._baseline;let k,x,v,N,w,T,C,$,E,V,P;if(p||(t.save(),t.transform(c[0],c[3],c[1],c[4],c[2],c[5])),l){const I=Fe.getRendererType(l._renderer.type);Fe[I].render.call(l,t,!0)}if(g||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=y,t.textBaseline=_,t.direction=m,f)if(typeof f=="string")t.fillStyle=f;else{const I=Fe.getRendererType(f._renderer.type);Fe[I].render.call(f,t,this),t.fillStyle=f._renderer.effect}if(d){if(typeof d=="string")t.strokeStyle=d;else{const I=Fe.getRendererType(d._renderer.type);Fe[I].render.call(d,t,this),t.strokeStyle=d._renderer.effect}u&&(t.lineWidth=kn(this))}if(typeof o=="number"&&(t.globalAlpha=o),b&&b.length>0&&(t.lineDashOffset=b.offset||0,t.setLineDash(b)),!a&&!i&&(Fe.isHidden.test(f)||(f._renderer&&f._renderer.offset?(T=f._renderer.scale.x,C=f._renderer.scale.y,t.save(),t.translate(-f._renderer.offset.x,-f._renderer.offset.y),t.scale(T,C),k=this._size/f._renderer.scale.y,x=this._leading/f._renderer.scale.y,t.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),v=f._renderer.offset.x/f._renderer.scale.x,N=f._renderer.offset.y/f._renderer.scale.y,t.fillText(this.value,v,N),t.restore()):t.fillText(this.value,0,0)),Fe.isHidden.test(d)||(d._renderer&&d._renderer.offset?(T=d._renderer.scale.x,C=d._renderer.scale.y,t.save(),t.translate(-d._renderer.offset.x,-d._renderer.offset.y),t.scale(T,C),k=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,t.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),v=d._renderer.offset.x/d._renderer.scale.x,N=d._renderer.offset.y/d._renderer.scale.y,w=u/d._renderer.scale.x,t.lineWidth=w,t.strokeText(this.value,v,N),t.restore()):t.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(h)){const I=t.measureText(this.value);let K=1;switch(h){case"underline":E=I.actualBoundingBoxDescent,P=I.actualBoundingBoxDescent;break;case"strikethrough":E=0,P=0,K=.5;break}switch(_){case"top":E+=this._size*K,P+=this._size*K;break;case"baseline":case"bottom":E-=this._size*K,P-=this._size*K;break}switch(y){case"left":case"start":$=0,V=I.width;break;case"right":case"end":$=-I.width,V=0;break;default:$=-I.width/2,V=I.width/2}t.lineWidth=Math.max(Math.floor(this._size/15),1),t.strokeStyle=t.fillStyle,t.beginPath(),t.moveTo($,E),t.lineTo(V,P),t.stroke()}return p||t.restore(),a&&!i&&t.clip(),b&&b.length>0&&t.setLineDash(sl),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,l=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,l=(l-.5)*i.height),this._renderer.effect=t.createLinearGradient(r,o,s,l);for(let a=0;a<this.stops.length;a++){const c=this.stops[a];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,l=this.focal._y,a=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,l=(l-.5)*i.height*.5,a*=Math.min(i.width,i.height)),this._renderer.effect=t.createRadialGradient(r,o,0,s,l,a);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=t.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(t,e,i,r,o,s,l,a,c,d){a=a*Math.PI/180,r=vd(r),o=vd(o);const u=(e-c)/2,f=(i-d)/2,h=To(a)*u+No(a)*f,m=-No(a)*u+To(a)*f,p=h*h,g=m*m;let b=r*r,y=o*o;const _=p/b+g/y;if(_>1){const I=$o(_);r=I*r,o=I*o,b=r*r,y=o*o}const k=b*g+y*p,x=(b*y-k)/k;let v=$o(ll(0,x));s===l&&(v=-v);const N=v*r*m/o,w=-v*o*h/r,T=To(a)*N-No(a)*w+(e+c)/2,C=No(a)*N+To(a)*w+(i+d)/2,$=Sd(1,0,(h-N)/r,(m-w)/o),E=Sd((h-N)/r,(m-w)/o,(-h-N)/r,(-m-w)/o)%tt,V=$+E;w0(t,T,C,r,o,$,V,l===0,a)}},vt=class extends ee{constructor(t){super();const e=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new pt,this.scene.parent=this}setSize(t,e,i){return this.width=t,this.height=e,this.ratio=typeof i>"u"?Is(this.ctx):i,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&oe.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this.trigger(ee.Types.resize,t,e,i)}render(){const t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Fe.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};S(vt,"Utils",Fe);function w0(t,e,i,r,o,s,l,a,c){const d=l-s,u=Zi.Tolerance.epsilon,f=Math.abs(d)<u;let h=ot(d,tt);h<u&&(f?h=0:h=tt),a===!0&&!f&&(h===tt?h=-tt:h=h-tt);for(let m=0;m<kt.Resolution;m++){const p=m/(kt.Resolution-1),g=s+p*h;let b=e+r*Math.cos(g),y=i+o*Math.sin(g);if(c!==0){const _=Math.cos(c),k=Math.sin(c),x=b-e,v=y-i;b=x*_-v*k+e,y=x*k+v*_+i}t.lineTo(b,y)}}function Sd(t,e,i,r){const o=t*i+e*r,s=$o(t*t+e*e)*$o(i*i+r*r);let l=_0(ll(-1,b0(1,o/s)));return t*r-e*i<0&&(l=-l),l}function Eo(t){return t[0]===1&&t[3]===0&&t[1]===0&&t[4]===1&&t[2]===0&&t[5]===0}var ue={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(t,e){const i=t,r=document.createElementNS(ue.ns,i);return i==="svg"&&(e=oe.defaults(e||{},{version:ue.version})),e&&Object.keys(e).length>0&&ue.setAttributes(r,e),r},setAttributes:function(t,e){const i=Object.keys(e);for(let r=0;r<i.length;r++)/href/.test(i[r])?t.setAttributeNS(ue.xlink,i[r],e[i[r]]):t.setAttribute(i[r],e[i[r]]);return this},removeAttributes:function(t,e){for(let i in e)t.removeAttribute(i);return this},toString:function(t,e){let i=t.length,r=i-1,o,s="";for(let l=0;l<i;l++){const a=t[l],c=e?ot(l-1,i):Math.max(l-1,0),d=t[c];let u,f,h,m,p,g,b,y,_,k,x,v,N,w,T,C=ze(a.x),$=ze(a.y);switch(a.command){case ie.close:u=ie.close;break;case ie.arc:x=a.rx,v=a.ry,N=a.xAxisRotation,w=a.largeArcFlag,T=a.sweepFlag,u=ie.arc+" "+x+" "+v+" "+N+" "+w+" "+T+" "+C+" "+$;break;case ie.curve:b=d.controls&&d.controls.right||re.zero,y=a.controls&&a.controls.left||re.zero,d.relative?(h=ze(b.x+d.x),m=ze(b.y+d.y)):(h=ze(b.x),m=ze(b.y)),a.relative?(p=ze(y.x+a.x),g=ze(y.y+a.y)):(p=ze(y.x),g=ze(y.y)),u=(l===0?ie.move:ie.curve)+" "+h+" "+m+" "+p+" "+g+" "+C+" "+$;break;case ie.move:o=a,u=ie.move+" "+C+" "+$;break;default:u=a.command+" "+C+" "+$}l>=r&&e&&(a.command===ie.curve&&(f=o,_=a.controls&&a.controls.right||a,k=f.controls&&f.controls.left||f,a.relative?(h=ze(_.x+a.x),m=ze(_.y+a.y)):(h=ze(_.x),m=ze(_.y)),f.relative?(p=ze(k.x+f.x),g=ze(k.y+f.y)):(p=ze(k.x),g=ze(k.y)),C=ze(f.x),$=ze(f.y),u+=" C "+h+" "+m+" "+p+" "+g+" "+C+" "+$),a.command!==ie.close&&(u+=" Z")),s+=u+" "}return s},pointsToString:function(t,e){let i="";const r=e*.5;for(let o=0;o<t.length;o++){const s=t[o].x,l=t[o].y-r;i+=ie.move+" "+s+" "+l+" ",i+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return i},getClip:function(t,e){let i=t._renderer.clip;return i||(i=t._renderer.clip=ue.createElement("clipPath",{"clip-rule":"nonzero"})),i.parentNode===null&&e.defs.appendChild(i),i},getRendererType:function(t){return t in ue?t:"path"},defs:{update:function(t){const{defs:e}=t;if(e._flagUpdate){const i=Array.prototype.slice.call(e.children,0);for(let r=0;r<i.length;r++){const o=i[r],s=o.id,l=`[fill="url(#${s})"],[stroke="url(#${s})"],[clip-path="url(#${s})"]`;t.querySelector(l)||e.removeChild(o)}e._flagUpdate=!1}}},group:{appendChild:function(t){const e=t._renderer.elem;if(!e)return;const i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||t._clip||this.elem.appendChild(e)},removeChild:function(t){const e=t._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||t._clip||this.elem.removeChild(e)},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){const e=ue.getRendererType(t._renderer.type);ue[e].render.call(t,this)},render:function(t){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=ue.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,i={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const o=this.children[r],s=ue.getRendererType(o._renderer.type);ue[s].render.call(o,t)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(ue.group.appendChild,i),this._flagSubtractions&&this.subtractions.forEach(ue.group.removeChild,i),this._flagOrder&&this.children.forEach(ue.group.orderChild,i),this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=ue.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=kn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=ue.getClip(this,t),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const s=this.worldMatrix.elements,l=wi(s[0],s[3],s[1],s[4],s[2],s[5]);r/=Math.max(l.scaleX,l.scaleY)}const o=ue.pointsToString(this._renderer.collection,r);e.d=o}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,t,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=kn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("path",e),t.appendChild(this._renderer.elem)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=ue.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=ue.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=kn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("text",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=ue.getClip(this,t),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?ue.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=ue.createElement("linearGradient",i)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],l={};s._flagOffset&&(l.offset=100*s._offset+"%"),s._flagColor&&(l["stop-color"]=s._color),s._flagOpacity&&(l["stop-opacity"]=s._opacity),s._renderer.elem?ue.setAttributes(s._renderer.elem,l):s._renderer.elem=ue.createElement("stop",l),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagCenter&&(i.cx=this.center._x,i.cy=this.center._y),this._flagFocal&&(i.fx=this.focal._x,i.fy=this.focal._y),this._flagRadius&&(i.r=this._radius),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?ue.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=ue.createElement("radialGradient",i)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],l={};s._flagOffset&&(l.offset=100*s._offset+"%"),s._flagColor&&(l["stop-color"]=s._color),s._flagOpacity&&(l["stop-opacity"]=s._opacity),s._renderer.elem?ue.setAttributes(s._renderer.elem,l):s._renderer.elem=ue.createElement("stop",l),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={},r={x:0,y:0},o=this.image;if(this._flagId&&(i.id=this._id),this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,o&&(i.x-=o.width/2,i.y-=o.height/2,this._scale instanceof re?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale)),i.x>0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,o)){switch(i.width=o.width,i.height=o.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof re?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=i.width,r.height=i.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?ue.setAttributes(this._renderer.image,r):this._renderer.image=ue.createElement("image",r)),this._renderer.elem?Object.keys(i).length!==0&&ue.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=ue.createElement("pattern",i)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},Bd=class extends ee{constructor(t){super(),this.domElement=t.domElement||ue.createElement("svg"),this.scene=new pt,this.scene.parent=this,this.defs=ue.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,e){return this.width=t,this.height=e,ue.setAttributes(this.domElement,{width:t,height:e}),this.trigger(ee.Types.resize,t,e)}render(){return ue.group.render.call(this.scene,this.domElement),ue.defs.update(this.domElement),this}};S(Bd,"Utils",ue);var rn={create:function(t,e,i){const r=t.createShader(t[i]);if(t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const s=t.getShaderInfoLog(r);throw t.deleteShader(r),new Lt("unable to compile shader "+r+": "+s)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
40
+ ***************************************************************************** */var co=function(){return co=Object.assign||function(e){for(var i,r=1,o=arguments.length;r<o;r++){i=arguments[r];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},co.apply(this,arguments)},jp={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},On={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Ns=500,qp=(function(){function t(e,i){return this.core=e,this.$LG=i,this.settings=co(co({},jp),this.core.settings),this}return t.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},t.prototype.enableZoom=function(e){var i=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){i.isImageSlide(i.core.index)&&(i.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===i.core.index&&i.setZoomEssentials())},r+30)},t.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(On.slideItemLoad+".zoom",this.enableZoom.bind(this))},t.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},t.prototype.getSwipeCords=function(e){var i=e.touches[0].pageX,r=e.touches[0].pageY;return{x:i,y:r}},t.prototype.getDragAllowedAxises=function(e,i){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),o=0,s=0,l=r.getBoundingClientRect();e?(o=r.offsetHeight*e,s=r.offsetWidth*e):i?(o=l.height+i*l.height,s=l.width+i*l.width):(o=l.height,s=l.width);var a=o>this.containerRect.height,c=s>this.containerRect.width;return{allowX:c,allowY:a}},t.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},t.prototype.zoomImage=function(e,i,r,o){if(!(!this.containerRect||Math.abs(i)<=0)){var s=this.containerRect.width/2+this.containerRect.left,l=this.containerRect.height/2+this.containerRect.top+this.scrollTop,a,c;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,i),u=d.allowY,f=d.allowX;this.positionChanged&&(a=this.left/(this.scale-i),c=this.top/(this.scale-i),this.pageX=s-a,this.pageY=l-c,this.positionChanged=!1);var h=this.getPossibleSwipeDragCords(i),m,p,g=s-this.pageX,b=l-this.pageY;if(e-i>1){var y=(e-i)/Math.abs(i);g=(i<0?-g:g)+this.left*(y+(i<0?-1:1)),b=(i<0?-b:b)+this.top*(y+(i<0?-1:1)),m=g/y,p=b/y}else{var y=(e-i)*i;m=g*y,p=b*y}r&&(f?this.isBeyondPossibleLeft(m,h.minX)?m=h.minX:this.isBeyondPossibleRight(m,h.maxX)&&(m=h.maxX):e>1&&(m<h.minX?m=h.minX:m>h.maxX&&(m=h.maxX)),u?this.isBeyondPossibleTop(p,h.minY)?p=h.minY:this.isBeyondPossibleBottom(p,h.maxY)&&(p=h.maxY):e>1&&(p<h.minY?p=h.minY:p>h.maxY&&(p=h.maxY))),this.setZoomStyles({x:m,y:p,scale:e}),this.left=m,this.top=p,o&&this.setZoomImageSize()}},t.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var i=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,i.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),i.css("width","auto").css("height","auto"),setTimeout(function(){i.removeClass("no-transition")},10)}},t.prototype.setZoomImageSize=function(){var e=this,i=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(i.addClass("no-transition"),e.imageReset=!0)},Ns),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var o=e.getDragAllowedAxises(e.scale);i.css("width",i.get().naturalWidth+"px").css("height",i.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),o.allowX&&o.allowY?i.addClass("reset-transition"):o.allowX&&!o.allowY?i.addClass("reset-transition-x"):!o.allowX&&o.allowY&&i.addClass("reset-transition-y")}},Ns+50)},t.prototype.setZoomStyles=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var s="translate3d("+e.x+"px, "+e.y+"px, 0)";i.css("transform",s)},t.prototype.setActualSize=function(e,i){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var o=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!o.src||r.core.outer.hasClass("lg-first-slide-loading"))){var s=r.getCurrentImageActualSizeScale(),l=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(s),r.setPageCords(i),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-l,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},Ns+110)}},t.prototype.getNaturalWidth=function(e){var i=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):i.get().naturalWidth},t.prototype.getActualSizeScale=function(e,i){var r,o;return e>=i?(r=e/i,o=r||2):o=1,o},t.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),i=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||i;return this.getActualSizeScale(r,i)},t.prototype.getPageCords=function(e){var i={};if(e)i.x=e.pageX||e.touches[0].pageX,i.y=e.pageY||e.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();i.x=r.width/2+r.left,i.y=r.height/2+this.scrollTop+r.top}return i},t.prototype.setPageCords=function(e){var i=this.getPageCords(e);this.pageX=i.x,this.pageY=i.y},t.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},t.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},t.prototype.getScale=function(e){var i=this.getCurrentImageActualSizeScale();return e<1?e=1:e>i&&(e=i),e},t.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var i=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var o=e.$LG(r.target);r.touches.length===1&&o.hasClass("lg-image")&&(i?(clearTimeout(i),i=null,r.preventDefault(),e.setActualSize(e.core.index,r)):i=setTimeout(function(){i=null},300))}),this.core.LGel.on(On.containerResize+".zoom "+On.rotateRight+".zoom "+On.rotateLeft+".zoom "+On.flipHorizontal+".zoom "+On.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var o=e.scale-e.settings.scale;o<1&&(o=1),e.beginZoom(o),e.zoomImage(o,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(On.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(On.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(On.afterSlide+".zoom",function(r){var o=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(o),e.resetImageTranslate(o),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},t.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},t.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var i=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e:this.core.index);i.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),r.find(".lg-img-wrap").first().removeAttr("style"),r.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},t.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},t.prototype.pinchZoom=function(){var e=this,i=0,r=!1,o=1,s=0,l=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(a){if(l=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&a.touches.length===2){if(a.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;o=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(a),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",i=e.getTouchDistance(a)}}),this.core.$inner.on("touchmove.lg",function(a){if(a.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(a.target).hasClass("lg-item")||l.get().contains(a.target))){a.preventDefault();var c=e.getTouchDistance(a),d=i-c;if(!r&&Math.abs(d)>5&&(r=!0),r){s=e.scale;var u=Math.max(1,o+-d*.02);e.scale=Math.round((u+Number.EPSILON)*100)/100;var f=e.scale-s;e.zoomImage(e.scale,Math.round((f+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(a){if(e.core.touchAction==="pinch"&&(e.$LG(a.target).hasClass("lg-item")||l.get().contains(a.target))){if(r=!1,i=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},t.prototype.touchendZoom=function(e,i,r,o,s){var l=i.x-e.x,a=i.y-e.y,c=Math.abs(l)/s+1,d=Math.abs(a)/s+1;c>2&&(c+=1),d>2&&(d+=1),l=l*c,a=a*d;var u=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),f={};f.x=this.left+l,f.y=this.top+a;var h=this.getPossibleSwipeDragCords();(Math.abs(l)>15||Math.abs(a)>15)&&(o&&(this.isBeyondPossibleTop(f.y,h.minY)?f.y=h.minY:this.isBeyondPossibleBottom(f.y,h.maxY)&&(f.y=h.maxY)),r&&(this.isBeyondPossibleLeft(f.x,h.minX)?f.x=h.minX:this.isBeyondPossibleRight(f.x,h.maxX)&&(f.x=h.maxX)),o?this.top=f.y:f.y=this.top,r?this.left=f.x:f.x=this.left,this.setZoomSwipeStyles(u,f),this.positionChanged=!0)},t.prototype.getZoomSwipeCords=function(e,i,r,o,s){var l={};if(o){if(l.y=this.top+(i.y-e.y),this.isBeyondPossibleTop(l.y,s.minY)){var a=s.minY-l.y;l.y=s.minY-a/6}else if(this.isBeyondPossibleBottom(l.y,s.maxY)){var c=l.y-s.maxY;l.y=s.maxY+c/6}}else l.y=this.top;if(r){if(l.x=this.left+(i.x-e.x),this.isBeyondPossibleLeft(l.x,s.minX)){var d=s.minX-l.x;l.x=s.minX-d/6}else if(this.isBeyondPossibleRight(l.x,s.maxX)){var u=l.x-s.maxX;l.x=s.maxX+u/6}}else l.x=this.left;return l},t.prototype.isBeyondPossibleLeft=function(e,i){return e>=i},t.prototype.isBeyondPossibleRight=function(e,i){return e<=i},t.prototype.isBeyondPossibleTop=function(e,i){return e>=i},t.prototype.isBeyondPossibleBottom=function(e,i){return e<=i},t.prototype.isImageSlide=function(e){var i=this.core.galleryItems[e];return this.core.getSlideType(i)==="image"},t.prototype.getPossibleSwipeDragCords=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,o=i.get().getBoundingClientRect(),s=o.height,l=o.width;e&&(s=s+e*s,l=l+e*l);var a=(s-this.containerRect.height)/2,c=(this.containerRect.height-s)/2+r,d=(l-this.containerRect.width)/2,u=(this.containerRect.width-l)/2,f={minY:a,maxY:c,minX:d,maxX:u};return f},t.prototype.setZoomSwipeStyles=function(e,i){e.css("transform","translate3d("+i.x+"px, "+i.y+"px, 0)")},t.prototype.zoomSwipe=function(){var e=this,i={},r={},o=!1,s=!1,l=!1,a=new Date,c=new Date,d,u,f=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(h){if(e.isImageSlide(e.core.index)&&(f=e.core.getSlideItem(e.core.index),(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))&&h.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){h.preventDefault(),a=new Date,e.core.touchAction="zoomSwipe",u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var m=e.getDragAllowedAxises(0);l=m.allowY,s=m.allowX,(s||l)&&(i=e.getSwipeCords(h)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(h){if(h.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){h.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(h);var m=e.getZoomSwipeCords(i,r,s,l,d);(Math.abs(r.x-i.x)>15||Math.abs(r.y-i.y)>15)&&(o=!0,e.setZoomSwipeStyles(u,m))}}),this.core.$inner.on("touchend.lg",function(h){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){if(h.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!o)return;o=!1,c=new Date;var m=c.valueOf()-a.valueOf();e.touchendZoom(i,r,s,l,m)}})},t.prototype.zoomDrag=function(){var e=this,i={},r={},o=!1,s=!1,l=!1,a=!1,c,d,u,f;this.core.outer.on("mousedown.lg.zoom",function(h){if(e.isImageSlide(e.core.index)){var m=e.core.getSlideItem(e.core.index);if(e.$LG(h.target).hasClass("lg-item")||m.get().contains(h.target)){c=new Date,f=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var p=e.getDragAllowedAxises(0);a=p.allowY,l=p.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(h.target).hasClass("lg-object")&&(l||a)&&(h.preventDefault(),i=e.getDragCords(h),u=e.getPossibleSwipeDragCords(),o=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(h){if(o){s=!0,r=e.getDragCords(h);var m=e.getZoomSwipeCords(i,r,l,a,u);e.setZoomSwipeStyles(f,m)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(h){if(o){if(d=new Date,o=!1,e.core.outer.removeClass("lg-zoom-dragging"),s&&(i.x!==r.x||i.y!==r.y)){r=e.getDragCords(h);var m=d.valueOf()-c.valueOf();e.touchendZoom(i,r,l,a,m)}s=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},t.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},t.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},t})();const Xp={ref:"gallery-container",class:"lightgallery-wrapper"},Yp={},Za=n.defineComponent({...Yp,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(t){const e=t,i={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=n.useTemplateRef("gallery-container"),o=n.ref(null);return n.onMounted(async()=>{if(!r.value)return;const s=await import("lightgallery");o.value=s.default(r.value,{...e.settings}),A.forOwn(i,(l,a)=>{var c;l&&((c=r.value)==null||c.addEventListener(a,l))})}),n.onBeforeUnmount(()=>{var s;o.value&&((s=o.value)==null||s.destroy(),o.value=null)}),(s,l)=>(n.openBlock(),n.createElementBlock("div",Xp,[n.renderSlot(s.$slots,"default")],512))}}),yt=class yt{static init(){yt.isInitialized||(yt.isInitialized=!0,yt.windowResizeHandler(),window.addEventListener("resize",yt.windowResizeHandler))}static destroy(){window.removeEventListener("resize",yt.windowResizeHandler),yt.isInitialized=!1}static getDeviceTypeByResolution(){const e=H.useBaseConfigStateStore().config.deviceTypeByResolution;return window.innerWidth<e.tablet?Xe.phone:window.innerWidth<e.laptop?Xe.tablet:Xe.laptop}static initRefDependingOnDeviceResolution(e,i,r){const o=n.ref(r);return yt.setRefValueDependingOnDeviceResolution(o,e,i,r),yt.refsDependingOnDeviceResolution.push({r:o,phoneValue:e,tabletValue:i,defaultValue:r}),o}static isPhoneDevice(){return yt.getDeviceTypeByResolution()===Xe.phone}static isTabletDevice(){return yt.getDeviceTypeByResolution()===Xe.tablet}static isLaptopDevice(){return yt.getDeviceTypeByResolution()===Xe.laptop}static setRefValueDependingOnDeviceResolution(e,i,r,o){switch(yt.getDeviceTypeByResolution()){case Xe.phone:e.value=i;break;case Xe.tablet:e.value=r;break;default:e.value=o;break}}static windowResizeHandler(){A.forEach(yt.refsDependingOnDeviceResolution,e=>{yt.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};B(yt,"isInitialized",!1),B(yt,"refsDependingOnDeviceResolution",[]);let Ye=yt;const Up=["href"],Kp=["src","alt"],Gp={},Qa=n.defineComponent({...Gp,__name:"image-gallery",props:{images:{}},setup(t,{expose:e}){const i=n.ref(!1),r=n.ref(!1),o=n.ref({plugins:[Wp,qp],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),s=()=>window.innerWidth*(Ye.getDeviceTypeByResolution()===Xe.phone?.7:.8),l=n.ref(s()),a=()=>{l.value=s()},c=()=>{i.value=!0};return n.onUnmounted(()=>{window.removeEventListener("resize",a)}),e({show:c}),window.addEventListener("resize",a),(d,u)=>{const f=Ga,h=F.NPopover;return n.openBlock(),n.createBlock(h,{trigger:"manual",show:i.value,class:"sc-image",placement:"top-start",onClickoutside:u[3]||(u[3]=()=>{r.value||(i.value=!1)})},{trigger:n.withCtx(()=>[n.createElementVNode("div",{class:"inline-flex",onClick:u[0]||(u[0]=m=>i.value=!i.value)},[n.renderSlot(d.$slots,"default",{},()=>[n.createVNode(f)])])]),default:n.withCtx(()=>[n.createVNode(Za,{settings:o.value,style:n.normalizeStyle(`max-width: ${l.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:u[1]||(u[1]=()=>{r.value=!0}),onAfterClose:u[2]||(u[2]=()=>{r.value=!1,i.value=!1})},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.images,(m,p)=>(n.openBlock(),n.createElementBlock("a",{key:p,href:m.image},[n.createElementVNode("img",{src:m.preview,alt:`Изображение #${p+1}`},null,8,Kp)],8,Up))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),Zp={class:"text-sm grid grid-cols-[auto_auto] gap-x-3 gap-y-1 items-baseline"},Qp={class:"pr-3"},Jp={class:"text-right"},eg={},tg=n.defineComponent({...eg,__name:"product-stock-count",props:{product:{}},setup(t){return(e,i)=>{const r=lo,o=F.NPopover;return n.openBlock(),n.createBlock(o,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:n.withCtx(()=>[n.renderSlot(e.$slots,"default",{},()=>[n.createVNode(r)])]),default:n.withCtx(()=>[n.createElementVNode("div",Zp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.product.stockCount,(s,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:l},[n.createElementVNode("span",Qp,n.toDisplayString(s.warehouse.name),1),n.createElementVNode("span",Jp,[n.createTextVNode(n.toDisplayString(s.count??"В наличии")+" ",1),s.count?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(t.product.unit.name),1)],64)):n.createCommentVNode("",!0)])],64))),128))])]),_:3})}}}),ng=["innerHTML"],ig=["innerHTML"],rg={class:"m-0 flex list-none flex-col gap-1 p-0 text-sm"},og=["href"],sg={key:1,class:"text-sm text-gray-500"},lg={},Ts=n.defineComponent({...lg,__name:"product-info-content",props:{product:{},size:{default:"medium"},maxHeight:{default:void 0},activeTab:{default:void 0}},setup(t){const e=t,i=n.computed(()=>e.maxHeight?{maxHeight:e.maxHeight}:void 0),r=n.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.description)??""}),o=n.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.specification)??""}),s=n.computed(()=>Ss(e.product)),l=n.computed(()=>[r.value?"description":null,o.value?"specification":null,s.value.length>0?"files":null].filter(c=>c!==null)),a=n.ref(e.activeTab&&l.value.includes(e.activeTab)?e.activeTab:l.value[0]);return(c,d)=>{const u=F.NScrollbar,f=F.NTabPane,h=F.NTabs;return l.value.length>0?(n.openBlock(),n.createBlock(h,{key:0,value:a.value,"onUpdate:value":d[0]||(d[0]=m=>a.value=m),size:t.size,type:"line",class:"sc-product-info-content"},{default:n.withCtx(()=>[r.value?(n.openBlock(),n.createBlock(f,{key:0,name:"description",tab:"Описание"},{default:n.withCtx(()=>[n.createVNode(u,{style:n.normalizeStyle(i.value)},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"sc-product-info-html",innerHTML:r.value},null,8,ng)]),_:1},8,["style"])]),_:1})):n.createCommentVNode("",!0),o.value?(n.openBlock(),n.createBlock(f,{key:1,name:"specification",tab:"Характеристики"},{default:n.withCtx(()=>[n.createVNode(u,{style:n.normalizeStyle(i.value)},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"sc-product-info-html",innerHTML:o.value},null,8,ig)]),_:1},8,["style"])]),_:1})):n.createCommentVNode("",!0),s.value.length>0?(n.openBlock(),n.createBlock(f,{key:2,name:"files",tab:`Файлы (${s.value.length})`},{default:n.withCtx(()=>[n.createVNode(u,{style:n.normalizeStyle(i.value)},{default:n.withCtx(()=>[n.createElementVNode("ul",rg,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,m=>(n.openBlock(),n.createElementBlock("li",{key:m.id},[n.createElementVNode("a",{href:m.url,target:"_blank",rel:"noopener"},n.toDisplayString(m.typeName),9,og)]))),128))])]),_:1},8,["style"])]),_:1},8,["tab"])):n.createCommentVNode("",!0)]),_:1},8,["value","size"])):(n.openBlock(),n.createElementBlock("span",sg," Описание, характеристики и файлы не заданы. "))}}}),ag={key:0,class:"flex flex-row gap-2.5"},cg={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},dg={},$s=n.defineComponent({...dg,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},modalWidth:{default:void 0},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})},trapFocus:{type:Boolean,default:!0}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(t,{expose:e,emit:i}){const r=t,o=i,s=n.ref(r.show),l=n.ref(r.processing),a=Ye.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=Ye.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=n.computed(()=>r.modalWidth??window.innerWidth*c.value),u=()=>{o("opening"),s.value=!0,o("update:show",s.value)},f=(m="other",p=!1)=>{if(l.value&&!p){o("processing:cancel",_=>{l.value=_});return}let g=!1;o("closing",m,()=>{g=!0}),g||(s.value=!1,o("update:show",s.value))},h=()=>{o("accept",p=>{l.value=p})};return n.watch(()=>r.show,m=>{m?u():f("other",!0)}),n.watch(()=>r.processing,m=>{l.value=m}),e({open:u,close:f,acceptHandler:h}),(m,p)=>{const g=F.NButton,b=F.NModal;return n.openBlock(),n.createBlock(b,{loading:l.value,show:s.value,"show-icon":!1,size:n.unref(a),style:n.normalizeStyle(`width: ${d.value}px`),title:t.title,"trap-focus":t.trapFocus??!0,"action-class":m.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:p[1]||(p[1]=y=>f("header")),onEsc:p[2]||(p[2]=y=>f("esc")),onMaskClick:p[3]||(p[3]=y=>f("mask"))},n.createSlots({default:n.withCtx(()=>[n.renderSlot(m.$slots,"default")]),_:2},[m.$slots.header?{name:"header",fn:n.withCtx(()=>[n.renderSlot(m.$slots,"header")]),key:"0"}:void 0,m.$slots.action||m.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:n.withCtx(()=>[m.$slots["extra-action"]?(n.openBlock(),n.createElementBlock("div",ag,[n.renderSlot(m.$slots,"extra-action")])):n.createCommentVNode("",!0),m.$slots.action||t.acceptButton.show||t.cancelButton.show?(n.openBlock(),n.createElementBlock("div",cg,[n.renderSlot(m.$slots,"action",{disabled:l.value}),t.acceptButton.show??!0?(n.openBlock(),n.createBlock(g,{key:0,disabled:l.value||!t.valid,loading:l.value,size:n.unref(a),type:"primary",onClick:h},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","loading","size"])):n.createCommentVNode("",!0),t.cancelButton.show??!0?(n.openBlock(),n.createBlock(g,{key:1,disabled:l.value,size:n.unref(a),type:"default",onClick:p[0]||(p[0]=y=>f("footer"))},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["disabled","size"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),ug={class:"flex flex-col gap-3"},fg={class:"text-xs text-gray-500"},hg={},Ja=n.defineComponent({...hg,__name:"product-info-dialog",props:{product:{},show:{type:Boolean,default:!1},activeTab:{default:void 0}},emits:["update:show"],setup(t,{emit:e}){const i=e,r=()=>{i("update:show",!1)};return(o,s)=>(n.openBlock(),n.createBlock($s,{show:t.show,title:t.product.name,"accept-button":{show:!1},"cancel-button":{show:!0,text:"Закрыть"},"trap-focus":!1,onClosing:r},{default:n.withCtx(()=>[n.createElementVNode("div",ug,[n.createElementVNode("span",fg,"Артикул: "+n.toDisplayString(t.product.code),1),n.createVNode(Ts,{product:t.product,"active-tab":t.activeTab,"max-height":"60vh"},null,8,["product","active-tab"])])]),_:1},8,["show","title"]))}}),mg={class:"flex flex-col gap-2"},pg={class:"flex justify-end border-0 border-t border-solid border-gray-200 pt-2"},gg={},ec=n.defineComponent({...gg,__name:"product-info-popover",props:{product:{}},setup(t){const e=n.ref(!1),i=n.ref(!1),r=n.ref(!1),o=()=>{e.value=!1,i.value=!0,r.value=!0};return(s,l)=>{const a=lo,c=F.NButton,d=F.NPopover;return n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(d,{show:e.value,"onUpdate:show":l[0]||(l[0]=u=>e.value=u),width:560,style:{maxWidth:"calc(100vw - 2rem)"},trigger:"click",placement:"bottom-start",class:"sc-product-info-popover"},{trigger:n.withCtx(()=>[n.renderSlot(s.$slots,"default",{},()=>[n.createVNode(a,{title:"Описание и характеристики",class:"cursor-pointer"})])]),default:n.withCtx(()=>[n.createElementVNode("div",mg,[n.createVNode(Ts,{product:t.product,size:"small","max-height":"16rem"},null,8,["product"]),n.createElementVNode("div",pg,[n.createVNode(c,{text:"",type:"info",size:"small",onClick:o},{default:n.withCtx(()=>[...l[2]||(l[2]=[n.createTextVNode(" Открыть полностью ",-1)])]),_:1})])])]),_:3},8,["show"]),i.value?(n.openBlock(),n.createBlock(Ja,{key:0,show:r.value,"onUpdate:show":l[1]||(l[1]=u=>r.value=u),product:t.product},null,8,["show","product"])):n.createCommentVNode("",!0)],64)}}}),yg={class:"flex flex-row justify-between"},bg={key:0,class:"inline-flex flex-row gap-0.5 mr-2 align-sub"},_g={key:1},wg={class:"ml-2 align-sub"},xg={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},kg={key:2,class:"ml-2 align-sub"},Cg={class:"@container"},vg={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},Sg={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Bg={class:"text-sc-dark-grey"},Ng={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},Tg={class:"text-gray-600"},$g={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},Eg={key:3,class:"underline decoration-dashed"},Rg={key:4,class:"sc-product-pack whitespace-nowrap"},Pg={class:"text-gray-600"},Fg={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},Vg={class:"text-gray-600"},Mg={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},Ig={key:0},Ag={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Og={},Nr=n.defineComponent({...Og,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showAdditionalSaleIcon:{type:Boolean,default:!1},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(t,{expose:e}){const i=t,r=n.computed(()=>A.isFunction(i.showProductCosts)?i.showProductCosts(i.product):i.showProductCosts),o=n.computed(()=>A.sortBy(i.product.priceCoefficients,["coefficient.slug"])),s=n.computed(()=>{var h,m;return(m=(h=i.product)==null?void 0:h.properties)==null?void 0:m.planingIncomingDate}),l=n.useTemplateRef("image-gallery"),a=()=>{var h;(h=l.value)==null||h.show()},c=n.computed(()=>A.isFunction(i.allowNameClick)?i.allowNameClick(i.product):i.allowNameClick),d=n.computed(()=>(A.isFunction(i.showProductInfoButton)?i.showProductInfoButton(i.product):i.showProductInfoButton)&&Wa(i.product)),u=n.computed(()=>{var h;return i.showProductAddToCartButton||i.showProductEditButton||i.showProductRequiredButton||(((h=i.productContextButtonsConfig)==null?void 0:h.length)??0)>0}),f=()=>{var h;c.value&&((h=i.eventEmitter)==null||h.emit("product:name-click",{product:i.product,exposedMethods:{showProductImagesPreview:a}}))};return e({showProductImagesPreview:a}),(h,m)=>{var w,T,C,$;const p=Lp,g=F.NTooltip,b=Ua,y=Op,_=Ga,k=F.NText,x=Ka,v=lo,N=F.NScrollbar;return n.openBlock(),n.createElementBlock("div",null,[n.createElementVNode("div",yg,[n.createVNode(k,{type:"info",class:"sc-product-name text-balance text-base font-medium text-black"},{default:n.withCtx(()=>{var E,V,P,I;return[(E=t.product)!=null&&E.isFavorite||(V=t.product)!=null&&V.isPreviouslyOrdered||t.showAdditionalSaleIcon?(n.openBlock(),n.createElementBlock("div",bg,[((P=t.product)==null?void 0:P.isFavorite)??!1?(n.openBlock(),n.createBlock(g,{key:0,placement:"bottom",trigger:"hover"},{trigger:n.withCtx(()=>[n.createVNode(p,{class:"!text-yellow-300"})]),default:n.withCtx(()=>[m[0]||(m[0]=n.createTextVNode(" Избранный товар ",-1))]),_:1})):n.createCommentVNode("",!0),((I=t.product)==null?void 0:I.isPreviouslyOrdered)??!1?(n.openBlock(),n.createBlock(g,{key:1,placement:"bottom",trigger:"hover"},{trigger:n.withCtx(()=>[n.createVNode(b,{class:"!text-green-700"})]),default:n.withCtx(()=>[m[1]||(m[1]=n.createTextVNode(" Ранее заказанный товар ",-1))]),_:1})):n.createCommentVNode("",!0),t.showAdditionalSaleIcon?(n.openBlock(),n.createBlock(g,{key:2,placement:"bottom",trigger:"hover"},{trigger:n.withCtx(()=>[n.createVNode(y,{class:"!text-green-500"})]),default:n.withCtx(()=>[m[2]||(m[2]=n.createTextVNode(" Дополнительная продажа ",-1))]),_:1})):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("span",{class:n.normalizeClass({"cursor-pointer":c.value&&t.eventEmitter,"text-gray-400 line-through":t.product.isHidden}),onClick:f},n.toDisplayString(t.product.name),3),t.product.onOrder?(n.openBlock(),n.createElementBlock("span",_g," [Под заказ] ")):n.createCommentVNode("",!0),n.createElementVNode("span",wg,[t.product.images&&t.product.images.length>0?(n.openBlock(),n.createBlock(Qa,{key:0,ref:"image-gallery",images:t.product.images},{default:n.withCtx(()=>[n.createElementVNode("div",xg,[n.createVNode(_)])]),_:1},8,["images"])):n.createCommentVNode("",!0)]),d.value?(n.openBlock(),n.createElementBlock("span",kg,[n.createVNode(ec,{product:t.product},null,8,["product"])])):n.createCommentVNode("",!0)]}),_:1}),u.value?(n.openBlock(),n.createBlock(x,{key:0,product:t.product,"event-emitter":t.eventEmitter,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-edit-button":t.showProductEditButton,"show-product-required-button":t.showProductRequiredButton,"product-context-buttons-config":t.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",Cg,[n.createElementVNode("div",vg,[t.product.supplierSku?(n.openBlock(),n.createElementBlock("div",Sg,[m[3]||(m[3]=n.createTextVNode(" Артикул производителя/поставщика: ",-1)),n.createElementVNode("span",Bg,n.toDisplayString(t.product.supplierSku),1)])):n.createCommentVNode("",!0),t.showCode?(n.openBlock(),n.createElementBlock("span",Ng,[m[4]||(m[4]=n.createTextVNode(" Артикул: ",-1)),n.createElementVNode("span",Tg,n.toDisplayString(t.product.code),1)])):n.createCommentVNode("",!0),t.product.stockCount&&t.product.stockCount.length>0?(n.openBlock(),n.createBlock(tg,{key:2,product:t.product},{default:n.withCtx(()=>[n.createElementVNode("span",$g,[m[5]||(m[5]=n.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),n.createVNode(v,{class:"mt-0.5"})])]),_:1},8,["product"])):(n.openBlock(),n.createElementBlock("span",Eg," Нет в наличии ")),t.product.pack??((T=(w=t.product)==null?void 0:w.properties)==null?void 0:T.pack)?(n.openBlock(),n.createElementBlock("span",Rg,[m[6]||(m[6]=n.createTextVNode(" Норма упаковки: ",-1)),n.createElementVNode("span",Pg,n.toDisplayString(t.product.pack??(($=(C=t.product)==null?void 0:C.properties)==null?void 0:$.pack)),1)])):n.createCommentVNode("",!0),t.showPlanningDates&&s.value?(n.openBlock(),n.createElementBlock("span",Fg,[m[7]||(m[7]=n.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),n.createElementVNode("span",Vg,n.toDisplayString(s.value),1)])):n.createCommentVNode("",!0)])]),n.createVNode(N,{"x-scrollable":""},{default:n.withCtx(()=>[r.value?(n.openBlock(),n.createElementBlock("div",Mg,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,E=>(n.openBlock(),n.createBlock(ii,{key:E.coefficient.slug,product:t.product,"cost-field-name":E.coefficient.slug??"","event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),n.createVNode(ii,{product:t.product,"event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":t.showCostDate,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):n.createCommentVNode("",!0)]),_:1}),t.showSlugs||t.showProperties?(n.openBlock(),n.createElementBlock("div",Ig,[n.createElementVNode("ul",Ag,[t.showSlugs?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList({id:t.product.id,slug:t.product.slug},(E,V)=>(n.openBlock(),n.createElementBlock("li",{key:V}," ("+n.toDisplayString(V)+"): "+n.toDisplayString(E),1))),128)):n.createCommentVNode("",!0),t.showProperties?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:1},n.renderList(t.product.properties,(E,V)=>(n.openBlock(),n.createElementBlock("li",{key:V}," ("+n.toDisplayString(V)+"): "+n.toDisplayString(E),1))),128)):n.createCommentVNode("",!0)])])):n.createCommentVNode("",!0)])}}}),zg=(t,e,i)=>({key:t,title:e,className:"align-top",resizable:!0,render:r=>n.h(ii,{product:r,costFieldName:t,eventEmitter:i.eventEmitter,allowPriceClick:i.allowPriceClick,currencyRates:i.currencyRates})}),Dg=(t,e)=>{if(t.length===0)return[];const i=[],r={};switch(A.isNil(e.isProductItemSelected)||i.push({key:"checkbox",title:"",className:"align-top",width:"32",render:o=>{var s,l;return n.h(F.NCheckbox,{checked:!!((s=e.isProductItemSelected)!=null&&s.call(e,o)),disabled:((l=e.isProductItemSelected)==null?void 0:l.call(e,o))==="disabled",onUpdateChecked:a=>{e.eventEmitter.emit("product:checked",{product:o,checked:a})}})}}),Ye.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:i.push({key:"name",title:"Наименование",className:"align-top",render:o=>n.h(Nr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:i.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:o=>n.h(Nr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,currencyRates:e.currencyRates})}),e.showProductCosts&&(A.forEach(t,o=>{A.forEach(o.priceCoefficients,s=>{r[s.coefficient.slug??""]||(r[s.coefficient.slug??""]=s.coefficient)})}),A.forEach(A.sortBy(r,["slug"]),o=>{i.push(zg(o.slug??"",o.name,e))}),i.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:o=>n.h(ii,{product:o,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!A.isNil(e.productContextButtonsConfig))&&i.push({key:"actions",title:"",className:"align-top",width:"50",render:o=>n.h(Ka,{product:o,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return i},Lg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Hg(t,e){return n.openBlock(),n.createElementBlock("svg",Lg,[...e[0]||(e[0]=[n.createElementVNode("path",{fill:"none",d:"M296 64h-80a7.91 7.91 0 0 0-8 8v24h96V72a7.91 7.91 0 0 0-8-8"},null,-1),n.createElementVNode("path",{fill:"currentColor",d:"M432 96h-96V72a40 40 0 0 0-40-40h-80a40 40 0 0 0-40 40v24H80a16 16 0 0 0 0 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 0 0 0-32M192.57 416H192a16 16 0 0 1-16-15.43l-8-224a16 16 0 1 1 32-1.14l8 224A16 16 0 0 1 192.57 416M272 400a16 16 0 0 1-32 0V176a16 16 0 0 1 32 0Zm32-304h-96V72a7.91 7.91 0 0 1 8-8h80a7.91 7.91 0 0 1 8 8Zm32 304.57A16 16 0 0 1 320 416h-.58A16 16 0 0 1 304 399.43l8-224a16 16 0 1 1 32 1.14Z"},null,-1)])])}const uo=n.markRaw({name:"ion-trash",render:Hg}),Wg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jg(t,e){return n.openBlock(),n.createElementBlock("svg",Wg,[...e[0]||(e[0]=[n.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const tc=n.markRaw({name:"ion-plus",render:jg}),qg={key:0,class:"flex w-fit items-center gap-2"},Xg={key:1,class:"flex flex-wrap gap-1"},Yg={key:0},Ug={key:2},Kg={},Tr=n.defineComponent({...Kg,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0},validation:{default:void 0}},setup(t){const e=t,i=n.computed(()=>{var r,o;return(o=(r=e.product)==null?void 0:r.properties)==null?void 0:o.planingProductionDate});return(r,o)=>{const s=F.NSpin,l=F.NText;return t.isProductSearching?(n.openBlock(),n.createElementBlock("div",qg,[n.createVNode(s,{size:17,class:"w-fit"}),o[0]||(o[0]=n.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):t.product&&!t.product.isNewRec()?(n.openBlock(),n.createElementBlock("div",Xg,[n.createElementVNode("div",null,n.toDisplayString(t.product.code)+" - "+n.toDisplayString(t.product.name)+" - "+n.toDisplayString(t.product.costRub.toLocaleString())+" ₽ / "+n.toDisplayString(t.product.unit.name),1),i.value?(n.openBlock(),n.createElementBlock("div",Yg,"(Планируемая дата производства: "+n.toDisplayString(i.value)+")",1)):n.createCommentVNode("",!0)])):t.validation?(n.openBlock(),n.createElementBlock("div",Ug,[n.createVNode(l,{type:t.validation.validationStatus},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.validation.feedback),1)]),_:1},8,["type"])])):n.createCommentVNode("",!0)}}}),Gg={class:"flex flex-col gap-4"},Zg={class:"flex flex-col gap-2"},Qg={class:"mt-8 font-bold"},Jg={class:"grid grow grid-cols-2 items-start gap-2"},ey={key:2,class:"text-red-500 text-sm"},ty={key:3,class:"text-red-500 text-sm mb-2"},ny={class:"flex flex-col gap-4"},iy={key:1},ry={class:"text-lg font-semibold"},oy={class:"flex gap-3"},sy={},ly=n.defineComponent({...sy,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(t,{expose:e,emit:i}){var b;const r=t,o=i,s=n.useTemplateRef("form-reference"),l=n.ref(!1),a=n.ref(A.cloneDeep(r.value)),c=n.computed(()=>{var _,k,x;const y={"configuratorParams.length":[ae.required,ae.min(r.settings.stripMinLength),ae.max(r.settings.stripMaxLength||Number.MAX_VALUE),ae.step(r.settings.lengthStep),We.serverValidation((_=r.validation.length)==null?void 0:_.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation((k=r.validation.quantity)==null?void 0:k.feedback)],marker:[We.serverValidation((x=r.validation.marker)==null?void 0:x.feedback)]};return A.forEach(a.value.configuratorParams.linesWidths,(v,N)=>{var C;const T=a.value.configuratorParams.linesWidths.length>1?r.settings.minLineWidth:r.settings.stripMinWidth;y[`configuratorParams.linesWidths.${N}`]=[ae.required,ae.min(T),ae.max(r.settings.maxLineWidth),ae.step(r.settings.lineWidthStep),We.serverValidation((C=r.validation[`lines_widths[${N+1}]`])==null?void 0:C.feedback)]}),A.forEach(a.value.configuratorParams.linesAngles,(v,N)=>{var w;y[`configuratorParams.linesAngles.${N}`]=[ae.required,ae.min(r.settings.minLineAngle),ae.max(r.settings.maxLineAngle),ae.step(r.settings.lineAngleStep),We.serverValidation((w=r.validation[`lines_angles[${N+1}]`])==null?void 0:w.feedback)]}),y}),d=n.ref(r.settings.canSetDopProdaga??!1),u=n.computed(()=>{var v;const{length:y}=a.value.configuratorParams,{quantity:_}=a.value,k=((v=a.value.product)==null?void 0:v.costRub)||0;if(!y||!_||k===0)return null;const x=y/1e3;return(k*_*x).toLocaleString("ru-ru",{maximumFractionDigits:2,minimumFractionDigits:2})}),f=n.computed(()=>A.reduce(a.value.configuratorParams.linesWidths,(y,_)=>y+(_||0),0)),h=n.computed(()=>{const y=f.value;return y>=r.settings.stripMinWidth&&y<=r.settings.stripMaxWidth}),m=n.computed(()=>{const{configuratorParams:y}=a.value,_=A.every(y.linesWidths,N=>!!(N&&N>0)),k=A.every(y.linesAngles,N=>!A.isNil(N)),x=!!(a.value.quantity&&a.value.quantity>0),v=y.length>0&&y.length>0;return _&&k&&x&&v&&h.value}),p=()=>{n.nextTick(()=>{var y;(y=s.value)==null||y.validate(_=>{_||(o("update:params",a.value.configuratorParams),g("configuratorParams",a.value.configuratorParams))}).catch(A.noop)})},g=(y,_)=>{const k=new H.OrderItemBase(a.value);k[y]=_,y==="configuratorParams"&&(k.product=new H.ClientProduct),o("update:value",k)};return n.watch(()=>r.previewParams,y=>{a.value.configuratorParams.linesWidths=y.linesWidths,a.value.configuratorParams.linesAngles=y.linesAngles},{deep:!0}),n.watch(()=>r.value,y=>{a.value=A.cloneDeep(y)},{deep:!0}),e({validate:(b=s.value)==null?void 0:b.validate,formReference:s}),(y,_)=>{const k=tc,x=uo,v=F.NCheckbox;return n.withDirectives((n.openBlock(),n.createBlock(n.unref(F.NForm),{ref:"form-reference",model:a.value,rules:c.value,class:"flex flex-col gap-4 sc-hide-empty-feedback-message"},{default:n.withCtx(()=>{var N;return[n.createElementVNode("div",Gg,[_[21]||(_[21]=n.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),t.settings.startTailConfigs&&t.settings.startTailConfigs.length>0?(n.openBlock(),n.createBlock(n.unref(F.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NSelect),{value:a.value.configuratorParams.startTailType,"onUpdate:value":[_[0]||(_[0]=w=>a.value.configuratorParams.startTailType=w),p],options:t.settings.startTailConfigs.map(({label:w},T)=>({label:w,value:T})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):n.createCommentVNode("",!0),n.createElementVNode("div",Zg,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.configuratorParams.linesAngles,(w,T)=>(n.openBlock(),n.createElementBlock("div",{key:T,class:"flex items-start gap-2"},[n.createElementVNode("div",Qg,n.toDisplayString(T+1),1),n.createElementVNode("div",Jg,[n.createVNode(n.unref(F.NFormItem),{path:`configuratorParams.linesWidths.${T}`,label:"Ширина, мм"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInputNumber),{value:a.value.configuratorParams.linesWidths[T],"onUpdate:value":[C=>a.value.configuratorParams.linesWidths[T]=C,_[2]||(_[2]=C=>p())],parse:n.unref(ct),"show-button":!1,class:"w-full",onKeydown:_[1]||(_[1]=C=>n.unref(lt)(C)),onInput:C=>n.unref(rt)(t.validation,`lines_widths[${T+1}]`),onFocus:n.unref(He)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"]),n.createVNode(n.unref(F.NFormItem),{path:`configuratorParams.linesAngles.${T}`,label:"Угол сгиба, °"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInputNumber),{value:a.value.configuratorParams.linesAngles[T],"onUpdate:value":[C=>a.value.configuratorParams.linesAngles[T]=C,_[4]||(_[4]=C=>p())],parse:n.unref(ct),"show-button":!1,class:"w-full",onKeydown:_[3]||(_[3]=C=>n.unref(lt)(C,!0)),onInput:C=>n.unref(rt)(t.validation,`lines_angles[${T+1}]`),onFocus:n.unref(He)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"])]),n.createVNode(n.unref(F.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:n.withCtx(()=>[t.settings.showOnlyTemplates?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(n.unref(F.NButton),{key:0,size:"medium",onClick:C=>o("click:add-line",T)},{default:n.withCtx(()=>[n.createVNode(k)]),_:1},8,["onClick"])),t.settings.showOnlyTemplates?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(n.unref(F.NButton),{key:1,disabled:a.value.configuratorParams.linesWidths.length===1,size:"medium",class:"ml-2",onClick:C=>o("click:remove-line",T)},{default:n.withCtx(()=>[n.createVNode(x)]),_:1},8,["disabled","onClick"]))]),_:2},1024)]))),128))]),t.settings.endTailConfigs&&t.settings.endTailConfigs.length>0?(n.openBlock(),n.createBlock(n.unref(F.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NSelect),{value:a.value.configuratorParams.endTailType,"onUpdate:value":[_[5]||(_[5]=w=>a.value.configuratorParams.endTailType=w),p],options:t.settings.endTailConfigs.map(({label:w},T)=>({label:w,value:T})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(Tr,{"is-product-searching":t.isProductSearching,product:a.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),h.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",ey," Суммарная ширина участков гиба должна быть от "+n.toDisplayString(t.settings.stripMinWidth)+" до "+n.toDisplayString(t.settings.stripMaxWidth)+" мм., текущая ширина: "+n.toDisplayString(f.value)+" мм. ",1)),m.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",ty," Пожалуйста, заполните все обязательные поля корректно. ")),t.settings.allowSaveTemplates&&t.selectTemplateIndex===((N=t.settings.allTemplates)==null?void 0:N.length)-1?(n.openBlock(),n.createBlock(n.unref(F.NButton),{key:4,type:"tertiary",class:"self-start",loading:l.value,onClick:_[6]||(_[6]=w=>o("click:save-template"))},{default:n.withCtx(()=>[..._[20]||(_[20]=[n.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",ny,[n.createVNode(n.unref(F.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NSelect),{value:a.value.configuratorParams.colorSide,"onUpdate:value":[_[7]||(_[7]=w=>a.value.configuratorParams.colorSide=w),p],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),n.createVNode(n.unref(F.NFormItem),{path:"configuratorParams.length",label:`Метраж${t.settings.stripMinLength?" от "+t.settings.stripMinLength:""}${t.settings.stripMaxLength?" до "+t.settings.stripMaxLength:""} мм`},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInputNumber),{value:a.value.configuratorParams.length,"onUpdate:value":[_[8]||(_[8]=w=>a.value.configuratorParams.length=w),_[11]||(_[11]=w=>p())],parse:n.unref(ct),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:_[9]||(_[9]=w=>n.unref(lt)(w)),onInput:_[10]||(_[10]=w=>n.unref(rt)(t.validation,"length")),onFocus:n.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),n.createVNode(n.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInputNumber),{value:a.value.quantity,"onUpdate:value":[_[12]||(_[12]=w=>a.value.quantity=w),_[15]||(_[15]=w=>g("quantity",w??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:_[13]||(_[13]=w=>n.unref(lt)(w,!1)),onInput:_[14]||(_[14]=w=>n.unref(rt)(t.validation,"quantity")),onFocus:n.unref(He)},null,8,["value","onFocus"])]),_:1}),n.createVNode(n.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:n.withCtx(()=>[n.createVNode(n.unref(F.NInput),{value:a.value.marker??null,placeholder:"Введите маркировку",onInput:_[16]||(_[16]=w=>n.unref(rt)(t.validation,"marker")),"onUpdate:value":_[17]||(_[17]=w=>{a.value.marker=w??null,g("marker",w??null)}),onFocus:n.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(n.openBlock(),n.createBlock(v,{key:0,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":_[18]||(_[18]=w=>{a.value.isAdditionalSale=w??!1,g("isAdditionalSale",w??!1)})},{default:n.withCtx(()=>[..._[22]||(_[22]=[n.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):n.createCommentVNode("",!0),u.value?(n.openBlock(),n.createElementBlock("div",iy,[_[23]||(_[23]=n.createTextVNode(" ИТОГО: ",-1)),n.createElementVNode("span",ry,n.toDisplayString(u.value)+" ₽",1)])):n.createCommentVNode("",!0),n.createElementVNode("div",oy,[n.createVNode(n.unref(F.NButton),{loading:t.isSubmitProcessing,disabled:!m.value||a.value.product.isNewRec(),type:"primary",class:"self-start",onClick:_[19]||(_[19]=w=>o("submit",a.value))},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1},8,["model","rules"])),[[n.unref(ti),()=>o("submit",a.value)]])}}}),nc=wn(ly,[["__scopeId","data-v-ac7f1192"]]);var ic=Object.defineProperty,ay=Object.defineProperties,cy=Object.getOwnPropertyDescriptors,rc=Object.getOwnPropertySymbols,dy=Object.prototype.hasOwnProperty,uy=Object.prototype.propertyIsEnumerable,oc=t=>{throw TypeError(t)},Es=(t,e,i)=>e in t?ic(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$r=(t,e)=>{for(var i in e||(e={}))dy.call(e,i)&&Es(t,i,e[i]);if(rc)for(var i of rc(e))uy.call(e,i)&&Es(t,i,e[i]);return t},Rs=(t,e)=>ay(t,cy(e)),sc=(t,e)=>{for(var i in e)ic(t,i,{get:e[i],enumerable:!0})},S=(t,e,i)=>Es(t,typeof e!="symbol"?e+"":e,i),lc=(t,e,i)=>e.has(t)||oc("Cannot "+i),Dt=(t,e,i)=>(lc(t,e,"read from private field"),i?i.call(t):e.get(t)),ac=(t,e,i)=>e.has(t)?oc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),fy=(t,e,i,r)=>(lc(t,e,"write to private field"),e.set(t,i),i),Pt={Image:null,isHeadless:!1,shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(i){return this[i]},t.setAttribute=function(i,r){return this[i]=r,this},t},polyfill:function(t,e){return Pt.shim(t),typeof e<"u"&&(Pt.Image=e),Pt.isHeadless=!0,t}},cc={};sc(cc,{Curve:()=>Zi,getAnchorsFromArcData:()=>py,getComponentOnCubicBezier:()=>Er,getControlPoints:()=>wc,getCurveBoundingBox:()=>yc,getCurveFromPoints:()=>_c,getCurveLength:()=>gc,getReflection:()=>Ms,integrate:()=>bc,subdivide:()=>Vs});var dc={};sc(dc,{HALF_PI:()=>dt,NumArray:()=>xn,TWO_PI:()=>tt,decomposeMatrix:()=>wi,getComputedMatrix:()=>Ps,getEffectiveStrokeWidth:()=>kn,getPoT:()=>hc,lerp:()=>Ft,mod:()=>ot,setMatrix:()=>fc,toFixed:()=>ze});var Ke;typeof window<"u"?Ke=window:typeof global<"u"?Ke=global:typeof self<"u"&&(Ke=self);var uc,tt=Math.PI*2,dt=Math.PI*.5;function wi(t,e,i,r,o,s){let l;return arguments.length<=1?(l=t.a,e=t.b,i=t.c,r=t.d,o=t.e,s=t.f):l=t,{translateX:o,translateY:s,scaleX:Math.sqrt(l*l+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,l)/Math.PI}}function fc(t){uc=t}function Ps(t,e){e=e&&e.identity()||new uc;let i=t;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const l=r[o].elements;e.multiply(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],l[8])}return e}function Ft(t,e,i){return i*(e-t)+t}var Fs=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function hc(t){let e=0;for(;Fs[e]&&Fs[e]<t;)e++;return Fs[e]}function ot(t,e){for(;t<0;)t+=e;return t%e}var xn=Ke.Float32Array||Array,hy=Math.floor;function ze(t){return hy(t*1e6)/1e6}function kn(t,e){const i=t._linewidth;if(t.strokeAttenuation)return i;e||(e=t.worldMatrix||Ps(t));const r=wi(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),o=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return o>0?i/o:i}var ie={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},ee=class{constructor(){S(this,"_events",{}),S(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let l=this._events[e];if(l){let a=[];if(i)for(let c=0,d=l.length;c<d;c++){let u=l[c];u=u.handler?u.handler:u,i!==u&&a.push(u)}this._events[e]=a}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}};S(ee,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(ee,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var mc={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(ee.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(ee.Types.change))}}},cn=class _r extends ee{constructor(e=0,i=0){super(),S(this,"_x",0),S(this,"_y",0);for(let r in mc)Object.defineProperty(this,r,mc[r]);this.x=e,this.y=i}static add(e,i){return new _r(e.x+i.x,e.y+i.y)}static sub(e,i){return new _r(e.x-i.x,e.y-i.y)}static subtract(e,i){return _r.sub(e,i)}static ratioBetween(e,i){return(e.x*i.x+e.y*i.y)/(e.length()*i.length())}static angleBetween(e,i){if(arguments.length>=4){const s=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,s)}const r=e.x-i.x,o=e.y-i.y;return Math.atan2(o,r)}static distanceBetween(e,i){return Math.sqrt(_r.distanceBetweenSquared(e,i))}static distanceBetweenSquared(e,i){const r=e.x-i.x,o=e.y-i.y;return r*r+o*o}set(e,i){return this.x=e,this.y=i,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new _r(this.x,this.y)}add(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=i),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,r=this.y-e.y;return i*i+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(e)<i}lerp(e,i){const r=(e.x-this.x)*i+this.x,o=(e.y-this.y)*i+this.y;return this.set(r,o)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:ze(this.x),y:ze(this.y)}}rotate(e){const i=this.x,r=this.y,o=Math.cos(e),s=Math.sin(e);return this.x=i*o-r*s,this.y=i*s+r*o,this}};S(cn,"zero",new cn),S(cn,"left",new cn(-1,0)),S(cn,"right",new cn(1,0)),S(cn,"up",new cn(0,-1)),S(cn,"down",new cn(0,1));var re=cn,$e=class _s extends re{constructor(e=0,i=0,r=0,o=0,s=0,l=0,a=ie.move){super(e,i),S(this,"controls",{left:new re,right:new re}),S(this,"_command",ie.move),S(this,"_relative",!0),S(this,"_rx",0),S(this,"_ry",0),S(this,"_xAxisRotation",0),S(this,"_largeArcFlag",0),S(this,"_sweepFlag",1);for(let d in pc)Object.defineProperty(this,d,pc[d]);this.command=a,this.relative=!0;const c=_s.makeBroadcast(this);this.controls.left.set(r,o).addEventListener(ee.Types.change,c),this.controls.right.set(s,l).addEventListener(ee.Types.change,c)}static makeBroadcast(e){return i;function i(){e._bound&&e.dispatchEvent(ee.Types.change)}}static fromObject(e){return new _s().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new _s().copy(this)}toObject(){return{x:ze(this.x),y:ze(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:ze(this.rx),ry:ze(this.ry),xAxisRotation:ze(this.xAxisRotation),largeArcFlag:ze(this.largeArcFlag),sweepFlag:ze(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},pc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(ee.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(ee.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(ee.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(ee.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(ee.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(ee.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(ee.Types.change))}}},my=0,kt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.23",PublishDate:"2025-12-22T19:59:24.486Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return my++}},Zi={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Er(t,e,i,r,o){const s=1-t;return s*s*s*e+3*s*s*t*i+3*s*t*t*r+t*t*t*o}function Vs(t,e,i,r,o,s,l,a,c){c=c||Zi.RecursionLimit;const d=c+1;if(Math.abs(t-l)<.001&&Math.abs(e-a)<.001)return[new $e(l,a)];const u=[];for(let f=0;f<d;f++){const h=f/d,m=Er(h,t,i,o,l),p=Er(h,e,r,s,a);u.push(new $e(m,p))}return u}function gc(t,e,i,r,o,s,l,a,c){if(t===i&&e===r&&o===l&&s===a){const b=l-t,y=a-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(l-t),u=6*(t+o)-12*i,f=3*(i-t),h=9*(r-s)+3*(a-e),m=6*(e+s)-12*r,p=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+m)*b+p;return Math.sqrt(y*y+_*_)}return bc(g,0,1,c||Zi.RecursionLimit)}function yc(t,e,i,r,o,s,l,a){const c=[],d=[[],[]];let u,f,h,m,p,g,b,y;for(let v=0;v<2;++v){if(v===0?(f=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*l,h=3*i-3*t):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*a,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;m=-h/f,0<m&&m<1&&c.push(m);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(p=(-f+y)/(2*u),0<p&&p<1&&c.push(p),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)m=c[_],x=1-m,d[0][_]=x*x*x*t+3*x*x*m*i+3*x*m*m*o+m*m*m*l,d[1][_]=x*x*x*e+3*x*x*m*r+3*x*m*m*s+m*m*m*a;return d[0][k]=t,d[1][k]=e,d[0][k+1]=l,d[1][k+1]=a,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function bc(t,e,i,r){let o=Zi.abscissas[r-2],s=Zi.weights[r-2],l=.5*(i-e),a=l+e,c=0,d=r+1>>1,u=r&1?s[c++]*t(a):0;for(;c<d;){const f=l*o[c];u+=s[c++]*(t(a+f)+t(a-f))}return l*u}function _c(t,e){const i=t.length,r=i-1;for(let o=0;o<i;o++){const s=t[o],l=e?ot(o-1,i):Math.max(o-1,0),a=e?ot(o+1,i):Math.min(o+1,r),c=t[l],d=s,u=t[a];wc(c,d,u),d.command=o===0?ie.move:ie.curve}}function wc(t,e,i){const r=re.angleBetween(t,e),o=re.angleBetween(i,e);let s=re.distanceBetween(t,e),l=re.distanceBetween(i,e),a=(r+o)/2;return s<.001||l<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,l*=.33,o<r?a+=dt:a-=dt,e.controls.left.x=Math.cos(a)*s,e.controls.left.y=Math.sin(a)*s,a-=Math.PI,e.controls.right.x=Math.cos(a)*l,e.controls.right.y=Math.sin(a)*l,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function Ms(t,e,i){return new re(2*t.x-(e.x+t.x)-(i?t.x:0),2*t.y-(e.y+t.y)-(i?t.y:0))}function py(t,e,i,r,o,s,l){const a=kt.Resolution;for(let c=0;c<a;c++){let d=(c+1)/a;l&&(d=1-d);const u=d*s+o,f=i*Math.cos(u),h=r*Math.sin(u),m=new $e(f,h);m.command=ie.line}}var xc=Array.prototype.slice;function gy(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}var oe={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=xc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)t[o]=r[o]}return t},defaults:function(t){const e=xc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)t[o]===void 0&&(t[o]=r[o])}return t},each:function(t,e,i){const r=i||this,o=!gy(t)&&Object.keys(t),s=(o||t).length;for(let l=0;l<s;l++){const a=o?o[l]:l;e.call(r,t[a],a,t)}return t},performance:Ke.performance&&Ke.performance.now?Ke.performance:Date},Ut={hasEventListeners:typeof Ke.addEventListener=="function",bind:function(t,e,i,r){return this.hasEventListeners?t.addEventListener(e,i,!!r):t.attachEvent("on"+e,i),Ut},unbind:function(t,e,i,r){return Ut.hasEventListeners?t.removeEventListeners(e,i,!!r):t.detachEvent("on"+e,i),Ut},getRequestAnimationFrame:function(){const t=["ms","moz","webkit","o"];let e=0,i=Ke.requestAnimationFrame;if(!i){for(let o=0;o<t.length;o++)i=Ke[t[o]+"RequestAnimationFrame"]||i;i=i||r}function r(o,s){const l=new Date().getTime(),a=Math.max(0,16-(l-e)),c=Ke.setTimeout(d,a);e=l+a;function d(){o(l+a)}return c}return i}},Qi=Ke.document?Ke.document.createElement("div"):{};Qi.id="help-two-load",Object.defineProperty(Ut,"temp",{enumerable:!0,get:function(){return oe.isElement(Qi)&&!Ke.document.head.contains(Qi)&&(Qi.style.display="none",Ke.document.head.appendChild(Qi)),Qi}});var Lt=class extends Error{constructor(e){super(),S(this,"name","Two.js"),S(this,"message"),this.message=e}},yy=Ke.devicePixelRatio||1;function by(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1}function Is(t){return yy/by(t)}var fo=class{constructor(){S(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},Ct,ri=class extends Array{constructor(){super(),ac(this,Ct,new ee),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Dt(this,Ct)}set _events(e){fy(this,Ct,e)}get _bound(){return Dt(this,Ct)._bound}set _bound(e){Dt(this,Ct)._bound=e}addEventListener(){var e;return(e=Dt(this,Ct).addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=Dt(this,Ct).on)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=Dt(this,Ct).bind)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=Dt(this,Ct).removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=Dt(this,Ct).off)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=Dt(this,Ct).unbind)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=Dt(this,Ct).dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=Dt(this,Ct).trigger)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=Dt(this,Ct).listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=Dt(this,Ct).ignore)==null?void 0:e.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(ee.Types.remove,e),arguments.length>2){const i=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ee.Types.insert,i),this.trigger(ee.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(ee.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ee.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,i){const r=[];for(let o=0;o<this.length;o++){const s=this[o];let l;i?l=e.call(i,s,o):l=e(s,o),r.push(l)}return r}};Ct=new WeakMap;var kc=class _m extends ee{constructor(){super(),S(this,"_flagId",!1),S(this,"_flagClassName",!1),S(this,"_renderer",{}),S(this,"_id",kt.Identifier+kt.uniqueId()),S(this,"_className",""),S(this,"classList",[]);for(let e in Cc)Object.defineProperty(this,e,Cc[e])}static fromObject(e){const i=new _m().copy(e);return"id"in e&&(i.id=e.id),i}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const i=this.renderer.ctx;this._renderer.texture&&(i.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(i.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const e=this._renderer.type;return this._renderer={type:e},this}};S(kc,"Properties",["renderer","id","className"]);var Ji=kc,Cc={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}},ho,vc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Ke.document&&(ho=document.createElement("a"));var dn=class Jt extends Ji{constructor(e,i){super(),S(this,"_flagSrc",!1),S(this,"_flagImage",!1),S(this,"_flagVideo",!1),S(this,"_flagLoaded",!1),S(this,"_flagRepeat",!1),S(this,"_flagOffset",!1),S(this,"_flagScale",!1),S(this,"_src",""),S(this,"_image",null),S(this,"_loaded",!1),S(this,"_repeat","no-repeat"),S(this,"_scale",1),S(this,"_offset",null);for(let r in Sc)Object.defineProperty(this,r,Sc[r]);if(this._renderer.type="texture",this._renderer.flagOffset=_y.bind(this),this._renderer.flagScale=wy.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new re,typeof i=="function"){const r=(function(){this.unbind(ee.Types.load,r),typeof i=="function"&&i()}).bind(this);this.bind(ee.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const i=new Jt().copy(e);return"id"in e&&(i.id=e.id),i}static getAbsoluteURL(e){return ho?(ho.href=e,ho.href):e}static loadHeadlessBuffer(e,i){e.image.onload=i,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const i=Jt.getAbsoluteURL(e);if(Jt.ImageRegistry.contains(i))return Jt.ImageRegistry.get(i);let r;return Pt.Image?(r=new Pt.Image,Pt.shim(r,"img")):Ke.document?vc.video.test(i)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,i){let r=e.image,o=Jt.getTag(r);e._flagImage&&(/canvas/i.test(o)?Jt.Register.canvas(e,i):(e._src=!Pt.isHeadless&&r.getAttribute("two-src")||r.src,Jt.Register[o](e,i))),e._flagSrc&&(r||(r=Jt.getImage(e.src),e.image=r),o=Jt.getTag(r),Jt.Register[o](e,i))}clone(){const e=new Jt(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof re?e.offset:new re().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re().copy(e.scale),this}toObject(){const e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ee.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Jt.load(this,(function(){this.loaded=!0,this.trigger(ee.Types.change).trigger(ee.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(dn,"Properties",["src","loaded","repeat","scale","offset","image"]),S(dn,"RegularExpressions",vc),S(dn,"ImageRegistry",new fo),S(dn,"Register",{canvas:function(t,e){t._src="#"+t.id,dn.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){const i=t.image,r=function(s){!Pt.isHeadless&&i.removeEventListener&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),typeof e=="function"&&e()},o=function(s){throw!Pt.isHeadless&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),new Lt("unable to load "+t.src)};typeof i.width=="number"&&i.width>0&&typeof i.height=="number"&&i.height>0?r():!Pt.isHeadless&&typeof i.addEventListener=="function"&&(i.addEventListener("load",r,!1),i.addEventListener("error",o,!1)),t._src=dn.getAbsoluteURL(t._src),!(!Pt.isHeadless&&i&&i.getAttribute("two-src"))&&(Pt.isHeadless||i.setAttribute("two-src",t.src),dn.ImageRegistry.add(t.src,i),Pt.isHeadless?dn.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(Pt.isHeadless)throw new Lt("video textures are not implemented in headless environments.");const i=function(o){t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof e=="function"&&e()},r=function(o){throw t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",r,!1),new Lt("unable to load "+t.src)};t._src=dn.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),dn.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?i():(t.image.addEventListener("canplaythrough",i,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var De=dn,Sc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=De.getTag(t);let i;switch(e){case"canvas":i="#"+t.id;break;default:i=t.src}De.ImageRegistry.contains(i)?this._image=De.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(ee.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(ee.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function _y(){this._flagOffset=!0}function wy(){this._flagScale=!0}var As=class _n extends Ji{constructor(e,i,r){super(),S(this,"_flagOffset",!0),S(this,"_flagOpacity",!0),S(this,"_flagColor",!0),S(this,"_offset",0),S(this,"_opacity",1),S(this,"_color","#fff");for(let o in Bc)Object.defineProperty(this,o,Bc[o]);this._renderer.type="stop",this.offset=typeof e=="number"?e:_n.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof i=="string"?i:_n.Index<=0?"#fff":"#000",_n.Index=(_n.Index+1)%2}static fromObject(e){const i=new _n().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<_n.Properties.length;i++){const r=_n.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new _n;return oe.each(_n.Properties,function(r){i[r]=this[r]},this),e&&e.stops&&e.stops.push(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",oe.each(_n.Properties,i=>{e[i]=this[i]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(As,"Index",0),S(As,"Properties",["offset","opacity","color"]);var oi=As,Bc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Os=class Wi extends Ji{constructor(e){super(),S(this,"_flagStops",!1),S(this,"_flagSpread",!1),S(this,"_flagUnits",!1),S(this,"_spread",""),S(this,"_units","");for(let i in Nc)Object.defineProperty(this,i,Nc[i]);this._renderer.type="gradient",this._renderer.flagStops=xy.bind(this),this._renderer.bindStops=ky.bind(this),this._renderer.unbindStops=Cy.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let i=e.stops;i&&i.length>0&&(i=i.map(o=>o instanceof oi?o:new oi().copy(o)));const r=new Wi(i).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const i=this.stops.map(o=>o.clone()),r=new Wi(i);return oe.each(Wi.Properties,o=>{r[o]=this[o]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let i=0;i<Wi.Properties.length;i++){const r=Wi.Properties[i];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(i=>i.toObject())};return oe.each(Wi.Properties,i=>{e[i]=this[i]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Os,"Stop",oi),S(Os,"Properties",["spread","stops","units"]);var ut=Os,Nc={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._stops=new ri((t||[]).slice(0)),this._stops.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._stops)}}};function xy(){this._flagStops=!0}function ky(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Cy(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}var zs=class eo extends ut{constructor(e,i,r,o,s){super(s),S(this,"_flagEndPoints",!1),S(this,"_left",null),S(this,"_right",null);for(let l in Tc)Object.defineProperty(this,l,Tc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=vy.bind(this),this.left=new re,this.right=new re,typeof e=="number"&&(this.left.x=e),typeof i=="number"&&(this.left.y=i),typeof r=="number"&&(this.right.x=r),typeof o=="number"&&(this.right.y=o)}static fromObject(e){const i=new eo().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<eo.Properties.length;i++){const r=eo.Properties[i];r in e&&(this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new eo(this.left._x,this.left._y,this.right._x,this.right._y,i);return oe.each(ut.Properties,function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(zs,"Stop",oi),S(zs,"Properties",["left","right"]);var Ge=zs,Tc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof re&&this._left.unbind(ee.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof re&&this._right.unbind(ee.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function vy(){this._flagEndPoints=!0}var Ds=class ji extends ut{constructor(e,i,r,o,s,l){super(o),S(this,"_flagRadius",!1),S(this,"_flagCenter",!1),S(this,"_flagFocal",!1),S(this,"_radius",0),S(this,"_center",null),S(this,"_focal",null);for(let a in $c)Object.defineProperty(this,a,$c[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Sy.bind(this),this._renderer.flagFocal=By.bind(this),this.center=new re,this.radius=typeof r=="number"?r:1,this.focal=new re,typeof e=="number"&&(this.center.x=e),typeof i=="number"&&(this.center.y=i),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof l=="number"&&(this.focal.y=l)}static fromObject(e){const i=new ji().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<ji.Properties.length;i++){const r=ji.Properties[i];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new ji(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return oe.each(ut.Properties.concat(ji.Properties),function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return oe.each(ji.Properties,function(i){e[i]=this[i]},this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Ds,"Stop",oi),S(Ds,"Properties",["center","radius","focal"]);var Ze=Ds,$c={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(ee.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(ee.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(ee.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(ee.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Sy(){this._flagCenter=!0}function By(){this._flagFocal=!0}function Ec(t,e){if(e===0||e===1)return!0;const r=t._length*e;let o=0;for(let s=0;s<t._lengths.length;s++){const l=t._lengths[s];if(o>=r)return r-o>=0;o+=l}return!1}function mo(t,e){const i=t._length;if(e<=0)return 0;if(e>=i)return t._lengths.length-1;for(let r=0,o=0;r<t._lengths.length;r++){if(o+t._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/t._lengths[r];o+=t._lengths[r]}return-1}function Rc(t,e,i){let r,o,s,l,a,c,d,u;const f=e.controls&&e.controls.right,h=t.controls&&t.controls.left;return r=e.x,a=e.y,o=(f||e).x,c=(f||e).y,s=(h||t).x,d=(h||t).y,l=t.x,u=t.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&t._relative&&(s+=t.x,d+=t.y),gc(r,a,o,c,s,d,l,u,i)}function Ls(t,e,i){let r,o,s,l,a,c,d,u;const f=e.controls&&e.controls.right,h=t.controls&&t.controls.left;return r=e.x,a=e.y,o=(f||e).x,c=(f||e).y,s=(h||t).x,d=(h||t).y,l=t.x,u=t.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&t._relative&&(s+=t.x,d+=t.y),Vs(r,a,o,c,s,d,l,u,i)}function xi(t){switch(t.renderer.type){case"texture":return De.fromObject(t);case"gradient":return ut.fromObject(t);case"linear-gradient":return Ge.fromObject(t);case"radial-gradient":return Ze.fromObject(t)}return t}var Ny=Math.cos,Ty=Math.sin,Pc=Math.tan,Hs=[],Fc=class en extends ee{constructor(e,i,r,o,s,l){super(),S(this,"elements",new xn(9)),S(this,"manual",!1);let a=e;Array.isArray(a)||(a=Array.prototype.slice.call(arguments)),this.identity(),a.length>0&&this.set(a)}static Multiply(e,i,r){if(i.length<=3){const N=e;let w,T,C;const $=i[0]||0,E=i[1]||0,V=i[2]||0;return w=N[0]*$+N[1]*E+N[2]*V,T=N[3]*$+N[4]*E+N[5]*V,C=N[6]*$+N[7]*E+N[8]*V,[w,T,C]}const o=e[0],s=e[1],l=e[2],a=e[3],c=e[4],d=e[5],u=e[6],f=e[7],h=e[8],m=i[0],p=i[1],g=i[2],b=i[3],y=i[4],_=i[5],k=i[6],x=i[7],v=i[8];return r=r||new xn(9),r[0]=o*m+s*b+l*k,r[1]=o*p+s*y+l*x,r[2]=o*g+s*_+l*v,r[3]=a*m+c*b+d*k,r[4]=a*p+c*y+d*x,r[5]=a*g+c*_+d*v,r[6]=u*m+f*b+h*k,r[7]=u*p+f*y+h*x,r[8]=u*g+f*_+h*v,r}static fromObject(e){return new en().copy(e)}set(e,i,r,o,s,l,a,c,d){if(typeof i>"u"){const u=e;e=u[0],i=u[1],r=u[2],o=u[3],s=u[4],l=u[5],a=u[6],c=u[7],d=u[8]}return this.elements[0]=e,this.elements[1]=i,this.elements[2]=r,this.elements[3]=o,this.elements[4]=s,this.elements[5]=l,this.elements[6]=a,this.elements[7]=c,this.elements[8]=d,this.trigger(ee.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(ee.Types.change)}identity(){return this.elements[0]=en.Identity[0],this.elements[1]=en.Identity[1],this.elements[2]=en.Identity[2],this.elements[3]=en.Identity[3],this.elements[4]=en.Identity[4],this.elements[5]=en.Identity[5],this.elements[6]=en.Identity[6],this.elements[7]=en.Identity[7],this.elements[8]=en.Identity[8],this.trigger(ee.Types.change)}multiply(e,i,r,o,s,l,a,c,d){if(typeof i>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(ee.Types.change);if(typeof r>"u"&&(r=1),typeof o>"u"){e=e||0,i=i||0,r=r||0,s=this.elements;const I=s[0]*e+s[1]*i+s[2]*r,K=s[3]*e+s[4]*i+s[5]*r,J=s[6]*e+s[7]*i+s[8]*r;return[I,K,J]}const u=this.elements,f=[e,i,r,o,s,l,a,c,d],h=u[0],m=u[1],p=u[2],g=u[3],b=u[4],y=u[5],_=u[6],k=u[7],x=u[8],v=f[0],N=f[1],w=f[2],T=f[3],C=f[4],$=f[5],E=f[6],V=f[7],P=f[8];return this.elements[0]=h*v+m*T+p*E,this.elements[1]=h*N+m*C+p*V,this.elements[2]=h*w+m*$+p*P,this.elements[3]=g*v+b*T+y*E,this.elements[4]=g*N+b*C+y*V,this.elements[5]=g*w+b*$+y*P,this.elements[6]=_*v+k*T+x*E,this.elements[7]=_*N+k*C+x*V,this.elements[8]=_*w+k*$+x*P,this.trigger(ee.Types.change)}inverse(e){const i=this.elements;e=e||new en;const r=i[0],o=i[1],s=i[2],l=i[3],a=i[4],c=i[5],d=i[6],u=i[7],f=i[8],h=f*a-c*u,m=-f*l+c*d,p=u*l-a*d;let g=r*h+o*m+s*p;return g?(g=1/g,e.elements[0]=h*g,e.elements[1]=(-f*o+s*u)*g,e.elements[2]=(c*o-s*a)*g,e.elements[3]=m*g,e.elements[4]=(f*r-s*d)*g,e.elements[5]=(-c*r+s*l)*g,e.elements[6]=p*g,e.elements[7]=(-u*r+o*d)*g,e.elements[8]=(a*r-o*l)*g,e):null}scale(e,i){return arguments.length<=1&&(i=e),this.multiply(e,0,0,0,i,0,0,0,1)}rotate(e){const i=Ny(e),r=Ty(e);return this.multiply(i,-r,0,r,i,0,0,0,1)}translate(e,i){return this.multiply(1,0,e,0,1,i,0,0,1)}skewX(e){const i=Pc(e);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(e){const i=Pc(e);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(e){return Hs.length=0,this.toTransformArray(e,Hs),Hs.map(ze).join(" ")}toTransformArray(e,i){const r=this.elements,o=!!i,s=r[0],l=r[1],a=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],m=r[8];if(o){i[0]=s,i[1]=c,i[2]=f,i[3]=l,i[4]=d,i[5]=h,i[6]=a,i[7]=u,i[8]=m;return}return[s,c,f,l,d,h,a,u,m]}if(o){i[0]=s,i[1]=c,i[2]=l,i[3]=d,i[4]=a,i[5]=u;return}return[s,c,l,d,a,u]}toArray(e,i){const r=this.elements,o=!!i,s=r[0],l=r[1],a=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],m=r[8];if(o){i[0]=s,i[1]=l,i[2]=a,i[3]=c,i[4]=d,i[5]=u,i[6]=f,i[7]=h,i[8]=m;return}return[s,l,a,c,d,u,f,h,m]}if(o){i[0]=s,i[1]=l,i[2]=a,i[3]=c,i[4]=d,i[5]=u;return}return[s,l,a,c,d,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new en().copy(this)}};S(Fc,"Identity",[1,0,0,0,1,0,0,0,1]);var ki=Fc;fc(ki);var Vc=class Fa extends Ji{constructor(){super(),S(this,"_flagMatrix",!0),S(this,"_flagScale",!1),S(this,"_matrix",null),S(this,"_worldMatrix",null),S(this,"_position",null),S(this,"_rotation",0),S(this,"_scale",1),S(this,"_skewX",0),S(this,"_skewY",0);for(let e in po)Object.defineProperty(this,e,po[e]);this._renderer.flagMatrix=Mc.bind(this),this.isShape=!0,this.matrix=new ki,this.worldMatrix=new ki,this.position=new re,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const i=new Fa().copy(e);return"id"in e&&(i.id=e.id),i}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return po.position.get.apply(this,arguments)}set translation(e){po.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&"visible"in this&&this.visible===!1||!s&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const a=this.getBoundingClientRect();return a?e>=a.left-l&&e<=a.right+l&&i>=a.top-l&&i<=a.bottom+l:!1}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof re?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){const i=new Fa;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof re?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof re?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Vc,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var zn=Vc,po={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(ee.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(ee.Types.change,this._renderer.flagMatrix),Mc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Ps(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Mc(){this._flagMatrix=!0}var Ic=/^(?:none|transparent)$/i,$y=8,Ws=Number.EPSILON;function Dn(t,e){return{x:t,y:e}}function go(t,e,i=Ws){return Math.abs(t.x-e.x)<=i&&Math.abs(t.y-e.y)<=i}function Ac(t,e,i,r){const o=t*i+e*r,s=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+r*r)||1e-12;let l=Math.acos(Math.max(-1,Math.min(1,o/s)));return t*r-e*i<0&&(l=-l),l}function Ey(t,e,i){if(!t)return[Dn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Dn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,l=e.largeArcFlag?1:0,a=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=t.x,d=t.y,u=e.x,f=e.y,h=(c-u)/2,m=(d-f)/2,p=Math.cos(s),g=Math.sin(s);let b=p*h+g*m,y=-g*h+p*m,_=r*r,k=o*o;const x=b*b/_+y*y/k;if(x>1){const O=Math.sqrt(x);r*=O,o*=O,_=r*r,k=o*o}const v=_*y*y+k*b*b,N=v===0?0:(_*k-v)/v;let w=Math.sqrt(Math.max(0,N));l===a&&(w=-w);const T=w*r*y/o,C=-w*o*b/r,$=p*T-g*C+(c+u)/2,E=g*T+p*C+(d+f)/2,V=Ac(1,0,(b-T)/r,(y-C)/o),P=Ac((b-T)/r,(y-C)/o,(-b-T)/r,(-y-C)/o)%tt,I=V+P,K=a===0,J=(()=>{const O=I-V,z=Math.abs(O)<Number.EPSILON;let M=ot(O,tt);return M<Number.EPSILON&&(M=z?0:tt),K&&!z&&(M=M===tt?-tt:M-tt),M})(),Z=Math.max(kt.Resolution,Math.max(i*2,1)),L=[];for(let O=1;O<=Z;O++){const z=O/Z,M=V+z*J;let R=$+r*Math.cos(M),W=E+o*Math.sin(M);if(s!==0){const U=R-$,G=W-E,X=Math.cos(s),j=Math.sin(s);R=U*X-G*j+$,W=U*j+G*X+E}L.push(Dn(R,W))}return L}function Ry(t,e=$y){const i=[],r=[],o=t._renderer&&t._renderer.vertices&&t._renderer.vertices.length>0?t._renderer.vertices:t.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let l=null,a=null,c=null,d=null;const u=(h=!1)=>{if(l){if(h&&a&&c&&!go(a,c)){const m=Dn(a.x,a.y);r.push({a:c,b:m}),l.push(m),c=m}l.length>=3&&a&&c&&go(a,c)&&i.push(l),l=null,a=null,c=null}},f=h=>{if(!c){c=h,l&&l.push(h);return}go(c,h)||(r.push({a:c,b:h}),l&&l.push(h),c=h)};for(let h=0;h<o.length;h++){const m=o[h],p=m.command||(h===0?ie.move:ie.line);if(p===ie.move){u(!1);const g=Dn(m.x,m.y);l=[g],a=g,c=g,d=m;continue}if(d||(d=o[Math.max(h-1,0)]),p===ie.line)f(Dn(m.x,m.y));else if(p===ie.curve){const g=Ls(m,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Dn(y.x,y.y))}f(Dn(m.x,m.y))}else if(p===ie.arc){const g=Ey(d,m,s);for(let b=0;b<g.length;b++)f(g[b])}else if(p===ie.close){u(!0),d=m;continue}else f(Dn(m.x,m.y));d=m}if(l){const h=!!t._closed||!!t.closed||a&&c&&!go(a,c);u(h)}return{polygons:i,segments:r}}function Py(t,e,i){let r=!1;for(let o=0;o<t.length;o++){const s=t[o];if(!s||s.length<3)continue;let l=s.length-1;for(let a=0;a<s.length;a++){const c=s[l],d=s[a];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),l=a}}return r}function Fy(t,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<Ws&&Math.abs(s)<Ws){const h=t-i.x,m=e-i.y;return h*h+m*m}const l=((t-i.x)*o+(e-i.y)*s)/(o*o+s*s),a=Math.max(0,Math.min(1,l)),c=i.x+a*o,d=i.y+a*s,u=t-c,f=e-d;return u*u+f*f}function Vy(t,e,i){if(!t||t.length===0)return 1/0;let r=1/0;for(let o=0;o<t.length;o++){const s=t[o],l=Fy(e,i,s.a,s.b);l<r&&(r=l)}return Math.sqrt(r)}function My(t,e){if(typeof e=="boolean")return e;const i=t.fill;return!i&&i!==0?!1:typeof i=="string"?!Ic.test(i):!0}function Iy(t,e){const i=typeof t.linewidth=="number"?t.linewidth:t._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=t.stroke;return!r&&r!==0?!1:typeof r=="string"?!Ic.test(r):!0}function Ay(t,e,i,r=0){if(!t)return!1;const o=t.left-r,s=t.right+r,l=t.top-r,a=t.bottom+r;return e>=o&&e<=s&&i>=l&&i<=a}var yo=Number.EPSILON;function bo(t){return typeof t.relative!="boolean"||!!t.relative}function un(t,e,i,r){const o=t.controls;if(!(!o||!o[e])){if(Math.abs(i)<yo&&Math.abs(r)<yo){bo(t)?o[e].clear():o[e].set(t.x,t.y);return}bo(t)?o[e].set(i,r):o[e].set(t.x+i,t.y+r)}}function Ht(t,e){un(t,e,0,0)}function Oy(t,e){const i=t.controls;return!i||!i[e]?{x:0,y:0}:bo(t)?{x:i[e].x,y:i[e].y}:{x:i[e].x-t.x,y:i[e].y-t.y}}function er(t,e){const i=Oy(t,e);return Math.abs(i.x)>yo||Math.abs(i.y)>yo}function _o(t){t.command===ie.move||t.command===ie.close||(t.command=er(t,"left")||er(t,"right")?ie.curve:ie.line)}function Oc(t,e){typeof e.relative=="boolean"&&(t.relative=e.relative)}function zy(t,e){return er(e,"right")||er(t,"left")||er(t,"right")||er(e,"left")||t.command===ie.curve||e.command===ie.curve}function tr(t,e,i){return{x:Ft(t.x,e.x,i),y:Ft(t.y,e.y,i)}}function zc(t,e){const i=t.controls&&t.controls[e];return i?bo(t)?{x:t.x+i.x,y:t.y+i.y}:{x:i.x,y:i.y}:{x:t.x,y:t.y}}function Dy(t,e,i){const r=t.controls&&t.controls.right,o=e.controls&&e.controls.left,s={x:t.x,y:t.y},l=r?zc(t,"right"):$r({},s),a={x:e.x,y:e.y},c=o?zc(e,"left"):$r({},a),d=tr(s,l,i),u=tr(l,c,i),f=tr(c,a,i),h=tr(d,u,i),m=tr(u,f,i),p=tr(h,m,i),g=new $e(p.x,p.y);return Oc(g,t),un(g,"left",h.x-p.x,h.y-p.y),un(g,"right",m.x-p.x,m.y-p.y),g.command=ie.curve,{anchor:g,startOut:d,endIn:f}}function Ly(t,e,i,r,o,s){const l=t.length,a=i-e+1;let c=a-1,d=o?Math.min(a,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,l-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let w=0,T=e-u;w<=c;w+=1,T+=1){const C=ot(T,l);h[w]=t[C]}let m=h[0].x+2*h[1].x,p=h[0].y+2*h[1].y,g=2;const b=c-1,y=[m],_=[p],k=[g],x=new Array(c+1),v=new Array(c+1);for(let w=1;w<c;w+=1){const T=w<b,C=T||s?1:2,$=T?4:s?2:7,E=T?4:s?3:8,V=T?2:s?0:1,P=C/g;g=k[w]=$-P,m=y[w]=E*h[w].x+V*h[w+1].x-P*m,p=_[w]=E*h[w].y+V*h[w+1].y-P*p}x[b]=y[b]/k[b],v[b]=_[b]/k[b];for(let w=c-2;w>=0;w-=1)x[w]=(y[w]-x[w+1])/k[w],v[w]=(_[w]-v[w+1])/k[w];x[c]=(3*h[c].x-x[b])/2,v[c]=(3*h[c].y-v[b])/2;const N=c-f;for(let w=u,T=e;w<=N;w+=1,T+=1){const C=ot(T,l),$=t[C],E=x[w]-$.x,V=v[w]-$.y;o||w<N?un($,"right",E,V):Ht($,"right"),o||w>u?un($,"left",-E,-V):Ht($,"left"),_o($)}}function Hy(t,e,i,r,o,s){const l=e||t,a=t,c=i||t,d=re.distanceBetween(l,a),u=re.distanceBetween(a,c),f=r===void 0?.5:r,h=Math.pow(d,f),m=Math.pow(u,f),p=h*h,g=m*m;if(!o&&e){const b=2*g+3*m*h+p,y=3*m*(m+h);if(y!==0){const _=(g*l.x+b*a.x-p*c.x)/y-a.x,k=(g*l.y+b*a.y-p*c.y)/y-a.y;un(t,"left",_,k)}else Ht(t,"left")}else Ht(t,"left");if(!s&&i){const b=2*p+3*h*m+g,y=3*h*(h+m);if(y!==0){const _=(p*c.x+b*a.x-g*l.x)/y-a.x,k=(p*c.y+b*a.y-g*l.y)/y-a.y;un(t,"right",_,k)}else Ht(t,"right")}else Ht(t,"right");_o(t)}function Wy(t,e,i,r,o,s){if(!(e&&i)){e||Ht(t,"left"),i||Ht(t,"right"),_o(t);return}const l=e,a=t,c=i,d=re.distanceBetween(l,a),u=re.distanceBetween(a,c),f=d+u,h=r===void 0?.4:r,m={x:l.x-c.x,y:l.y-c.y};if(!o&&f!==0){const p=h*d/f;un(t,"left",m.x*p,m.y*p)}else Ht(t,"left");if(!s&&f!==0){const p=h*d/f-h;un(t,"right",m.x*p,m.y*p)}else Ht(t,"right");_o(t)}function jy(t,e,i,r,o,s){const l=s.type,a=s.factor,c=t.length;for(let d=e;d<=i;d+=1){const u=ot(d,c),f=t[u];if(f.command===ie.move){Ht(f,"left"),Ht(f,"right");continue}const h=d===e&&!o?null:d-1,m=d===i&&!o?null:d+1,p=h===null?null:t[ot(h,c)],g=m===null?null:t[ot(m,c)],b=h===null,y=m===null;l==="geometric"?Wy(f,p,g,a,b,y):Hy(f,p,g,a,b,y)}}var nr=Math.min,ir=Math.max,qy=Math.ceil,Xy=Math.floor,Yy=new re,Uy=new ki,js=class gi extends zn{constructor(e,i,r,o){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagCap",!0),S(this,"_flagJoin",!0),S(this,"_flagMiter",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in Dc)Object.defineProperty(this,s,Dc[s]);this._renderer.type="path",this._renderer.flagVertices=Lc.bind(this),this._renderer.bindVertices=Hc.bind(this),this._renderer.unbindVertices=Wc.bind(this),this._renderer.flagFill=jc.bind(this),this._renderer.flagStroke=qc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:xi(e.fill),r=typeof e.stroke=="string"?e.stroke:xi(e.stroke),o=new gi().copy(Rs($r({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof $e?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new $e().copy(r))}}for(let i=0;i<gi.Properties.length;i++){const r=gi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new gi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<gi.Properties.length;r++){const o=gi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(i=>i.toObject()),oe.each(gi.Properties,i=>{typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind(),i.controls&&(i.controls.left&&typeof i.controls.left.unbind=="function"&&i.controls.left.unbind(),i.controls.right&&typeof i.controls.right.unbind=="function"&&i.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),i=e.width/2,r=e.height/2,o=e.left+e.width/2,s=e.top+e.height/2;for(let l=0;l<this.vertices.length;l++){const a=this.vertices[l];a.x-=o,a.y-=s,a.x+=i,a.y+=r}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=i,this.mask.translation.y-=s,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o];s.x-=i,s.y-=r}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getBoundingClientRect(e){let i,r,o,s,l,a,c=1/0,d=-1/0,u=1/0,f=-1/0;if(this._update(!0),i=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:h,scaleY:m}=wi(i.elements[0],i.elements[3],i.elements[1],i.elements[4],i.elements[2],i.elements[5]);typeof h=="number"&&typeof m=="number"&&(r=Math.max(h,m)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(s=0;s<o;s++){a=this._renderer.vertices[s],l=this._renderer.vertices[(s+o-1)%o];const[h,m]=i.multiply(l.x,l.y),[p,g]=i.multiply(a.x,a.y);if(l.controls&&a.controls){let b=l.controls.right.x,y=l.controls.right.y;l.relative&&(b+=l.x,y+=l.y);let[_,k]=i.multiply(b,y),x=a.controls.left.x,v=a.controls.left.y;a.relative&&(x+=a.x,v+=a.y);let[N,w]=i.multiply(x,v);const T=yc(h,m,_,k,N,w,p,g);u=nr(T.min.y-r,u),c=nr(T.min.x-r,c),d=ir(T.max.x+r,d),f=ir(T.max.y+r,f)}else s<=1&&(u=nr(m-r,u),c=nr(h-r,c),d=ir(h+r,d),f=ir(m+r,f)),u=nr(g-r,u),c=nr(p-r,c),d=ir(p+r,d),f=ir(g+r,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&this.visible===!1||!s&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const a=this.getBoundingClientRect();if(!a||e<a.left-l||e>a.right+l||i<a.top-l||i>a.bottom+l)return!1;const c=this.worldMatrix,d=c&&c.inverse(Uy);if(!d)return super.contains(e,i,o);const[u,f]=d.multiply(e,i,1),h=typeof o.precision=="number"&&!Number.isNaN(o.precision)?Math.max(1,Math.floor(o.precision)):8,m=My(this,o.fill),p=Iy(this,o.stroke),{polygons:g,segments:b}=Ry(this,h);if(m&&g.length>0&&Py(g,u,f))return!0;if(p&&b.length>0){const y=typeof this.linewidth=="number"?this.linewidth:0;if(y>0&&Vy(b,u,f)<=y/2+l)return!0}return!m&&!p?super.contains(e,i,o):m&&g.length===0?super.contains(e,i,o):!1}getPointAt(e,i){let r,o,s,l,a,c,d,u,f,h,m,p,g,b,y,_=this.length*Math.min(Math.max(e,0),1);const k=this.vertices.length,x=k-1;let v=null,N=null;for(let Z=0,L=this._lengths.length,O=0;Z<L;Z++){if(O+this._lengths[Z]>=_){this._closed?(r=ot(Z,k),o=ot(Z-1,k),Z===0&&(r=o,o=Z)):(r=Z,o=Math.min(Math.max(Z-1,0),x)),v=this.vertices[r],N=this.vertices[o],_-=O,this._lengths[Z]!==0?e=_/this._lengths[Z]:e=0;break}O+=this._lengths[Z]}if(v===null||N===null)return null;if(v){if(!N)return v}else return N;y=N.controls&&N.controls.right,b=v.controls&&v.controls.left,a=N.x,h=N.y,c=(y||N).x,m=(y||N).y,d=(b||v).x,p=(b||v).y,u=v.x,g=v.y,y&&N.relative&&(c+=N.x,m+=N.y),b&&v.relative&&(d+=v.x,p+=v.y),l=Er(e,a,c,d,u),f=Er(e,h,m,p,g);const w=Ft(a,c,e),T=Ft(h,m,e),C=Ft(c,d,e),$=Ft(m,p,e),E=Ft(d,u,e),V=Ft(p,g,e),P=Ft(w,C,e),I=Ft(T,$,e),K=Ft(C,E,e),J=Ft($,V,e);return oe.isObject(i)?(i.x=l,i.y=f,i instanceof $e&&(i.controls.left.x=P,i.controls.left.y=I,i.controls.right.x=K,i.controls.right.y=J,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=l,i.controls.left.y-=f,i.controls.right.x-=l,i.controls.right.y-=f)),i.t=e,i):(s=new $e(l,f,P-l,I-f,K-l,J-f,this._curved?ie.curve:ie.line),s.t=e,s)}plot(){if(this.curved)return _c(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ie.move:ie.line;return this}smooth(e){const i=e||{},r=i.type||"continuous",o=this._collection,s=o.length;if(s<2)return this;const l=this._closed||s>0&&o[s-1]&&o[s-1].command===ie.close,a=(h,m)=>{if(h==null)return m;if(typeof h=="number"){if(l)return ot(h,s);let g=h;return g<0&&(g+=s),Math.min(Math.max(g,0),s-1)}const p=o.indexOf(h);return p!==-1?p:m},c=l&&i.from===void 0&&i.to===void 0;let d=a(i.from,0),u=a(i.to,s-1);if(d>u)if(l)d-=s;else{const h=d;d=u,u=h}const f=u-d+1;for(let h=0;h<f;h+=1){const m=ot(d+h,s),p=o[m],g=!l&&m===0;p.command===ie.move&&!g&&(p.command=ie.line)}if(r==="continuous"||r==="asymmetric")Ly(o,d,u,l,c,r==="asymmetric");else if(r==="catmull-rom"||r==="geometric"){const h={type:r,factor:i.factor};jy(o,d,u,l,c,h)}else throw new Error(`Path.smooth does not support type "${r}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(e){this._update();const i=this.vertices,r=i.length;if(r<2)return this;const o=[];let s=null,l=null;for(let a=0;a<r;a+=1){const c=i[a];if(!s||c.command===ie.move){const u=c.clone();o.push(u),s=c,l=c;continue}if(zy(c,s)){const f=Ls(c,s,e).length,h=o[o.length-1];let m=h.clone(),p=c.clone(),g=h,b=0;if(f<=1){const y=c.clone();o.push(y)}else{for(let _=1;_<f;_+=1){const k=_/f,x=1-b,v=x<=Number.EPSILON?k:(k-b)/x,N=Dy(m,p,v);un(g,"right",N.startOut.x-g.x,N.startOut.y-g.y);const w=N.anchor;o.push(w),g=w,m=w.clone(),b=k,un(p,"left",N.endIn.x-p.x,N.endIn.y-p.y)}const y=c.clone();y.controls.left.copy(p.controls.left),o.push(y)}}else{const u=Ls(c,s,e);for(let h=1;h<u.length;h+=1){const m=u[h];Oc(m,s),Ht(m,"left"),Ht(m,"right"),m.command=ie.line,o.push(m)}const f=c.clone();o.push(f)}s=c,c.command===ie.close&&(s=l)}return this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,i){i||this._update();const o=this.vertices.length-1;let s=this.vertices[o],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),oe.each(this.vertices,function(a,c){if(c<=0||a.command===ie.move){s=a,this._lengths[c]=0;return}this._lengths[c]=Rc(a,s,e),l+=this._lengths[c],s=a},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,i=this._closed,r=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),s=mo(this,r*this._length),l=mo(this,o*this._length),a=qy(s),c=Xy(l);let d,u,f,h,m,p;for(this._renderer.vertices.length=0,p=0;p<e;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new $e),p>c&&!u?(m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,m),m.command=this._renderer.collection[p].command,this._renderer.vertices.push(m),u=m,f=this._collection[p-1],f&&f.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),f.relative?this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(re.zero,1-m.t):this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(f,1-m.t))):p>=a&&p<=c&&(m=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(m),p===c&&Ec(this,o)?(u=m,!i&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):p===a&&Ec(this,r)&&(d=m,d.command=ie.move,!i&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));a>0&&!d&&(p=a-1,m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(r,m),m.command=ie.move,this._renderer.vertices.unshift(m),h=this._collection[p+1],h&&h.controls&&(m.controls.left.clear(),h.relative?this._renderer.collection[p+1].controls.left.copy(h.controls.left).lerp(re.zero,m.t):(Yy.copy(h),this._renderer.collection[p+1].controls.left.copy(h.controls.left).lerp(h,m.t))))}return zn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,zn.prototype.flagReset.call(this),this}};S(js,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(js,"Utils",{getCurveLength:Rc});var Re=js,Dc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";oe.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),t instanceof ri?this._collection=t:this._collection=new ri(t||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Lc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Hc(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Wc(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function jc(){this._flagFill=!0}function qc(){this._flagStroke=!0}var Xc=class to extends Re{constructor(e,i,r,o){const s=[new $e,new $e,new $e,new $e];super(s,!0,!1,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_origin",null),this._renderer.type="rectangle";for(let l in Yc)Object.defineProperty(this,l,Yc[l]);this.width=typeof r=="number"?r:1,this.height=typeof o=="number"?o:1,this.origin=new re,typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i),this._update()}static fromObject(e){const i=new to().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<to.Properties.length;i++){const r=to.Properties[i];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof re&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,i=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new $e),this.vertices[0].set(-e,-i).sub(this._origin).command=ie.move,this.vertices[1].set(e,-i).sub(this._origin).command=ie.line,this.vertices[2].set(e,i).sub(this._origin).command=ie.line,this.vertices[3].set(-e,i).sub(this._origin).command=ie.line,this.vertices[4]&&(this.vertices[4].set(-e,-i).sub(this._origin).command=ie.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=new to(0,0,this.width,this.height);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];i[o]instanceof re?i[o].copy(this[o]):i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="rectangle",e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}};S(Xc,"Properties",["width","height","origin"]);var si=Xc,Yc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(ee.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(ee.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Uc=class no extends si{constructor(e,i,r,o,s,l){super(i,r,0,0),S(this,"_flagTexture",!1),S(this,"_flagColumns",!1),S(this,"_flagRows",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_texture",null),S(this,"_columns",1),S(this,"_rows",1),S(this,"_frameRate",0),S(this,"_index",0),S(this,"_origin",null),this._renderer.type="sprite";for(let a in Kc)Object.defineProperty(this,a,Kc[a]);this.noStroke(),this.noFill(),e instanceof De?this.texture=e:typeof e=="string"&&(this.texture=new De(e)),this.origin=new re,this._update(),typeof o=="number"&&(this.columns=o),typeof s=="number"&&(this.rows=s),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(e){const i=new no().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<no.Properties.length;i++){const r=no.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const i=new no(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&i.play(this._firstFrame,this._lastFrame),i.loop=this.loop,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,i=this._columns,r=this._rows;let o,s,l,a,c,d,u,f,h;if(e&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=e),e.loaded)){u=e.image.width,f=e.image.height,o=u/i,s=f/r,a=this._amount,this.width!==o&&(this.width=o),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(oe.isNaN(this._lastFrame)&&(this._lastFrame=a-1),l=oe.performance.now()-this._startTime,h=this._lastFrame+1,c=1e3*(h-this._firstFrame)/this._frameRate,this._loop?l=l%c:l=Math.min(l,c),d=Ft(this._firstFrame,h,l/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%i,p=Math.floor(this._index/i),g=-o*m+(u-o)/2,b=-s*p+(f-s)/2;g!==e.offset.x&&(e.offset.x=g),b!==e.offset.y&&(e.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(Uc,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var wo=Uc,Kc={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},qs,Gc=class extends ri{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),ac(this,qs,{}),this.attach(e),this.on(ee.Types.insert,this.attach),this.on(ee.Types.remove,this.detach)}get ids(){return Dt(this,qs)}attach(e){for(let i=0;i<e.length;i++){const r=e[i];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let i=0;i<e.length;i++)delete this.ids[e[i].id];return this}};qs=new WeakMap;var Zc=class qi extends Re{constructor(e,i,r,o,s,l,a){const c=a||kt.Resolution*3,d=[];for(let u=0;u<c;u++)d.push(new $e);super(d,!0,!1,!0),S(this,"_flagStartAngle",!1),S(this,"_flagEndAngle",!1),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_startAngle",0),S(this,"_endAngle",tt),S(this,"_innerRadius",0),S(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let u in Qc)Object.defineProperty(this,u,Qc[u]);typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.startAngle=s),typeof l=="number"&&(this.endAngle=l),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new qi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<qi.Properties.length;i++){const r=qi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,i=this._endAngle,r=this._innerRadius,o=this._outerRadius,s=ot(e,tt)===ot(i,tt),l=r>0,a=this.vertices;let c=l?a.length/2:a.length,d,u=0,f,h,m,p,g,b,y,_,k;for(s?c--:l||(c-=2),f=0,h=c-1;f<c;f++){switch(m=f/h,p=a[u],g=m*(i-e)+e,b=(i-e)/c,y=o*Math.cos(g),_=o*Math.sin(g),f){case 0:d=ie.move;break;default:d=ie.curve}p.command=d,p.x=y,p.y=_,p.controls.left.clear(),p.controls.right.clear(),p.command===ie.curve&&(k=o*b/Math.PI,p.controls.left.x=k*Math.cos(g-dt),p.controls.left.y=k*Math.sin(g-dt),p.controls.right.x=k*Math.cos(g+dt),p.controls.right.y=k*Math.sin(g+dt),f===1&&p.controls.left.multiplyScalar(2),f===h&&p.controls.right.multiplyScalar(2)),u++}if(l){for(s?(a[u].command=ie.close,u++):(c--,h=c-1),f=0;f<c;f++)m=f/h,p=a[u],g=(1-m)*(i-e)+e,b=(i-e)/c,y=r*Math.cos(g),_=r*Math.sin(g),d=ie.curve,f<=0&&(d=s?ie.move:ie.line),p.command=d,p.x=y,p.y=_,p.controls.left.clear(),p.controls.right.clear(),p.command===ie.curve&&(k=r*b/Math.PI,p.controls.left.x=k*Math.cos(g+dt),p.controls.left.y=k*Math.sin(g+dt),p.controls.right.x=k*Math.cos(g-dt),p.controls.right.y=k*Math.sin(g-dt),f===1&&p.controls.left.multiplyScalar(2),f===h&&p.controls.right.multiplyScalar(2)),u++;a[u].copy(a[0]),a[u].command=ie.line}else s||(a[u].command=ie.line,a[u].x=0,a[u].y=0,u++,a[u].copy(a[0]),a[u].command=ie.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.startAngle,s=this.endAngle,l=this.vertices.length,a=new qi(0,0,i,r,o,s,l);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let c=0;c<Re.Properties.length;c++){const d=Re.Properties[c];a[d]=this[d]}return e&&e.add(a),a}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let i=0;i<qi.Properties.length;i++){const r=qi.Properties[i];e[r]=this[r]}return e}};S(Zc,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Xs=Zc,Qc={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},Ys=Math.cos,Us=Math.sin,Jc=class Xi extends Re{constructor(e,i,r,o){const s=o?Math.max(o,2):4,l=[];for(let a=0;a<s;a++)l.push(new $e(0,0,0,0,0,0));super(l,!0,!0,!0),S(this,"_flagRadius",!1),S(this,"_radius",0),this._renderer.type="circle";for(let a in ed)Object.defineProperty(this,a,ed[a]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Xi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Xi.Properties.length;i++){const r=Xi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,o=r*i;for(let s=0;s<this.vertices.length;s++){const a=s/e*tt,c=r*Ys(a),d=r*Us(a),u=o*Ys(a-dt),f=o*Us(a-dt),h=o*Ys(a+dt),m=o*Us(a+dt),p=this.vertices[s];p.command=s===0?ie.move:ie.curve,p.set(c,d),p.controls.left.set(u,f),p.controls.right.set(h,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=new Xi(0,0,this.radius,this.vertices.length);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let i=0;i<Xi.Properties.length;i++){const r=Xi.Properties[i];e[r]=this[r]}return e}};S(Jc,"Properties",["radius"]);var xo=Jc,ed={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Ks=Math.cos,Gs=Math.sin,td=class Yi extends Re{constructor(e,i,r,o,s){typeof o!="number"&&typeof r=="number"&&(o=r);const l=s?Math.max(s,2):4,a=[];for(let c=0;c<l;c++)a.push(new $e);super(a,!0,!0,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),this._renderer.type="ellipse";for(let c in nd)Object.defineProperty(this,c,nd[c]);typeof r=="number"&&(this.width=r*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Yi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Yi.Properties.length;i++){const r=Yi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,o=this._height/2;for(let s=0;s<this.vertices.length;s++){const a=s/e*tt,c=r*Ks(a),d=o*Gs(a),u=r*i*Ks(a-dt),f=o*i*Gs(a-dt),h=r*i*Ks(a+dt),m=o*i*Gs(a+dt),p=this.vertices[s];p.command=s===0?ie.move:ie.curve,p.set(c,d),p.controls.left.set(u,f),p.controls.right.set(h,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=this.width/2,r=this.height/2,o=this.vertices.length,s=new Yi(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let l=0;l<Re.Properties.length;l++){const a=Re.Properties[l];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let i=0;i<Yi.Properties.length;i++){const r=Yi.Properties[i];e[r]=this[r]}return e}};S(td,"Properties",["width","height"]);var ko=td,nd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},Ky=Math.ceil,Gy=Math.floor,id=class yi extends zn{constructor(e){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagSize",!0),S(this,"_flagSizeAttenuation",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_size",1),S(this,"_sizeAttenuation",!1),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0),S(this,"noFill",Re.prototype.noFill),S(this,"noStroke",Re.prototype.noStroke),S(this,"corner",Re.prototype.corner),S(this,"center",Re.prototype.center),S(this,"getBoundingClientRect",Re.prototype.getBoundingClientRect),S(this,"_updateLength",Re.prototype._updateLength);for(let i in rd)Object.defineProperty(this,i,rd[i]);this._renderer.type="points",this._renderer.flagVertices=Lc.bind(this),this._renderer.bindVertices=Hc.bind(this),this._renderer.unbindVertices=Wc.bind(this),this._renderer.flagFill=jc.bind(this),this._renderer.flagStroke=qc.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:xi(e.fill),r=typeof e.stroke=="string"?e.stroke:xi(e.stroke),o=new yi().copy(Rs($r({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof $e?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new $e().copy(r))}for(let i=0;i<yi.Properties.length;i++){const r=yi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new yi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<yi.Properties.length;r++){const o=yi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(i=>i.toObject()),oe.each(yi.Properties,function(i){typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(e){this._update();let i=[];for(let r=0;r<this.vertices.length;r++){const o=this.vertices[r],s=this.vertices[r-1];if(!s)continue;const l=o.x,a=o.y,c=s.x,d=s.y,u=Vs(l,a,l,a,c,d,c,d,e);i=i.concat(u)}return this.vertices=i,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),i=Math.max(this._beginning,this._ending),r=mo(this,e*this._length),o=mo(this,i*this._length),s=Ky(r),l=Gy(o);let a=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=s&&d<=l&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[a*2+0]=c.x,this._renderer.vertices[a*2+1]=c.y,a++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};S(id,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var Zs=id,rd={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),t instanceof ri?this._collection=t:this._collection=new ri(t||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},Zy=Math.cos,Qy=Math.sin,od=class Ui extends Re{constructor(e,i,r,o){o=Math.max(o||0,3),super(),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagSides",!1),S(this,"_radius",0),S(this,"_width",0),S(this,"_height",0),S(this,"_sides",0),this._renderer.type="polygon";for(let s in sd)Object.defineProperty(this,s,sd[s]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ui().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ui.Properties.length;i++){const r=Ui.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,l=tt*s+Math.PI/2,a=this._width*Zy(l)/2,c=this._height*Qy(l)/2;o>=r?this.vertices.push(new $e(a,c)):this.vertices[o].set(a,c),this.vertices[o].command=o===0?ie.move:ie.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=new Ui(0,0,0,this.sides);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.width=this.width,i.height=this.height,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let i=0;i<Ui.Properties.length;i++){const r=Ui.Properties[i];e[r]=this[r]}return e}};S(od,"Properties",["width","height","sides"]);var Qs=od,sd={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},ld=class Ki extends Re{constructor(e,i,r,o,s){typeof s>"u"&&typeof r=="number"&&typeof o=="number"&&(s=Math.floor(Math.min(r,o)/12));const l=[];for(let a=0;a<10;a++)l.push(new $e(0,0,0,0,0,0,a===0?ie.move:ie.curve));super(l),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagRadius",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let a in ad)Object.defineProperty(this,a,ad[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Jy.bind(this),typeof r=="number"&&(this.width=r),typeof o=="number"&&(this.height=o),(typeof s=="number"||s instanceof re)&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ki().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];if(r in e){const o=e[r];/radius/i.test(r)?this[r]=typeof o=="number"||o instanceof re?o:new re().copy(o):typeof o=="number"&&(this[r]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,i=this._height;let r,o;this._radius instanceof re?(r=this._radius.x,o=this._radius.y):(r=this._radius,o=this._radius);let s,l=e/2,a=i/2;s=this.vertices[0],s.x=-(l-r),s.y=-a,s=this.vertices[1],s.x=l-r,s.y=-a,s.controls.left.clear(),s.controls.right.x=r,s.controls.right.y=0,s=this.vertices[2],s.x=l,s.y=-(a-o),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=l,s.y=a-o,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=o,s=this.vertices[4],s.x=l-r,s.y=a,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(l-r),s.y=a,s.controls.left.clear(),s.controls.right.x=-r,s.controls.right.y=0,s=this.vertices[6],s.x=-l,s.y=a-o,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-l,s.y=-(a-o),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-o,s=this.vertices[8],s.x=-(l-r),s.y=-a,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[9],s.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=this.width,r=this.height,o=this.radius,s=new Ki(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let l=0;l<Re.Properties.length;l++){const a=Re.Properties[l];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};S(ld,"Properties",["width","height","radius"]);var Co=ld,ad={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof re&&this._radius.unbind(ee.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof re&&this._radius.bind(ee.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Jy(){this._flagRadius=!0}var e0=Math.cos,t0=Math.sin,cd=class Gi extends Re{constructor(e,i,r,o,s){arguments.length<=3&&(o=r,r=o/2),(typeof s!="number"||s<=0)&&(s=5),super(),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_flagSides",!1),S(this,"_innerRadius",0),S(this,"_outerRadius",0),S(this,"_sides",0),this._renderer.type="star";for(let l in dd)Object.defineProperty(this,l,dd[l]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Gi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,l=tt*s,a=(o%2?this._outerRadius:this._innerRadius)/2,c=a*e0(l),d=a*t0(l);o>=r?this.vertices.push(new $e(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?ie.move:ie.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.sides,s=new Gi(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let l=0;l<Re.Properties.length;l++){const a=Re.Properties[l];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];e[r]=this[r]}return e}};S(cd,"Properties",["innerRadius","outerRadius","sides"]);var Js=cd,dd={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},el,ud=Math.min,fd=Math.max;Ke.document&&(el=document.createElement("canvas"));var tl=class tn extends zn{constructor(e,i,r,o){super(),S(this,"_flagValue",!0),S(this,"_flagFamily",!0),S(this,"_flagSize",!0),S(this,"_flagLeading",!0),S(this,"_flagAlignment",!0),S(this,"_flagBaseline",!0),S(this,"_flagStyle",!0),S(this,"_flagWeight",!0),S(this,"_flagDecoration",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_flagDirection",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_value",""),S(this,"_family","sans-serif"),S(this,"_size",13),S(this,"_leading",17),S(this,"_alignment","center"),S(this,"_baseline","middle"),S(this,"_style","normal"),S(this,"_weight",500),S(this,"_decoration","none"),S(this,"_direction","ltr"),S(this,"_fill","#000"),S(this,"_stroke","none"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in hd)Object.defineProperty(this,s,hd[s]);if(this._renderer.type="text",this._renderer.flagFill=n0.bind(this),this._renderer.flagStroke=i0.bind(this),this.value=e,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!oe.isObject(o))return this;for(let s=0;s<tn.Properties.length;s++){const l=tn.Properties[s];l in o&&(this[l]=o[l])}}static Measure(e){if(el){const i=el.getContext("2d");i.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=i.measureText(e.value,0,0),o=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:o}}else{const i=this.value.length*this.size*tn.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:i,height:r}}}static fromObject(e){const i=typeof e.fill=="string"?e.fill:xi(e.fill),r=typeof e.stroke=="string"?e.stroke:xi(e.stroke),o=new tn().copy(Rs($r({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<tn.Properties.length;i++){const r=tn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new tn(this.value);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale;for(let r=0;r<tn.Properties.length;r++){const o=tn.Properties[r];i[o]=this[o]}return this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let i=0;i<tn.Properties.length;i++){const r=tn.Properties[i];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let i,r,o,s,l;this._update(!0),i=e?this.matrix:this.worldMatrix;const{width:a,height:c}=tn.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,o=a+d;break;case"right":r=-(a+d),o=d;break;default:r=-(a/2+d),o=a/2+d}switch(this.baseline){case"middle":s=-(c/2+d),l=c/2+d;break;default:s=-(c+d),l=d}const[u,f]=i.multiply(r,s),[h,m]=i.multiply(r,l),[p,g]=i.multiply(o,s),[b,y]=i.multiply(o,l);return s=ud(f,m,g,y),r=ud(u,h,p,b),o=fd(u,h,p,b),l=fd(f,m,g,y),{top:s,left:r,right:o,bottom:l,width:o-r,height:l-s}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};S(tl,"Ratio",.6),S(tl,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var Cn=tl,hd={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function n0(){this._flagFill=!0}function i0(){this._flagStroke=!0}var nl=class wr extends si{constructor(e,i,r,o){super(i,r,0,0),S(this,"_flagTextures",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_index",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_textures",null),S(this,"_frameRate",0),S(this,"_origin",null),this._renderer.type="image-sequence";for(let s in md)Object.defineProperty(this,s,md[s]);this._renderer.flagTextures=r0.bind(this),this._renderer.bindTextures=o0.bind(this),this._renderer.unbindTextures=s0.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(pd.bind(this)):typeof e=="string"&&(this.textures=[pd(e)]),this.origin=new re,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=wr.DefaultFrameRate,this.index=0}static fromObject(e){const i=new wr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<wr.Properties.length;i++){const r=wr.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const i=new wr(this.textures,this.translation.x,this.translation.y,this.frameRate);return i._loop=this._loop,this._playing&&i.play(),e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(i){return i.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const i=this.textures[e];typeof i.dispose=="function"?i.dispose():typeof i.unbind=="function"&&i.unbind()}return this}_update(){const e=this._textures;let i,r,o,s,l,a,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,oe.isNaN(this._lastFrame)&&(this._lastFrame=s-1),o=oe.performance.now()-this._startTime,d=this._lastFrame+1,l=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),c=Ft(this._firstFrame,d,o/l),c=Math.floor(c),c!==this._index&&(this._index=c,a=e[this._index],a.loaded&&(i=a.image.width,r=a.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r),this.fill=a,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof De))&&(a=e[this._index],a.loaded&&(i=a.image.width,r=a.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r)),this.fill=a)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(nl,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(nl,"DefaultFrameRate",30);var il=nl,md={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._textures=new ri((t||[]).slice(0)),this._textures.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function r0(){this._flagTextures=!0}function o0(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function s0(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function pd(t){if(t instanceof De)return t;if(typeof t=="string")return new De(t)}var vo=Math.min,So=Math.max,l0={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},rl=class an extends zn{constructor(e){super(),S(this,"_flagAdditions",!1),S(this,"_flagSubtractions",!1),S(this,"_flagOrder",!1),S(this,"_flagOpacity",!0),S(this,"_flagBeginning",!1),S(this,"_flagEnding",!1),S(this,"_flagLength",!1),S(this,"_flagMask",!1),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_length",0),S(this,"_mask",null),S(this,"_strokeAttenuation",!0);for(let i in gd)Object.defineProperty(this,i,gd[i]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let i=0;i<e.length;i++)yd.call(this,e[i],this)}static RemoveChildren(e){for(let i=0;i<e.length;i++)yd.call(this,e[i])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const i=new an;for(let o=0;o<an.Properties.length;o++){const s=an.Properties[o];s in e&&(/(fill|stroke)/i.test(s)?i[s]=typeof e[s]=="string"?e[s]:xi(e[s]):i[s]=e[s])}return"mask"in e&&(i.mask=r(e.mask)),"id"in e&&(i.id=e.id),i.children=e.children.map(r),i;function r(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return Xs.fromObject(o);case"circle":return xo.fromObject(o);case"element":return Ji.fromObject(o);case"ellipse":return ko.fromObject(o);case"group":return an.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return il.fromObject(o);case"path":return Re.fromObject(o);case"points":return Zs.fromObject(o);case"polygon":return Qs.fromObject(o);case"rectangle":return si.fromObject(o);case"rounded-rectangle":return Co.fromObject(o);case"shape":return zn.fromObject(o);case"sprite":return wo.fromObject(o);case"star":return Js.fromObject(o);case"text":return Cn.fromObject(o)}return o}}static IsVisible(e,i){if(!i)return!0;let r=e;for(;r;){if(typeof r.visible=="boolean"&&!r.visible||typeof r.opacity=="number"&&r.opacity<=0)return!1;r=r.parent}return!0}static VisitForHitTest(e,i,r,o,s,l,a){const c=e&&e.children;if(!c)return!1;const d=i.results;for(let u=c.length-1;u>=0;u--){const f=c[u];if(!f||!an.IsVisible(f,i.visibleOnly))continue;const h=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(h&&!Ay(h,i.x,i.y,l))){if(f instanceof an){if(r&&(!o||o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),a)||an.VisitForHitTest(f,i,r,o,s,l,a))return!0;continue}if(f instanceof zn&&!(o&&!o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),a))return!0}}return!1}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let i=0;i<an.Properties.length;i++){const r=an.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new an,r=this.children.map(function(o){return o.clone()});return i.add(r),i.opacity=this.opacity,this.mask&&(i.mask=this.mask),i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.className=this.className,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="group",e.children=[],e.opacity=this.opacity,e.className=this.className,e.mask=this.mask?this.mask.toObject():null,oe.each(this.children,(i,r)=>{e.children[r]=i.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const i=this.children[e];typeof i.dispose=="function"&&i.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(e,i,r){const o=r||{},{results:s,hitOptions:l,context:a,single:c,empty:d}=l0.getShapesAtPoint;s.length=0;const u=o.mode==="deepest"||o.deepest?"deepest":"all",f=o.visibleOnly!==!1,h=!!o.includeGroups,m=typeof o.filter=="function"?o.filter:null,p=typeof o.tolerance=="number"?o.tolerance:0;typeof o.precision=="number"?l.precision=o.precision:delete l.precision,typeof o.fill<"u"?l.fill=o.fill:delete l.fill,typeof o.stroke<"u"?l.stroke=o.stroke:delete l.stroke,l.tolerance=p,l.ignoreVisibility=!f;const g=u==="deepest";if(a.x=e,a.y=i,a.visibleOnly=f,a.results=s,an.VisitForHitTest(this,a,h,m,l,p,g),g){if(s.length>0){const y=s[0];return s.length=0,c[0]=y,c.length=1,c}return d.length=0,d}const b=s.slice();return s.length=0,b}corner(){const e=this.getBoundingClientRect(!0);for(let i=0;i<this.children.length;i++){const r=this.children[i];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const s=this.children[o];s.isShape&&(s.translation.x-=i,s.translation.y-=r)}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getById(e){let i=null;function r(o){if(o.id===e)return o;if(o.children){if(o.children.ids[e])return o.children.ids[e];for(let s=0;s<o.children.length;s++)if(i=r(o.children[s]),i)return i}return null}return r(this)}getByClassName(e){const i=[];function r(o){if(Array.prototype.indexOf.call(o.classList,e)>=0&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const l=o.children[s];r(l)}return i}return r(this)}getByType(e){const i=[];function r(o){if(o instanceof e&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const l=o.children[s];r(l)}return i}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let i=0;i<e.length;i++){const r=e[i];if(!(r&&r.id))continue;const o=Array.prototype.indexOf.call(this.children,r);o>=0&&this.children.splice(o,1),this.children.push(r)}return this}remove(e){const i=arguments.length,r=this.parent;if(i<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let o=0;o<e.length;o++){const s=e[o];if(!s||!this.children.ids[s.id])continue;const l=this.children.indexOf(s);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(e){let i,r,o,s,l,a;this._update(!0);let c=1/0,d=-1/0,u=1/0,f=-1/0;const h=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const p=this.children[m];if(!(!p.visible||h.test(p._renderer.type))&&(i=p.getBoundingClientRect(e),o=typeof i.top!="number"||oe.isNaN(i.top)||!isFinite(i.top),s=typeof i.left!="number"||oe.isNaN(i.left)||!isFinite(i.left),l=typeof i.right!="number"||oe.isNaN(i.right)||!isFinite(i.right),a=typeof i.bottom!="number"||oe.isNaN(i.bottom)||!isFinite(i.bottom),!(o||s||l||a)))if(e){const[g,b]=r.multiply(i.left,i.top),[y,_]=r.multiply(i.right,i.top),[k,x]=r.multiply(i.left,i.bottom),[v,N]=r.multiply(i.right,i.bottom);u=vo(b,_,x,N,u),c=vo(g,y,k,v,c),d=So(g,y,k,v,d),f=So(b,_,x,N,f)}else u=vo(i.top,u),c=vo(i.left,c),d=So(i.right,d),f=So(i.bottom,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}noFill(){return this.children.forEach(function(e){e.noFill()}),this}noStroke(){return this.children.forEach(function(e){e.noStroke()}),this}subdivide(){const e=arguments;return this.children.forEach(function(i){i.subdivide.apply(i,e)}),this}_update(){let e,i,r;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),l=this.length;let a=0;const c=o*l,d=s*l;for(e=0;e<this.children.length;e++)r=this.children[e],i=r.length,c>a+i?(r.beginning=1,r.ending=1):d<a?(r.beginning=0,r.ending=0):c>a&&c<a+i?(r.beginning=(c-a)/i,r.ending=1):d>a&&d<a+i?(r.beginning=0,r.ending=(d-a)/i):(r.beginning=0,r.ending=1),a+=i}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};S(rl,"Children",Gc),S(rl,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var pt=rl,gd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=pt.InsertChildren.bind(this),i=pt.RemoveChildren.bind(this),r=pt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new Gc(t),this._children.bind(ee.Types.insert,e),this._children.bind(ee.Types.remove,i),this._children.bind(ee.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=t)}}}};function yd(t,e){const i=t.parent;let r;if(i===e){o();return}if(i&&i.children.ids[t.id]&&(r=Array.prototype.indexOf.call(i.children,t),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete t.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,t),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,t),r<0&&(i.subtractions.push(t),i._flagSubtractions=!0)}}var Bo=class extends Re{constructor(e,i,r,o){const s=[new $e(e,i),new $e(r,o)];super(s);for(let l in bd)Object.defineProperty(this,l,bd[l]);this.vertices[0].command=ie.move,this.vertices[1].command=ie.line,this.automatic=!1}};S(Bo,"Properties",["left","right"]);var bd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(oe.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=ie.move;else{const e=new Lt("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(oe.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=ie.line;else{const e=new Lt("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},vn={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},a0={start:"left",middle:"center",end:"right"},_d=["id","class","transform","xmlns","viewBox"],c0=["x","y","width","height","href","xlink:href"];function d0(t){return a0[t]}function u0(t){const e=t.getAttribute("dominant-baseline"),i=t.getAttribute("alignment-baseline");return e||i}function Rr(t){return t.replace(/svg:/gi,"").toLowerCase()}function wd(t,e){if(e.x+=t.translateX,e.y+=t.translateY,e.x*=t.scaleX,e.y*=t.scaleY,t.rotation!==0){const i=e.length();e.x=i*Math.cos(t.rotation),e.y=i*Math.sin(t.rotation)}}function f0(t,e){e||(e={});const i=t.split(";");for(let r=0;r<i.length;r++){const o=i[r].split(":"),s=o[0],l=o[1];if(typeof s>"u"||typeof l>"u")continue;const a=s.replace(/\s/g,""),c=l.replace(/\s/g,"");e[a]=c}return e}function h0(t){const e={},i=m0(t),r=Math.max(i.length,t.style.length);for(let o=0;o<r;o++){const s=t.style[o],l=i[o];s&&(e[s]=t.style[s]),l&&(e[l]=t.getAttribute(l))}return e}function m0(t){const e=t.getAttributeNames();for(let i=0;i<_d.length;i++){const r=_d[i],o=Array.prototype.indexOf.call(e,r);o>=0&&e.splice(o,1)}return e}function p0(t,e){const i=e.split(/[\s,]/),r=-parseFloat(i[0]),o=-parseFloat(i[1]),s=parseFloat(i[2]),l=parseFloat(i[3]);if(r&&o)for(let f=0;f<t.children.length;f++){const h=t.children[f];"translation"in h?h.translation.add(r,o):"x"in h?h.x=r:"y"in h&&(h.y=o)}const a=typeof t.x=="number",c=typeof t.y=="number",d=typeof t.width=="number",u=typeof t.height=="number";return a&&(t.translation.x+=t.x),c&&(t.translation.y+=t.y),(d||u)&&(t.scale=new re(1,1)),d&&(t.scale.x=t.width/s),u&&(t.scale.y=t.height/l),t.mask=new si(0,0,s,l),t.mask.origin.set(-s/2,-l/2),t}function nn(t,e,i){const r={},o={},s={};let l,a,c,d,u,f,h,m,p,g,b,y,_,k,x,v,N;if(t===null)return r;if(Ke.getComputedStyle){const w=Ke.getComputedStyle(t);for(l=w.length;l--;)c=w[l],d=w[c],typeof d<"u"&&(r[c]=d)}for(l=0;l<t.attributes.length;l++)f=t.attributes[l],/style/i.test(f.nodeName)?f0(f.value,s):o[f.nodeName]=f.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),i&&oe.defaults(r,i),oe.extend(r,s,o),r.visible=!(typeof r.display>"u"&&/none/i.test(r.display))||typeof r.visibility>"u"&&/hidden/i.test(r.visibility);for(c in r)switch(d=r[c],c){case"gradientTransform":if(/none/i.test(d)||(a=t.gradientTransform&&t.gradientTransform.baseVal&&t.gradientTransform.baseVal.length>0?t.gradientTransform.baseVal[0].matrix:t.getCTM?t.getCTM():null,a===null))break;switch(h=wi(a),e._renderer.type){case"linear-gradient":wd(h,e.left),wd(h,e.right);break;case"radial-gradient":e.center.x+=h.translateX,e.center.y+=h.translateY,e.focal.x+=h.translateX,e.focal.y+=h.translateY,e.radius*=Math.max(h.scaleX,h.scaleY);break}break;case"transform":if(/none/i.test(d)||(a=t.transform&&t.transform.baseVal&&t.transform.baseVal.length>0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null,a===null))break;h=wi(a),e.translation.set(h.translateX,h.translateY),e.rotation=Math.PI*(h.rotation/180),e.scale=new re(h.scaleX,h.scaleY),m=parseFloat((r.x+"").replace("px")),p=parseFloat((r.y+"").replace("px")),m&&(e.translation.x=m),p&&(e.translation.y=p);break;case"visible":if(e instanceof pt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof pt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof pt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof pt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof pt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof pt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if(vn.cssBackgroundImage.test(d)&&(g=d.replace(vn.cssBackgroundImage,"$1"),Ue.defs.current&&Ue.defs.current.contains(g)&&(y=Ue.defs.current.get(g),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],_=Rr(y.nodeName),e.mask=Ue[_].call(this,y,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":u=(e instanceof pt?"_":"")+c,vn.cssBackgroundImage.test(d)?(g=d.replace(vn.cssBackgroundImage,"$1"),Ue.defs.current&&Ue.defs.current.contains(g)?(y=Ue.defs.current.get(g),y.object||(_=Rr(y.nodeName),y.object=Ue[_].call(this,y,{})),y=y.object):(b=y0(this),y=b.getById(g)),e[u]=y):e[u]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(k=e instanceof ut,x=e instanceof Ge,v=e instanceof Ze,k||x||v)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Lt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof Cn&&(e.family=d);break;case"font-size":e instanceof Cn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Lt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof Cn&&(e.weight=d);break;case"font-style":e instanceof Cn&&(e.style=d);break;case"text-decoration":e instanceof Cn&&(e.decoration=d);break;case"line-height":e instanceof Cn&&(e.leading=d);break}return Object.keys(t.dataset).length&&(e.dataset=t.dataset),r}function g0(t,e){for(let i=0,r=t.childNodes.length;i<r;i++){const o=t.childNodes[i];!o.id||Rr(t.nodeName)==="#text"||e.add(o.id,o)}}function y0(t){for(;t.parent;)t=t.parent;return t.scene}var Ue={svg:function(t){const e=Ue.defs.current=new fo,i=t.getElementsByTagName("defs");for(let p=0;p<i.length;p++)g0(i[p],e);const r=Ue.g.call(this,t),o=t.getAttribute("viewBox"),s=t.getAttribute("x"),l=t.getAttribute("y"),a=t.getAttribute("width"),c=t.getAttribute("height");r.defs=e;const d=o!==null,u=s!==null,f=l!==null,h=a!==null,m=c!==null;return u&&(r.x=parseFloat(s.replace(vn.unitSuffix,""))),f&&(r.y=parseFloat(l.replace(vn.unitSuffix,""))),h&&(r.width=parseFloat(a.replace(vn.unitSuffix,""))),m&&(r.height=parseFloat(c.replace(vn.unitSuffix,""))),d&&p0(r,o),delete Ue.defs.current,r},defs:function(t){return null},use:function(t,e){let i;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return i=new Lt("encountered <use /> with no href."),console.warn(i.name,i.message),null;const o=r.slice(1);if(!Ue.defs.current.contains(o))return i=new Lt("unable to find element for reference "+r+"."),console.warn(i.name,i.message),null;const l=Ue.defs.current.get(o).cloneNode(!0);for(let c=0;c<t.attributes.length;c++){const d=t.attributes[c],u=c0.includes(d.nodeName),f=!l.hasAttribute(d.nodeName);(u||f)&&l.setAttribute(d.nodeName,d.value)}const a=Rr(l.nodeName);return Ue[a].call(this,l,e)},g:function(t,e){const i=new pt;nn.call(this,t,i,e),this.add(i);const r=h0.call(this,t);for(let o=0,s=t.childNodes.length;o<s;o++){const l=t.childNodes[o],a=l.nodeName;if(!a)return;const c=Rr(a);if(c in Ue){const d=Ue[c].call(i,l,r);d&&!d.parent&&i.add(d)}}return i},polygon:function(t,e){let i;typeof t=="string"?i=t:i=t.getAttribute("points");const r=[];i.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(s,l,a){r.push(new $e(parseFloat(l),parseFloat(a)))});const o=new Re(r,!0);return o.stroke="none",o.fill="black",nn.call(this,t,o,e),o},polyline:function(t,e){const i=Ue.polygon.call(this,t,e);return i.closed=!1,i},path:function(t,e){let i;typeof t=="string"?(i=t,t=null):i=t.getAttribute("d");let r=[],o=!1,s=!1;if(i){let a=new $e,c,d,u=i.match(/[a-df-z][^a-df-z]*/gi);const f=u.length-1;oe.each(u.slice(0),function(h,m){const p=h.slice(1).trim().match(vn.path),g=h[0],b=g.toLowerCase();let y,_,k,x,v;const N=[];switch(m===0&&(u=[]),b){case"h":case"v":p.length>1&&(y=1);break;case"m":case"l":case"t":p.length>2&&(y=2);break;case"s":case"q":p.length>4&&(y=4);break;case"c":p.length>6&&(y=6);break;case"a":p.length>7&&(y=7);break}if(y){for(_=0,k=p.length,v=0;_<k;_+=y){if(x=g,v>0)switch(g){case"m":x="l";break;case"M":x="L";break}N.push(x+p.slice(_,_+y).join(" ")),v++}u=Array.prototype.concat.apply(u,N)}else u.push(h)}),oe.each(u,function(h,m){let p,g,b;const y=h[0],_=y.toLowerCase();d=h.slice(1).trim().match(vn.path),s=y===_;let k,x,v,N,w,T,C,$,E,V,P,I,K,J,Z,L,O;switch(_){case"z":if(m>=f)o=!0;else{g=a.x,b=a.y,p=new $e(g,b,void 0,void 0,void 0,void 0,ie.close);for(let z=r.length-1;z>=0;z--){const M=r[z];if(/m/i.test(M.command)){a=M;break}}}break;case"m":case"l":c=void 0,g=parseFloat(d[0]),b=parseFloat(d[1]),p=new $e(g,b,void 0,void 0,void 0,void 0,/m/i.test(_)?ie.move:ie.line),s&&p.addSelf(a),a=p;break;case"h":case"v":V=/h/i.test(_)?"x":"y",P=/x/i.test(V)?"y":"x",p=new $e(void 0,void 0,void 0,void 0,void 0,void 0,ie.line),p[V]=parseFloat(d[0]),p[P]=a[P],s&&(p[V]+=a[V]),a=p;break;case"c":case"s":k=a.x,x=a.y,c||(c=new re),/c/i.test(_)?(v=parseFloat(d[0]),N=parseFloat(d[1]),w=parseFloat(d[2]),T=parseFloat(d[3]),C=parseFloat(d[4]),$=parseFloat(d[5])):(E=Ms(a,c,s),v=E.x,N=E.y,w=parseFloat(d[0]),T=parseFloat(d[1]),C=parseFloat(d[2]),$=parseFloat(d[3])),s&&(v+=k,N+=x,w+=k,T+=x,C+=k,$+=x),a.controls.right.set(v-a.x,N-a.y),p=new $e(C,$,w-C,T-$,void 0,void 0,ie.curve),a=p,c=p.controls.left;break;case"t":case"q":k=a.x,x=a.y,c||(c=new re),/q/i.test(_)?(v=parseFloat(d[0]),N=parseFloat(d[1]),w=parseFloat(d[0]),T=parseFloat(d[1]),C=parseFloat(d[2]),$=parseFloat(d[3])):(E=Ms(a,c,s),v=E.x,N=E.y,w=E.x,T=E.y,C=parseFloat(d[0]),$=parseFloat(d[1])),s&&(v+=k,N+=x,w+=k,T+=x,C+=k,$+=x),a.controls.right.set((v-a.x)*.33,(N-a.y)*.33),p=new $e(C,$,w-C,T-$,void 0,void 0,ie.curve),a=p,c=p.controls.left;break;case"a":k=a.x,x=a.y,K=parseFloat(d[0]),J=parseFloat(d[1]),Z=parseFloat(d[2]),L=parseFloat(d[3]),O=parseFloat(d[4]),C=parseFloat(d[5]),$=parseFloat(d[6]),s&&(C+=k,$+=x),I=new $e(C,$),I.command=ie.arc,I.rx=K,I.ry=J,I.xAxisRotation=Z,I.largeArcFlag=L,I.sweepFlag=O,p=I,a=I,c=void 0;break}p&&(Array.isArray(p)?r=r.concat(p):r.push(p))})}i=new Re(r,o,void 0,!0),i.stroke="none",i.fill="black";const l=i.getBoundingClientRect(!0);return l.centroid={x:l.left+l.width/2,y:l.top+l.height/2},oe.each(i.vertices,function(a){a.subSelf(l.centroid)}),nn.call(this,t,i,e),i.translation.addSelf(l.centroid),i},circle:function(t,e){const i=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),o=parseFloat(t.getAttribute("r")),s=new xo(0,0,o);return s.stroke="none",s.fill="black",nn.call(this,t,s,e),s.translation.x=i,s.translation.y=r,s},ellipse:function(t,e){const i=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),o=parseFloat(t.getAttribute("rx")),s=parseFloat(t.getAttribute("ry")),l=new ko(0,0,o,s);return l.stroke="none",l.fill="black",nn.call(this,t,l,e),l.translation.x=i,l.translation.y=r,l},rect:function(t,e){const i=parseFloat(t.getAttribute("rx")),r=parseFloat(t.getAttribute("ry"));if(!oe.isNaN(i)||!oe.isNaN(r))return Ue["rounded-rect"](t);const o=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height")),l=o/2,a=s/2,c=new si(0,0,o,s);return c.stroke="none",c.fill="black",nn.call(this,t,c,e),c.translation.x+=l,c.translation.y+=a,c},"rounded-rect":function(t,e){const i=parseFloat(t.getAttribute("rx"))||0,r=parseFloat(t.getAttribute("ry"))||0,o=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height")),l=o/2,a=s/2,c=new re(i,r),d=new Co(0,0,o,s,c);return d.stroke="none",d.fill="black",nn.call(this,t,d,e),d.translation.x+=l,d.translation.y+=a,d},line:function(t,e){const i=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),o=parseFloat(t.getAttribute("x2")),s=parseFloat(t.getAttribute("y2")),l=new Bo(i,r,o,s).noFill();return nn.call(this,t,l,e),l},lineargradient:function(t,e){let i=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(t.getAttribute("x1")||0),s=parseFloat(t.getAttribute("y1")||0),l=parseFloat(t.getAttribute("x2")||0),a=parseFloat(t.getAttribute("y2")||0);const c=(l+o)/2,d=(a+s)/2;/userSpaceOnUse/i.test(i)&&(o-=c,s-=d,l-=c,a-=d);const u=[];for(let h=0;h<t.children.length;h++){const m=t.children[h];let p=m.getAttribute("offset");/%/gi.test(p)&&(p=parseFloat(p.replace(/%/gi,""))/100),p=parseFloat(p);let g=m.getAttribute("stop-color"),b=m.getAttribute("stop-opacity"),y=m.getAttribute("style"),_;g===null&&(_=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,g=_&&_.length>1?_[1]:void 0),b===null?(_=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=_&&_.length>1?parseFloat(_[1]):1):b=parseFloat(b),u.push(new oi(p,g,b))}const f=new Ge(o,s,l,a,u);return f.spread=r,f.units=i,nn.call(this,t,f,e),f},radialgradient:function(t,e){let i=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(t.getAttribute("cx"))||0,s=parseFloat(t.getAttribute("cy"))||0,l=parseFloat(t.getAttribute("r")),a=parseFloat(t.getAttribute("fx")),c=parseFloat(t.getAttribute("fy"));oe.isNaN(a)&&(a=o),oe.isNaN(c)&&(c=s);const d=Math.abs(o+a)/2,u=Math.abs(s+c)/2;/userSpaceOnUse/i.test(i)&&(o-=d,s-=u,a-=d,c-=u);const f=[];for(let m=0;m<t.children.length;m++){const p=t.children[m];let g=p.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let b=p.getAttribute("stop-color"),y=p.getAttribute("stop-opacity"),_=p.getAttribute("style"),k;b===null&&(k=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,b=k&&k.length>1?k[1]:void 0),y===null?(k=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=k&&k.length>1?parseFloat(k[1]):1):y=parseFloat(y),f.push(new oi(g,b,y))}const h=new Ze(o,s,l,f,a,c);return h.spread=r,h.units=i,nn.call(this,t,h,e),h},text:function(t,e){const i=d0(t.getAttribute("text-anchor"))||"left",r=u0(t)||"baseline";let o="";t.childNodes.length>0&&t.childNodes[0].tagName==="TSPAN"?o=t.childNodes[0].textContent:o=t.textContent;const s=new Cn(o);return nn.call(this,t,s,e),s.alignment=i,s.baseline=r,s},clippath:function(t,e){return Ue.defs.current&&!Ue.defs.current.contains(t.id)&&Ue.defs.current.add(t.id,t),null},image:function(t,e){let i;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return i=new Lt("encountered <image /> with no href."),console.warn(i.name,i.message),null;const o=parseFloat(t.getAttribute("x"))||0,s=parseFloat(t.getAttribute("y"))||0,l=parseFloat(t.getAttribute("width")),a=parseFloat(t.getAttribute("height")),c=new wo(r,o,s);return oe.isNaN(l)||(c.width=l),oe.isNaN(a)||(c.height=a),nn.call(this,t,c,e),c}};function xd(t,e){const i=new XMLHttpRequest;return i.open("GET",t),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&e(i.responseText)},i.send(),i}var ol=class An extends si{constructor(e,i,r,o,s,l){super(i,r,o||1,s||1),S(this,"_flagTexture",!1),S(this,"_flagMode",!1),S(this,"_texture",null),S(this,"_mode","fill"),this._renderer.type="image";for(let a in Cd)Object.defineProperty(this,a,Cd[a]);this.noStroke(),this.noFill(),e instanceof De?this.texture=e:typeof e=="string"&&(this.texture=new De(e)),typeof l=="string"&&(this.mode=l),this._update()}static fromObject(e){const i=new An().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<An.Properties.length;i++){const r=An.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new An(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const i=e.image.width,r=e.image.height,o=this.width,s=this.height,l=o/i,a=s/r;switch(this._mode){case An.Modes.fill:{const c=Math.max(l,a);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case An.Modes.fit:{const c=Math.min(l,a);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case An.Modes.crop:break;case An.Modes.tile:{e.offset.x=(i-o)/2,e.offset.y=(r-s)/2,e.repeat="repeat";break}case An.Modes.stretch:default:e.scale=new re(l,a),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};S(ol,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),S(ol,"Properties",["texture","mode"]);var kd=ol,Cd={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(t){this._mode=t,this._flagMode=!0}}},sl=[],ll=Math.max,b0=Math.min,vd=Math.abs,No=Math.sin,To=Math.cos,_0=Math.acos,$o=Math.sqrt,Fe={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(t){return t in Fe?t:"path"},group:{renderChild:function(t){const e=Fe.getRendererType(t._renderer.type);Fe[e].render.call(t,this.ctx,!0,this.clip)},render:function(t){if(!this._visible)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);const r=this._mask,o=Eo(e),s=!o||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,s&&(t.save(),o||t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const l=Fe.getRendererType(r._renderer.type);Fe[l].render.call(r,t,!0)}if(this._opacity>0&&this._scale!==0)for(let l=0;l<this.children.length;l++){const a=this.children[l],c=Fe.getRendererType(a._renderer.type);Fe[c].render.call(a,t)}return s&&t.restore(),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t,e,i){let r,o,s,l,a,c,d,u,f,h,m,p,g,b,y,_,k,x,v,N,w,T,C,$,E,V,P,I,K,J,Z,L,O,z;if(z=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,K=this._mask,J=this._clip,a=this._opacity*(z||1),c=this._visible,!e&&(!c||J||a===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,l=this._fill,d=this._cap,u=this._join,f=this._miter,h=this._closed,m=this._renderer.vertices,p=m.length,g=p-1,Z=Eo(r),O=this.dashes,Z||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),K){const q=Fe.getRendererType(K._renderer.type);Fe[q].render.call(K,t,!0)}if(l)if(typeof l=="string")t.fillStyle=l;else{const q=Fe.getRendererType(l._renderer.type);Fe[q].render.call(l,t,this),t.fillStyle=l._renderer.effect}if(o){if(typeof o=="string")t.strokeStyle=o;else{const q=Fe.getRendererType(o._renderer.type);Fe[q].render.call(o,t,this),t.strokeStyle=o._renderer.effect}s&&(t.lineWidth=kn(this)),f&&(t.miterLimit=f),u&&(t.lineJoin=u),!h&&d&&(t.lineCap=d)}typeof a=="number"&&(t.globalAlpha=a),O&&O.length>0&&(t.lineDashOffset=O.offset||0,t.setLineDash(O)),t.beginPath();let M,R,W,U,G,X,j;for(let q=0;q<p;q++)switch(_=m[q],P=_.x,I=_.y,_.command){case ie.close:t.closePath();break;case ie.arc:M=_.rx,R=_.ry,W=_.xAxisRotation,U=_.largeArcFlag,G=_.sweepFlag,b=h?ot(q-1,p):ll(q-1,0),y=m[b],X=y.x,j=y.y,Fe.renderSvgArcCommand(t,X,j,M,R,U,G,W,P,I);break;case ie.curve:b=h?ot(q-1,p):Math.max(q-1,0),y=m[b],C=y.controls&&y.controls.right||re.zero,$=_.controls&&_.controls.left||re.zero,y._relative?(w=C.x+y.x,T=C.y+y.y):(w=C.x,T=C.y),_._relative?(v=$.x+_.x,N=$.y+_.y):(v=$.x,N=$.y),t.bezierCurveTo(w,T,v,N,P,I),q>=g&&h&&(k=x,E=_.controls&&_.controls.right||re.zero,V=k.controls&&k.controls.left||re.zero,_._relative?(w=E.x+_.x,T=E.y+_.y):(w=E.x,T=E.y),k._relative?(v=V.x+k.x,N=V.y+k.y):(v=V.x,N=V.y),P=k.x,I=k.y,t.bezierCurveTo(w,T,v,N,P,I));break;case ie.line:t.lineTo(P,I);break;case ie.move:x=_,t.moveTo(P,I);break}return h&&t.closePath(),!J&&!i&&(Fe.isHidden.test(l)||(L=l._renderer&&l._renderer.offset,L&&(t.save(),t.translate(-l._renderer.offset.x,-l._renderer.offset.y),t.scale(l._renderer.scale.x,l._renderer.scale.y)),t.fill(),L&&t.restore()),Fe.isHidden.test(o)||(L=o._renderer&&o._renderer.offset,L&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y),t.lineWidth=s/o._renderer.scale.x),t.stroke(),L&&t.restore())),Z||t.restore(),J&&!i&&t.clip(),O&&O.length>0&&t.setLineDash(sl),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t,e,i){let r,o,s,l,a,c,d,u,f,h,m,p,g,b,y,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,a=this._opacity*(_||1),c=this._visible,!e&&(!c||a===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,l=this._fill,u=this._renderer.collection,f=u.length,g=Eo(r),y=this.dashes,d=this._size,g||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),l)if(typeof l=="string")t.fillStyle=l;else{const v=Fe.getRendererType(l._renderer.type);Fe[v].render.call(l,t,this),t.fillStyle=l._renderer.effect}if(o){if(typeof o=="string")t.strokeStyle=o;else{const v=Fe.getRendererType(o._renderer.type);Fe[v].render.call(o,t,this),t.strokeStyle=o._renderer.effect}s&&(t.lineWidth=kn(this))}typeof a=="number"&&(t.globalAlpha=a),y&&y.length>0&&(t.lineDashOffset=y.offset||0,t.setLineDash(y)),t.beginPath();let k=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=wi(x[0],x[3],x[1],x[4],x[2],x[5]),k/=Math.max(x.scaleX,x.scaleY));for(let v=0;v<f;v++)h=u[v],m=h.x,p=h.y,t.moveTo(m+k,p),t.arc(m,p,k,0,tt);return i||(Fe.isHidden.test(l)||(b=l._renderer&&l._renderer.offset,b&&(t.save(),t.translate(-l._renderer.offset.x,-l._renderer.offset.y),t.scale(l._renderer.scale.x,l._renderer.scale.y)),t.fill(),b&&t.restore()),Fe.isHidden.test(o)||(b=o._renderer&&o._renderer.offset,b&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y),t.lineWidth=s/o._renderer.scale.x),t.stroke(),b&&t.restore())),g||t.restore(),y&&y.length>0&&t.setLineDash(sl),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t,e,i){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*r,s=this._visible,l=this._mask,a=this._clip;if(!e&&(!s||a||o===0))return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,u=this._linewidth,f=this._fill,h=this._decoration,m=this._direction,p=Eo(c),g=f._renderer&&f._renderer.offset&&d._renderer&&d._renderer.offset,b=this.dashes,y=Fe.alignments[this._alignment]||this._alignment,_=Fe.baselines[this._baseline]||this._baseline;let k,x,v,N,w,T,C,$,E,V,P;if(p||(t.save(),t.transform(c[0],c[3],c[1],c[4],c[2],c[5])),l){const I=Fe.getRendererType(l._renderer.type);Fe[I].render.call(l,t,!0)}if(g||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=y,t.textBaseline=_,t.direction=m,f)if(typeof f=="string")t.fillStyle=f;else{const I=Fe.getRendererType(f._renderer.type);Fe[I].render.call(f,t,this),t.fillStyle=f._renderer.effect}if(d){if(typeof d=="string")t.strokeStyle=d;else{const I=Fe.getRendererType(d._renderer.type);Fe[I].render.call(d,t,this),t.strokeStyle=d._renderer.effect}u&&(t.lineWidth=kn(this))}if(typeof o=="number"&&(t.globalAlpha=o),b&&b.length>0&&(t.lineDashOffset=b.offset||0,t.setLineDash(b)),!a&&!i&&(Fe.isHidden.test(f)||(f._renderer&&f._renderer.offset?(T=f._renderer.scale.x,C=f._renderer.scale.y,t.save(),t.translate(-f._renderer.offset.x,-f._renderer.offset.y),t.scale(T,C),k=this._size/f._renderer.scale.y,x=this._leading/f._renderer.scale.y,t.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),v=f._renderer.offset.x/f._renderer.scale.x,N=f._renderer.offset.y/f._renderer.scale.y,t.fillText(this.value,v,N),t.restore()):t.fillText(this.value,0,0)),Fe.isHidden.test(d)||(d._renderer&&d._renderer.offset?(T=d._renderer.scale.x,C=d._renderer.scale.y,t.save(),t.translate(-d._renderer.offset.x,-d._renderer.offset.y),t.scale(T,C),k=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,t.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),v=d._renderer.offset.x/d._renderer.scale.x,N=d._renderer.offset.y/d._renderer.scale.y,w=u/d._renderer.scale.x,t.lineWidth=w,t.strokeText(this.value,v,N),t.restore()):t.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(h)){const I=t.measureText(this.value);let K=1;switch(h){case"underline":E=I.actualBoundingBoxDescent,P=I.actualBoundingBoxDescent;break;case"strikethrough":E=0,P=0,K=.5;break}switch(_){case"top":E+=this._size*K,P+=this._size*K;break;case"baseline":case"bottom":E-=this._size*K,P-=this._size*K;break}switch(y){case"left":case"start":$=0,V=I.width;break;case"right":case"end":$=-I.width,V=0;break;default:$=-I.width/2,V=I.width/2}t.lineWidth=Math.max(Math.floor(this._size/15),1),t.strokeStyle=t.fillStyle,t.beginPath(),t.moveTo($,E),t.lineTo(V,P),t.stroke()}return p||t.restore(),a&&!i&&t.clip(),b&&b.length>0&&t.setLineDash(sl),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,l=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,l=(l-.5)*i.height),this._renderer.effect=t.createLinearGradient(r,o,s,l);for(let a=0;a<this.stops.length;a++){const c=this.stops[a];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,l=this.focal._y,a=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,l=(l-.5)*i.height*.5,a*=Math.min(i.width,i.height)),this._renderer.effect=t.createRadialGradient(r,o,0,s,l,a);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=t.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(t,e,i,r,o,s,l,a,c,d){a=a*Math.PI/180,r=vd(r),o=vd(o);const u=(e-c)/2,f=(i-d)/2,h=To(a)*u+No(a)*f,m=-No(a)*u+To(a)*f,p=h*h,g=m*m;let b=r*r,y=o*o;const _=p/b+g/y;if(_>1){const I=$o(_);r=I*r,o=I*o,b=r*r,y=o*o}const k=b*g+y*p,x=(b*y-k)/k;let v=$o(ll(0,x));s===l&&(v=-v);const N=v*r*m/o,w=-v*o*h/r,T=To(a)*N-No(a)*w+(e+c)/2,C=No(a)*N+To(a)*w+(i+d)/2,$=Sd(1,0,(h-N)/r,(m-w)/o),E=Sd((h-N)/r,(m-w)/o,(-h-N)/r,(-m-w)/o)%tt,V=$+E;w0(t,T,C,r,o,$,V,l===0,a)}},vt=class extends ee{constructor(t){super();const e=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new pt,this.scene.parent=this}setSize(t,e,i){return this.width=t,this.height=e,this.ratio=typeof i>"u"?Is(this.ctx):i,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&oe.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this.trigger(ee.Types.resize,t,e,i)}render(){const t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Fe.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};S(vt,"Utils",Fe);function w0(t,e,i,r,o,s,l,a,c){const d=l-s,u=Zi.Tolerance.epsilon,f=Math.abs(d)<u;let h=ot(d,tt);h<u&&(f?h=0:h=tt),a===!0&&!f&&(h===tt?h=-tt:h=h-tt);for(let m=0;m<kt.Resolution;m++){const p=m/(kt.Resolution-1),g=s+p*h;let b=e+r*Math.cos(g),y=i+o*Math.sin(g);if(c!==0){const _=Math.cos(c),k=Math.sin(c),x=b-e,v=y-i;b=x*_-v*k+e,y=x*k+v*_+i}t.lineTo(b,y)}}function Sd(t,e,i,r){const o=t*i+e*r,s=$o(t*t+e*e)*$o(i*i+r*r);let l=_0(ll(-1,b0(1,o/s)));return t*r-e*i<0&&(l=-l),l}function Eo(t){return t[0]===1&&t[3]===0&&t[1]===0&&t[4]===1&&t[2]===0&&t[5]===0}var ue={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(t,e){const i=t,r=document.createElementNS(ue.ns,i);return i==="svg"&&(e=oe.defaults(e||{},{version:ue.version})),e&&Object.keys(e).length>0&&ue.setAttributes(r,e),r},setAttributes:function(t,e){const i=Object.keys(e);for(let r=0;r<i.length;r++)/href/.test(i[r])?t.setAttributeNS(ue.xlink,i[r],e[i[r]]):t.setAttribute(i[r],e[i[r]]);return this},removeAttributes:function(t,e){for(let i in e)t.removeAttribute(i);return this},toString:function(t,e){let i=t.length,r=i-1,o,s="";for(let l=0;l<i;l++){const a=t[l],c=e?ot(l-1,i):Math.max(l-1,0),d=t[c];let u,f,h,m,p,g,b,y,_,k,x,v,N,w,T,C=ze(a.x),$=ze(a.y);switch(a.command){case ie.close:u=ie.close;break;case ie.arc:x=a.rx,v=a.ry,N=a.xAxisRotation,w=a.largeArcFlag,T=a.sweepFlag,u=ie.arc+" "+x+" "+v+" "+N+" "+w+" "+T+" "+C+" "+$;break;case ie.curve:b=d.controls&&d.controls.right||re.zero,y=a.controls&&a.controls.left||re.zero,d.relative?(h=ze(b.x+d.x),m=ze(b.y+d.y)):(h=ze(b.x),m=ze(b.y)),a.relative?(p=ze(y.x+a.x),g=ze(y.y+a.y)):(p=ze(y.x),g=ze(y.y)),u=(l===0?ie.move:ie.curve)+" "+h+" "+m+" "+p+" "+g+" "+C+" "+$;break;case ie.move:o=a,u=ie.move+" "+C+" "+$;break;default:u=a.command+" "+C+" "+$}l>=r&&e&&(a.command===ie.curve&&(f=o,_=a.controls&&a.controls.right||a,k=f.controls&&f.controls.left||f,a.relative?(h=ze(_.x+a.x),m=ze(_.y+a.y)):(h=ze(_.x),m=ze(_.y)),f.relative?(p=ze(k.x+f.x),g=ze(k.y+f.y)):(p=ze(k.x),g=ze(k.y)),C=ze(f.x),$=ze(f.y),u+=" C "+h+" "+m+" "+p+" "+g+" "+C+" "+$),a.command!==ie.close&&(u+=" Z")),s+=u+" "}return s},pointsToString:function(t,e){let i="";const r=e*.5;for(let o=0;o<t.length;o++){const s=t[o].x,l=t[o].y-r;i+=ie.move+" "+s+" "+l+" ",i+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return i},getClip:function(t,e){let i=t._renderer.clip;return i||(i=t._renderer.clip=ue.createElement("clipPath",{"clip-rule":"nonzero"})),i.parentNode===null&&e.defs.appendChild(i),i},getRendererType:function(t){return t in ue?t:"path"},defs:{update:function(t){const{defs:e}=t;if(e._flagUpdate){const i=Array.prototype.slice.call(e.children,0);for(let r=0;r<i.length;r++){const o=i[r],s=o.id,l=`[fill="url(#${s})"],[stroke="url(#${s})"],[clip-path="url(#${s})"]`;t.querySelector(l)||e.removeChild(o)}e._flagUpdate=!1}}},group:{appendChild:function(t){const e=t._renderer.elem;if(!e)return;const i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||t._clip||this.elem.appendChild(e)},removeChild:function(t){const e=t._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||t._clip||this.elem.removeChild(e)},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){const e=ue.getRendererType(t._renderer.type);ue[e].render.call(t,this)},render:function(t){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=ue.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,i={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const o=this.children[r],s=ue.getRendererType(o._renderer.type);ue[s].render.call(o,t)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(ue.group.appendChild,i),this._flagSubtractions&&this.subtractions.forEach(ue.group.removeChild,i),this._flagOrder&&this.children.forEach(ue.group.orderChild,i),this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=ue.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=kn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=ue.getClip(this,t),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const s=this.worldMatrix.elements,l=wi(s[0],s[3],s[1],s[4],s[2],s[5]);r/=Math.max(l.scaleX,l.scaleY)}const o=ue.pointsToString(this._renderer.collection,r);e.d=o}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,t,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=kn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("path",e),t.appendChild(this._renderer.elem)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=ue.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=ue.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=kn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("text",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=ue.getClip(this,t),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?ue.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=ue.createElement("linearGradient",i)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],l={};s._flagOffset&&(l.offset=100*s._offset+"%"),s._flagColor&&(l["stop-color"]=s._color),s._flagOpacity&&(l["stop-opacity"]=s._opacity),s._renderer.elem?ue.setAttributes(s._renderer.elem,l):s._renderer.elem=ue.createElement("stop",l),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagCenter&&(i.cx=this.center._x,i.cy=this.center._y),this._flagFocal&&(i.fx=this.focal._x,i.fy=this.focal._y),this._flagRadius&&(i.r=this._radius),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?ue.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=ue.createElement("radialGradient",i)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],l={};s._flagOffset&&(l.offset=100*s._offset+"%"),s._flagColor&&(l["stop-color"]=s._color),s._flagOpacity&&(l["stop-opacity"]=s._opacity),s._renderer.elem?ue.setAttributes(s._renderer.elem,l):s._renderer.elem=ue.createElement("stop",l),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={},r={x:0,y:0},o=this.image;if(this._flagId&&(i.id=this._id),this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,o&&(i.x-=o.width/2,i.y-=o.height/2,this._scale instanceof re?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale)),i.x>0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,o)){switch(i.width=o.width,i.height=o.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof re?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=i.width,r.height=i.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?ue.setAttributes(this._renderer.image,r):this._renderer.image=ue.createElement("image",r)),this._renderer.elem?Object.keys(i).length!==0&&ue.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=ue.createElement("pattern",i)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},Bd=class extends ee{constructor(t){super(),this.domElement=t.domElement||ue.createElement("svg"),this.scene=new pt,this.scene.parent=this,this.defs=ue.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,e){return this.width=t,this.height=e,ue.setAttributes(this.domElement,{width:t,height:e}),this.trigger(ee.Types.resize,t,e)}render(){return ue.group.render.call(this.scene,this.domElement),ue.defs.update(this.domElement),this}};S(Bd,"Utils",ue);var rn={create:function(t,e,i){const r=t.createShader(t[i]);if(t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const s=t.getShaderInfoLog(r);throw t.deleteShader(r),new Lt("unable to compile shader "+r+": "+s)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
41
41
  precision mediump float;
42
42
  attribute vec2 a_position;
43
43