@snabcentr/vue-ui-lib 2.19.0 → 2.19.1
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.
- package/dist/manifest.json +2 -2
- package/dist/release_notes.tmp +3 -3
- package/dist/sc-vue-ui-lib.css +1 -1
- package/dist/sc-vue-ui-lib.js +6 -4
- package/dist/sc-vue-ui-lib.js.map +1 -1
- package/dist/sc-vue-ui-lib.umd.cjs +1 -1
- package/dist/sc-vue-ui-lib.umd.cjs.map +1 -1
- package/dist/src/catalog/interfaces/properties/i-category-collapse-properties.d.ts +4 -0
- package/package.json +2 -2
@@ -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 Cr=function(){return Cr=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Cr.apply(this,arguments)},Iu={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"}},dn={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Ss=500,Vu=function(){function e(t,n){return this.core=t,this.$LG=n,this.settings=Cr(Cr({},Iu),this.core.settings),this}return e.prototype.buildTemplates=function(){var t=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&&(t+='<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(t)},e.prototype.enableZoom=function(t){var n=this,r=this.settings.enableZoomAfter+t.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&t.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){n.isImageSlide(n.core.index)&&(n.core.getSlideItem(t.detail.index).addClass("lg-zoomable"),t.detail.index===n.core.index&&n.setZoomEssentials())},r+30)},e.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(dn.slideItemLoad+".zoom",this.enableZoom.bind(this))},e.prototype.getDragCords=function(t){return{x:t.pageX,y:t.pageY}},e.prototype.getSwipeCords=function(t){var n=t.touches[0].pageX,r=t.touches[0].pageY;return{x:n,y:r}},e.prototype.getDragAllowedAxises=function(t,n){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),s=0,o=0,a=r.getBoundingClientRect();t?(s=r.offsetHeight*t,o=r.offsetWidth*t):n?(s=a.height+n*a.height,o=a.width+n*a.width):(s=a.height,o=a.width);var l=s>this.containerRect.height,c=o>this.containerRect.width;return{allowX:c,allowY:l}},e.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},e.prototype.zoomImage=function(t,n,r,s){if(!(Math.abs(n)<=0)){var o=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;t===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,n),h=d.allowY,u=d.allowX;this.positionChanged&&(l=this.left/(this.scale-n),c=this.top/(this.scale-n),this.pageX=o-l,this.pageY=a-c,this.positionChanged=!1);var p=this.getPossibleSwipeDragCords(n),f,g,m=o-this.pageX,_=a-this.pageY;if(t-n>1){var y=(t-n)/Math.abs(n);m=(n<0?-m:m)+this.left*(y+(n<0?-1:1)),_=(n<0?-_:_)+this.top*(y+(n<0?-1:1)),f=m/y,g=_/y}else{var y=(t-n)*n;f=m*y,g=_*y}r&&(u?this.isBeyondPossibleLeft(f,p.minX)?f=p.minX:this.isBeyondPossibleRight(f,p.maxX)&&(f=p.maxX):t>1&&(f<p.minX?f=p.minX:f>p.maxX&&(f=p.maxX)),h?this.isBeyondPossibleTop(g,p.minY)?g=p.minY:this.isBeyondPossibleBottom(g,p.maxY)&&(g=p.maxY):t>1&&(g<p.minY?g=p.minY:g>p.maxY&&(g=p.maxY))),this.setZoomStyles({x:f,y:g,scale:t}),this.left=f,this.top=g,s&&this.setZoomImageSize()}},e.prototype.resetImageTranslate=function(t){if(this.isImageSlide(t)){var n=this.core.getSlideItem(t).find(".lg-image").first();this.imageReset=!1,n.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),n.css("width","auto").css("height","auto"),setTimeout(function(){n.removeClass("no-transition")},10)}},e.prototype.setZoomImageSize=function(){var t=this,n=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=t.getCurrentImageActualSizeScale();t.scale>=r&&(n.addClass("no-transition"),t.imageReset=!0)},Ss),setTimeout(function(){var r=t.getCurrentImageActualSizeScale();if(t.scale>=r){var s=t.getDragAllowedAxises(t.scale);n.css("width",n.get().naturalWidth+"px").css("height",n.get().naturalHeight+"px"),t.core.outer.addClass("lg-actual-size"),s.allowX&&s.allowY?n.addClass("reset-transition"):s.allowX&&!s.allowY?n.addClass("reset-transition-x"):!s.allowX&&s.allowY&&n.addClass("reset-transition-y")}},Ss+50)},e.prototype.setZoomStyles=function(t){var n=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),s=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=t.scale,r.css("transform","scale3d("+t.scale+", "+t.scale+", 1)"),s.css("transform","scale3d("+t.scale+", "+t.scale+", 1)");var o="translate3d("+t.x+"px, "+t.y+"px, 0)";n.css("transform",o)},e.prototype.setActualSize=function(t,n){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var s=this.core.galleryItems[this.core.index];this.resetImageTranslate(t),setTimeout(function(){if(!(!s.src||r.core.outer.hasClass("lg-first-slide-loading"))){var o=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(o),r.setPageCords(n),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-a,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},Ss+110)}},e.prototype.getNaturalWidth=function(t){var n=this.core.getSlideItem(t).find(".lg-image").first(),r=this.core.galleryItems[t].width;return r?parseFloat(r):n.get().naturalWidth},e.prototype.getActualSizeScale=function(t,n){var r,s;return t>=n?(r=t/n,s=r||2):s=1,s},e.prototype.getCurrentImageActualSizeScale=function(){var t=this.core.getSlideItem(this.core.index).find(".lg-image").first(),n=t.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||n;return this.getActualSizeScale(r,n)},e.prototype.getPageCords=function(t){var n={};if(t)n.x=t.pageX||t.touches[0].pageX,n.y=t.pageY||t.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();n.x=r.width/2+r.left,n.y=r.height/2+this.scrollTop+r.top}return n},e.prototype.setPageCords=function(t){var n=this.getPageCords(t);this.pageX=n.x,this.pageY=n.y},e.prototype.manageActualPixelClassNames=function(){var t=this.core.getElementById("lg-actual-size");t.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},e.prototype.beginZoom=function(t){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),t>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),t>1},e.prototype.getScale=function(t){var n=this.getCurrentImageActualSizeScale();return t<1?t=1:t>n&&(t=n),t},e.prototype.init=function(){var t=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var n=null;this.core.outer.on("dblclick.lg",function(r){t.$LG(r.target).hasClass("lg-image")&&t.setActualSize(t.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var s=t.$LG(r.target);r.touches.length===1&&s.hasClass("lg-image")&&(n?(clearTimeout(n),n=null,r.preventDefault(),t.setActualSize(t.core.index,r)):n=setTimeout(function(){n=null},300))}),this.core.LGel.on(dn.containerResize+".zoom "+dn.rotateRight+".zoom "+dn.rotateLeft+".zoom "+dn.flipHorizontal+".zoom "+dn.flipVertical+".zoom",function(){if(!(!t.core.lgOpened||!t.isImageSlide(t.core.index)||t.core.touchAction)){var r=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();t.top=0,t.left=0,t.setZoomEssentials(),t.setZoomSwipeStyles(r,{x:0,y:0}),t.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){t.core.lgOpened&&(t.scrollTop=t.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(t.isImageSlide(t.core.index)){var r=0;t.imageReset&&(t.resetImageTranslate(t.core.index),r=50),setTimeout(function(){var s=t.scale-t.settings.scale;s<1&&(s=1),t.beginZoom(s),t.zoomImage(s,-t.settings.scale,!0,!t.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){t.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){t.setActualSize(t.core.index)}),this.core.LGel.on(dn.beforeOpen+".zoom",function(){t.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(dn.afterOpen+".zoom",function(){t.scrollTop=t.$LG(window).scrollTop(),t.pageX=t.core.outer.width()/2,t.pageY=t.core.outer.height()/2+t.scrollTop,t.scale=1}),this.core.LGel.on(dn.afterSlide+".zoom",function(r){var s=r.detail.prevIndex;t.scale=1,t.positionChanged=!1,t.zoomInProgress=!1,t.resetZoom(s),t.resetImageTranslate(s),t.isImageSlide(t.core.index)&&t.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},e.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var t=this.scale+this.settings.scale;this.settings.infiniteZoom||(t=this.getScale(t)),this.beginZoom(t),this.zoomImage(t,Math.min(this.settings.scale,t-this.scale),!0,!this.settings.infiniteZoom)}},e.prototype.resetZoom=function(t){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var n=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(t!==void 0?t:this.core.index);n.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()},e.prototype.getTouchDistance=function(t){return Math.sqrt((t.touches[0].pageX-t.touches[1].pageX)*(t.touches[0].pageX-t.touches[1].pageX)+(t.touches[0].pageY-t.touches[1].pageY)*(t.touches[0].pageY-t.touches[1].pageY))},e.prototype.pinchZoom=function(){var t=this,n=0,r=!1,s=1,o=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=t.core.getSlideItem(t.core.index),!!t.isImageSlide(t.core.index)&&l.touches.length===2){if(l.preventDefault(),t.core.outer.hasClass("lg-first-slide-loading"))return;s=t.scale||1,t.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),t.setPageCords(l),t.resetImageTranslate(t.core.index),t.core.touchAction="pinch",n=t.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&t.core.touchAction==="pinch"&&(t.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=t.getTouchDistance(l),d=n-c;if(!r&&Math.abs(d)>5&&(r=!0),r){o=t.scale;var h=Math.max(1,s+-d*.02);t.scale=Math.round((h+Number.EPSILON)*100)/100;var u=t.scale-o;t.zoomImage(t.scale,Math.round((u+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(t.core.touchAction==="pinch"&&(t.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,n=0,t.scale<=1)t.resetZoom();else{var c=t.getCurrentImageActualSizeScale();if(t.scale>=c){var d=c-t.scale;d===0&&(d=.01),t.zoomImage(c,d,!1,!0)}t.manageActualPixelClassNames(),t.core.outer.addClass("lg-zoomed")}t.core.touchAction=void 0}})},e.prototype.touchendZoom=function(t,n,r,s,o){var a=n.x-t.x,l=n.y-t.y,c=Math.abs(a)/o+1,d=Math.abs(l)/o+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var h=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),u={};u.x=this.left+a,u.y=this.top+l;var p=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(s&&(this.isBeyondPossibleTop(u.y,p.minY)?u.y=p.minY:this.isBeyondPossibleBottom(u.y,p.maxY)&&(u.y=p.maxY)),r&&(this.isBeyondPossibleLeft(u.x,p.minX)?u.x=p.minX:this.isBeyondPossibleRight(u.x,p.maxX)&&(u.x=p.maxX)),s?this.top=u.y:u.y=this.top,r?this.left=u.x:u.x=this.left,this.setZoomSwipeStyles(h,u),this.positionChanged=!0)},e.prototype.getZoomSwipeCords=function(t,n,r,s,o){var a={};if(s){if(a.y=this.top+(n.y-t.y),this.isBeyondPossibleTop(a.y,o.minY)){var l=o.minY-a.y;a.y=o.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,o.maxY)){var c=a.y-o.maxY;a.y=o.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(n.x-t.x),this.isBeyondPossibleLeft(a.x,o.minX)){var d=o.minX-a.x;a.x=o.minX-d/6}else if(this.isBeyondPossibleRight(a.x,o.maxX)){var h=a.x-o.maxX;a.x=o.maxX+h/6}}else a.x=this.left;return a},e.prototype.isBeyondPossibleLeft=function(t,n){return t>=n},e.prototype.isBeyondPossibleRight=function(t,n){return t<=n},e.prototype.isBeyondPossibleTop=function(t,n){return t>=n},e.prototype.isBeyondPossibleBottom=function(t,n){return t<=n},e.prototype.isImageSlide=function(t){var n=this.core.galleryItems[t];return this.core.getSlideType(n)==="image"},e.prototype.getPossibleSwipeDragCords=function(t){var n=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,s=n.get().getBoundingClientRect(),o=s.height,a=s.width;t&&(o=o+t*o,a=a+t*a);var l=(o-this.containerRect.height)/2,c=(this.containerRect.height-o)/2+r,d=(a-this.containerRect.width)/2,h=(this.containerRect.width-a)/2,u={minY:l,maxY:c,minX:d,maxX:h};return u},e.prototype.setZoomSwipeStyles=function(t,n){t.css("transform","translate3d("+n.x+"px, "+n.y+"px, 0)")},e.prototype.zoomSwipe=function(){var t=this,n={},r={},s=!1,o=!1,a=!1,l=new Date,c=new Date,d,h,u=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(p){if(t.isImageSlide(t.core.index)&&(u=t.core.getSlideItem(t.core.index),(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))&&p.touches.length===1&&t.core.outer.hasClass("lg-zoomed"))){p.preventDefault(),l=new Date,t.core.touchAction="zoomSwipe",h=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var f=t.getDragAllowedAxises(0);a=f.allowY,o=f.allowX,(o||a)&&(n=t.getSwipeCords(p)),d=t.getPossibleSwipeDragCords(),t.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(p){if(p.touches.length===1&&t.core.touchAction==="zoomSwipe"&&(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))){p.preventDefault(),t.core.touchAction="zoomSwipe",r=t.getSwipeCords(p);var f=t.getZoomSwipeCords(n,r,o,a,d);(Math.abs(r.x-n.x)>15||Math.abs(r.y-n.y)>15)&&(s=!0,t.setZoomSwipeStyles(h,f))}}),this.core.$inner.on("touchend.lg",function(p){if(t.core.touchAction==="zoomSwipe"&&(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))){if(p.preventDefault(),t.core.touchAction=void 0,t.core.outer.removeClass("lg-zoom-dragging"),!s)return;s=!1,c=new Date;var f=c.valueOf()-l.valueOf();t.touchendZoom(n,r,o,a,f)}})},e.prototype.zoomDrag=function(){var t=this,n={},r={},s=!1,o=!1,a=!1,l=!1,c,d,h,u;this.core.outer.on("mousedown.lg.zoom",function(p){if(t.isImageSlide(t.core.index)){var f=t.core.getSlideItem(t.core.index);if(t.$LG(p.target).hasClass("lg-item")||f.get().contains(p.target)){c=new Date,u=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var g=t.getDragAllowedAxises(0);l=g.allowY,a=g.allowX,t.core.outer.hasClass("lg-zoomed")&&t.$LG(p.target).hasClass("lg-object")&&(a||l)&&(p.preventDefault(),n=t.getDragCords(p),h=t.getPossibleSwipeDragCords(),s=!0,t.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(p){if(s){o=!0,r=t.getDragCords(p);var f=t.getZoomSwipeCords(n,r,a,l,h);t.setZoomSwipeStyles(u,f)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(p){if(s){if(d=new Date,s=!1,t.core.outer.removeClass("lg-zoom-dragging"),o&&(n.x!==r.x||n.y!==r.y)){r=t.getDragCords(p);var f=d.valueOf()-c.valueOf();t.touchendZoom(n,r,a,l,f)}o=!1}t.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},e.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},e.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},e}();const Le=class Le{static init(t){if(Le.uiConfig)throw new Error("UI provider already initialized.");Le.uiConfig=t,Le.windowResizeHandler(),window.addEventListener("resize",Le.windowResizeHandler)}static destroy(){window.removeEventListener("resize",Le.windowResizeHandler)}static getMessagesService(){return Le.getUiConfig().messagesService}static getNotificationsService(){return Le.getUiConfig().notificationsService}static getDeviceTypeByResolution(){const{deviceTypeResolutionsConfig:t}=Le.getUiConfig();return window.innerWidth<t.tablet?W.WindowResolutionEnum.phone:window.innerWidth<t.laptop?W.WindowResolutionEnum.tablet:W.WindowResolutionEnum.laptop}static initRefDependingOnDeviceResolution(t,n,r){const s=i.ref(r);return Le.setRefValueDependingOnDeviceResolution(s,t,n,r),Le.refsDependingOnDeviceResolution.push({r:s,phoneValue:t,tabletValue:n,defaultValue:r}),s}static isPhoneDevice(){return Le.getDeviceTypeByResolution()===W.WindowResolutionEnum.phone}static isTabletDevice(){return Le.getDeviceTypeByResolution()===W.WindowResolutionEnum.tablet}static isLaptopDevice(){return Le.getDeviceTypeByResolution()===W.WindowResolutionEnum.laptop}static showNotificationsForErrorResponseData(t,n={}){var r,s;if(H.isEmpty(t.errors)){const o=(s=(r=t.rawError)==null?void 0:r.config)==null?void 0:s.url,a=o?` [ ${o} ]`:"";Le.getNotificationsService().error({title:"Ошибка выполнения/обработки запроса",content:t.message,meta:`#${t.status}${a}: ${t.statusText}`,duration:3e3})}else for(const o in t.errors)Object.prototype.hasOwnProperty.call(n,o)?n[o]=new W.FieldValidationResultData(t.errors[o].toString(),"error"):Le.getMessagesService().error(t.errors[o].toString())}static getUiConfig(){if(!Le.uiConfig)throw new Error("UI provider is not initialized.");return Le.uiConfig}static setRefValueDependingOnDeviceResolution(t,n,r,s){switch(Le.getDeviceTypeByResolution()){case W.WindowResolutionEnum.phone:t.value=n;break;case W.WindowResolutionEnum.tablet:t.value=r;break;default:t.value=s;break}}static windowResizeHandler(){H.forEach(Le.refsDependingOnDeviceResolution,t=>{Le.setRefValueDependingOnDeviceResolution(t.r,t.phoneValue,t.tabletValue,t.defaultValue)})}};k(Le,"uiConfig"),k(Le,"refsDependingOnDeviceResolution",[]);let _t=Le;const zu={ref:"gallery-container",class:"lightgallery-wrapper"},Lu={},ya=i.defineComponent({...Lu,__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(e){const t=e,n={lgAfterAppendSlide:t.onAfterAppendSlide,lgInit:t.onInit,lgHasVideo:t.onHasVideo,lgContainerResize:t.onContainerResize,lgAfterAppendSubHtml:t.onAfterAppendSubHtml,lgBeforeOpen:t.onBeforeOpen,lgAfterOpen:t.onAfterOpen,lgSlideItemLoad:t.onSlideItemLoad,lgBeforeSlide:t.onBeforeSlide,lgAfterSlide:t.onAfterSlide,lgPosterClick:t.onPosterClick,lgDragStart:t.onDragStart,lgDragMove:t.onDragMove,lgDragEnd:t.onDragEnd,lgBeforeNextSlide:t.onBeforeNextSlide,lgBeforePrevSlide:t.onBeforePrevSlide,lgBeforeClose:t.onBeforeClose,lgAfterClose:t.onAfterClose,lgRotateLeft:t.onRotateLeft,lgRotateRight:t.onRotateRight,lgFlipHorizontal:t.onFlipHorizontal,lgFlipVertical:t.onFlipVertical},r=i.useTemplateRef("gallery-container"),s=i.ref(null);return i.onMounted(async()=>{if(!r.value)return;const o=await import("lightgallery");s.value=o.default(r.value,{...t.settings}),H.forOwn(n,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),i.onBeforeUnmount(()=>{var o;s.value&&((o=s.value)==null||o.destroy(),s.value=null)}),(o,a)=>(i.openBlock(),i.createElementBlock("div",zu,[i.renderSlot(o.$slots,"default")],512))}}),Du=["href"],Hu=["src","alt"],Wu={},ba=i.defineComponent({...Wu,__name:"image-gallery",props:{images:{}},setup(e,{expose:t}){const n=i.ref(!1),r=i.ref(!1),s=i.ref({plugins:[Ou,Vu],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),o=()=>window.innerWidth*(_t.getDeviceTypeByResolution()===W.WindowResolutionEnum.phone?.7:.8),a=i.ref(o()),l=()=>{a.value=o()},c=()=>{n.value=!0};return i.onUnmounted(()=>{window.removeEventListener("resize",l)}),t({show:c}),window.addEventListener("resize",l),(d,h)=>{const u=_a,p=O.NPopover;return i.openBlock(),i.createBlock(p,{trigger:"manual",show:n.value,class:"sc-image",placement:"top-start",onClickoutside:h[3]||(h[3]=()=>{r.value||(n.value=!1)})},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:"inline-flex",onClick:h[0]||(h[0]=f=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(u)])])]),default:i.withCtx(()=>[i.createVNode(ya,{settings:s.value,style:i.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:h[1]||(h[1]=()=>{r.value=!0}),onAfterClose:h[2]||(h[2]=()=>{r.value=!1,n.value=!1})},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.images,(f,g)=>(i.openBlock(),i.createElementBlock("a",{key:g,href:f.image},[i.createElementVNode("img",{src:f.preview,alt:`Изображение #${g+1}`},null,8,Hu)],8,Du))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),ju={class:"flex flex-col text-sm"},Xu={},qu=i.defineComponent({...Xu,__name:"product-stock-count",props:{product:{}},setup(e){return(t,n)=>{const r=Cs,s=O.NPopover;return i.openBlock(),i.createBlock(s,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:i.withCtx(()=>[i.renderSlot(t.$slots,"default",{},()=>[i.createVNode(r)])]),default:i.withCtx(()=>[i.createElementVNode("div",ju,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.product.stockCount,(o,a)=>(i.openBlock(),i.createElementBlock("span",{key:a},i.toDisplayString(o.warehouse.name)+": "+i.toDisplayString(o.count)+" "+i.toDisplayString(t.product.quantityUnit),1))),128))])]),_:3})}}}),Yu={class:"flex flex-row justify-between"},Uu={key:0},Gu={class:"ml-2 align-sub"},Ku={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Zu={class:"@container"},Ju={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},Qu={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},ef={class:"text-sc-dark-grey"},tf={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},nf={class:"text-gray-600"},rf={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},sf={key:3,class:"underline decoration-dashed"},of={key:4,class:"sc-product-pack whitespace-nowrap"},af={class:"text-gray-600"},lf={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},cf={class:"text-gray-600"},df={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},hf={key:0},uf={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},ff={},Xi=i.defineComponent({...ff,__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},showPriceHistory:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e,{expose:t}){const n=e,r=i.computed(()=>H.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),s=i.computed(()=>H.sortBy(n.product.priceCoefficients,["coefficient.slug"])),o=i.computed(()=>{var h,u;return(u=(h=n.product)==null?void 0:h.properties)==null?void 0:u.planingIncomingDate}),a=i.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=i.computed(()=>H.isFunction(n.allowNameClick)?n.allowNameClick(n.product):n.allowNameClick),d=()=>{var h;c.value&&((h=n.eventEmitter)==null||h.emit("product:name-click",{product:n.product,exposedMethods:{showProductImagesPreview:l}}))};return t({showProductImagesPreview:l}),(h,u)=>{var y,b,S,x,C;const p=_a,f=O.NText,g=ma,m=Cs,_=O.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",Yu,[i.createVNode(f,{type:"info",class:"sc-product-name text-balance text-base font-medium"},{default:i.withCtx(()=>[i.createElementVNode("span",{class:i.normalizeClass({"cursor-pointer":c.value&&h.eventEmitter}),onClick:d},i.toDisplayString(h.product.name),3),h.product.onOrder?(i.openBlock(),i.createElementBlock("span",Uu," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",Gu,[h.product.images&&h.product.images.length>0?(i.openBlock(),i.createBlock(ba,{key:0,ref:"image-gallery",images:h.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",Ku,[i.createVNode(p)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]),_:1}),h.showProductAddToCartButton||h.showProductEditButton||((y=h.productContextButtonsConfig)==null?void 0:y.length)>0?(i.openBlock(),i.createBlock(g,{key:0,product:h.product,"event-emitter":h.eventEmitter,"show-product-add-to-cart-button":h.showProductAddToCartButton,"show-product-edit-button":h.showProductEditButton,"product-context-buttons-config":h.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",Zu,[i.createElementVNode("div",Ju,[h.product.supplierSku?(i.openBlock(),i.createElementBlock("div",Qu,[u[0]||(u[0]=i.createTextVNode(" Артикул производителя/поставщика: ")),i.createElementVNode("span",ef,i.toDisplayString(h.product.supplierSku),1)])):i.createCommentVNode("",!0),h.showCode?(i.openBlock(),i.createElementBlock("span",tf,[u[1]||(u[1]=i.createTextVNode(" Артикул: ")),i.createElementVNode("span",nf,i.toDisplayString(h.product.code),1)])):i.createCommentVNode("",!0),h.product.stockCount&&h.product.stockCount.length>0?(i.openBlock(),i.createBlock(qu,{key:2,product:h.product},{default:i.withCtx(()=>[i.createElementVNode("span",rf,[u[2]||(u[2]=i.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),i.createVNode(m,{class:"mt-0.5"})])]),_:1},8,["product"])):(i.openBlock(),i.createElementBlock("span",sf," Нет в наличии ")),(S=(b=h.product)==null?void 0:b.properties)!=null&&S.pack?(i.openBlock(),i.createElementBlock("span",of,[u[3]||(u[3]=i.createTextVNode(" Норма упаковки: ")),i.createElementVNode("span",af,i.toDisplayString((C=(x=h.product)==null?void 0:x.properties)==null?void 0:C.pack),1)])):i.createCommentVNode("",!0),h.showPlanningDates&&o.value?(i.openBlock(),i.createElementBlock("span",lf,[u[4]||(u[4]=i.createTextVNode(" Планируемая дата поступления на основной склад: ")),i.createElementVNode("span",cf,i.toDisplayString(o.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(_,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",df,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,B=>(i.openBlock(),i.createBlock(kr,{key:B.coefficient.slug,product:h.product,"cost-field-name":B.coefficient.slug??"","event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-price-history":h.showPriceHistory,"currency-rates":h.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),i.createVNode(kr,{product:h.product,"event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":!0,"show-price-history":h.showPriceHistory,"currency-rates":h.currencyRates,"cost-field-name":"cost",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-price-history","currency-rates"])])):i.createCommentVNode("",!0)]),_:1}),h.showSlugs||h.showProperties?(i.openBlock(),i.createElementBlock("div",hf,[i.createElementVNode("ul",uf,[h.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:h.product.id,slug:h.product.slug},(B,v)=>(i.openBlock(),i.createElementBlock("li",{key:v}," ("+i.toDisplayString(v)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0),h.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(h.product.properties,(B,v)=>(i.openBlock(),i.createElementBlock("li",{key:v}," ("+i.toDisplayString(v)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),pf=(e,t,n)=>({key:e,title:t,className:"align-top",resizable:!0,render:r=>i.h(kr,{product:r,costFieldName:e,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick,currencyRates:n.currencyRates})}),gf=(e,t)=>{if(e.length===0)return[];const n=[],r={};switch(_t.getDeviceTypeByResolution()){case W.WindowResolutionEnum.phone:case W.WindowResolutionEnum.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:s=>i.h(Xi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,currencyRates:t.currencyRates,productContextButtonsConfig:t.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:s=>i.h(Xi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,currencyRates:t.currencyRates})}),t.showProductCosts&&(H.forEach(e,s=>{H.forEach(s.priceCoefficients,o=>{r[o.coefficient.slug??""]||(r[o.coefficient.slug??""]=o.coefficient)})}),H.forEach(H.sortBy(r,["slug"]),s=>{n.push(pf(s.slug??"",s.name,t))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:s=>i.h(kr,{product:s,costFieldName:"cost",eventEmitter:t.eventEmitter,allowPriceClick:t.allowPriceClick,showQuantityUnit:!0,showCostDate:!0,showPriceHistory:t.showPriceHistory,currencyRates:t.currencyRates})})),(t.showProductEditButton||!H.isNil(t.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:s=>i.h(ma,{product:s,eventEmitter:t.eventEmitter,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,productContextButtonsConfig:t.productContextButtonsConfig})});break}return n},mf={key:0,class:"pt-0.5"},_f={class:"flex flex-row gap-1"},yf={key:0},bf={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},wf={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},vf={},kf=i.defineComponent({...vf,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},selectedCategoriesItems:{default:void 0},selectedProductsItems:{default:void 0},showHideForClientButton:{type:[Boolean,Function],default:!1},showPinButton:{type:[Boolean,Function],default:!1},showCategoryEditButton:{type:[Boolean,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(vr,"medium"),r=i.computed(()=>{var E;return(E=t==null?void 0:t.filteredItems)==null?void 0:E[t.categoryItem.id]}),s=i.computed(()=>{var E,A;return H.isArray((E=t.categoryItem)==null?void 0:E.categories)&&((A=t.categoryItem.categories)==null?void 0:A.length)>0}),o=i.computed(()=>{var E;return H.isArray((E=t.categoryItem)==null?void 0:E.products)?t.categoryItem.products:[]}),a=i.computed(()=>Object.entries(t.categoryItem.currencyRates??{}).map(([E,A])=>`${A} руб./${S(E)}`).join(", ")),l=i.computed(()=>H.isUndefined(t.filteredItems)||r.value==="*"?o.value:o.value.filter(E=>{var A,K;return(K=(A=r.value)==null?void 0:A.products)==null?void 0:K.includes(E.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>H.isFunction(t.showHideForClientButton)?t.showHideForClientButton(t.categoryItem):t.showHideForClientButton),h=i.computed(()=>H.isFunction(t.showPinButton)?t.showPinButton(t.categoryItem):t.showPinButton),u=i.computed(()=>H.isFunction(t.showCategoryEditButton)?t.showCategoryEditButton(t.categoryItem):t.showCategoryEditButton),p=i.computed(()=>H.isNil(t.categoryContextButtonsConfig)?[]:H.isFunction(t.categoryContextButtonsConfig)?t.categoryContextButtonsConfig(t.categoryItem):t.categoryContextButtonsConfig),f=i.computed(()=>new W.ClientCategory(t.categoryItem)),g=i.ref(!1),m=i.ref(!1),_=i.computed(()=>!H.isUndefined(t.selectedCategoriesItems)),y=i.computed(()=>(t.selectedCategoriesItems??[]).some(E=>E.id===t.categoryItem.id)),b=i.computed(()=>q.value&&_t.getDeviceTypeByResolution()===W.WindowResolutionEnum.laptop?"auto":"fixed"),S=(E,A="ru-RU")=>0 .toLocaleString(A,{style:"currency",currency:E,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),x=E=>{t.eventEmitter.emit("category:checked",{category:t.categoryItem,checked:E})},C=(E,A)=>{t.eventEmitter.emit("category:header-click",{categoryItem:t.categoryItem,expanded:A,isLoadingState:g})},B=()=>{t.eventEmitter.emit("category:hide",{category:t.categoryItem})},v=()=>{t.eventEmitter.emit("category:attach",{category:t.categoryItem})},N=()=>{t.eventEmitter.emit("category:detach",{category:t.categoryItem})},F=()=>{t.eventEmitter.emit("category:edit",{category:t.categoryItem})},P=E=>{t.eventEmitter.emit("category:context-select",{category:t.categoryItem,key:E})},q=i.ref(0),U=i.computed(()=>q.value&&o.value.length>0?gf(o.value,{eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,currencyRates:t.categoryItem.currencyRates,productContextButtonsConfig:t.productContextButtonsConfig}):[]),M=H.debounce(()=>{q.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",M)}),window.addEventListener("resize",M),M(),(E,A)=>{const K=O.NCheckbox,R=ou,$=O.NTooltip,j=iu,z=pa,Y=O.NTag,I=Jh,V=Gh,J=O.NButton,pe=qh,ie=fa,ge=ua,re=O.NDropdown,Me=O.NDataTable,Fe=O.NAlert,Ge=O.NSpin;return i.openBlock(),i.createBlock(ga,{name:E.categoryItem.id,"data-id":E.categoryItem.id,"onHeader:click":C},{"pre-arrow":i.withCtx(()=>{var xe,Se,st;return[_.value?(i.openBlock(),i.createElementBlock("div",mf,[i.createVNode(K,{checked:y.value,"onUpdate:checked":x},null,8,["checked"])])):i.createCommentVNode("",!0),!d.value&&((xe=f.value)!=null&&xe.isDisabled)?(i.openBlock(),i.createBlock($,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(R,{class:"pt-1.5"})]),default:i.withCtx(()=>[A[1]||(A[1]=i.createTextVNode(" Категория скрыта для клиента "))]),_:1,__:[1]})):i.createCommentVNode("",!0),((Se=f.value)==null?void 0:Se.isFavorite)??!1?(i.openBlock(),i.createBlock($,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(j,{class:"pt-1.5"})]),default:i.withCtx(()=>[A[2]||(A[2]=i.createTextVNode(" Избранная категория "))]),_:1,__:[2]})):i.createCommentVNode("",!0),((st=f.value)==null?void 0:st.isRequired)??!1?(i.openBlock(),i.createBlock($,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(z,{class:"pt-1.5"})]),default:i.withCtx(()=>[A[3]||(A[3]=i.createTextVNode(" Доп. продажа "))]),_:1,__:[3]})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var xe,Se,st;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":E.categoryItem.isHidden,"text-gray-400":(xe=f.value)==null?void 0:xe.isDisabled})},[i.createVNode($,{disabled:!E.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(E.categoryItem.name),1)]),default:i.withCtx(()=>[A[4]||(A[4]=i.createTextVNode(" Категория скрыта "))]),_:1,__:[4]},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:A[0]||(A[0]=i.withModifiers((...Ke)=>i.unref(H.noop)&&i.unref(H.noop)(...Ke),["prevent","stop"]))},[(Se=E.categoryItem.properties)!=null&&Se.m2Price?(i.openBlock(),i.createBlock(Y,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Средняя стоимость: "+i.toDisplayString(E.categoryItem.properties.m2Price)+" руб./м2 ",1)]),_:1},8,["size"])):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(Y,{key:1,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),h.value&&((st=f.value)!=null&&st.manager)?(i.openBlock(),i.createBlock(Y,{key:2,size:i.unref(n),closable:!0,round:"",onClose:N},{default:i.withCtx(()=>[i.createVNode($,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var Ke,nt;return[i.createElementVNode("span",_f,[i.createVNode(I),i.createTextVNode(" "+i.toDisplayString((nt=(Ke=f.value)==null?void 0:Ke.manager)==null?void 0:nt.name),1)])]}),default:i.withCtx(()=>{var Ke,nt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((nt=(Ke=f.value)==null?void 0:Ke.manager)==null?void 0:nt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[E.showSlugs||E.showProperties?(i.openBlock(),i.createElementBlock("div",yf,[i.createElementVNode("ul",bf,[E.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:E.categoryItem.id,slug:E.categoryItem.slug},(xe,Se)=>(i.openBlock(),i.createElementBlock("li",{key:Se}," ("+i.toDisplayString(Se)+"): "+i.toDisplayString(xe),1))),128)):i.createCommentVNode("",!0),E.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(E.categoryItem.properties,(xe,Se)=>(i.openBlock(),i.createElementBlock("li",{key:Se}," ("+i.toDisplayString(Se)+"): "+i.toDisplayString(xe),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var xe;return[i.createElementVNode("div",wf,[d.value?(i.openBlock(),i.createBlock($,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(J,{size:i.unref(n),onClick:B},{default:i.withCtx(()=>{var Se;return[(Se=f.value)!=null&&Se.isDisabled?(i.openBlock(),i.createBlock(R,{key:1})):(i.openBlock(),i.createBlock(V,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var Se;return[(Se=f.value)!=null&&Se.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(f.value.hidingComment?`. Причина: '${f.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),h.value&&!((xe=f.value)!=null&&xe.manager)?(i.openBlock(),i.createBlock($,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(J,{size:i.unref(n),onClick:v},{default:i.withCtx(()=>[i.createVNode(pe)]),_:1},8,["size"])]),default:i.withCtx(()=>{var Se,st,Ke;return[(Se=f.value)!=null&&Se.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((Ke=(st=f.value)==null?void 0:st.manager)==null?void 0:Ke.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock($,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(J,{ghost:!0,size:i.unref(n),type:"primary",onClick:F},{default:i.withCtx(()=>[i.createVNode(ie)]),_:1},8,["size"])]),default:i.withCtx(()=>[A[5]||(A[5]=i.createTextVNode(" Редактировать "))]),_:1,__:[5]})):i.createCommentVNode("",!0),p.value.length>0?(i.openBlock(),i.createBlock(re,{key:3,options:p.value,size:i.unref(n),trigger:"click",onSelect:P},{default:i.withCtx(()=>[i.createVNode(J,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(ge)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(E.$slots,"default",{},()=>{var xe;return[s.value?(i.openBlock(),i.createBlock(va,{key:0,"categories-items":E.categoryItem.categories??[],"event-emitter":E.eventEmitter,"filtered-items":(xe=r.value)==null?void 0:xe.categories,"selected-categories-items":E.selectedCategoriesItems,"selected-products-items":E.selectedProductsItems,"show-slugs":E.showSlugs,"show-properties":E.showProperties,"show-product-costs":E.showProductCosts,"allow-name-click":E.allowNameClick,"allow-price-click":E.allowPriceClick,"show-price-history":E.showPriceHistory,"show-product-add-to-cart-button":E.showProductAddToCartButton,"show-product-edit-button":E.showProductEditButton,"product-context-buttons-config":E.productContextButtonsConfig,"show-hide-for-client-button":E.showHideForClientButton,"show-pin-button":E.showPinButton,"show-category-edit-button":E.showCategoryEditButton,"category-context-buttons-config":E.categoryContextButtonsConfig},null,8,["categories-items","event-emitter","filtered-items","selected-categories-items","selected-products-items","show-slugs","show-properties","show-product-costs","allow-name-click","allow-price-click","show-price-history","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config","show-hide-for-client-button","show-pin-button","show-category-edit-button","category-context-buttons-config"])):i.createCommentVNode("",!0),c.value?(i.openBlock(),i.createBlock(Me,{key:1,columns:U.value,data:l.value,bordered:!0,loading:g.value,remote:!0,"row-key":Se=>Se.id,"table-layout":b.value,class:"mt-1"},null,8,["columns","data","loading","row-key","table-layout"])):i.createCommentVNode("",!0),!g.value&&!m.value&&!s.value&&!c.value?(i.openBlock(),i.createBlock(Fe,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(Fe,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),g.value?(i.openBlock(),i.createBlock(Ge,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>A[6]||(A[6]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),xf=Ln(kf,[["__scopeId","data-v-b143377d"]]),Cf={class:"sc-collapse flex w-full flex-col"},Sf={},wa=i.defineComponent({...Sf,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(e,{emit:t}){const n=e,r=t,s=(o,a)=>{r("on-item-header-click",o,a)};return i.provide("itemHeaderClickHandler",s),i.provide("defaultExpandedNames",n.defaultExpandedNames),i.provide("expandedNames",n.expandedNames),(o,a)=>(i.openBlock(),i.createElementBlock("div",Cf,[i.renderSlot(o.$slots,"default")]))}}),Bf={},va=i.defineComponent({...Bf,__name:"category-collapse",props:{categoriesItems:{},loading:{type:Boolean,default:!1},filteredItems:{default:void 0},selectedCategoriesItems:{default:void 0},selectedProductsItems:{default:void 0},showHideForClientButton:{type:[Boolean,Function],default:!1},showPinButton:{type:[Boolean,Function],default:!1},showCategoryEditButton:{type:[Boolean,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(vr,"medium"),r=i.computed(()=>H.isUndefined(t.filteredItems)?t.categoriesItems:t.categoriesItems.filter(o=>{var a;return!!((a=t.filteredItems)!=null&&a[o.id])})),s=(o,a)=>{if(H.isUndefined(a))return;const l=a[o.id];if(l==="*")return;const c={};return c[o.id]=structuredClone(i.toRaw(l)),c};return(o,a)=>{const l=O.NSpin,c=O.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(wa,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(xf,{key:d.id,"category-item":d,"event-emitter":o.eventEmitter,"filtered-items":s(d,o.filteredItems),"selected-categories-items":o.selectedCategoriesItems,"selected-products-items":o.selectedProductsItems,"show-slugs":o.showSlugs,"show-properties":o.showProperties,"show-product-costs":o.showProductCosts,"allow-name-click":o.allowNameClick,"allow-price-click":o.allowPriceClick,"show-price-history":o.showPriceHistory,"show-product-add-to-cart-button":o.showProductAddToCartButton,"show-product-edit-button":o.showProductEditButton,"product-context-buttons-config":o.productContextButtonsConfig,"show-hide-for-client-button":o.showHideForClientButton,"show-pin-button":o.showPinButton,"show-category-edit-button":o.showCategoryEditButton,"category-context-buttons-config":o.categoryContextButtonsConfig},null,8,["category-item","event-emitter","filtered-items","selected-categories-items","selected-products-items","show-slugs","show-properties","show-product-costs","allow-name-click","allow-price-click","show-price-history","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config","show-hide-for-client-button","show-pin-button","show-category-edit-button","category-context-buttons-config"]))),128))]),_:1})):o.loading?(i.openBlock(),i.createBlock(l,{key:1,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>a[0]||(a[0]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])),_:1},8,["size"])):i.createCommentVNode("",!0),!o.loading&&o.categoriesItems.length>0&&r.value.length===0?(i.openBlock(),i.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):i.createCommentVNode("",!0)],64)}}}),Tf={class:"text-sm"},Ef={class:"text-sm"},$f={},Nf=i.defineComponent({...$f,__name:"add-product-to-cart-form",props:{product:{},cartItem:{default:void 0},validation:{default:()=>({length:{},quantity:{},marker:{}})},isSubmitProcessing:{type:Boolean}},emits:["submit"],setup(e,{emit:t}){var l,c,d,h,u,p,f,g;const n=e,r=i.ref(new W.CartItemBase(n.cartItem??new W.CartItemBase({product:n.product,quantity:((c=(l=n.product)==null?void 0:l.properties)==null?void 0:c.minCount)??1,length:((h=(d=n.product)==null?void 0:d.properties)==null?void 0:h.minLength)||((p=(u=n.product)==null?void 0:u.properties)!=null&&p.ignoreMinCountCheck?0:(g=(f=n.product)==null?void 0:f.properties)==null?void 0:g.minCount)||0}))),s=t,o=i.computed(()=>{var y,b,S,x,C,B,v,N,F;const m=((b=(y=n.product)==null?void 0:y.properties)==null?void 0:b.minLength)??((x=(S=n.product)==null?void 0:S.properties)!=null&&x.ignoreMinCountCheck?0:(B=(C=n.product)==null?void 0:C.properties)==null?void 0:B.minCount),_=(N=(v=n.product)==null?void 0:v.properties)==null?void 0:N.maxLength;return m||_?`(${m?`от ${m}`:""}${m&&_?" ":""}${_?`до ${_}`:""} ${(F=n.product)==null?void 0:F.unit})`:""}),a=()=>{W.UnitsHelper.productIsMeasurable(n.product)||delete r.value.length,s("submit",r.value)};return(m,_)=>(i.openBlock(),i.createBlock(i.unref(O.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.unref(W.UnitsHelper).productIsMeasurable(m.product)?(i.openBlock(),i.createBlock(i.unref(O.NFormItem),{key:0,required:!0,feedback:m.validation.length.feedback||"","show-feedback":m.validation.length.showFeedback||i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01||!1,"validation-status":m.validation.length.validationStatus||void 0,label:"Метраж, "+m.product.unit+o.value+"м."},i.createSlots({default:i.withCtx(()=>{var y,b;return[i.createVNode(i.unref(O.NInputNumber),{value:r.value.length,"onUpdate:value":_[0]||(_[0]=S=>r.value.length=S),max:((y=m.product.properties)==null?void 0:y.maxLength)||void 0,min:((b=m.product.properties)==null?void 0:b.minLength)||i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product),step:i.unref(W.UnitsHelper).getProductMultiplicity(m.product),validator:S=>S%i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product)===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]}),_:2},[!m.validation.length.feedback&&i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Tf,"Метраж должен быть кратен "+i.toDisplayString(i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status","label"])):i.createCommentVNode("",!0),i.createVNode(i.unref(O.NFormItem),{required:!0,feedback:m.validation.quantity.feedback||"","show-feedback":m.validation.quantity.showFeedback||i.unref(W.UnitsHelper).getProductMultiplicity(m.product)!==1||!1,"validation-status":m.validation.quantity.validationStatus||void 0,label:"Количество"},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:r.value.quantity,"onUpdate:value":_[1]||(_[1]=y=>r.value.quantity=y),min:i.unref(W.UnitsHelper).getProductMultiplicity(m.product),step:i.unref(W.UnitsHelper).getProductMultiplicity(m.product),validator:y=>y%i.unref(W.UnitsHelper).getProductMultiplicity(m.product)===0,placeholder:"Введите количество",class:"w-full"},null,8,["value","min","step","validator"])]),_:2},[!m.validation.quantity.feedback&&i.unref(W.UnitsHelper).getProductMultiplicity(m.product)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Ef,"Количество должно быть кратно "+i.toDisplayString(i.unref(W.UnitsHelper).getProductMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(O.NFormItem),{feedback:m.validation.marker.feedback||"","show-feedback":m.validation.marker.showFeedback||!1,"validation-status":m.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:r.value.marker,"onUpdate:value":_[2]||(_[2]=y=>r.value.marker=y),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(O.NButton),{loading:m.isSubmitProcessing,disabled:r.value.length===0||r.value.quantity===0,type:"primary",class:"self-start",onClick:_[3]||(_[3]=y=>a())},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(m.cartItem?"Изменить":"В корзину"),1)]),_:1},8,["loading","disabled"])]),_:1}))}}),Rf={class:"flex flex-row gap-1"},Pf={class:"sc-client-name flex flex-col gap-1 text-base"},Ff=["href"],Mf={key:1,class:"text-sc-grey"},Af={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Of={key:0},If={key:1,class:"text-sm"},Vf={},Sr=i.defineComponent({...Vf,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>n.client.lastLoginAt?Sn.format(n.client.lastLoginAt,W.AppConfigProvider.getConfig().dateFormats.uiDateWithTime):""),o=a=>{H.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Cs,d=O.NButton,h=O.NPopover;return i.openBlock(),i.createElementBlock("div",Rf,[a.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=u=>a.$emit("click:client-info",a.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(h,{disabled:i.unref(H.isNil)(a.popoverPosition),placement:a.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Pf,[i.createElementVNode("a",{href:a.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=u=>o(u))},[i.createElementVNode("span",{class:i.normalizeClass({"line-through":!a.client.isActive})},i.toDisplayString(a.client.name),3),a.showSalesDirection&&a.client.salesDirection?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"line-through":!a.client.isActive})}," ("+i.toDisplayString(a.client.salesDirection.name)+") ",3)):i.createCommentVNode("",!0),a.client.isActive?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",Mf," [ Деактивирован ] "))],8,Ff),a.showCityAndRegion&&a.client.city?(i.openBlock(),i.createElementBlock("span",Af," г. "+i.toDisplayString(a.client.city.name)+", "+i.toDisplayString(a.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[a.client.alternativeName?(i.openBlock(),i.createElementBlock("div",Of,i.toDisplayString(a.client.alternativeName),1)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("span",If," Последний вход: "+i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),zf={class:"text-base"},Lf={},ka=i.defineComponent({...Lf,__name:"contragent-with-short-info",props:{contragent:{}},setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("span",zf,i.toDisplayString(t.contragent.name),1))}}),Df={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hf(e,t){return i.openBlock(),i.createElementBlock("svg",Df,t[0]||(t[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),i.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)]))}const Wf=i.markRaw({name:"tabler-mail",render:Hf}),jf=["href"],Xf={},qf=i.defineComponent({...Xf,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(e){return(t,n)=>{const r=Wf;return i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showEmailIcon})},[t.showEmailIcon?(i.openBlock(),i.createBlock(r,{key:0})):i.createCommentVNode("",!0),i.createElementVNode("a",{href:`mailto:${t.email}`,class:"no-underline"},i.toDisplayString(t.email),9,jf)],2)}}}),Yf={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Uf(e,t){return i.openBlock(),i.createElementBlock("svg",Yf,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)]))}const xa=i.markRaw({name:"fa6-brands-viber",render:Uf}),Gf={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Kf=["id"],Zf=["id"],Jf=["fill"],Qf=["fill"];function ep(e,t){return i.openBlock(),i.createElementBlock("svg",Gf,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.logosWhatsappIcon0,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},t[0]||(t[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)]),8,Kf),i.createElementVNode("linearGradient",{id:e.idMap.logosWhatsappIcon1,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},t[1]||(t[1]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)]),8,Zf)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosWhatsappIcon0+")",d:"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"},null,8,Jf),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosWhatsappIcon1+")",d:"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"},null,8,Qf),t[2]||(t[2]=i.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const Ca=i.markRaw({name:"logos-whatsapp-icon",render:ep,setup(){const e=()=>Math.random().toString(36).substr(2,10);return{idMap:{logosWhatsappIcon0:"uicons-"+e(),logosWhatsappIcon1:"uicons-"+e()}}}}),tp={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},np=["id"],ip=["fill"];function rp(e,t){return i.openBlock(),i.createElementBlock("svg",tp,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.logosTelegram0,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},t[0]||(t[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)]),8,np)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosTelegram0+")",d:"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"},null,8,ip),t[1]||(t[1]=i.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const Sa=i.markRaw({name:"logos-telegram",render:rp,setup(){return{idMap:{logosTelegram0:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),sp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function op(e,t){return i.openBlock(),i.createElementBlock("svg",sp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)]))}const Ba=i.markRaw({name:"ion-call",render:op}),ap={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lp(e,t){return i.openBlock(),i.createElementBlock("svg",ap,t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)]))}const cp=i.markRaw({name:"tabler-phone-call",render:lp}),dp={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},hp=["href"],up=["href"],fp=["href"],pp=["href"],gp={},mp=i.defineComponent({...gp,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(e){const t=e,n=i.computed(()=>{try{return t.phone?Wi.parsePhoneNumberWithError(t.phone,t.defaultCountry):void 0}catch{}return t.phone}),r=i.computed(()=>{var l;return H.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),s=i.computed(()=>{var l;return H.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var l;return H.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=cp,h=Ba,u=Sa,p=Ca,f=xa;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=g=>a.value=!a.value),onFocusout:c[1]||(c[1]=g=>a.value=!1),onMouseleave:c[2]||(c[2]=g=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":l.showPhoneIcon})},[l.showPhoneIcon?(i.openBlock(),i.createBlock(d,{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(s.value),1)],2),r.value&&a.value?(i.openBlock(),i.createElementBlock("div",dp,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${o.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[i.createVNode(h)],8,hp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${o.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(u)],8,up)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${o.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(p)],8,fp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${o.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(f)],8,pp)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),_p={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function yp(e,t){return i.openBlock(),i.createElementBlock("svg",_p,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)]))}const bp=i.markRaw({name:"mdi-envelope",render:yp}),wp={class:"flex flex-col gap-1"},vp={key:0,class:"mb-2 flex flex-col text-base"},kp={key:0,class:"text-sc-dark-grey text-sm"},xp={key:1,class:"whitespace-nowrap text-sm"},Cp={key:2,class:"whitespace-nowrap text-sm"},Sp={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},Bp=["href"],Tp=["href"],Ep=["href"],$p=["href"],Np=["href"],Rp={key:0,class:"flex flex-col text-base"},Pp={key:0,class:"text-sc-dark-grey text-sm"},Fp={key:1,class:"mt-2 text-sm"},Mp={key:0,class:"-mt-1"},Ap={},Op=i.defineComponent({...Ap,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(e){const t=e,n=i.computed(()=>{try{return t.contact.phone?Wi.parsePhoneNumberWithError(t.contact.phone,t.defaultCountry):void 0}catch{}return t.contact.phone}),r=i.computed(()=>{var c;return H.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),s=i.computed(()=>{var c;return H.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var c;return H.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("E.164"))??""}),a=i.computed(()=>r.value||t.contact.email),l=i.ref(!1);return(c,d)=>{var _,y;const h=Ba,u=Sa,p=Ca,f=xa,g=bp,m=O.NPopover;return i.openBlock(),i.createElementBlock("div",wp,[i.createVNode(m,{disabled:c.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var b,S,x,C;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(b=c.contact)!=null&&b.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${c.classes}`),style:i.normalizeStyle(c.styles),onMouseenter:d[0]||(d[0]=B=>l.value=!0),onFocusin:d[1]||(d[1]=B=>l.value=!0),onMouseleave:d[2]||(d[2]=B=>l.value=!1),onFocusout:d[3]||(d[3]=B=>l.value=!1)},[i.createElementVNode("div",null,[c.fullView&&(c.contact.name||(S=c.contact)!=null&&S.position)?(i.openBlock(),i.createElementBlock("div",vp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(x=c.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",kp,i.toDisplayString((C=c.contact)==null?void 0:C.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),c.contact.phone?(i.openBlock(),i.createElementBlock("div",xp,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("div",Cp,i.toDisplayString(c.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",Sp,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${o.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[i.createVNode(h)],8,Bp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${o.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(u)],8,Tp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${o.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(p)],8,Ep)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${o.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[i.createVNode(f)],8,$p)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${c.contact.email}`,class:"hover:text-3xl"},[i.createVNode(g)],8,Np)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var b,S,x,C;return[c.contact.name?(i.openBlock(),i.createElementBlock("div",Rp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(b=c.contact)!=null&&b.position?(i.openBlock(),i.createElementBlock("span",Pp,i.toDisplayString((S=c.contact)==null?void 0:S.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(x=c.contact)!=null&&x.comment?(i.openBlock(),i.createElementBlock("div",Fp,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((C=c.contact)==null?void 0:C.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),c.fullView&&((_=c.contact)!=null&&_.comment)?(i.openBlock(),i.createElementBlock("div",Mp,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((y=c.contact)==null?void 0:y.comment),1)])):i.createCommentVNode("",!0)])}}}),Ip={key:0,class:"flex w-fit items-center gap-2"},Vp={key:1,class:"flex flex-wrap gap-1"},zp={key:0},Lp={},qi=i.defineComponent({...Lp,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0}},setup(e){const t=e,n=i.computed(()=>{var r,s;return(s=(r=t.product)==null?void 0:r.properties)==null?void 0:s.planingProductionDate});return(r,s)=>{const o=O.NSpin;return r.isProductSearching?(i.openBlock(),i.createElementBlock("div",Ip,[i.createVNode(o,{size:17,class:"w-fit"}),s[0]||(s[0]=i.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):r.product.isNewRec()?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Vp,[i.createElementVNode("div",null,i.toDisplayString(r.product.code)+" - "+i.toDisplayString(r.product.name)+" - "+i.toDisplayString(r.product.costRub.toLocaleString())+" ₽ / "+i.toDisplayString(r.product.unit),1),n.value?(i.openBlock(),i.createElementBlock("div",zp,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)]))}}}),Dp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Hp(e,t){return i.openBlock(),i.createElementBlock("svg",Dp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)]))}const Br=i.markRaw({name:"ion-close",render:Hp}),Wp={class:"mr-3 flex flex-col gap-2"},jp=["onClick"],Xp={class:"h-full p-2"},qp={},Yp=i.defineComponent({...qp,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(e,{emit:t}){const n=e,r=i.useTemplateRef("drawing-template-containers"),s=t;return i.onMounted(()=>{n.settings.allTemplates.forEach((o,a)=>{var c;const l=(c=r.value)==null?void 0:c.at(a);l&&s("init-draw-template",l,o)})}),i.watch(()=>n.settings.allTemplates,(o,a)=>{i.nextTick(()=>{o.forEach((l,c)=>{var d;if(!a.includes(l)){const h=(d=r.value)==null?void 0:d.at(c);h&&s("init-draw-template",h,l)}})})},{deep:!0}),(o,a)=>{const l=Br;return i.openBlock(),i.createBlock(i.unref(O.NScrollbar),{style:{"max-height":"12.5rem",width:"auto"},trigger:"none"},{default:i.withCtx(()=>[i.createElementVNode("div",Wp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.settings.allTemplates,(c,d)=>(i.openBlock(),i.createElementBlock("div",{key:d,class:"group relative"},[i.createVNode(i.unref(O.NPopover),{trigger:"hover",placement:"right"},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":d===o.selectTemplateIndex}]),onClick:h=>s("template:select",d)},[i.createElementVNode("div",Xp,[i.createElementVNode("div",{ref_for:!0,ref:"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,jp)]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(c.label),1)]),_:2},1024),c.isCustom&&!c.isNewRec()?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,size:"tiny",quaternary:"",circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:h=>s("remove-custom-template",d)},{default:i.withCtx(()=>[i.createVNode(l)]),_:2},1032,["onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Ta=Ln(Yp,[["__scopeId","data-v-828c3059"]]),Up={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Gp(e,t){return i.openBlock(),i.createElementBlock("svg",Up,t[0]||(t[0]=[i.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),i.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 Ea=i.markRaw({name:"ion-trash",render:Gp}),Kp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Zp(e,t){return i.openBlock(),i.createElementBlock("svg",Kp,t[0]||(t[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)]))}const $a=i.markRaw({name:"ion-plus",render:Zp}),Jp={class:"flex flex-col gap-4"},Qp={class:"flex flex-col gap-2"},eg={class:"mt-8 font-bold"},tg={class:"grid grow grid-cols-2 items-start gap-2"},ng={class:"flex flex-col gap-4"},ig={class:"flex gap-3"},rg={},Na=i.defineComponent({...rg,__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","click:view-switch","submit","click:add-line","click:remove-line","click:save-template"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(structuredClone(i.toRaw(n.value.configuratorParams))),o=i.ref(!1),a=()=>{s.value.length>0&&(r("update:params",s.value),l("configuratorParams",s.value))},l=(c,d)=>{const h=new W.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.watch(()=>n.value.configuratorParams,c=>{s.value=H.cloneDeep(i.toRaw(c))},{deep:!0}),i.watch(()=>n.previewParams,c=>{s.value.linesWidths=c.linesWidths,s.value.linesAngles=c.linesAngles},{deep:!0}),(c,d)=>{const h=$a,u=Ea,p=O.NInput;return i.openBlock(),i.createBlock(i.unref(O.NForm),{class:"grid gap-2 md:grid-cols-2 md:gap-6"},{default:i.withCtx(()=>{var f,g,m,_,y,b,S,x,C;return[i.createElementVNode("div",Jp,[d[10]||(d[10]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),c.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(O.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:s.value.startTailType,"onUpdate:value":[d[0]||(d[0]=B=>s.value.startTailType=B),a],options:c.settings.startTailConfigs.map(({label:B},v)=>({label:B,value:v})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",Qp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value.linesAngles,(B,v)=>{var N,F,P,q,U,M;return i.openBlock(),i.createElementBlock("div",{key:v,class:"flex items-start gap-2"},[i.createElementVNode("div",eg,i.toDisplayString(v+1),1),i.createElementVNode("div",tg,[i.createVNode(i.unref(O.NFormItem),{label:"Ширина, мм",required:!0,feedback:((N=c.validation[`lines_widths[${v+1}]`])==null?void 0:N.feedback)||"","show-feedback":((F=c.validation[`lines_widths[${v+1}]`])==null?void 0:F.showFeedback)||!1,"validation-status":(P=c.validation[`lines_widths[${v+1}]`])==null?void 0:P.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:s.value.linesWidths[v],"onUpdate:value":[E=>s.value.linesWidths[v]=E,a],min:s.value.linesWidths.length>1?c.settings.minLineWidth:c.settings.stripMinWidth,max:c.settings.maxLineWidth,step:c.settings.lineWidthStep,validator:E=>E%c.settings.lineWidthStep===0,class:"w-full"},null,8,["value","onUpdate:value","min","max","step","validator"])]),_:2},1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(O.NFormItem),{label:"Угол сгиба, °",required:!0,feedback:((q=c.validation[`lines_angles[${v+1}]`])==null?void 0:q.feedback)||"","show-feedback":((U=c.validation[`lines_angles[${v+1}]`])==null?void 0:U.showFeedback)||!1,"validation-status":(M=c.validation[`lines_angles[${v+1}]`])==null?void 0:M.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:s.value.linesAngles[v],"onUpdate:value":[E=>s.value.linesAngles[v]=E,a],min:c.settings.minLineAngle,max:c.settings.maxLineAngle,step:c.settings.lineAngleStep,validator:E=>E%c.settings.lineAngleStep===0,class:"w-full"},null,8,["value","onUpdate:value","min","max","step","validator"])]),_:2},1032,["feedback","show-feedback","validation-status"])]),i.createVNode(i.unref(O.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:i.withCtx(()=>[c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,size:"medium",onClick:E=>r("click:add-line",v)},{default:i.withCtx(()=>[i.createVNode(h)]),_:2},1032,["onClick"])),c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:1,disabled:s.value.linesWidths.length===1,size:"medium",class:"ml-2",onClick:E=>r("click:remove-line",v)},{default:i.withCtx(()=>[i.createVNode(u)]),_:2},1032,["disabled","onClick"]))]),_:2},1024)])}),128))]),c.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(O.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:s.value.endTailType,"onUpdate:value":[d[1]||(d[1]=B=>s.value.endTailType=B),a],options:c.settings.endTailConfigs.map(({label:B},v)=>({label:B,value:v})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(qi,{"is-product-searching":c.isProductSearching,product:c.value.product},null,8,["is-product-searching","product"]),c.settings.allowSaveTemplates&&c.selectTemplateIndex===c.settings.allTemplates.length-1?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:2,type:"tertiary",class:"self-start",loading:o.value,onClick:d[2]||(d[2]=B=>r("click:save-template"))},{default:i.withCtx(()=>d[9]||(d[9]=[i.createTextVNode(" Сохранить шаблон ")])),_:1,__:[9]},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",ng,[i.createVNode(i.unref(O.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:s.value.colorSide,"onUpdate:value":[d[3]||(d[3]=B=>s.value.colorSide=B),a],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":((f=c.validation.length)==null?void 0:f.showFeedback)||!1,feedback:((g=c.validation.length)==null?void 0:g.feedback)||"","validation-status":(m=c.validation.length)==null?void 0:m.validationStatus,label:`Метраж${c.settings.stripMinLength?" от "+c.settings.stripMinLength:""}${c.settings.stripMaxLength?" до "+c.settings.stripMaxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:s.value.length,"onUpdate:value":[d[4]||(d[4]=B=>s.value.length=B),a],required:!0,max:c.settings.stripMaxLength||void 0,min:c.settings.stripMinLength,step:c.settings.lengthStep,validator:B=>B%c.settings.lengthStep===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]),_:1},8,["show-feedback","feedback","validation-status","label"]),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":((_=c.validation.quantity)==null?void 0:_.showFeedback)||!1,feedback:((y=c.validation.quantity)==null?void 0:y.feedback)||"","validation-status":(b=c.validation.quantity)==null?void 0:b.validationStatus,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:c.value.quantity,"onUpdate:value":d[5]||(d[5]=B=>c.value.quantity=B),min:1,validator:B=>Number.isInteger(B),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":((S=c.validation.marker)==null?void 0:S.showFeedback)||!1,feedback:((x=c.validation.marker)==null?void 0:x.feedback)||"","validation-status":(C=c.validation.marker)==null?void 0:C.validationStatus,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(p,{value:c.value.marker,"onUpdate:value":d[6]||(d[6]=B=>c.value.marker=B),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createElementVNode("div",ig,[i.createVNode(i.unref(O.NButton),{loading:c.isSubmitProcessing,type:"primary",class:"self-start",onClick:d[7]||(d[7]=B=>r("submit",c.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading"]),c.settings.allowShowTable?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,type:"tertiary",class:"self-start",onClick:d[8]||(d[8]=B=>r("click:view-switch"))},{default:i.withCtx(()=>d[11]||(d[11]=[i.createTextVNode(" Показать в виде списка ")])),_:1,__:[11]})):i.createCommentVNode("",!0)])])]}),_:1})}}});var Ra=Object.defineProperty,sg=Object.defineProperties,og=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertySymbols,ag=Object.prototype.hasOwnProperty,lg=Object.prototype.propertyIsEnumerable,Bs=(e,t,n)=>t in e?Ra(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ts=(e,t)=>{for(var n in t||(t={}))ag.call(t,n)&&Bs(e,n,t[n]);if(Pa)for(var n of Pa(t))lg.call(t,n)&&Bs(e,n,t[n]);return e},Es=(e,t)=>sg(e,og(t)),Fa=(e,t)=>{for(var n in t)Ra(e,n,{get:t[n],enumerable:!0})},w=(e,t,n)=>(Bs(e,typeof t!="symbol"?t+"":t,n),n),Ma=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},St=(e,t,n)=>(Ma(e,t,"read from private field"),n?n.call(e):t.get(e)),Aa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},cg=(e,t,n,r)=>(Ma(e,t,"write to private field"),t.set(e,n),n),yt={Image:null,isHeadless:!1,shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(n){return this[n]},e.setAttribute=function(n,r){return this[n]=r,this},e},polyfill:function(e,t){return yt.shim(e),typeof t<"u"&&(yt.Image=t),yt.isHeadless=!0,e}},Oa={};Fa(Oa,{Curve:()=>vi,getAnchorsFromArcData:()=>ug,getComponentOnCubicBezier:()=>Yi,getControlPoints:()=>Ua,getCurveBoundingBox:()=>Xa,getCurveFromPoints:()=>Ya,getCurveLength:()=>ja,getReflection:()=>Rs,integrate:()=>qa,subdivide:()=>Ns});var Ia={};Fa(Ia,{HALF_PI:()=>Ze,NumArray:()=>Gt,TWO_PI:()=>ct,decomposeMatrix:()=>wi,getComputedMatrix:()=>La,getPoT:()=>Da,lerp:()=>Nt,mod:()=>Rt,setMatrix:()=>za,toFixed:()=>Re});var De;typeof window<"u"?De=window:typeof global<"u"?De=global:typeof self<"u"&&(De=self);var Va,ct=Math.PI*2,Ze=Math.PI*.5;function wi(e,t,n,r,s,o){let a;return arguments.length<=1?(a=e.a,t=e.b,n=e.c,r=e.d,s=e.e,o=e.f):a=e,{translateX:s,translateY:o,scaleX:Math.sqrt(a*a+t*t),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(t,a)/Math.PI}}function za(e){Va=e}function La(e,t){t=t&&t.identity()||new Va;let n=e;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let s=0;s<r.length;s++){const a=r[s].elements;t.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9])}return t}function Nt(e,t,n){return n*(t-e)+e}var $s=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Da(e){let t=0;for(;$s[t]&&$s[t]<e;)t++;return $s[t]}function Rt(e,t){for(;e<0;)e+=t;return e%t}var Gt=De.Float32Array||Array,dg=Math.floor;function Re(e){return dg(e*1e6)/1e6}var ee={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},X=class{constructor(){w(this,"_events",{}),w(this,"_bound",!1)}addEventListener(t,n){return(this._events[t]||(this._events[t]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(t,n){if(!this._events)return this;if(!t&&!n)return this._events={},this._bound=!1,this;const r=t?[t]:Object.keys(this._events);for(let s=0,o=r.length;s<o;s++){t=r[s];let a=this._events[t];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let h=a[c];h=h.handler?h.handler:h,n!==h&&l.push(h)}this._events[t]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(t){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[t];if(r)for(let s=0;s<r.length;s++)r[s].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(t,n,r){const s=this;t&&(o.obj=t,o.name=n,o.handler=r,t.on(n,o));function o(){r.apply(s,arguments)}return s}ignore(t,n,r){return t.off(n,r),this}};w(X,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),w(X,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var Ha={x:{enumerable:!0,get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this._bound&&this.dispatchEvent(X.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this._bound&&this.dispatchEvent(X.Types.change))}}},Ht=class extends X{constructor(e=0,t=0){super(),w(this,"_x",0),w(this,"_y",0);for(let n in Ha)Object.defineProperty(this,n,Ha[n]);this.x=e,this.y=t}static add(e,t){return new Ht(e.x+t.x,e.y+t.y)}static sub(e,t){return new Ht(e.x-t.x,e.y-t.y)}static subtract(e,t){return Ht.sub(e,t)}static ratioBetween(e,t){return(e.x*t.x+e.y*t.y)/(e.length()*t.length())}static angleBetween(e,t){if(arguments.length>=4){const s=arguments[0]-arguments[2],o=arguments[1]-arguments[3];return Math.atan2(o,s)}const n=e.x-t.x,r=e.y-t.y;return Math.atan2(r,n)}static distanceBetween(e,t){return Math.sqrt(Ht.distanceBetweenSquared(e,t))}static distanceBetweenSquared(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}set(e,t){return this.x=e,this.y=t,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 Ht(this.x,this.y)}add(e,t){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+=t),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,t){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-=t),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,t){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*=t),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,t){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/=t),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 t=this.x-e.x,n=this.y-e.y;return t*t+n*n}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,t){return t=typeof t>"u"?1e-4:t,this.distanceTo(e)<t}lerp(e,t){const n=(e.x-this.x)*t+this.x,r=(e.y-this.y)*t+this.y;return this.set(n,r)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Re(this.x),y:Re(this.y)}}rotate(e){const t=this.x,n=this.y,r=Math.cos(e),s=Math.sin(e);return this.x=t*r-n*s,this.y=t*s+n*r,this}},Z=Ht;w(Z,"zero",new Ht),w(Z,"left",new Ht(-1,0)),w(Z,"right",new Ht(1,0)),w(Z,"up",new Ht(0,-1)),w(Z,"down",new Ht(0,1));var ve=class extends Z{constructor(t=0,n=0,r=0,s=0,o=0,a=0,l=ee.move){super(t,n),w(this,"controls",{left:new Z,right:new Z}),w(this,"_command",ee.move),w(this,"_relative",!0),w(this,"_rx",0),w(this,"_ry",0),w(this,"_xAxisRotation",0),w(this,"_largeArcFlag",0),w(this,"_sweepFlag",1);for(let d in Wa)Object.defineProperty(this,d,Wa[d]);this.command=l,this.relative=!0;const c=ve.makeBroadcast(this);this.controls.left.set(r,s).addEventListener(X.Types.change,c),this.controls.right.set(o,a).addEventListener(X.Types.change,c)}static makeBroadcast(t){return n;function n(){t._bound&&t.dispatchEvent(X.Types.change)}}static fromObject(t){return new ve().copy(t)}copy(t){return this.x=t.x,this.y=t.y,typeof t.command=="string"&&(this.command=t.command),t.controls&&(t.controls.left&&this.controls.left.copy(t.controls.left),t.controls.right&&this.controls.right.copy(t.controls.right)),typeof t.relative=="boolean"&&(this.relative=t.relative),typeof t.rx=="number"&&(this.rx=t.rx),typeof t.ry=="number"&&(this.ry=t.ry),typeof t.xAxisRotation=="number"&&(this.xAxisRotation=t.xAxisRotation),typeof t.largeArcFlag=="number"&&(this.largeArcFlag=t.largeArcFlag),typeof t.sweepFlag=="number"&&(this.sweepFlag=t.sweepFlag),this}clone(){return new ve().copy(this)}toObject(){return{x:Re(this.x),y:Re(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Re(this.rx),ry:Re(this.ry),xAxisRotation:Re(this.xAxisRotation),largeArcFlag:Re(this.largeArcFlag),sweepFlag:Re(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Wa={command:{enumerable:!0,get:function(){return this._command},set:function(e){this._command!==e&&(this._command=e,this._bound&&this.dispatchEvent(X.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!==!!e&&(this._relative=!!e,this._bound&&this.dispatchEvent(X.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(e){this._rx!==e&&(this._rx=e,this._bound&&this.dispatchEvent(X.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(e){this._ry!==e&&(this._ry=e,this._bound&&this.dispatchEvent(X.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(e){this._xAxisRotation!==e&&(this._xAxisRotation=e,this._bound&&this.dispatchEvent(X.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag!==e&&(this._largeArcFlag=e,this._bound&&this.dispatchEvent(X.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag!==e&&(this._sweepFlag=e,this._bound&&this.dispatchEvent(X.Types.change))}}},hg=0,bt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.18",PublishDate:"2025-04-07T22:33:48.746Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return hg++}},vi={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],weights:[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]]};function Yi(e,t,n,r,s){const o=1-e;return o*o*o*t+3*o*o*e*n+3*o*e*e*r+e*e*e*s}function Ns(e,t,n,r,s,o,a,l,c){c=c||vi.RecursionLimit;const d=c+1;if(Math.abs(e-a)<.001&&Math.abs(t-l)<.001)return[new ve(a,l)];const h=[];for(let u=0;u<d;u++){const p=u/d,f=Yi(p,e,n,s,a),g=Yi(p,t,r,o,l);h.push(new ve(f,g))}return h}function ja(e,t,n,r,s,o,a,l,c){if(e===n&&t===r&&s===a&&o===l){const _=a-e,y=l-t;return Math.sqrt(_*_+y*y)}const d=9*(n-s)+3*(a-e),h=6*(e+s)-12*n,u=3*(n-e),p=9*(r-o)+3*(l-t),f=6*(t+o)-12*r,g=3*(r-t);function m(_){const y=(d*_+h)*_+u,b=(p*_+f)*_+g;return Math.sqrt(y*y+b*b)}return qa(m,0,1,c||vi.RecursionLimit)}function Xa(e,t,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,p,f,g,m,_,y;for(let C=0;C<2;++C){if(C==0?(u=6*e-12*n+6*s,h=-3*e+9*n-9*s+3*a,p=3*n-3*e):(u=6*t-12*r+6*o,h=-3*t+9*r-9*o+3*l,p=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;f=-p/u,0<f&&f<1&&c.push(f);continue}_=u*u-4*p*h,y=Math.sqrt(_),!(_<0)&&(g=(-u+y)/(2*h),0<g&&g<1&&c.push(g),m=(-u-y)/(2*h),0<m&&m<1&&c.push(m))}let b=c.length,S=b,x;for(;b--;)f=c[b],x=1-f,d[0][b]=x*x*x*e+3*x*x*f*n+3*x*f*f*s+f*f*f*a,d[1][b]=x*x*x*t+3*x*x*f*r+3*x*f*f*o+f*f*f*l;return d[0][S]=e,d[1][S]=t,d[0][S+1]=a,d[1][S+1]=l,d[0].length=d[1].length=S+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 qa(e,t,n,r){let s=vi.abscissas[r-2],o=vi.weights[r-2],a=.5*(n-t),l=a+t,c=0,d=r+1>>1,h=r&1?o[c++]*e(l):0;for(;c<d;){const u=a*s[c];h+=o[c++]*(e(l+u)+e(l-u))}return a*h}function Ya(e,t){const n=e.length,r=n-1;for(let s=0;s<n;s++){const o=e[s],a=t?Rt(s-1,n):Math.max(s-1,0),l=t?Rt(s+1,n):Math.min(s+1,r),c=e[a],d=o,h=e[l];Ua(c,d,h),d.command=s===0?ee.move:ee.curve}}function Ua(e,t,n){const r=Z.angleBetween(e,t),s=Z.angleBetween(n,t);let o=Z.distanceBetween(e,t),a=Z.distanceBetween(n,t),l=(r+s)/2;return o<1e-4||a<1e-4?(typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.copy(t),t.controls.right.copy(t)),t):(o*=.33,a*=.33,s<r?l+=Ze:l-=Ze,t.controls.left.x=Math.cos(l)*o,t.controls.left.y=Math.sin(l)*o,l-=Math.PI,t.controls.right.x=Math.cos(l)*a,t.controls.right.y=Math.sin(l)*a,typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.x+=t.x,t.controls.left.y+=t.y,t.controls.right.x+=t.x,t.controls.right.y+=t.y),t)}function Rs(e,t,n){return new Z(2*e.x-(t.x+e.x)-(n?e.x:0),2*e.y-(t.y+e.y)-(n?e.y:0))}function ug(e,t,n,r,s,o,a){const l=bt.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const h=d*o+s,u=n*Math.cos(h),p=r*Math.sin(h),f=new ve(u,p);f.command=ee.line}}var Ga=Array.prototype.slice;function fg(e){if(e==null)return!1;const t=e.length;return typeof t=="number"&&t>=0&&t<4294967296}var ae={isNaN:function(e){return typeof e=="number"&&e!==+e},isElement:function(e){return!!(e&&e.nodeType===1)},isObject:function(e){const t=typeof e;return t==="function"||t==="object"&&!!e},extend:function(e){const t=Ga.call(arguments,1);for(let n=0;n<t.length;n++){const r=t[n];for(let s in r)e[s]=r[s]}return e},defaults:function(e){const t=Ga.call(arguments,1);for(let n=0;n<t.length;n++){const r=t[n];for(let s in r)e[s]===void 0&&(e[s]=r[s])}return e},each:function(e,t,n){const r=n||this,s=!fg(e)&&Object.keys(e),o=(s||e).length;for(let a=0;a<o;a++){const l=s?s[a]:a;t.call(r,e[l],l,e)}return e},performance:De.performance&&De.performance.now?De.performance:Date},Pt={hasEventListeners:typeof De.addEventListener=="function",bind:function(e,t,n,r){return this.hasEventListeners?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n),Pt},unbind:function(e,t,n,r){return Pt.hasEventListeners?e.removeEventListeners(t,n,!!r):e.detachEvent("on"+t,n),Pt},getRequestAnimationFrame:function(){const e=["ms","moz","webkit","o"];let t=0,n=De.requestAnimationFrame;if(!n){for(let s=0;s<e.length;s++)n=De[e[s]+"RequestAnimationFrame"]||n;n=n||r}function r(s,o){const a=new Date().getTime(),l=Math.max(0,16-(a-t)),c=De.setTimeout(d,l);t=a+l;function d(){s(a+l)}return c}return n}},ki=De.document?De.document.createElement("div"):{};ki.id="help-two-load",Object.defineProperty(Pt,"temp",{enumerable:!0,get:function(){return ae.isElement(ki)&&!De.document.head.contains(ki)&&(ki.style.display="none",De.document.head.appendChild(ki)),ki}});var Bt=class extends Error{constructor(t){super(),w(this,"name","Two.js"),w(this,"message"),this.message=t}},pg=De.devicePixelRatio||1;function gg(e){return e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1}function Ps(e){return pg/gg(e)}var Tr=class{constructor(){w(this,"map",{})}add(t,n){return this.map[t]=n,this}remove(t){return delete this.map[t],this}get(t){return this.map[t]}contains(t){return t in this.map}},dt,Bn=class extends Array{constructor(){super(),Aa(this,dt,new X),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 St(this,dt)}set _events(t){cg(this,dt,t)}get _bound(){return St(this,dt)._bound}set _bound(t){St(this,dt)._bound=t}addEventListener(){return St(this,dt).addEventListener.apply(this,arguments)}on(){return St(this,dt).on.apply(this,arguments)}bind(){return St(this,dt).bind.apply(this,arguments)}removeEventListener(){return St(this,dt).removeEventListener.apply(this,arguments)}off(){return St(this,dt).off.apply(this,arguments)}unbind(){return St(this,dt).unbind.apply(this,arguments)}dispatchEvent(){return St(this,dt).dispatchEvent.apply(this,arguments)}trigger(){return St(this,dt).trigger.apply(this,arguments)}listen(){return St(this,dt).listen.apply(this,arguments)}ignore(){return St(this,dt).ignore.apply(this,arguments)}pop(){const t=super.pop.apply(this,arguments);return this.trigger(X.Types.remove,[t]),t}shift(){const t=super.shift.apply(this,arguments);return this.trigger(X.Types.remove,[t]),t}push(){const t=super.push.apply(this,arguments);return this.trigger(X.Types.insert,arguments),t}unshift(){const t=super.unshift.apply(this,arguments);return this.trigger(X.Types.insert,arguments),t}splice(){const t=super.splice.apply(this,arguments);if(this.trigger(X.Types.remove,t),arguments.length>2){const n=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(X.Types.insert,n),this.trigger(X.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(X.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(X.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(t,n){const r=[];for(let s=0;s<this.length;s++){const o=this[s];let a;n?a=t.call(n,o,s):a=t(o,s),r.push(a)}return r}};dt=new WeakMap;var Ka=class extends X{constructor(){super(),w(this,"_flagId",!1),w(this,"_flagClassName",!1),w(this,"_renderer",{}),w(this,"_id",bt.Identifier+bt.uniqueId()),w(this,"_className",""),w(this,"classList",[]);for(let e in Za)Object.defineProperty(this,e,Za[e])}static fromObject(e){const t=new Ka().copy(e);return"id"in e&&(t.id=e.id),t}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return this.renderer.type=e.renderer.type,this.className=e.className,this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}},Dn=Ka;w(Dn,"Properties",["renderer","id","className"]);var Za={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(e){const t=this._id;e!==this._id&&(this._id=e,this._flagId=!0,this.parent&&(delete this.parent.children.ids[t],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(e){this._className!==e&&(this._flagClassName=!0,this.classList=e.split(/\s+?/),this._className=e)}}},Er,Ja={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};De.document&&(Er=document.createElement("a"));var Je=class extends Dn{constructor(e,t){super(),w(this,"_flagSrc",!1),w(this,"_flagImage",!1),w(this,"_flagVideo",!1),w(this,"_flagLoaded",!1),w(this,"_flagRepeat",!1),w(this,"_flagOffset",!1),w(this,"_flagScale",!1),w(this,"_src",""),w(this,"_image",null),w(this,"_loaded",!1),w(this,"_repeat","no-repeat"),w(this,"_scale",1),w(this,"_offset",null);for(let n in Qa)Object.defineProperty(this,n,Qa[n]);if(this._renderer.type="texture",this._renderer.flagOffset=mg.bind(this),this._renderer.flagScale=_g.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new Z,typeof t=="function"){const n=(function(){this.unbind(X.Types.load,n),typeof t=="function"&&t()}).bind(this);this.bind(X.Types.load,n)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const n=Object.prototype.toString.call(e);(n==="[object HTMLImageElement]"||n==="[object HTMLCanvasElement]"||n==="[object HTMLVideoElement]"||n==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const t=new Je().copy(e);return"id"in e&&(t.id=e.id),t}static getAbsoluteURL(e){return Er?(Er.href=e,Er.href):e}static loadHeadlessBuffer(e,t){e.image.onload=t,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const t=Je.getAbsoluteURL(e);if(Je.ImageRegistry.contains(t))return Je.ImageRegistry.get(t);let n;return yt.Image?(n=new yt.Image,yt.shim(n,"img")):De.document?Ja.video.test(t)?n=document.createElement("video"):n=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),n.crossOrigin="anonymous",n.referrerPolicy="no-referrer",n}static load(e,t){let n=e.image,r=Je.getTag(n);e._flagImage&&(/canvas/i.test(r)?Je.Register.canvas(e,t):(e._src=!yt.isHeadless&&n.getAttribute("two-src")||n.src,Je.Register[r](e,t))),e._flagSrc&&(n||(n=Je.getImage(e.src),e.image=n),r=Je.getTag(n),Je.Register[r](e,t))}clone(){const e=new Je(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 Z?e.offset:new Z().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof Z?e.scale:new Z().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(X.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Je.load(this,(function(){this.loaded=!0,this.trigger(X.Types.change).trigger(X.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("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}},Ee=Je;w(Ee,"Properties",["src","loaded","repeat","scale","offset","image"]),w(Ee,"RegularExpressions",Ja),w(Ee,"ImageRegistry",new Tr),w(Ee,"Register",{canvas:function(e,t){e._src="#"+e.id,Je.ImageRegistry.add(e.src,e.image),typeof t=="function"&&t()},img:function(e,t){const n=e.image,r=function(o){!yt.isHeadless&&n.removeEventListener&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),typeof t=="function"&&t()},s=function(o){throw!yt.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),new Bt("unable to load "+e.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!yt.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",s,!1)),e._src=Je.getAbsoluteURL(e._src),!(!yt.isHeadless&&n&&n.getAttribute("two-src"))&&(yt.isHeadless||n.setAttribute("two-src",e.src),Je.ImageRegistry.add(e.src,n),yt.isHeadless?Je.loadHeadlessBuffer(e,r):e.image.src=e.src)},video:function(e,t){if(yt.isHeadless)throw new Bt("video textures are not implemented in headless environments.");const n=function(s){e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",r,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,typeof t=="function"&&t()},r=function(s){throw e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",r,!1),new Bt("unable to load "+e.src)};e._src=Je.getAbsoluteURL(e._src),e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),Je.ImageRegistry.add(e.src,e.image)),e.image.readyState>=4?n():(e.image.addEventListener("canplaythrough",n,!1),e.image.addEventListener("error",r,!1),e.image.src=e.src,e.image.load())}});var Qa={src:{enumerable:!0,get:function(){return this._src},set:function(e){this._src=e,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(e){this._loaded=e,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(e){this._repeat=e,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(e){const t=Ee.getTag(e);let n;switch(t){case"canvas":n="#"+e.id;break;default:n=e.src}Ee.ImageRegistry.contains(n)?this._image=Ee.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(X.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(X.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof Z&&this._scale.unbind(X.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof Z&&this._scale.bind(X.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function mg(){this._flagOffset=!0}function _g(){this._flagScale=!0}var Wt=class extends Dn{constructor(e,t,n){super(),w(this,"_flagOffset",!0),w(this,"_flagOpacity",!0),w(this,"_flagColor",!0),w(this,"_offset",0),w(this,"_opacity",1),w(this,"_color","#fff");for(let r in el)Object.defineProperty(this,r,el[r]);this._renderer.type="stop",this.offset=typeof e=="number"?e:Wt.Index<=0?0:1,this.opacity=typeof n=="number"?n:1,this.color=typeof t=="string"?t:Wt.Index<=0?"#fff":"#000",Wt.Index=(Wt.Index+1)%2}static fromObject(e){const t=new Wt().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Wt.Properties.length;t++){const n=Wt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Wt;return ae.each(Wt.Properties,function(n){t[n]=this[n]},this),e&&e.stops&&e.stops.push(t),t}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",ae.each(Wt.Properties,t=>{e[t]=this[t]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},Kt=Wt;w(Kt,"Index",0),w(Kt,"Properties",["offset","opacity","color"]);var el={offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset=e,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(e){this._color=e,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Hn=class extends Dn{constructor(e){super(),w(this,"_flagStops",!1),w(this,"_flagSpread",!1),w(this,"_flagUnits",!1),w(this,"_spread",""),w(this,"_units","");for(let t in tl)Object.defineProperty(this,t,tl[t]);this._renderer.type="gradient",this._renderer.flagStops=yg.bind(this),this._renderer.bindStops=bg.bind(this),this._renderer.unbindStops=wg.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let t=e.stops;t&&t.length>0&&(t=t.map(r=>r instanceof Kt?r:new Kt().copy(r)));const n=new Hn().copy(e);return"id"in e&&(n.id=e.id),n}clone(e){const t=this.stops.map(r=>r.clone()),n=new Hn(t);return ae.each(Hn.Properties,r=>{n[r]=this[r]},this),e&&e.add(n),n}copy(e){super.copy.call(this,e);for(let t=0;t<Hn.Properties.length;t++){const n=Hn.Properties[t];n in e&&(this[n]=e[n])}return this}toObject(){const e={stops:this.stops.map(t=>t.toObject())};return ae.each(Hn.Properties,t=>{e[t]=this[t]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(X.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}},qe=Hn;w(qe,"Stop",Kt),w(qe,"Properties",["spread","stops","units"]);var tl={spread:{enumerable:!0,get:function(){return this._spread},set:function(e){this._spread=e,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(e){this._units=e,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(e){const t=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(X.Types.insert,t).unbind(X.Types.remove,n),this._stops=new Bn((e||[]).slice(0)),this._stops.bind(X.Types.insert,t).bind(X.Types.remove,n),t(this._stops)}}};function yg(){this._flagStops=!0}function bg(e){let t=e.length;for(;t--;)e[t].bind(X.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function wg(e){let t=e.length;for(;t--;)e[t].unbind(X.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var Ui=class extends qe{constructor(e,t,n,r,s){super(s),w(this,"_flagEndPoints",!1),w(this,"_left",null),w(this,"_right",null);for(let o in nl)Object.defineProperty(this,o,nl[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=vg.bind(this),this.left=new Z,this.right=new Z,typeof e=="number"&&(this.left.x=e),typeof t=="number"&&(this.left.y=t),typeof n=="number"&&(this.right.x=n),typeof r=="number"&&(this.right.y=r)}static fromObject(e){const t=new Ui().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ui.Properties.length;t++){const n=Ui.Properties[t];n in e&&(this[n]=e[n]instanceof Z?e[n]:new Z().copy(e[n]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Ui(this.left._x,this.left._y,this.right._x,this.right._y,t);return ae.each(qe.Properties,function(r){n[r]=this[r]},this),e&&e.add(n),n}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(X.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},Oe=Ui;w(Oe,"Stop",Kt),w(Oe,"Properties",["left","right"]);var nl={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof Z&&this._left.unbind(X.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(X.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof Z&&this._right.unbind(X.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(X.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function vg(){this._flagEndPoints=!0}var Wn=class extends qe{constructor(e,t,n,r,s,o){super(r),w(this,"_flagRadius",!1),w(this,"_flagCenter",!1),w(this,"_flagFocal",!1),w(this,"_radius",0),w(this,"_center",null),w(this,"_focal",null);for(let a in il)Object.defineProperty(this,a,il[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=kg.bind(this),this._renderer.flagFocal=xg.bind(this),this.center=new Z,this.radius=typeof n=="number"?n:1,this.focal=new Z,typeof e=="number"&&(this.center.x=e),typeof t=="number"&&(this.center.y=t),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof o=="number"&&(this.focal.y=o)}static fromObject(e){const t=new Wn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Wn.Properties.length;t++){const n=Wn.Properties[t];n in e&&(/(center|focal)i/.test(n)?this[n]=e[n]instanceof Z?e[n]:new Z().copy(e[n]):typeof e[n]=="number"&&(this[n]=e[MediaKeySystemAccess]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Wn(this.center._x,this.center._y,this._radius,t,this.focal._x,this.focal._y);return ae.each(qe.Properties.concat(Wn.Properties),function(r){n[r]=this[r]},this),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return ae.each(Wn.Properties,function(t){e[t]=this[t]},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(X.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},Ie=Wn;w(Ie,"Stop",Kt),w(Ie,"Properties",["center","radius","focal"]);var il={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(e){this._center&&this._center.unbind(X.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(X.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(X.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(X.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function kg(){this._flagCenter=!0}function xg(){this._flagFocal=!0}function rl(e,t){if(t===0||t===1)return!0;const r=e._length*t;let s=0;for(let o=0;o<e._lengths.length;o++){const a=e._lengths[o];if(s>=r)return r-s>=0;s+=a}return!1}function $r(e,t){const n=e._length;if(t<=0)return 0;if(t>=n)return e._lengths.length-1;for(let r=0,s=0;r<e._lengths.length;r++){if(s+e._lengths[r]>=t)return t-=s,Math.max(r-1,0)+t/e._lengths[r];s+=e._lengths[r]}return-1}function sl(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),ja(r,l,s,c,o,d,a,h,n)}function ol(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Ns(r,l,s,c,o,d,a,h,n)}function jn(e){switch(e.renderer.type){case"texture":return Ee.fromObject(e);case"gradient":return qe.fromObject(e);case"linear-gradient":return Oe.fromObject(e);case"radial-gradient":return Ie.fromObject(e)}return e}var Cg=Math.cos,Sg=Math.sin,al=Math.tan,Fs=[],Ft=class extends X{constructor(e,t,n,r,s,o){super(),w(this,"elements",new Gt(9)),w(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,t,n){if(t.length<=3){const C=e;let B,v,N;const F=t[0]||0,P=t[1]||0,q=t[2]||0;return B=C[0]*F+C[1]*P+C[2]*q,v=C[3]*F+C[4]*P+C[5]*q,N=C[6]*F+C[7]*P+C[8]*q,[B,v,N]}const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],c=e[5],d=e[6],h=e[7],u=e[8],p=t[0],f=t[1],g=t[2],m=t[3],_=t[4],y=t[5],b=t[6],S=t[7],x=t[8];return n=n||new Gt(9),n[0]=r*p+s*m+o*b,n[1]=r*f+s*_+o*S,n[2]=r*g+s*y+o*x,n[3]=a*p+l*m+c*b,n[4]=a*f+l*_+c*S,n[5]=a*g+l*y+c*x,n[6]=d*p+h*m+u*b,n[7]=d*f+h*_+u*S,n[8]=d*g+h*y+u*x,n}static fromObject(e){return new Ft().copy(e)}set(e,t,n,r,s,o,a,l,c){if(typeof t>"u"){const d=e;e=d[0],t=d[1],n=d[2],r=d[3],s=d[4],o=d[5],a=d[6],l=d[7],c=d[8]}return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=s,this.elements[5]=o,this.elements[6]=a,this.elements[7]=l,this.elements[8]=c,this.trigger(X.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(X.Types.change)}identity(){return this.elements[0]=Ft.Identity[0],this.elements[1]=Ft.Identity[1],this.elements[2]=Ft.Identity[2],this.elements[3]=Ft.Identity[3],this.elements[4]=Ft.Identity[4],this.elements[5]=Ft.Identity[5],this.elements[6]=Ft.Identity[6],this.elements[7]=Ft.Identity[7],this.elements[8]=Ft.Identity[8],this.trigger(X.Types.change)}multiply(e,t,n,r,s,o,a,l,c){if(typeof t>"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(X.Types.change);if(typeof n>"u"&&(n=1),typeof r>"u"){e=e||0,t=t||0,n=n||0,s=this.elements;const M=s[0]*e+s[1]*t+s[2]*n,E=s[3]*e+s[4]*t+s[5]*n,A=s[6]*e+s[7]*t+s[8]*n;return[M,E,A]}const d=this.elements,h=[e,t,n,r,s,o,a,l,c],u=d[0],p=d[1],f=d[2],g=d[3],m=d[4],_=d[5],y=d[6],b=d[7],S=d[8],x=h[0],C=h[1],B=h[2],v=h[3],N=h[4],F=h[5],P=h[6],q=h[7],U=h[8];return this.elements[0]=u*x+p*v+f*P,this.elements[1]=u*C+p*N+f*q,this.elements[2]=u*B+p*F+f*U,this.elements[3]=g*x+m*v+_*P,this.elements[4]=g*C+m*N+_*q,this.elements[5]=g*B+m*F+_*U,this.elements[6]=y*x+b*v+S*P,this.elements[7]=y*C+b*N+S*q,this.elements[8]=y*B+b*F+S*U,this.trigger(X.Types.change)}inverse(e){const t=this.elements;e=e||new Ft;const n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],h=t[8],u=h*a-l*d,p=-h*o+l*c,f=d*o-a*c;let g=n*u+r*p+s*f;return g?(g=1/g,e.elements[0]=u*g,e.elements[1]=(-h*r+s*d)*g,e.elements[2]=(l*r-s*a)*g,e.elements[3]=p*g,e.elements[4]=(h*n-s*c)*g,e.elements[5]=(-l*n+s*o)*g,e.elements[6]=f*g,e.elements[7]=(-d*n+r*c)*g,e.elements[8]=(a*n-r*o)*g,e):null}scale(e,t){return arguments.length<=1&&(t=e),this.multiply(e,0,0,0,t,0,0,0,1)}rotate(e){const t=Cg(e),n=Sg(e);return this.multiply(t,-n,0,n,t,0,0,0,1)}translate(e,t){return this.multiply(1,0,e,0,1,t,0,0,1)}skewX(e){const t=al(e);return this.multiply(1,t,0,0,1,0,0,0,1)}skewY(e){const t=al(e);return this.multiply(1,0,0,t,1,0,0,0,1)}toString(e){return Fs.length=0,this.toTransformArray(e,Fs),Fs.map(Re).join(" ")}toTransformArray(e,t){const n=this.elements,r=!!t,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],d=n[5];if(e){const h=n[6],u=n[7],p=n[8];if(r){t[0]=s,t[1]=l,t[2]=h,t[3]=o,t[4]=c,t[5]=u,t[6]=a,t[7]=d,t[8]=p;return}return[s,l,h,o,c,u,a,d,p]}if(r){t[0]=s,t[1]=l,t[2]=o,t[3]=c,t[4]=a,t[5]=d;return}return[s,l,o,c,a,d]}toArray(e,t){const n=this.elements,r=!!t,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],d=n[5];if(e){const h=n[6],u=n[7],p=n[8];if(r){t[0]=s,t[1]=o,t[2]=a,t[3]=l,t[4]=c,t[5]=d,t[6]=h,t[7]=u,t[8]=p;return}return[s,o,a,l,c,d,h,u,p]}if(r){t[0]=s,t[1]=o,t[2]=a,t[3]=l,t[4]=c,t[5]=d;return}return[s,o,a,l,c,d]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ft().copy(this)}},Xn=Ft;w(Xn,"Identity",[1,0,0,0,1,0,0,0,1]),za(Xn);var Ms=class extends Dn{constructor(){super(),w(this,"_flagMatrix",!0),w(this,"_flagScale",!1),w(this,"_matrix",null),w(this,"_worldMatrix",null),w(this,"_position",null),w(this,"_rotation",0),w(this,"_scale",1),w(this,"_skewX",0),w(this,"_skewY",0);for(let e in Nr)Object.defineProperty(this,e,Nr[e]);this._renderer.flagMatrix=ll.bind(this),this.isShape=!0,this.matrix=new Xn,this.worldMatrix=new Xn,this.position=new Z,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const t=new Ms().copy(e);return"id"in e&&(t.id=e.id),t}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return Nr.position.get.apply(this,arguments)}set translation(e){Nr.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof Z?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 Z?e.scale:new Z(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 t=new Ms;return t.position.copy(this.position),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._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 Z?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}_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 Z?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}},hn=Ms;w(hn,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Nr={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(X.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(X.Types.change,this._renderer.flagMatrix),ll.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(e){this._rotation=e,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof Z&&this._scale.unbind(X.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof Z&&this._scale.bind(X.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(e){this._skewX=e,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(e){this._skewY=e,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(e){this._matrix=e,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return La(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function ll(){this._flagMatrix=!0}var xi=Math.min,Ci=Math.max,Bg=Math.ceil,Tg=Math.floor,Eg=new Z,Tn=class extends hn{constructor(e,t,n,r){super(),w(this,"_flagVertices",!0),w(this,"_flagLength",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagCap",!0),w(this,"_flagJoin",!0),w(this,"_flagMiter",!0),w(this,"_flagMask",!1),w(this,"_flagClip",!1),w(this,"_length",0),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_cap","round"),w(this,"_join","round"),w(this,"_miter",4),w(this,"_closed",!0),w(this,"_curved",!1),w(this,"_automatic",!0),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_mask",null),w(this,"_clip",!1),w(this,"_dashes",null);for(let s in cl)Object.defineProperty(this,s,cl[s]);this._renderer.type="path",this._renderer.flagVertices=dl.bind(this),this._renderer.bindVertices=hl.bind(this),this._renderer.unbindVertices=ul.bind(this),this._renderer.flagFill=fl.bind(this),this._renderer.flagStroke=pl.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!t,this.curved=!!n,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=!r,this.dashes=[],this.dashes.offset=0}static fromObject(e){const t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new Tn().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e),this.vertices=[];for(let t=0;t<e.vertices.length;t++){const n=e.vertices[t];n instanceof ve?this.vertices.push(e.vertices[t].clone()):this.vertices.push(new ve().copy(n))}for(let t=0;t<Tn.Properties.length;t++){const n=Tn.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Tn;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<Tn.Properties.length;n++){const r=Tn.Properties[n];t[r]=this[r]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(t=>t.toObject()),ae.each(Tn.Properties,t=>{typeof this[t]<"u"&&(this[t].toObject?e[t]=this[t].toObject():e[t]=this[t])},this),e}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),t=e.width/2,n=e.height/2,r=e.left+e.width/2,s=e.top+e.height/2;for(let o=0;o<this.vertices.length;o++){const a=this.vertices[o];a.x-=r,a.y-=s,a.x+=t,a.y+=n}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.x+=t,this.mask.translation.y-=s,this.mask.translation.y+=n),this}center(){const e=this.getBoundingClientRect(!0),t=e.left+e.width/2-this.translation.x,n=e.top+e.height/2-this.translation.y;for(let r=0;r<this.vertices.length;r++){const s=this.vertices[r];s.x-=t,s.y-=n}return this.mask&&(this.mask.translation.x-=t,this.mask.translation.y-=n),this}getBoundingClientRect(e){let t,n,r,s,o,a,l=1/0,c=-1/0,d=1/0,h=-1/0;if(this._update(!0),t=e?this.matrix:this.worldMatrix,n=(this.linewidth||0)/2,r=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:u,scaleY:p}=wi(t.elements[0],t.elements[3],t.elements[1],t.elements[4],t.elements[2],t.elements[5]);typeof u=="number"&&typeof p=="number"&&(n=Math.max(u,p)*(this.linewidth||0)/2)}else n*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(r<=0)return{width:0,height:0};for(s=0;s<r;s++){a=this._renderer.vertices[s],o=this._renderer.vertices[(s+r-1)%r];const[u,p]=t.multiply(o.x,o.y),[f,g]=t.multiply(a.x,a.y);if(o.controls&&a.controls){let m=o.controls.right.x,_=o.controls.right.y;o.relative&&(m+=o.x,_+=o.y);let[y,b]=t.multiply(m,_),S=a.controls.left.x,x=a.controls.left.y;a.relative&&(S+=a.x,x+=a.y);let[C,B]=t.multiply(S,x);const v=Xa(u,p,y,b,C,B,f,g);d=xi(v.min.y-n,d),l=xi(v.min.x-n,l),c=Ci(v.max.x+n,c),h=Ci(v.max.y+n,h)}else s<=1&&(d=xi(p-n,d),l=xi(u-n,l),c=Ci(u+n,c),h=Ci(p+n,h)),d=xi(g-n,d),l=xi(f-n,l),c=Ci(f+n,c),h=Ci(g+n,h)}return{top:d,left:l,right:c,bottom:h,width:c-l,height:h-d}}getPointAt(e,t){let n,r,s,o,a,l,c,d,h,u,p,f,g,m,_,y=this.length*Math.min(Math.max(e,0),1);const b=this.vertices.length,S=b-1;let x=null,C=null;for(let K=0,R=this._lengths.length,$=0;K<R;K++){if($+this._lengths[K]>=y){this._closed?(n=Rt(K,b),r=Rt(K-1,b),K===0&&(n=r,r=K)):(n=K,r=Math.min(Math.max(K-1,0),S)),x=this.vertices[n],C=this.vertices[r],y-=$,this._lengths[K]!==0?e=y/this._lengths[K]:e=0;break}$+=this._lengths[K]}if(x===null||C===null)return null;if(x){if(!C)return x}else return C;_=C.controls&&C.controls.right,m=x.controls&&x.controls.left,a=C.x,u=C.y,l=(_||C).x,p=(_||C).y,c=(m||x).x,f=(m||x).y,d=x.x,g=x.y,_&&C.relative&&(l+=C.x,p+=C.y),m&&x.relative&&(c+=x.x,f+=x.y),o=Yi(e,a,l,c,d),h=Yi(e,u,p,f,g);const B=Nt(a,l,e),v=Nt(u,p,e),N=Nt(l,c,e),F=Nt(p,f,e),P=Nt(c,d,e),q=Nt(f,g,e),U=Nt(B,N,e),M=Nt(v,F,e),E=Nt(N,P,e),A=Nt(F,q,e);return ae.isObject(t)?(t.x=o,t.y=h,t instanceof ve&&(t.controls.left.x=U,t.controls.left.y=M,t.controls.right.x=E,t.controls.right.y=A,(typeof t.relative!="boolean"||t.relative)&&(t.controls.left.x-=o,t.controls.left.y-=h,t.controls.right.x-=o,t.controls.right.y-=h)),t.t=e,t):(s=new ve(o,h,U-o,M-h,E-o,A-h,this._curved?ee.curve:ee.line),s.t=e,s)}plot(){if(this.curved)return Ya(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ee.move:ee.line;return this}subdivide(e){this._update();const t=this.vertices.length-1,n=this._closed||this.vertices[t]._command===ee.close;let r=this.vertices[t],s=[],o;return ae.each(this.vertices,function(a,l){if(l<=0&&!n){r=a;return}if(a.command===ee.move){s.push(new ve(r.x,r.y)),l>0&&(s[s.length-1].command=ee.line),r=a;return}o=ol(a,r,e),s=s.concat(o),ae.each(o,function(c,d){d<=0&&r.command===ee.move?c.command=ee.move:c.command=ee.line}),l>=t&&(this._closed&&this._automatic&&(r=a,o=ol(a,r,e),s=s.concat(o),ae.each(o,function(c,d){d<=0&&r.command===ee.move?c.command=ee.move:c.command=ee.line})),s.push(new ve(a.x,a.y)),s[s.length-1].command=n?ee.close:ee.line),r=a},this),this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(e,t){t||this._update();const r=this.vertices.length-1;let s=this.vertices[r],o=0;return typeof this._lengths>"u"&&(this._lengths=[]),ae.each(this.vertices,function(a,l){if(l<=0||a.command===ee.move){s=a,this._lengths[l]=0;return}this._lengths[l]=sl(a,s,e),o+=this._lengths[l],s=a},this),this._length=o,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,t=this._closed,n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),s=$r(this,n*this._length),o=$r(this,r*this._length),a=Bg(s),l=Tg(o);let c,d,h,u,p,f;for(this._renderer.vertices.length=0,f=0;f<e;f++)this._renderer.collection.length<=f&&this._renderer.collection.push(new ve),f>l&&!d?(p=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(r,p),p.command=this._renderer.collection[f].command,this._renderer.vertices.push(p),d=p,h=this._collection[f-1],h&&h.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),h.relative?this._renderer.collection[f-1].controls.right.copy(h.controls.right).lerp(Z.zero,1-p.t):this._renderer.collection[f-1].controls.right.copy(h.controls.right).lerp(h,1-p.t))):f>=a&&f<=l&&(p=this._renderer.collection[f].copy(this._collection[f]),this._renderer.vertices.push(p),f===l&&rl(this,r)?(d=p,!t&&d.controls&&(d.relative?d.controls.right.clear():d.controls.right.copy(d))):f===a&&rl(this,n)&&(c=p,c.command=ee.move,!t&&c.controls&&(c.relative?c.controls.left.clear():c.controls.left.copy(c))));a>0&&!c&&(f=a-1,p=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(n,p),p.command=ee.move,this._renderer.vertices.unshift(p),u=this._collection[f+1],u&&u.controls&&(p.controls.left.clear(),u.relative?this._renderer.collection[f+1].controls.left.copy(u.controls.left).lerp(Z.zero,p.t):(Eg.copy(u),this._renderer.collection[f+1].controls.left.copy(u.controls.left).lerp(u,p.t))))}return hn.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=!1,hn.prototype.flagReset.call(this),this}},Ce=Tn;w(Ce,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),w(Ce,"Utils",{getCurveLength:sl});var cl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.bind(X.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(e){this._closed=!!e,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e===this._automatic)return;this._automatic=!!e;const t=this._automatic?"ignore":"listen";ae.each(this.vertices,function(n){n[t]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){const t=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(X.Types.insert,t).unbind(X.Types.remove,n),e instanceof Bn?this._collection=e:this._collection=new Bn(e||[]),this._collection.bind(X.Types.insert,t).bind(X.Types.remove,n),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function dl(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function hl(e){let t=e.length;for(;t--;)e[t].bind(X.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ul(e){let t=e.length;for(;t--;)e[t].unbind(X.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function fl(){this._flagFill=!0}function pl(){this._flagStroke=!0}var Gi=class extends Ce{constructor(e,t,n,r){const s=[new ve,new ve,new ve,new ve];super(s,!0,!1,!0),w(this,"_flagWidth",0),w(this,"_flagHeight",0),w(this,"_width",0),w(this,"_height",0),w(this,"_origin",null),this._renderer.type="rectangle";for(let o in gl)Object.defineProperty(this,o,gl[o]);this.width=typeof n=="number"?n:1,this.height=typeof r=="number"?r:1,this.origin=new Z,typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t),this._update()}static fromObject(e){const t=new Gi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Gi.Properties.length;t++){const n=Gi.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,t=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new ve),this.vertices[0].set(-e,-t).sub(this._origin).command=ee.move,this.vertices[1].set(e,-t).sub(this._origin).command=ee.line,this.vertices[2].set(e,t).sub(this._origin).command=ee.line,this.vertices[3].set(-e,t).sub(this._origin).command=ee.line,this.vertices[4]&&(this.vertices[4].set(-e,-t).sub(this._origin).command=ee.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=new Gi(0,0,this.width,this.height);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Ce.Properties.length;n++){const r=Ce.Properties[n];t[r]=this[r]}return e&&e.add(t),t}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}},En=Gi;w(En,"Properties",["width","height"]);var gl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(X.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(X.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Ki=class extends En{constructor(e,t,n,r,s,o){super(t,n,0,0),w(this,"_flagTexture",!1),w(this,"_flagColumns",!1),w(this,"_flagRows",!1),w(this,"_flagFrameRate",!1),w(this,"_flagIndex",!1),w(this,"_amount",1),w(this,"_duration",0),w(this,"_startTime",0),w(this,"_playing",!1),w(this,"_firstFrame",0),w(this,"_lastFrame",0),w(this,"_loop",!0),w(this,"_texture",null),w(this,"_columns",1),w(this,"_rows",1),w(this,"_frameRate",0),w(this,"_index",0),w(this,"_origin",null);for(let a in ml)Object.defineProperty(this,a,ml[a]);this.noStroke(),this.noFill(),e instanceof Ee?this.texture=e:typeof e=="string"&&(this.texture=new Ee(e)),this.origin=new Z,this._update(),typeof r=="number"&&(this.columns=r),typeof s=="number"&&(this.rows=s),typeof o=="number"&&(this.frameRate=o),this.index=0}static fromObject(e){const t=new Ki().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ki.Properties.length;t++){const n=Ki.Properties[t];n in e&&(this[n]=e[n])}return this}play(e,t,n){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=ae.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof t=="number"&&(this._lastFrame=t),typeof n=="function"?this._onLastFrame=n: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 t=new Ki(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&t.play(this._firstFrame,this._lastFrame),t.loop=this.loop,t.firstFrame=this.firstFrame,t.lastFrame=this.lastFrame,e&&e.add(t),t}toObject(){const e=super.toObject.call(this);return 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}_update(){const e=this._texture,t=this._columns,n=this._rows;let r,s,o,a,l,c,d,h,u;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)){d=e.image.width,h=e.image.height,r=d/t,s=h/n,a=this._amount,this.width!==r&&(this.width=r),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(ae.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=ae.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),c=Nt(this._firstFrame,u,o/l),c=Math.floor(c),c!==this._index&&(this._index=c,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%t,f=Math.floor(this._index/t),g=-r*p+(d-r)/2,m=-s*f+(h-s)/2;g!==e.offset.x&&(e.offset.x=g),m!==e.offset.y&&(e.offset.y=m)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},Rr=Ki;w(Rr,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var ml={texture:{enumerable:!0,get:function(){return this._texture},set:function(e){this._texture=e,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(e){this._columns=e,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(e){this._rows=e,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}},As,_l=class extends Bn{constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments),super(t),Aa(this,As,{}),this.attach(t),this.on(X.Types.insert,this.attach),this.on(X.Types.remove,this.detach)}get ids(){return St(this,As)}attach(t){for(let n=0;n<t.length;n++){const r=t[n];r&&r.id&&(this.ids[r.id]=r)}return this}detach(t){for(let n=0;n<t.length;n++)delete this.ids[t[n].id];return this}};As=new WeakMap;var qn=class extends Ce{constructor(e,t,n,r,s,o,a){const l=a||bt.Resolution*3,c=[];for(let d=0;d<l;d++)c.push(new ve);super(c,!0,!1,!0),w(this,"_flagStartAngle",!1),w(this,"_flagEndAngle",!1),w(this,"_flagInnerRadius",!1),w(this,"_flagOuterRadius",!1),w(this,"_startAngle",0),w(this,"_endAngle",ct),w(this,"_innerRadius",0),w(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let d in yl)Object.defineProperty(this,d,yl[d]);typeof n=="number"&&(this.innerRadius=n),typeof r=="number"&&(this.outerRadius=r),typeof s=="number"&&(this.startAngle=s),typeof o=="number"&&(this.endAngle=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new qn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<qn.Properties.length;t++){const n=qn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,t=this._endAngle,n=this._innerRadius,r=this._outerRadius,s=Rt(e,ct)===Rt(t,ct),o=n>0,a=this.vertices;let l=o?a.length/2:a.length,c,d=0,h,u,p,f,g,m,_,y,b;for(s?l--:o||(l-=2),h=0,u=l-1;h<l;h++){switch(p=h/u,f=a[d],g=p*(t-e)+e,m=(t-e)/l,_=r*Math.cos(g),y=r*Math.sin(g),h){case 0:c=ee.move;break;default:c=ee.curve}f.command=c,f.x=_,f.y=y,f.controls.left.clear(),f.controls.right.clear(),f.command===ee.curve&&(b=r*m/Math.PI,f.controls.left.x=b*Math.cos(g-Ze),f.controls.left.y=b*Math.sin(g-Ze),f.controls.right.x=b*Math.cos(g+Ze),f.controls.right.y=b*Math.sin(g+Ze),h===1&&f.controls.left.multiplyScalar(2),h===u&&f.controls.right.multiplyScalar(2)),d++}if(o){for(s?(a[d].command=ee.close,d++):(l--,u=l-1),h=0;h<l;h++)p=h/u,f=a[d],g=(1-p)*(t-e)+e,m=(t-e)/l,_=n*Math.cos(g),y=n*Math.sin(g),c=ee.curve,h<=0&&(c=s?ee.move:ee.line),f.command=c,f.x=_,f.y=y,f.controls.left.clear(),f.controls.right.clear(),f.command===ee.curve&&(b=n*m/Math.PI,f.controls.left.x=b*Math.cos(g+Ze),f.controls.left.y=b*Math.sin(g+Ze),f.controls.right.x=b*Math.cos(g-Ze),f.controls.right.y=b*Math.sin(g-Ze),h===1&&f.controls.left.multiplyScalar(2),h===u&&f.controls.right.multiplyScalar(2)),d++;a[d].copy(a[0]),a[d].command=ee.line}else s||(a[d].command=ee.line,a[d].x=0,a[d].y=0,d++,a[d].copy(a[0]),a[d].command=ee.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 t=this.innerRadius,n=this.outerRadius,r=this.startAngle,s=this.endAngle,o=this.vertices.length,a=new qn(0,0,t,n,r,s,o);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 l=0;l<Ce.Properties.length;l++){const c=Ce.Properties[l];a[c]=this[c]}return e&&e.add(a),a}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let t=0;t<qn.Properties.length;t++){const n=qn.Properties[t];e[n]=this[n]}return e}},Pr=qn;w(Pr,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var yl={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(e){this._startAngle=e,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(e){this._endAngle=e,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(e){this._innerRadius=e,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(e){this._outerRadius=e,this._flagOuterRadius=!0}}},Os=Math.cos,Is=Math.sin,Yn=class extends Ce{constructor(e,t,n,r){const s=r?Math.max(r,2):4,o=[];for(let a=0;a<s;a++)o.push(new ve(0,0,0,0,0,0));super(o,!0,!0,!0),w(this,"_flagRadius",!1),w(this,"_radius",0),this._renderer.type="circle";for(let a in bl)Object.defineProperty(this,a,bl[a]);typeof n=="number"&&(this.radius=n),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Yn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Yn.Properties.length;t++){const n=Yn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const t=4/3*Math.tan(Math.PI/(e*2)),n=this._radius,r=n*t;for(let s=0;s<this.vertices.length;s++){const a=s/e*ct,l=n*Os(a),c=n*Is(a),d=r*Os(a-Ze),h=r*Is(a-Ze),u=r*Os(a+Ze),p=r*Is(a+Ze),f=this.vertices[s];f.command=s===0?ee.move:ee.curve,f.set(l,c),f.controls.left.set(d,h),f.controls.right.set(u,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const t=new Yn(0,0,this.radius,this.vertices.length);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Ce.Properties.length;n++){const r=Ce.Properties[n];t[r]=this[r]}return e&&e.add(t),t}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let t=0;t<Yn.Properties.length;t++){const n=Yn.Properties[t];e[n]=this[n]}return e}},Zi=Yn;w(Zi,"Properties",["radius"]);var bl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}}},Vs=Math.cos,zs=Math.sin,Un=class extends Ce{constructor(e,t,n,r,s){typeof r!="number"&&typeof n=="number"&&(r=n);const o=s?Math.max(s,2):4,a=[];for(let l=0;l<o;l++)a.push(new ve);super(a,!0,!0,!0),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_width",0),w(this,"_height",0),this._renderer.type="ellipse";for(let l in wl)Object.defineProperty(this,l,wl[l]);typeof n=="number"&&(this.width=n*2),typeof r=="number"&&(this.height=r*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Un().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Un.Properties.length;t++){const n=Un.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const t=4/3*Math.tan(Math.PI/(this.vertices.length*2)),n=this._width/2,r=this._height/2;for(let s=0;s<this.vertices.length;s++){const a=s/e*ct,l=n*Vs(a),c=r*zs(a),d=n*t*Vs(a-Ze),h=r*t*zs(a-Ze),u=n*t*Vs(a+Ze),p=r*t*zs(a+Ze),f=this.vertices[s];f.command=s===0?ee.move:ee.curve,f.set(l,c),f.controls.left.set(d,h),f.controls.right.set(u,p)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=this.width/2,n=this.height/2,r=this.vertices.length,s=new Un(0,0,t,n,r);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 o=0;o<Ce.Properties.length;o++){const a=Ce.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let t=0;t<Un.Properties.length;t++){const n=Un.Properties[t];e[n]=this[n]}return e}},Ji=Un;w(Ji,"Properties",["width","height"]);var wl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}}},$g=Math.ceil,Ng=Math.floor,$n=class extends hn{constructor(e){super(),w(this,"_flagVertices",!0),w(this,"_flagLength",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagSize",!0),w(this,"_flagSizeAttenuation",!0),w(this,"_length",0),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_size",1),w(this,"_sizeAttenuation",!1),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_dashes",null),w(this,"noFill",Ce.prototype.noFill),w(this,"noStroke",Ce.prototype.noStroke),w(this,"corner",Ce.prototype.corner),w(this,"center",Ce.prototype.center),w(this,"getBoundingClientRect",Ce.prototype.getBoundingClientRect),w(this,"_updateLength",Ce.prototype._updateLength);for(let t in vl)Object.defineProperty(this,t,vl[t]);this._renderer.type="points",this._renderer.flagVertices=dl.bind(this),this._renderer.bindVertices=hl.bind(this),this._renderer.unbindVertices=ul.bind(this),this._renderer.flagFill=fl.bind(this),this._renderer.flagStroke=pl.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 t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new $n().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e);for(let t=0;t<e.vertices.length;t++){const n=e.vertices[t];n instanceof ve?this.vertices.push(e.vertices[t].clone()):this.vertices.push(new ve().copy(n))}for(let t=0;t<$n.Properties.length;t++){const n=$n.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new $n;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<$n.Properties.length;n++){const r=$n.Properties[n];t[r]=this[r]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(t=>t.toObject()),ae.each($n.Properties,function(t){typeof this[t]<"u"&&(this[t].toObject?e[t]=this[t].toObject():e[t]=this[t])},this),e}subdivide(e){this._update();let t=[];for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n],s=this.vertices[n-1];if(!s)continue;const o=r.x,a=r.y,l=s.x,c=s.y,d=Ns(o,a,o,a,l,c,l,c,e);t=t.concat(d)}return this.vertices=t,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),t=Math.max(this._beginning,this._ending),n=$r(this,e*this._length),r=$r(this,t*this._length),s=$g(n),o=Ng(r);let a=0,l;this._renderer.vertices=[],this._renderer.collection=[];for(let c=0;c<this._collection.length;c++)c>=s&&c<=o&&(l=this._collection[c],this._renderer.collection.push(l),this._renderer.vertices[a*2+0]=l.x,this._renderer.vertices[a*2+1]=l.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}},Fr=$n;w(Fr,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);var vl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.bind(X.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(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){const t=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(X.Types.insert,t).unbind(X.Types.remove,n),e instanceof Bn?this._collection=e:this._collection=new Bn(e||[]),this._collection.bind(X.Types.insert,t).bind(X.Types.remove,n),t(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}},Rg=Math.cos,Pg=Math.sin,Gn=class extends Ce{constructor(e,t,n,r){r=Math.max(r||0,3),super(),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_flagSides",!1),w(this,"_radius",0),w(this,"_width",0),w(this,"_height",0),w(this,"_sides",0),this._renderer.type="polygon";for(let s in kl)Object.defineProperty(this,s,kl[s]);this.closed=!0,this.automatic=!1,typeof n=="number"&&(this.radius=n),typeof r=="number"&&(this.sides=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Gn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Gn.Properties.length;t++){const n=Gn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,t=e+1;let n=this.vertices.length;n>e&&(this.vertices.splice(e-1,n-e),n=e);for(let r=0;r<t;r++){const s=(r+.5)/e,o=ct*s+Math.PI/2,a=this._width*Rg(o)/2,l=this._height*Pg(o)/2;r>=n?this.vertices.push(new ve(a,l)):this.vertices[r].set(a,l),this.vertices[r].command=r===0?ee.move:ee.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const t=new Gn(0,0,0,this.sides);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,t.width=this.width,t.height=this.height,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Ce.Properties.length;n++){const r=Ce.Properties[n];t[r]=this[r]}return e&&e.add(t),t}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let t=0;t<Gn.Properties.length;t++){const n=Gn.Properties[t];e[n]=this[n]}return e}},Mr=Gn;w(Mr,"Properties",["width","height","sides"]);var kl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this.width=e*2,this.height=e*2}},width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(e){this._sides=e,this._flagSides=!0}}},Kn=class extends Ce{constructor(e,t,n,r,s){typeof s>"u"&&typeof n=="number"&&typeof r=="number"&&(s=Math.floor(Math.min(n,r)/12));const o=[];for(let a=0;a<10;a++)o.push(new ve(0,0,0,0,0,0,a===0?ee.move:ee.curve));super(o),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_flagRadius",!1),w(this,"_width",0),w(this,"_height",0),w(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let a in xl)Object.defineProperty(this,a,xl[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Fg.bind(this),typeof n=="number"&&(this.width=n),typeof r=="number"&&(this.height=r),typeof s=="number"&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Kn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Kn.Properties.length;t++){const n=Kn.Properties[t];if(n in e){const r=e[n];/radius/i.test(n)?this[n]=typeof r=="number"||r instanceof Z?r:new Z().copy(r):typeof r=="number"&&(this[n]=r)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,t=this._height;let n,r;this._radius instanceof Z?(n=this._radius.x,r=this._radius.y):(n=this._radius,r=this._radius);let s,o=e/2,a=t/2;s=this.vertices[0],s.x=-(o-n),s.y=-a,s=this.vertices[1],s.x=o-n,s.y=-a,s.controls.left.clear(),s.controls.right.x=n,s.controls.right.y=0,s=this.vertices[2],s.x=o,s.y=-(a-r),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=o,s.y=a-r,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=r,s=this.vertices[4],s.x=o-n,s.y=a,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(o-n),s.y=a,s.controls.left.clear(),s.controls.right.x=-n,s.controls.right.y=0,s=this.vertices[6],s.x=-o,s.y=a-r,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-o,s.y=-(a-r),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-r,s=this.vertices[8],s.x=-(o-n),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 t=this.width,n=this.height,r=this.radius,s=new Kn(0,0,t,n,r);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 o=0;o<Ce.Properties.length;o++){const a=Ce.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let t=0;t<Kn.Properties.length;t++){const n=Kn.Properties[t];e[n]=this[n]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}},Qi=Kn;w(Qi,"Properties",["width","height","radius"]);var xl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius instanceof Z&&this._radius.unbind(X.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof Z&&this._radius.bind(X.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Fg(){this._flagRadius=!0}var Mg=Math.cos,Ag=Math.sin,Zn=class extends Ce{constructor(e,t,n,r,s){arguments.length<=3&&(r=n,n=r/2),(typeof s!="number"||s<=0)&&(s=5),super(),w(this,"_flagInnerRadius",!1),w(this,"_flagOuterRadius",!1),w(this,"_flagSides",!1),w(this,"_innerRadius",0),w(this,"_outerRadius",0),w(this,"_sides",0),this._renderer.type="star";for(let o in Cl)Object.defineProperty(this,o,Cl[o]);this.closed=!0,this.automatic=!1,typeof n=="number"&&(this.innerRadius=n),typeof r=="number"&&(this.outerRadius=r),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Zn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Zn.Properties.length;t++){const n=Zn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,t=e+1;let n=this.vertices.length;n>e&&(this.vertices.splice(e-1,n-e),n=e);for(let r=0;r<t;r++){const s=(r+.5)/e,o=ct*s,a=(r%2?this._outerRadius:this._innerRadius)/2,l=a*Mg(o),c=a*Ag(o);r>=n?this.vertices.push(new ve(l,c)):this.vertices[r].set(l,c),this.vertices[r].command=r===0?ee.move:ee.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const t=this.innerRadius,n=this.outerRadius,r=this.sides,s=new Zn(0,0,t,n,r);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 o=0;o<Ce.Properties.length;o++){const a=Ce.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let t=0;t<Zn.Properties.length;t++){const n=Zn.Properties[t];e[n]=this[n]}return e}},Ar=Zn;w(Ar,"Properties",["innerRadius","outerRadius","sides"]);var Cl={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(e){this._innerRadius=e,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(e){this._outerRadius=e,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(e){this._sides=e,this._flagSides=!0}}},Ls,Sl=Math.min,Bl=Math.max;De.document&&(Ls=document.createElement("canvas"));var Mt=class extends hn{constructor(e,t,n,r){super(),w(this,"_flagValue",!0),w(this,"_flagFamily",!0),w(this,"_flagSize",!0),w(this,"_flagLeading",!0),w(this,"_flagAlignment",!0),w(this,"_flagBaseline",!0),w(this,"_flagStyle",!0),w(this,"_flagWeight",!0),w(this,"_flagDecoration",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagMask",!1),w(this,"_flagClip",!1),w(this,"_flagDirection",!0),w(this,"_value",""),w(this,"_family","sans-serif"),w(this,"_size",13),w(this,"_leading",17),w(this,"_alignment","center"),w(this,"_baseline","middle"),w(this,"_style","normal"),w(this,"_weight",500),w(this,"_decoration","none"),w(this,"_direction","ltr"),w(this,"_fill","#000"),w(this,"_stroke","none"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_mask",null),w(this,"_clip",!1),w(this,"_dashes",null);for(let s in Tl)Object.defineProperty(this,s,Tl[s]);if(this._renderer.type="text",this._renderer.flagFill=Og.bind(this),this._renderer.flagStroke=Ig.bind(this),this.value=e,typeof t=="number"&&(this.translation.x=t),typeof n=="number"&&(this.translation.y=n),this.dashes=[],this.dashes.offset=0,!ae.isObject(r))return this;for(let s=0;s<Mt.Properties.length;s++){const o=Mt.Properties[s];o in r&&(this[o]=r[o])}}static Measure(e){if(Ls){const t=Ls.getContext("2d");t.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const n=t.measureText(e.value,0,0),r=n.actualBoundingBoxDescent+n.actualBoundingBoxAscent;return{width:n.width,height:r}}else{const t=this.value.length*this.size*Mt.Ratio,n=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:t,height:n}}}static fromObject(e){const t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new Mt().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e);for(let t=0;t<Mt.Properties.length;t++){const n=Mt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Mt(this.value);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale;for(let n=0;n<Mt.Properties.length;n++){const r=Mt.Properties[n];t[r]=this[r]}return this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let t=0;t<Mt.Properties.length;t++){const n=Mt.Properties[t];e[n]=this[n]}return e}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let t,n,r,s,o;this._update(!0),t=e?this.matrix:this.worldMatrix;const{width:a,height:l}=Mt.Measure(this),c=(this._linewidth||0)/2;switch(this.alignment){case"left":n=-c,r=a+c;break;case"right":n=-(a+c),r=c;break;default:n=-(a/2+c),r=a/2+c}switch(this.baseline){case"middle":s=-(l/2+c),o=l/2+c;break;default:s=-(l+c),o=c}const[d,h]=t.multiply(n,s),[u,p]=t.multiply(n,o),[f,g]=t.multiply(r,s),[m,_]=t.multiply(r,o);return s=Sl(h,p,g,_),n=Sl(d,u,f,m),r=Bl(d,u,f,m),o=Bl(h,p,g,_),{top:s,left:n,right:r,bottom:o,width:r-n,height:o-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}},It=Mt;w(It,"Ratio",.6),w(It,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);var Tl={value:{enumerable:!0,get:function(){return this._value},set:function(e){this._value=e,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(e){this._family=e,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(e){this._leading=e,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(e){this._alignment=e,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(e){this._style=e,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(e){this._weight=e,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(e){this._decoration=e,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(e){this._direction=e,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(e){this._baseline=e,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.bind(X.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function Og(){this._flagFill=!0}function Ig(){this._flagStroke=!0}var Or=Math.min,Ir=Math.max,Si=class extends hn{constructor(e){super(),w(this,"_flagAdditions",!1),w(this,"_flagSubtractions",!1),w(this,"_flagOrder",!1),w(this,"_flagOpacity",!0),w(this,"_flagBeginning",!1),w(this,"_flagEnding",!1),w(this,"_flagLength",!1),w(this,"_flagMask",!1),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_cap","round"),w(this,"_join","round"),w(this,"_miter",4),w(this,"_closed",!0),w(this,"_curved",!1),w(this,"_automatic",!0),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_length",0),w(this,"_mask",null);for(let t in El)Object.defineProperty(this,t,El[t]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let t=0;t<e.length;t++)$l.call(this,e[t],this)}static RemoveChildren(e){for(let t=0;t<e.length;t++)$l.call(this,e[t])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const t=new Si;for(let r=0;r<Si.Properties.length;r++){const s=Si.Properties[r];s in e&&(/(fill|stroke)/i.test(s)?t[s]=typeof e[s]=="string"?e[s]:jn(e[s]):t[s]=e[s])}return"mask"in e&&(t.mask=n(e.mask)),"id"in e&&(t.id=e.id),t.children=e.children.map(n),t;function n(r){if(r&&r.renderer)switch(r.renderer.type){case"arc-segment":return Pr.fromObject(r);case"circle":return Zi.fromObject(r);case"ellipse":return Ji.fromObject(r);case"points":return Fr.fromObject(r);case"polygon":return Mr.fromObject(r);case"rectangle":return En.fromObject(r);case"rounded-rectangle":return Qi.fromObject(r);case"star":return Ar.fromObject(r);case"path":return Ce.fromObject(r);case"text":return It.fromObject(r);case"group":return Si.fromObject(r);case"shape":return hn.fromObject(r);case"element":return Dn.fromObject(r)}return r}}copy(e){return super.copy.call(this,e),console.warn("Two.Group.copy is not supported yet."),this}clone(e){const t=new Si,n=this.children.map(function(r){return r.clone()});return t.add(n),t.opacity=this.opacity,this.mask&&(t.mask=this.mask),t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.className=this.className,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._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,ae.each(this.children,(t,n)=>{e.children[n]=t.toObject()},this),e}corner(){const e=this.getBoundingClientRect(!0);for(let t=0;t<this.children.length;t++){const n=this.children[t];n.translation.x-=e.left,n.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),t=e.left+e.width/2-this.translation.x,n=e.top+e.height/2-this.translation.y;for(let r=0;r<this.children.length;r++){const s=this.children[r];s.isShape&&(s.translation.x-=t,s.translation.y-=n)}return this.mask&&(this.mask.translation.x-=t,this.mask.translation.y-=n),this}getById(e){let t=null;function n(r){if(r.id===e)return r;if(r.children){if(r.children.ids[e])return r.children.ids[e];for(let s=0;s<r.children.length;s++)if(t=n(r.children[s]),t)return t}return null}return n(this)}getByClassName(e){const t=[];function n(r){if(Array.prototype.indexOf.call(r.classList,e)>=0&&t.push(r),r.children)for(let s=0;s<r.children.length;s++){const o=r.children[s];n(o)}return t}return n(this)}getByType(e){const t=[];function n(r){if(r instanceof e&&t.push(r),r.children)for(let s=0;s<r.children.length;s++){const o=r.children[s];n(o)}return t}return n(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let t=0;t<e.length;t++){const n=e[t];if(!(n&&n.id))continue;const r=Array.prototype.indexOf.call(this.children,n);r>=0&&this.children.splice(r,1),this.children.push(n)}return this}remove(e){const t=arguments.length,n=this.parent;if(t<=0&&n)return n.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let r=0;r<e.length;r++){const s=e[r];if(!s||!this.children.ids[s.id])continue;const o=this.children.indexOf(s);o>=0&&this.children.splice(o,1)}return this}getBoundingClientRect(e){let t,n,r,s,o,a;this._update(!0);let l=1/0,c=-1/0,d=1/0,h=-1/0;const u=/texture|gradient/i;n=e?this.matrix:this.worldMatrix;for(let p=0;p<this.children.length;p++){const f=this.children[p];if(!(!f.visible||u.test(f._renderer.type))&&(t=f.getBoundingClientRect(e),r=typeof t.top!="number"||ae.isNaN(t.top)||!isFinite(t.top),s=typeof t.left!="number"||ae.isNaN(t.left)||!isFinite(t.left),o=typeof t.right!="number"||ae.isNaN(t.right)||!isFinite(t.right),a=typeof t.bottom!="number"||ae.isNaN(t.bottom)||!isFinite(t.bottom),!(r||s||o||a)))if(e){const[g,m]=n.multiply(t.left,t.top),[_,y]=n.multiply(t.right,t.top),[b,S]=n.multiply(t.left,t.bottom),[x,C]=n.multiply(t.right,t.bottom);d=Or(m,y,S,C,d),l=Or(g,_,b,x,l),c=Ir(g,_,b,x,c),h=Ir(m,y,S,C,h)}else d=Or(t.top,d),l=Or(t.left,l),c=Ir(t.right,c),h=Ir(t.bottom,h)}return{top:d,left:l,right:c,bottom:h,width:c-l,height:h-d}}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(t){t.subdivide.apply(t,e)}),this}_update(){let e,t,n;if(this._flagBeginning||this._flagEnding){const r=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),o=this.length;let a=0;const l=r*o,c=s*o;for(e=0;e<this.children.length;e++)n=this.children[e],t=n.length,l>a+t?(n.beginning=1,n.ending=1):c<a?(n.beginning=0,n.ending=0):l>a&&l<a+t?(n.beginning=(l-a)/t,n.ending=1):c>a&&c<a+t?(n.beginning=0,n.ending=(c-a)/t):(n.beginning=0,n.ending=1),a+=t}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}},Ue=Si;w(Ue,"Children",_l),w(Ue,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var El={visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._flagVisible=this._visible!==e||this._flagVisible,this._visible=e}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._flagOpacity=this._opacity!==e||this._flagOpacity,this._opacity=e}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._flagBeginning=this._beginning!==e||this._flagBeginning,this._beginning=e}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._flagEnding=this._ending!==e||this._flagEnding,this._ending=e}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let e=0;e<this.children.length;e++){const t=this.children[e];this._length+=t.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){this._fill=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.fill=e}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){this._stroke=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.stroke=e}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.linewidth=e}}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.join=e}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.miter=e}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.cap=e}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(e){this._closed=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.closed=e}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.curved=e}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){this._automatic=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.automatic=e}}},children:{enumerable:!0,get:function(){return this._children},set:function(e){const t=Ue.InsertChildren.bind(this),n=Ue.RemoveChildren.bind(this),r=Ue.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new _l(e),this._children.bind(X.Types.insert,t),this._children.bind(X.Types.remove,n),this._children.bind(X.Types.order,r),e.length>0&&t(e)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}}};function $l(e,t){const n=e.parent;let r;if(n===t){s();return}if(n&&n.children.ids[e.id]&&(r=Array.prototype.indexOf.call(n.children,e),n.children.splice(r,1),o()),t){s();return}o(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete e.parent;function s(){t.subtractions.length>0&&(r=Array.prototype.indexOf.call(t.subtractions,e),r>=0&&t.subtractions.splice(r,1)),t.additions.length>0&&(r=Array.prototype.indexOf.call(t.additions,e),r>=0&&t.additions.splice(r,1)),e.parent=t,t.additions.push(e),t._flagAdditions=!0}function o(){r=Array.prototype.indexOf.call(n.additions,e),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,e),r<0&&(n.subtractions.push(e),n._flagSubtractions=!0)}}var Ds=class extends Ce{constructor(t,n,r,s){const o=[new ve(t,n),new ve(r,s)];super(o);for(let a in Nl)Object.defineProperty(this,a,Nl[a]);this.vertices[0].command=ee.move,this.vertices[1].command=ee.line,this.automatic=!1}},Nl={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(ae.isObject(e))this.vertices.splice(0,1,e);else{const t=new Bt("Two.Line.x argument is not an object.");console.warn(t.name,t.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(e){if(ae.isObject(e))this.vertices.splice(1,1,e);else{const t=new Bt("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}},Zt={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},Vg={start:"left",middle:"center",end:"right"},Rl=["id","class","transform","xmlns","viewBox"],zg=["x","y","width","height","href","xlink:href"];function Lg(e){return Vg[e]}function Dg(e){const t=e.getAttribute("dominant-baseline"),n=e.getAttribute("alignment-baseline");return t||n}function er(e){return e.replace(/svg:/gi,"").toLowerCase()}function Pl(e,t){if(t.x+=e.translateX,t.y+=e.translateY,t.x*=e.scaleX,t.y*=e.scaleY,e.rotation!==0){const n=t.length();t.x=n*Math.cos(e.rotation),t.y=n*Math.sin(e.rotation)}}function Hg(e,t){t||(t={});const n=e.split(";");for(let r=0;r<n.length;r++){const s=n[r].split(":"),o=s[0],a=s[1];if(typeof o>"u"||typeof a>"u")continue;const l=o.replace(/\s/g,""),c=a.replace(/\s/g,"");t[l]=c}return t}function Wg(e){const t={},n=jg(e),r=Math.max(n.length,e.style.length);for(let s=0;s<r;s++){const o=e.style[s],a=n[s];o&&(t[o]=e.style[o]),a&&(t[a]=e.getAttribute(a))}return t}function jg(e){const t=e.getAttributeNames();for(let n=0;n<Rl.length;n++){const r=Rl[n],s=Array.prototype.indexOf.call(t,r);s>=0&&t.splice(s,1)}return t}function Xg(e,t){const n=t.split(/[\s,]/),r=-parseFloat(n[0]),s=-parseFloat(n[1]),o=parseFloat(n[2]),a=parseFloat(n[3]);if(r&&s)for(let u=0;u<e.children.length;u++){const p=e.children[u];"translation"in p?p.translation.add(r,s):"x"in p?p.x=r:"y"in p&&(p.y=s)}const l=typeof e.x=="number",c=typeof e.y=="number",d=typeof e.width=="number",h=typeof e.height=="number";return l&&(e.translation.x+=e.x),c&&(e.translation.y+=e.y),(d||h)&&(e.scale=new Z(1,1)),d&&(e.scale.x=e.width/o),h&&(e.scale.y=e.height/a),e.mask=new En(0,0,o,a),e.mask.origin.set(-o/2,-a/2),e}function Vt(e,t,n){const r={},s={},o={};let a,l,c,d,h,u,p,f,g,m,_,y,b,S,x,C,B;if(e===null)return r;if(De.getComputedStyle){const v=De.getComputedStyle(e);for(a=v.length;a--;)c=v[a],d=v[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<e.attributes.length;a++)u=e.attributes[a],/style/i.test(u.nodeName)?Hg(u.value,o):s[u.nodeName]=u.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),n&&ae.defaults(r,n),ae.extend(r,o,s),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)||(l=e.gradientTransform&&e.gradientTransform.baseVal&&e.gradientTransform.baseVal.length>0?e.gradientTransform.baseVal[0].matrix:e.getCTM?e.getCTM():null,l===null))break;switch(p=wi(l),t._renderer.type){case"linear-gradient":Pl(p,t.left),Pl(p,t.right);break;case"radial-gradient":t.center.x+=p.translateX,t.center.y+=p.translateY,t.focal.x+=p.translateX,t.focal.y+=p.translateY,t.radius*=Math.max(p.scaleX,p.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=e.transform&&e.transform.baseVal&&e.transform.baseVal.length>0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null,l===null))break;p=wi(l),t.translation.set(p.translateX,p.translateY),t.rotation=Math.PI*(p.rotation/180),t.scale=new Z(p.scaleX,p.scaleY),f=parseFloat((r.x+"").replace("px")),g=parseFloat((r.y+"").replace("px")),f&&(t.translation.x=f),g&&(t.translation.y=g);break;case"visible":if(t instanceof Ue){t._visible=d;break}t.visible=d;break;case"stroke-linecap":if(t instanceof Ue){t._cap=d;break}t.cap=d;break;case"stroke-linejoin":if(t instanceof Ue){t._join=d;break}t.join=d;break;case"stroke-miterlimit":if(t instanceof Ue){t._miter=d;break}t.miter=d;break;case"stroke-width":if(t instanceof Ue){t._linewidth=parseFloat(d);break}t.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof Ue){t._opacity=parseFloat(d);break}t.opacity=parseFloat(d);break;case"clip-path":if(Zt.cssBackgroundImage.test(d)&&(m=d.replace(Zt.cssBackgroundImage,"$1"),ze.defs.current&&ze.defs.current.contains(m)&&(y=ze.defs.current.get(m),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],b=er(y.nodeName),t.mask=ze[b].call(this,y,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":h=(t instanceof Ue?"_":"")+c,Zt.cssBackgroundImage.test(d)?(m=d.replace(Zt.cssBackgroundImage,"$1"),ze.defs.current&&ze.defs.current.contains(m)?(y=ze.defs.current.get(m),y.object||(b=er(y.nodeName),y.object=ze[b].call(this,y,{})),y=y.object):(_=Yg(this),y=_.getById(m)),t[h]=y):t[h]=d;break;case"id":t.id=d;break;case"class":case"className":t.classList=d.split(" "),t._flagClassName=!0;break;case"x":case"y":if(S=t instanceof qe,x=t instanceof Oe,C=t instanceof Ie,S||x||C)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Bt("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),t.translation[c]=parseFloat(d);break;case"font-family":t instanceof It&&(t.family=d);break;case"font-size":t instanceof It&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Bt("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),t.size=parseFloat(d));break;case"font-weight":t instanceof It&&(t.weight=d);break;case"font-style":t instanceof It&&(t.style=d);break;case"text-decoration":t instanceof It&&(t.decoration=d);break;case"line-height":t instanceof It&&(t.leading=d);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),r}function qg(e,t){for(let n=0,r=e.childNodes.length;n<r;n++){const s=e.childNodes[n];!s.id||er(e.nodeName)==="#text"||t.add(s.id,s)}}function Yg(e){for(;e.parent;)e=e.parent;return e.scene}var ze={svg:function(e){const t=ze.defs.current=new Tr,n=e.getElementsByTagName("defs");for(let g=0;g<n.length;g++)qg(n[g],t);const r=ze.g.call(this,e),s=e.getAttribute("viewBox"),o=e.getAttribute("x"),a=e.getAttribute("y"),l=e.getAttribute("width"),c=e.getAttribute("height");r.defs=t;const d=s!==null,h=o!==null,u=a!==null,p=l!==null,f=c!==null;return h&&(r.x=parseFloat(o.replace(Zt.unitSuffix,""))),u&&(r.y=parseFloat(a.replace(Zt.unitSuffix,""))),p&&(r.width=parseFloat(l.replace(Zt.unitSuffix,""))),f&&(r.height=parseFloat(c.replace(Zt.unitSuffix,""))),d&&Xg(r,s),delete ze.defs.current,r},defs:function(e){return null},use:function(e,t){let n;const r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return n=new Bt("encountered <use /> with no href."),console.warn(n.name,n.message),null;const s=r.slice(1);if(!ze.defs.current.contains(s))return n=new Bt("unable to find element for reference "+r+"."),console.warn(n.name,n.message),null;const a=ze.defs.current.get(s).cloneNode(!0);for(let c=0;c<e.attributes.length;c++){const d=e.attributes[c],h=zg.includes(d.nodeName),u=!a.hasAttribute(d.nodeName);(h||u)&&a.setAttribute(d.nodeName,d.value)}const l=er(a.nodeName);return ze[l].call(this,a,t)},g:function(e,t){const n=new Ue;Vt.call(this,e,n,t),this.add(n);const r=Wg.call(this,e);for(let s=0,o=e.childNodes.length;s<o;s++){const a=e.childNodes[s],l=a.nodeName;if(!l)return;const c=er(l);if(c in ze){const d=ze[c].call(n,a,r);d&&!d.parent&&n.add(d)}}return n},polygon:function(e,t){let n;typeof e=="string"?n=e:n=e.getAttribute("points");const r=[];n.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(o,a,l){r.push(new ve(parseFloat(a),parseFloat(l)))});const s=new Ce(r,!0);return s.stroke="none",s.fill="black",Vt.call(this,e,s,t),s},polyline:function(e,t){const n=ze.polygon.call(this,e,t);return n.closed=!1,n},path:function(e,t){let n;typeof e=="string"?(n=e,e=null):n=e.getAttribute("d");let r=[],s=!1,o=!1;if(n){let l=new ve,c,d,h=n.match(/[a-df-z][^a-df-z]*/gi);const u=h.length-1;ae.each(h.slice(0),function(p,f){const g=p.slice(1).trim().match(Zt.path),m=p[0],_=m.toLowerCase();let y,b,S,x,C;const B=[];switch(f===0&&(h=[]),_){case"h":case"v":g.length>1&&(y=1);break;case"m":case"l":case"t":g.length>2&&(y=2);break;case"s":case"q":g.length>4&&(y=4);break;case"c":g.length>6&&(y=6);break;case"a":g.length>7&&(y=7);break}if(y){for(b=0,S=g.length,C=0;b<S;b+=y){if(x=m,C>0)switch(m){case"m":x="l";break;case"M":x="L";break}B.push(x+g.slice(b,b+y).join(" ")),C++}h=Array.prototype.concat.apply(h,B)}else h.push(p)}),ae.each(h,function(p,f){let g,m,_;const y=p[0],b=y.toLowerCase();d=p.slice(1).trim().match(Zt.path),o=y===b;let S,x,C,B,v,N,F,P,q,U,M,E,A,K,R,$,j;switch(b){case"z":if(f>=u)s=!0;else{m=l.x,_=l.y,g=new ve(m,_,void 0,void 0,void 0,void 0,ee.close);for(let z=r.length-1;z>=0;z--){const Y=r[z];if(/m/i.test(Y.command)){l=Y;break}}}break;case"m":case"l":c=void 0,m=parseFloat(d[0]),_=parseFloat(d[1]),g=new ve(m,_,void 0,void 0,void 0,void 0,/m/i.test(b)?ee.move:ee.line),o&&g.addSelf(l),l=g;break;case"h":case"v":U=/h/i.test(b)?"x":"y",M=/x/i.test(U)?"y":"x",g=new ve(void 0,void 0,void 0,void 0,void 0,void 0,ee.line),g[U]=parseFloat(d[0]),g[M]=l[M],o&&(g[U]+=l[U]),l=g;break;case"c":case"s":S=l.x,x=l.y,c||(c=new Z),/c/i.test(b)?(C=parseFloat(d[0]),B=parseFloat(d[1]),v=parseFloat(d[2]),N=parseFloat(d[3]),F=parseFloat(d[4]),P=parseFloat(d[5])):(q=Rs(l,c,o),C=q.x,B=q.y,v=parseFloat(d[0]),N=parseFloat(d[1]),F=parseFloat(d[2]),P=parseFloat(d[3])),o&&(C+=S,B+=x,v+=S,N+=x,F+=S,P+=x),l.controls.right.set(C-l.x,B-l.y),g=new ve(F,P,v-F,N-P,void 0,void 0,ee.curve),l=g,c=g.controls.left;break;case"t":case"q":S=l.x,x=l.y,c||(c=new Z),/q/i.test(b)?(C=parseFloat(d[0]),B=parseFloat(d[1]),v=parseFloat(d[0]),N=parseFloat(d[1]),F=parseFloat(d[2]),P=parseFloat(d[3])):(q=Rs(l,c,o),C=q.x,B=q.y,v=q.x,N=q.y,F=parseFloat(d[0]),P=parseFloat(d[1])),o&&(C+=S,B+=x,v+=S,N+=x,F+=S,P+=x),l.controls.right.set((C-l.x)*.33,(B-l.y)*.33),g=new ve(F,P,v-F,N-P,void 0,void 0,ee.curve),l=g,c=g.controls.left;break;case"a":S=l.x,x=l.y,A=parseFloat(d[0]),K=parseFloat(d[1]),R=parseFloat(d[2]),$=parseFloat(d[3]),j=parseFloat(d[4]),F=parseFloat(d[5]),P=parseFloat(d[6]),o&&(F+=S,P+=x),E=new ve(F,P),E.command=ee.arc,E.rx=A,E.ry=K,E.xAxisRotation=R,E.largeArcFlag=$,E.sweepFlag=j,g=E,l=E,c=void 0;break}g&&(Array.isArray(g)?r=r.concat(g):r.push(g))})}n=new Ce(r,s,void 0,!0),n.stroke="none",n.fill="black";const a=n.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},ae.each(n.vertices,function(l){l.subSelf(a.centroid)}),Vt.call(this,e,n,t),n.translation.addSelf(a.centroid),n},circle:function(e,t){const n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=parseFloat(e.getAttribute("r")),o=new Zi(0,0,s);return o.stroke="none",o.fill="black",Vt.call(this,e,o,t),o.translation.x=n,o.translation.y=r,o},ellipse:function(e,t){const n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=parseFloat(e.getAttribute("rx")),o=parseFloat(e.getAttribute("ry")),a=new Ji(0,0,s,o);return a.stroke="none",a.fill="black",Vt.call(this,e,a,t),a.translation.x=n,a.translation.y=r,a},rect:function(e,t){const n=parseFloat(e.getAttribute("rx")),r=parseFloat(e.getAttribute("ry"));if(!ae.isNaN(n)||!ae.isNaN(r))return ze["rounded-rect"](e);const s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),a=s/2,l=o/2,c=new En(0,0,s,o);return c.stroke="none",c.fill="black",Vt.call(this,e,c,t),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(e,t){const n=parseFloat(e.getAttribute("rx"))||0,r=parseFloat(e.getAttribute("ry"))||0,s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),a=s/2,l=o/2,c=new Z(n,r),d=new Qi(0,0,s,o,c);return d.stroke="none",d.fill="black",Vt.call(this,e,d,t),d.translation.x+=a,d.translation.y+=l,d},line:function(e,t){const n=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),s=parseFloat(e.getAttribute("x2")),o=parseFloat(e.getAttribute("y2")),a=new Ds(n,r,s,o).noFill();return Vt.call(this,e,a,t),a},lineargradient:function(e,t){let n=e.getAttribute("gradientUnits"),r=e.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(e.getAttribute("x1")||0),o=parseFloat(e.getAttribute("y1")||0),a=parseFloat(e.getAttribute("x2")||0),l=parseFloat(e.getAttribute("y2")||0);const c=(a+s)/2,d=(l+o)/2;/userSpaceOnUse/i.test(n)&&(s-=c,o-=d,a-=c,l-=d);const h=[];for(let p=0;p<e.children.length;p++){const f=e.children[p];let g=f.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let m=f.getAttribute("stop-color"),_=f.getAttribute("stop-opacity"),y=f.getAttribute("style"),b;m===null&&(b=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,m=b&&b.length>1?b[1]:void 0),_===null?(b=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,_=b&&b.length>1?parseFloat(b[1]):1):_=parseFloat(_),h.push(new Kt(g,m,_))}const u=new Oe(s,o,a,l,h);return u.spread=r,u.units=n,Vt.call(this,e,u,t),u},radialgradient:function(e,t){let n=e.getAttribute("gradientUnits"),r=e.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(e.getAttribute("cx"))||0,o=parseFloat(e.getAttribute("cy"))||0,a=parseFloat(e.getAttribute("r")),l=parseFloat(e.getAttribute("fx")),c=parseFloat(e.getAttribute("fy"));ae.isNaN(l)&&(l=s),ae.isNaN(c)&&(c=o);const d=Math.abs(s+l)/2,h=Math.abs(o+c)/2;/userSpaceOnUse/i.test(n)&&(s-=d,o-=h,l-=d,c-=h);const u=[];for(let f=0;f<e.children.length;f++){const g=e.children[f];let m=g.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let _=g.getAttribute("stop-color"),y=g.getAttribute("stop-opacity"),b=g.getAttribute("style"),S;_===null&&(S=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,_=S&&S.length>1?S[1]:void 0),y===null?(S=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=S&&S.length>1?parseFloat(S[1]):1):y=parseFloat(y),u.push(new Kt(m,_,y))}const p=new Ie(s,o,a,u,l,c);return p.spread=r,p.units=n,Vt.call(this,e,p,t),p},text:function(e,t){const n=Lg(e.getAttribute("text-anchor"))||"left",r=Dg(e)||"baseline";let s="";e.childNodes.length>0&&e.childNodes[0].tagName==="TSPAN"?s=e.childNodes[0].textContent:s=e.textContent;const o=new It(s);return Vt.call(this,e,o,t),o.alignment=n,o.baseline=r,o},clippath:function(e,t){return ze.defs.current&&!ze.defs.current.contains(e.id)&&ze.defs.current.add(e.id,e),null},image:function(e,t){let n;const r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return n=new Bt("encountered <image /> with no href."),console.warn(n.name,n.message),null;const s=parseFloat(e.getAttribute("x"))||0,o=parseFloat(e.getAttribute("y"))||0,a=parseFloat(e.getAttribute("width")),l=parseFloat(e.getAttribute("height")),c=new Rr(r,s,o);return ae.isNaN(a)||(c.width=a),ae.isNaN(l)||(c.height=l),Vt.call(this,e,c,t),c}};function Fl(e,t){const n=new XMLHttpRequest;return n.open("GET",e),n.onreadystatechange=function(){n.readyState===4&&n.status===200&&t(n.responseText)},n.send(),n}var Bi=class extends En{constructor(e,t,n,r){super(t,n,0,0),w(this,"_flagTextures",!1),w(this,"_flagFrameRate",!1),w(this,"_flagIndex",!1),w(this,"_amount",1),w(this,"_duration",0),w(this,"_index",0),w(this,"_startTime",0),w(this,"_playing",!1),w(this,"_firstFrame",0),w(this,"_lastFrame",0),w(this,"_loop",!0),w(this,"_textures",null),w(this,"_frameRate",0),w(this,"_origin",null);for(let s in Ml)Object.defineProperty(this,s,Ml[s]);this._renderer.flagTextures=Ug.bind(this),this._renderer.bindTextures=Gg.bind(this),this._renderer.unbindTextures=Kg.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Al.bind(this)):this.textures=[Al(e)],this.origin=new Z,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Bi.DefaultFrameRate,this.index=0}static fromObject(e){const t=new Bi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Bi.Properties.length;t++){const n=Bi.Properties[t];n in e&&(this[n]=e[n])}return this}play(e,t,n){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=ae.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof t=="number"&&(this._lastFrame=t),typeof n=="function"?this._onLastFrame=n: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 t=new Bi(this.textures,this.translation.x,this.translation.y,this.frameRate);return t._loop=this._loop,this._playing&&t.play(),e&&e.add(t),t}toObject(){const e=super.toObject.call(this);return e.textures=this.textures.map(function(t){return t.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}_update(){const e=this._textures;let t,n,r,s,o,a,l,c;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,ae.isNaN(this._lastFrame)&&(this._lastFrame=s-1),r=ae.performance.now()-this._startTime,c=this._lastFrame+1,o=1e3*(c-this._firstFrame)/this._frameRate,this._loop?r=r%o:r=Math.min(r,o),l=Nt(this._firstFrame,c,r/o),l=Math.floor(l),l!==this._index&&(this._index=l,a=e[this._index],a.loaded&&(t=a.image.width,n=a.image.height,this.width!==t&&(this.width=t),this.height!==n&&(this.height=n),this.fill=a,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Ee))&&(a=e[this._index],a.loaded&&(t=a.image.width,n=a.image.height,this.width!==t&&(this.width=t),this.height!==n&&(this.height=n)),this.fill=a)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},Vr=Bi;w(Vr,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(Vr,"DefaultFrameRate",30);var Ml={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(e){const t=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(X.Types.insert,t).unbind(X.Types.remove,n),this._textures=new Bn((e||[]).slice(0)),this._textures.bind(X.Types.insert,t).bind(X.Types.remove,n),t(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}};function Ug(){this._flagTextures=!0}function Gg(e){let t=e.length;for(;t--;)e[t].bind(X.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Kg(e){let t=e.length;for(;t--;)e[t].unbind(X.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Al(e){if(e instanceof Ee)return e;if(typeof e=="string")return new Ee(e)}var Hs=[],Ws=Math.max,Zg=Math.min,Ol=Math.abs,zr=Math.sin,Lr=Math.cos,Jg=Math.acos,Dr=Math.sqrt,Te={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(e){return e in Te?e:"path"},group:{renderChild:function(e){const t=Te.getRendererType(e._renderer.type);Te[t].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;this._update();const t=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);const r=this._mask,s=Hr(t),o=!s||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,o&&(e.save(),s||e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),r){const a=Te.getRendererType(r._renderer.type);Te[a].render.call(r,e,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Te.getRendererType(l._renderer.type);Te[c].render.call(l,e)}return o&&e.restore(),this.flagReset()}},path:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,p,f,g,m,_,y,b,S,x,C,B,v,N,F,P,q,U,M,E,A,K,R,$,j,z;if(z=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,A=this._mask,K=this._clip,l=this._opacity*(z||1),c=this._visible,!t&&(!c||K||l===0))return this;if(this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,d=this._cap,h=this._join,u=this._miter,p=this._closed,f=this._renderer.vertices,g=f.length,m=g-1,R=Hr(r),j=this.dashes,R||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),A){const re=Te.getRendererType(A._renderer.type);Te[re].render.call(A,e,!0)}if(a)if(typeof a=="string")e.fillStyle=a;else{const re=Te.getRendererType(a._renderer.type);Te[re].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const re=Te.getRendererType(s._renderer.type);Te[re].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o),u&&(e.miterLimit=u),h&&(e.lineJoin=h),!p&&d&&(e.lineCap=d)}typeof l=="number"&&(e.globalAlpha=l),j&&j.length>0&&(e.lineDashOffset=j.offset||0,e.setLineDash(j)),e.beginPath();let Y,I,V,J,pe,ie,ge;for(let re=0;re<g;re++)switch(b=f[re],M=b.x,E=b.y,b.command){case ee.close:e.closePath();break;case ee.arc:Y=b.rx,I=b.ry,V=b.xAxisRotation,J=b.largeArcFlag,pe=b.sweepFlag,_=p?Rt(re-1,g):Ws(re-1,0),y=f[_],ie=y.x,ge=y.y,Te.renderSvgArcCommand(e,ie,ge,Y,I,J,pe,V,M,E);break;case ee.curve:_=p?Rt(re-1,g):Math.max(re-1,0),y=f[_],F=y.controls&&y.controls.right||Z.zero,P=b.controls&&b.controls.left||Z.zero,y._relative?(v=F.x+y.x,N=F.y+y.y):(v=F.x,N=F.y),b._relative?(C=P.x+b.x,B=P.y+b.y):(C=P.x,B=P.y),e.bezierCurveTo(v,N,C,B,M,E),re>=m&&p&&(S=x,q=b.controls&&b.controls.right||Z.zero,U=S.controls&&S.controls.left||Z.zero,b._relative?(v=q.x+b.x,N=q.y+b.y):(v=q.x,N=q.y),S._relative?(C=U.x+S.x,B=U.y+S.y):(C=U.x,B=U.y),M=S.x,E=S.y,e.bezierCurveTo(v,N,C,B,M,E));break;case ee.line:e.lineTo(M,E);break;case ee.move:x=b,e.moveTo(M,E);break}return p&&e.closePath(),!K&&!n&&(Te.isHidden.test(a)||($=a._renderer&&a._renderer.offset,$&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),$&&e.restore()),Te.isHidden.test(s)||($=s._renderer&&s._renderer.offset,$&&(e.save(),e.translate(-s._renderer.offset.x,-s._renderer.offset.y),e.scale(s._renderer.scale.x,s._renderer.scale.y),e.lineWidth=o/s._renderer.scale.x),e.stroke(),$&&e.restore())),R||e.restore(),K&&!n&&e.clip(),j&&j.length>0&&e.setLineDash(Hs),this.flagReset()}},points:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,p,f,g,m,_,y,b;if(b=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(b||1),c=this._visible,!t&&(!c||l===0))return this;if(this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,h=this._renderer.collection,u=h.length,m=Hr(r),y=this.dashes,d=this._size,m||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")e.fillStyle=a;else{const C=Te.getRendererType(a._renderer.type);Te[C].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const C=Te.getRendererType(s._renderer.type);Te[C].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o)}typeof l=="number"&&(e.globalAlpha=l),y&&y.length>0&&(e.lineDashOffset=y.offset||0,e.setLineDash(y)),e.beginPath();let S=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=wi(x[0],x[3],x[1],x[4],x[2],x[5]),S/=Math.max(x.scaleX,x.scaleY));for(let C=0;C<u;C++)p=h[C],f=p.x,g=p.y,e.moveTo(f+S,g),e.arc(f,g,S,0,ct);return n||(Te.isHidden.test(a)||(_=a._renderer&&a._renderer.offset,_&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),_&&e.restore()),Te.isHidden.test(s)||(_=s._renderer&&s._renderer.offset,_&&(e.save(),e.translate(-s._renderer.offset.x,-s._renderer.offset.y),e.scale(s._renderer.scale.x,s._renderer.scale.y),e.lineWidth=o/s._renderer.scale.x),e.stroke(),_&&e.restore())),m||e.restore(),y&&y.length>0&&e.setLineDash(Hs),this.flagReset()}},text:{render:function(e,t,n){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,s=this._opacity*r,o=this._visible,a=this._mask,l=this._clip;if(!t&&(!o||l||s===0))return this;this._update();const c=this._matrix.elements,d=this._stroke,h=this._linewidth,u=this._fill,p=this._decoration,f=this._direction,g=Hr(c),m=u._renderer&&u._renderer.offset&&d._renderer&&d._renderer.offset,_=this.dashes,y=Te.alignments[this._alignment]||this._alignment,b=Te.baselines[this._baseline]||this._baseline;let S,x,C,B,v,N,F,P,q,U,M;if(g||(e.save(),e.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const E=Te.getRendererType(a._renderer.type);Te[E].render.call(a,e,!0)}if(m||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=y,e.textBaseline=b,e.direction=f,u)if(typeof u=="string")e.fillStyle=u;else{const E=Te.getRendererType(u._renderer.type);Te[E].render.call(u,e,this),e.fillStyle=u._renderer.effect}if(d){if(typeof d=="string")e.strokeStyle=d;else{const E=Te.getRendererType(d._renderer.type);Te[E].render.call(d,e,this),e.strokeStyle=d._renderer.effect}h&&(e.lineWidth=h)}if(typeof s=="number"&&(e.globalAlpha=s),_&&_.length>0&&(e.lineDashOffset=_.offset||0,e.setLineDash(_)),!l&&!n&&(Te.isHidden.test(u)||(u._renderer&&u._renderer.offset?(N=u._renderer.scale.x,F=u._renderer.scale.y,e.save(),e.translate(-u._renderer.offset.x,-u._renderer.offset.y),e.scale(N,F),S=this._size/u._renderer.scale.y,x=this._leading/u._renderer.scale.y,e.font=[this._style,this._weight,S+"px/",x+"px",this._family].join(" "),C=u._renderer.offset.x/u._renderer.scale.x,B=u._renderer.offset.y/u._renderer.scale.y,e.fillText(this.value,C,B),e.restore()):e.fillText(this.value,0,0)),Te.isHidden.test(d)||(d._renderer&&d._renderer.offset?(N=d._renderer.scale.x,F=d._renderer.scale.y,e.save(),e.translate(-d._renderer.offset.x,-d._renderer.offset.y),e.scale(N,F),S=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,e.font=[this._style,this._weight,S+"px/",x+"px",this._family].join(" "),C=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,v=h/d._renderer.scale.x,e.lineWidth=v,e.strokeText(this.value,C,B),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(p)){const E=e.measureText(this.value);let A=1;switch(p){case"underline":q=E.actualBoundingBoxDescent,M=E.actualBoundingBoxDescent;break;case"strikethrough":q=0,M=0,A=.5;break}switch(b){case"top":q+=this._size*A,M+=this._size*A;break;case"baseline":case"bottom":q-=this._size*A,M-=this._size*A;break}switch(y){case"left":case"start":P=0,U=E.width;break;case"right":case"end":P=-E.width,U=0;break;default:P=-E.width/2,U=E.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(P,q),e.lineTo(U,M),e.stroke()}return g||e.restore(),l&&!n&&e.clip(),_&&_.length>0&&e.setLineDash(Hs),this.flagReset()}},"linear-gradient":{render:function(e,t){if(t){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,s=this.left._y,o=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=t.getBoundingClientRect(!0),r=(r-.5)*n.width,s=(s-.5)*n.height,o=(o-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=e.createLinearGradient(r,s,o,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return this.flagReset()}}},"radial-gradient":{render:function(e,t){if(t){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,s=this.center._y,o=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=t.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,s=(s-.5)*n.height*.5,o=(o-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=e.createRadialGradient(r,s,0,o,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return this.flagReset()}}},texture:{render:function(e){this._update();const t=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=e.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof Z||(this._renderer.offset=new Z),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,t&&(this._renderer.offset.x+=t.width/2,this._renderer.offset.y+=t.height/2,this._scale instanceof Z?(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 Z||(this._renderer.scale=new Z),this._scale instanceof Z?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}},renderSvgArcCommand:function(e,t,n,r,s,o,a,l,c,d){l=l*Math.PI/180,r=Ol(r),s=Ol(s);const h=(t-c)/2,u=(n-d)/2,p=Lr(l)*h+zr(l)*u,f=-zr(l)*h+Lr(l)*u,g=p*p,m=f*f;let _=r*r,y=s*s;const b=g/_+m/y;if(b>1){const E=Dr(b);r=E*r,s=E*s,_=r*r,y=s*s}const S=_*m+y*g,x=(_*y-S)/S;let C=Dr(Ws(0,x));o===a&&(C=-C);const B=C*r*f/s,v=-C*s*p/r,N=Lr(l)*B-zr(l)*v+(t+c)/2,F=zr(l)*B+Lr(l)*v+(n+d)/2,P=Il(1,0,(p-B)/r,(f-v)/s),q=Il((p-B)/r,(f-v)/s,(-p-B)/r,(-f-v)/s)%ct,U=P+q;Qg(e,N,F,r,s,P,U,a===0,l)}},ht=class extends X{constructor(e){super();const t=e.smoothing!==!1;this.domElement=e.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=e.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=t),this.scene=new Ue,this.scene.parent=this}setSize(e,t,n){return this.width=e,this.height=t,this.ratio=typeof n>"u"?Ps(this.ctx):n,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,this.domElement.style&&ae.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this.trigger(X.Types.resize,e,t,n)}render(){const e=this.ratio===1;return e||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Te.group.render.call(this.scene,this.ctx),e||this.ctx.restore(),this}};w(ht,"Utils",Te);function Qg(e,t,n,r,s,o,a,l,c){const d=a-o,h=vi.Tolerance.epsilon,u=Math.abs(d)<h;let p=Rt(d,ct);p<h&&(u?p=0:p=ct),l===!0&&!u&&(p===ct?p=-ct:p=p-ct);for(let f=0;f<bt.Resolution;f++){const g=f/(bt.Resolution-1),m=o+g*p;let _=t+r*Math.cos(m),y=n+s*Math.sin(m);if(c!==0){const b=Math.cos(c),S=Math.sin(c),x=_-t,C=y-n;_=x*b-C*S+t,y=x*S+C*b+n}e.lineTo(_,y)}}function Il(e,t,n,r){const s=e*n+t*r,o=Dr(e*e+t*t)*Dr(n*n+r*r);let a=Jg(Ws(-1,Zg(1,s/o)));return e*r-t*n<0&&(a=-a),a}function Hr(e){return e[0]==1&&e[3]==0&&e[1]==0&&e[4]==1&&e[2]==0&&e[5]==0}var se={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(e,t){const n=e,r=document.createElementNS(se.ns,n);return n==="svg"&&(t=ae.defaults(t||{},{version:se.version})),t&&Object.keys(t).length>0&&se.setAttributes(r,t),r},setAttributes:function(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r++)/href/.test(n[r])?e.setAttributeNS(se.xlink,n[r],t[n[r]]):e.setAttribute(n[r],t[n[r]]);return this},removeAttributes:function(e,t){for(let n in t)e.removeAttribute(n);return this},toString:function(e,t){let n=e.length,r=n-1,s,o="";for(let a=0;a<n;a++){const l=e[a],c=t?Rt(a-1,n):Math.max(a-1,0),d=e[c];let h,u,p,f,g,m,_,y,b,S,x,C,B,v,N,F=Re(l.x),P=Re(l.y);switch(l.command){case ee.close:h=ee.close;break;case ee.arc:x=l.rx,C=l.ry,B=l.xAxisRotation,v=l.largeArcFlag,N=l.sweepFlag,h=ee.arc+" "+x+" "+C+" "+B+" "+v+" "+N+" "+F+" "+P;break;case ee.curve:_=d.controls&&d.controls.right||Z.zero,y=l.controls&&l.controls.left||Z.zero,d.relative?(p=Re(_.x+d.x),f=Re(_.y+d.y)):(p=Re(_.x),f=Re(_.y)),l.relative?(g=Re(y.x+l.x),m=Re(y.y+l.y)):(g=Re(y.x),m=Re(y.y)),h=(a===0?ee.move:ee.curve)+" "+p+" "+f+" "+g+" "+m+" "+F+" "+P;break;case ee.move:s=l,h=ee.move+" "+F+" "+P;break;default:h=l.command+" "+F+" "+P}a>=r&&t&&(l.command===ee.curve&&(u=s,b=l.controls&&l.controls.right||l,S=u.controls&&u.controls.left||u,l.relative?(p=Re(b.x+l.x),f=Re(b.y+l.y)):(p=Re(b.x),f=Re(b.y)),u.relative?(g=Re(S.x+u.x),m=Re(S.y+u.y)):(g=Re(S.x),m=Re(S.y)),F=Re(u.x),P=Re(u.y),h+=" C "+p+" "+f+" "+g+" "+m+" "+F+" "+P),l.command!==ee.close&&(h+=" Z")),o+=h+" "}return o},pointsToString:function(e,t){let n="";const r=t*.5;for(let s=0;s<e.length;s++){const o=e[s].x,a=e[s].y-r;n+=ee.move+" "+o+" "+a+" ",n+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return n},getClip:function(e,t){let n=e._renderer.clip;return n||(n=e._renderer.clip=se.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&t.defs.appendChild(n),n},getRendererType:function(e){return e in se?e:"path"},defs:{update:function(e){const{defs:t}=e;if(t._flagUpdate){const n=Array.prototype.slice.call(t.children,0);for(let r=0;r<n.length;r++){const s=n[r],o=s.id,a=`[fill="url(#${o})"],[stroke="url(#${o})"],[clip-path="url(#${o})"]`;e.querySelector(a)||t.removeChild(s)}t._flagUpdate=!1}}},group:{appendChild:function(e){const t=e._renderer.elem;if(!t)return;const n=t.nodeName;!n||/(radial|linear)gradient/i.test(n)||e._clip||this.elem.appendChild(t)},removeChild:function(e){const t=e._renderer.elem;!t||t.parentNode!=this.elem||!t.nodeName||e._clip||this.elem.removeChild(t)},orderChild:function(e){this.elem.appendChild(e._renderer.elem)},renderChild:function(e){const t=se.getRendererType(e._renderer.type);se[t].render.call(e,this)},render:function(e){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;this._update(),this._renderer.elem||(this._renderer.elem=se.createElement("g",{id:this.id}),e.appendChild(this._renderer.elem));const t=this._matrix.manual||this._flagMatrix,n={domElement:e,elem:this._renderer.elem};t&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const s=this.children[r],o=se.getRendererType(s._renderer.type);se[o].render.call(s,e)}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(se.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(se.group.removeChild,n),this._flagOrder&&this.children.forEach(se.group.orderChild,n),this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),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),this.flagReset()}},path:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices){const r=se.toString(this._renderer.vertices,this._closed);t.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this._flagCap&&(t["stroke-linecap"]=this._cap),this._flagJoin&&(t["stroke-linejoin"]=this._join),this._flagMiter&&(t["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=se.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}if(this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const o=this.worldMatrix.elements,a=wi(o[0],o[3],o[1],o[4],o[2],o[5]);r/=Math.max(a.scaleX,a.scaleY)}const s=se.pointsToString(this._renderer.collection,r);t.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}return this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("path",t),e.appendChild(this._renderer.elem)),this.flagReset()}},text:{render:function(e){this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=se.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=se.baselines[this._baseline]||this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._flagDirection&&(t.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("text",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=se.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}if(this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),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(e,t){t||this._update();const n={};if(this._flagId&&(n.id=this._id),this._flagEndPoints&&(n.x1=this.left._x,n.y1=this.left._y,n.x2=this.right._x,n.y2=this.right._y),this._flagSpread&&(n.spreadMethod=this._spread),this._flagUnits&&(n.gradientUnits=this._units),this._renderer.elem?se.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=se.createElement("linearGradient",n)),this._renderer.elem.parentNode===null&&e.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 s=0;s<this.stops.length;s++){const o=this.stops[s],a={};o._flagOffset&&(a.offset=100*o._offset+"%"),o._flagColor&&(a["stop-color"]=o._color),o._flagOpacity&&(a["stop-opacity"]=o._opacity),o._renderer.elem?se.setAttributes(o._renderer.elem,a):o._renderer.elem=se.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(e,t){t||this._update();const n={};if(this._flagId&&(n.id=this._id),this._flagCenter&&(n.cx=this.center._x,n.cy=this.center._y),this._flagFocal&&(n.fx=this.focal._x,n.fy=this.focal._y),this._flagRadius&&(n.r=this._radius),this._flagSpread&&(n.spreadMethod=this._spread),this._flagUnits&&(n.gradientUnits=this._units),this._renderer.elem?se.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=se.createElement("radialGradient",n)),this._renderer.elem.parentNode===null&&e.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 s=0;s<this.stops.length;s++){const o=this.stops[s],a={};o._flagOffset&&(a.offset=100*o._offset+"%"),o._flagColor&&(a["stop-color"]=o._color),o._flagOpacity&&(a["stop-opacity"]=o._opacity),o._renderer.elem?se.setAttributes(o._renderer.elem,a):o._renderer.elem=se.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return this.flagReset()}},texture:{render:function(e,t){t||this._update();const n={},r={x:0,y:0},s=this.image;if(this._flagId&&(n.id=this._id),this._flagLoaded&&this.loaded)switch(s.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=s.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(n.x=this._offset.x,n.y=this._offset.y,s&&(n.x-=s.width/2,n.y-=s.height/2,this._scale instanceof Z?(n.x*=this._scale.x,n.y*=this._scale.y):(n.x*=this._scale,n.y*=this._scale)),n.x>0&&(n.x*=-1),n.y>0&&(n.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(n.width=0,n.height=0,s)){switch(n.width=s.width,n.height=s.height,this._repeat){case"no-repeat":n.width+=1,n.height+=1;break}this._scale instanceof Z?(n.width*=this._scale.x,n.height*=this._scale.y):(n.width*=this._scale,n.height*=this._scale),r.width=n.width,r.height=n.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?se.setAttributes(this._renderer.image,r):this._renderer.image=se.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&se.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=se.createElement("pattern",n)),this._renderer.elem.parentNode===null&&e.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),this.flagReset()}}},Vl=class extends X{constructor(e){super(),this.domElement=e.domElement||se.createElement("svg"),this.scene=new Ue,this.scene.parent=this,this.defs=se.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(e,t){return this.width=e,this.height=t,se.setAttributes(this.domElement,{width:e,height:t}),this.trigger(X.Types.resize,e,t)}render(){return se.group.render.call(this.scene,this.domElement),se.defs.update(this.domElement),this}};w(Vl,"Utils",se);var zt={create:function(e,t,n){const r=e.createShader(e[n]);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){const o=e.getShaderInfoLog(r);throw e.deleteShader(r),new Bt("unable to compile shader "+r+": "+o)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
|
40
|
+
***************************************************************************** */var Cr=function(){return Cr=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Cr.apply(this,arguments)},Iu={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"}},dn={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Ss=500,Vu=function(){function e(t,n){return this.core=t,this.$LG=n,this.settings=Cr(Cr({},Iu),this.core.settings),this}return e.prototype.buildTemplates=function(){var t=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&&(t+='<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(t)},e.prototype.enableZoom=function(t){var n=this,r=this.settings.enableZoomAfter+t.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&t.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){n.isImageSlide(n.core.index)&&(n.core.getSlideItem(t.detail.index).addClass("lg-zoomable"),t.detail.index===n.core.index&&n.setZoomEssentials())},r+30)},e.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(dn.slideItemLoad+".zoom",this.enableZoom.bind(this))},e.prototype.getDragCords=function(t){return{x:t.pageX,y:t.pageY}},e.prototype.getSwipeCords=function(t){var n=t.touches[0].pageX,r=t.touches[0].pageY;return{x:n,y:r}},e.prototype.getDragAllowedAxises=function(t,n){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),s=0,o=0,a=r.getBoundingClientRect();t?(s=r.offsetHeight*t,o=r.offsetWidth*t):n?(s=a.height+n*a.height,o=a.width+n*a.width):(s=a.height,o=a.width);var l=s>this.containerRect.height,c=o>this.containerRect.width;return{allowX:c,allowY:l}},e.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},e.prototype.zoomImage=function(t,n,r,s){if(!(Math.abs(n)<=0)){var o=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;t===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,n),h=d.allowY,u=d.allowX;this.positionChanged&&(l=this.left/(this.scale-n),c=this.top/(this.scale-n),this.pageX=o-l,this.pageY=a-c,this.positionChanged=!1);var p=this.getPossibleSwipeDragCords(n),f,g,m=o-this.pageX,_=a-this.pageY;if(t-n>1){var y=(t-n)/Math.abs(n);m=(n<0?-m:m)+this.left*(y+(n<0?-1:1)),_=(n<0?-_:_)+this.top*(y+(n<0?-1:1)),f=m/y,g=_/y}else{var y=(t-n)*n;f=m*y,g=_*y}r&&(u?this.isBeyondPossibleLeft(f,p.minX)?f=p.minX:this.isBeyondPossibleRight(f,p.maxX)&&(f=p.maxX):t>1&&(f<p.minX?f=p.minX:f>p.maxX&&(f=p.maxX)),h?this.isBeyondPossibleTop(g,p.minY)?g=p.minY:this.isBeyondPossibleBottom(g,p.maxY)&&(g=p.maxY):t>1&&(g<p.minY?g=p.minY:g>p.maxY&&(g=p.maxY))),this.setZoomStyles({x:f,y:g,scale:t}),this.left=f,this.top=g,s&&this.setZoomImageSize()}},e.prototype.resetImageTranslate=function(t){if(this.isImageSlide(t)){var n=this.core.getSlideItem(t).find(".lg-image").first();this.imageReset=!1,n.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),n.css("width","auto").css("height","auto"),setTimeout(function(){n.removeClass("no-transition")},10)}},e.prototype.setZoomImageSize=function(){var t=this,n=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=t.getCurrentImageActualSizeScale();t.scale>=r&&(n.addClass("no-transition"),t.imageReset=!0)},Ss),setTimeout(function(){var r=t.getCurrentImageActualSizeScale();if(t.scale>=r){var s=t.getDragAllowedAxises(t.scale);n.css("width",n.get().naturalWidth+"px").css("height",n.get().naturalHeight+"px"),t.core.outer.addClass("lg-actual-size"),s.allowX&&s.allowY?n.addClass("reset-transition"):s.allowX&&!s.allowY?n.addClass("reset-transition-x"):!s.allowX&&s.allowY&&n.addClass("reset-transition-y")}},Ss+50)},e.prototype.setZoomStyles=function(t){var n=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),s=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=t.scale,r.css("transform","scale3d("+t.scale+", "+t.scale+", 1)"),s.css("transform","scale3d("+t.scale+", "+t.scale+", 1)");var o="translate3d("+t.x+"px, "+t.y+"px, 0)";n.css("transform",o)},e.prototype.setActualSize=function(t,n){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var s=this.core.galleryItems[this.core.index];this.resetImageTranslate(t),setTimeout(function(){if(!(!s.src||r.core.outer.hasClass("lg-first-slide-loading"))){var o=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(o),r.setPageCords(n),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-a,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},Ss+110)}},e.prototype.getNaturalWidth=function(t){var n=this.core.getSlideItem(t).find(".lg-image").first(),r=this.core.galleryItems[t].width;return r?parseFloat(r):n.get().naturalWidth},e.prototype.getActualSizeScale=function(t,n){var r,s;return t>=n?(r=t/n,s=r||2):s=1,s},e.prototype.getCurrentImageActualSizeScale=function(){var t=this.core.getSlideItem(this.core.index).find(".lg-image").first(),n=t.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||n;return this.getActualSizeScale(r,n)},e.prototype.getPageCords=function(t){var n={};if(t)n.x=t.pageX||t.touches[0].pageX,n.y=t.pageY||t.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();n.x=r.width/2+r.left,n.y=r.height/2+this.scrollTop+r.top}return n},e.prototype.setPageCords=function(t){var n=this.getPageCords(t);this.pageX=n.x,this.pageY=n.y},e.prototype.manageActualPixelClassNames=function(){var t=this.core.getElementById("lg-actual-size");t.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},e.prototype.beginZoom=function(t){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),t>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),t>1},e.prototype.getScale=function(t){var n=this.getCurrentImageActualSizeScale();return t<1?t=1:t>n&&(t=n),t},e.prototype.init=function(){var t=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var n=null;this.core.outer.on("dblclick.lg",function(r){t.$LG(r.target).hasClass("lg-image")&&t.setActualSize(t.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var s=t.$LG(r.target);r.touches.length===1&&s.hasClass("lg-image")&&(n?(clearTimeout(n),n=null,r.preventDefault(),t.setActualSize(t.core.index,r)):n=setTimeout(function(){n=null},300))}),this.core.LGel.on(dn.containerResize+".zoom "+dn.rotateRight+".zoom "+dn.rotateLeft+".zoom "+dn.flipHorizontal+".zoom "+dn.flipVertical+".zoom",function(){if(!(!t.core.lgOpened||!t.isImageSlide(t.core.index)||t.core.touchAction)){var r=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();t.top=0,t.left=0,t.setZoomEssentials(),t.setZoomSwipeStyles(r,{x:0,y:0}),t.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){t.core.lgOpened&&(t.scrollTop=t.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(t.isImageSlide(t.core.index)){var r=0;t.imageReset&&(t.resetImageTranslate(t.core.index),r=50),setTimeout(function(){var s=t.scale-t.settings.scale;s<1&&(s=1),t.beginZoom(s),t.zoomImage(s,-t.settings.scale,!0,!t.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){t.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){t.setActualSize(t.core.index)}),this.core.LGel.on(dn.beforeOpen+".zoom",function(){t.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(dn.afterOpen+".zoom",function(){t.scrollTop=t.$LG(window).scrollTop(),t.pageX=t.core.outer.width()/2,t.pageY=t.core.outer.height()/2+t.scrollTop,t.scale=1}),this.core.LGel.on(dn.afterSlide+".zoom",function(r){var s=r.detail.prevIndex;t.scale=1,t.positionChanged=!1,t.zoomInProgress=!1,t.resetZoom(s),t.resetImageTranslate(s),t.isImageSlide(t.core.index)&&t.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},e.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var t=this.scale+this.settings.scale;this.settings.infiniteZoom||(t=this.getScale(t)),this.beginZoom(t),this.zoomImage(t,Math.min(this.settings.scale,t-this.scale),!0,!this.settings.infiniteZoom)}},e.prototype.resetZoom=function(t){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var n=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(t!==void 0?t:this.core.index);n.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()},e.prototype.getTouchDistance=function(t){return Math.sqrt((t.touches[0].pageX-t.touches[1].pageX)*(t.touches[0].pageX-t.touches[1].pageX)+(t.touches[0].pageY-t.touches[1].pageY)*(t.touches[0].pageY-t.touches[1].pageY))},e.prototype.pinchZoom=function(){var t=this,n=0,r=!1,s=1,o=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=t.core.getSlideItem(t.core.index),!!t.isImageSlide(t.core.index)&&l.touches.length===2){if(l.preventDefault(),t.core.outer.hasClass("lg-first-slide-loading"))return;s=t.scale||1,t.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),t.setPageCords(l),t.resetImageTranslate(t.core.index),t.core.touchAction="pinch",n=t.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&t.core.touchAction==="pinch"&&(t.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=t.getTouchDistance(l),d=n-c;if(!r&&Math.abs(d)>5&&(r=!0),r){o=t.scale;var h=Math.max(1,s+-d*.02);t.scale=Math.round((h+Number.EPSILON)*100)/100;var u=t.scale-o;t.zoomImage(t.scale,Math.round((u+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(t.core.touchAction==="pinch"&&(t.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,n=0,t.scale<=1)t.resetZoom();else{var c=t.getCurrentImageActualSizeScale();if(t.scale>=c){var d=c-t.scale;d===0&&(d=.01),t.zoomImage(c,d,!1,!0)}t.manageActualPixelClassNames(),t.core.outer.addClass("lg-zoomed")}t.core.touchAction=void 0}})},e.prototype.touchendZoom=function(t,n,r,s,o){var a=n.x-t.x,l=n.y-t.y,c=Math.abs(a)/o+1,d=Math.abs(l)/o+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var h=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),u={};u.x=this.left+a,u.y=this.top+l;var p=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(s&&(this.isBeyondPossibleTop(u.y,p.minY)?u.y=p.minY:this.isBeyondPossibleBottom(u.y,p.maxY)&&(u.y=p.maxY)),r&&(this.isBeyondPossibleLeft(u.x,p.minX)?u.x=p.minX:this.isBeyondPossibleRight(u.x,p.maxX)&&(u.x=p.maxX)),s?this.top=u.y:u.y=this.top,r?this.left=u.x:u.x=this.left,this.setZoomSwipeStyles(h,u),this.positionChanged=!0)},e.prototype.getZoomSwipeCords=function(t,n,r,s,o){var a={};if(s){if(a.y=this.top+(n.y-t.y),this.isBeyondPossibleTop(a.y,o.minY)){var l=o.minY-a.y;a.y=o.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,o.maxY)){var c=a.y-o.maxY;a.y=o.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(n.x-t.x),this.isBeyondPossibleLeft(a.x,o.minX)){var d=o.minX-a.x;a.x=o.minX-d/6}else if(this.isBeyondPossibleRight(a.x,o.maxX)){var h=a.x-o.maxX;a.x=o.maxX+h/6}}else a.x=this.left;return a},e.prototype.isBeyondPossibleLeft=function(t,n){return t>=n},e.prototype.isBeyondPossibleRight=function(t,n){return t<=n},e.prototype.isBeyondPossibleTop=function(t,n){return t>=n},e.prototype.isBeyondPossibleBottom=function(t,n){return t<=n},e.prototype.isImageSlide=function(t){var n=this.core.galleryItems[t];return this.core.getSlideType(n)==="image"},e.prototype.getPossibleSwipeDragCords=function(t){var n=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,s=n.get().getBoundingClientRect(),o=s.height,a=s.width;t&&(o=o+t*o,a=a+t*a);var l=(o-this.containerRect.height)/2,c=(this.containerRect.height-o)/2+r,d=(a-this.containerRect.width)/2,h=(this.containerRect.width-a)/2,u={minY:l,maxY:c,minX:d,maxX:h};return u},e.prototype.setZoomSwipeStyles=function(t,n){t.css("transform","translate3d("+n.x+"px, "+n.y+"px, 0)")},e.prototype.zoomSwipe=function(){var t=this,n={},r={},s=!1,o=!1,a=!1,l=new Date,c=new Date,d,h,u=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(p){if(t.isImageSlide(t.core.index)&&(u=t.core.getSlideItem(t.core.index),(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))&&p.touches.length===1&&t.core.outer.hasClass("lg-zoomed"))){p.preventDefault(),l=new Date,t.core.touchAction="zoomSwipe",h=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var f=t.getDragAllowedAxises(0);a=f.allowY,o=f.allowX,(o||a)&&(n=t.getSwipeCords(p)),d=t.getPossibleSwipeDragCords(),t.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(p){if(p.touches.length===1&&t.core.touchAction==="zoomSwipe"&&(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))){p.preventDefault(),t.core.touchAction="zoomSwipe",r=t.getSwipeCords(p);var f=t.getZoomSwipeCords(n,r,o,a,d);(Math.abs(r.x-n.x)>15||Math.abs(r.y-n.y)>15)&&(s=!0,t.setZoomSwipeStyles(h,f))}}),this.core.$inner.on("touchend.lg",function(p){if(t.core.touchAction==="zoomSwipe"&&(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))){if(p.preventDefault(),t.core.touchAction=void 0,t.core.outer.removeClass("lg-zoom-dragging"),!s)return;s=!1,c=new Date;var f=c.valueOf()-l.valueOf();t.touchendZoom(n,r,o,a,f)}})},e.prototype.zoomDrag=function(){var t=this,n={},r={},s=!1,o=!1,a=!1,l=!1,c,d,h,u;this.core.outer.on("mousedown.lg.zoom",function(p){if(t.isImageSlide(t.core.index)){var f=t.core.getSlideItem(t.core.index);if(t.$LG(p.target).hasClass("lg-item")||f.get().contains(p.target)){c=new Date,u=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var g=t.getDragAllowedAxises(0);l=g.allowY,a=g.allowX,t.core.outer.hasClass("lg-zoomed")&&t.$LG(p.target).hasClass("lg-object")&&(a||l)&&(p.preventDefault(),n=t.getDragCords(p),h=t.getPossibleSwipeDragCords(),s=!0,t.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(p){if(s){o=!0,r=t.getDragCords(p);var f=t.getZoomSwipeCords(n,r,a,l,h);t.setZoomSwipeStyles(u,f)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(p){if(s){if(d=new Date,s=!1,t.core.outer.removeClass("lg-zoom-dragging"),o&&(n.x!==r.x||n.y!==r.y)){r=t.getDragCords(p);var f=d.valueOf()-c.valueOf();t.touchendZoom(n,r,a,l,f)}o=!1}t.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},e.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},e.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},e}();const Le=class Le{static init(t){if(Le.uiConfig)throw new Error("UI provider already initialized.");Le.uiConfig=t,Le.windowResizeHandler(),window.addEventListener("resize",Le.windowResizeHandler)}static destroy(){window.removeEventListener("resize",Le.windowResizeHandler)}static getMessagesService(){return Le.getUiConfig().messagesService}static getNotificationsService(){return Le.getUiConfig().notificationsService}static getDeviceTypeByResolution(){const{deviceTypeResolutionsConfig:t}=Le.getUiConfig();return window.innerWidth<t.tablet?W.WindowResolutionEnum.phone:window.innerWidth<t.laptop?W.WindowResolutionEnum.tablet:W.WindowResolutionEnum.laptop}static initRefDependingOnDeviceResolution(t,n,r){const s=i.ref(r);return Le.setRefValueDependingOnDeviceResolution(s,t,n,r),Le.refsDependingOnDeviceResolution.push({r:s,phoneValue:t,tabletValue:n,defaultValue:r}),s}static isPhoneDevice(){return Le.getDeviceTypeByResolution()===W.WindowResolutionEnum.phone}static isTabletDevice(){return Le.getDeviceTypeByResolution()===W.WindowResolutionEnum.tablet}static isLaptopDevice(){return Le.getDeviceTypeByResolution()===W.WindowResolutionEnum.laptop}static showNotificationsForErrorResponseData(t,n={}){var r,s;if(H.isEmpty(t.errors)){const o=(s=(r=t.rawError)==null?void 0:r.config)==null?void 0:s.url,a=o?` [ ${o} ]`:"";Le.getNotificationsService().error({title:"Ошибка выполнения/обработки запроса",content:t.message,meta:`#${t.status}${a}: ${t.statusText}`,duration:3e3})}else for(const o in t.errors)Object.prototype.hasOwnProperty.call(n,o)?n[o]=new W.FieldValidationResultData(t.errors[o].toString(),"error"):Le.getMessagesService().error(t.errors[o].toString())}static getUiConfig(){if(!Le.uiConfig)throw new Error("UI provider is not initialized.");return Le.uiConfig}static setRefValueDependingOnDeviceResolution(t,n,r,s){switch(Le.getDeviceTypeByResolution()){case W.WindowResolutionEnum.phone:t.value=n;break;case W.WindowResolutionEnum.tablet:t.value=r;break;default:t.value=s;break}}static windowResizeHandler(){H.forEach(Le.refsDependingOnDeviceResolution,t=>{Le.setRefValueDependingOnDeviceResolution(t.r,t.phoneValue,t.tabletValue,t.defaultValue)})}};k(Le,"uiConfig"),k(Le,"refsDependingOnDeviceResolution",[]);let _t=Le;const zu={ref:"gallery-container",class:"lightgallery-wrapper"},Lu={},ya=i.defineComponent({...Lu,__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(e){const t=e,n={lgAfterAppendSlide:t.onAfterAppendSlide,lgInit:t.onInit,lgHasVideo:t.onHasVideo,lgContainerResize:t.onContainerResize,lgAfterAppendSubHtml:t.onAfterAppendSubHtml,lgBeforeOpen:t.onBeforeOpen,lgAfterOpen:t.onAfterOpen,lgSlideItemLoad:t.onSlideItemLoad,lgBeforeSlide:t.onBeforeSlide,lgAfterSlide:t.onAfterSlide,lgPosterClick:t.onPosterClick,lgDragStart:t.onDragStart,lgDragMove:t.onDragMove,lgDragEnd:t.onDragEnd,lgBeforeNextSlide:t.onBeforeNextSlide,lgBeforePrevSlide:t.onBeforePrevSlide,lgBeforeClose:t.onBeforeClose,lgAfterClose:t.onAfterClose,lgRotateLeft:t.onRotateLeft,lgRotateRight:t.onRotateRight,lgFlipHorizontal:t.onFlipHorizontal,lgFlipVertical:t.onFlipVertical},r=i.useTemplateRef("gallery-container"),s=i.ref(null);return i.onMounted(async()=>{if(!r.value)return;const o=await import("lightgallery");s.value=o.default(r.value,{...t.settings}),H.forOwn(n,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),i.onBeforeUnmount(()=>{var o;s.value&&((o=s.value)==null||o.destroy(),s.value=null)}),(o,a)=>(i.openBlock(),i.createElementBlock("div",zu,[i.renderSlot(o.$slots,"default")],512))}}),Du=["href"],Hu=["src","alt"],Wu={},ba=i.defineComponent({...Wu,__name:"image-gallery",props:{images:{}},setup(e,{expose:t}){const n=i.ref(!1),r=i.ref(!1),s=i.ref({plugins:[Ou,Vu],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),o=()=>window.innerWidth*(_t.getDeviceTypeByResolution()===W.WindowResolutionEnum.phone?.7:.8),a=i.ref(o()),l=()=>{a.value=o()},c=()=>{n.value=!0};return i.onUnmounted(()=>{window.removeEventListener("resize",l)}),t({show:c}),window.addEventListener("resize",l),(d,h)=>{const u=_a,p=O.NPopover;return i.openBlock(),i.createBlock(p,{trigger:"manual",show:n.value,class:"sc-image",placement:"top-start",onClickoutside:h[3]||(h[3]=()=>{r.value||(n.value=!1)})},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:"inline-flex",onClick:h[0]||(h[0]=f=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(u)])])]),default:i.withCtx(()=>[i.createVNode(ya,{settings:s.value,style:i.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:h[1]||(h[1]=()=>{r.value=!0}),onAfterClose:h[2]||(h[2]=()=>{r.value=!1,n.value=!1})},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.images,(f,g)=>(i.openBlock(),i.createElementBlock("a",{key:g,href:f.image},[i.createElementVNode("img",{src:f.preview,alt:`Изображение #${g+1}`},null,8,Hu)],8,Du))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),ju={class:"flex flex-col text-sm"},Xu={},qu=i.defineComponent({...Xu,__name:"product-stock-count",props:{product:{}},setup(e){return(t,n)=>{const r=Cs,s=O.NPopover;return i.openBlock(),i.createBlock(s,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:i.withCtx(()=>[i.renderSlot(t.$slots,"default",{},()=>[i.createVNode(r)])]),default:i.withCtx(()=>[i.createElementVNode("div",ju,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.product.stockCount,(o,a)=>(i.openBlock(),i.createElementBlock("span",{key:a},i.toDisplayString(o.warehouse.name)+": "+i.toDisplayString(o.count)+" "+i.toDisplayString(t.product.quantityUnit),1))),128))])]),_:3})}}}),Yu={class:"flex flex-row justify-between"},Uu={key:0},Gu={class:"ml-2 align-sub"},Ku={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Zu={class:"@container"},Ju={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},Qu={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},ef={class:"text-sc-dark-grey"},tf={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},nf={class:"text-gray-600"},rf={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},sf={key:3,class:"underline decoration-dashed"},of={key:4,class:"sc-product-pack whitespace-nowrap"},af={class:"text-gray-600"},lf={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},cf={class:"text-gray-600"},df={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},hf={key:0},uf={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},ff={},Xi=i.defineComponent({...ff,__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},showPriceHistory:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e,{expose:t}){const n=e,r=i.computed(()=>H.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),s=i.computed(()=>H.sortBy(n.product.priceCoefficients,["coefficient.slug"])),o=i.computed(()=>{var h,u;return(u=(h=n.product)==null?void 0:h.properties)==null?void 0:u.planingIncomingDate}),a=i.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=i.computed(()=>H.isFunction(n.allowNameClick)?n.allowNameClick(n.product):n.allowNameClick),d=()=>{var h;c.value&&((h=n.eventEmitter)==null||h.emit("product:name-click",{product:n.product,exposedMethods:{showProductImagesPreview:l}}))};return t({showProductImagesPreview:l}),(h,u)=>{var y,b,S,x,C;const p=_a,f=O.NText,g=ma,m=Cs,_=O.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",Yu,[i.createVNode(f,{type:"info",class:"sc-product-name text-balance text-base font-medium"},{default:i.withCtx(()=>[i.createElementVNode("span",{class:i.normalizeClass({"cursor-pointer":c.value&&h.eventEmitter}),onClick:d},i.toDisplayString(h.product.name),3),h.product.onOrder?(i.openBlock(),i.createElementBlock("span",Uu," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",Gu,[h.product.images&&h.product.images.length>0?(i.openBlock(),i.createBlock(ba,{key:0,ref:"image-gallery",images:h.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",Ku,[i.createVNode(p)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]),_:1}),h.showProductAddToCartButton||h.showProductEditButton||((y=h.productContextButtonsConfig)==null?void 0:y.length)>0?(i.openBlock(),i.createBlock(g,{key:0,product:h.product,"event-emitter":h.eventEmitter,"show-product-add-to-cart-button":h.showProductAddToCartButton,"show-product-edit-button":h.showProductEditButton,"product-context-buttons-config":h.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",Zu,[i.createElementVNode("div",Ju,[h.product.supplierSku?(i.openBlock(),i.createElementBlock("div",Qu,[u[0]||(u[0]=i.createTextVNode(" Артикул производителя/поставщика: ")),i.createElementVNode("span",ef,i.toDisplayString(h.product.supplierSku),1)])):i.createCommentVNode("",!0),h.showCode?(i.openBlock(),i.createElementBlock("span",tf,[u[1]||(u[1]=i.createTextVNode(" Артикул: ")),i.createElementVNode("span",nf,i.toDisplayString(h.product.code),1)])):i.createCommentVNode("",!0),h.product.stockCount&&h.product.stockCount.length>0?(i.openBlock(),i.createBlock(qu,{key:2,product:h.product},{default:i.withCtx(()=>[i.createElementVNode("span",rf,[u[2]||(u[2]=i.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),i.createVNode(m,{class:"mt-0.5"})])]),_:1},8,["product"])):(i.openBlock(),i.createElementBlock("span",sf," Нет в наличии ")),(S=(b=h.product)==null?void 0:b.properties)!=null&&S.pack?(i.openBlock(),i.createElementBlock("span",of,[u[3]||(u[3]=i.createTextVNode(" Норма упаковки: ")),i.createElementVNode("span",af,i.toDisplayString((C=(x=h.product)==null?void 0:x.properties)==null?void 0:C.pack),1)])):i.createCommentVNode("",!0),h.showPlanningDates&&o.value?(i.openBlock(),i.createElementBlock("span",lf,[u[4]||(u[4]=i.createTextVNode(" Планируемая дата поступления на основной склад: ")),i.createElementVNode("span",cf,i.toDisplayString(o.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(_,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",df,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,B=>(i.openBlock(),i.createBlock(kr,{key:B.coefficient.slug,product:h.product,"cost-field-name":B.coefficient.slug??"","event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-price-history":h.showPriceHistory,"currency-rates":h.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),i.createVNode(kr,{product:h.product,"event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":!0,"show-price-history":h.showPriceHistory,"currency-rates":h.currencyRates,"cost-field-name":"cost",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-price-history","currency-rates"])])):i.createCommentVNode("",!0)]),_:1}),h.showSlugs||h.showProperties?(i.openBlock(),i.createElementBlock("div",hf,[i.createElementVNode("ul",uf,[h.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:h.product.id,slug:h.product.slug},(B,v)=>(i.openBlock(),i.createElementBlock("li",{key:v}," ("+i.toDisplayString(v)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0),h.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(h.product.properties,(B,v)=>(i.openBlock(),i.createElementBlock("li",{key:v}," ("+i.toDisplayString(v)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),pf=(e,t,n)=>({key:e,title:t,className:"align-top",resizable:!0,render:r=>i.h(kr,{product:r,costFieldName:e,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick,currencyRates:n.currencyRates})}),gf=(e,t)=>{if(e.length===0)return[];const n=[],r={};switch(_t.getDeviceTypeByResolution()){case W.WindowResolutionEnum.phone:case W.WindowResolutionEnum.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:s=>i.h(Xi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,currencyRates:t.currencyRates,productContextButtonsConfig:t.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:s=>i.h(Xi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,currencyRates:t.currencyRates})}),t.showProductCosts&&(H.forEach(e,s=>{H.forEach(s.priceCoefficients,o=>{r[o.coefficient.slug??""]||(r[o.coefficient.slug??""]=o.coefficient)})}),H.forEach(H.sortBy(r,["slug"]),s=>{n.push(pf(s.slug??"",s.name,t))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:s=>i.h(kr,{product:s,costFieldName:"cost",eventEmitter:t.eventEmitter,allowPriceClick:t.allowPriceClick,showQuantityUnit:!0,showCostDate:!0,showPriceHistory:t.showPriceHistory,currencyRates:t.currencyRates})})),(t.showProductEditButton||!H.isNil(t.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:s=>i.h(ma,{product:s,eventEmitter:t.eventEmitter,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,productContextButtonsConfig:t.productContextButtonsConfig})});break}return n},mf={key:0,class:"pt-0.5"},_f={class:"flex flex-row gap-1"},yf={key:0},bf={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},wf={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},vf={},kf=i.defineComponent({...vf,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},selectedCategoriesItems:{default:void 0},selectedProductsItems:{default:void 0},showHideForClientButton:{type:[Boolean,Function],default:!1},showPinButton:{type:[Boolean,Function],default:!1},showCategoryEditButton:{type:[Boolean,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(vr,"medium"),r=i.computed(()=>{var E;return(E=t==null?void 0:t.filteredItems)==null?void 0:E[t.categoryItem.id]}),s=i.computed(()=>{var E,A;return H.isArray((E=t.categoryItem)==null?void 0:E.categories)&&((A=t.categoryItem.categories)==null?void 0:A.length)>0}),o=i.computed(()=>{var E;return H.isArray((E=t.categoryItem)==null?void 0:E.products)?t.categoryItem.products:[]}),a=i.computed(()=>Object.entries(t.categoryItem.currencyRates??{}).map(([E,A])=>`${A} руб./${S(E)}`).join(", ")),l=i.computed(()=>H.isUndefined(t.filteredItems)||r.value==="*"?o.value:o.value.filter(E=>{var A,K;return(K=(A=r.value)==null?void 0:A.products)==null?void 0:K.includes(E.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>H.isFunction(t.showHideForClientButton)?t.showHideForClientButton(t.categoryItem):t.showHideForClientButton),h=i.computed(()=>H.isFunction(t.showPinButton)?t.showPinButton(t.categoryItem):t.showPinButton),u=i.computed(()=>H.isFunction(t.showCategoryEditButton)?t.showCategoryEditButton(t.categoryItem):t.showCategoryEditButton),p=i.computed(()=>H.isNil(t.categoryContextButtonsConfig)?[]:H.isFunction(t.categoryContextButtonsConfig)?t.categoryContextButtonsConfig(t.categoryItem):t.categoryContextButtonsConfig),f=i.computed(()=>new W.ClientCategory(t.categoryItem)),g=i.ref(!1),m=i.ref(!1),_=i.computed(()=>!H.isUndefined(t.selectedCategoriesItems)),y=i.computed(()=>(t.selectedCategoriesItems??[]).some(E=>E.id===t.categoryItem.id)),b=i.computed(()=>q.value&&_t.getDeviceTypeByResolution()===W.WindowResolutionEnum.laptop?"auto":"fixed"),S=(E,A="ru-RU")=>0 .toLocaleString(A,{style:"currency",currency:E,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),x=E=>{t.eventEmitter.emit("category:checked",{category:t.categoryItem,checked:E})},C=(E,A)=>{t.eventEmitter.emit("category:header-click",{categoryItem:t.categoryItem,expanded:A,isLoadingState:g})},B=()=>{t.eventEmitter.emit("category:hide",{category:t.categoryItem})},v=()=>{t.eventEmitter.emit("category:attach",{category:t.categoryItem})},N=()=>{t.eventEmitter.emit("category:detach",{category:t.categoryItem})},F=()=>{t.eventEmitter.emit("category:edit",{category:t.categoryItem})},P=E=>{t.eventEmitter.emit("category:context-select",{category:t.categoryItem,key:E})},q=i.ref(0),U=i.computed(()=>q.value&&o.value.length>0?gf(o.value,{eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,currencyRates:t.categoryItem.currencyRates,productContextButtonsConfig:t.productContextButtonsConfig}):[]),M=H.debounce(()=>{q.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",M)}),window.addEventListener("resize",M),M(),(E,A)=>{const K=O.NCheckbox,R=ou,$=O.NTooltip,j=iu,z=pa,Y=O.NTag,I=Jh,V=Gh,J=O.NButton,pe=qh,ie=fa,ge=ua,re=O.NDropdown,Me=O.NDataTable,Fe=O.NAlert,Ge=O.NSpin;return i.openBlock(),i.createBlock(ga,{name:E.categoryItem.id,"data-id":E.categoryItem.id,"onHeader:click":C},{"pre-arrow":i.withCtx(()=>{var xe,Se,st;return[_.value?(i.openBlock(),i.createElementBlock("div",mf,[i.createVNode(K,{checked:y.value,"onUpdate:checked":x},null,8,["checked"])])):i.createCommentVNode("",!0),!d.value&&((xe=f.value)!=null&&xe.isDisabled)?(i.openBlock(),i.createBlock($,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(R,{class:"pt-1.5"})]),default:i.withCtx(()=>[A[1]||(A[1]=i.createTextVNode(" Категория скрыта для клиента "))]),_:1,__:[1]})):i.createCommentVNode("",!0),((Se=f.value)==null?void 0:Se.isFavorite)??!1?(i.openBlock(),i.createBlock($,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(j,{class:"pt-1.5"})]),default:i.withCtx(()=>[A[2]||(A[2]=i.createTextVNode(" Избранная категория "))]),_:1,__:[2]})):i.createCommentVNode("",!0),((st=f.value)==null?void 0:st.isRequired)??!1?(i.openBlock(),i.createBlock($,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(z,{class:"pt-1.5"})]),default:i.withCtx(()=>[A[3]||(A[3]=i.createTextVNode(" Доп. продажа "))]),_:1,__:[3]})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var xe,Se,st;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":E.categoryItem.isHidden,"text-gray-400":(xe=f.value)==null?void 0:xe.isDisabled})},[i.createVNode($,{disabled:!E.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(E.categoryItem.name),1)]),default:i.withCtx(()=>[A[4]||(A[4]=i.createTextVNode(" Категория скрыта "))]),_:1,__:[4]},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:A[0]||(A[0]=i.withModifiers((...Ke)=>i.unref(H.noop)&&i.unref(H.noop)(...Ke),["prevent","stop"]))},[(Se=E.categoryItem.properties)!=null&&Se.m2Price?(i.openBlock(),i.createBlock(Y,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Средняя стоимость: "+i.toDisplayString(E.categoryItem.properties.m2Price)+" руб./м2 ",1)]),_:1},8,["size"])):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(Y,{key:1,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),h.value&&((st=f.value)!=null&&st.manager)?(i.openBlock(),i.createBlock(Y,{key:2,size:i.unref(n),closable:!0,round:"",onClose:N},{default:i.withCtx(()=>[i.createVNode($,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var Ke,nt;return[i.createElementVNode("span",_f,[i.createVNode(I),i.createTextVNode(" "+i.toDisplayString((nt=(Ke=f.value)==null?void 0:Ke.manager)==null?void 0:nt.name),1)])]}),default:i.withCtx(()=>{var Ke,nt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((nt=(Ke=f.value)==null?void 0:Ke.manager)==null?void 0:nt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[E.showSlugs||E.showProperties?(i.openBlock(),i.createElementBlock("div",yf,[i.createElementVNode("ul",bf,[E.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:E.categoryItem.id,slug:E.categoryItem.slug},(xe,Se)=>(i.openBlock(),i.createElementBlock("li",{key:Se}," ("+i.toDisplayString(Se)+"): "+i.toDisplayString(xe),1))),128)):i.createCommentVNode("",!0),E.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(E.categoryItem.properties,(xe,Se)=>(i.openBlock(),i.createElementBlock("li",{key:Se}," ("+i.toDisplayString(Se)+"): "+i.toDisplayString(xe),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var xe;return[i.createElementVNode("div",wf,[d.value?(i.openBlock(),i.createBlock($,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(J,{size:i.unref(n),onClick:B},{default:i.withCtx(()=>{var Se;return[(Se=f.value)!=null&&Se.isDisabled?(i.openBlock(),i.createBlock(R,{key:1})):(i.openBlock(),i.createBlock(V,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var Se;return[(Se=f.value)!=null&&Se.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(f.value.hidingComment?`. Причина: '${f.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),h.value&&!((xe=f.value)!=null&&xe.manager)?(i.openBlock(),i.createBlock($,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(J,{size:i.unref(n),onClick:v},{default:i.withCtx(()=>[i.createVNode(pe)]),_:1},8,["size"])]),default:i.withCtx(()=>{var Se,st,Ke;return[(Se=f.value)!=null&&Se.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((Ke=(st=f.value)==null?void 0:st.manager)==null?void 0:Ke.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock($,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(J,{ghost:!0,size:i.unref(n),type:"primary",onClick:F},{default:i.withCtx(()=>[i.createVNode(ie)]),_:1},8,["size"])]),default:i.withCtx(()=>[A[5]||(A[5]=i.createTextVNode(" Редактировать "))]),_:1,__:[5]})):i.createCommentVNode("",!0),p.value.length>0?(i.openBlock(),i.createBlock(re,{key:3,options:p.value,size:i.unref(n),trigger:"click",onSelect:P},{default:i.withCtx(()=>[i.createVNode(J,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(ge)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(E.$slots,"default",{},()=>{var xe;return[s.value?(i.openBlock(),i.createBlock(va,{key:0,"categories-items":E.categoryItem.categories??[],"has-products":c.value||g.value,"event-emitter":E.eventEmitter,"filtered-items":r.value?((xe=r.value)==null?void 0:xe.categories)??{}:void 0,"selected-categories-items":E.selectedCategoriesItems,"selected-products-items":E.selectedProductsItems,"show-slugs":E.showSlugs,"show-properties":E.showProperties,"show-product-costs":E.showProductCosts,"allow-name-click":E.allowNameClick,"allow-price-click":E.allowPriceClick,"show-price-history":E.showPriceHistory,"show-product-add-to-cart-button":E.showProductAddToCartButton,"show-product-edit-button":E.showProductEditButton,"product-context-buttons-config":E.productContextButtonsConfig,"show-hide-for-client-button":E.showHideForClientButton,"show-pin-button":E.showPinButton,"show-category-edit-button":E.showCategoryEditButton,"category-context-buttons-config":E.categoryContextButtonsConfig},null,8,["categories-items","has-products","event-emitter","filtered-items","selected-categories-items","selected-products-items","show-slugs","show-properties","show-product-costs","allow-name-click","allow-price-click","show-price-history","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config","show-hide-for-client-button","show-pin-button","show-category-edit-button","category-context-buttons-config"])):i.createCommentVNode("",!0),c.value?(i.openBlock(),i.createBlock(Me,{key:1,columns:U.value,data:l.value,bordered:!0,loading:g.value,remote:!0,"row-key":Se=>Se.id,"table-layout":b.value,class:"mt-1"},null,8,["columns","data","loading","row-key","table-layout"])):i.createCommentVNode("",!0),!g.value&&!m.value&&!s.value&&!c.value?(i.openBlock(),i.createBlock(Fe,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(Fe,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),g.value?(i.openBlock(),i.createBlock(Ge,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>A[6]||(A[6]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),xf=Ln(kf,[["__scopeId","data-v-56546932"]]),Cf={class:"sc-collapse flex w-full flex-col"},Sf={},wa=i.defineComponent({...Sf,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(e,{emit:t}){const n=e,r=t,s=(o,a)=>{r("on-item-header-click",o,a)};return i.provide("itemHeaderClickHandler",s),i.provide("defaultExpandedNames",n.defaultExpandedNames),i.provide("expandedNames",n.expandedNames),(o,a)=>(i.openBlock(),i.createElementBlock("div",Cf,[i.renderSlot(o.$slots,"default")]))}}),Bf={},va=i.defineComponent({...Bf,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},filteredItems:{default:void 0},selectedCategoriesItems:{default:void 0},selectedProductsItems:{default:void 0},showHideForClientButton:{type:[Boolean,Function],default:!1},showPinButton:{type:[Boolean,Function],default:!1},showCategoryEditButton:{type:[Boolean,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(vr,"medium"),r=i.computed(()=>H.isUndefined(t.filteredItems)?t.categoriesItems:t.categoriesItems.filter(o=>{var a;return!!((a=t.filteredItems)!=null&&a[o.id])})),s=(o,a)=>{if(H.isUndefined(a))return;const l=a[o.id];if(l==="*")return;const c={};return c[o.id]=structuredClone(i.toRaw(l)),c};return(o,a)=>{const l=O.NSpin,c=O.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(wa,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(xf,{key:d.id,"category-item":d,"event-emitter":o.eventEmitter,"filtered-items":s(d,o.filteredItems),"selected-categories-items":o.selectedCategoriesItems,"selected-products-items":o.selectedProductsItems,"show-slugs":o.showSlugs,"show-properties":o.showProperties,"show-product-costs":o.showProductCosts,"allow-name-click":o.allowNameClick,"allow-price-click":o.allowPriceClick,"show-price-history":o.showPriceHistory,"show-product-add-to-cart-button":o.showProductAddToCartButton,"show-product-edit-button":o.showProductEditButton,"product-context-buttons-config":o.productContextButtonsConfig,"show-hide-for-client-button":o.showHideForClientButton,"show-pin-button":o.showPinButton,"show-category-edit-button":o.showCategoryEditButton,"category-context-buttons-config":o.categoryContextButtonsConfig},null,8,["category-item","event-emitter","filtered-items","selected-categories-items","selected-products-items","show-slugs","show-properties","show-product-costs","allow-name-click","allow-price-click","show-price-history","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config","show-hide-for-client-button","show-pin-button","show-category-edit-button","category-context-buttons-config"]))),128))]),_:1})):o.loading?(i.openBlock(),i.createBlock(l,{key:1,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>a[0]||(a[0]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])),_:1},8,["size"])):i.createCommentVNode("",!0),!o.hasProducts&&!o.loading&&o.categoriesItems.length>0&&r.value.length===0?(i.openBlock(),i.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):i.createCommentVNode("",!0)],64)}}}),Tf={class:"text-sm"},Ef={class:"text-sm"},$f={},Nf=i.defineComponent({...$f,__name:"add-product-to-cart-form",props:{product:{},cartItem:{default:void 0},validation:{default:()=>({length:{},quantity:{},marker:{}})},isSubmitProcessing:{type:Boolean}},emits:["submit"],setup(e,{emit:t}){var l,c,d,h,u,p,f,g;const n=e,r=i.ref(new W.CartItemBase(n.cartItem??new W.CartItemBase({product:n.product,quantity:((c=(l=n.product)==null?void 0:l.properties)==null?void 0:c.minCount)??1,length:((h=(d=n.product)==null?void 0:d.properties)==null?void 0:h.minLength)||((p=(u=n.product)==null?void 0:u.properties)!=null&&p.ignoreMinCountCheck?0:(g=(f=n.product)==null?void 0:f.properties)==null?void 0:g.minCount)||0}))),s=t,o=i.computed(()=>{var y,b,S,x,C,B,v,N,F;const m=((b=(y=n.product)==null?void 0:y.properties)==null?void 0:b.minLength)??((x=(S=n.product)==null?void 0:S.properties)!=null&&x.ignoreMinCountCheck?0:(B=(C=n.product)==null?void 0:C.properties)==null?void 0:B.minCount),_=(N=(v=n.product)==null?void 0:v.properties)==null?void 0:N.maxLength;return m||_?`(${m?`от ${m}`:""}${m&&_?" ":""}${_?`до ${_}`:""} ${(F=n.product)==null?void 0:F.unit})`:""}),a=()=>{W.UnitsHelper.productIsMeasurable(n.product)||delete r.value.length,s("submit",r.value)};return(m,_)=>(i.openBlock(),i.createBlock(i.unref(O.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.unref(W.UnitsHelper).productIsMeasurable(m.product)?(i.openBlock(),i.createBlock(i.unref(O.NFormItem),{key:0,required:!0,feedback:m.validation.length.feedback||"","show-feedback":m.validation.length.showFeedback||i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01||!1,"validation-status":m.validation.length.validationStatus||void 0,label:"Метраж, "+m.product.unit+o.value+"м."},i.createSlots({default:i.withCtx(()=>{var y,b;return[i.createVNode(i.unref(O.NInputNumber),{value:r.value.length,"onUpdate:value":_[0]||(_[0]=S=>r.value.length=S),max:((y=m.product.properties)==null?void 0:y.maxLength)||void 0,min:((b=m.product.properties)==null?void 0:b.minLength)||i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product),step:i.unref(W.UnitsHelper).getProductMultiplicity(m.product),validator:S=>S%i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product)===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]}),_:2},[!m.validation.length.feedback&&i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Tf,"Метраж должен быть кратен "+i.toDisplayString(i.unref(W.UnitsHelper).getProductLengthMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status","label"])):i.createCommentVNode("",!0),i.createVNode(i.unref(O.NFormItem),{required:!0,feedback:m.validation.quantity.feedback||"","show-feedback":m.validation.quantity.showFeedback||i.unref(W.UnitsHelper).getProductMultiplicity(m.product)!==1||!1,"validation-status":m.validation.quantity.validationStatus||void 0,label:"Количество"},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:r.value.quantity,"onUpdate:value":_[1]||(_[1]=y=>r.value.quantity=y),min:i.unref(W.UnitsHelper).getProductMultiplicity(m.product),step:i.unref(W.UnitsHelper).getProductMultiplicity(m.product),validator:y=>y%i.unref(W.UnitsHelper).getProductMultiplicity(m.product)===0,placeholder:"Введите количество",class:"w-full"},null,8,["value","min","step","validator"])]),_:2},[!m.validation.quantity.feedback&&i.unref(W.UnitsHelper).getProductMultiplicity(m.product)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Ef,"Количество должно быть кратно "+i.toDisplayString(i.unref(W.UnitsHelper).getProductMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(O.NFormItem),{feedback:m.validation.marker.feedback||"","show-feedback":m.validation.marker.showFeedback||!1,"validation-status":m.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:r.value.marker,"onUpdate:value":_[2]||(_[2]=y=>r.value.marker=y),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(O.NButton),{loading:m.isSubmitProcessing,disabled:r.value.length===0||r.value.quantity===0,type:"primary",class:"self-start",onClick:_[3]||(_[3]=y=>a())},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(m.cartItem?"Изменить":"В корзину"),1)]),_:1},8,["loading","disabled"])]),_:1}))}}),Rf={class:"flex flex-row gap-1"},Pf={class:"sc-client-name flex flex-col gap-1 text-base"},Ff=["href"],Mf={key:1,class:"text-sc-grey"},Af={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Of={key:0},If={key:1,class:"text-sm"},Vf={},Sr=i.defineComponent({...Vf,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>n.client.lastLoginAt?Sn.format(n.client.lastLoginAt,W.AppConfigProvider.getConfig().dateFormats.uiDateWithTime):""),o=a=>{H.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Cs,d=O.NButton,h=O.NPopover;return i.openBlock(),i.createElementBlock("div",Rf,[a.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=u=>a.$emit("click:client-info",a.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(h,{disabled:i.unref(H.isNil)(a.popoverPosition),placement:a.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Pf,[i.createElementVNode("a",{href:a.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=u=>o(u))},[i.createElementVNode("span",{class:i.normalizeClass({"line-through":!a.client.isActive})},i.toDisplayString(a.client.name),3),a.showSalesDirection&&a.client.salesDirection?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"line-through":!a.client.isActive})}," ("+i.toDisplayString(a.client.salesDirection.name)+") ",3)):i.createCommentVNode("",!0),a.client.isActive?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",Mf," [ Деактивирован ] "))],8,Ff),a.showCityAndRegion&&a.client.city?(i.openBlock(),i.createElementBlock("span",Af," г. "+i.toDisplayString(a.client.city.name)+", "+i.toDisplayString(a.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[a.client.alternativeName?(i.openBlock(),i.createElementBlock("div",Of,i.toDisplayString(a.client.alternativeName),1)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("span",If," Последний вход: "+i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),zf={class:"text-base"},Lf={},ka=i.defineComponent({...Lf,__name:"contragent-with-short-info",props:{contragent:{}},setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("span",zf,i.toDisplayString(t.contragent.name),1))}}),Df={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hf(e,t){return i.openBlock(),i.createElementBlock("svg",Df,t[0]||(t[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),i.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)]))}const Wf=i.markRaw({name:"tabler-mail",render:Hf}),jf=["href"],Xf={},qf=i.defineComponent({...Xf,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(e){return(t,n)=>{const r=Wf;return i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showEmailIcon})},[t.showEmailIcon?(i.openBlock(),i.createBlock(r,{key:0})):i.createCommentVNode("",!0),i.createElementVNode("a",{href:`mailto:${t.email}`,class:"no-underline"},i.toDisplayString(t.email),9,jf)],2)}}}),Yf={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Uf(e,t){return i.openBlock(),i.createElementBlock("svg",Yf,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)]))}const xa=i.markRaw({name:"fa6-brands-viber",render:Uf}),Gf={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Kf=["id"],Zf=["id"],Jf=["fill"],Qf=["fill"];function ep(e,t){return i.openBlock(),i.createElementBlock("svg",Gf,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.logosWhatsappIcon0,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},t[0]||(t[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)]),8,Kf),i.createElementVNode("linearGradient",{id:e.idMap.logosWhatsappIcon1,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},t[1]||(t[1]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)]),8,Zf)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosWhatsappIcon0+")",d:"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"},null,8,Jf),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosWhatsappIcon1+")",d:"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"},null,8,Qf),t[2]||(t[2]=i.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const Ca=i.markRaw({name:"logos-whatsapp-icon",render:ep,setup(){const e=()=>Math.random().toString(36).substr(2,10);return{idMap:{logosWhatsappIcon0:"uicons-"+e(),logosWhatsappIcon1:"uicons-"+e()}}}}),tp={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},np=["id"],ip=["fill"];function rp(e,t){return i.openBlock(),i.createElementBlock("svg",tp,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.logosTelegram0,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},t[0]||(t[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)]),8,np)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosTelegram0+")",d:"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"},null,8,ip),t[1]||(t[1]=i.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const Sa=i.markRaw({name:"logos-telegram",render:rp,setup(){return{idMap:{logosTelegram0:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),sp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function op(e,t){return i.openBlock(),i.createElementBlock("svg",sp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)]))}const Ba=i.markRaw({name:"ion-call",render:op}),ap={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lp(e,t){return i.openBlock(),i.createElementBlock("svg",ap,t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)]))}const cp=i.markRaw({name:"tabler-phone-call",render:lp}),dp={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},hp=["href"],up=["href"],fp=["href"],pp=["href"],gp={},mp=i.defineComponent({...gp,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(e){const t=e,n=i.computed(()=>{try{return t.phone?Wi.parsePhoneNumberWithError(t.phone,t.defaultCountry):void 0}catch{}return t.phone}),r=i.computed(()=>{var l;return H.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),s=i.computed(()=>{var l;return H.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var l;return H.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=cp,h=Ba,u=Sa,p=Ca,f=xa;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=g=>a.value=!a.value),onFocusout:c[1]||(c[1]=g=>a.value=!1),onMouseleave:c[2]||(c[2]=g=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":l.showPhoneIcon})},[l.showPhoneIcon?(i.openBlock(),i.createBlock(d,{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(s.value),1)],2),r.value&&a.value?(i.openBlock(),i.createElementBlock("div",dp,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${o.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[i.createVNode(h)],8,hp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${o.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(u)],8,up)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${o.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(p)],8,fp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${o.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(f)],8,pp)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),_p={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function yp(e,t){return i.openBlock(),i.createElementBlock("svg",_p,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)]))}const bp=i.markRaw({name:"mdi-envelope",render:yp}),wp={class:"flex flex-col gap-1"},vp={key:0,class:"mb-2 flex flex-col text-base"},kp={key:0,class:"text-sc-dark-grey text-sm"},xp={key:1,class:"whitespace-nowrap text-sm"},Cp={key:2,class:"whitespace-nowrap text-sm"},Sp={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},Bp=["href"],Tp=["href"],Ep=["href"],$p=["href"],Np=["href"],Rp={key:0,class:"flex flex-col text-base"},Pp={key:0,class:"text-sc-dark-grey text-sm"},Fp={key:1,class:"mt-2 text-sm"},Mp={key:0,class:"-mt-1"},Ap={},Op=i.defineComponent({...Ap,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(e){const t=e,n=i.computed(()=>{try{return t.contact.phone?Wi.parsePhoneNumberWithError(t.contact.phone,t.defaultCountry):void 0}catch{}return t.contact.phone}),r=i.computed(()=>{var c;return H.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),s=i.computed(()=>{var c;return H.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var c;return H.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("E.164"))??""}),a=i.computed(()=>r.value||t.contact.email),l=i.ref(!1);return(c,d)=>{var _,y;const h=Ba,u=Sa,p=Ca,f=xa,g=bp,m=O.NPopover;return i.openBlock(),i.createElementBlock("div",wp,[i.createVNode(m,{disabled:c.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var b,S,x,C;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(b=c.contact)!=null&&b.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${c.classes}`),style:i.normalizeStyle(c.styles),onMouseenter:d[0]||(d[0]=B=>l.value=!0),onFocusin:d[1]||(d[1]=B=>l.value=!0),onMouseleave:d[2]||(d[2]=B=>l.value=!1),onFocusout:d[3]||(d[3]=B=>l.value=!1)},[i.createElementVNode("div",null,[c.fullView&&(c.contact.name||(S=c.contact)!=null&&S.position)?(i.openBlock(),i.createElementBlock("div",vp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(x=c.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",kp,i.toDisplayString((C=c.contact)==null?void 0:C.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),c.contact.phone?(i.openBlock(),i.createElementBlock("div",xp,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("div",Cp,i.toDisplayString(c.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",Sp,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${o.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[i.createVNode(h)],8,Bp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${o.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(u)],8,Tp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${o.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(p)],8,Ep)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${o.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[i.createVNode(f)],8,$p)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${c.contact.email}`,class:"hover:text-3xl"},[i.createVNode(g)],8,Np)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var b,S,x,C;return[c.contact.name?(i.openBlock(),i.createElementBlock("div",Rp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(b=c.contact)!=null&&b.position?(i.openBlock(),i.createElementBlock("span",Pp,i.toDisplayString((S=c.contact)==null?void 0:S.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(x=c.contact)!=null&&x.comment?(i.openBlock(),i.createElementBlock("div",Fp,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((C=c.contact)==null?void 0:C.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),c.fullView&&((_=c.contact)!=null&&_.comment)?(i.openBlock(),i.createElementBlock("div",Mp,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((y=c.contact)==null?void 0:y.comment),1)])):i.createCommentVNode("",!0)])}}}),Ip={key:0,class:"flex w-fit items-center gap-2"},Vp={key:1,class:"flex flex-wrap gap-1"},zp={key:0},Lp={},qi=i.defineComponent({...Lp,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0}},setup(e){const t=e,n=i.computed(()=>{var r,s;return(s=(r=t.product)==null?void 0:r.properties)==null?void 0:s.planingProductionDate});return(r,s)=>{const o=O.NSpin;return r.isProductSearching?(i.openBlock(),i.createElementBlock("div",Ip,[i.createVNode(o,{size:17,class:"w-fit"}),s[0]||(s[0]=i.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):r.product.isNewRec()?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Vp,[i.createElementVNode("div",null,i.toDisplayString(r.product.code)+" - "+i.toDisplayString(r.product.name)+" - "+i.toDisplayString(r.product.costRub.toLocaleString())+" ₽ / "+i.toDisplayString(r.product.unit),1),n.value?(i.openBlock(),i.createElementBlock("div",zp,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)]))}}}),Dp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Hp(e,t){return i.openBlock(),i.createElementBlock("svg",Dp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)]))}const Br=i.markRaw({name:"ion-close",render:Hp}),Wp={class:"mr-3 flex flex-col gap-2"},jp=["onClick"],Xp={class:"h-full p-2"},qp={},Yp=i.defineComponent({...qp,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(e,{emit:t}){const n=e,r=i.useTemplateRef("drawing-template-containers"),s=t;return i.onMounted(()=>{n.settings.allTemplates.forEach((o,a)=>{var c;const l=(c=r.value)==null?void 0:c.at(a);l&&s("init-draw-template",l,o)})}),i.watch(()=>n.settings.allTemplates,(o,a)=>{i.nextTick(()=>{o.forEach((l,c)=>{var d;if(!a.includes(l)){const h=(d=r.value)==null?void 0:d.at(c);h&&s("init-draw-template",h,l)}})})},{deep:!0}),(o,a)=>{const l=Br;return i.openBlock(),i.createBlock(i.unref(O.NScrollbar),{style:{"max-height":"12.5rem",width:"auto"},trigger:"none"},{default:i.withCtx(()=>[i.createElementVNode("div",Wp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.settings.allTemplates,(c,d)=>(i.openBlock(),i.createElementBlock("div",{key:d,class:"group relative"},[i.createVNode(i.unref(O.NPopover),{trigger:"hover",placement:"right"},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":d===o.selectTemplateIndex}]),onClick:h=>s("template:select",d)},[i.createElementVNode("div",Xp,[i.createElementVNode("div",{ref_for:!0,ref:"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,jp)]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(c.label),1)]),_:2},1024),c.isCustom&&!c.isNewRec()?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,size:"tiny",quaternary:"",circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:h=>s("remove-custom-template",d)},{default:i.withCtx(()=>[i.createVNode(l)]),_:2},1032,["onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Ta=Ln(Yp,[["__scopeId","data-v-828c3059"]]),Up={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Gp(e,t){return i.openBlock(),i.createElementBlock("svg",Up,t[0]||(t[0]=[i.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),i.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 Ea=i.markRaw({name:"ion-trash",render:Gp}),Kp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Zp(e,t){return i.openBlock(),i.createElementBlock("svg",Kp,t[0]||(t[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)]))}const $a=i.markRaw({name:"ion-plus",render:Zp}),Jp={class:"flex flex-col gap-4"},Qp={class:"flex flex-col gap-2"},eg={class:"mt-8 font-bold"},tg={class:"grid grow grid-cols-2 items-start gap-2"},ng={class:"flex flex-col gap-4"},ig={class:"flex gap-3"},rg={},Na=i.defineComponent({...rg,__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","click:view-switch","submit","click:add-line","click:remove-line","click:save-template"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(structuredClone(i.toRaw(n.value.configuratorParams))),o=i.ref(!1),a=()=>{s.value.length>0&&(r("update:params",s.value),l("configuratorParams",s.value))},l=(c,d)=>{const h=new W.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.watch(()=>n.value.configuratorParams,c=>{s.value=H.cloneDeep(i.toRaw(c))},{deep:!0}),i.watch(()=>n.previewParams,c=>{s.value.linesWidths=c.linesWidths,s.value.linesAngles=c.linesAngles},{deep:!0}),(c,d)=>{const h=$a,u=Ea,p=O.NInput;return i.openBlock(),i.createBlock(i.unref(O.NForm),{class:"grid gap-2 md:grid-cols-2 md:gap-6"},{default:i.withCtx(()=>{var f,g,m,_,y,b,S,x,C;return[i.createElementVNode("div",Jp,[d[10]||(d[10]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),c.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(O.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:s.value.startTailType,"onUpdate:value":[d[0]||(d[0]=B=>s.value.startTailType=B),a],options:c.settings.startTailConfigs.map(({label:B},v)=>({label:B,value:v})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",Qp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value.linesAngles,(B,v)=>{var N,F,P,q,U,M;return i.openBlock(),i.createElementBlock("div",{key:v,class:"flex items-start gap-2"},[i.createElementVNode("div",eg,i.toDisplayString(v+1),1),i.createElementVNode("div",tg,[i.createVNode(i.unref(O.NFormItem),{label:"Ширина, мм",required:!0,feedback:((N=c.validation[`lines_widths[${v+1}]`])==null?void 0:N.feedback)||"","show-feedback":((F=c.validation[`lines_widths[${v+1}]`])==null?void 0:F.showFeedback)||!1,"validation-status":(P=c.validation[`lines_widths[${v+1}]`])==null?void 0:P.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:s.value.linesWidths[v],"onUpdate:value":[E=>s.value.linesWidths[v]=E,a],min:s.value.linesWidths.length>1?c.settings.minLineWidth:c.settings.stripMinWidth,max:c.settings.maxLineWidth,step:c.settings.lineWidthStep,validator:E=>E%c.settings.lineWidthStep===0,class:"w-full"},null,8,["value","onUpdate:value","min","max","step","validator"])]),_:2},1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(O.NFormItem),{label:"Угол сгиба, °",required:!0,feedback:((q=c.validation[`lines_angles[${v+1}]`])==null?void 0:q.feedback)||"","show-feedback":((U=c.validation[`lines_angles[${v+1}]`])==null?void 0:U.showFeedback)||!1,"validation-status":(M=c.validation[`lines_angles[${v+1}]`])==null?void 0:M.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:s.value.linesAngles[v],"onUpdate:value":[E=>s.value.linesAngles[v]=E,a],min:c.settings.minLineAngle,max:c.settings.maxLineAngle,step:c.settings.lineAngleStep,validator:E=>E%c.settings.lineAngleStep===0,class:"w-full"},null,8,["value","onUpdate:value","min","max","step","validator"])]),_:2},1032,["feedback","show-feedback","validation-status"])]),i.createVNode(i.unref(O.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:i.withCtx(()=>[c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,size:"medium",onClick:E=>r("click:add-line",v)},{default:i.withCtx(()=>[i.createVNode(h)]),_:2},1032,["onClick"])),c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:1,disabled:s.value.linesWidths.length===1,size:"medium",class:"ml-2",onClick:E=>r("click:remove-line",v)},{default:i.withCtx(()=>[i.createVNode(u)]),_:2},1032,["disabled","onClick"]))]),_:2},1024)])}),128))]),c.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(O.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:s.value.endTailType,"onUpdate:value":[d[1]||(d[1]=B=>s.value.endTailType=B),a],options:c.settings.endTailConfigs.map(({label:B},v)=>({label:B,value:v})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(qi,{"is-product-searching":c.isProductSearching,product:c.value.product},null,8,["is-product-searching","product"]),c.settings.allowSaveTemplates&&c.selectTemplateIndex===c.settings.allTemplates.length-1?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:2,type:"tertiary",class:"self-start",loading:o.value,onClick:d[2]||(d[2]=B=>r("click:save-template"))},{default:i.withCtx(()=>d[9]||(d[9]=[i.createTextVNode(" Сохранить шаблон ")])),_:1,__:[9]},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",ng,[i.createVNode(i.unref(O.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:s.value.colorSide,"onUpdate:value":[d[3]||(d[3]=B=>s.value.colorSide=B),a],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":((f=c.validation.length)==null?void 0:f.showFeedback)||!1,feedback:((g=c.validation.length)==null?void 0:g.feedback)||"","validation-status":(m=c.validation.length)==null?void 0:m.validationStatus,label:`Метраж${c.settings.stripMinLength?" от "+c.settings.stripMinLength:""}${c.settings.stripMaxLength?" до "+c.settings.stripMaxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:s.value.length,"onUpdate:value":[d[4]||(d[4]=B=>s.value.length=B),a],required:!0,max:c.settings.stripMaxLength||void 0,min:c.settings.stripMinLength,step:c.settings.lengthStep,validator:B=>B%c.settings.lengthStep===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]),_:1},8,["show-feedback","feedback","validation-status","label"]),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":((_=c.validation.quantity)==null?void 0:_.showFeedback)||!1,feedback:((y=c.validation.quantity)==null?void 0:y.feedback)||"","validation-status":(b=c.validation.quantity)==null?void 0:b.validationStatus,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:c.value.quantity,"onUpdate:value":d[5]||(d[5]=B=>c.value.quantity=B),min:1,validator:B=>Number.isInteger(B),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":((S=c.validation.marker)==null?void 0:S.showFeedback)||!1,feedback:((x=c.validation.marker)==null?void 0:x.feedback)||"","validation-status":(C=c.validation.marker)==null?void 0:C.validationStatus,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(p,{value:c.value.marker,"onUpdate:value":d[6]||(d[6]=B=>c.value.marker=B),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createElementVNode("div",ig,[i.createVNode(i.unref(O.NButton),{loading:c.isSubmitProcessing,type:"primary",class:"self-start",onClick:d[7]||(d[7]=B=>r("submit",c.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading"]),c.settings.allowShowTable?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,type:"tertiary",class:"self-start",onClick:d[8]||(d[8]=B=>r("click:view-switch"))},{default:i.withCtx(()=>d[11]||(d[11]=[i.createTextVNode(" Показать в виде списка ")])),_:1,__:[11]})):i.createCommentVNode("",!0)])])]}),_:1})}}});var Ra=Object.defineProperty,sg=Object.defineProperties,og=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertySymbols,ag=Object.prototype.hasOwnProperty,lg=Object.prototype.propertyIsEnumerable,Bs=(e,t,n)=>t in e?Ra(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ts=(e,t)=>{for(var n in t||(t={}))ag.call(t,n)&&Bs(e,n,t[n]);if(Pa)for(var n of Pa(t))lg.call(t,n)&&Bs(e,n,t[n]);return e},Es=(e,t)=>sg(e,og(t)),Fa=(e,t)=>{for(var n in t)Ra(e,n,{get:t[n],enumerable:!0})},w=(e,t,n)=>(Bs(e,typeof t!="symbol"?t+"":t,n),n),Ma=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},St=(e,t,n)=>(Ma(e,t,"read from private field"),n?n.call(e):t.get(e)),Aa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},cg=(e,t,n,r)=>(Ma(e,t,"write to private field"),t.set(e,n),n),yt={Image:null,isHeadless:!1,shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(n){return this[n]},e.setAttribute=function(n,r){return this[n]=r,this},e},polyfill:function(e,t){return yt.shim(e),typeof t<"u"&&(yt.Image=t),yt.isHeadless=!0,e}},Oa={};Fa(Oa,{Curve:()=>vi,getAnchorsFromArcData:()=>ug,getComponentOnCubicBezier:()=>Yi,getControlPoints:()=>Ua,getCurveBoundingBox:()=>Xa,getCurveFromPoints:()=>Ya,getCurveLength:()=>ja,getReflection:()=>Rs,integrate:()=>qa,subdivide:()=>Ns});var Ia={};Fa(Ia,{HALF_PI:()=>Ze,NumArray:()=>Gt,TWO_PI:()=>ct,decomposeMatrix:()=>wi,getComputedMatrix:()=>La,getPoT:()=>Da,lerp:()=>Nt,mod:()=>Rt,setMatrix:()=>za,toFixed:()=>Re});var De;typeof window<"u"?De=window:typeof global<"u"?De=global:typeof self<"u"&&(De=self);var Va,ct=Math.PI*2,Ze=Math.PI*.5;function wi(e,t,n,r,s,o){let a;return arguments.length<=1?(a=e.a,t=e.b,n=e.c,r=e.d,s=e.e,o=e.f):a=e,{translateX:s,translateY:o,scaleX:Math.sqrt(a*a+t*t),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(t,a)/Math.PI}}function za(e){Va=e}function La(e,t){t=t&&t.identity()||new Va;let n=e;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let s=0;s<r.length;s++){const a=r[s].elements;t.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9])}return t}function Nt(e,t,n){return n*(t-e)+e}var $s=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Da(e){let t=0;for(;$s[t]&&$s[t]<e;)t++;return $s[t]}function Rt(e,t){for(;e<0;)e+=t;return e%t}var Gt=De.Float32Array||Array,dg=Math.floor;function Re(e){return dg(e*1e6)/1e6}var ee={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},X=class{constructor(){w(this,"_events",{}),w(this,"_bound",!1)}addEventListener(t,n){return(this._events[t]||(this._events[t]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(t,n){if(!this._events)return this;if(!t&&!n)return this._events={},this._bound=!1,this;const r=t?[t]:Object.keys(this._events);for(let s=0,o=r.length;s<o;s++){t=r[s];let a=this._events[t];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let h=a[c];h=h.handler?h.handler:h,n!==h&&l.push(h)}this._events[t]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(t){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[t];if(r)for(let s=0;s<r.length;s++)r[s].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(t,n,r){const s=this;t&&(o.obj=t,o.name=n,o.handler=r,t.on(n,o));function o(){r.apply(s,arguments)}return s}ignore(t,n,r){return t.off(n,r),this}};w(X,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),w(X,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var Ha={x:{enumerable:!0,get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this._bound&&this.dispatchEvent(X.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this._bound&&this.dispatchEvent(X.Types.change))}}},Ht=class extends X{constructor(e=0,t=0){super(),w(this,"_x",0),w(this,"_y",0);for(let n in Ha)Object.defineProperty(this,n,Ha[n]);this.x=e,this.y=t}static add(e,t){return new Ht(e.x+t.x,e.y+t.y)}static sub(e,t){return new Ht(e.x-t.x,e.y-t.y)}static subtract(e,t){return Ht.sub(e,t)}static ratioBetween(e,t){return(e.x*t.x+e.y*t.y)/(e.length()*t.length())}static angleBetween(e,t){if(arguments.length>=4){const s=arguments[0]-arguments[2],o=arguments[1]-arguments[3];return Math.atan2(o,s)}const n=e.x-t.x,r=e.y-t.y;return Math.atan2(r,n)}static distanceBetween(e,t){return Math.sqrt(Ht.distanceBetweenSquared(e,t))}static distanceBetweenSquared(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}set(e,t){return this.x=e,this.y=t,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 Ht(this.x,this.y)}add(e,t){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+=t),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,t){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-=t),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,t){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*=t),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,t){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/=t),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 t=this.x-e.x,n=this.y-e.y;return t*t+n*n}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,t){return t=typeof t>"u"?1e-4:t,this.distanceTo(e)<t}lerp(e,t){const n=(e.x-this.x)*t+this.x,r=(e.y-this.y)*t+this.y;return this.set(n,r)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Re(this.x),y:Re(this.y)}}rotate(e){const t=this.x,n=this.y,r=Math.cos(e),s=Math.sin(e);return this.x=t*r-n*s,this.y=t*s+n*r,this}},Z=Ht;w(Z,"zero",new Ht),w(Z,"left",new Ht(-1,0)),w(Z,"right",new Ht(1,0)),w(Z,"up",new Ht(0,-1)),w(Z,"down",new Ht(0,1));var ve=class extends Z{constructor(t=0,n=0,r=0,s=0,o=0,a=0,l=ee.move){super(t,n),w(this,"controls",{left:new Z,right:new Z}),w(this,"_command",ee.move),w(this,"_relative",!0),w(this,"_rx",0),w(this,"_ry",0),w(this,"_xAxisRotation",0),w(this,"_largeArcFlag",0),w(this,"_sweepFlag",1);for(let d in Wa)Object.defineProperty(this,d,Wa[d]);this.command=l,this.relative=!0;const c=ve.makeBroadcast(this);this.controls.left.set(r,s).addEventListener(X.Types.change,c),this.controls.right.set(o,a).addEventListener(X.Types.change,c)}static makeBroadcast(t){return n;function n(){t._bound&&t.dispatchEvent(X.Types.change)}}static fromObject(t){return new ve().copy(t)}copy(t){return this.x=t.x,this.y=t.y,typeof t.command=="string"&&(this.command=t.command),t.controls&&(t.controls.left&&this.controls.left.copy(t.controls.left),t.controls.right&&this.controls.right.copy(t.controls.right)),typeof t.relative=="boolean"&&(this.relative=t.relative),typeof t.rx=="number"&&(this.rx=t.rx),typeof t.ry=="number"&&(this.ry=t.ry),typeof t.xAxisRotation=="number"&&(this.xAxisRotation=t.xAxisRotation),typeof t.largeArcFlag=="number"&&(this.largeArcFlag=t.largeArcFlag),typeof t.sweepFlag=="number"&&(this.sweepFlag=t.sweepFlag),this}clone(){return new ve().copy(this)}toObject(){return{x:Re(this.x),y:Re(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Re(this.rx),ry:Re(this.ry),xAxisRotation:Re(this.xAxisRotation),largeArcFlag:Re(this.largeArcFlag),sweepFlag:Re(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Wa={command:{enumerable:!0,get:function(){return this._command},set:function(e){this._command!==e&&(this._command=e,this._bound&&this.dispatchEvent(X.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!==!!e&&(this._relative=!!e,this._bound&&this.dispatchEvent(X.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(e){this._rx!==e&&(this._rx=e,this._bound&&this.dispatchEvent(X.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(e){this._ry!==e&&(this._ry=e,this._bound&&this.dispatchEvent(X.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(e){this._xAxisRotation!==e&&(this._xAxisRotation=e,this._bound&&this.dispatchEvent(X.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag!==e&&(this._largeArcFlag=e,this._bound&&this.dispatchEvent(X.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag!==e&&(this._sweepFlag=e,this._bound&&this.dispatchEvent(X.Types.change))}}},hg=0,bt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.18",PublishDate:"2025-04-07T22:33:48.746Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return hg++}},vi={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],weights:[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]]};function Yi(e,t,n,r,s){const o=1-e;return o*o*o*t+3*o*o*e*n+3*o*e*e*r+e*e*e*s}function Ns(e,t,n,r,s,o,a,l,c){c=c||vi.RecursionLimit;const d=c+1;if(Math.abs(e-a)<.001&&Math.abs(t-l)<.001)return[new ve(a,l)];const h=[];for(let u=0;u<d;u++){const p=u/d,f=Yi(p,e,n,s,a),g=Yi(p,t,r,o,l);h.push(new ve(f,g))}return h}function ja(e,t,n,r,s,o,a,l,c){if(e===n&&t===r&&s===a&&o===l){const _=a-e,y=l-t;return Math.sqrt(_*_+y*y)}const d=9*(n-s)+3*(a-e),h=6*(e+s)-12*n,u=3*(n-e),p=9*(r-o)+3*(l-t),f=6*(t+o)-12*r,g=3*(r-t);function m(_){const y=(d*_+h)*_+u,b=(p*_+f)*_+g;return Math.sqrt(y*y+b*b)}return qa(m,0,1,c||vi.RecursionLimit)}function Xa(e,t,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,p,f,g,m,_,y;for(let C=0;C<2;++C){if(C==0?(u=6*e-12*n+6*s,h=-3*e+9*n-9*s+3*a,p=3*n-3*e):(u=6*t-12*r+6*o,h=-3*t+9*r-9*o+3*l,p=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;f=-p/u,0<f&&f<1&&c.push(f);continue}_=u*u-4*p*h,y=Math.sqrt(_),!(_<0)&&(g=(-u+y)/(2*h),0<g&&g<1&&c.push(g),m=(-u-y)/(2*h),0<m&&m<1&&c.push(m))}let b=c.length,S=b,x;for(;b--;)f=c[b],x=1-f,d[0][b]=x*x*x*e+3*x*x*f*n+3*x*f*f*s+f*f*f*a,d[1][b]=x*x*x*t+3*x*x*f*r+3*x*f*f*o+f*f*f*l;return d[0][S]=e,d[1][S]=t,d[0][S+1]=a,d[1][S+1]=l,d[0].length=d[1].length=S+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 qa(e,t,n,r){let s=vi.abscissas[r-2],o=vi.weights[r-2],a=.5*(n-t),l=a+t,c=0,d=r+1>>1,h=r&1?o[c++]*e(l):0;for(;c<d;){const u=a*s[c];h+=o[c++]*(e(l+u)+e(l-u))}return a*h}function Ya(e,t){const n=e.length,r=n-1;for(let s=0;s<n;s++){const o=e[s],a=t?Rt(s-1,n):Math.max(s-1,0),l=t?Rt(s+1,n):Math.min(s+1,r),c=e[a],d=o,h=e[l];Ua(c,d,h),d.command=s===0?ee.move:ee.curve}}function Ua(e,t,n){const r=Z.angleBetween(e,t),s=Z.angleBetween(n,t);let o=Z.distanceBetween(e,t),a=Z.distanceBetween(n,t),l=(r+s)/2;return o<1e-4||a<1e-4?(typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.copy(t),t.controls.right.copy(t)),t):(o*=.33,a*=.33,s<r?l+=Ze:l-=Ze,t.controls.left.x=Math.cos(l)*o,t.controls.left.y=Math.sin(l)*o,l-=Math.PI,t.controls.right.x=Math.cos(l)*a,t.controls.right.y=Math.sin(l)*a,typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.x+=t.x,t.controls.left.y+=t.y,t.controls.right.x+=t.x,t.controls.right.y+=t.y),t)}function Rs(e,t,n){return new Z(2*e.x-(t.x+e.x)-(n?e.x:0),2*e.y-(t.y+e.y)-(n?e.y:0))}function ug(e,t,n,r,s,o,a){const l=bt.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const h=d*o+s,u=n*Math.cos(h),p=r*Math.sin(h),f=new ve(u,p);f.command=ee.line}}var Ga=Array.prototype.slice;function fg(e){if(e==null)return!1;const t=e.length;return typeof t=="number"&&t>=0&&t<4294967296}var ae={isNaN:function(e){return typeof e=="number"&&e!==+e},isElement:function(e){return!!(e&&e.nodeType===1)},isObject:function(e){const t=typeof e;return t==="function"||t==="object"&&!!e},extend:function(e){const t=Ga.call(arguments,1);for(let n=0;n<t.length;n++){const r=t[n];for(let s in r)e[s]=r[s]}return e},defaults:function(e){const t=Ga.call(arguments,1);for(let n=0;n<t.length;n++){const r=t[n];for(let s in r)e[s]===void 0&&(e[s]=r[s])}return e},each:function(e,t,n){const r=n||this,s=!fg(e)&&Object.keys(e),o=(s||e).length;for(let a=0;a<o;a++){const l=s?s[a]:a;t.call(r,e[l],l,e)}return e},performance:De.performance&&De.performance.now?De.performance:Date},Pt={hasEventListeners:typeof De.addEventListener=="function",bind:function(e,t,n,r){return this.hasEventListeners?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n),Pt},unbind:function(e,t,n,r){return Pt.hasEventListeners?e.removeEventListeners(t,n,!!r):e.detachEvent("on"+t,n),Pt},getRequestAnimationFrame:function(){const e=["ms","moz","webkit","o"];let t=0,n=De.requestAnimationFrame;if(!n){for(let s=0;s<e.length;s++)n=De[e[s]+"RequestAnimationFrame"]||n;n=n||r}function r(s,o){const a=new Date().getTime(),l=Math.max(0,16-(a-t)),c=De.setTimeout(d,l);t=a+l;function d(){s(a+l)}return c}return n}},ki=De.document?De.document.createElement("div"):{};ki.id="help-two-load",Object.defineProperty(Pt,"temp",{enumerable:!0,get:function(){return ae.isElement(ki)&&!De.document.head.contains(ki)&&(ki.style.display="none",De.document.head.appendChild(ki)),ki}});var Bt=class extends Error{constructor(t){super(),w(this,"name","Two.js"),w(this,"message"),this.message=t}},pg=De.devicePixelRatio||1;function gg(e){return e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1}function Ps(e){return pg/gg(e)}var Tr=class{constructor(){w(this,"map",{})}add(t,n){return this.map[t]=n,this}remove(t){return delete this.map[t],this}get(t){return this.map[t]}contains(t){return t in this.map}},dt,Bn=class extends Array{constructor(){super(),Aa(this,dt,new X),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 St(this,dt)}set _events(t){cg(this,dt,t)}get _bound(){return St(this,dt)._bound}set _bound(t){St(this,dt)._bound=t}addEventListener(){return St(this,dt).addEventListener.apply(this,arguments)}on(){return St(this,dt).on.apply(this,arguments)}bind(){return St(this,dt).bind.apply(this,arguments)}removeEventListener(){return St(this,dt).removeEventListener.apply(this,arguments)}off(){return St(this,dt).off.apply(this,arguments)}unbind(){return St(this,dt).unbind.apply(this,arguments)}dispatchEvent(){return St(this,dt).dispatchEvent.apply(this,arguments)}trigger(){return St(this,dt).trigger.apply(this,arguments)}listen(){return St(this,dt).listen.apply(this,arguments)}ignore(){return St(this,dt).ignore.apply(this,arguments)}pop(){const t=super.pop.apply(this,arguments);return this.trigger(X.Types.remove,[t]),t}shift(){const t=super.shift.apply(this,arguments);return this.trigger(X.Types.remove,[t]),t}push(){const t=super.push.apply(this,arguments);return this.trigger(X.Types.insert,arguments),t}unshift(){const t=super.unshift.apply(this,arguments);return this.trigger(X.Types.insert,arguments),t}splice(){const t=super.splice.apply(this,arguments);if(this.trigger(X.Types.remove,t),arguments.length>2){const n=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(X.Types.insert,n),this.trigger(X.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(X.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(X.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(t,n){const r=[];for(let s=0;s<this.length;s++){const o=this[s];let a;n?a=t.call(n,o,s):a=t(o,s),r.push(a)}return r}};dt=new WeakMap;var Ka=class extends X{constructor(){super(),w(this,"_flagId",!1),w(this,"_flagClassName",!1),w(this,"_renderer",{}),w(this,"_id",bt.Identifier+bt.uniqueId()),w(this,"_className",""),w(this,"classList",[]);for(let e in Za)Object.defineProperty(this,e,Za[e])}static fromObject(e){const t=new Ka().copy(e);return"id"in e&&(t.id=e.id),t}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return this.renderer.type=e.renderer.type,this.className=e.className,this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}},Dn=Ka;w(Dn,"Properties",["renderer","id","className"]);var Za={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(e){const t=this._id;e!==this._id&&(this._id=e,this._flagId=!0,this.parent&&(delete this.parent.children.ids[t],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(e){this._className!==e&&(this._flagClassName=!0,this.classList=e.split(/\s+?/),this._className=e)}}},Er,Ja={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};De.document&&(Er=document.createElement("a"));var Je=class extends Dn{constructor(e,t){super(),w(this,"_flagSrc",!1),w(this,"_flagImage",!1),w(this,"_flagVideo",!1),w(this,"_flagLoaded",!1),w(this,"_flagRepeat",!1),w(this,"_flagOffset",!1),w(this,"_flagScale",!1),w(this,"_src",""),w(this,"_image",null),w(this,"_loaded",!1),w(this,"_repeat","no-repeat"),w(this,"_scale",1),w(this,"_offset",null);for(let n in Qa)Object.defineProperty(this,n,Qa[n]);if(this._renderer.type="texture",this._renderer.flagOffset=mg.bind(this),this._renderer.flagScale=_g.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new Z,typeof t=="function"){const n=(function(){this.unbind(X.Types.load,n),typeof t=="function"&&t()}).bind(this);this.bind(X.Types.load,n)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const n=Object.prototype.toString.call(e);(n==="[object HTMLImageElement]"||n==="[object HTMLCanvasElement]"||n==="[object HTMLVideoElement]"||n==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const t=new Je().copy(e);return"id"in e&&(t.id=e.id),t}static getAbsoluteURL(e){return Er?(Er.href=e,Er.href):e}static loadHeadlessBuffer(e,t){e.image.onload=t,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const t=Je.getAbsoluteURL(e);if(Je.ImageRegistry.contains(t))return Je.ImageRegistry.get(t);let n;return yt.Image?(n=new yt.Image,yt.shim(n,"img")):De.document?Ja.video.test(t)?n=document.createElement("video"):n=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),n.crossOrigin="anonymous",n.referrerPolicy="no-referrer",n}static load(e,t){let n=e.image,r=Je.getTag(n);e._flagImage&&(/canvas/i.test(r)?Je.Register.canvas(e,t):(e._src=!yt.isHeadless&&n.getAttribute("two-src")||n.src,Je.Register[r](e,t))),e._flagSrc&&(n||(n=Je.getImage(e.src),e.image=n),r=Je.getTag(n),Je.Register[r](e,t))}clone(){const e=new Je(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 Z?e.offset:new Z().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof Z?e.scale:new Z().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(X.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Je.load(this,(function(){this.loaded=!0,this.trigger(X.Types.change).trigger(X.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("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}},Ee=Je;w(Ee,"Properties",["src","loaded","repeat","scale","offset","image"]),w(Ee,"RegularExpressions",Ja),w(Ee,"ImageRegistry",new Tr),w(Ee,"Register",{canvas:function(e,t){e._src="#"+e.id,Je.ImageRegistry.add(e.src,e.image),typeof t=="function"&&t()},img:function(e,t){const n=e.image,r=function(o){!yt.isHeadless&&n.removeEventListener&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),typeof t=="function"&&t()},s=function(o){throw!yt.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),new Bt("unable to load "+e.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!yt.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",s,!1)),e._src=Je.getAbsoluteURL(e._src),!(!yt.isHeadless&&n&&n.getAttribute("two-src"))&&(yt.isHeadless||n.setAttribute("two-src",e.src),Je.ImageRegistry.add(e.src,n),yt.isHeadless?Je.loadHeadlessBuffer(e,r):e.image.src=e.src)},video:function(e,t){if(yt.isHeadless)throw new Bt("video textures are not implemented in headless environments.");const n=function(s){e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",r,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,typeof t=="function"&&t()},r=function(s){throw e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",r,!1),new Bt("unable to load "+e.src)};e._src=Je.getAbsoluteURL(e._src),e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),Je.ImageRegistry.add(e.src,e.image)),e.image.readyState>=4?n():(e.image.addEventListener("canplaythrough",n,!1),e.image.addEventListener("error",r,!1),e.image.src=e.src,e.image.load())}});var Qa={src:{enumerable:!0,get:function(){return this._src},set:function(e){this._src=e,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(e){this._loaded=e,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(e){this._repeat=e,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(e){const t=Ee.getTag(e);let n;switch(t){case"canvas":n="#"+e.id;break;default:n=e.src}Ee.ImageRegistry.contains(n)?this._image=Ee.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(X.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(X.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof Z&&this._scale.unbind(X.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof Z&&this._scale.bind(X.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function mg(){this._flagOffset=!0}function _g(){this._flagScale=!0}var Wt=class extends Dn{constructor(e,t,n){super(),w(this,"_flagOffset",!0),w(this,"_flagOpacity",!0),w(this,"_flagColor",!0),w(this,"_offset",0),w(this,"_opacity",1),w(this,"_color","#fff");for(let r in el)Object.defineProperty(this,r,el[r]);this._renderer.type="stop",this.offset=typeof e=="number"?e:Wt.Index<=0?0:1,this.opacity=typeof n=="number"?n:1,this.color=typeof t=="string"?t:Wt.Index<=0?"#fff":"#000",Wt.Index=(Wt.Index+1)%2}static fromObject(e){const t=new Wt().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Wt.Properties.length;t++){const n=Wt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Wt;return ae.each(Wt.Properties,function(n){t[n]=this[n]},this),e&&e.stops&&e.stops.push(t),t}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",ae.each(Wt.Properties,t=>{e[t]=this[t]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},Kt=Wt;w(Kt,"Index",0),w(Kt,"Properties",["offset","opacity","color"]);var el={offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset=e,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(e){this._color=e,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Hn=class extends Dn{constructor(e){super(),w(this,"_flagStops",!1),w(this,"_flagSpread",!1),w(this,"_flagUnits",!1),w(this,"_spread",""),w(this,"_units","");for(let t in tl)Object.defineProperty(this,t,tl[t]);this._renderer.type="gradient",this._renderer.flagStops=yg.bind(this),this._renderer.bindStops=bg.bind(this),this._renderer.unbindStops=wg.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let t=e.stops;t&&t.length>0&&(t=t.map(r=>r instanceof Kt?r:new Kt().copy(r)));const n=new Hn().copy(e);return"id"in e&&(n.id=e.id),n}clone(e){const t=this.stops.map(r=>r.clone()),n=new Hn(t);return ae.each(Hn.Properties,r=>{n[r]=this[r]},this),e&&e.add(n),n}copy(e){super.copy.call(this,e);for(let t=0;t<Hn.Properties.length;t++){const n=Hn.Properties[t];n in e&&(this[n]=e[n])}return this}toObject(){const e={stops:this.stops.map(t=>t.toObject())};return ae.each(Hn.Properties,t=>{e[t]=this[t]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(X.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}},qe=Hn;w(qe,"Stop",Kt),w(qe,"Properties",["spread","stops","units"]);var tl={spread:{enumerable:!0,get:function(){return this._spread},set:function(e){this._spread=e,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(e){this._units=e,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(e){const t=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(X.Types.insert,t).unbind(X.Types.remove,n),this._stops=new Bn((e||[]).slice(0)),this._stops.bind(X.Types.insert,t).bind(X.Types.remove,n),t(this._stops)}}};function yg(){this._flagStops=!0}function bg(e){let t=e.length;for(;t--;)e[t].bind(X.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function wg(e){let t=e.length;for(;t--;)e[t].unbind(X.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var Ui=class extends qe{constructor(e,t,n,r,s){super(s),w(this,"_flagEndPoints",!1),w(this,"_left",null),w(this,"_right",null);for(let o in nl)Object.defineProperty(this,o,nl[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=vg.bind(this),this.left=new Z,this.right=new Z,typeof e=="number"&&(this.left.x=e),typeof t=="number"&&(this.left.y=t),typeof n=="number"&&(this.right.x=n),typeof r=="number"&&(this.right.y=r)}static fromObject(e){const t=new Ui().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ui.Properties.length;t++){const n=Ui.Properties[t];n in e&&(this[n]=e[n]instanceof Z?e[n]:new Z().copy(e[n]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Ui(this.left._x,this.left._y,this.right._x,this.right._y,t);return ae.each(qe.Properties,function(r){n[r]=this[r]},this),e&&e.add(n),n}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(X.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},Oe=Ui;w(Oe,"Stop",Kt),w(Oe,"Properties",["left","right"]);var nl={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof Z&&this._left.unbind(X.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(X.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof Z&&this._right.unbind(X.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(X.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function vg(){this._flagEndPoints=!0}var Wn=class extends qe{constructor(e,t,n,r,s,o){super(r),w(this,"_flagRadius",!1),w(this,"_flagCenter",!1),w(this,"_flagFocal",!1),w(this,"_radius",0),w(this,"_center",null),w(this,"_focal",null);for(let a in il)Object.defineProperty(this,a,il[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=kg.bind(this),this._renderer.flagFocal=xg.bind(this),this.center=new Z,this.radius=typeof n=="number"?n:1,this.focal=new Z,typeof e=="number"&&(this.center.x=e),typeof t=="number"&&(this.center.y=t),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof o=="number"&&(this.focal.y=o)}static fromObject(e){const t=new Wn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Wn.Properties.length;t++){const n=Wn.Properties[t];n in e&&(/(center|focal)i/.test(n)?this[n]=e[n]instanceof Z?e[n]:new Z().copy(e[n]):typeof e[n]=="number"&&(this[n]=e[MediaKeySystemAccess]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Wn(this.center._x,this.center._y,this._radius,t,this.focal._x,this.focal._y);return ae.each(qe.Properties.concat(Wn.Properties),function(r){n[r]=this[r]},this),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return ae.each(Wn.Properties,function(t){e[t]=this[t]},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(X.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},Ie=Wn;w(Ie,"Stop",Kt),w(Ie,"Properties",["center","radius","focal"]);var il={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(e){this._center&&this._center.unbind(X.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(X.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(X.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(X.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function kg(){this._flagCenter=!0}function xg(){this._flagFocal=!0}function rl(e,t){if(t===0||t===1)return!0;const r=e._length*t;let s=0;for(let o=0;o<e._lengths.length;o++){const a=e._lengths[o];if(s>=r)return r-s>=0;s+=a}return!1}function $r(e,t){const n=e._length;if(t<=0)return 0;if(t>=n)return e._lengths.length-1;for(let r=0,s=0;r<e._lengths.length;r++){if(s+e._lengths[r]>=t)return t-=s,Math.max(r-1,0)+t/e._lengths[r];s+=e._lengths[r]}return-1}function sl(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),ja(r,l,s,c,o,d,a,h,n)}function ol(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Ns(r,l,s,c,o,d,a,h,n)}function jn(e){switch(e.renderer.type){case"texture":return Ee.fromObject(e);case"gradient":return qe.fromObject(e);case"linear-gradient":return Oe.fromObject(e);case"radial-gradient":return Ie.fromObject(e)}return e}var Cg=Math.cos,Sg=Math.sin,al=Math.tan,Fs=[],Ft=class extends X{constructor(e,t,n,r,s,o){super(),w(this,"elements",new Gt(9)),w(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,t,n){if(t.length<=3){const C=e;let B,v,N;const F=t[0]||0,P=t[1]||0,q=t[2]||0;return B=C[0]*F+C[1]*P+C[2]*q,v=C[3]*F+C[4]*P+C[5]*q,N=C[6]*F+C[7]*P+C[8]*q,[B,v,N]}const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],c=e[5],d=e[6],h=e[7],u=e[8],p=t[0],f=t[1],g=t[2],m=t[3],_=t[4],y=t[5],b=t[6],S=t[7],x=t[8];return n=n||new Gt(9),n[0]=r*p+s*m+o*b,n[1]=r*f+s*_+o*S,n[2]=r*g+s*y+o*x,n[3]=a*p+l*m+c*b,n[4]=a*f+l*_+c*S,n[5]=a*g+l*y+c*x,n[6]=d*p+h*m+u*b,n[7]=d*f+h*_+u*S,n[8]=d*g+h*y+u*x,n}static fromObject(e){return new Ft().copy(e)}set(e,t,n,r,s,o,a,l,c){if(typeof t>"u"){const d=e;e=d[0],t=d[1],n=d[2],r=d[3],s=d[4],o=d[5],a=d[6],l=d[7],c=d[8]}return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=s,this.elements[5]=o,this.elements[6]=a,this.elements[7]=l,this.elements[8]=c,this.trigger(X.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(X.Types.change)}identity(){return this.elements[0]=Ft.Identity[0],this.elements[1]=Ft.Identity[1],this.elements[2]=Ft.Identity[2],this.elements[3]=Ft.Identity[3],this.elements[4]=Ft.Identity[4],this.elements[5]=Ft.Identity[5],this.elements[6]=Ft.Identity[6],this.elements[7]=Ft.Identity[7],this.elements[8]=Ft.Identity[8],this.trigger(X.Types.change)}multiply(e,t,n,r,s,o,a,l,c){if(typeof t>"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(X.Types.change);if(typeof n>"u"&&(n=1),typeof r>"u"){e=e||0,t=t||0,n=n||0,s=this.elements;const M=s[0]*e+s[1]*t+s[2]*n,E=s[3]*e+s[4]*t+s[5]*n,A=s[6]*e+s[7]*t+s[8]*n;return[M,E,A]}const d=this.elements,h=[e,t,n,r,s,o,a,l,c],u=d[0],p=d[1],f=d[2],g=d[3],m=d[4],_=d[5],y=d[6],b=d[7],S=d[8],x=h[0],C=h[1],B=h[2],v=h[3],N=h[4],F=h[5],P=h[6],q=h[7],U=h[8];return this.elements[0]=u*x+p*v+f*P,this.elements[1]=u*C+p*N+f*q,this.elements[2]=u*B+p*F+f*U,this.elements[3]=g*x+m*v+_*P,this.elements[4]=g*C+m*N+_*q,this.elements[5]=g*B+m*F+_*U,this.elements[6]=y*x+b*v+S*P,this.elements[7]=y*C+b*N+S*q,this.elements[8]=y*B+b*F+S*U,this.trigger(X.Types.change)}inverse(e){const t=this.elements;e=e||new Ft;const n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],h=t[8],u=h*a-l*d,p=-h*o+l*c,f=d*o-a*c;let g=n*u+r*p+s*f;return g?(g=1/g,e.elements[0]=u*g,e.elements[1]=(-h*r+s*d)*g,e.elements[2]=(l*r-s*a)*g,e.elements[3]=p*g,e.elements[4]=(h*n-s*c)*g,e.elements[5]=(-l*n+s*o)*g,e.elements[6]=f*g,e.elements[7]=(-d*n+r*c)*g,e.elements[8]=(a*n-r*o)*g,e):null}scale(e,t){return arguments.length<=1&&(t=e),this.multiply(e,0,0,0,t,0,0,0,1)}rotate(e){const t=Cg(e),n=Sg(e);return this.multiply(t,-n,0,n,t,0,0,0,1)}translate(e,t){return this.multiply(1,0,e,0,1,t,0,0,1)}skewX(e){const t=al(e);return this.multiply(1,t,0,0,1,0,0,0,1)}skewY(e){const t=al(e);return this.multiply(1,0,0,t,1,0,0,0,1)}toString(e){return Fs.length=0,this.toTransformArray(e,Fs),Fs.map(Re).join(" ")}toTransformArray(e,t){const n=this.elements,r=!!t,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],d=n[5];if(e){const h=n[6],u=n[7],p=n[8];if(r){t[0]=s,t[1]=l,t[2]=h,t[3]=o,t[4]=c,t[5]=u,t[6]=a,t[7]=d,t[8]=p;return}return[s,l,h,o,c,u,a,d,p]}if(r){t[0]=s,t[1]=l,t[2]=o,t[3]=c,t[4]=a,t[5]=d;return}return[s,l,o,c,a,d]}toArray(e,t){const n=this.elements,r=!!t,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],d=n[5];if(e){const h=n[6],u=n[7],p=n[8];if(r){t[0]=s,t[1]=o,t[2]=a,t[3]=l,t[4]=c,t[5]=d,t[6]=h,t[7]=u,t[8]=p;return}return[s,o,a,l,c,d,h,u,p]}if(r){t[0]=s,t[1]=o,t[2]=a,t[3]=l,t[4]=c,t[5]=d;return}return[s,o,a,l,c,d]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ft().copy(this)}},Xn=Ft;w(Xn,"Identity",[1,0,0,0,1,0,0,0,1]),za(Xn);var Ms=class extends Dn{constructor(){super(),w(this,"_flagMatrix",!0),w(this,"_flagScale",!1),w(this,"_matrix",null),w(this,"_worldMatrix",null),w(this,"_position",null),w(this,"_rotation",0),w(this,"_scale",1),w(this,"_skewX",0),w(this,"_skewY",0);for(let e in Nr)Object.defineProperty(this,e,Nr[e]);this._renderer.flagMatrix=ll.bind(this),this.isShape=!0,this.matrix=new Xn,this.worldMatrix=new Xn,this.position=new Z,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const t=new Ms().copy(e);return"id"in e&&(t.id=e.id),t}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return Nr.position.get.apply(this,arguments)}set translation(e){Nr.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof Z?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 Z?e.scale:new Z(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 t=new Ms;return t.position.copy(this.position),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._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 Z?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}_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 Z?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}},hn=Ms;w(hn,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Nr={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(X.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(X.Types.change,this._renderer.flagMatrix),ll.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(e){this._rotation=e,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof Z&&this._scale.unbind(X.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof Z&&this._scale.bind(X.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(e){this._skewX=e,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(e){this._skewY=e,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(e){this._matrix=e,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return La(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function ll(){this._flagMatrix=!0}var xi=Math.min,Ci=Math.max,Bg=Math.ceil,Tg=Math.floor,Eg=new Z,Tn=class extends hn{constructor(e,t,n,r){super(),w(this,"_flagVertices",!0),w(this,"_flagLength",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagCap",!0),w(this,"_flagJoin",!0),w(this,"_flagMiter",!0),w(this,"_flagMask",!1),w(this,"_flagClip",!1),w(this,"_length",0),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_cap","round"),w(this,"_join","round"),w(this,"_miter",4),w(this,"_closed",!0),w(this,"_curved",!1),w(this,"_automatic",!0),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_mask",null),w(this,"_clip",!1),w(this,"_dashes",null);for(let s in cl)Object.defineProperty(this,s,cl[s]);this._renderer.type="path",this._renderer.flagVertices=dl.bind(this),this._renderer.bindVertices=hl.bind(this),this._renderer.unbindVertices=ul.bind(this),this._renderer.flagFill=fl.bind(this),this._renderer.flagStroke=pl.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!t,this.curved=!!n,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=!r,this.dashes=[],this.dashes.offset=0}static fromObject(e){const t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new Tn().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e),this.vertices=[];for(let t=0;t<e.vertices.length;t++){const n=e.vertices[t];n instanceof ve?this.vertices.push(e.vertices[t].clone()):this.vertices.push(new ve().copy(n))}for(let t=0;t<Tn.Properties.length;t++){const n=Tn.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Tn;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<Tn.Properties.length;n++){const r=Tn.Properties[n];t[r]=this[r]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(t=>t.toObject()),ae.each(Tn.Properties,t=>{typeof this[t]<"u"&&(this[t].toObject?e[t]=this[t].toObject():e[t]=this[t])},this),e}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),t=e.width/2,n=e.height/2,r=e.left+e.width/2,s=e.top+e.height/2;for(let o=0;o<this.vertices.length;o++){const a=this.vertices[o];a.x-=r,a.y-=s,a.x+=t,a.y+=n}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.x+=t,this.mask.translation.y-=s,this.mask.translation.y+=n),this}center(){const e=this.getBoundingClientRect(!0),t=e.left+e.width/2-this.translation.x,n=e.top+e.height/2-this.translation.y;for(let r=0;r<this.vertices.length;r++){const s=this.vertices[r];s.x-=t,s.y-=n}return this.mask&&(this.mask.translation.x-=t,this.mask.translation.y-=n),this}getBoundingClientRect(e){let t,n,r,s,o,a,l=1/0,c=-1/0,d=1/0,h=-1/0;if(this._update(!0),t=e?this.matrix:this.worldMatrix,n=(this.linewidth||0)/2,r=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:u,scaleY:p}=wi(t.elements[0],t.elements[3],t.elements[1],t.elements[4],t.elements[2],t.elements[5]);typeof u=="number"&&typeof p=="number"&&(n=Math.max(u,p)*(this.linewidth||0)/2)}else n*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(r<=0)return{width:0,height:0};for(s=0;s<r;s++){a=this._renderer.vertices[s],o=this._renderer.vertices[(s+r-1)%r];const[u,p]=t.multiply(o.x,o.y),[f,g]=t.multiply(a.x,a.y);if(o.controls&&a.controls){let m=o.controls.right.x,_=o.controls.right.y;o.relative&&(m+=o.x,_+=o.y);let[y,b]=t.multiply(m,_),S=a.controls.left.x,x=a.controls.left.y;a.relative&&(S+=a.x,x+=a.y);let[C,B]=t.multiply(S,x);const v=Xa(u,p,y,b,C,B,f,g);d=xi(v.min.y-n,d),l=xi(v.min.x-n,l),c=Ci(v.max.x+n,c),h=Ci(v.max.y+n,h)}else s<=1&&(d=xi(p-n,d),l=xi(u-n,l),c=Ci(u+n,c),h=Ci(p+n,h)),d=xi(g-n,d),l=xi(f-n,l),c=Ci(f+n,c),h=Ci(g+n,h)}return{top:d,left:l,right:c,bottom:h,width:c-l,height:h-d}}getPointAt(e,t){let n,r,s,o,a,l,c,d,h,u,p,f,g,m,_,y=this.length*Math.min(Math.max(e,0),1);const b=this.vertices.length,S=b-1;let x=null,C=null;for(let K=0,R=this._lengths.length,$=0;K<R;K++){if($+this._lengths[K]>=y){this._closed?(n=Rt(K,b),r=Rt(K-1,b),K===0&&(n=r,r=K)):(n=K,r=Math.min(Math.max(K-1,0),S)),x=this.vertices[n],C=this.vertices[r],y-=$,this._lengths[K]!==0?e=y/this._lengths[K]:e=0;break}$+=this._lengths[K]}if(x===null||C===null)return null;if(x){if(!C)return x}else return C;_=C.controls&&C.controls.right,m=x.controls&&x.controls.left,a=C.x,u=C.y,l=(_||C).x,p=(_||C).y,c=(m||x).x,f=(m||x).y,d=x.x,g=x.y,_&&C.relative&&(l+=C.x,p+=C.y),m&&x.relative&&(c+=x.x,f+=x.y),o=Yi(e,a,l,c,d),h=Yi(e,u,p,f,g);const B=Nt(a,l,e),v=Nt(u,p,e),N=Nt(l,c,e),F=Nt(p,f,e),P=Nt(c,d,e),q=Nt(f,g,e),U=Nt(B,N,e),M=Nt(v,F,e),E=Nt(N,P,e),A=Nt(F,q,e);return ae.isObject(t)?(t.x=o,t.y=h,t instanceof ve&&(t.controls.left.x=U,t.controls.left.y=M,t.controls.right.x=E,t.controls.right.y=A,(typeof t.relative!="boolean"||t.relative)&&(t.controls.left.x-=o,t.controls.left.y-=h,t.controls.right.x-=o,t.controls.right.y-=h)),t.t=e,t):(s=new ve(o,h,U-o,M-h,E-o,A-h,this._curved?ee.curve:ee.line),s.t=e,s)}plot(){if(this.curved)return Ya(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ee.move:ee.line;return this}subdivide(e){this._update();const t=this.vertices.length-1,n=this._closed||this.vertices[t]._command===ee.close;let r=this.vertices[t],s=[],o;return ae.each(this.vertices,function(a,l){if(l<=0&&!n){r=a;return}if(a.command===ee.move){s.push(new ve(r.x,r.y)),l>0&&(s[s.length-1].command=ee.line),r=a;return}o=ol(a,r,e),s=s.concat(o),ae.each(o,function(c,d){d<=0&&r.command===ee.move?c.command=ee.move:c.command=ee.line}),l>=t&&(this._closed&&this._automatic&&(r=a,o=ol(a,r,e),s=s.concat(o),ae.each(o,function(c,d){d<=0&&r.command===ee.move?c.command=ee.move:c.command=ee.line})),s.push(new ve(a.x,a.y)),s[s.length-1].command=n?ee.close:ee.line),r=a},this),this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(e,t){t||this._update();const r=this.vertices.length-1;let s=this.vertices[r],o=0;return typeof this._lengths>"u"&&(this._lengths=[]),ae.each(this.vertices,function(a,l){if(l<=0||a.command===ee.move){s=a,this._lengths[l]=0;return}this._lengths[l]=sl(a,s,e),o+=this._lengths[l],s=a},this),this._length=o,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,t=this._closed,n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),s=$r(this,n*this._length),o=$r(this,r*this._length),a=Bg(s),l=Tg(o);let c,d,h,u,p,f;for(this._renderer.vertices.length=0,f=0;f<e;f++)this._renderer.collection.length<=f&&this._renderer.collection.push(new ve),f>l&&!d?(p=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(r,p),p.command=this._renderer.collection[f].command,this._renderer.vertices.push(p),d=p,h=this._collection[f-1],h&&h.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),h.relative?this._renderer.collection[f-1].controls.right.copy(h.controls.right).lerp(Z.zero,1-p.t):this._renderer.collection[f-1].controls.right.copy(h.controls.right).lerp(h,1-p.t))):f>=a&&f<=l&&(p=this._renderer.collection[f].copy(this._collection[f]),this._renderer.vertices.push(p),f===l&&rl(this,r)?(d=p,!t&&d.controls&&(d.relative?d.controls.right.clear():d.controls.right.copy(d))):f===a&&rl(this,n)&&(c=p,c.command=ee.move,!t&&c.controls&&(c.relative?c.controls.left.clear():c.controls.left.copy(c))));a>0&&!c&&(f=a-1,p=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(n,p),p.command=ee.move,this._renderer.vertices.unshift(p),u=this._collection[f+1],u&&u.controls&&(p.controls.left.clear(),u.relative?this._renderer.collection[f+1].controls.left.copy(u.controls.left).lerp(Z.zero,p.t):(Eg.copy(u),this._renderer.collection[f+1].controls.left.copy(u.controls.left).lerp(u,p.t))))}return hn.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=!1,hn.prototype.flagReset.call(this),this}},Ce=Tn;w(Ce,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),w(Ce,"Utils",{getCurveLength:sl});var cl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.bind(X.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(e){this._closed=!!e,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e===this._automatic)return;this._automatic=!!e;const t=this._automatic?"ignore":"listen";ae.each(this.vertices,function(n){n[t]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){const t=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(X.Types.insert,t).unbind(X.Types.remove,n),e instanceof Bn?this._collection=e:this._collection=new Bn(e||[]),this._collection.bind(X.Types.insert,t).bind(X.Types.remove,n),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function dl(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function hl(e){let t=e.length;for(;t--;)e[t].bind(X.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ul(e){let t=e.length;for(;t--;)e[t].unbind(X.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function fl(){this._flagFill=!0}function pl(){this._flagStroke=!0}var Gi=class extends Ce{constructor(e,t,n,r){const s=[new ve,new ve,new ve,new ve];super(s,!0,!1,!0),w(this,"_flagWidth",0),w(this,"_flagHeight",0),w(this,"_width",0),w(this,"_height",0),w(this,"_origin",null),this._renderer.type="rectangle";for(let o in gl)Object.defineProperty(this,o,gl[o]);this.width=typeof n=="number"?n:1,this.height=typeof r=="number"?r:1,this.origin=new Z,typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t),this._update()}static fromObject(e){const t=new Gi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Gi.Properties.length;t++){const n=Gi.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,t=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new ve),this.vertices[0].set(-e,-t).sub(this._origin).command=ee.move,this.vertices[1].set(e,-t).sub(this._origin).command=ee.line,this.vertices[2].set(e,t).sub(this._origin).command=ee.line,this.vertices[3].set(-e,t).sub(this._origin).command=ee.line,this.vertices[4]&&(this.vertices[4].set(-e,-t).sub(this._origin).command=ee.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=new Gi(0,0,this.width,this.height);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Ce.Properties.length;n++){const r=Ce.Properties[n];t[r]=this[r]}return e&&e.add(t),t}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}},En=Gi;w(En,"Properties",["width","height"]);var gl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(X.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(X.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Ki=class extends En{constructor(e,t,n,r,s,o){super(t,n,0,0),w(this,"_flagTexture",!1),w(this,"_flagColumns",!1),w(this,"_flagRows",!1),w(this,"_flagFrameRate",!1),w(this,"_flagIndex",!1),w(this,"_amount",1),w(this,"_duration",0),w(this,"_startTime",0),w(this,"_playing",!1),w(this,"_firstFrame",0),w(this,"_lastFrame",0),w(this,"_loop",!0),w(this,"_texture",null),w(this,"_columns",1),w(this,"_rows",1),w(this,"_frameRate",0),w(this,"_index",0),w(this,"_origin",null);for(let a in ml)Object.defineProperty(this,a,ml[a]);this.noStroke(),this.noFill(),e instanceof Ee?this.texture=e:typeof e=="string"&&(this.texture=new Ee(e)),this.origin=new Z,this._update(),typeof r=="number"&&(this.columns=r),typeof s=="number"&&(this.rows=s),typeof o=="number"&&(this.frameRate=o),this.index=0}static fromObject(e){const t=new Ki().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ki.Properties.length;t++){const n=Ki.Properties[t];n in e&&(this[n]=e[n])}return this}play(e,t,n){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=ae.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof t=="number"&&(this._lastFrame=t),typeof n=="function"?this._onLastFrame=n: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 t=new Ki(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&t.play(this._firstFrame,this._lastFrame),t.loop=this.loop,t.firstFrame=this.firstFrame,t.lastFrame=this.lastFrame,e&&e.add(t),t}toObject(){const e=super.toObject.call(this);return 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}_update(){const e=this._texture,t=this._columns,n=this._rows;let r,s,o,a,l,c,d,h,u;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)){d=e.image.width,h=e.image.height,r=d/t,s=h/n,a=this._amount,this.width!==r&&(this.width=r),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(ae.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=ae.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),c=Nt(this._firstFrame,u,o/l),c=Math.floor(c),c!==this._index&&(this._index=c,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%t,f=Math.floor(this._index/t),g=-r*p+(d-r)/2,m=-s*f+(h-s)/2;g!==e.offset.x&&(e.offset.x=g),m!==e.offset.y&&(e.offset.y=m)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},Rr=Ki;w(Rr,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var ml={texture:{enumerable:!0,get:function(){return this._texture},set:function(e){this._texture=e,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(e){this._columns=e,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(e){this._rows=e,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}},As,_l=class extends Bn{constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments),super(t),Aa(this,As,{}),this.attach(t),this.on(X.Types.insert,this.attach),this.on(X.Types.remove,this.detach)}get ids(){return St(this,As)}attach(t){for(let n=0;n<t.length;n++){const r=t[n];r&&r.id&&(this.ids[r.id]=r)}return this}detach(t){for(let n=0;n<t.length;n++)delete this.ids[t[n].id];return this}};As=new WeakMap;var qn=class extends Ce{constructor(e,t,n,r,s,o,a){const l=a||bt.Resolution*3,c=[];for(let d=0;d<l;d++)c.push(new ve);super(c,!0,!1,!0),w(this,"_flagStartAngle",!1),w(this,"_flagEndAngle",!1),w(this,"_flagInnerRadius",!1),w(this,"_flagOuterRadius",!1),w(this,"_startAngle",0),w(this,"_endAngle",ct),w(this,"_innerRadius",0),w(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let d in yl)Object.defineProperty(this,d,yl[d]);typeof n=="number"&&(this.innerRadius=n),typeof r=="number"&&(this.outerRadius=r),typeof s=="number"&&(this.startAngle=s),typeof o=="number"&&(this.endAngle=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new qn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<qn.Properties.length;t++){const n=qn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,t=this._endAngle,n=this._innerRadius,r=this._outerRadius,s=Rt(e,ct)===Rt(t,ct),o=n>0,a=this.vertices;let l=o?a.length/2:a.length,c,d=0,h,u,p,f,g,m,_,y,b;for(s?l--:o||(l-=2),h=0,u=l-1;h<l;h++){switch(p=h/u,f=a[d],g=p*(t-e)+e,m=(t-e)/l,_=r*Math.cos(g),y=r*Math.sin(g),h){case 0:c=ee.move;break;default:c=ee.curve}f.command=c,f.x=_,f.y=y,f.controls.left.clear(),f.controls.right.clear(),f.command===ee.curve&&(b=r*m/Math.PI,f.controls.left.x=b*Math.cos(g-Ze),f.controls.left.y=b*Math.sin(g-Ze),f.controls.right.x=b*Math.cos(g+Ze),f.controls.right.y=b*Math.sin(g+Ze),h===1&&f.controls.left.multiplyScalar(2),h===u&&f.controls.right.multiplyScalar(2)),d++}if(o){for(s?(a[d].command=ee.close,d++):(l--,u=l-1),h=0;h<l;h++)p=h/u,f=a[d],g=(1-p)*(t-e)+e,m=(t-e)/l,_=n*Math.cos(g),y=n*Math.sin(g),c=ee.curve,h<=0&&(c=s?ee.move:ee.line),f.command=c,f.x=_,f.y=y,f.controls.left.clear(),f.controls.right.clear(),f.command===ee.curve&&(b=n*m/Math.PI,f.controls.left.x=b*Math.cos(g+Ze),f.controls.left.y=b*Math.sin(g+Ze),f.controls.right.x=b*Math.cos(g-Ze),f.controls.right.y=b*Math.sin(g-Ze),h===1&&f.controls.left.multiplyScalar(2),h===u&&f.controls.right.multiplyScalar(2)),d++;a[d].copy(a[0]),a[d].command=ee.line}else s||(a[d].command=ee.line,a[d].x=0,a[d].y=0,d++,a[d].copy(a[0]),a[d].command=ee.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 t=this.innerRadius,n=this.outerRadius,r=this.startAngle,s=this.endAngle,o=this.vertices.length,a=new qn(0,0,t,n,r,s,o);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 l=0;l<Ce.Properties.length;l++){const c=Ce.Properties[l];a[c]=this[c]}return e&&e.add(a),a}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let t=0;t<qn.Properties.length;t++){const n=qn.Properties[t];e[n]=this[n]}return e}},Pr=qn;w(Pr,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var yl={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(e){this._startAngle=e,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(e){this._endAngle=e,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(e){this._innerRadius=e,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(e){this._outerRadius=e,this._flagOuterRadius=!0}}},Os=Math.cos,Is=Math.sin,Yn=class extends Ce{constructor(e,t,n,r){const s=r?Math.max(r,2):4,o=[];for(let a=0;a<s;a++)o.push(new ve(0,0,0,0,0,0));super(o,!0,!0,!0),w(this,"_flagRadius",!1),w(this,"_radius",0),this._renderer.type="circle";for(let a in bl)Object.defineProperty(this,a,bl[a]);typeof n=="number"&&(this.radius=n),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Yn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Yn.Properties.length;t++){const n=Yn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const t=4/3*Math.tan(Math.PI/(e*2)),n=this._radius,r=n*t;for(let s=0;s<this.vertices.length;s++){const a=s/e*ct,l=n*Os(a),c=n*Is(a),d=r*Os(a-Ze),h=r*Is(a-Ze),u=r*Os(a+Ze),p=r*Is(a+Ze),f=this.vertices[s];f.command=s===0?ee.move:ee.curve,f.set(l,c),f.controls.left.set(d,h),f.controls.right.set(u,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const t=new Yn(0,0,this.radius,this.vertices.length);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Ce.Properties.length;n++){const r=Ce.Properties[n];t[r]=this[r]}return e&&e.add(t),t}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let t=0;t<Yn.Properties.length;t++){const n=Yn.Properties[t];e[n]=this[n]}return e}},Zi=Yn;w(Zi,"Properties",["radius"]);var bl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}}},Vs=Math.cos,zs=Math.sin,Un=class extends Ce{constructor(e,t,n,r,s){typeof r!="number"&&typeof n=="number"&&(r=n);const o=s?Math.max(s,2):4,a=[];for(let l=0;l<o;l++)a.push(new ve);super(a,!0,!0,!0),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_width",0),w(this,"_height",0),this._renderer.type="ellipse";for(let l in wl)Object.defineProperty(this,l,wl[l]);typeof n=="number"&&(this.width=n*2),typeof r=="number"&&(this.height=r*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Un().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Un.Properties.length;t++){const n=Un.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const t=4/3*Math.tan(Math.PI/(this.vertices.length*2)),n=this._width/2,r=this._height/2;for(let s=0;s<this.vertices.length;s++){const a=s/e*ct,l=n*Vs(a),c=r*zs(a),d=n*t*Vs(a-Ze),h=r*t*zs(a-Ze),u=n*t*Vs(a+Ze),p=r*t*zs(a+Ze),f=this.vertices[s];f.command=s===0?ee.move:ee.curve,f.set(l,c),f.controls.left.set(d,h),f.controls.right.set(u,p)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=this.width/2,n=this.height/2,r=this.vertices.length,s=new Un(0,0,t,n,r);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 o=0;o<Ce.Properties.length;o++){const a=Ce.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let t=0;t<Un.Properties.length;t++){const n=Un.Properties[t];e[n]=this[n]}return e}},Ji=Un;w(Ji,"Properties",["width","height"]);var wl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}}},$g=Math.ceil,Ng=Math.floor,$n=class extends hn{constructor(e){super(),w(this,"_flagVertices",!0),w(this,"_flagLength",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagSize",!0),w(this,"_flagSizeAttenuation",!0),w(this,"_length",0),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_size",1),w(this,"_sizeAttenuation",!1),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_dashes",null),w(this,"noFill",Ce.prototype.noFill),w(this,"noStroke",Ce.prototype.noStroke),w(this,"corner",Ce.prototype.corner),w(this,"center",Ce.prototype.center),w(this,"getBoundingClientRect",Ce.prototype.getBoundingClientRect),w(this,"_updateLength",Ce.prototype._updateLength);for(let t in vl)Object.defineProperty(this,t,vl[t]);this._renderer.type="points",this._renderer.flagVertices=dl.bind(this),this._renderer.bindVertices=hl.bind(this),this._renderer.unbindVertices=ul.bind(this),this._renderer.flagFill=fl.bind(this),this._renderer.flagStroke=pl.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 t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new $n().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e);for(let t=0;t<e.vertices.length;t++){const n=e.vertices[t];n instanceof ve?this.vertices.push(e.vertices[t].clone()):this.vertices.push(new ve().copy(n))}for(let t=0;t<$n.Properties.length;t++){const n=$n.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new $n;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<$n.Properties.length;n++){const r=$n.Properties[n];t[r]=this[r]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(t=>t.toObject()),ae.each($n.Properties,function(t){typeof this[t]<"u"&&(this[t].toObject?e[t]=this[t].toObject():e[t]=this[t])},this),e}subdivide(e){this._update();let t=[];for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n],s=this.vertices[n-1];if(!s)continue;const o=r.x,a=r.y,l=s.x,c=s.y,d=Ns(o,a,o,a,l,c,l,c,e);t=t.concat(d)}return this.vertices=t,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),t=Math.max(this._beginning,this._ending),n=$r(this,e*this._length),r=$r(this,t*this._length),s=$g(n),o=Ng(r);let a=0,l;this._renderer.vertices=[],this._renderer.collection=[];for(let c=0;c<this._collection.length;c++)c>=s&&c<=o&&(l=this._collection[c],this._renderer.collection.push(l),this._renderer.vertices[a*2+0]=l.x,this._renderer.vertices[a*2+1]=l.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}},Fr=$n;w(Fr,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);var vl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.bind(X.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(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){const t=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(X.Types.insert,t).unbind(X.Types.remove,n),e instanceof Bn?this._collection=e:this._collection=new Bn(e||[]),this._collection.bind(X.Types.insert,t).bind(X.Types.remove,n),t(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}},Rg=Math.cos,Pg=Math.sin,Gn=class extends Ce{constructor(e,t,n,r){r=Math.max(r||0,3),super(),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_flagSides",!1),w(this,"_radius",0),w(this,"_width",0),w(this,"_height",0),w(this,"_sides",0),this._renderer.type="polygon";for(let s in kl)Object.defineProperty(this,s,kl[s]);this.closed=!0,this.automatic=!1,typeof n=="number"&&(this.radius=n),typeof r=="number"&&(this.sides=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Gn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Gn.Properties.length;t++){const n=Gn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,t=e+1;let n=this.vertices.length;n>e&&(this.vertices.splice(e-1,n-e),n=e);for(let r=0;r<t;r++){const s=(r+.5)/e,o=ct*s+Math.PI/2,a=this._width*Rg(o)/2,l=this._height*Pg(o)/2;r>=n?this.vertices.push(new ve(a,l)):this.vertices[r].set(a,l),this.vertices[r].command=r===0?ee.move:ee.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const t=new Gn(0,0,0,this.sides);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,t.width=this.width,t.height=this.height,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Ce.Properties.length;n++){const r=Ce.Properties[n];t[r]=this[r]}return e&&e.add(t),t}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let t=0;t<Gn.Properties.length;t++){const n=Gn.Properties[t];e[n]=this[n]}return e}},Mr=Gn;w(Mr,"Properties",["width","height","sides"]);var kl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this.width=e*2,this.height=e*2}},width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(e){this._sides=e,this._flagSides=!0}}},Kn=class extends Ce{constructor(e,t,n,r,s){typeof s>"u"&&typeof n=="number"&&typeof r=="number"&&(s=Math.floor(Math.min(n,r)/12));const o=[];for(let a=0;a<10;a++)o.push(new ve(0,0,0,0,0,0,a===0?ee.move:ee.curve));super(o),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_flagRadius",!1),w(this,"_width",0),w(this,"_height",0),w(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let a in xl)Object.defineProperty(this,a,xl[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Fg.bind(this),typeof n=="number"&&(this.width=n),typeof r=="number"&&(this.height=r),typeof s=="number"&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Kn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Kn.Properties.length;t++){const n=Kn.Properties[t];if(n in e){const r=e[n];/radius/i.test(n)?this[n]=typeof r=="number"||r instanceof Z?r:new Z().copy(r):typeof r=="number"&&(this[n]=r)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,t=this._height;let n,r;this._radius instanceof Z?(n=this._radius.x,r=this._radius.y):(n=this._radius,r=this._radius);let s,o=e/2,a=t/2;s=this.vertices[0],s.x=-(o-n),s.y=-a,s=this.vertices[1],s.x=o-n,s.y=-a,s.controls.left.clear(),s.controls.right.x=n,s.controls.right.y=0,s=this.vertices[2],s.x=o,s.y=-(a-r),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=o,s.y=a-r,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=r,s=this.vertices[4],s.x=o-n,s.y=a,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(o-n),s.y=a,s.controls.left.clear(),s.controls.right.x=-n,s.controls.right.y=0,s=this.vertices[6],s.x=-o,s.y=a-r,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-o,s.y=-(a-r),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-r,s=this.vertices[8],s.x=-(o-n),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 t=this.width,n=this.height,r=this.radius,s=new Kn(0,0,t,n,r);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 o=0;o<Ce.Properties.length;o++){const a=Ce.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let t=0;t<Kn.Properties.length;t++){const n=Kn.Properties[t];e[n]=this[n]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}},Qi=Kn;w(Qi,"Properties",["width","height","radius"]);var xl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius instanceof Z&&this._radius.unbind(X.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof Z&&this._radius.bind(X.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Fg(){this._flagRadius=!0}var Mg=Math.cos,Ag=Math.sin,Zn=class extends Ce{constructor(e,t,n,r,s){arguments.length<=3&&(r=n,n=r/2),(typeof s!="number"||s<=0)&&(s=5),super(),w(this,"_flagInnerRadius",!1),w(this,"_flagOuterRadius",!1),w(this,"_flagSides",!1),w(this,"_innerRadius",0),w(this,"_outerRadius",0),w(this,"_sides",0),this._renderer.type="star";for(let o in Cl)Object.defineProperty(this,o,Cl[o]);this.closed=!0,this.automatic=!1,typeof n=="number"&&(this.innerRadius=n),typeof r=="number"&&(this.outerRadius=r),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Zn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Zn.Properties.length;t++){const n=Zn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,t=e+1;let n=this.vertices.length;n>e&&(this.vertices.splice(e-1,n-e),n=e);for(let r=0;r<t;r++){const s=(r+.5)/e,o=ct*s,a=(r%2?this._outerRadius:this._innerRadius)/2,l=a*Mg(o),c=a*Ag(o);r>=n?this.vertices.push(new ve(l,c)):this.vertices[r].set(l,c),this.vertices[r].command=r===0?ee.move:ee.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const t=this.innerRadius,n=this.outerRadius,r=this.sides,s=new Zn(0,0,t,n,r);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 o=0;o<Ce.Properties.length;o++){const a=Ce.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let t=0;t<Zn.Properties.length;t++){const n=Zn.Properties[t];e[n]=this[n]}return e}},Ar=Zn;w(Ar,"Properties",["innerRadius","outerRadius","sides"]);var Cl={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(e){this._innerRadius=e,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(e){this._outerRadius=e,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(e){this._sides=e,this._flagSides=!0}}},Ls,Sl=Math.min,Bl=Math.max;De.document&&(Ls=document.createElement("canvas"));var Mt=class extends hn{constructor(e,t,n,r){super(),w(this,"_flagValue",!0),w(this,"_flagFamily",!0),w(this,"_flagSize",!0),w(this,"_flagLeading",!0),w(this,"_flagAlignment",!0),w(this,"_flagBaseline",!0),w(this,"_flagStyle",!0),w(this,"_flagWeight",!0),w(this,"_flagDecoration",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagMask",!1),w(this,"_flagClip",!1),w(this,"_flagDirection",!0),w(this,"_value",""),w(this,"_family","sans-serif"),w(this,"_size",13),w(this,"_leading",17),w(this,"_alignment","center"),w(this,"_baseline","middle"),w(this,"_style","normal"),w(this,"_weight",500),w(this,"_decoration","none"),w(this,"_direction","ltr"),w(this,"_fill","#000"),w(this,"_stroke","none"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_mask",null),w(this,"_clip",!1),w(this,"_dashes",null);for(let s in Tl)Object.defineProperty(this,s,Tl[s]);if(this._renderer.type="text",this._renderer.flagFill=Og.bind(this),this._renderer.flagStroke=Ig.bind(this),this.value=e,typeof t=="number"&&(this.translation.x=t),typeof n=="number"&&(this.translation.y=n),this.dashes=[],this.dashes.offset=0,!ae.isObject(r))return this;for(let s=0;s<Mt.Properties.length;s++){const o=Mt.Properties[s];o in r&&(this[o]=r[o])}}static Measure(e){if(Ls){const t=Ls.getContext("2d");t.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const n=t.measureText(e.value,0,0),r=n.actualBoundingBoxDescent+n.actualBoundingBoxAscent;return{width:n.width,height:r}}else{const t=this.value.length*this.size*Mt.Ratio,n=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:t,height:n}}}static fromObject(e){const t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new Mt().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e);for(let t=0;t<Mt.Properties.length;t++){const n=Mt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Mt(this.value);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale;for(let n=0;n<Mt.Properties.length;n++){const r=Mt.Properties[n];t[r]=this[r]}return this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let t=0;t<Mt.Properties.length;t++){const n=Mt.Properties[t];e[n]=this[n]}return e}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let t,n,r,s,o;this._update(!0),t=e?this.matrix:this.worldMatrix;const{width:a,height:l}=Mt.Measure(this),c=(this._linewidth||0)/2;switch(this.alignment){case"left":n=-c,r=a+c;break;case"right":n=-(a+c),r=c;break;default:n=-(a/2+c),r=a/2+c}switch(this.baseline){case"middle":s=-(l/2+c),o=l/2+c;break;default:s=-(l+c),o=c}const[d,h]=t.multiply(n,s),[u,p]=t.multiply(n,o),[f,g]=t.multiply(r,s),[m,_]=t.multiply(r,o);return s=Sl(h,p,g,_),n=Sl(d,u,f,m),r=Bl(d,u,f,m),o=Bl(h,p,g,_),{top:s,left:n,right:r,bottom:o,width:r-n,height:o-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}},It=Mt;w(It,"Ratio",.6),w(It,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);var Tl={value:{enumerable:!0,get:function(){return this._value},set:function(e){this._value=e,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(e){this._family=e,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(e){this._leading=e,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(e){this._alignment=e,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(e){this._style=e,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(e){this._weight=e,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(e){this._decoration=e,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(e){this._direction=e,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(e){this._baseline=e,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof qe||this._fill instanceof Oe||this._fill instanceof Ie||this._fill instanceof Ee)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof qe||this._stroke instanceof Oe||this._stroke instanceof Ie||this._stroke instanceof Ee)&&this._stroke.bind(X.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function Og(){this._flagFill=!0}function Ig(){this._flagStroke=!0}var Or=Math.min,Ir=Math.max,Si=class extends hn{constructor(e){super(),w(this,"_flagAdditions",!1),w(this,"_flagSubtractions",!1),w(this,"_flagOrder",!1),w(this,"_flagOpacity",!0),w(this,"_flagBeginning",!1),w(this,"_flagEnding",!1),w(this,"_flagLength",!1),w(this,"_flagMask",!1),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_cap","round"),w(this,"_join","round"),w(this,"_miter",4),w(this,"_closed",!0),w(this,"_curved",!1),w(this,"_automatic",!0),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_length",0),w(this,"_mask",null);for(let t in El)Object.defineProperty(this,t,El[t]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let t=0;t<e.length;t++)$l.call(this,e[t],this)}static RemoveChildren(e){for(let t=0;t<e.length;t++)$l.call(this,e[t])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const t=new Si;for(let r=0;r<Si.Properties.length;r++){const s=Si.Properties[r];s in e&&(/(fill|stroke)/i.test(s)?t[s]=typeof e[s]=="string"?e[s]:jn(e[s]):t[s]=e[s])}return"mask"in e&&(t.mask=n(e.mask)),"id"in e&&(t.id=e.id),t.children=e.children.map(n),t;function n(r){if(r&&r.renderer)switch(r.renderer.type){case"arc-segment":return Pr.fromObject(r);case"circle":return Zi.fromObject(r);case"ellipse":return Ji.fromObject(r);case"points":return Fr.fromObject(r);case"polygon":return Mr.fromObject(r);case"rectangle":return En.fromObject(r);case"rounded-rectangle":return Qi.fromObject(r);case"star":return Ar.fromObject(r);case"path":return Ce.fromObject(r);case"text":return It.fromObject(r);case"group":return Si.fromObject(r);case"shape":return hn.fromObject(r);case"element":return Dn.fromObject(r)}return r}}copy(e){return super.copy.call(this,e),console.warn("Two.Group.copy is not supported yet."),this}clone(e){const t=new Si,n=this.children.map(function(r){return r.clone()});return t.add(n),t.opacity=this.opacity,this.mask&&(t.mask=this.mask),t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.className=this.className,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._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,ae.each(this.children,(t,n)=>{e.children[n]=t.toObject()},this),e}corner(){const e=this.getBoundingClientRect(!0);for(let t=0;t<this.children.length;t++){const n=this.children[t];n.translation.x-=e.left,n.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),t=e.left+e.width/2-this.translation.x,n=e.top+e.height/2-this.translation.y;for(let r=0;r<this.children.length;r++){const s=this.children[r];s.isShape&&(s.translation.x-=t,s.translation.y-=n)}return this.mask&&(this.mask.translation.x-=t,this.mask.translation.y-=n),this}getById(e){let t=null;function n(r){if(r.id===e)return r;if(r.children){if(r.children.ids[e])return r.children.ids[e];for(let s=0;s<r.children.length;s++)if(t=n(r.children[s]),t)return t}return null}return n(this)}getByClassName(e){const t=[];function n(r){if(Array.prototype.indexOf.call(r.classList,e)>=0&&t.push(r),r.children)for(let s=0;s<r.children.length;s++){const o=r.children[s];n(o)}return t}return n(this)}getByType(e){const t=[];function n(r){if(r instanceof e&&t.push(r),r.children)for(let s=0;s<r.children.length;s++){const o=r.children[s];n(o)}return t}return n(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let t=0;t<e.length;t++){const n=e[t];if(!(n&&n.id))continue;const r=Array.prototype.indexOf.call(this.children,n);r>=0&&this.children.splice(r,1),this.children.push(n)}return this}remove(e){const t=arguments.length,n=this.parent;if(t<=0&&n)return n.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let r=0;r<e.length;r++){const s=e[r];if(!s||!this.children.ids[s.id])continue;const o=this.children.indexOf(s);o>=0&&this.children.splice(o,1)}return this}getBoundingClientRect(e){let t,n,r,s,o,a;this._update(!0);let l=1/0,c=-1/0,d=1/0,h=-1/0;const u=/texture|gradient/i;n=e?this.matrix:this.worldMatrix;for(let p=0;p<this.children.length;p++){const f=this.children[p];if(!(!f.visible||u.test(f._renderer.type))&&(t=f.getBoundingClientRect(e),r=typeof t.top!="number"||ae.isNaN(t.top)||!isFinite(t.top),s=typeof t.left!="number"||ae.isNaN(t.left)||!isFinite(t.left),o=typeof t.right!="number"||ae.isNaN(t.right)||!isFinite(t.right),a=typeof t.bottom!="number"||ae.isNaN(t.bottom)||!isFinite(t.bottom),!(r||s||o||a)))if(e){const[g,m]=n.multiply(t.left,t.top),[_,y]=n.multiply(t.right,t.top),[b,S]=n.multiply(t.left,t.bottom),[x,C]=n.multiply(t.right,t.bottom);d=Or(m,y,S,C,d),l=Or(g,_,b,x,l),c=Ir(g,_,b,x,c),h=Ir(m,y,S,C,h)}else d=Or(t.top,d),l=Or(t.left,l),c=Ir(t.right,c),h=Ir(t.bottom,h)}return{top:d,left:l,right:c,bottom:h,width:c-l,height:h-d}}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(t){t.subdivide.apply(t,e)}),this}_update(){let e,t,n;if(this._flagBeginning||this._flagEnding){const r=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),o=this.length;let a=0;const l=r*o,c=s*o;for(e=0;e<this.children.length;e++)n=this.children[e],t=n.length,l>a+t?(n.beginning=1,n.ending=1):c<a?(n.beginning=0,n.ending=0):l>a&&l<a+t?(n.beginning=(l-a)/t,n.ending=1):c>a&&c<a+t?(n.beginning=0,n.ending=(c-a)/t):(n.beginning=0,n.ending=1),a+=t}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}},Ue=Si;w(Ue,"Children",_l),w(Ue,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var El={visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._flagVisible=this._visible!==e||this._flagVisible,this._visible=e}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._flagOpacity=this._opacity!==e||this._flagOpacity,this._opacity=e}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._flagBeginning=this._beginning!==e||this._flagBeginning,this._beginning=e}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._flagEnding=this._ending!==e||this._flagEnding,this._ending=e}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let e=0;e<this.children.length;e++){const t=this.children[e];this._length+=t.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){this._fill=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.fill=e}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){this._stroke=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.stroke=e}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.linewidth=e}}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.join=e}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.miter=e}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.cap=e}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(e){this._closed=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.closed=e}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.curved=e}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){this._automatic=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.automatic=e}}},children:{enumerable:!0,get:function(){return this._children},set:function(e){const t=Ue.InsertChildren.bind(this),n=Ue.RemoveChildren.bind(this),r=Ue.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new _l(e),this._children.bind(X.Types.insert,t),this._children.bind(X.Types.remove,n),this._children.bind(X.Types.order,r),e.length>0&&t(e)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}}};function $l(e,t){const n=e.parent;let r;if(n===t){s();return}if(n&&n.children.ids[e.id]&&(r=Array.prototype.indexOf.call(n.children,e),n.children.splice(r,1),o()),t){s();return}o(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete e.parent;function s(){t.subtractions.length>0&&(r=Array.prototype.indexOf.call(t.subtractions,e),r>=0&&t.subtractions.splice(r,1)),t.additions.length>0&&(r=Array.prototype.indexOf.call(t.additions,e),r>=0&&t.additions.splice(r,1)),e.parent=t,t.additions.push(e),t._flagAdditions=!0}function o(){r=Array.prototype.indexOf.call(n.additions,e),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,e),r<0&&(n.subtractions.push(e),n._flagSubtractions=!0)}}var Ds=class extends Ce{constructor(t,n,r,s){const o=[new ve(t,n),new ve(r,s)];super(o);for(let a in Nl)Object.defineProperty(this,a,Nl[a]);this.vertices[0].command=ee.move,this.vertices[1].command=ee.line,this.automatic=!1}},Nl={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(ae.isObject(e))this.vertices.splice(0,1,e);else{const t=new Bt("Two.Line.x argument is not an object.");console.warn(t.name,t.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(e){if(ae.isObject(e))this.vertices.splice(1,1,e);else{const t=new Bt("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}},Zt={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},Vg={start:"left",middle:"center",end:"right"},Rl=["id","class","transform","xmlns","viewBox"],zg=["x","y","width","height","href","xlink:href"];function Lg(e){return Vg[e]}function Dg(e){const t=e.getAttribute("dominant-baseline"),n=e.getAttribute("alignment-baseline");return t||n}function er(e){return e.replace(/svg:/gi,"").toLowerCase()}function Pl(e,t){if(t.x+=e.translateX,t.y+=e.translateY,t.x*=e.scaleX,t.y*=e.scaleY,e.rotation!==0){const n=t.length();t.x=n*Math.cos(e.rotation),t.y=n*Math.sin(e.rotation)}}function Hg(e,t){t||(t={});const n=e.split(";");for(let r=0;r<n.length;r++){const s=n[r].split(":"),o=s[0],a=s[1];if(typeof o>"u"||typeof a>"u")continue;const l=o.replace(/\s/g,""),c=a.replace(/\s/g,"");t[l]=c}return t}function Wg(e){const t={},n=jg(e),r=Math.max(n.length,e.style.length);for(let s=0;s<r;s++){const o=e.style[s],a=n[s];o&&(t[o]=e.style[o]),a&&(t[a]=e.getAttribute(a))}return t}function jg(e){const t=e.getAttributeNames();for(let n=0;n<Rl.length;n++){const r=Rl[n],s=Array.prototype.indexOf.call(t,r);s>=0&&t.splice(s,1)}return t}function Xg(e,t){const n=t.split(/[\s,]/),r=-parseFloat(n[0]),s=-parseFloat(n[1]),o=parseFloat(n[2]),a=parseFloat(n[3]);if(r&&s)for(let u=0;u<e.children.length;u++){const p=e.children[u];"translation"in p?p.translation.add(r,s):"x"in p?p.x=r:"y"in p&&(p.y=s)}const l=typeof e.x=="number",c=typeof e.y=="number",d=typeof e.width=="number",h=typeof e.height=="number";return l&&(e.translation.x+=e.x),c&&(e.translation.y+=e.y),(d||h)&&(e.scale=new Z(1,1)),d&&(e.scale.x=e.width/o),h&&(e.scale.y=e.height/a),e.mask=new En(0,0,o,a),e.mask.origin.set(-o/2,-a/2),e}function Vt(e,t,n){const r={},s={},o={};let a,l,c,d,h,u,p,f,g,m,_,y,b,S,x,C,B;if(e===null)return r;if(De.getComputedStyle){const v=De.getComputedStyle(e);for(a=v.length;a--;)c=v[a],d=v[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<e.attributes.length;a++)u=e.attributes[a],/style/i.test(u.nodeName)?Hg(u.value,o):s[u.nodeName]=u.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),n&&ae.defaults(r,n),ae.extend(r,o,s),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)||(l=e.gradientTransform&&e.gradientTransform.baseVal&&e.gradientTransform.baseVal.length>0?e.gradientTransform.baseVal[0].matrix:e.getCTM?e.getCTM():null,l===null))break;switch(p=wi(l),t._renderer.type){case"linear-gradient":Pl(p,t.left),Pl(p,t.right);break;case"radial-gradient":t.center.x+=p.translateX,t.center.y+=p.translateY,t.focal.x+=p.translateX,t.focal.y+=p.translateY,t.radius*=Math.max(p.scaleX,p.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=e.transform&&e.transform.baseVal&&e.transform.baseVal.length>0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null,l===null))break;p=wi(l),t.translation.set(p.translateX,p.translateY),t.rotation=Math.PI*(p.rotation/180),t.scale=new Z(p.scaleX,p.scaleY),f=parseFloat((r.x+"").replace("px")),g=parseFloat((r.y+"").replace("px")),f&&(t.translation.x=f),g&&(t.translation.y=g);break;case"visible":if(t instanceof Ue){t._visible=d;break}t.visible=d;break;case"stroke-linecap":if(t instanceof Ue){t._cap=d;break}t.cap=d;break;case"stroke-linejoin":if(t instanceof Ue){t._join=d;break}t.join=d;break;case"stroke-miterlimit":if(t instanceof Ue){t._miter=d;break}t.miter=d;break;case"stroke-width":if(t instanceof Ue){t._linewidth=parseFloat(d);break}t.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof Ue){t._opacity=parseFloat(d);break}t.opacity=parseFloat(d);break;case"clip-path":if(Zt.cssBackgroundImage.test(d)&&(m=d.replace(Zt.cssBackgroundImage,"$1"),ze.defs.current&&ze.defs.current.contains(m)&&(y=ze.defs.current.get(m),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],b=er(y.nodeName),t.mask=ze[b].call(this,y,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":h=(t instanceof Ue?"_":"")+c,Zt.cssBackgroundImage.test(d)?(m=d.replace(Zt.cssBackgroundImage,"$1"),ze.defs.current&&ze.defs.current.contains(m)?(y=ze.defs.current.get(m),y.object||(b=er(y.nodeName),y.object=ze[b].call(this,y,{})),y=y.object):(_=Yg(this),y=_.getById(m)),t[h]=y):t[h]=d;break;case"id":t.id=d;break;case"class":case"className":t.classList=d.split(" "),t._flagClassName=!0;break;case"x":case"y":if(S=t instanceof qe,x=t instanceof Oe,C=t instanceof Ie,S||x||C)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Bt("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),t.translation[c]=parseFloat(d);break;case"font-family":t instanceof It&&(t.family=d);break;case"font-size":t instanceof It&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Bt("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),t.size=parseFloat(d));break;case"font-weight":t instanceof It&&(t.weight=d);break;case"font-style":t instanceof It&&(t.style=d);break;case"text-decoration":t instanceof It&&(t.decoration=d);break;case"line-height":t instanceof It&&(t.leading=d);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),r}function qg(e,t){for(let n=0,r=e.childNodes.length;n<r;n++){const s=e.childNodes[n];!s.id||er(e.nodeName)==="#text"||t.add(s.id,s)}}function Yg(e){for(;e.parent;)e=e.parent;return e.scene}var ze={svg:function(e){const t=ze.defs.current=new Tr,n=e.getElementsByTagName("defs");for(let g=0;g<n.length;g++)qg(n[g],t);const r=ze.g.call(this,e),s=e.getAttribute("viewBox"),o=e.getAttribute("x"),a=e.getAttribute("y"),l=e.getAttribute("width"),c=e.getAttribute("height");r.defs=t;const d=s!==null,h=o!==null,u=a!==null,p=l!==null,f=c!==null;return h&&(r.x=parseFloat(o.replace(Zt.unitSuffix,""))),u&&(r.y=parseFloat(a.replace(Zt.unitSuffix,""))),p&&(r.width=parseFloat(l.replace(Zt.unitSuffix,""))),f&&(r.height=parseFloat(c.replace(Zt.unitSuffix,""))),d&&Xg(r,s),delete ze.defs.current,r},defs:function(e){return null},use:function(e,t){let n;const r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return n=new Bt("encountered <use /> with no href."),console.warn(n.name,n.message),null;const s=r.slice(1);if(!ze.defs.current.contains(s))return n=new Bt("unable to find element for reference "+r+"."),console.warn(n.name,n.message),null;const a=ze.defs.current.get(s).cloneNode(!0);for(let c=0;c<e.attributes.length;c++){const d=e.attributes[c],h=zg.includes(d.nodeName),u=!a.hasAttribute(d.nodeName);(h||u)&&a.setAttribute(d.nodeName,d.value)}const l=er(a.nodeName);return ze[l].call(this,a,t)},g:function(e,t){const n=new Ue;Vt.call(this,e,n,t),this.add(n);const r=Wg.call(this,e);for(let s=0,o=e.childNodes.length;s<o;s++){const a=e.childNodes[s],l=a.nodeName;if(!l)return;const c=er(l);if(c in ze){const d=ze[c].call(n,a,r);d&&!d.parent&&n.add(d)}}return n},polygon:function(e,t){let n;typeof e=="string"?n=e:n=e.getAttribute("points");const r=[];n.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(o,a,l){r.push(new ve(parseFloat(a),parseFloat(l)))});const s=new Ce(r,!0);return s.stroke="none",s.fill="black",Vt.call(this,e,s,t),s},polyline:function(e,t){const n=ze.polygon.call(this,e,t);return n.closed=!1,n},path:function(e,t){let n;typeof e=="string"?(n=e,e=null):n=e.getAttribute("d");let r=[],s=!1,o=!1;if(n){let l=new ve,c,d,h=n.match(/[a-df-z][^a-df-z]*/gi);const u=h.length-1;ae.each(h.slice(0),function(p,f){const g=p.slice(1).trim().match(Zt.path),m=p[0],_=m.toLowerCase();let y,b,S,x,C;const B=[];switch(f===0&&(h=[]),_){case"h":case"v":g.length>1&&(y=1);break;case"m":case"l":case"t":g.length>2&&(y=2);break;case"s":case"q":g.length>4&&(y=4);break;case"c":g.length>6&&(y=6);break;case"a":g.length>7&&(y=7);break}if(y){for(b=0,S=g.length,C=0;b<S;b+=y){if(x=m,C>0)switch(m){case"m":x="l";break;case"M":x="L";break}B.push(x+g.slice(b,b+y).join(" ")),C++}h=Array.prototype.concat.apply(h,B)}else h.push(p)}),ae.each(h,function(p,f){let g,m,_;const y=p[0],b=y.toLowerCase();d=p.slice(1).trim().match(Zt.path),o=y===b;let S,x,C,B,v,N,F,P,q,U,M,E,A,K,R,$,j;switch(b){case"z":if(f>=u)s=!0;else{m=l.x,_=l.y,g=new ve(m,_,void 0,void 0,void 0,void 0,ee.close);for(let z=r.length-1;z>=0;z--){const Y=r[z];if(/m/i.test(Y.command)){l=Y;break}}}break;case"m":case"l":c=void 0,m=parseFloat(d[0]),_=parseFloat(d[1]),g=new ve(m,_,void 0,void 0,void 0,void 0,/m/i.test(b)?ee.move:ee.line),o&&g.addSelf(l),l=g;break;case"h":case"v":U=/h/i.test(b)?"x":"y",M=/x/i.test(U)?"y":"x",g=new ve(void 0,void 0,void 0,void 0,void 0,void 0,ee.line),g[U]=parseFloat(d[0]),g[M]=l[M],o&&(g[U]+=l[U]),l=g;break;case"c":case"s":S=l.x,x=l.y,c||(c=new Z),/c/i.test(b)?(C=parseFloat(d[0]),B=parseFloat(d[1]),v=parseFloat(d[2]),N=parseFloat(d[3]),F=parseFloat(d[4]),P=parseFloat(d[5])):(q=Rs(l,c,o),C=q.x,B=q.y,v=parseFloat(d[0]),N=parseFloat(d[1]),F=parseFloat(d[2]),P=parseFloat(d[3])),o&&(C+=S,B+=x,v+=S,N+=x,F+=S,P+=x),l.controls.right.set(C-l.x,B-l.y),g=new ve(F,P,v-F,N-P,void 0,void 0,ee.curve),l=g,c=g.controls.left;break;case"t":case"q":S=l.x,x=l.y,c||(c=new Z),/q/i.test(b)?(C=parseFloat(d[0]),B=parseFloat(d[1]),v=parseFloat(d[0]),N=parseFloat(d[1]),F=parseFloat(d[2]),P=parseFloat(d[3])):(q=Rs(l,c,o),C=q.x,B=q.y,v=q.x,N=q.y,F=parseFloat(d[0]),P=parseFloat(d[1])),o&&(C+=S,B+=x,v+=S,N+=x,F+=S,P+=x),l.controls.right.set((C-l.x)*.33,(B-l.y)*.33),g=new ve(F,P,v-F,N-P,void 0,void 0,ee.curve),l=g,c=g.controls.left;break;case"a":S=l.x,x=l.y,A=parseFloat(d[0]),K=parseFloat(d[1]),R=parseFloat(d[2]),$=parseFloat(d[3]),j=parseFloat(d[4]),F=parseFloat(d[5]),P=parseFloat(d[6]),o&&(F+=S,P+=x),E=new ve(F,P),E.command=ee.arc,E.rx=A,E.ry=K,E.xAxisRotation=R,E.largeArcFlag=$,E.sweepFlag=j,g=E,l=E,c=void 0;break}g&&(Array.isArray(g)?r=r.concat(g):r.push(g))})}n=new Ce(r,s,void 0,!0),n.stroke="none",n.fill="black";const a=n.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},ae.each(n.vertices,function(l){l.subSelf(a.centroid)}),Vt.call(this,e,n,t),n.translation.addSelf(a.centroid),n},circle:function(e,t){const n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=parseFloat(e.getAttribute("r")),o=new Zi(0,0,s);return o.stroke="none",o.fill="black",Vt.call(this,e,o,t),o.translation.x=n,o.translation.y=r,o},ellipse:function(e,t){const n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=parseFloat(e.getAttribute("rx")),o=parseFloat(e.getAttribute("ry")),a=new Ji(0,0,s,o);return a.stroke="none",a.fill="black",Vt.call(this,e,a,t),a.translation.x=n,a.translation.y=r,a},rect:function(e,t){const n=parseFloat(e.getAttribute("rx")),r=parseFloat(e.getAttribute("ry"));if(!ae.isNaN(n)||!ae.isNaN(r))return ze["rounded-rect"](e);const s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),a=s/2,l=o/2,c=new En(0,0,s,o);return c.stroke="none",c.fill="black",Vt.call(this,e,c,t),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(e,t){const n=parseFloat(e.getAttribute("rx"))||0,r=parseFloat(e.getAttribute("ry"))||0,s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),a=s/2,l=o/2,c=new Z(n,r),d=new Qi(0,0,s,o,c);return d.stroke="none",d.fill="black",Vt.call(this,e,d,t),d.translation.x+=a,d.translation.y+=l,d},line:function(e,t){const n=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),s=parseFloat(e.getAttribute("x2")),o=parseFloat(e.getAttribute("y2")),a=new Ds(n,r,s,o).noFill();return Vt.call(this,e,a,t),a},lineargradient:function(e,t){let n=e.getAttribute("gradientUnits"),r=e.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(e.getAttribute("x1")||0),o=parseFloat(e.getAttribute("y1")||0),a=parseFloat(e.getAttribute("x2")||0),l=parseFloat(e.getAttribute("y2")||0);const c=(a+s)/2,d=(l+o)/2;/userSpaceOnUse/i.test(n)&&(s-=c,o-=d,a-=c,l-=d);const h=[];for(let p=0;p<e.children.length;p++){const f=e.children[p];let g=f.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let m=f.getAttribute("stop-color"),_=f.getAttribute("stop-opacity"),y=f.getAttribute("style"),b;m===null&&(b=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,m=b&&b.length>1?b[1]:void 0),_===null?(b=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,_=b&&b.length>1?parseFloat(b[1]):1):_=parseFloat(_),h.push(new Kt(g,m,_))}const u=new Oe(s,o,a,l,h);return u.spread=r,u.units=n,Vt.call(this,e,u,t),u},radialgradient:function(e,t){let n=e.getAttribute("gradientUnits"),r=e.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(e.getAttribute("cx"))||0,o=parseFloat(e.getAttribute("cy"))||0,a=parseFloat(e.getAttribute("r")),l=parseFloat(e.getAttribute("fx")),c=parseFloat(e.getAttribute("fy"));ae.isNaN(l)&&(l=s),ae.isNaN(c)&&(c=o);const d=Math.abs(s+l)/2,h=Math.abs(o+c)/2;/userSpaceOnUse/i.test(n)&&(s-=d,o-=h,l-=d,c-=h);const u=[];for(let f=0;f<e.children.length;f++){const g=e.children[f];let m=g.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let _=g.getAttribute("stop-color"),y=g.getAttribute("stop-opacity"),b=g.getAttribute("style"),S;_===null&&(S=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,_=S&&S.length>1?S[1]:void 0),y===null?(S=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=S&&S.length>1?parseFloat(S[1]):1):y=parseFloat(y),u.push(new Kt(m,_,y))}const p=new Ie(s,o,a,u,l,c);return p.spread=r,p.units=n,Vt.call(this,e,p,t),p},text:function(e,t){const n=Lg(e.getAttribute("text-anchor"))||"left",r=Dg(e)||"baseline";let s="";e.childNodes.length>0&&e.childNodes[0].tagName==="TSPAN"?s=e.childNodes[0].textContent:s=e.textContent;const o=new It(s);return Vt.call(this,e,o,t),o.alignment=n,o.baseline=r,o},clippath:function(e,t){return ze.defs.current&&!ze.defs.current.contains(e.id)&&ze.defs.current.add(e.id,e),null},image:function(e,t){let n;const r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return n=new Bt("encountered <image /> with no href."),console.warn(n.name,n.message),null;const s=parseFloat(e.getAttribute("x"))||0,o=parseFloat(e.getAttribute("y"))||0,a=parseFloat(e.getAttribute("width")),l=parseFloat(e.getAttribute("height")),c=new Rr(r,s,o);return ae.isNaN(a)||(c.width=a),ae.isNaN(l)||(c.height=l),Vt.call(this,e,c,t),c}};function Fl(e,t){const n=new XMLHttpRequest;return n.open("GET",e),n.onreadystatechange=function(){n.readyState===4&&n.status===200&&t(n.responseText)},n.send(),n}var Bi=class extends En{constructor(e,t,n,r){super(t,n,0,0),w(this,"_flagTextures",!1),w(this,"_flagFrameRate",!1),w(this,"_flagIndex",!1),w(this,"_amount",1),w(this,"_duration",0),w(this,"_index",0),w(this,"_startTime",0),w(this,"_playing",!1),w(this,"_firstFrame",0),w(this,"_lastFrame",0),w(this,"_loop",!0),w(this,"_textures",null),w(this,"_frameRate",0),w(this,"_origin",null);for(let s in Ml)Object.defineProperty(this,s,Ml[s]);this._renderer.flagTextures=Ug.bind(this),this._renderer.bindTextures=Gg.bind(this),this._renderer.unbindTextures=Kg.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Al.bind(this)):this.textures=[Al(e)],this.origin=new Z,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Bi.DefaultFrameRate,this.index=0}static fromObject(e){const t=new Bi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Bi.Properties.length;t++){const n=Bi.Properties[t];n in e&&(this[n]=e[n])}return this}play(e,t,n){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=ae.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof t=="number"&&(this._lastFrame=t),typeof n=="function"?this._onLastFrame=n: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 t=new Bi(this.textures,this.translation.x,this.translation.y,this.frameRate);return t._loop=this._loop,this._playing&&t.play(),e&&e.add(t),t}toObject(){const e=super.toObject.call(this);return e.textures=this.textures.map(function(t){return t.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}_update(){const e=this._textures;let t,n,r,s,o,a,l,c;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,ae.isNaN(this._lastFrame)&&(this._lastFrame=s-1),r=ae.performance.now()-this._startTime,c=this._lastFrame+1,o=1e3*(c-this._firstFrame)/this._frameRate,this._loop?r=r%o:r=Math.min(r,o),l=Nt(this._firstFrame,c,r/o),l=Math.floor(l),l!==this._index&&(this._index=l,a=e[this._index],a.loaded&&(t=a.image.width,n=a.image.height,this.width!==t&&(this.width=t),this.height!==n&&(this.height=n),this.fill=a,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Ee))&&(a=e[this._index],a.loaded&&(t=a.image.width,n=a.image.height,this.width!==t&&(this.width=t),this.height!==n&&(this.height=n)),this.fill=a)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},Vr=Bi;w(Vr,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(Vr,"DefaultFrameRate",30);var Ml={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(e){const t=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(X.Types.insert,t).unbind(X.Types.remove,n),this._textures=new Bn((e||[]).slice(0)),this._textures.bind(X.Types.insert,t).bind(X.Types.remove,n),t(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}};function Ug(){this._flagTextures=!0}function Gg(e){let t=e.length;for(;t--;)e[t].bind(X.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Kg(e){let t=e.length;for(;t--;)e[t].unbind(X.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Al(e){if(e instanceof Ee)return e;if(typeof e=="string")return new Ee(e)}var Hs=[],Ws=Math.max,Zg=Math.min,Ol=Math.abs,zr=Math.sin,Lr=Math.cos,Jg=Math.acos,Dr=Math.sqrt,Te={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(e){return e in Te?e:"path"},group:{renderChild:function(e){const t=Te.getRendererType(e._renderer.type);Te[t].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;this._update();const t=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);const r=this._mask,s=Hr(t),o=!s||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,o&&(e.save(),s||e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),r){const a=Te.getRendererType(r._renderer.type);Te[a].render.call(r,e,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Te.getRendererType(l._renderer.type);Te[c].render.call(l,e)}return o&&e.restore(),this.flagReset()}},path:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,p,f,g,m,_,y,b,S,x,C,B,v,N,F,P,q,U,M,E,A,K,R,$,j,z;if(z=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,A=this._mask,K=this._clip,l=this._opacity*(z||1),c=this._visible,!t&&(!c||K||l===0))return this;if(this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,d=this._cap,h=this._join,u=this._miter,p=this._closed,f=this._renderer.vertices,g=f.length,m=g-1,R=Hr(r),j=this.dashes,R||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),A){const re=Te.getRendererType(A._renderer.type);Te[re].render.call(A,e,!0)}if(a)if(typeof a=="string")e.fillStyle=a;else{const re=Te.getRendererType(a._renderer.type);Te[re].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const re=Te.getRendererType(s._renderer.type);Te[re].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o),u&&(e.miterLimit=u),h&&(e.lineJoin=h),!p&&d&&(e.lineCap=d)}typeof l=="number"&&(e.globalAlpha=l),j&&j.length>0&&(e.lineDashOffset=j.offset||0,e.setLineDash(j)),e.beginPath();let Y,I,V,J,pe,ie,ge;for(let re=0;re<g;re++)switch(b=f[re],M=b.x,E=b.y,b.command){case ee.close:e.closePath();break;case ee.arc:Y=b.rx,I=b.ry,V=b.xAxisRotation,J=b.largeArcFlag,pe=b.sweepFlag,_=p?Rt(re-1,g):Ws(re-1,0),y=f[_],ie=y.x,ge=y.y,Te.renderSvgArcCommand(e,ie,ge,Y,I,J,pe,V,M,E);break;case ee.curve:_=p?Rt(re-1,g):Math.max(re-1,0),y=f[_],F=y.controls&&y.controls.right||Z.zero,P=b.controls&&b.controls.left||Z.zero,y._relative?(v=F.x+y.x,N=F.y+y.y):(v=F.x,N=F.y),b._relative?(C=P.x+b.x,B=P.y+b.y):(C=P.x,B=P.y),e.bezierCurveTo(v,N,C,B,M,E),re>=m&&p&&(S=x,q=b.controls&&b.controls.right||Z.zero,U=S.controls&&S.controls.left||Z.zero,b._relative?(v=q.x+b.x,N=q.y+b.y):(v=q.x,N=q.y),S._relative?(C=U.x+S.x,B=U.y+S.y):(C=U.x,B=U.y),M=S.x,E=S.y,e.bezierCurveTo(v,N,C,B,M,E));break;case ee.line:e.lineTo(M,E);break;case ee.move:x=b,e.moveTo(M,E);break}return p&&e.closePath(),!K&&!n&&(Te.isHidden.test(a)||($=a._renderer&&a._renderer.offset,$&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),$&&e.restore()),Te.isHidden.test(s)||($=s._renderer&&s._renderer.offset,$&&(e.save(),e.translate(-s._renderer.offset.x,-s._renderer.offset.y),e.scale(s._renderer.scale.x,s._renderer.scale.y),e.lineWidth=o/s._renderer.scale.x),e.stroke(),$&&e.restore())),R||e.restore(),K&&!n&&e.clip(),j&&j.length>0&&e.setLineDash(Hs),this.flagReset()}},points:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,p,f,g,m,_,y,b;if(b=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(b||1),c=this._visible,!t&&(!c||l===0))return this;if(this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,h=this._renderer.collection,u=h.length,m=Hr(r),y=this.dashes,d=this._size,m||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")e.fillStyle=a;else{const C=Te.getRendererType(a._renderer.type);Te[C].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const C=Te.getRendererType(s._renderer.type);Te[C].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o)}typeof l=="number"&&(e.globalAlpha=l),y&&y.length>0&&(e.lineDashOffset=y.offset||0,e.setLineDash(y)),e.beginPath();let S=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=wi(x[0],x[3],x[1],x[4],x[2],x[5]),S/=Math.max(x.scaleX,x.scaleY));for(let C=0;C<u;C++)p=h[C],f=p.x,g=p.y,e.moveTo(f+S,g),e.arc(f,g,S,0,ct);return n||(Te.isHidden.test(a)||(_=a._renderer&&a._renderer.offset,_&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),_&&e.restore()),Te.isHidden.test(s)||(_=s._renderer&&s._renderer.offset,_&&(e.save(),e.translate(-s._renderer.offset.x,-s._renderer.offset.y),e.scale(s._renderer.scale.x,s._renderer.scale.y),e.lineWidth=o/s._renderer.scale.x),e.stroke(),_&&e.restore())),m||e.restore(),y&&y.length>0&&e.setLineDash(Hs),this.flagReset()}},text:{render:function(e,t,n){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,s=this._opacity*r,o=this._visible,a=this._mask,l=this._clip;if(!t&&(!o||l||s===0))return this;this._update();const c=this._matrix.elements,d=this._stroke,h=this._linewidth,u=this._fill,p=this._decoration,f=this._direction,g=Hr(c),m=u._renderer&&u._renderer.offset&&d._renderer&&d._renderer.offset,_=this.dashes,y=Te.alignments[this._alignment]||this._alignment,b=Te.baselines[this._baseline]||this._baseline;let S,x,C,B,v,N,F,P,q,U,M;if(g||(e.save(),e.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const E=Te.getRendererType(a._renderer.type);Te[E].render.call(a,e,!0)}if(m||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=y,e.textBaseline=b,e.direction=f,u)if(typeof u=="string")e.fillStyle=u;else{const E=Te.getRendererType(u._renderer.type);Te[E].render.call(u,e,this),e.fillStyle=u._renderer.effect}if(d){if(typeof d=="string")e.strokeStyle=d;else{const E=Te.getRendererType(d._renderer.type);Te[E].render.call(d,e,this),e.strokeStyle=d._renderer.effect}h&&(e.lineWidth=h)}if(typeof s=="number"&&(e.globalAlpha=s),_&&_.length>0&&(e.lineDashOffset=_.offset||0,e.setLineDash(_)),!l&&!n&&(Te.isHidden.test(u)||(u._renderer&&u._renderer.offset?(N=u._renderer.scale.x,F=u._renderer.scale.y,e.save(),e.translate(-u._renderer.offset.x,-u._renderer.offset.y),e.scale(N,F),S=this._size/u._renderer.scale.y,x=this._leading/u._renderer.scale.y,e.font=[this._style,this._weight,S+"px/",x+"px",this._family].join(" "),C=u._renderer.offset.x/u._renderer.scale.x,B=u._renderer.offset.y/u._renderer.scale.y,e.fillText(this.value,C,B),e.restore()):e.fillText(this.value,0,0)),Te.isHidden.test(d)||(d._renderer&&d._renderer.offset?(N=d._renderer.scale.x,F=d._renderer.scale.y,e.save(),e.translate(-d._renderer.offset.x,-d._renderer.offset.y),e.scale(N,F),S=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,e.font=[this._style,this._weight,S+"px/",x+"px",this._family].join(" "),C=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,v=h/d._renderer.scale.x,e.lineWidth=v,e.strokeText(this.value,C,B),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(p)){const E=e.measureText(this.value);let A=1;switch(p){case"underline":q=E.actualBoundingBoxDescent,M=E.actualBoundingBoxDescent;break;case"strikethrough":q=0,M=0,A=.5;break}switch(b){case"top":q+=this._size*A,M+=this._size*A;break;case"baseline":case"bottom":q-=this._size*A,M-=this._size*A;break}switch(y){case"left":case"start":P=0,U=E.width;break;case"right":case"end":P=-E.width,U=0;break;default:P=-E.width/2,U=E.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(P,q),e.lineTo(U,M),e.stroke()}return g||e.restore(),l&&!n&&e.clip(),_&&_.length>0&&e.setLineDash(Hs),this.flagReset()}},"linear-gradient":{render:function(e,t){if(t){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,s=this.left._y,o=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=t.getBoundingClientRect(!0),r=(r-.5)*n.width,s=(s-.5)*n.height,o=(o-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=e.createLinearGradient(r,s,o,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return this.flagReset()}}},"radial-gradient":{render:function(e,t){if(t){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,s=this.center._y,o=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=t.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,s=(s-.5)*n.height*.5,o=(o-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=e.createRadialGradient(r,s,0,o,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return this.flagReset()}}},texture:{render:function(e){this._update();const t=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=e.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof Z||(this._renderer.offset=new Z),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,t&&(this._renderer.offset.x+=t.width/2,this._renderer.offset.y+=t.height/2,this._scale instanceof Z?(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 Z||(this._renderer.scale=new Z),this._scale instanceof Z?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}},renderSvgArcCommand:function(e,t,n,r,s,o,a,l,c,d){l=l*Math.PI/180,r=Ol(r),s=Ol(s);const h=(t-c)/2,u=(n-d)/2,p=Lr(l)*h+zr(l)*u,f=-zr(l)*h+Lr(l)*u,g=p*p,m=f*f;let _=r*r,y=s*s;const b=g/_+m/y;if(b>1){const E=Dr(b);r=E*r,s=E*s,_=r*r,y=s*s}const S=_*m+y*g,x=(_*y-S)/S;let C=Dr(Ws(0,x));o===a&&(C=-C);const B=C*r*f/s,v=-C*s*p/r,N=Lr(l)*B-zr(l)*v+(t+c)/2,F=zr(l)*B+Lr(l)*v+(n+d)/2,P=Il(1,0,(p-B)/r,(f-v)/s),q=Il((p-B)/r,(f-v)/s,(-p-B)/r,(-f-v)/s)%ct,U=P+q;Qg(e,N,F,r,s,P,U,a===0,l)}},ht=class extends X{constructor(e){super();const t=e.smoothing!==!1;this.domElement=e.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=e.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=t),this.scene=new Ue,this.scene.parent=this}setSize(e,t,n){return this.width=e,this.height=t,this.ratio=typeof n>"u"?Ps(this.ctx):n,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,this.domElement.style&&ae.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this.trigger(X.Types.resize,e,t,n)}render(){const e=this.ratio===1;return e||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Te.group.render.call(this.scene,this.ctx),e||this.ctx.restore(),this}};w(ht,"Utils",Te);function Qg(e,t,n,r,s,o,a,l,c){const d=a-o,h=vi.Tolerance.epsilon,u=Math.abs(d)<h;let p=Rt(d,ct);p<h&&(u?p=0:p=ct),l===!0&&!u&&(p===ct?p=-ct:p=p-ct);for(let f=0;f<bt.Resolution;f++){const g=f/(bt.Resolution-1),m=o+g*p;let _=t+r*Math.cos(m),y=n+s*Math.sin(m);if(c!==0){const b=Math.cos(c),S=Math.sin(c),x=_-t,C=y-n;_=x*b-C*S+t,y=x*S+C*b+n}e.lineTo(_,y)}}function Il(e,t,n,r){const s=e*n+t*r,o=Dr(e*e+t*t)*Dr(n*n+r*r);let a=Jg(Ws(-1,Zg(1,s/o)));return e*r-t*n<0&&(a=-a),a}function Hr(e){return e[0]==1&&e[3]==0&&e[1]==0&&e[4]==1&&e[2]==0&&e[5]==0}var se={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(e,t){const n=e,r=document.createElementNS(se.ns,n);return n==="svg"&&(t=ae.defaults(t||{},{version:se.version})),t&&Object.keys(t).length>0&&se.setAttributes(r,t),r},setAttributes:function(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r++)/href/.test(n[r])?e.setAttributeNS(se.xlink,n[r],t[n[r]]):e.setAttribute(n[r],t[n[r]]);return this},removeAttributes:function(e,t){for(let n in t)e.removeAttribute(n);return this},toString:function(e,t){let n=e.length,r=n-1,s,o="";for(let a=0;a<n;a++){const l=e[a],c=t?Rt(a-1,n):Math.max(a-1,0),d=e[c];let h,u,p,f,g,m,_,y,b,S,x,C,B,v,N,F=Re(l.x),P=Re(l.y);switch(l.command){case ee.close:h=ee.close;break;case ee.arc:x=l.rx,C=l.ry,B=l.xAxisRotation,v=l.largeArcFlag,N=l.sweepFlag,h=ee.arc+" "+x+" "+C+" "+B+" "+v+" "+N+" "+F+" "+P;break;case ee.curve:_=d.controls&&d.controls.right||Z.zero,y=l.controls&&l.controls.left||Z.zero,d.relative?(p=Re(_.x+d.x),f=Re(_.y+d.y)):(p=Re(_.x),f=Re(_.y)),l.relative?(g=Re(y.x+l.x),m=Re(y.y+l.y)):(g=Re(y.x),m=Re(y.y)),h=(a===0?ee.move:ee.curve)+" "+p+" "+f+" "+g+" "+m+" "+F+" "+P;break;case ee.move:s=l,h=ee.move+" "+F+" "+P;break;default:h=l.command+" "+F+" "+P}a>=r&&t&&(l.command===ee.curve&&(u=s,b=l.controls&&l.controls.right||l,S=u.controls&&u.controls.left||u,l.relative?(p=Re(b.x+l.x),f=Re(b.y+l.y)):(p=Re(b.x),f=Re(b.y)),u.relative?(g=Re(S.x+u.x),m=Re(S.y+u.y)):(g=Re(S.x),m=Re(S.y)),F=Re(u.x),P=Re(u.y),h+=" C "+p+" "+f+" "+g+" "+m+" "+F+" "+P),l.command!==ee.close&&(h+=" Z")),o+=h+" "}return o},pointsToString:function(e,t){let n="";const r=t*.5;for(let s=0;s<e.length;s++){const o=e[s].x,a=e[s].y-r;n+=ee.move+" "+o+" "+a+" ",n+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return n},getClip:function(e,t){let n=e._renderer.clip;return n||(n=e._renderer.clip=se.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&t.defs.appendChild(n),n},getRendererType:function(e){return e in se?e:"path"},defs:{update:function(e){const{defs:t}=e;if(t._flagUpdate){const n=Array.prototype.slice.call(t.children,0);for(let r=0;r<n.length;r++){const s=n[r],o=s.id,a=`[fill="url(#${o})"],[stroke="url(#${o})"],[clip-path="url(#${o})"]`;e.querySelector(a)||t.removeChild(s)}t._flagUpdate=!1}}},group:{appendChild:function(e){const t=e._renderer.elem;if(!t)return;const n=t.nodeName;!n||/(radial|linear)gradient/i.test(n)||e._clip||this.elem.appendChild(t)},removeChild:function(e){const t=e._renderer.elem;!t||t.parentNode!=this.elem||!t.nodeName||e._clip||this.elem.removeChild(t)},orderChild:function(e){this.elem.appendChild(e._renderer.elem)},renderChild:function(e){const t=se.getRendererType(e._renderer.type);se[t].render.call(e,this)},render:function(e){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;this._update(),this._renderer.elem||(this._renderer.elem=se.createElement("g",{id:this.id}),e.appendChild(this._renderer.elem));const t=this._matrix.manual||this._flagMatrix,n={domElement:e,elem:this._renderer.elem};t&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const s=this.children[r],o=se.getRendererType(s._renderer.type);se[o].render.call(s,e)}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(se.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(se.group.removeChild,n),this._flagOrder&&this.children.forEach(se.group.orderChild,n),this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),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),this.flagReset()}},path:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices){const r=se.toString(this._renderer.vertices,this._closed);t.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this._flagCap&&(t["stroke-linecap"]=this._cap),this._flagJoin&&(t["stroke-linejoin"]=this._join),this._flagMiter&&(t["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=se.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}if(this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const o=this.worldMatrix.elements,a=wi(o[0],o[3],o[1],o[4],o[2],o[5]);r/=Math.max(a.scaleX,a.scaleY)}const s=se.pointsToString(this._renderer.collection,r);t.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}return this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("path",t),e.appendChild(this._renderer.elem)),this.flagReset()}},text:{render:function(e){this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=se.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=se.baselines[this._baseline]||this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._flagDirection&&(t.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("text",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=se.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}if(this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),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(e,t){t||this._update();const n={};if(this._flagId&&(n.id=this._id),this._flagEndPoints&&(n.x1=this.left._x,n.y1=this.left._y,n.x2=this.right._x,n.y2=this.right._y),this._flagSpread&&(n.spreadMethod=this._spread),this._flagUnits&&(n.gradientUnits=this._units),this._renderer.elem?se.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=se.createElement("linearGradient",n)),this._renderer.elem.parentNode===null&&e.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 s=0;s<this.stops.length;s++){const o=this.stops[s],a={};o._flagOffset&&(a.offset=100*o._offset+"%"),o._flagColor&&(a["stop-color"]=o._color),o._flagOpacity&&(a["stop-opacity"]=o._opacity),o._renderer.elem?se.setAttributes(o._renderer.elem,a):o._renderer.elem=se.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(e,t){t||this._update();const n={};if(this._flagId&&(n.id=this._id),this._flagCenter&&(n.cx=this.center._x,n.cy=this.center._y),this._flagFocal&&(n.fx=this.focal._x,n.fy=this.focal._y),this._flagRadius&&(n.r=this._radius),this._flagSpread&&(n.spreadMethod=this._spread),this._flagUnits&&(n.gradientUnits=this._units),this._renderer.elem?se.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=se.createElement("radialGradient",n)),this._renderer.elem.parentNode===null&&e.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 s=0;s<this.stops.length;s++){const o=this.stops[s],a={};o._flagOffset&&(a.offset=100*o._offset+"%"),o._flagColor&&(a["stop-color"]=o._color),o._flagOpacity&&(a["stop-opacity"]=o._opacity),o._renderer.elem?se.setAttributes(o._renderer.elem,a):o._renderer.elem=se.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return this.flagReset()}},texture:{render:function(e,t){t||this._update();const n={},r={x:0,y:0},s=this.image;if(this._flagId&&(n.id=this._id),this._flagLoaded&&this.loaded)switch(s.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=s.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(n.x=this._offset.x,n.y=this._offset.y,s&&(n.x-=s.width/2,n.y-=s.height/2,this._scale instanceof Z?(n.x*=this._scale.x,n.y*=this._scale.y):(n.x*=this._scale,n.y*=this._scale)),n.x>0&&(n.x*=-1),n.y>0&&(n.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(n.width=0,n.height=0,s)){switch(n.width=s.width,n.height=s.height,this._repeat){case"no-repeat":n.width+=1,n.height+=1;break}this._scale instanceof Z?(n.width*=this._scale.x,n.height*=this._scale.y):(n.width*=this._scale,n.height*=this._scale),r.width=n.width,r.height=n.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?se.setAttributes(this._renderer.image,r):this._renderer.image=se.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&se.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=se.createElement("pattern",n)),this._renderer.elem.parentNode===null&&e.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),this.flagReset()}}},Vl=class extends X{constructor(e){super(),this.domElement=e.domElement||se.createElement("svg"),this.scene=new Ue,this.scene.parent=this,this.defs=se.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(e,t){return this.width=e,this.height=t,se.setAttributes(this.domElement,{width:e,height:t}),this.trigger(X.Types.resize,e,t)}render(){return se.group.render.call(this.scene,this.domElement),se.defs.update(this.domElement),this}};w(Vl,"Utils",se);var zt={create:function(e,t,n){const r=e.createShader(e[n]);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){const o=e.getShaderInfoLog(r);throw e.deleteShader(r),new Bt("unable to compile shader "+r+": "+o)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
|
41
41
|
precision mediump float;
|
42
42
|
attribute vec2 a_position;
|
43
43
|
|