@snabcentr/vue-ui-lib 3.2.0 → 3.3.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.
|
@@ -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 Pr=function(){return Pr=Object.assign||function(e){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)&&(e[o]=n[o])}return e},Pr.apply(this,arguments)},Lf={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"}},_n={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Ms=500,Df=(function(){function t(e,n){return this.core=e,this.$LG=n,this.settings=Pr(Pr({},Lf),this.core.settings),this}return t.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},t.prototype.enableZoom=function(e){var n=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){n.isImageSlide(n.core.index)&&(n.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===n.core.index&&n.setZoomEssentials())},r+30)},t.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(_n.slideItemLoad+".zoom",this.enableZoom.bind(this))},t.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},t.prototype.getSwipeCords=function(e){var n=e.touches[0].pageX,r=e.touches[0].pageY;return{x:n,y:r}},t.prototype.getDragAllowedAxises=function(e,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();e?(s=r.offsetHeight*e,o=r.offsetWidth*e):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}},t.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},t.prototype.zoomImage=function(e,n,r,s){if(!(!this.containerRect||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;e===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 m=this.getPossibleSwipeDragCords(n),g,f,p=o-this.pageX,y=a-this.pageY;if(e-n>1){var b=(e-n)/Math.abs(n);p=(n<0?-p:p)+this.left*(b+(n<0?-1:1)),y=(n<0?-y:y)+this.top*(b+(n<0?-1:1)),g=p/b,f=y/b}else{var b=(e-n)*n;g=p*b,f=y*b}r&&(u?this.isBeyondPossibleLeft(g,m.minX)?g=m.minX:this.isBeyondPossibleRight(g,m.maxX)&&(g=m.maxX):e>1&&(g<m.minX?g=m.minX:g>m.maxX&&(g=m.maxX)),h?this.isBeyondPossibleTop(f,m.minY)?f=m.minY:this.isBeyondPossibleBottom(f,m.maxY)&&(f=m.maxY):e>1&&(f<m.minY?f=m.minY:f>m.maxY&&(f=m.maxY))),this.setZoomStyles({x:g,y:f,scale:e}),this.left=g,this.top=f,s&&this.setZoomImageSize()}},t.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var n=this.core.getSlideItem(e).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)}},t.prototype.setZoomImageSize=function(){var e=this,n=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(n.addClass("no-transition"),e.imageReset=!0)},Ms),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var s=e.getDragAllowedAxises(e.scale);n.css("width",n.get().naturalWidth+"px").css("height",n.get().naturalHeight+"px"),e.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")}},Ms+50)},t.prototype.setZoomStyles=function(e){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=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),s.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var o="translate3d("+e.x+"px, "+e.y+"px, 0)";n.css("transform",o)},t.prototype.setActualSize=function(e,n){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var s=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),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},Ms+110)}},t.prototype.getNaturalWidth=function(e){var n=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):n.get().naturalWidth},t.prototype.getActualSizeScale=function(e,n){var r,s;return e>=n?(r=e/n,s=r||2):s=1,s},t.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),n=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||n;return this.getActualSizeScale(r,n)},t.prototype.getPageCords=function(e){var n={};if(e)n.x=e.pageX||e.touches[0].pageX,n.y=e.pageY||e.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},t.prototype.setPageCords=function(e){var n=this.getPageCords(e);this.pageX=n.x,this.pageY=n.y},t.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},t.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},t.prototype.getScale=function(e){var n=this.getCurrentImageActualSizeScale();return e<1?e=1:e>n&&(e=n),e},t.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var n=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var s=e.$LG(r.target);r.touches.length===1&&s.hasClass("lg-image")&&(n?(clearTimeout(n),n=null,r.preventDefault(),e.setActualSize(e.core.index,r)):n=setTimeout(function(){n=null},300))}),this.core.LGel.on(_n.containerResize+".zoom "+_n.rotateRight+".zoom "+_n.rotateLeft+".zoom "+_n.flipHorizontal+".zoom "+_n.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var s=e.scale-e.settings.scale;s<1&&(s=1),e.beginZoom(s),e.zoomImage(s,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(_n.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(_n.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(_n.afterSlide+".zoom",function(r){var s=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(s),e.resetImageTranslate(s),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},t.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},t.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var n=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e: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()},t.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},t.prototype.pinchZoom=function(){var e=this,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=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;s=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",n=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=e.getTouchDistance(l),d=n-c;if(!r&&Math.abs(d)>5&&(r=!0),r){o=e.scale;var h=Math.max(1,s+-d*.02);e.scale=Math.round((h+Number.EPSILON)*100)/100;var u=e.scale-o;e.zoomImage(e.scale,Math.round((u+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,n=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},t.prototype.touchendZoom=function(e,n,r,s,o){var a=n.x-e.x,l=n.y-e.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 m=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(s&&(this.isBeyondPossibleTop(u.y,m.minY)?u.y=m.minY:this.isBeyondPossibleBottom(u.y,m.maxY)&&(u.y=m.maxY)),r&&(this.isBeyondPossibleLeft(u.x,m.minX)?u.x=m.minX:this.isBeyondPossibleRight(u.x,m.maxX)&&(u.x=m.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)},t.prototype.getZoomSwipeCords=function(e,n,r,s,o){var a={};if(s){if(a.y=this.top+(n.y-e.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-e.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},t.prototype.isBeyondPossibleLeft=function(e,n){return e>=n},t.prototype.isBeyondPossibleRight=function(e,n){return e<=n},t.prototype.isBeyondPossibleTop=function(e,n){return e>=n},t.prototype.isBeyondPossibleBottom=function(e,n){return e<=n},t.prototype.isImageSlide=function(e){var n=this.core.galleryItems[e];return this.core.getSlideType(n)==="image"},t.prototype.getPossibleSwipeDragCords=function(e){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;e&&(o=o+e*o,a=a+e*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},t.prototype.setZoomSwipeStyles=function(e,n){e.css("transform","translate3d("+n.x+"px, "+n.y+"px, 0)")},t.prototype.zoomSwipe=function(){var e=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(m){if(e.isImageSlide(e.core.index)&&(u=e.core.getSlideItem(e.core.index),(e.$LG(m.target).hasClass("lg-item")||u.get().contains(m.target))&&m.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){m.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",h=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var g=e.getDragAllowedAxises(0);a=g.allowY,o=g.allowX,(o||a)&&(n=e.getSwipeCords(m)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(m){if(m.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(m.target).hasClass("lg-item")||u.get().contains(m.target))){m.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(m);var g=e.getZoomSwipeCords(n,r,o,a,d);(Math.abs(r.x-n.x)>15||Math.abs(r.y-n.y)>15)&&(s=!0,e.setZoomSwipeStyles(h,g))}}),this.core.$inner.on("touchend.lg",function(m){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(m.target).hasClass("lg-item")||u.get().contains(m.target))){if(m.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!s)return;s=!1,c=new Date;var g=c.valueOf()-l.valueOf();e.touchendZoom(n,r,o,a,g)}})},t.prototype.zoomDrag=function(){var e=this,n={},r={},s=!1,o=!1,a=!1,l=!1,c,d,h,u;this.core.outer.on("mousedown.lg.zoom",function(m){if(e.isImageSlide(e.core.index)){var g=e.core.getSlideItem(e.core.index);if(e.$LG(m.target).hasClass("lg-item")||g.get().contains(m.target)){c=new Date,u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var f=e.getDragAllowedAxises(0);l=f.allowY,a=f.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(m.target).hasClass("lg-object")&&(a||l)&&(m.preventDefault(),n=e.getDragCords(m),h=e.getPossibleSwipeDragCords(),s=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(m){if(s){o=!0,r=e.getDragCords(m);var g=e.getZoomSwipeCords(n,r,a,l,h);e.setZoomSwipeStyles(u,g)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(m){if(s){if(d=new Date,s=!1,e.core.outer.removeClass("lg-zoom-dragging"),o&&(n.x!==r.x||n.y!==r.y)){r=e.getDragCords(m);var g=d.valueOf()-c.valueOf();e.touchendZoom(n,r,a,l,g)}o=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},t.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},t.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},t})();const Hf={ref:"gallery-container",class:"lightgallery-wrapper"},Wf={},ja=i.defineComponent({...Wf,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(t){const e=t,n={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=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,{...e.settings}),O.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",Hf,[i.renderSlot(o.$slots,"default")],512))}}),rt=class rt{static init(){rt.isInitialized||(rt.isInitialized=!0,rt.windowResizeHandler(),window.addEventListener("resize",rt.windowResizeHandler))}static destroy(){window.removeEventListener("resize",rt.windowResizeHandler),rt.isInitialized=!1}static getDeviceTypeByResolution(){const e=G.AppConfigProvider.getConfig().deviceTypeByResolution;return window.innerWidth<e.tablet?Ue.phone:window.innerWidth<e.laptop?Ue.tablet:Ue.laptop}static initRefDependingOnDeviceResolution(e,n,r){const s=i.ref(r);return rt.setRefValueDependingOnDeviceResolution(s,e,n,r),rt.refsDependingOnDeviceResolution.push({r:s,phoneValue:e,tabletValue:n,defaultValue:r}),s}static isPhoneDevice(){return rt.getDeviceTypeByResolution()===Ue.phone}static isTabletDevice(){return rt.getDeviceTypeByResolution()===Ue.tablet}static isLaptopDevice(){return rt.getDeviceTypeByResolution()===Ue.laptop}static setRefValueDependingOnDeviceResolution(e,n,r,s){switch(rt.getDeviceTypeByResolution()){case Ue.phone:e.value=n;break;case Ue.tablet:e.value=r;break;default:e.value=s;break}}static windowResizeHandler(){O.forEach(rt.refsDependingOnDeviceResolution,e=>{rt.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};x(rt,"isInitialized",!1),x(rt,"refsDependingOnDeviceResolution",[]);let bt=rt;const jf=["href"],qf=["src","alt"],Xf={},qa=i.defineComponent({...Xf,__name:"image-gallery",props:{images:{}},setup(t,{expose:e}){const n=i.ref(!1),r=i.ref(!1),s=i.ref({plugins:[zf,Df],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),o=()=>window.innerWidth*(bt.getDeviceTypeByResolution()===Ue.phone?.7:.8),a=i.ref(o()),l=()=>{a.value=o()},c=()=>{n.value=!0};return i.onUnmounted(()=>{window.removeEventListener("resize",l)}),e({show:c}),window.addEventListener("resize",l),(d,h)=>{const u=Wa,m=z.NPopover;return i.openBlock(),i.createBlock(m,{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]=g=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(u)])])]),default:i.withCtx(()=>[i.createVNode(ja,{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(t.images,(g,f)=>(i.openBlock(),i.createElementBlock("a",{key:f,href:g.image},[i.createElementVNode("img",{src:g.preview,alt:`Изображение #${f+1}`},null,8,qf)],8,jf))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),Yf={class:"flex flex-col text-sm"},Uf={},Gf=i.defineComponent({...Uf,__name:"product-stock-count",props:{product:{}},setup(t){return(e,n)=>{const r=Fs,s=z.NPopover;return i.openBlock(),i.createBlock(s,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:i.withCtx(()=>[i.renderSlot(e.$slots,"default",{},()=>[i.createVNode(r)])]),default:i.withCtx(()=>[i.createElementVNode("div",Yf,[(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})}}}),Kf={class:"flex flex-row justify-between"},Zf={key:0},Qf={class:"ml-2 align-sub"},Jf={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},eg={class:"@container"},tg={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},ng={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},ig={class:"text-sc-dark-grey"},rg={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},sg={class:"text-gray-600"},og={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},ag={key:3,class:"underline decoration-dashed"},lg={key:4,class:"sc-product-pack whitespace-nowrap"},cg={class:"text-gray-600"},dg={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},hg={class:"text-gray-600"},ug={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},fg={key:0},gg={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},mg={},tr=i.defineComponent({...mg,__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},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(t,{expose:e}){const n=t,r=i.computed(()=>O.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),s=i.computed(()=>O.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(()=>O.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 e({showProductImagesPreview:l}),(h,u)=>{var b,_,C,S,v;const m=Wa,g=z.NText,f=Ha,p=Fs,y=z.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",Kf,[i.createVNode(g,{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&&t.eventEmitter}),onClick:d},i.toDisplayString(t.product.name),3),t.product.onOrder?(i.openBlock(),i.createElementBlock("span",Zf," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",Qf,[t.product.images&&t.product.images.length>0?(i.openBlock(),i.createBlock(qa,{key:0,ref:"image-gallery",images:t.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",Jf,[i.createVNode(m)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]),_:1}),t.showProductAddToCartButton||t.showProductEditButton||t.showProductRequiredButton||((b=t.productContextButtonsConfig)==null?void 0:b.length)>0?(i.openBlock(),i.createBlock(f,{key:0,product:t.product,"event-emitter":t.eventEmitter,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-edit-button":t.showProductEditButton,"show-product-required-button":t.showProductRequiredButton,"product-context-buttons-config":t.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",eg,[i.createElementVNode("div",tg,[t.product.supplierSku?(i.openBlock(),i.createElementBlock("div",ng,[u[0]||(u[0]=i.createTextVNode(" Артикул производителя/поставщика: ",-1)),i.createElementVNode("span",ig,i.toDisplayString(t.product.supplierSku),1)])):i.createCommentVNode("",!0),t.showCode?(i.openBlock(),i.createElementBlock("span",rg,[u[1]||(u[1]=i.createTextVNode(" Артикул: ",-1)),i.createElementVNode("span",sg,i.toDisplayString(t.product.code),1)])):i.createCommentVNode("",!0),t.product.stockCount&&t.product.stockCount.length>0?(i.openBlock(),i.createBlock(Gf,{key:2,product:t.product},{default:i.withCtx(()=>[i.createElementVNode("span",og,[u[2]||(u[2]=i.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),i.createVNode(p,{class:"mt-0.5"})])]),_:1},8,["product"])):(i.openBlock(),i.createElementBlock("span",ag," Нет в наличии ")),(C=(_=t.product)==null?void 0:_.properties)!=null&&C.pack?(i.openBlock(),i.createElementBlock("span",lg,[u[3]||(u[3]=i.createTextVNode(" Норма упаковки: ",-1)),i.createElementVNode("span",cg,i.toDisplayString((v=(S=t.product)==null?void 0:S.properties)==null?void 0:v.pack),1)])):i.createCommentVNode("",!0),t.showPlanningDates&&o.value?(i.openBlock(),i.createElementBlock("span",dg,[u[4]||(u[4]=i.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),i.createElementVNode("span",hg,i.toDisplayString(o.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(y,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",ug,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,B=>(i.openBlock(),i.createBlock(Er,{key:B.coefficient.slug,product:t.product,"cost-field-name":B.coefficient.slug??"","event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),i.createVNode(Er,{product:t.product,"event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":t.showCostDate,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):i.createCommentVNode("",!0)]),_:1}),t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",fg,[i.createElementVNode("ul",gg,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.product.id,slug:t.product.slug},(B,k)=>(i.openBlock(),i.createElementBlock("li",{key:k}," ("+i.toDisplayString(k)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0),t.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(t.product.properties,(B,k)=>(i.openBlock(),i.createElementBlock("li",{key:k}," ("+i.toDisplayString(k)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),pg=(t,e,n)=>({key:t,title:e,className:"align-top",resizable:!0,render:r=>i.h(Er,{product:r,costFieldName:t,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick,currencyRates:n.currencyRates})}),yg=(t,e)=>{if(t.length===0)return[];const n=[],r={};switch(O.isNil(e.isProductItemSelected)||n.push({key:"checkbox",title:"",className:"align-top",width:"32",render:s=>{var o,a;return i.h(z.NCheckbox,{checked:!!((o=e.isProductItemSelected)!=null&&o.call(e,s)),disabled:((a=e.isProductItemSelected)==null?void 0:a.call(e,s))==="disabled",onUpdateChecked:l=>{e.eventEmitter.emit("product:checked",{product:s,checked:l})}})}}),bt.getDeviceTypeByResolution()){case Ue.phone:case Ue.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:s=>i.h(tr,{product:s,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:s=>i.h(tr,{product:s,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})}),e.showProductCosts&&(O.forEach(t,s=>{O.forEach(s.priceCoefficients,o=>{r[o.coefficient.slug??""]||(r[o.coefficient.slug??""]=o.coefficient)})}),O.forEach(O.sortBy(r,["slug"]),s=>{n.push(pg(s.slug??"",s.name,e))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:s=>i.h(Er,{product:s,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!O.isNil(e.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:s=>i.h(Ha,{product:s,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return n},bg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function _g(t,e){return i.openBlock(),i.createElementBlock("svg",bg,[...e[0]||(e[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 Xa=i.markRaw({name:"ion-trash",render:_g}),wg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function xg(t,e){return i.openBlock(),i.createElementBlock("svg",wg,[...e[0]||(e[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const Ya=i.markRaw({name:"ion-plus",render:xg}),vg={key:0,class:"flex w-fit items-center gap-2"},kg={key:1,class:"flex flex-wrap gap-1"},Cg={key:0},Sg={},nr=i.defineComponent({...Sg,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0}},setup(t){const e=t,n=i.computed(()=>{var r,s;return(s=(r=e.product)==null?void 0:r.properties)==null?void 0:s.planingProductionDate});return(r,s)=>{const o=z.NSpin;return t.isProductSearching?(i.openBlock(),i.createElementBlock("div",vg,[i.createVNode(o,{size:17,class:"w-fit"}),s[0]||(s[0]=i.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):t.product.isNewRec()?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",kg,[i.createElementVNode("div",null,i.toDisplayString(t.product.code)+" - "+i.toDisplayString(t.product.name)+" - "+i.toDisplayString(t.product.costRub.toLocaleString())+" ₽ / "+i.toDisplayString(t.product.unit),1),n.value?(i.openBlock(),i.createElementBlock("div",Cg,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)]))}}}),Bg={class:"flex flex-col gap-4"},Tg={class:"flex flex-col gap-2"},Rg={class:"mt-8 font-bold"},$g={class:"grid grow grid-cols-2 items-start gap-2"},Eg={class:"text-sm"},Ng={class:"font-medium"},Pg={key:0,class:"text-red-500"},Fg={key:2,class:"text-red-500 text-sm mb-2"},Mg={class:"flex flex-col gap-4"},Ag={key:0},Vg={class:"text-lg font-semibold"},Og={class:"flex gap-3"},Ig={},Ua=i.defineComponent({...Ig,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(structuredClone(i.toRaw(n.value.configuratorParams))),o=i.ref(!1),a=i.computed(()=>{var y;const{length:m}=s.value,{quantity:g}=n.value,f=((y=n.value.product)==null?void 0:y.costRub)||0;if(!m||!g||f===0)return null;const p=m/100;return(f*g*p).toLocaleString("ru-ru",{minimumFractionDigits:2})}),l=i.computed(()=>O.reduce(s.value.linesWidths,(m,g)=>m+(g||0),0)),c=i.computed(()=>{const m=l.value;return m>=n.settings.stripMinWidth&&m<=n.settings.stripMaxWidth}),d=i.computed(()=>{const m=O.every(s.value.linesWidths,y=>!!(y&&y>0)),g=O.every(s.value.linesAngles,y=>!O.isNil(y)),f=!!(n.value.quantity&&n.value.quantity>0),p=s.value.length>0&&s.value.length>0;return m&&g&&f&&p&&c.value}),h=()=>{d.value&&(r("update:params",s.value),u("configuratorParams",s.value))},u=(m,g)=>{const f=new G.CartItemBase(n.value);f[m]=g,r("update:value",f)};return i.watch(()=>n.value.configuratorParams,m=>{s.value=O.cloneDeep(i.toRaw(m))},{deep:!0}),i.watch(()=>n.previewParams,m=>{s.value.linesWidths=m.linesWidths,s.value.linesAngles=m.linesAngles},{deep:!0}),(m,g)=>{const f=Ya,p=Xa,y=z.NInput;return i.openBlock(),i.createBlock(i.unref(z.NForm),{class:"grid gap-2 md:grid-cols-2 md:gap-6"},{default:i.withCtx(()=>{var b,_,C,S,v,B,k,R,$,P;return[i.createElementVNode("div",Bg,[g[9]||(g[9]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),t.settings.startTailConfigs&&t.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:s.value.startTailType,"onUpdate:value":[g[0]||(g[0]=I=>s.value.startTailType=I),h],options:t.settings.startTailConfigs.map(({label:I},V)=>({label:I,value:V})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",Tg,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value.linesAngles,(I,V)=>{var A,L,D,ee,E,N;return i.openBlock(),i.createElementBlock("div",{key:V,class:"flex items-start gap-2"},[i.createElementVNode("div",Rg,i.toDisplayString(V+1),1),i.createElementVNode("div",$g,[i.createVNode(i.unref(z.NFormItem),{label:"Ширина, мм",required:!0,feedback:((A=t.validation[`lines_widths[${V+1}]`])==null?void 0:A.feedback)||"","show-feedback":((L=t.validation[`lines_widths[${V+1}]`])==null?void 0:L.showFeedback)||!1,"validation-status":(D=t.validation[`lines_widths[${V+1}]`])==null?void 0:D.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:s.value.linesWidths[V],"onUpdate:value":[H=>s.value.linesWidths[V]=H,h],min:s.value.linesWidths.length>1?t.settings.minLineWidth:t.settings.stripMinWidth,max:t.settings.maxLineWidth,step:t.settings.lineWidthStep,validator:H=>!H||H>=(s.value.linesWidths.length>1?t.settings.minLineWidth:t.settings.stripMinWidth)&&H<=t.settings.maxLineWidth&&H%t.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(z.NFormItem),{label:"Угол сгиба, °",required:!0,feedback:((ee=t.validation[`lines_angles[${V+1}]`])==null?void 0:ee.feedback)||"","show-feedback":((E=t.validation[`lines_angles[${V+1}]`])==null?void 0:E.showFeedback)||!1,"validation-status":(N=t.validation[`lines_angles[${V+1}]`])==null?void 0:N.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:s.value.linesAngles[V],"onUpdate:value":[H=>s.value.linesAngles[V]=H,h],min:t.settings.minLineAngle,max:t.settings.maxLineAngle,step:t.settings.lineAngleStep,validator:H=>!H||H%t.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(z.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:i.withCtx(()=>[t.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,size:"medium",onClick:H=>r("click:add-line",V)},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["onClick"])),t.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,disabled:s.value.linesWidths.length===1,size:"medium",class:"ml-2",onClick:H=>r("click:remove-line",V)},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled","onClick"]))]),_:2},1024)])}),128))]),t.settings.endTailConfigs&&t.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:s.value.endTailType,"onUpdate:value":[g[1]||(g[1]=I=>s.value.endTailType=I),h],options:t.settings.endTailConfigs.map(({label:I},V)=>({label:I,value:V})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(nr,{"is-product-searching":t.isProductSearching,product:t.value.product},null,8,["is-product-searching","product"]),i.createElementVNode("div",Eg,[i.createElementVNode("div",Ng,"Суммарная ширина участков: "+i.toDisplayString(l.value)+" мм",1),c.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Pg," Должна быть от "+i.toDisplayString(t.settings.stripMinWidth)+" до "+i.toDisplayString(t.settings.stripMaxWidth)+" мм ",1))]),d.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Fg," Пожалуйста, заполните все обязательные поля корректно. ")),t.settings.allowSaveTemplates&&t.selectTemplateIndex===((b=t.settings.allTemplates)==null?void 0:b.length)-1?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:3,type:"tertiary",class:"self-start",loading:o.value,onClick:g[2]||(g[2]=I=>r("click:save-template"))},{default:i.withCtx(()=>[...g[8]||(g[8]=[i.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",Mg,[i.createVNode(i.unref(z.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:s.value.colorSide,"onUpdate:value":[g[3]||(g[3]=I=>s.value.colorSide=I),h],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":((_=t.validation.length)==null?void 0:_.showFeedback)||!1,feedback:((C=t.validation.length)==null?void 0:C.feedback)||"","validation-status":(S=t.validation.length)==null?void 0:S.validationStatus,label:`Метраж${t.settings.stripMinLength?" от "+t.settings.stripMinLength:""}${t.settings.stripMaxLength?" до "+t.settings.stripMaxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:s.value.length,"onUpdate:value":[g[4]||(g[4]=I=>s.value.length=I),h],required:!0,max:t.settings.stripMaxLength||void 0,min:t.settings.stripMinLength,step:t.settings.lengthStep,validator:I=>!I||I%t.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(z.NFormItem),{required:!0,"show-feedback":((v=t.validation.quantity)==null?void 0:v.showFeedback)||!1,feedback:((B=t.validation.quantity)==null?void 0:B.feedback)||"","validation-status":(k=t.validation.quantity)==null?void 0:k.validationStatus,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:t.value.quantity,"onUpdate:value":g[5]||(g[5]=I=>t.value.quantity=I),min:1,validator:I=>Number.isInteger(I),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{required:!1,"show-feedback":((R=t.validation.marker)==null?void 0:R.showFeedback)||!1,feedback:(($=t.validation.marker)==null?void 0:$.feedback)||"","validation-status":(P=t.validation.marker)==null?void 0:P.validationStatus,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(y,{value:t.value.marker,"onUpdate:value":g[6]||(g[6]=I=>t.value.marker=I),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["show-feedback","feedback","validation-status"]),a.value?(i.openBlock(),i.createElementBlock("div",Ag,[g[10]||(g[10]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Vg,i.toDisplayString(a.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",Og,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!d.value,type:"primary",class:"self-start",onClick:g[7]||(g[7]=I=>r("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1})}}});var Ga=Object.defineProperty,zg=Object.defineProperties,Lg=Object.getOwnPropertyDescriptors,Ka=Object.getOwnPropertySymbols,Dg=Object.prototype.hasOwnProperty,Hg=Object.prototype.propertyIsEnumerable,Za=t=>{throw TypeError(t)},As=(t,e,n)=>e in t?Ga(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Vs=(t,e)=>{for(var n in e||(e={}))Dg.call(e,n)&&As(t,n,e[n]);if(Ka)for(var n of Ka(e))Hg.call(e,n)&&As(t,n,e[n]);return t},Os=(t,e)=>zg(t,Lg(e)),Qa=(t,e)=>{for(var n in e)Ga(t,n,{get:e[n],enumerable:!0})},w=(t,e,n)=>As(t,typeof e!="symbol"?e+"":e,n),Ja=(t,e,n)=>e.has(t)||Za("Cannot "+n),Tt=(t,e,n)=>(Ja(t,e,"read from private field"),n?n.call(t):e.get(t)),el=(t,e,n)=>e.has(t)?Za("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Wg=(t,e,n,r)=>(Ja(t,e,"write to private field"),e.set(t,n),n),_t={Image:null,isHeadless:!1,shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(n){return this[n]},t.setAttribute=function(n,r){return this[n]=r,this},t},polyfill:function(t,e){return _t.shim(t),typeof e<"u"&&(_t.Image=e),_t.isHeadless=!0,t}},tl={};Qa(tl,{Curve:()=>Ei,getAnchorsFromArcData:()=>Xg,getComponentOnCubicBezier:()=>ir,getControlPoints:()=>ul,getCurveBoundingBox:()=>cl,getCurveFromPoints:()=>hl,getCurveLength:()=>ll,getReflection:()=>Ds,integrate:()=>dl,subdivide:()=>Ls});var nl={};Qa(nl,{HALF_PI:()=>Ze,NumArray:()=>nn,TWO_PI:()=>at,decomposeMatrix:()=>Qn,getComputedMatrix:()=>Is,getEffectiveStrokeWidth:()=>rn,getPoT:()=>sl,lerp:()=>Nt,mod:()=>Pt,setMatrix:()=>rl,toFixed:()=>Ne});var He;typeof window<"u"?He=window:typeof global<"u"?He=global:typeof self<"u"&&(He=self);var il,at=Math.PI*2,Ze=Math.PI*.5;function Qn(t,e,n,r,s,o){let a;return arguments.length<=1?(a=t.a,e=t.b,n=t.c,r=t.d,s=t.e,o=t.f):a=t,{translateX:s,translateY:o,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function rl(t){il=t}function Is(t,e){e=e&&e.identity()||new il;let n=t;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;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Nt(t,e,n){return n*(e-t)+t}var zs=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function sl(t){let e=0;for(;zs[e]&&zs[e]<t;)e++;return zs[e]}function Pt(t,e){for(;t<0;)t+=e;return t%e}var nn=He.Float32Array||Array,jg=Math.floor;function Ne(t){return jg(t*1e6)/1e6}function rn(t,e){const n=t._linewidth;if(t.strokeAttenuation)return n;e||(e=t.worldMatrix||Is(t));const r=Qn(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),s=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return s>0?n/s:n}var te={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},X=class{constructor(){w(this,"_events",{}),w(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let s=0,o=r.length;s<o;s++){e=r[s];let a=this._events[e];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[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];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(e,n,r){const s=this;e&&(o.obj=e,o.name=n,o.handler=r,e.on(n,o));function o(){r.apply(s,arguments)}return s}ignore(e,n,r){return e.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 ol={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(X.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(X.Types.change))}}},qt=class Zi extends X{constructor(e=0,n=0){super(),w(this,"_x",0),w(this,"_y",0);for(let r in ol)Object.defineProperty(this,r,ol[r]);this.x=e,this.y=n}static add(e,n){return new Zi(e.x+n.x,e.y+n.y)}static sub(e,n){return new Zi(e.x-n.x,e.y-n.y)}static subtract(e,n){return Zi.sub(e,n)}static ratioBetween(e,n){return(e.x*n.x+e.y*n.y)/(e.length()*n.length())}static angleBetween(e,n){if(arguments.length>=4){const o=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,o)}const r=e.x-n.x,s=e.y-n.y;return Math.atan2(s,r)}static distanceBetween(e,n){return Math.sqrt(Zi.distanceBetweenSquared(e,n))}static distanceBetweenSquared(e,n){const r=e.x-n.x,s=e.y-n.y;return r*r+s*s}set(e,n){return this.x=e,this.y=n,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 Zi(this.x,this.y)}add(e,n){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+=n),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,n){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-=n),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,n){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*=n),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,n){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/=n),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 n=this.x-e.x,r=this.y-e.y;return n*n+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,n){return n=typeof n>"u"?1e-4:n,this.distanceTo(e)<n}lerp(e,n){const r=(e.x-this.x)*n+this.x,s=(e.y-this.y)*n+this.y;return this.set(r,s)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Ne(this.x),y:Ne(this.y)}}rotate(e){const n=this.x,r=this.y,s=Math.cos(e),o=Math.sin(e);return this.x=n*s-r*o,this.y=n*o+r*s,this}};w(qt,"zero",new qt),w(qt,"left",new qt(-1,0)),w(qt,"right",new qt(1,0)),w(qt,"up",new qt(0,-1)),w(qt,"down",new qt(0,1));var Q=qt,ve=class Ns extends Q{constructor(e=0,n=0,r=0,s=0,o=0,a=0,l=te.move){super(e,n),w(this,"controls",{left:new Q,right:new Q}),w(this,"_command",te.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 al)Object.defineProperty(this,d,al[d]);this.command=l,this.relative=!0;const c=Ns.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(e){return n;function n(){e._bound&&e.dispatchEvent(X.Types.change)}}static fromObject(e){return new Ns().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new Ns().copy(this)}toObject(){return{x:Ne(this.x),y:Ne(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Ne(this.rx),ry:Ne(this.ry),xAxisRotation:Ne(this.xAxisRotation),largeArcFlag:Ne(this.largeArcFlag),sweepFlag:Ne(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},al={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(X.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(X.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(X.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(X.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(X.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(X.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(X.Types.change))}}},qg=0,wt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.21",PublishDate:"2025-10-01T00:18:49.277Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return qg++}},Ei={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function ir(t,e,n,r,s){const o=1-t;return o*o*o*e+3*o*o*t*n+3*o*t*t*r+t*t*t*s}function Ls(t,e,n,r,s,o,a,l,c){c=c||Ei.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new ve(a,l)];const h=[];for(let u=0;u<d;u++){const m=u/d,g=ir(m,t,n,s,a),f=ir(m,e,r,o,l);h.push(new ve(g,f))}return h}function ll(t,e,n,r,s,o,a,l,c){if(t===n&&e===r&&s===a&&o===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-s)+3*(a-t),h=6*(t+s)-12*n,u=3*(n-t),m=9*(r-o)+3*(l-e),g=6*(e+o)-12*r,f=3*(r-e);function p(y){const b=(d*y+h)*y+u,_=(m*y+g)*y+f;return Math.sqrt(b*b+_*_)}return dl(p,0,1,c||Ei.RecursionLimit)}function cl(t,e,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,m,g,f,p,y,b;for(let v=0;v<2;++v){if(v===0?(u=6*t-12*n+6*s,h=-3*t+9*n-9*s+3*a,m=3*n-3*t):(u=6*e-12*r+6*o,h=-3*e+9*r-9*o+3*l,m=3*r-3*e),Math.abs(h)<.001){if(Math.abs(u)<.001)continue;g=-m/u,0<g&&g<1&&c.push(g);continue}y=u*u-4*m*h,b=Math.sqrt(y),!(y<0)&&(f=(-u+b)/(2*h),0<f&&f<1&&c.push(f),p=(-u-b)/(2*h),0<p&&p<1&&c.push(p))}let _=c.length,C=_,S;for(;_--;)g=c[_],S=1-g,d[0][_]=S*S*S*t+3*S*S*g*n+3*S*g*g*s+g*g*g*a,d[1][_]=S*S*S*e+3*S*S*g*r+3*S*g*g*o+g*g*g*l;return d[0][C]=t,d[1][C]=e,d[0][C+1]=a,d[1][C+1]=l,d[0].length=d[1].length=C+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 dl(t,e,n,r){let s=Ei.abscissas[r-2],o=Ei.weights[r-2],a=.5*(n-e),l=a+e,c=0,d=r+1>>1,h=r&1?o[c++]*t(l):0;for(;c<d;){const u=a*s[c];h+=o[c++]*(t(l+u)+t(l-u))}return a*h}function hl(t,e){const n=t.length,r=n-1;for(let s=0;s<n;s++){const o=t[s],a=e?Pt(s-1,n):Math.max(s-1,0),l=e?Pt(s+1,n):Math.min(s+1,r),c=t[a],d=o,h=t[l];ul(c,d,h),d.command=s===0?te.move:te.curve}}function ul(t,e,n){const r=Q.angleBetween(t,e),s=Q.angleBetween(n,e);let o=Q.distanceBetween(t,e),a=Q.distanceBetween(n,e),l=(r+s)/2;return o<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(o*=.33,a*=.33,s<r?l+=Ze:l-=Ze,e.controls.left.x=Math.cos(l)*o,e.controls.left.y=Math.sin(l)*o,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function Ds(t,e,n){return new Q(2*t.x-(e.x+t.x)-(n?t.x:0),2*t.y-(e.y+t.y)-(n?t.y:0))}function Xg(t,e,n,r,s,o,a){const l=wt.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),m=r*Math.sin(h),g=new ve(u,m);g.command=te.line}}var fl=Array.prototype.slice;function Yg(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}var K={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=fl.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let s in r)t[s]=r[s]}return t},defaults:function(t){const e=fl.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let s in r)t[s]===void 0&&(t[s]=r[s])}return t},each:function(t,e,n){const r=n||this,s=!Yg(t)&&Object.keys(t),o=(s||t).length;for(let a=0;a<o;a++){const l=s?s[a]:a;e.call(r,t[l],l,t)}return t},performance:He.performance&&He.performance.now?He.performance:Date},Ft={hasEventListeners:typeof He.addEventListener=="function",bind:function(t,e,n,r){return this.hasEventListeners?t.addEventListener(e,n,!!r):t.attachEvent("on"+e,n),Ft},unbind:function(t,e,n,r){return Ft.hasEventListeners?t.removeEventListeners(e,n,!!r):t.detachEvent("on"+e,n),Ft},getRequestAnimationFrame:function(){const t=["ms","moz","webkit","o"];let e=0,n=He.requestAnimationFrame;if(!n){for(let s=0;s<t.length;s++)n=He[t[s]+"RequestAnimationFrame"]||n;n=n||r}function r(s,o){const a=new Date().getTime(),l=Math.max(0,16-(a-e)),c=He.setTimeout(d,l);e=a+l;function d(){s(a+l)}return c}return n}},Ni=He.document?He.document.createElement("div"):{};Ni.id="help-two-load",Object.defineProperty(Ft,"temp",{enumerable:!0,get:function(){return K.isElement(Ni)&&!He.document.head.contains(Ni)&&(Ni.style.display="none",He.document.head.appendChild(Ni)),Ni}});var Rt=class extends Error{constructor(e){super(),w(this,"name","Two.js"),w(this,"message"),this.message=e}},Ug=He.devicePixelRatio||1;function Gg(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1}function Hs(t){return Ug/Gg(t)}var Fr=class{constructor(){w(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},lt,An=class extends Array{constructor(){super(),el(this,lt,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 Tt(this,lt)}set _events(e){Wg(this,lt,e)}get _bound(){return Tt(this,lt)._bound}set _bound(e){Tt(this,lt)._bound=e}addEventListener(){return Tt(this,lt).addEventListener.apply(this,arguments)}on(){return Tt(this,lt).on.apply(this,arguments)}bind(){return Tt(this,lt).bind.apply(this,arguments)}removeEventListener(){return Tt(this,lt).removeEventListener.apply(this,arguments)}off(){return Tt(this,lt).off.apply(this,arguments)}unbind(){return Tt(this,lt).unbind.apply(this,arguments)}dispatchEvent(){return Tt(this,lt).dispatchEvent.apply(this,arguments)}trigger(){return Tt(this,lt).trigger.apply(this,arguments)}listen(){return Tt(this,lt).listen.apply(this,arguments)}ignore(){return Tt(this,lt).ignore.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(X.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(X.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(X.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(X.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(X.Types.remove,e),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 e}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(e,n){const r=[];for(let s=0;s<this.length;s++){const o=this[s];let a;n?a=e.call(n,o,s):a=e(o,s),r.push(a)}return r}};lt=new WeakMap;var gl=class Mu extends X{constructor(){super(),w(this,"_flagId",!1),w(this,"_flagClassName",!1),w(this,"_renderer",{}),w(this,"_id",wt.Identifier+wt.uniqueId()),w(this,"_className",""),w(this,"classList",[]);for(let e in ml)Object.defineProperty(this,e,ml[e])}static fromObject(e){const n=new Mu().copy(e);return"id"in e&&(n.id=e.id),n}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){const e=this._renderer.type;return this._renderer={type:e},typeof this.unbind=="function"&&this.unbind(),this}};w(gl,"Properties",["renderer","id","className"]);var Pi=gl,ml={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}},Mr,pl={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};He.document&&(Mr=document.createElement("a"));var Xt=class Vt extends Pi{constructor(e,n){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 r in yl)Object.defineProperty(this,r,yl[r]);if(this._renderer.type="texture",this._renderer.flagOffset=Kg.bind(this),this._renderer.flagScale=Zg.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new Q,typeof n=="function"){const r=(function(){this.unbind(X.Types.load,r),typeof n=="function"&&n()}).bind(this);this.bind(X.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const n=new Vt().copy(e);return"id"in e&&(n.id=e.id),n}static getAbsoluteURL(e){return Mr?(Mr.href=e,Mr.href):e}static loadHeadlessBuffer(e,n){e.image.onload=n,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const n=Vt.getAbsoluteURL(e);if(Vt.ImageRegistry.contains(n))return Vt.ImageRegistry.get(n);let r;return _t.Image?(r=new _t.Image,_t.shim(r,"img")):He.document?pl.video.test(n)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,n){let r=e.image,s=Vt.getTag(r);e._flagImage&&(/canvas/i.test(s)?Vt.Register.canvas(e,n):(e._src=!_t.isHeadless&&r.getAttribute("two-src")||r.src,Vt.Register[s](e,n))),e._flagSrc&&(r||(r=Vt.getImage(e.src),e.image=r),s=Vt.getTag(r),Vt.Register[s](e,n))}clone(){const e=new Vt(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 Q?e.offset:new Q().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof Q?e.scale:new Q().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,Vt.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(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};w(Xt,"Properties",["src","loaded","repeat","scale","offset","image"]),w(Xt,"RegularExpressions",pl),w(Xt,"ImageRegistry",new Fr),w(Xt,"Register",{canvas:function(t,e){t._src="#"+t.id,Xt.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){const n=t.image,r=function(o){!_t.isHeadless&&n.removeEventListener&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),typeof e=="function"&&e()},s=function(o){throw!_t.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),new Rt("unable to load "+t.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!_t.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",s,!1)),t._src=Xt.getAbsoluteURL(t._src),!(!_t.isHeadless&&n&&n.getAttribute("two-src"))&&(_t.isHeadless||n.setAttribute("two-src",t.src),Xt.ImageRegistry.add(t.src,n),_t.isHeadless?Xt.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(_t.isHeadless)throw new Rt("video textures are not implemented in headless environments.");const n=function(s){t.image.removeEventListener("canplaythrough",n,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof e=="function"&&e()},r=function(s){throw t.image.removeEventListener("canplaythrough",n,!1),t.image.removeEventListener("error",r,!1),new Rt("unable to load "+t.src)};t._src=Xt.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),Xt.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?n():(t.image.addEventListener("canplaythrough",n,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var Pe=Xt,yl={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=Pe.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Pe.ImageRegistry.contains(n)?this._image=Pe.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(X.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(X.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof Q&&this._scale.unbind(X.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof Q&&this._scale.bind(X.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Kg(){this._flagOffset=!0}function Zg(){this._flagScale=!0}var Ws=class tn extends Pi{constructor(e,n,r){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 s in bl)Object.defineProperty(this,s,bl[s]);this._renderer.type="stop",this.offset=typeof e=="number"?e:tn.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof n=="string"?n:tn.Index<=0?"#fff":"#000",tn.Index=(tn.Index+1)%2}static fromObject(e){const n=new tn().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<tn.Properties.length;n++){const r=tn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new tn;return K.each(tn.Properties,function(r){n[r]=this[r]},this),e&&e.stops&&e.stops.push(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",K.each(tn.Properties,n=>{e[n]=this[n]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};w(Ws,"Index",0),w(Ws,"Properties",["offset","opacity","color"]);var Vn=Ws,bl={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},js=class vi extends Pi{constructor(e){super(),w(this,"_flagStops",!1),w(this,"_flagSpread",!1),w(this,"_flagUnits",!1),w(this,"_spread",""),w(this,"_units","");for(let n in _l)Object.defineProperty(this,n,_l[n]);this._renderer.type="gradient",this._renderer.flagStops=Qg.bind(this),this._renderer.bindStops=Jg.bind(this),this._renderer.unbindStops=em.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let n=e.stops;n&&n.length>0&&(n=n.map(s=>s instanceof Vn?s:new Vn().copy(s)));const r=new vi(n).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const n=this.stops.map(s=>s.clone()),r=new vi(n);return K.each(vi.Properties,s=>{r[s]=this[s]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let n=0;n<vi.Properties.length;n++){const r=vi.Properties[n];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(n=>n.toObject())};return K.each(vi.Properties,n=>{e[n]=this[n]},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}};w(js,"Stop",Vn),w(js,"Properties",["spread","stops","units"]);var Qe=js,_l={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(X.Types.insert,e).unbind(X.Types.remove,n),this._stops=new An((t||[]).slice(0)),this._stops.bind(X.Types.insert,e).bind(X.Types.remove,n),e(this._stops)}}};function Qg(){this._flagStops=!0}function Jg(t){let e=t.length;for(;e--;)t[e].bind(X.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function em(t){let e=t.length;for(;e--;)t[e].unbind(X.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}var qs=class Sr extends Qe{constructor(e,n,r,s,o){super(o),w(this,"_flagEndPoints",!1),w(this,"_left",null),w(this,"_right",null);for(let a in wl)Object.defineProperty(this,a,wl[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=tm.bind(this),this.left=new Q,this.right=new Q,typeof e=="number"&&(this.left.x=e),typeof n=="number"&&(this.left.y=n),typeof r=="number"&&(this.right.x=r),typeof s=="number"&&(this.right.y=s)}static fromObject(e){const n=new Sr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Sr.Properties.length;n++){const r=Sr.Properties[n];r in e&&(this[r]=e[r]instanceof Q?e[r]:new Q().copy(e[r]))}return this}clone(e){const n=this.stops.map(function(s){return s.clone()}),r=new Sr(this.left._x,this.left._y,this.right._x,this.right._y,n);return K.each(Qe.Properties,function(s){r[s]=this[s]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(X.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};w(qs,"Stop",Vn),w(qs,"Properties",["left","right"]);var We=qs,wl={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof Q&&this._left.unbind(X.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(X.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof Q&&this._right.unbind(X.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(X.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function tm(){this._flagEndPoints=!0}var Xs=class ki extends Qe{constructor(e,n,r,s,o,a){super(s),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 l in xl)Object.defineProperty(this,l,xl[l]);this._renderer.type="radial-gradient",this._renderer.flagCenter=nm.bind(this),this._renderer.flagFocal=im.bind(this),this.center=new Q,this.radius=typeof r=="number"?r:1,this.focal=new Q,typeof e=="number"&&(this.center.x=e),typeof n=="number"&&(this.center.y=n),this.focal.copy(this.center),typeof o=="number"&&(this.focal.x=o),typeof a=="number"&&(this.focal.y=a)}static fromObject(e){const n=new ki().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<ki.Properties.length;n++){const r=ki.Properties[n];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof Q?e[r]:new Q().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const n=this.stops.map(function(s){return s.clone()}),r=new ki(this.center._x,this.center._y,this._radius,n,this.focal._x,this.focal._y);return K.each(Qe.Properties.concat(ki.Properties),function(s){r[s]=this[s]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return K.each(ki.Properties,function(n){e[n]=this[n]},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}};w(Xs,"Stop",Vn),w(Xs,"Properties",["center","radius","focal"]);var je=Xs,xl={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(X.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(X.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(X.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(X.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function nm(){this._flagCenter=!0}function im(){this._flagFocal=!0}function vl(t,e){if(e===0||e===1)return!0;const r=t._length*e;let s=0;for(let o=0;o<t._lengths.length;o++){const a=t._lengths[o];if(s>=r)return r-s>=0;s+=a}return!1}function Ar(t,e){const n=t._length;if(e<=0)return 0;if(e>=n)return t._lengths.length-1;for(let r=0,s=0;r<t._lengths.length;r++){if(s+t._lengths[r]>=e)return e-=s,Math.max(r-1,0)+e/t._lengths[r];s+=t._lengths[r]}return-1}function kl(t,e,n){let r,s,o,a,l,c,d,h;const u=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,s=(u||e).x,c=(u||e).y,o=(m||t).x,d=(m||t).y,a=t.x,h=t.y,u&&e._relative&&(s+=e.x,c+=e.y),m&&t._relative&&(o+=t.x,d+=t.y),ll(r,l,s,c,o,d,a,h,n)}function Cl(t,e,n){let r,s,o,a,l,c,d,h;const u=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,s=(u||e).x,c=(u||e).y,o=(m||t).x,d=(m||t).y,a=t.x,h=t.y,u&&e._relative&&(s+=e.x,c+=e.y),m&&t._relative&&(o+=t.x,d+=t.y),Ls(r,l,s,c,o,d,a,h,n)}function Jn(t){switch(t.renderer.type){case"texture":return Pe.fromObject(t);case"gradient":return Qe.fromObject(t);case"linear-gradient":return We.fromObject(t);case"radial-gradient":return je.fromObject(t)}return t}var rm=Math.cos,sm=Math.sin,Sl=Math.tan,Ys=[],Bl=class Ot extends X{constructor(e,n,r,s,o,a){super(),w(this,"elements",new nn(9)),w(this,"manual",!1);let l=e;Array.isArray(l)||(l=Array.prototype.slice.call(arguments)),this.identity(),l.length>0&&this.set(l)}static Multiply(e,n,r){if(n.length<=3){const B=e;let k,R,$;const P=n[0]||0,I=n[1]||0,V=n[2]||0;return k=B[0]*P+B[1]*I+B[2]*V,R=B[3]*P+B[4]*I+B[5]*V,$=B[6]*P+B[7]*I+B[8]*V,[k,R,$]}const s=e[0],o=e[1],a=e[2],l=e[3],c=e[4],d=e[5],h=e[6],u=e[7],m=e[8],g=n[0],f=n[1],p=n[2],y=n[3],b=n[4],_=n[5],C=n[6],S=n[7],v=n[8];return r=r||new nn(9),r[0]=s*g+o*y+a*C,r[1]=s*f+o*b+a*S,r[2]=s*p+o*_+a*v,r[3]=l*g+c*y+d*C,r[4]=l*f+c*b+d*S,r[5]=l*p+c*_+d*v,r[6]=h*g+u*y+m*C,r[7]=h*f+u*b+m*S,r[8]=h*p+u*_+m*v,r}static fromObject(e){return new Ot().copy(e)}set(e,n,r,s,o,a,l,c,d){if(typeof n>"u"){const h=e;e=h[0],n=h[1],r=h[2],s=h[3],o=h[4],a=h[5],l=h[6],c=h[7],d=h[8]}return this.elements[0]=e,this.elements[1]=n,this.elements[2]=r,this.elements[3]=s,this.elements[4]=o,this.elements[5]=a,this.elements[6]=l,this.elements[7]=c,this.elements[8]=d,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]=Ot.Identity[0],this.elements[1]=Ot.Identity[1],this.elements[2]=Ot.Identity[2],this.elements[3]=Ot.Identity[3],this.elements[4]=Ot.Identity[4],this.elements[5]=Ot.Identity[5],this.elements[6]=Ot.Identity[6],this.elements[7]=Ot.Identity[7],this.elements[8]=Ot.Identity[8],this.trigger(X.Types.change)}multiply(e,n,r,s,o,a,l,c,d){if(typeof n>"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 r>"u"&&(r=1),typeof s>"u"){e=e||0,n=n||0,r=r||0,o=this.elements;const L=o[0]*e+o[1]*n+o[2]*r,D=o[3]*e+o[4]*n+o[5]*r,ee=o[6]*e+o[7]*n+o[8]*r;return[L,D,ee]}const h=this.elements,u=[e,n,r,s,o,a,l,c,d],m=h[0],g=h[1],f=h[2],p=h[3],y=h[4],b=h[5],_=h[6],C=h[7],S=h[8],v=u[0],B=u[1],k=u[2],R=u[3],$=u[4],P=u[5],I=u[6],V=u[7],A=u[8];return this.elements[0]=m*v+g*R+f*I,this.elements[1]=m*B+g*$+f*V,this.elements[2]=m*k+g*P+f*A,this.elements[3]=p*v+y*R+b*I,this.elements[4]=p*B+y*$+b*V,this.elements[5]=p*k+y*P+b*A,this.elements[6]=_*v+C*R+S*I,this.elements[7]=_*B+C*$+S*V,this.elements[8]=_*k+C*P+S*A,this.trigger(X.Types.change)}inverse(e){const n=this.elements;e=e||new Ot;const r=n[0],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],d=n[6],h=n[7],u=n[8],m=u*l-c*h,g=-u*a+c*d,f=h*a-l*d;let p=r*m+s*g+o*f;return p?(p=1/p,e.elements[0]=m*p,e.elements[1]=(-u*s+o*h)*p,e.elements[2]=(c*s-o*l)*p,e.elements[3]=g*p,e.elements[4]=(u*r-o*d)*p,e.elements[5]=(-c*r+o*a)*p,e.elements[6]=f*p,e.elements[7]=(-h*r+s*d)*p,e.elements[8]=(l*r-s*a)*p,e):null}scale(e,n){return arguments.length<=1&&(n=e),this.multiply(e,0,0,0,n,0,0,0,1)}rotate(e){const n=rm(e),r=sm(e);return this.multiply(n,-r,0,r,n,0,0,0,1)}translate(e,n){return this.multiply(1,0,e,0,1,n,0,0,1)}skewX(e){const n=Sl(e);return this.multiply(1,n,0,0,1,0,0,0,1)}skewY(e){const n=Sl(e);return this.multiply(1,0,0,n,1,0,0,0,1)}toString(e){return Ys.length=0,this.toTransformArray(e,Ys),Ys.map(Ne).join(" ")}toTransformArray(e,n){const r=this.elements,s=!!n,o=r[0],a=r[1],l=r[2],c=r[3],d=r[4],h=r[5];if(e){const u=r[6],m=r[7],g=r[8];if(s){n[0]=o,n[1]=c,n[2]=u,n[3]=a,n[4]=d,n[5]=m,n[6]=l,n[7]=h,n[8]=g;return}return[o,c,u,a,d,m,l,h,g]}if(s){n[0]=o,n[1]=c,n[2]=a,n[3]=d,n[4]=l,n[5]=h;return}return[o,c,a,d,l,h]}toArray(e,n){const r=this.elements,s=!!n,o=r[0],a=r[1],l=r[2],c=r[3],d=r[4],h=r[5];if(e){const u=r[6],m=r[7],g=r[8];if(s){n[0]=o,n[1]=a,n[2]=l,n[3]=c,n[4]=d,n[5]=h,n[6]=u,n[7]=m,n[8]=g;return}return[o,a,l,c,d,h,u,m,g]}if(s){n[0]=o,n[1]=a,n[2]=l,n[3]=c,n[4]=d,n[5]=h;return}return[o,a,l,c,d,h]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ot().copy(this)}};w(Bl,"Identity",[1,0,0,0,1,0,0,0,1]);var Fi=Bl;rl(Fi);var Tl=class Va extends Pi{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 Vr)Object.defineProperty(this,e,Vr[e]);this._renderer.flagMatrix=Rl.bind(this),this.isShape=!0,this.matrix=new Fi,this.worldMatrix=new Fi,this.position=new Q,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const n=new Va().copy(e);return"id"in e&&(n.id=e.id),n}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return Vr.position.get.apply(this,arguments)}set translation(e){Vr.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 Q?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 Q?e.scale:new Q(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 n=new Va;return n.position.copy(this.position),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._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 Q?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 Q?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}};w(Tl,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var On=Tl,Vr={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(X.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(X.Types.change,this._renderer.flagMatrix),Rl.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof Q&&this._scale.unbind(X.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof Q&&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(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Is(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Rl(){this._flagMatrix=!0}var Mi=Math.min,Ai=Math.max,om=Math.ceil,am=Math.floor,lm=new Q,Us=class Yn extends On{constructor(e,n,r,s){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,"_flagStrokeAttenuation",!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),w(this,"_strokeAttenuation",!0);for(let o in $l)Object.defineProperty(this,o,$l[o]);this._renderer.type="path",this._renderer.flagVertices=El.bind(this),this._renderer.bindVertices=Nl.bind(this),this._renderer.unbindVertices=Pl.bind(this),this._renderer.flagFill=Fl.bind(this),this._renderer.flagStroke=Ml.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!n,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(e){const n=typeof e.fill=="string"?e.fill:Jn(e.fill),r=typeof e.stroke=="string"?e.stroke:Jn(e.stroke),s=new Yn().copy(Os(Vs({},e),{fill:n,stroke:r}));return"id"in e&&(s.id=e.id),s}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let n=0;n<e.vertices.length;n++){const r=e.vertices[n];r instanceof ve?this.vertices.push(e.vertices[n].clone()):this.vertices.push(new ve().copy(r))}}for(let n=0;n<Yn.Properties.length;n++){const r=Yn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new Yn;for(let r=0;r<this.vertices.length;r++)n.vertices.push(this.vertices[r].clone());for(let r=0;r<Yn.Properties.length;r++){const s=Yn.Properties[r];n[s]=this[s]}return n.className=this.className,n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(n=>n.toObject()),K.each(Yn.Properties,n=>{typeof this[n]<"u"&&(this[n].toObject?e[n]=this[n].toObject():e[n]=this[n])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];typeof n.unbind=="function"&&n.unbind(),n.controls&&(n.controls.left&&typeof n.controls.left.unbind=="function"&&n.controls.left.unbind(),n.controls.right&&typeof n.controls.right.unbind=="function"&&n.controls.right.unbind())}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),n=e.width/2,r=e.height/2,s=e.left+e.width/2,o=e.top+e.height/2;for(let a=0;a<this.vertices.length;a++){const l=this.vertices[a];l.x-=s,l.y-=o,l.x+=n,l.y+=r}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=n,this.mask.translation.y-=o,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),n=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const o=this.vertices[s];o.x-=n,o.y-=r}return this.mask&&(this.mask.translation.x-=n,this.mask.translation.y-=r),this}getBoundingClientRect(e){let n,r,s,o,a,l,c=1/0,d=-1/0,h=1/0,u=-1/0;if(this._update(!0),n=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:m,scaleY:g}=Qn(n.elements[0],n.elements[3],n.elements[1],n.elements[4],n.elements[2],n.elements[5]);typeof m=="number"&&typeof g=="number"&&(r=Math.max(m,g)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(o=0;o<s;o++){l=this._renderer.vertices[o],a=this._renderer.vertices[(o+s-1)%s];const[m,g]=n.multiply(a.x,a.y),[f,p]=n.multiply(l.x,l.y);if(a.controls&&l.controls){let y=a.controls.right.x,b=a.controls.right.y;a.relative&&(y+=a.x,b+=a.y);let[_,C]=n.multiply(y,b),S=l.controls.left.x,v=l.controls.left.y;l.relative&&(S+=l.x,v+=l.y);let[B,k]=n.multiply(S,v);const R=cl(m,g,_,C,B,k,f,p);h=Mi(R.min.y-r,h),c=Mi(R.min.x-r,c),d=Ai(R.max.x+r,d),u=Ai(R.max.y+r,u)}else o<=1&&(h=Mi(g-r,h),c=Mi(m-r,c),d=Ai(m+r,d),u=Ai(g+r,u)),h=Mi(p-r,h),c=Mi(f-r,c),d=Ai(f+r,d),u=Ai(p+r,u)}return{top:h,left:c,right:d,bottom:u,width:d-c,height:u-h}}getPointAt(e,n){let r,s,o,a,l,c,d,h,u,m,g,f,p,y,b,_=this.length*Math.min(Math.max(e,0),1);const C=this.vertices.length,S=C-1;let v=null,B=null;for(let E=0,N=this._lengths.length,H=0;E<N;E++){if(H+this._lengths[E]>=_){this._closed?(r=Pt(E,C),s=Pt(E-1,C),E===0&&(r=s,s=E)):(r=E,s=Math.min(Math.max(E-1,0),S)),v=this.vertices[r],B=this.vertices[s],_-=H,this._lengths[E]!==0?e=_/this._lengths[E]:e=0;break}H+=this._lengths[E]}if(v===null||B===null)return null;if(v){if(!B)return v}else return B;b=B.controls&&B.controls.right,y=v.controls&&v.controls.left,l=B.x,m=B.y,c=(b||B).x,g=(b||B).y,d=(y||v).x,f=(y||v).y,h=v.x,p=v.y,b&&B.relative&&(c+=B.x,g+=B.y),y&&v.relative&&(d+=v.x,f+=v.y),a=ir(e,l,c,d,h),u=ir(e,m,g,f,p);const k=Nt(l,c,e),R=Nt(m,g,e),$=Nt(c,d,e),P=Nt(g,f,e),I=Nt(d,h,e),V=Nt(f,p,e),A=Nt(k,$,e),L=Nt(R,P,e),D=Nt($,I,e),ee=Nt(P,V,e);return K.isObject(n)?(n.x=a,n.y=u,n instanceof ve&&(n.controls.left.x=A,n.controls.left.y=L,n.controls.right.x=D,n.controls.right.y=ee,(typeof n.relative!="boolean"||n.relative)&&(n.controls.left.x-=a,n.controls.left.y-=u,n.controls.right.x-=a,n.controls.right.y-=u)),n.t=e,n):(o=new ve(a,u,A-a,L-u,D-a,ee-u,this._curved?te.curve:te.line),o.t=e,o)}plot(){if(this.curved)return hl(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?te.move:te.line;return this}subdivide(e){this._update();const n=this.vertices.length-1,r=this._closed||this.vertices[n]._command===te.close;let s=this.vertices[n],o=[],a;return K.each(this.vertices,function(l,c){if(c<=0&&!r){s=l;return}if(l.command===te.move){o.push(new ve(s.x,s.y)),c>0&&(o[o.length-1].command=te.line),s=l;return}a=Cl(l,s,e),o=o.concat(a),K.each(a,function(d,h){h<=0&&s.command===te.move?d.command=te.move:d.command=te.line}),c>=n&&(this._closed&&this._automatic&&(s=l,a=Cl(l,s,e),o=o.concat(a),K.each(a,function(d,h){h<=0&&s.command===te.move?d.command=te.move:d.command=te.line})),o.push(new ve(l.x,l.y)),o[o.length-1].command=r?te.close:te.line),s=l},this),this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,n){n||this._update();const s=this.vertices.length-1;let o=this.vertices[s],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),K.each(this.vertices,function(l,c){if(c<=0||l.command===te.move){o=l,this._lengths[c]=0;return}this._lengths[c]=kl(l,o,e),a+=this._lengths[c],o=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,n=this._closed,r=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),o=Ar(this,r*this._length),a=Ar(this,s*this._length),l=om(o),c=am(a);let d,h,u,m,g,f;for(this._renderer.vertices.length=0,f=0;f<e;f++)this._renderer.collection.length<=f&&this._renderer.collection.push(new ve),f>c&&!h?(g=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(s,g),g.command=this._renderer.collection[f].command,this._renderer.vertices.push(g),h=g,u=this._collection[f-1],u&&u.controls&&(g.relative?g.controls.right.clear():g.controls.right.copy(g),u.relative?this._renderer.collection[f-1].controls.right.copy(u.controls.right).lerp(Q.zero,1-g.t):this._renderer.collection[f-1].controls.right.copy(u.controls.right).lerp(u,1-g.t))):f>=l&&f<=c&&(g=this._renderer.collection[f].copy(this._collection[f]),this._renderer.vertices.push(g),f===c&&vl(this,s)?(h=g,!n&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):f===l&&vl(this,r)&&(d=g,d.command=te.move,!n&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));l>0&&!d&&(f=l-1,g=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(r,g),g.command=te.move,this._renderer.vertices.unshift(g),m=this._collection[f+1],m&&m.controls&&(g.controls.left.clear(),m.relative?this._renderer.collection[f+1].controls.left.copy(m.controls.left).lerp(Q.zero,g.t):(lm.copy(m),this._renderer.collection[f+1].controls.left.copy(m.controls.left).lerp(m,g.t))))}return On.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,On.prototype.flagReset.call(this),this}};w(Us,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),w(Us,"Utils",{getCurveLength:kl});var Se=Us,$l={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&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(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";K.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(X.Types.insert,e).unbind(X.Types.remove,n),t instanceof An?this._collection=t:this._collection=new An(t||[]),this._collection.bind(X.Types.insert,e).bind(X.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,K.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function El(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Nl(t){let e=t.length;for(;e--;)t[e].bind(X.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Pl(t){let e=t.length;for(;e--;)t[e].unbind(X.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Fl(){this._flagFill=!0}function Ml(){this._flagStroke=!0}var Al=class Br extends Se{constructor(e,n,r,s){const o=[new ve,new ve,new ve,new ve];super(o,!0,!1,!0),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_width",0),w(this,"_height",0),w(this,"_origin",null),this._renderer.type="rectangle";for(let a in Vl)Object.defineProperty(this,a,Vl[a]);this.width=typeof r=="number"?r:1,this.height=typeof s=="number"?s:1,this.origin=new Q,typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n),this._update()}static fromObject(e){const n=new Br().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Br.Properties.length;n++){const r=Br.Properties[n];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof Q&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,n=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new ve),this.vertices[0].set(-e,-n).sub(this._origin).command=te.move,this.vertices[1].set(e,-n).sub(this._origin).command=te.line,this.vertices[2].set(e,n).sub(this._origin).command=te.line,this.vertices[3].set(-e,n).sub(this._origin).command=te.line,this.vertices[4]&&(this.vertices[4].set(-e,-n).sub(this._origin).command=te.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const n=new Br(0,0,this.width,this.height);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Se.Properties.length;r++){const s=Se.Properties[r];n[s]instanceof Q?n[s].copy(this[s]):n[s]=this[s]}return e&&e.add(n),n}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}};w(Al,"Properties",["width","height","origin"]);var In=Al,Vl={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(X.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(X.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Ol=class Tr extends In{constructor(e,n,r,s,o,a){super(n,r,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),this._renderer.type="sprite";for(let l in Il)Object.defineProperty(this,l,Il[l]);this.noStroke(),this.noFill(),e instanceof Pe?this.texture=e:typeof e=="string"&&(this.texture=new Pe(e)),this.origin=new Q,this._update(),typeof s=="number"&&(this.columns=s),typeof o=="number"&&(this.rows=o),typeof a=="number"&&(this.frameRate=a),this.index=0}static fromObject(e){const n=new Tr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Tr.Properties.length;n++){const r=Tr.Properties[n];r in e&&(this[r]=e[r])}return this}play(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=K.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof n=="number"&&(this._lastFrame=n),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const n=new Tr(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&n.play(this._firstFrame,this._lastFrame),n.loop=this.loop,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,n=this._columns,r=this._rows;let s,o,a,l,c,d,h,u,m;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)){h=e.image.width,u=e.image.height,s=h/n,o=u/r,l=this._amount,this.width!==s&&(this.width=s),this.height!==o&&(this.height=o),this._playing&&this._frameRate>0&&(K.isNaN(this._lastFrame)&&(this._lastFrame=l-1),a=K.performance.now()-this._startTime,m=this._lastFrame+1,c=1e3*(m-this._firstFrame)/this._frameRate,this._loop?a=a%c:a=Math.min(a,c),d=Nt(this._firstFrame,m,a/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const g=this._index%n,f=Math.floor(this._index/n),p=-s*g+(h-s)/2,y=-o*f+(u-o)/2;p!==e.offset.x&&(e.offset.x=p),y!==e.offset.y&&(e.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};w(Ol,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var Or=Ol,Il={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},Gs,zl=class extends An{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),el(this,Gs,{}),this.attach(e),this.on(X.Types.insert,this.attach),this.on(X.Types.remove,this.detach)}get ids(){return Tt(this,Gs)}attach(e){for(let n=0;n<e.length;n++){const r=e[n];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let n=0;n<e.length;n++)delete this.ids[e[n].id];return this}};Gs=new WeakMap;var Ll=class Ci extends Se{constructor(e,n,r,s,o,a,l){const c=l||wt.Resolution*3,d=[];for(let h=0;h<c;h++)d.push(new ve);super(d,!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",at),w(this,"_innerRadius",0),w(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let h in Dl)Object.defineProperty(this,h,Dl[h]);typeof r=="number"&&(this.innerRadius=r),typeof s=="number"&&(this.outerRadius=s),typeof o=="number"&&(this.startAngle=o),typeof a=="number"&&(this.endAngle=a),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Ci().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Ci.Properties.length;n++){const r=Ci.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,n=this._endAngle,r=this._innerRadius,s=this._outerRadius,o=Pt(e,at)===Pt(n,at),a=r>0,l=this.vertices;let c=a?l.length/2:l.length,d,h=0,u,m,g,f,p,y,b,_,C;for(o?c--:a||(c-=2),u=0,m=c-1;u<c;u++){switch(g=u/m,f=l[h],p=g*(n-e)+e,y=(n-e)/c,b=s*Math.cos(p),_=s*Math.sin(p),u){case 0:d=te.move;break;default:d=te.curve}f.command=d,f.x=b,f.y=_,f.controls.left.clear(),f.controls.right.clear(),f.command===te.curve&&(C=s*y/Math.PI,f.controls.left.x=C*Math.cos(p-Ze),f.controls.left.y=C*Math.sin(p-Ze),f.controls.right.x=C*Math.cos(p+Ze),f.controls.right.y=C*Math.sin(p+Ze),u===1&&f.controls.left.multiplyScalar(2),u===m&&f.controls.right.multiplyScalar(2)),h++}if(a){for(o?(l[h].command=te.close,h++):(c--,m=c-1),u=0;u<c;u++)g=u/m,f=l[h],p=(1-g)*(n-e)+e,y=(n-e)/c,b=r*Math.cos(p),_=r*Math.sin(p),d=te.curve,u<=0&&(d=o?te.move:te.line),f.command=d,f.x=b,f.y=_,f.controls.left.clear(),f.controls.right.clear(),f.command===te.curve&&(C=r*y/Math.PI,f.controls.left.x=C*Math.cos(p+Ze),f.controls.left.y=C*Math.sin(p+Ze),f.controls.right.x=C*Math.cos(p-Ze),f.controls.right.y=C*Math.sin(p-Ze),u===1&&f.controls.left.multiplyScalar(2),u===m&&f.controls.right.multiplyScalar(2)),h++;l[h].copy(l[0]),l[h].command=te.line}else o||(l[h].command=te.line,l[h].x=0,l[h].y=0,h++,l[h].copy(l[0]),l[h].command=te.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 n=this.innerRadius,r=this.outerRadius,s=this.startAngle,o=this.endAngle,a=this.vertices.length,l=new Ci(0,0,n,r,s,o,a);l.translation.copy(this.translation),l.rotation=this.rotation,l.scale=this.scale,l.skewX=this.skewX,l.skewY=this.skewY,this.matrix.manual&&l.matrix.copy(this.matrix);for(let c=0;c<Se.Properties.length;c++){const d=Se.Properties[c];l[d]=this[d]}return e&&e.add(l),l}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let n=0;n<Ci.Properties.length;n++){const r=Ci.Properties[n];e[r]=this[r]}return e}};w(Ll,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Ks=Ll,Dl={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},Zs=Math.cos,Qs=Math.sin,Hl=class Si extends Se{constructor(e,n,r,s){const o=s?Math.max(s,2):4,a=[];for(let l=0;l<o;l++)a.push(new ve(0,0,0,0,0,0));super(a,!0,!0,!0),w(this,"_flagRadius",!1),w(this,"_radius",0),this._renderer.type="circle";for(let l in Wl)Object.defineProperty(this,l,Wl[l]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Si().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Si.Properties.length;n++){const r=Si.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const n=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,s=r*n;for(let o=0;o<this.vertices.length;o++){const l=o/e*at,c=r*Zs(l),d=r*Qs(l),h=s*Zs(l-Ze),u=s*Qs(l-Ze),m=s*Zs(l+Ze),g=s*Qs(l+Ze),f=this.vertices[o];f.command=o===0?te.move:te.curve,f.set(c,d),f.controls.left.set(h,u),f.controls.right.set(m,g)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const n=new Si(0,0,this.radius,this.vertices.length);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Se.Properties.length;r++){const s=Se.Properties[r];n[s]=this[s]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let n=0;n<Si.Properties.length;n++){const r=Si.Properties[n];e[r]=this[r]}return e}};w(Hl,"Properties",["radius"]);var Ir=Hl,Wl={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Js=Math.cos,eo=Math.sin,jl=class Bi extends Se{constructor(e,n,r,s,o){typeof s!="number"&&typeof r=="number"&&(s=r);const a=o?Math.max(o,2):4,l=[];for(let c=0;c<a;c++)l.push(new ve);super(l,!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 c in ql)Object.defineProperty(this,c,ql[c]);typeof r=="number"&&(this.width=r*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Bi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Bi.Properties.length;n++){const r=Bi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const n=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,s=this._height/2;for(let o=0;o<this.vertices.length;o++){const l=o/e*at,c=r*Js(l),d=s*eo(l),h=r*n*Js(l-Ze),u=s*n*eo(l-Ze),m=r*n*Js(l+Ze),g=s*n*eo(l+Ze),f=this.vertices[o];f.command=o===0?te.move:te.curve,f.set(c,d),f.controls.left.set(h,u),f.controls.right.set(m,g)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const n=this.width/2,r=this.height/2,s=this.vertices.length,o=new Bi(0,0,n,r,s);o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,o.skewX=this.skewX,o.skewY=this.skewY,this.matrix.manual&&o.matrix.copy(this.matrix);for(let a=0;a<Se.Properties.length;a++){const l=Se.Properties[a];o[l]=this[l]}return e&&e.add(o),o}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let n=0;n<Bi.Properties.length;n++){const r=Bi.Properties[n];e[r]=this[r]}return e}};w(jl,"Properties",["width","height"]);var zr=jl,ql={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},cm=Math.ceil,dm=Math.floor,Xl=class Un extends On{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,"_flagStrokeAttenuation",!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,"_strokeAttenuation",!0),w(this,"noFill",Se.prototype.noFill),w(this,"noStroke",Se.prototype.noStroke),w(this,"corner",Se.prototype.corner),w(this,"center",Se.prototype.center),w(this,"getBoundingClientRect",Se.prototype.getBoundingClientRect),w(this,"_updateLength",Se.prototype._updateLength);for(let n in Yl)Object.defineProperty(this,n,Yl[n]);this._renderer.type="points",this._renderer.flagVertices=El.bind(this),this._renderer.bindVertices=Nl.bind(this),this._renderer.unbindVertices=Pl.bind(this),this._renderer.flagFill=Fl.bind(this),this._renderer.flagStroke=Ml.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 n=typeof e.fill=="string"?e.fill:Jn(e.fill),r=typeof e.stroke=="string"?e.stroke:Jn(e.stroke),s=new Un().copy(Os(Vs({},e),{fill:n,stroke:r}));return"id"in e&&(s.id=e.id),s}copy(e){super.copy.call(this,e);for(let n=0;n<e.vertices.length;n++){const r=e.vertices[n];r instanceof ve?this.vertices.push(e.vertices[n].clone()):this.vertices.push(new ve().copy(r))}for(let n=0;n<Un.Properties.length;n++){const r=Un.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new Un;for(let r=0;r<this.vertices.length;r++)n.vertices.push(this.vertices[r].clone());for(let r=0;r<Un.Properties.length;r++){const s=Un.Properties[r];n[s]=this[s]}return n.className=this.className,n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(n=>n.toObject()),K.each(Un.Properties,function(n){typeof this[n]<"u"&&(this[n].toObject?e[n]=this[n].toObject():e[n]=this[n])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];typeof n.unbind=="function"&&n.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(e){this._update();let n=[];for(let r=0;r<this.vertices.length;r++){const s=this.vertices[r],o=this.vertices[r-1];if(!o)continue;const a=s.x,l=s.y,c=o.x,d=o.y,h=Ls(a,l,a,l,c,d,c,d,e);n=n.concat(h)}return this.vertices=n,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),n=Math.max(this._beginning,this._ending),r=Ar(this,e*this._length),s=Ar(this,n*this._length),o=cm(r),a=dm(s);let l=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=o&&d<=a&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[l*2+0]=c.x,this._renderer.vertices[l*2+1]=c.y,l++)}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}};w(Xl,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var to=Xl,Yl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&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(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(X.Types.insert,e).unbind(X.Types.remove,n),t instanceof An?this._collection=t:this._collection=new An(t||[]),this._collection.bind(X.Types.insert,e).bind(X.Types.remove,n),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},hm=Math.cos,um=Math.sin,Ul=class Ti extends Se{constructor(e,n,r,s){s=Math.max(s||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 o in Gl)Object.defineProperty(this,o,Gl[o]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Ti().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Ti.Properties.length;n++){const r=Ti.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,n=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let s=0;s<n;s++){const o=(s+.5)/e,a=at*o+Math.PI/2,l=this._width*hm(a)/2,c=this._height*um(a)/2;s>=r?this.vertices.push(new ve(l,c)):this.vertices[s].set(l,c),this.vertices[s].command=s===0?te.move:te.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const n=new Ti(0,0,0,this.sides);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.width=this.width,n.height=this.height,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Se.Properties.length;r++){const s=Se.Properties[r];n[s]=this[s]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let n=0;n<Ti.Properties.length;n++){const r=Ti.Properties[n];e[r]=this[r]}return e}};w(Ul,"Properties",["width","height","sides"]);var no=Ul,Gl={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},Kl=class Ri extends Se{constructor(e,n,r,s,o){typeof o>"u"&&typeof r=="number"&&typeof s=="number"&&(o=Math.floor(Math.min(r,s)/12));const a=[];for(let l=0;l<10;l++)a.push(new ve(0,0,0,0,0,0,l===0?te.move:te.curve));super(a),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 l in Zl)Object.defineProperty(this,l,Zl[l]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=fm.bind(this),typeof r=="number"&&(this.width=r),typeof s=="number"&&(this.height=s),(typeof o=="number"||o instanceof Q)&&(this.radius=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Ri().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Ri.Properties.length;n++){const r=Ri.Properties[n];if(r in e){const s=e[r];/radius/i.test(r)?this[r]=typeof s=="number"||s instanceof Q?s:new Q().copy(s):typeof s=="number"&&(this[r]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,n=this._height;let r,s;this._radius instanceof Q?(r=this._radius.x,s=this._radius.y):(r=this._radius,s=this._radius);let o,a=e/2,l=n/2;o=this.vertices[0],o.x=-(a-r),o.y=-l,o=this.vertices[1],o.x=a-r,o.y=-l,o.controls.left.clear(),o.controls.right.x=r,o.controls.right.y=0,o=this.vertices[2],o.x=a,o.y=-(l-s),o.controls.right.clear(),o.controls.left.clear(),o=this.vertices[3],o.x=a,o.y=l-s,o.controls.left.clear(),o.controls.right.x=0,o.controls.right.y=s,o=this.vertices[4],o.x=a-r,o.y=l,o.controls.right.clear(),o.controls.left.clear(),o=this.vertices[5],o.x=-(a-r),o.y=l,o.controls.left.clear(),o.controls.right.x=-r,o.controls.right.y=0,o=this.vertices[6],o.x=-a,o.y=l-s,o.controls.left.clear(),o.controls.right.clear(),o=this.vertices[7],o.x=-a,o.y=-(l-s),o.controls.left.clear(),o.controls.right.x=0,o.controls.right.y=-s,o=this.vertices[8],o.x=-(a-r),o.y=-l,o.controls.left.clear(),o.controls.right.clear(),o=this.vertices[9],o.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 n=this.width,r=this.height,s=this.radius,o=new Ri(0,0,n,r,s);o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,o.skewX=this.skewX,o.skewY=this.skewY,this.matrix.manual&&o.matrix.copy(this.matrix);for(let a=0;a<Se.Properties.length;a++){const l=Se.Properties[a];o[l]=this[l]}return e&&e.add(o),o}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let n=0;n<Ri.Properties.length;n++){const r=Ri.Properties[n];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};w(Kl,"Properties",["width","height","radius"]);var Lr=Kl,Zl={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof Q&&this._radius.unbind(X.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof Q&&this._radius.bind(X.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function fm(){this._flagRadius=!0}var gm=Math.cos,mm=Math.sin,Ql=class $i extends Se{constructor(e,n,r,s,o){arguments.length<=3&&(s=r,r=s/2),(typeof o!="number"||o<=0)&&(o=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 a in Jl)Object.defineProperty(this,a,Jl[a]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof s=="number"&&(this.outerRadius=s),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new $i().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<$i.Properties.length;n++){const r=$i.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,n=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let s=0;s<n;s++){const o=(s+.5)/e,a=at*o,l=(s%2?this._outerRadius:this._innerRadius)/2,c=l*gm(a),d=l*mm(a);s>=r?this.vertices.push(new ve(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?te.move:te.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const n=this.innerRadius,r=this.outerRadius,s=this.sides,o=new $i(0,0,n,r,s);o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,o.skewX=this.skewX,o.skewY=this.skewY,this.matrix.manual&&o.matrix.copy(this.matrix);for(let a=0;a<Se.Properties.length;a++){const l=Se.Properties[a];o[l]=this[l]}return e&&e.add(o),o}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let n=0;n<$i.Properties.length;n++){const r=$i.Properties[n];e[r]=this[r]}return e}};w(Ql,"Properties",["innerRadius","outerRadius","sides"]);var io=Ql,Jl={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},ro,ec=Math.min,tc=Math.max;He.document&&(ro=document.createElement("canvas"));var so=class It extends On{constructor(e,n,r,s){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,"_flagStrokeAttenuation",!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),w(this,"_strokeAttenuation",!0);for(let o in nc)Object.defineProperty(this,o,nc[o]);if(this._renderer.type="text",this._renderer.flagFill=pm.bind(this),this._renderer.flagStroke=ym.bind(this),this.value=e,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!K.isObject(s))return this;for(let o=0;o<It.Properties.length;o++){const a=It.Properties[o];a in s&&(this[a]=s[a])}}static Measure(e){if(ro){const n=ro.getContext("2d");n.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=n.measureText(e.value,0,0),s=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:s}}else{const n=this.value.length*this.size*It.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:n,height:r}}}static fromObject(e){const n=typeof e.fill=="string"?e.fill:Jn(e.fill),r=typeof e.stroke=="string"?e.stroke:Jn(e.stroke),s=new It().copy(Os(Vs({},e),{fill:n,stroke:r}));return"id"in e&&(s.id=e.id),s}copy(e){super.copy.call(this,e);for(let n=0;n<It.Properties.length;n++){const r=It.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new It(this.value);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale;for(let r=0;r<It.Properties.length;r++){const s=It.Properties[r];n[s]=this[s]}return this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let n=0;n<It.Properties.length;n++){const r=It.Properties[n];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let n,r,s,o,a;this._update(!0),n=e?this.matrix:this.worldMatrix;const{width:l,height:c}=It.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,s=l+d;break;case"right":r=-(l+d),s=d;break;default:r=-(l/2+d),s=l/2+d}switch(this.baseline){case"middle":o=-(c/2+d),a=c/2+d;break;default:o=-(c+d),a=d}const[h,u]=n.multiply(r,o),[m,g]=n.multiply(r,a),[f,p]=n.multiply(s,o),[y,b]=n.multiply(s,a);return o=ec(u,g,p,b),r=ec(h,m,f,y),s=tc(h,m,f,y),a=tc(u,g,p,b),{top:o,left:r,right:s,bottom:a,width:s-r,height:a-o}}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}};w(so,"Ratio",.6),w(so,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var sn=so,nc={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&this._stroke.bind(X.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,K.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function pm(){this._flagFill=!0}function ym(){this._flagStroke=!0}var oo=class Qi extends In{constructor(e,n,r,s){super(n,r,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),this._renderer.type="image-sequence";for(let o in ic)Object.defineProperty(this,o,ic[o]);this._renderer.flagTextures=bm.bind(this),this._renderer.bindTextures=_m.bind(this),this._renderer.unbindTextures=wm.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(rc.bind(this)):typeof e=="string"&&(this.textures=[rc(e)]),this.origin=new Q,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Qi.DefaultFrameRate,this.index=0}static fromObject(e){const n=new Qi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Qi.Properties.length;n++){const r=Qi.Properties[n];r in e&&(this[r]=e[r])}return this}play(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=K.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof n=="number"&&(this._lastFrame=n),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const n=new Qi(this.textures,this.translation.x,this.translation.y,this.frameRate);return n._loop=this._loop,this._playing&&n.play(),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(n){return n.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const n=this.textures[e];typeof n.dispose=="function"?n.dispose():typeof n.unbind=="function"&&n.unbind()}return this}_update(){const e=this._textures;let n,r,s,o,a,l,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(o=this._amount,K.isNaN(this._lastFrame)&&(this._lastFrame=o-1),s=K.performance.now()-this._startTime,d=this._lastFrame+1,a=1e3*(d-this._firstFrame)/this._frameRate,this._loop?s=s%a:s=Math.min(s,a),c=Nt(this._firstFrame,d,s/a),c=Math.floor(c),c!==this._index&&(this._index=c,l=e[this._index],l.loaded&&(n=l.image.width,r=l.image.height,this.width!==n&&(this.width=n),this.height!==r&&(this.height=r),this.fill=l,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Pe))&&(l=e[this._index],l.loaded&&(n=l.image.width,r=l.image.height,this.width!==n&&(this.width=n),this.height!==r&&(this.height=r)),this.fill=l)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};w(oo,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(oo,"DefaultFrameRate",30);var ao=oo,ic={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(X.Types.insert,e).unbind(X.Types.remove,n),this._textures=new An((t||[]).slice(0)),this._textures.bind(X.Types.insert,e).bind(X.Types.remove,n),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function bm(){this._flagTextures=!0}function _m(t){let e=t.length;for(;e--;)t[e].bind(X.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function wm(t){let e=t.length;for(;e--;)t[e].unbind(X.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function rc(t){if(t instanceof Pe)return t;if(typeof t=="string")return new Pe(t)}var Dr=Math.min,Hr=Math.max,lo=class Gn extends On{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),w(this,"_strokeAttenuation",!0);for(let n in sc)Object.defineProperty(this,n,sc[n]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let n=0;n<e.length;n++)oc.call(this,e[n],this)}static RemoveChildren(e){for(let n=0;n<e.length;n++)oc.call(this,e[n])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const n=new Gn;for(let s=0;s<Gn.Properties.length;s++){const o=Gn.Properties[s];o in e&&(/(fill|stroke)/i.test(o)?n[o]=typeof e[o]=="string"?e[o]:Jn(e[o]):n[o]=e[o])}return"mask"in e&&(n.mask=r(e.mask)),"id"in e&&(n.id=e.id),n.children=e.children.map(r),n;function r(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return Ks.fromObject(s);case"circle":return Ir.fromObject(s);case"element":return Pi.fromObject(s);case"ellipse":return zr.fromObject(s);case"group":return Gn.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return ao.fromObject(s);case"path":return Se.fromObject(s);case"points":return to.fromObject(s);case"polygon":return no.fromObject(s);case"rectangle":return In.fromObject(s);case"rounded-rectangle":return Lr.fromObject(s);case"shape":return On.fromObject(s);case"sprite":return Or.fromObject(s);case"star":return io.fromObject(s);case"text":return sn.fromObject(s)}return s}}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let n=0;n<Gn.Properties.length;n++){const r=Gn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new Gn,r=this.children.map(function(s){return s.clone()});return n.add(r),n.opacity=this.opacity,this.mask&&(n.mask=this.mask),n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.className=this.className,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._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,K.each(this.children,(n,r)=>{e.children[r]=n.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const n=this.children[e];typeof n.dispose=="function"&&n.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}corner(){const e=this.getBoundingClientRect(!0);for(let n=0;n<this.children.length;n++){const r=this.children[n];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),n=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const o=this.children[s];o.isShape&&(o.translation.x-=n,o.translation.y-=r)}return this.mask&&(this.mask.translation.x-=n,this.mask.translation.y-=r),this}getById(e){let n=null;function r(s){if(s.id===e)return s;if(s.children){if(s.children.ids[e])return s.children.ids[e];for(let o=0;o<s.children.length;o++)if(n=r(s.children[o]),n)return n}return null}return r(this)}getByClassName(e){const n=[];function r(s){if(Array.prototype.indexOf.call(s.classList,e)>=0&&n.push(s),s.children)for(let o=0;o<s.children.length;o++){const a=s.children[o];r(a)}return n}return r(this)}getByType(e){const n=[];function r(s){if(s instanceof e&&n.push(s),s.children)for(let o=0;o<s.children.length;o++){const a=s.children[o];r(a)}return n}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let n=0;n<e.length;n++){const r=e[n];if(!(r&&r.id))continue;const s=Array.prototype.indexOf.call(this.children,r);s>=0&&this.children.splice(s,1),this.children.push(r)}return this}remove(e){const n=arguments.length,r=this.parent;if(n<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let s=0;s<e.length;s++){const o=e[s];if(!o||!this.children.ids[o.id])continue;const a=this.children.indexOf(o);a>=0&&this.children.splice(a,1)}return this}getBoundingClientRect(e){let n,r,s,o,a,l;this._update(!0);let c=1/0,d=-1/0,h=1/0,u=-1/0;const m=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let g=0;g<this.children.length;g++){const f=this.children[g];if(!(!f.visible||m.test(f._renderer.type))&&(n=f.getBoundingClientRect(e),s=typeof n.top!="number"||K.isNaN(n.top)||!isFinite(n.top),o=typeof n.left!="number"||K.isNaN(n.left)||!isFinite(n.left),a=typeof n.right!="number"||K.isNaN(n.right)||!isFinite(n.right),l=typeof n.bottom!="number"||K.isNaN(n.bottom)||!isFinite(n.bottom),!(s||o||a||l)))if(e){const[p,y]=r.multiply(n.left,n.top),[b,_]=r.multiply(n.right,n.top),[C,S]=r.multiply(n.left,n.bottom),[v,B]=r.multiply(n.right,n.bottom);h=Dr(y,_,S,B,h),c=Dr(p,b,C,v,c),d=Hr(p,b,C,v,d),u=Hr(y,_,S,B,u)}else h=Dr(n.top,h),c=Dr(n.left,c),d=Hr(n.right,d),u=Hr(n.bottom,u)}return{top:h,left:c,right:d,bottom:u,width:d-c,height:u-h}}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(n){n.subdivide.apply(n,e)}),this}_update(){let e,n,r;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),a=this.length;let l=0;const c=s*a,d=o*a;for(e=0;e<this.children.length;e++)r=this.children[e],n=r.length,c>l+n?(r.beginning=1,r.ending=1):d<l?(r.beginning=0,r.ending=0):c>l&&c<l+n?(r.beginning=(c-l)/n,r.ending=1):d>l&&d<l+n?(r.beginning=0,r.ending=(d-l)/n):(r.beginning=0,r.ending=1),l+=n}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}};w(lo,"Children",zl),w(lo,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var nt=lo,sc={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=nt.InsertChildren.bind(this),n=nt.RemoveChildren.bind(this),r=nt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new zl(t),this._children.bind(X.Types.insert,e),this._children.bind(X.Types.remove,n),this._children.bind(X.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,K.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function oc(t,e){const n=t.parent;let r;if(n===e){s();return}if(n&&n.children.ids[t.id]&&(r=Array.prototype.indexOf.call(n.children,t),n.children.splice(r,1),o()),e){s();return}o(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete t.parent;function s(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function o(){r=Array.prototype.indexOf.call(n.additions,t),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,t),r<0&&(n.subtractions.push(t),n._flagSubtractions=!0)}}var Wr=class extends Se{constructor(e,n,r,s){const o=[new ve(e,n),new ve(r,s)];super(o);for(let a in ac)Object.defineProperty(this,a,ac[a]);this.vertices[0].command=te.move,this.vertices[1].command=te.line,this.automatic=!1}};w(Wr,"Properties",["left","right"]);var ac={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(K.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=te.move;else{const e=new Rt("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(K.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=te.line;else{const e=new Rt("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},on={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},xm={start:"left",middle:"center",end:"right"},lc=["id","class","transform","xmlns","viewBox"],vm=["x","y","width","height","href","xlink:href"];function km(t){return xm[t]}function Cm(t){const e=t.getAttribute("dominant-baseline"),n=t.getAttribute("alignment-baseline");return e||n}function rr(t){return t.replace(/svg:/gi,"").toLowerCase()}function cc(t,e){if(e.x+=t.translateX,e.y+=t.translateY,e.x*=t.scaleX,e.y*=t.scaleY,t.rotation!==0){const n=e.length();e.x=n*Math.cos(t.rotation),e.y=n*Math.sin(t.rotation)}}function Sm(t,e){e||(e={});const n=t.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,"");e[l]=c}return e}function Bm(t){const e={},n=Tm(t),r=Math.max(n.length,t.style.length);for(let s=0;s<r;s++){const o=t.style[s],a=n[s];o&&(e[o]=t.style[o]),a&&(e[a]=t.getAttribute(a))}return e}function Tm(t){const e=t.getAttributeNames();for(let n=0;n<lc.length;n++){const r=lc[n],s=Array.prototype.indexOf.call(e,r);s>=0&&e.splice(s,1)}return e}function Rm(t,e){const n=e.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<t.children.length;u++){const m=t.children[u];"translation"in m?m.translation.add(r,s):"x"in m?m.x=r:"y"in m&&(m.y=s)}const l=typeof t.x=="number",c=typeof t.y=="number",d=typeof t.width=="number",h=typeof t.height=="number";return l&&(t.translation.x+=t.x),c&&(t.translation.y+=t.y),(d||h)&&(t.scale=new Q(1,1)),d&&(t.scale.x=t.width/o),h&&(t.scale.y=t.height/a),t.mask=new In(0,0,o,a),t.mask.origin.set(-o/2,-a/2),t}function Lt(t,e,n){const r={},s={},o={};let a,l,c,d,h,u,m,g,f,p,y,b,_,C,S,v,B;if(t===null)return r;if(He.getComputedStyle){const k=He.getComputedStyle(t);for(a=k.length;a--;)c=k[a],d=k[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<t.attributes.length;a++)u=t.attributes[a],/style/i.test(u.nodeName)?Sm(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&&K.defaults(r,n),K.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=t.gradientTransform&&t.gradientTransform.baseVal&&t.gradientTransform.baseVal.length>0?t.gradientTransform.baseVal[0].matrix:t.getCTM?t.getCTM():null,l===null))break;switch(m=Qn(l),e._renderer.type){case"linear-gradient":cc(m,e.left),cc(m,e.right);break;case"radial-gradient":e.center.x+=m.translateX,e.center.y+=m.translateY,e.focal.x+=m.translateX,e.focal.y+=m.translateY,e.radius*=Math.max(m.scaleX,m.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=t.transform&&t.transform.baseVal&&t.transform.baseVal.length>0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null,l===null))break;m=Qn(l),e.translation.set(m.translateX,m.translateY),e.rotation=Math.PI*(m.rotation/180),e.scale=new Q(m.scaleX,m.scaleY),g=parseFloat((r.x+"").replace("px")),f=parseFloat((r.y+"").replace("px")),g&&(e.translation.x=g),f&&(e.translation.y=f);break;case"visible":if(e instanceof nt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof nt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof nt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof nt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof nt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof nt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if(on.cssBackgroundImage.test(d)&&(p=d.replace(on.cssBackgroundImage,"$1"),ze.defs.current&&ze.defs.current.contains(p)&&(b=ze.defs.current.get(p),b&&b.childNodes.length>0)))switch(b=b.childNodes[0],_=rr(b.nodeName),e.mask=ze[_].call(this,b,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":h=(e instanceof nt?"_":"")+c,on.cssBackgroundImage.test(d)?(p=d.replace(on.cssBackgroundImage,"$1"),ze.defs.current&&ze.defs.current.contains(p)?(b=ze.defs.current.get(p),b.object||(_=rr(b.nodeName),b.object=ze[_].call(this,b,{})),b=b.object):(y=Em(this),b=y.getById(p)),e[h]=b):e[h]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(C=e instanceof Qe,S=e instanceof We,v=e instanceof je,C||S||v)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Rt("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof sn&&(e.family=d);break;case"font-size":e instanceof sn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Rt("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof sn&&(e.weight=d);break;case"font-style":e instanceof sn&&(e.style=d);break;case"text-decoration":e instanceof sn&&(e.decoration=d);break;case"line-height":e instanceof sn&&(e.leading=d);break}return Object.keys(t.dataset).length&&(e.dataset=t.dataset),r}function $m(t,e){for(let n=0,r=t.childNodes.length;n<r;n++){const s=t.childNodes[n];!s.id||rr(t.nodeName)==="#text"||e.add(s.id,s)}}function Em(t){for(;t.parent;)t=t.parent;return t.scene}var ze={svg:function(t){const e=ze.defs.current=new Fr,n=t.getElementsByTagName("defs");for(let f=0;f<n.length;f++)$m(n[f],e);const r=ze.g.call(this,t),s=t.getAttribute("viewBox"),o=t.getAttribute("x"),a=t.getAttribute("y"),l=t.getAttribute("width"),c=t.getAttribute("height");r.defs=e;const d=s!==null,h=o!==null,u=a!==null,m=l!==null,g=c!==null;return h&&(r.x=parseFloat(o.replace(on.unitSuffix,""))),u&&(r.y=parseFloat(a.replace(on.unitSuffix,""))),m&&(r.width=parseFloat(l.replace(on.unitSuffix,""))),g&&(r.height=parseFloat(c.replace(on.unitSuffix,""))),d&&Rm(r,s),delete ze.defs.current,r},defs:function(t){return null},use:function(t,e){let n;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return n=new Rt("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 Rt("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<t.attributes.length;c++){const d=t.attributes[c],h=vm.includes(d.nodeName),u=!a.hasAttribute(d.nodeName);(h||u)&&a.setAttribute(d.nodeName,d.value)}const l=rr(a.nodeName);return ze[l].call(this,a,e)},g:function(t,e){const n=new nt;Lt.call(this,t,n,e),this.add(n);const r=Bm.call(this,t);for(let s=0,o=t.childNodes.length;s<o;s++){const a=t.childNodes[s],l=a.nodeName;if(!l)return;const c=rr(l);if(c in ze){const d=ze[c].call(n,a,r);d&&!d.parent&&n.add(d)}}return n},polygon:function(t,e){let n;typeof t=="string"?n=t:n=t.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 Se(r,!0);return s.stroke="none",s.fill="black",Lt.call(this,t,s,e),s},polyline:function(t,e){const n=ze.polygon.call(this,t,e);return n.closed=!1,n},path:function(t,e){let n;typeof t=="string"?(n=t,t=null):n=t.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;K.each(h.slice(0),function(m,g){const f=m.slice(1).trim().match(on.path),p=m[0],y=p.toLowerCase();let b,_,C,S,v;const B=[];switch(g===0&&(h=[]),y){case"h":case"v":f.length>1&&(b=1);break;case"m":case"l":case"t":f.length>2&&(b=2);break;case"s":case"q":f.length>4&&(b=4);break;case"c":f.length>6&&(b=6);break;case"a":f.length>7&&(b=7);break}if(b){for(_=0,C=f.length,v=0;_<C;_+=b){if(S=p,v>0)switch(p){case"m":S="l";break;case"M":S="L";break}B.push(S+f.slice(_,_+b).join(" ")),v++}h=Array.prototype.concat.apply(h,B)}else h.push(m)}),K.each(h,function(m,g){let f,p,y;const b=m[0],_=b.toLowerCase();d=m.slice(1).trim().match(on.path),o=b===_;let C,S,v,B,k,R,$,P,I,V,A,L,D,ee,E,N,H;switch(_){case"z":if(g>=u)s=!0;else{p=l.x,y=l.y,f=new ve(p,y,void 0,void 0,void 0,void 0,te.close);for(let q=r.length-1;q>=0;q--){const Y=r[q];if(/m/i.test(Y.command)){l=Y;break}}}break;case"m":case"l":c=void 0,p=parseFloat(d[0]),y=parseFloat(d[1]),f=new ve(p,y,void 0,void 0,void 0,void 0,/m/i.test(_)?te.move:te.line),o&&f.addSelf(l),l=f;break;case"h":case"v":V=/h/i.test(_)?"x":"y",A=/x/i.test(V)?"y":"x",f=new ve(void 0,void 0,void 0,void 0,void 0,void 0,te.line),f[V]=parseFloat(d[0]),f[A]=l[A],o&&(f[V]+=l[V]),l=f;break;case"c":case"s":C=l.x,S=l.y,c||(c=new Q),/c/i.test(_)?(v=parseFloat(d[0]),B=parseFloat(d[1]),k=parseFloat(d[2]),R=parseFloat(d[3]),$=parseFloat(d[4]),P=parseFloat(d[5])):(I=Ds(l,c,o),v=I.x,B=I.y,k=parseFloat(d[0]),R=parseFloat(d[1]),$=parseFloat(d[2]),P=parseFloat(d[3])),o&&(v+=C,B+=S,k+=C,R+=S,$+=C,P+=S),l.controls.right.set(v-l.x,B-l.y),f=new ve($,P,k-$,R-P,void 0,void 0,te.curve),l=f,c=f.controls.left;break;case"t":case"q":C=l.x,S=l.y,c||(c=new Q),/q/i.test(_)?(v=parseFloat(d[0]),B=parseFloat(d[1]),k=parseFloat(d[0]),R=parseFloat(d[1]),$=parseFloat(d[2]),P=parseFloat(d[3])):(I=Ds(l,c,o),v=I.x,B=I.y,k=I.x,R=I.y,$=parseFloat(d[0]),P=parseFloat(d[1])),o&&(v+=C,B+=S,k+=C,R+=S,$+=C,P+=S),l.controls.right.set((v-l.x)*.33,(B-l.y)*.33),f=new ve($,P,k-$,R-P,void 0,void 0,te.curve),l=f,c=f.controls.left;break;case"a":C=l.x,S=l.y,D=parseFloat(d[0]),ee=parseFloat(d[1]),E=parseFloat(d[2]),N=parseFloat(d[3]),H=parseFloat(d[4]),$=parseFloat(d[5]),P=parseFloat(d[6]),o&&($+=C,P+=S),L=new ve($,P),L.command=te.arc,L.rx=D,L.ry=ee,L.xAxisRotation=E,L.largeArcFlag=N,L.sweepFlag=H,f=L,l=L,c=void 0;break}f&&(Array.isArray(f)?r=r.concat(f):r.push(f))})}n=new Se(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},K.each(n.vertices,function(l){l.subSelf(a.centroid)}),Lt.call(this,t,n,e),n.translation.addSelf(a.centroid),n},circle:function(t,e){const n=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),s=parseFloat(t.getAttribute("r")),o=new Ir(0,0,s);return o.stroke="none",o.fill="black",Lt.call(this,t,o,e),o.translation.x=n,o.translation.y=r,o},ellipse:function(t,e){const n=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),s=parseFloat(t.getAttribute("rx")),o=parseFloat(t.getAttribute("ry")),a=new zr(0,0,s,o);return a.stroke="none",a.fill="black",Lt.call(this,t,a,e),a.translation.x=n,a.translation.y=r,a},rect:function(t,e){const n=parseFloat(t.getAttribute("rx")),r=parseFloat(t.getAttribute("ry"));if(!K.isNaN(n)||!K.isNaN(r))return ze["rounded-rect"](t);const s=parseFloat(t.getAttribute("width")),o=parseFloat(t.getAttribute("height")),a=s/2,l=o/2,c=new In(0,0,s,o);return c.stroke="none",c.fill="black",Lt.call(this,t,c,e),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(t,e){const n=parseFloat(t.getAttribute("rx"))||0,r=parseFloat(t.getAttribute("ry"))||0,s=parseFloat(t.getAttribute("width")),o=parseFloat(t.getAttribute("height")),a=s/2,l=o/2,c=new Q(n,r),d=new Lr(0,0,s,o,c);return d.stroke="none",d.fill="black",Lt.call(this,t,d,e),d.translation.x+=a,d.translation.y+=l,d},line:function(t,e){const n=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),s=parseFloat(t.getAttribute("x2")),o=parseFloat(t.getAttribute("y2")),a=new Wr(n,r,s,o).noFill();return Lt.call(this,t,a,e),a},lineargradient:function(t,e){let n=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(t.getAttribute("x1")||0),o=parseFloat(t.getAttribute("y1")||0),a=parseFloat(t.getAttribute("x2")||0),l=parseFloat(t.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 m=0;m<t.children.length;m++){const g=t.children[m];let f=g.getAttribute("offset");/%/gi.test(f)&&(f=parseFloat(f.replace(/%/gi,""))/100),f=parseFloat(f);let p=g.getAttribute("stop-color"),y=g.getAttribute("stop-opacity"),b=g.getAttribute("style"),_;p===null&&(_=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,p=_&&_.length>1?_[1]:void 0),y===null?(_=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=_&&_.length>1?parseFloat(_[1]):1):y=parseFloat(y),h.push(new Vn(f,p,y))}const u=new We(s,o,a,l,h);return u.spread=r,u.units=n,Lt.call(this,t,u,e),u},radialgradient:function(t,e){let n=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(t.getAttribute("cx"))||0,o=parseFloat(t.getAttribute("cy"))||0,a=parseFloat(t.getAttribute("r")),l=parseFloat(t.getAttribute("fx")),c=parseFloat(t.getAttribute("fy"));K.isNaN(l)&&(l=s),K.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 g=0;g<t.children.length;g++){const f=t.children[g];let p=f.getAttribute("offset");/%/gi.test(p)&&(p=parseFloat(p.replace(/%/gi,""))/100),p=parseFloat(p);let y=f.getAttribute("stop-color"),b=f.getAttribute("stop-opacity"),_=f.getAttribute("style"),C;y===null&&(C=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,y=C&&C.length>1?C[1]:void 0),b===null?(C=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=C&&C.length>1?parseFloat(C[1]):1):b=parseFloat(b),u.push(new Vn(p,y,b))}const m=new je(s,o,a,u,l,c);return m.spread=r,m.units=n,Lt.call(this,t,m,e),m},text:function(t,e){const n=km(t.getAttribute("text-anchor"))||"left",r=Cm(t)||"baseline";let s="";t.childNodes.length>0&&t.childNodes[0].tagName==="TSPAN"?s=t.childNodes[0].textContent:s=t.textContent;const o=new sn(s);return Lt.call(this,t,o,e),o.alignment=n,o.baseline=r,o},clippath:function(t,e){return ze.defs.current&&!ze.defs.current.contains(t.id)&&ze.defs.current.add(t.id,t),null},image:function(t,e){let n;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return n=new Rt("encountered <image /> with no href."),console.warn(n.name,n.message),null;const s=parseFloat(t.getAttribute("x"))||0,o=parseFloat(t.getAttribute("y"))||0,a=parseFloat(t.getAttribute("width")),l=parseFloat(t.getAttribute("height")),c=new Or(r,s,o);return K.isNaN(a)||(c.width=a),K.isNaN(l)||(c.height=l),Lt.call(this,t,c,e),c}};function dc(t,e){const n=new XMLHttpRequest;return n.open("GET",t),n.onreadystatechange=function(){n.readyState===4&&n.status===200&&e(n.responseText)},n.send(),n}var co=class bn extends In{constructor(e,n,r,s,o,a){super(n,r,s||1,o||1),w(this,"_flagTexture",!1),w(this,"_flagMode",!1),w(this,"_texture",null),w(this,"_mode","fill"),this._renderer.type="image";for(let l in uc)Object.defineProperty(this,l,uc[l]);this.noStroke(),this.noFill(),e instanceof Pe?this.texture=e:typeof e=="string"&&(this.texture=new Pe(e)),typeof a=="string"&&(this.mode=a),this._update()}static fromObject(e){const n=new bn().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<bn.Properties.length;n++){const r=bn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new bn(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const n=e.image.width,r=e.image.height,s=this.width,o=this.height,a=s/n,l=o/r;switch(this._mode){case bn.Modes.fill:{const c=Math.max(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case bn.Modes.fit:{const c=Math.min(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case bn.Modes.crop:break;case bn.Modes.tile:{e.offset.x=(n-s)/2,e.offset.y=(r-o)/2,e.repeat="repeat";break}case bn.Modes.stretch:default:e.scale=new Q(a,l),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};w(co,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),w(co,"Properties",["texture","mode"]);var hc=co,uc={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(t){this._mode=t,this._flagMode=!0}}},ho=[],uo=Math.max,Nm=Math.min,fc=Math.abs,jr=Math.sin,qr=Math.cos,Pm=Math.acos,Xr=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(t){return t in Te?t:"path"},group:{renderChild:function(t){const e=Te.getRendererType(t._renderer.type);Te[e].render.call(t,this.ctx,!0,this.clip)},render:function(t){if(!this._visible)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);const r=this._mask,s=Yr(e),o=!s||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,o&&(t.save(),s||t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const a=Te.getRendererType(r._renderer.type);Te[a].render.call(r,t,!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,t)}return o&&t.restore(),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t,e,n){let r,s,o,a,l,c,d,h,u,m,g,f,p,y,b,_,C,S,v,B,k,R,$,P,I,V,A,L,D,ee,E,N,H,q;if(q=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,D=this._mask,ee=this._clip,l=this._opacity*(q||1),c=this._visible,!e&&(!c||ee||l===0))return this;if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,d=this._cap,h=this._join,u=this._miter,m=this._closed,g=this._renderer.vertices,f=g.length,p=f-1,E=Yr(r),H=this.dashes,E||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),D){const re=Te.getRendererType(D._renderer.type);Te[re].render.call(D,t,!0)}if(a)if(typeof a=="string")t.fillStyle=a;else{const re=Te.getRendererType(a._renderer.type);Te[re].render.call(a,t,this),t.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")t.strokeStyle=s;else{const re=Te.getRendererType(s._renderer.type);Te[re].render.call(s,t,this),t.strokeStyle=s._renderer.effect}o&&(t.lineWidth=rn(this)),u&&(t.miterLimit=u),h&&(t.lineJoin=h),!m&&d&&(t.lineCap=d)}typeof l=="number"&&(t.globalAlpha=l),H&&H.length>0&&(t.lineDashOffset=H.offset||0,t.setLineDash(H)),t.beginPath();let Y,F,M,Z,fe,ie,me;for(let re=0;re<f;re++)switch(_=g[re],A=_.x,L=_.y,_.command){case te.close:t.closePath();break;case te.arc:Y=_.rx,F=_.ry,M=_.xAxisRotation,Z=_.largeArcFlag,fe=_.sweepFlag,y=m?Pt(re-1,f):uo(re-1,0),b=g[y],ie=b.x,me=b.y,Te.renderSvgArcCommand(t,ie,me,Y,F,Z,fe,M,A,L);break;case te.curve:y=m?Pt(re-1,f):Math.max(re-1,0),b=g[y],$=b.controls&&b.controls.right||Q.zero,P=_.controls&&_.controls.left||Q.zero,b._relative?(k=$.x+b.x,R=$.y+b.y):(k=$.x,R=$.y),_._relative?(v=P.x+_.x,B=P.y+_.y):(v=P.x,B=P.y),t.bezierCurveTo(k,R,v,B,A,L),re>=p&&m&&(C=S,I=_.controls&&_.controls.right||Q.zero,V=C.controls&&C.controls.left||Q.zero,_._relative?(k=I.x+_.x,R=I.y+_.y):(k=I.x,R=I.y),C._relative?(v=V.x+C.x,B=V.y+C.y):(v=V.x,B=V.y),A=C.x,L=C.y,t.bezierCurveTo(k,R,v,B,A,L));break;case te.line:t.lineTo(A,L);break;case te.move:S=_,t.moveTo(A,L);break}return m&&t.closePath(),!ee&&!n&&(Te.isHidden.test(a)||(N=a._renderer&&a._renderer.offset,N&&(t.save(),t.translate(-a._renderer.offset.x,-a._renderer.offset.y),t.scale(a._renderer.scale.x,a._renderer.scale.y)),t.fill(),N&&t.restore()),Te.isHidden.test(s)||(N=s._renderer&&s._renderer.offset,N&&(t.save(),t.translate(-s._renderer.offset.x,-s._renderer.offset.y),t.scale(s._renderer.scale.x,s._renderer.scale.y),t.lineWidth=o/s._renderer.scale.x),t.stroke(),N&&t.restore())),E||t.restore(),ee&&!n&&t.clip(),H&&H.length>0&&t.setLineDash(ho),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t,e,n){let r,s,o,a,l,c,d,h,u,m,g,f,p,y,b,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(_||1),c=this._visible,!e&&(!c||l===0))return this;if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,h=this._renderer.collection,u=h.length,p=Yr(r),b=this.dashes,d=this._size,p||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")t.fillStyle=a;else{const v=Te.getRendererType(a._renderer.type);Te[v].render.call(a,t,this),t.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")t.strokeStyle=s;else{const v=Te.getRendererType(s._renderer.type);Te[v].render.call(s,t,this),t.strokeStyle=s._renderer.effect}o&&(t.lineWidth=rn(this))}typeof l=="number"&&(t.globalAlpha=l),b&&b.length>0&&(t.lineDashOffset=b.offset||0,t.setLineDash(b)),t.beginPath();let C=d*.5,S;this._sizeAttenuation||(S=this.worldMatrix.elements,S=Qn(S[0],S[3],S[1],S[4],S[2],S[5]),C/=Math.max(S.scaleX,S.scaleY));for(let v=0;v<u;v++)m=h[v],g=m.x,f=m.y,t.moveTo(g+C,f),t.arc(g,f,C,0,at);return n||(Te.isHidden.test(a)||(y=a._renderer&&a._renderer.offset,y&&(t.save(),t.translate(-a._renderer.offset.x,-a._renderer.offset.y),t.scale(a._renderer.scale.x,a._renderer.scale.y)),t.fill(),y&&t.restore()),Te.isHidden.test(s)||(y=s._renderer&&s._renderer.offset,y&&(t.save(),t.translate(-s._renderer.offset.x,-s._renderer.offset.y),t.scale(s._renderer.scale.x,s._renderer.scale.y),t.lineWidth=o/s._renderer.scale.x),t.stroke(),y&&t.restore())),p||t.restore(),b&&b.length>0&&t.setLineDash(ho),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t,e,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(!e&&(!o||l||s===0))return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,h=this._linewidth,u=this._fill,m=this._decoration,g=this._direction,f=Yr(c),p=u._renderer&&u._renderer.offset&&d._renderer&&d._renderer.offset,y=this.dashes,b=Te.alignments[this._alignment]||this._alignment,_=Te.baselines[this._baseline]||this._baseline;let C,S,v,B,k,R,$,P,I,V,A;if(f||(t.save(),t.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const L=Te.getRendererType(a._renderer.type);Te[L].render.call(a,t,!0)}if(p||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=b,t.textBaseline=_,t.direction=g,u)if(typeof u=="string")t.fillStyle=u;else{const L=Te.getRendererType(u._renderer.type);Te[L].render.call(u,t,this),t.fillStyle=u._renderer.effect}if(d){if(typeof d=="string")t.strokeStyle=d;else{const L=Te.getRendererType(d._renderer.type);Te[L].render.call(d,t,this),t.strokeStyle=d._renderer.effect}h&&(t.lineWidth=rn(this))}if(typeof s=="number"&&(t.globalAlpha=s),y&&y.length>0&&(t.lineDashOffset=y.offset||0,t.setLineDash(y)),!l&&!n&&(Te.isHidden.test(u)||(u._renderer&&u._renderer.offset?(R=u._renderer.scale.x,$=u._renderer.scale.y,t.save(),t.translate(-u._renderer.offset.x,-u._renderer.offset.y),t.scale(R,$),C=this._size/u._renderer.scale.y,S=this._leading/u._renderer.scale.y,t.font=[this._style,this._weight,C+"px/",S+"px",this._family].join(" "),v=u._renderer.offset.x/u._renderer.scale.x,B=u._renderer.offset.y/u._renderer.scale.y,t.fillText(this.value,v,B),t.restore()):t.fillText(this.value,0,0)),Te.isHidden.test(d)||(d._renderer&&d._renderer.offset?(R=d._renderer.scale.x,$=d._renderer.scale.y,t.save(),t.translate(-d._renderer.offset.x,-d._renderer.offset.y),t.scale(R,$),C=this._size/d._renderer.scale.y,S=this._leading/d._renderer.scale.y,t.font=[this._style,this._weight,C+"px/",S+"px",this._family].join(" "),v=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,k=h/d._renderer.scale.x,t.lineWidth=k,t.strokeText(this.value,v,B),t.restore()):t.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(m)){const L=t.measureText(this.value);let D=1;switch(m){case"underline":I=L.actualBoundingBoxDescent,A=L.actualBoundingBoxDescent;break;case"strikethrough":I=0,A=0,D=.5;break}switch(_){case"top":I+=this._size*D,A+=this._size*D;break;case"baseline":case"bottom":I-=this._size*D,A-=this._size*D;break}switch(b){case"left":case"start":P=0,V=L.width;break;case"right":case"end":P=-L.width,V=0;break;default:P=-L.width/2,V=L.width/2}t.lineWidth=Math.max(Math.floor(this._size/15),1),t.strokeStyle=t.fillStyle,t.beginPath(),t.moveTo(P,I),t.lineTo(V,A),t.stroke()}return f||t.restore(),l&&!n&&t.clip(),y&&y.length>0&&t.setLineDash(ho),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(e){if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=e.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=t.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 K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(e){if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=e.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=t.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 K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t){K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=t.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof Q||(this._renderer.offset=new Q),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof Q?(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 Q||(this._renderer.scale=new Q),this._scale instanceof Q?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(t,e,n,r,s,o,a,l,c,d){l=l*Math.PI/180,r=fc(r),s=fc(s);const h=(e-c)/2,u=(n-d)/2,m=qr(l)*h+jr(l)*u,g=-jr(l)*h+qr(l)*u,f=m*m,p=g*g;let y=r*r,b=s*s;const _=f/y+p/b;if(_>1){const L=Xr(_);r=L*r,s=L*s,y=r*r,b=s*s}const C=y*p+b*f,S=(y*b-C)/C;let v=Xr(uo(0,S));o===a&&(v=-v);const B=v*r*g/s,k=-v*s*m/r,R=qr(l)*B-jr(l)*k+(e+c)/2,$=jr(l)*B+qr(l)*k+(n+d)/2,P=gc(1,0,(m-B)/r,(g-k)/s),I=gc((m-B)/r,(g-k)/s,(-m-B)/r,(-g-k)/s)%at,V=P+I;Fm(t,R,$,r,s,P,V,a===0,l)}},ct=class extends X{constructor(t){super();const e=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new nt,this.scene.parent=this}setSize(t,e,n){return this.width=t,this.height=e,this.ratio=typeof n>"u"?Hs(this.ctx):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&K.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this.trigger(X.Types.resize,t,e,n)}render(){const t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Te.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};w(ct,"Utils",Te);function Fm(t,e,n,r,s,o,a,l,c){const d=a-o,h=Ei.Tolerance.epsilon,u=Math.abs(d)<h;let m=Pt(d,at);m<h&&(u?m=0:m=at),l===!0&&!u&&(m===at?m=-at:m=m-at);for(let g=0;g<wt.Resolution;g++){const f=g/(wt.Resolution-1),p=o+f*m;let y=e+r*Math.cos(p),b=n+s*Math.sin(p);if(c!==0){const _=Math.cos(c),C=Math.sin(c),S=y-e,v=b-n;y=S*_-v*C+e,b=S*C+v*_+n}t.lineTo(y,b)}}function gc(t,e,n,r){const s=t*n+e*r,o=Xr(t*t+e*e)*Xr(n*n+r*r);let a=Pm(uo(-1,Nm(1,s/o)));return t*r-e*n<0&&(a=-a),a}function Yr(t){return t[0]===1&&t[3]===0&&t[1]===0&&t[4]===1&&t[2]===0&&t[5]===0}var oe={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(t,e){const n=t,r=document.createElementNS(oe.ns,n);return n==="svg"&&(e=K.defaults(e||{},{version:oe.version})),e&&Object.keys(e).length>0&&oe.setAttributes(r,e),r},setAttributes:function(t,e){const n=Object.keys(e);for(let r=0;r<n.length;r++)/href/.test(n[r])?t.setAttributeNS(oe.xlink,n[r],e[n[r]]):t.setAttribute(n[r],e[n[r]]);return this},removeAttributes:function(t,e){for(let n in e)t.removeAttribute(n);return this},toString:function(t,e){let n=t.length,r=n-1,s,o="";for(let a=0;a<n;a++){const l=t[a],c=e?Pt(a-1,n):Math.max(a-1,0),d=t[c];let h,u,m,g,f,p,y,b,_,C,S,v,B,k,R,$=Ne(l.x),P=Ne(l.y);switch(l.command){case te.close:h=te.close;break;case te.arc:S=l.rx,v=l.ry,B=l.xAxisRotation,k=l.largeArcFlag,R=l.sweepFlag,h=te.arc+" "+S+" "+v+" "+B+" "+k+" "+R+" "+$+" "+P;break;case te.curve:y=d.controls&&d.controls.right||Q.zero,b=l.controls&&l.controls.left||Q.zero,d.relative?(m=Ne(y.x+d.x),g=Ne(y.y+d.y)):(m=Ne(y.x),g=Ne(y.y)),l.relative?(f=Ne(b.x+l.x),p=Ne(b.y+l.y)):(f=Ne(b.x),p=Ne(b.y)),h=(a===0?te.move:te.curve)+" "+m+" "+g+" "+f+" "+p+" "+$+" "+P;break;case te.move:s=l,h=te.move+" "+$+" "+P;break;default:h=l.command+" "+$+" "+P}a>=r&&e&&(l.command===te.curve&&(u=s,_=l.controls&&l.controls.right||l,C=u.controls&&u.controls.left||u,l.relative?(m=Ne(_.x+l.x),g=Ne(_.y+l.y)):(m=Ne(_.x),g=Ne(_.y)),u.relative?(f=Ne(C.x+u.x),p=Ne(C.y+u.y)):(f=Ne(C.x),p=Ne(C.y)),$=Ne(u.x),P=Ne(u.y),h+=" C "+m+" "+g+" "+f+" "+p+" "+$+" "+P),l.command!==te.close&&(h+=" Z")),o+=h+" "}return o},pointsToString:function(t,e){let n="";const r=e*.5;for(let s=0;s<t.length;s++){const o=t[s].x,a=t[s].y-r;n+=te.move+" "+o+" "+a+" ",n+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return n},getClip:function(t,e){let n=t._renderer.clip;return n||(n=t._renderer.clip=oe.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&e.defs.appendChild(n),n},getRendererType:function(t){return t in oe?t:"path"},defs:{update:function(t){const{defs:e}=t;if(e._flagUpdate){const n=Array.prototype.slice.call(e.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})"]`;t.querySelector(a)||e.removeChild(s)}e._flagUpdate=!1}}},group:{appendChild:function(t){const e=t._renderer.elem;if(!e)return;const n=e.nodeName;!n||/(radial|linear)gradient/i.test(n)||t._clip||this.elem.appendChild(e)},removeChild:function(t){const e=t._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||t._clip||this.elem.removeChild(e)},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){const e=oe.getRendererType(t._renderer.type);oe[e].render.call(t,this)},render:function(t){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=oe.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,n={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const s=this.children[r],o=oe.getRendererType(s._renderer.type);oe[o].render.call(s,t)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(oe.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(oe.group.removeChild,n),this._flagOrder&&this.children.forEach(oe.group.orderChild,n),this._flagMask)if(this._mask){const r=oe.getRendererType(this._mask._renderer.type);oe[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=oe.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=oe.getRendererType(this._stroke._renderer.type);oe[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=rn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?oe.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=oe.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=oe.getClip(this,t),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=oe.getRendererType(this._mask._renderer.type);oe[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const o=this.worldMatrix.elements,a=Qn(o[0],o[3],o[1],o[4],o[2],o[5]);r/=Math.max(a.scaleX,a.scaleY)}const s=oe.pointsToString(this._renderer.collection,r);e.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=oe.getRendererType(this._stroke._renderer.type);oe[r].render.call(this._stroke,t,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=rn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?oe.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=oe.createElement("path",e),t.appendChild(this._renderer.elem)),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=oe.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=oe.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=oe.getRendererType(this._stroke._renderer.type);oe[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=rn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?oe.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=oe.createElement("text",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=oe.getClip(this,t),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=oe.getRendererType(this._mask._renderer.type);oe[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||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?oe.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=oe.createElement("linearGradient",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let 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?oe.setAttributes(o._renderer.elem,a):o._renderer.elem=oe.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(t,e){K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||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?oe.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=oe.createElement("radialGradient",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let 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?oe.setAttributes(o._renderer.elem,a):o._renderer.elem=oe.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(t,e){K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||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 Q?(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 Q?(n.width*=this._scale.x,n.height*=this._scale.y):(n.width*=this._scale,n.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=n.width,r.height=n.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?oe.setAttributes(this._renderer.image,r):this._renderer.image=oe.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&oe.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=oe.createElement("pattern",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},mc=class extends X{constructor(t){super(),this.domElement=t.domElement||oe.createElement("svg"),this.scene=new nt,this.scene.parent=this,this.defs=oe.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,e){return this.width=t,this.height=e,oe.setAttributes(this.domElement,{width:t,height:e}),this.trigger(X.Types.resize,t,e)}render(){return oe.group.render.call(this.scene,this.domElement),oe.defs.update(this.domElement),this}};w(mc,"Utils",oe);var Dt={create:function(t,e,n){const r=t.createShader(t[n]);if(t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Rt("unable to compile shader "+r+": "+o)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
|
|
40
|
+
***************************************************************************** */var Pr=function(){return Pr=Object.assign||function(e){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)&&(e[o]=n[o])}return e},Pr.apply(this,arguments)},Lf={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"}},_n={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Ms=500,Df=(function(){function t(e,n){return this.core=e,this.$LG=n,this.settings=Pr(Pr({},Lf),this.core.settings),this}return t.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},t.prototype.enableZoom=function(e){var n=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){n.isImageSlide(n.core.index)&&(n.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===n.core.index&&n.setZoomEssentials())},r+30)},t.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(_n.slideItemLoad+".zoom",this.enableZoom.bind(this))},t.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},t.prototype.getSwipeCords=function(e){var n=e.touches[0].pageX,r=e.touches[0].pageY;return{x:n,y:r}},t.prototype.getDragAllowedAxises=function(e,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();e?(s=r.offsetHeight*e,o=r.offsetWidth*e):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}},t.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},t.prototype.zoomImage=function(e,n,r,s){if(!(!this.containerRect||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;e===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 m=this.getPossibleSwipeDragCords(n),g,f,p=o-this.pageX,y=a-this.pageY;if(e-n>1){var b=(e-n)/Math.abs(n);p=(n<0?-p:p)+this.left*(b+(n<0?-1:1)),y=(n<0?-y:y)+this.top*(b+(n<0?-1:1)),g=p/b,f=y/b}else{var b=(e-n)*n;g=p*b,f=y*b}r&&(u?this.isBeyondPossibleLeft(g,m.minX)?g=m.minX:this.isBeyondPossibleRight(g,m.maxX)&&(g=m.maxX):e>1&&(g<m.minX?g=m.minX:g>m.maxX&&(g=m.maxX)),h?this.isBeyondPossibleTop(f,m.minY)?f=m.minY:this.isBeyondPossibleBottom(f,m.maxY)&&(f=m.maxY):e>1&&(f<m.minY?f=m.minY:f>m.maxY&&(f=m.maxY))),this.setZoomStyles({x:g,y:f,scale:e}),this.left=g,this.top=f,s&&this.setZoomImageSize()}},t.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var n=this.core.getSlideItem(e).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)}},t.prototype.setZoomImageSize=function(){var e=this,n=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(n.addClass("no-transition"),e.imageReset=!0)},Ms),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var s=e.getDragAllowedAxises(e.scale);n.css("width",n.get().naturalWidth+"px").css("height",n.get().naturalHeight+"px"),e.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")}},Ms+50)},t.prototype.setZoomStyles=function(e){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=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),s.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var o="translate3d("+e.x+"px, "+e.y+"px, 0)";n.css("transform",o)},t.prototype.setActualSize=function(e,n){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var s=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),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},Ms+110)}},t.prototype.getNaturalWidth=function(e){var n=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):n.get().naturalWidth},t.prototype.getActualSizeScale=function(e,n){var r,s;return e>=n?(r=e/n,s=r||2):s=1,s},t.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),n=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||n;return this.getActualSizeScale(r,n)},t.prototype.getPageCords=function(e){var n={};if(e)n.x=e.pageX||e.touches[0].pageX,n.y=e.pageY||e.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},t.prototype.setPageCords=function(e){var n=this.getPageCords(e);this.pageX=n.x,this.pageY=n.y},t.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},t.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},t.prototype.getScale=function(e){var n=this.getCurrentImageActualSizeScale();return e<1?e=1:e>n&&(e=n),e},t.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var n=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var s=e.$LG(r.target);r.touches.length===1&&s.hasClass("lg-image")&&(n?(clearTimeout(n),n=null,r.preventDefault(),e.setActualSize(e.core.index,r)):n=setTimeout(function(){n=null},300))}),this.core.LGel.on(_n.containerResize+".zoom "+_n.rotateRight+".zoom "+_n.rotateLeft+".zoom "+_n.flipHorizontal+".zoom "+_n.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var s=e.scale-e.settings.scale;s<1&&(s=1),e.beginZoom(s),e.zoomImage(s,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(_n.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(_n.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(_n.afterSlide+".zoom",function(r){var s=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(s),e.resetImageTranslate(s),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},t.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},t.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var n=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e: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()},t.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},t.prototype.pinchZoom=function(){var e=this,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=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;s=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",n=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=e.getTouchDistance(l),d=n-c;if(!r&&Math.abs(d)>5&&(r=!0),r){o=e.scale;var h=Math.max(1,s+-d*.02);e.scale=Math.round((h+Number.EPSILON)*100)/100;var u=e.scale-o;e.zoomImage(e.scale,Math.round((u+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,n=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},t.prototype.touchendZoom=function(e,n,r,s,o){var a=n.x-e.x,l=n.y-e.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 m=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(s&&(this.isBeyondPossibleTop(u.y,m.minY)?u.y=m.minY:this.isBeyondPossibleBottom(u.y,m.maxY)&&(u.y=m.maxY)),r&&(this.isBeyondPossibleLeft(u.x,m.minX)?u.x=m.minX:this.isBeyondPossibleRight(u.x,m.maxX)&&(u.x=m.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)},t.prototype.getZoomSwipeCords=function(e,n,r,s,o){var a={};if(s){if(a.y=this.top+(n.y-e.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-e.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},t.prototype.isBeyondPossibleLeft=function(e,n){return e>=n},t.prototype.isBeyondPossibleRight=function(e,n){return e<=n},t.prototype.isBeyondPossibleTop=function(e,n){return e>=n},t.prototype.isBeyondPossibleBottom=function(e,n){return e<=n},t.prototype.isImageSlide=function(e){var n=this.core.galleryItems[e];return this.core.getSlideType(n)==="image"},t.prototype.getPossibleSwipeDragCords=function(e){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;e&&(o=o+e*o,a=a+e*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},t.prototype.setZoomSwipeStyles=function(e,n){e.css("transform","translate3d("+n.x+"px, "+n.y+"px, 0)")},t.prototype.zoomSwipe=function(){var e=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(m){if(e.isImageSlide(e.core.index)&&(u=e.core.getSlideItem(e.core.index),(e.$LG(m.target).hasClass("lg-item")||u.get().contains(m.target))&&m.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){m.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",h=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var g=e.getDragAllowedAxises(0);a=g.allowY,o=g.allowX,(o||a)&&(n=e.getSwipeCords(m)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(m){if(m.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(m.target).hasClass("lg-item")||u.get().contains(m.target))){m.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(m);var g=e.getZoomSwipeCords(n,r,o,a,d);(Math.abs(r.x-n.x)>15||Math.abs(r.y-n.y)>15)&&(s=!0,e.setZoomSwipeStyles(h,g))}}),this.core.$inner.on("touchend.lg",function(m){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(m.target).hasClass("lg-item")||u.get().contains(m.target))){if(m.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!s)return;s=!1,c=new Date;var g=c.valueOf()-l.valueOf();e.touchendZoom(n,r,o,a,g)}})},t.prototype.zoomDrag=function(){var e=this,n={},r={},s=!1,o=!1,a=!1,l=!1,c,d,h,u;this.core.outer.on("mousedown.lg.zoom",function(m){if(e.isImageSlide(e.core.index)){var g=e.core.getSlideItem(e.core.index);if(e.$LG(m.target).hasClass("lg-item")||g.get().contains(m.target)){c=new Date,u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var f=e.getDragAllowedAxises(0);l=f.allowY,a=f.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(m.target).hasClass("lg-object")&&(a||l)&&(m.preventDefault(),n=e.getDragCords(m),h=e.getPossibleSwipeDragCords(),s=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(m){if(s){o=!0,r=e.getDragCords(m);var g=e.getZoomSwipeCords(n,r,a,l,h);e.setZoomSwipeStyles(u,g)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(m){if(s){if(d=new Date,s=!1,e.core.outer.removeClass("lg-zoom-dragging"),o&&(n.x!==r.x||n.y!==r.y)){r=e.getDragCords(m);var g=d.valueOf()-c.valueOf();e.touchendZoom(n,r,a,l,g)}o=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},t.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},t.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},t})();const Hf={ref:"gallery-container",class:"lightgallery-wrapper"},Wf={},ja=i.defineComponent({...Wf,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(t){const e=t,n={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=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,{...e.settings}),O.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",Hf,[i.renderSlot(o.$slots,"default")],512))}}),rt=class rt{static init(){rt.isInitialized||(rt.isInitialized=!0,rt.windowResizeHandler(),window.addEventListener("resize",rt.windowResizeHandler))}static destroy(){window.removeEventListener("resize",rt.windowResizeHandler),rt.isInitialized=!1}static getDeviceTypeByResolution(){const e=G.AppConfigProvider.getConfig().deviceTypeByResolution;return window.innerWidth<e.tablet?Ue.phone:window.innerWidth<e.laptop?Ue.tablet:Ue.laptop}static initRefDependingOnDeviceResolution(e,n,r){const s=i.ref(r);return rt.setRefValueDependingOnDeviceResolution(s,e,n,r),rt.refsDependingOnDeviceResolution.push({r:s,phoneValue:e,tabletValue:n,defaultValue:r}),s}static isPhoneDevice(){return rt.getDeviceTypeByResolution()===Ue.phone}static isTabletDevice(){return rt.getDeviceTypeByResolution()===Ue.tablet}static isLaptopDevice(){return rt.getDeviceTypeByResolution()===Ue.laptop}static setRefValueDependingOnDeviceResolution(e,n,r,s){switch(rt.getDeviceTypeByResolution()){case Ue.phone:e.value=n;break;case Ue.tablet:e.value=r;break;default:e.value=s;break}}static windowResizeHandler(){O.forEach(rt.refsDependingOnDeviceResolution,e=>{rt.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};x(rt,"isInitialized",!1),x(rt,"refsDependingOnDeviceResolution",[]);let bt=rt;const jf=["href"],qf=["src","alt"],Xf={},qa=i.defineComponent({...Xf,__name:"image-gallery",props:{images:{}},setup(t,{expose:e}){const n=i.ref(!1),r=i.ref(!1),s=i.ref({plugins:[zf,Df],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),o=()=>window.innerWidth*(bt.getDeviceTypeByResolution()===Ue.phone?.7:.8),a=i.ref(o()),l=()=>{a.value=o()},c=()=>{n.value=!0};return i.onUnmounted(()=>{window.removeEventListener("resize",l)}),e({show:c}),window.addEventListener("resize",l),(d,h)=>{const u=Wa,m=z.NPopover;return i.openBlock(),i.createBlock(m,{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]=g=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(u)])])]),default:i.withCtx(()=>[i.createVNode(ja,{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(t.images,(g,f)=>(i.openBlock(),i.createElementBlock("a",{key:f,href:g.image},[i.createElementVNode("img",{src:g.preview,alt:`Изображение #${f+1}`},null,8,qf)],8,jf))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),Yf={class:"flex flex-col text-sm"},Uf={},Gf=i.defineComponent({...Uf,__name:"product-stock-count",props:{product:{}},setup(t){return(e,n)=>{const r=Fs,s=z.NPopover;return i.openBlock(),i.createBlock(s,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:i.withCtx(()=>[i.renderSlot(e.$slots,"default",{},()=>[i.createVNode(r)])]),default:i.withCtx(()=>[i.createElementVNode("div",Yf,[(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})}}}),Kf={class:"flex flex-row justify-between"},Zf={key:0},Qf={class:"ml-2 align-sub"},Jf={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},eg={class:"@container"},tg={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},ng={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},ig={class:"text-sc-dark-grey"},rg={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},sg={class:"text-gray-600"},og={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},ag={key:3,class:"underline decoration-dashed"},lg={key:4,class:"sc-product-pack whitespace-nowrap"},cg={class:"text-gray-600"},dg={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},hg={class:"text-gray-600"},ug={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},fg={key:0},gg={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},mg={},tr=i.defineComponent({...mg,__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},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(t,{expose:e}){const n=t,r=i.computed(()=>O.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),s=i.computed(()=>O.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(()=>O.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 e({showProductImagesPreview:l}),(h,u)=>{var b,_,C,S,v;const m=Wa,g=z.NText,f=Ha,p=Fs,y=z.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",Kf,[i.createVNode(g,{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&&t.eventEmitter}),onClick:d},i.toDisplayString(t.product.name),3),t.product.onOrder?(i.openBlock(),i.createElementBlock("span",Zf," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",Qf,[t.product.images&&t.product.images.length>0?(i.openBlock(),i.createBlock(qa,{key:0,ref:"image-gallery",images:t.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",Jf,[i.createVNode(m)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]),_:1}),t.showProductAddToCartButton||t.showProductEditButton||t.showProductRequiredButton||((b=t.productContextButtonsConfig)==null?void 0:b.length)>0?(i.openBlock(),i.createBlock(f,{key:0,product:t.product,"event-emitter":t.eventEmitter,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-edit-button":t.showProductEditButton,"show-product-required-button":t.showProductRequiredButton,"product-context-buttons-config":t.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",eg,[i.createElementVNode("div",tg,[t.product.supplierSku?(i.openBlock(),i.createElementBlock("div",ng,[u[0]||(u[0]=i.createTextVNode(" Артикул производителя/поставщика: ",-1)),i.createElementVNode("span",ig,i.toDisplayString(t.product.supplierSku),1)])):i.createCommentVNode("",!0),t.showCode?(i.openBlock(),i.createElementBlock("span",rg,[u[1]||(u[1]=i.createTextVNode(" Артикул: ",-1)),i.createElementVNode("span",sg,i.toDisplayString(t.product.code),1)])):i.createCommentVNode("",!0),t.product.stockCount&&t.product.stockCount.length>0?(i.openBlock(),i.createBlock(Gf,{key:2,product:t.product},{default:i.withCtx(()=>[i.createElementVNode("span",og,[u[2]||(u[2]=i.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),i.createVNode(p,{class:"mt-0.5"})])]),_:1},8,["product"])):(i.openBlock(),i.createElementBlock("span",ag," Нет в наличии ")),(C=(_=t.product)==null?void 0:_.properties)!=null&&C.pack?(i.openBlock(),i.createElementBlock("span",lg,[u[3]||(u[3]=i.createTextVNode(" Норма упаковки: ",-1)),i.createElementVNode("span",cg,i.toDisplayString((v=(S=t.product)==null?void 0:S.properties)==null?void 0:v.pack),1)])):i.createCommentVNode("",!0),t.showPlanningDates&&o.value?(i.openBlock(),i.createElementBlock("span",dg,[u[4]||(u[4]=i.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),i.createElementVNode("span",hg,i.toDisplayString(o.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(y,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",ug,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,B=>(i.openBlock(),i.createBlock(Er,{key:B.coefficient.slug,product:t.product,"cost-field-name":B.coefficient.slug??"","event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),i.createVNode(Er,{product:t.product,"event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":t.showCostDate,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):i.createCommentVNode("",!0)]),_:1}),t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",fg,[i.createElementVNode("ul",gg,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.product.id,slug:t.product.slug},(B,k)=>(i.openBlock(),i.createElementBlock("li",{key:k}," ("+i.toDisplayString(k)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0),t.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(t.product.properties,(B,k)=>(i.openBlock(),i.createElementBlock("li",{key:k}," ("+i.toDisplayString(k)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),pg=(t,e,n)=>({key:t,title:e,className:"align-top",resizable:!0,render:r=>i.h(Er,{product:r,costFieldName:t,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick,currencyRates:n.currencyRates})}),yg=(t,e)=>{if(t.length===0)return[];const n=[],r={};switch(O.isNil(e.isProductItemSelected)||n.push({key:"checkbox",title:"",className:"align-top",width:"32",render:s=>{var o,a;return i.h(z.NCheckbox,{checked:!!((o=e.isProductItemSelected)!=null&&o.call(e,s)),disabled:((a=e.isProductItemSelected)==null?void 0:a.call(e,s))==="disabled",onUpdateChecked:l=>{e.eventEmitter.emit("product:checked",{product:s,checked:l})}})}}),bt.getDeviceTypeByResolution()){case Ue.phone:case Ue.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:s=>i.h(tr,{product:s,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:s=>i.h(tr,{product:s,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})}),e.showProductCosts&&(O.forEach(t,s=>{O.forEach(s.priceCoefficients,o=>{r[o.coefficient.slug??""]||(r[o.coefficient.slug??""]=o.coefficient)})}),O.forEach(O.sortBy(r,["slug"]),s=>{n.push(pg(s.slug??"",s.name,e))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:s=>i.h(Er,{product:s,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!O.isNil(e.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:s=>i.h(Ha,{product:s,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return n},bg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function _g(t,e){return i.openBlock(),i.createElementBlock("svg",bg,[...e[0]||(e[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 Xa=i.markRaw({name:"ion-trash",render:_g}),wg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function xg(t,e){return i.openBlock(),i.createElementBlock("svg",wg,[...e[0]||(e[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const Ya=i.markRaw({name:"ion-plus",render:xg}),vg={key:0,class:"flex w-fit items-center gap-2"},kg={key:1,class:"flex flex-wrap gap-1"},Cg={key:0},Sg={},nr=i.defineComponent({...Sg,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0}},setup(t){const e=t,n=i.computed(()=>{var r,s;return(s=(r=e.product)==null?void 0:r.properties)==null?void 0:s.planingProductionDate});return(r,s)=>{const o=z.NSpin;return t.isProductSearching?(i.openBlock(),i.createElementBlock("div",vg,[i.createVNode(o,{size:17,class:"w-fit"}),s[0]||(s[0]=i.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):t.product.isNewRec()?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",kg,[i.createElementVNode("div",null,i.toDisplayString(t.product.code)+" - "+i.toDisplayString(t.product.name)+" - "+i.toDisplayString(t.product.costRub.toLocaleString())+" ₽ / "+i.toDisplayString(t.product.unit),1),n.value?(i.openBlock(),i.createElementBlock("div",Cg,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)]))}}}),Bg={class:"flex flex-col gap-4"},Tg={class:"flex flex-col gap-2"},Rg={class:"mt-8 font-bold"},$g={class:"grid grow grid-cols-2 items-start gap-2"},Eg={class:"text-sm"},Ng={class:"font-medium"},Pg={key:0,class:"text-red-500"},Fg={key:2,class:"text-red-500 text-sm mb-2"},Mg={class:"flex flex-col gap-4"},Ag={key:0},Vg={class:"text-lg font-semibold"},Og={class:"flex gap-3"},Ig={},Ua=i.defineComponent({...Ig,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(structuredClone(i.toRaw(n.value.configuratorParams))),o=i.ref(!1),a=i.computed(()=>{var y;const{length:m}=s.value,{quantity:g}=n.value,f=((y=n.value.product)==null?void 0:y.costRub)||0;if(!m||!g||f===0)return null;const p=m/100;return(f*g*p).toLocaleString("ru-ru",{minimumFractionDigits:2})}),l=i.computed(()=>O.reduce(s.value.linesWidths,(m,g)=>m+(g||0),0)),c=i.computed(()=>{const m=l.value;return m>=n.settings.stripMinWidth&&m<=n.settings.stripMaxWidth}),d=i.computed(()=>{const m=O.every(s.value.linesWidths,y=>!!(y&&y>0)),g=O.every(s.value.linesAngles,y=>!O.isNil(y)),f=!!(n.value.quantity&&n.value.quantity>0),p=s.value.length>0&&s.value.length>0;return m&&g&&f&&p&&c.value}),h=()=>{d.value&&(r("update:params",s.value),u("configuratorParams",s.value))},u=(m,g)=>{const f=new G.CartItemBase(n.value);f[m]=g,r("update:value",f)};return i.watch(()=>n.value.configuratorParams,m=>{s.value=O.cloneDeep(i.toRaw(m))},{deep:!0}),i.watch(()=>n.previewParams,m=>{s.value.linesWidths=m.linesWidths,s.value.linesAngles=m.linesAngles},{deep:!0}),(m,g)=>{const f=Ya,p=Xa,y=z.NInput;return i.openBlock(),i.createBlock(i.unref(z.NForm),{class:"grid gap-2 md:grid-cols-2 md:gap-6"},{default:i.withCtx(()=>{var b,_,C,S,v,B,k,R,$,P;return[i.createElementVNode("div",Bg,[g[9]||(g[9]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),t.settings.startTailConfigs&&t.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:s.value.startTailType,"onUpdate:value":[g[0]||(g[0]=I=>s.value.startTailType=I),h],options:t.settings.startTailConfigs.map(({label:I},V)=>({label:I,value:V})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",Tg,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value.linesAngles,(I,V)=>{var A,L,D,ee,E,N;return i.openBlock(),i.createElementBlock("div",{key:V,class:"flex items-start gap-2"},[i.createElementVNode("div",Rg,i.toDisplayString(V+1),1),i.createElementVNode("div",$g,[i.createVNode(i.unref(z.NFormItem),{label:"Ширина, мм",required:!0,feedback:((A=t.validation[`lines_widths[${V+1}]`])==null?void 0:A.feedback)||"","show-feedback":((L=t.validation[`lines_widths[${V+1}]`])==null?void 0:L.showFeedback)||!1,"validation-status":(D=t.validation[`lines_widths[${V+1}]`])==null?void 0:D.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:s.value.linesWidths[V],"onUpdate:value":[H=>s.value.linesWidths[V]=H,h],"show-button":!1,min:s.value.linesWidths.length>1?t.settings.minLineWidth:t.settings.stripMinWidth,max:t.settings.maxLineWidth,step:t.settings.lineWidthStep,validator:H=>!H||H>=(s.value.linesWidths.length>1?t.settings.minLineWidth:t.settings.stripMinWidth)&&H<=t.settings.maxLineWidth&&H%t.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(z.NFormItem),{label:"Угол сгиба, °",required:!0,feedback:((ee=t.validation[`lines_angles[${V+1}]`])==null?void 0:ee.feedback)||"","show-feedback":((E=t.validation[`lines_angles[${V+1}]`])==null?void 0:E.showFeedback)||!1,"validation-status":(N=t.validation[`lines_angles[${V+1}]`])==null?void 0:N.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:s.value.linesAngles[V],"onUpdate:value":[H=>s.value.linesAngles[V]=H,h],"show-button":!1,min:t.settings.minLineAngle,max:t.settings.maxLineAngle,step:t.settings.lineAngleStep,validator:H=>!H||H%t.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(z.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:i.withCtx(()=>[t.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,size:"medium",onClick:H=>r("click:add-line",V)},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["onClick"])),t.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,disabled:s.value.linesWidths.length===1,size:"medium",class:"ml-2",onClick:H=>r("click:remove-line",V)},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled","onClick"]))]),_:2},1024)])}),128))]),t.settings.endTailConfigs&&t.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:s.value.endTailType,"onUpdate:value":[g[1]||(g[1]=I=>s.value.endTailType=I),h],options:t.settings.endTailConfigs.map(({label:I},V)=>({label:I,value:V})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(nr,{"is-product-searching":t.isProductSearching,product:t.value.product},null,8,["is-product-searching","product"]),i.createElementVNode("div",Eg,[i.createElementVNode("div",Ng,"Суммарная ширина участков: "+i.toDisplayString(l.value)+" мм",1),c.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Pg," Должна быть от "+i.toDisplayString(t.settings.stripMinWidth)+" до "+i.toDisplayString(t.settings.stripMaxWidth)+" мм ",1))]),d.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Fg," Пожалуйста, заполните все обязательные поля корректно. ")),t.settings.allowSaveTemplates&&t.selectTemplateIndex===((b=t.settings.allTemplates)==null?void 0:b.length)-1?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:3,type:"tertiary",class:"self-start",loading:o.value,onClick:g[2]||(g[2]=I=>r("click:save-template"))},{default:i.withCtx(()=>[...g[8]||(g[8]=[i.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",Mg,[i.createVNode(i.unref(z.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:s.value.colorSide,"onUpdate:value":[g[3]||(g[3]=I=>s.value.colorSide=I),h],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":((_=t.validation.length)==null?void 0:_.showFeedback)||!1,feedback:((C=t.validation.length)==null?void 0:C.feedback)||"","validation-status":(S=t.validation.length)==null?void 0:S.validationStatus,label:`Метраж${t.settings.stripMinLength?" от "+t.settings.stripMinLength:""}${t.settings.stripMaxLength?" до "+t.settings.stripMaxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:s.value.length,"onUpdate:value":[g[4]||(g[4]=I=>s.value.length=I),h],required:!0,"show-button":!1,max:t.settings.stripMaxLength||void 0,min:t.settings.stripMinLength,step:t.settings.lengthStep,validator:I=>!I||I%t.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(z.NFormItem),{required:!0,"show-feedback":((v=t.validation.quantity)==null?void 0:v.showFeedback)||!1,feedback:((B=t.validation.quantity)==null?void 0:B.feedback)||"","validation-status":(k=t.validation.quantity)==null?void 0:k.validationStatus,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:t.value.quantity,"onUpdate:value":g[5]||(g[5]=I=>t.value.quantity=I),min:1,"show-button":!1,validator:I=>Number.isInteger(I),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{required:!1,"show-feedback":((R=t.validation.marker)==null?void 0:R.showFeedback)||!1,feedback:(($=t.validation.marker)==null?void 0:$.feedback)||"","validation-status":(P=t.validation.marker)==null?void 0:P.validationStatus,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(y,{value:t.value.marker,"onUpdate:value":g[6]||(g[6]=I=>t.value.marker=I),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["show-feedback","feedback","validation-status"]),a.value?(i.openBlock(),i.createElementBlock("div",Ag,[g[10]||(g[10]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Vg,i.toDisplayString(a.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",Og,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!d.value,type:"primary",class:"self-start",onClick:g[7]||(g[7]=I=>r("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1})}}});var Ga=Object.defineProperty,zg=Object.defineProperties,Lg=Object.getOwnPropertyDescriptors,Ka=Object.getOwnPropertySymbols,Dg=Object.prototype.hasOwnProperty,Hg=Object.prototype.propertyIsEnumerable,Za=t=>{throw TypeError(t)},As=(t,e,n)=>e in t?Ga(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Vs=(t,e)=>{for(var n in e||(e={}))Dg.call(e,n)&&As(t,n,e[n]);if(Ka)for(var n of Ka(e))Hg.call(e,n)&&As(t,n,e[n]);return t},Os=(t,e)=>zg(t,Lg(e)),Qa=(t,e)=>{for(var n in e)Ga(t,n,{get:e[n],enumerable:!0})},w=(t,e,n)=>As(t,typeof e!="symbol"?e+"":e,n),Ja=(t,e,n)=>e.has(t)||Za("Cannot "+n),Tt=(t,e,n)=>(Ja(t,e,"read from private field"),n?n.call(t):e.get(t)),el=(t,e,n)=>e.has(t)?Za("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Wg=(t,e,n,r)=>(Ja(t,e,"write to private field"),e.set(t,n),n),_t={Image:null,isHeadless:!1,shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(n){return this[n]},t.setAttribute=function(n,r){return this[n]=r,this},t},polyfill:function(t,e){return _t.shim(t),typeof e<"u"&&(_t.Image=e),_t.isHeadless=!0,t}},tl={};Qa(tl,{Curve:()=>Ei,getAnchorsFromArcData:()=>Xg,getComponentOnCubicBezier:()=>ir,getControlPoints:()=>ul,getCurveBoundingBox:()=>cl,getCurveFromPoints:()=>hl,getCurveLength:()=>ll,getReflection:()=>Ds,integrate:()=>dl,subdivide:()=>Ls});var nl={};Qa(nl,{HALF_PI:()=>Ze,NumArray:()=>nn,TWO_PI:()=>at,decomposeMatrix:()=>Qn,getComputedMatrix:()=>Is,getEffectiveStrokeWidth:()=>rn,getPoT:()=>sl,lerp:()=>Nt,mod:()=>Pt,setMatrix:()=>rl,toFixed:()=>Ne});var He;typeof window<"u"?He=window:typeof global<"u"?He=global:typeof self<"u"&&(He=self);var il,at=Math.PI*2,Ze=Math.PI*.5;function Qn(t,e,n,r,s,o){let a;return arguments.length<=1?(a=t.a,e=t.b,n=t.c,r=t.d,s=t.e,o=t.f):a=t,{translateX:s,translateY:o,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function rl(t){il=t}function Is(t,e){e=e&&e.identity()||new il;let n=t;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;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Nt(t,e,n){return n*(e-t)+t}var zs=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function sl(t){let e=0;for(;zs[e]&&zs[e]<t;)e++;return zs[e]}function Pt(t,e){for(;t<0;)t+=e;return t%e}var nn=He.Float32Array||Array,jg=Math.floor;function Ne(t){return jg(t*1e6)/1e6}function rn(t,e){const n=t._linewidth;if(t.strokeAttenuation)return n;e||(e=t.worldMatrix||Is(t));const r=Qn(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),s=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return s>0?n/s:n}var te={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},X=class{constructor(){w(this,"_events",{}),w(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let s=0,o=r.length;s<o;s++){e=r[s];let a=this._events[e];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[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];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(e,n,r){const s=this;e&&(o.obj=e,o.name=n,o.handler=r,e.on(n,o));function o(){r.apply(s,arguments)}return s}ignore(e,n,r){return e.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 ol={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(X.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(X.Types.change))}}},qt=class Zi extends X{constructor(e=0,n=0){super(),w(this,"_x",0),w(this,"_y",0);for(let r in ol)Object.defineProperty(this,r,ol[r]);this.x=e,this.y=n}static add(e,n){return new Zi(e.x+n.x,e.y+n.y)}static sub(e,n){return new Zi(e.x-n.x,e.y-n.y)}static subtract(e,n){return Zi.sub(e,n)}static ratioBetween(e,n){return(e.x*n.x+e.y*n.y)/(e.length()*n.length())}static angleBetween(e,n){if(arguments.length>=4){const o=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,o)}const r=e.x-n.x,s=e.y-n.y;return Math.atan2(s,r)}static distanceBetween(e,n){return Math.sqrt(Zi.distanceBetweenSquared(e,n))}static distanceBetweenSquared(e,n){const r=e.x-n.x,s=e.y-n.y;return r*r+s*s}set(e,n){return this.x=e,this.y=n,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 Zi(this.x,this.y)}add(e,n){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+=n),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,n){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-=n),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,n){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*=n),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,n){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/=n),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 n=this.x-e.x,r=this.y-e.y;return n*n+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,n){return n=typeof n>"u"?1e-4:n,this.distanceTo(e)<n}lerp(e,n){const r=(e.x-this.x)*n+this.x,s=(e.y-this.y)*n+this.y;return this.set(r,s)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Ne(this.x),y:Ne(this.y)}}rotate(e){const n=this.x,r=this.y,s=Math.cos(e),o=Math.sin(e);return this.x=n*s-r*o,this.y=n*o+r*s,this}};w(qt,"zero",new qt),w(qt,"left",new qt(-1,0)),w(qt,"right",new qt(1,0)),w(qt,"up",new qt(0,-1)),w(qt,"down",new qt(0,1));var Q=qt,ve=class Ns extends Q{constructor(e=0,n=0,r=0,s=0,o=0,a=0,l=te.move){super(e,n),w(this,"controls",{left:new Q,right:new Q}),w(this,"_command",te.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 al)Object.defineProperty(this,d,al[d]);this.command=l,this.relative=!0;const c=Ns.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(e){return n;function n(){e._bound&&e.dispatchEvent(X.Types.change)}}static fromObject(e){return new Ns().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new Ns().copy(this)}toObject(){return{x:Ne(this.x),y:Ne(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Ne(this.rx),ry:Ne(this.ry),xAxisRotation:Ne(this.xAxisRotation),largeArcFlag:Ne(this.largeArcFlag),sweepFlag:Ne(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},al={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(X.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(X.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(X.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(X.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(X.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(X.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(X.Types.change))}}},qg=0,wt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.21",PublishDate:"2025-10-01T00:18:49.277Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return qg++}},Ei={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function ir(t,e,n,r,s){const o=1-t;return o*o*o*e+3*o*o*t*n+3*o*t*t*r+t*t*t*s}function Ls(t,e,n,r,s,o,a,l,c){c=c||Ei.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new ve(a,l)];const h=[];for(let u=0;u<d;u++){const m=u/d,g=ir(m,t,n,s,a),f=ir(m,e,r,o,l);h.push(new ve(g,f))}return h}function ll(t,e,n,r,s,o,a,l,c){if(t===n&&e===r&&s===a&&o===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-s)+3*(a-t),h=6*(t+s)-12*n,u=3*(n-t),m=9*(r-o)+3*(l-e),g=6*(e+o)-12*r,f=3*(r-e);function p(y){const b=(d*y+h)*y+u,_=(m*y+g)*y+f;return Math.sqrt(b*b+_*_)}return dl(p,0,1,c||Ei.RecursionLimit)}function cl(t,e,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,m,g,f,p,y,b;for(let v=0;v<2;++v){if(v===0?(u=6*t-12*n+6*s,h=-3*t+9*n-9*s+3*a,m=3*n-3*t):(u=6*e-12*r+6*o,h=-3*e+9*r-9*o+3*l,m=3*r-3*e),Math.abs(h)<.001){if(Math.abs(u)<.001)continue;g=-m/u,0<g&&g<1&&c.push(g);continue}y=u*u-4*m*h,b=Math.sqrt(y),!(y<0)&&(f=(-u+b)/(2*h),0<f&&f<1&&c.push(f),p=(-u-b)/(2*h),0<p&&p<1&&c.push(p))}let _=c.length,C=_,S;for(;_--;)g=c[_],S=1-g,d[0][_]=S*S*S*t+3*S*S*g*n+3*S*g*g*s+g*g*g*a,d[1][_]=S*S*S*e+3*S*S*g*r+3*S*g*g*o+g*g*g*l;return d[0][C]=t,d[1][C]=e,d[0][C+1]=a,d[1][C+1]=l,d[0].length=d[1].length=C+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 dl(t,e,n,r){let s=Ei.abscissas[r-2],o=Ei.weights[r-2],a=.5*(n-e),l=a+e,c=0,d=r+1>>1,h=r&1?o[c++]*t(l):0;for(;c<d;){const u=a*s[c];h+=o[c++]*(t(l+u)+t(l-u))}return a*h}function hl(t,e){const n=t.length,r=n-1;for(let s=0;s<n;s++){const o=t[s],a=e?Pt(s-1,n):Math.max(s-1,0),l=e?Pt(s+1,n):Math.min(s+1,r),c=t[a],d=o,h=t[l];ul(c,d,h),d.command=s===0?te.move:te.curve}}function ul(t,e,n){const r=Q.angleBetween(t,e),s=Q.angleBetween(n,e);let o=Q.distanceBetween(t,e),a=Q.distanceBetween(n,e),l=(r+s)/2;return o<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(o*=.33,a*=.33,s<r?l+=Ze:l-=Ze,e.controls.left.x=Math.cos(l)*o,e.controls.left.y=Math.sin(l)*o,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function Ds(t,e,n){return new Q(2*t.x-(e.x+t.x)-(n?t.x:0),2*t.y-(e.y+t.y)-(n?t.y:0))}function Xg(t,e,n,r,s,o,a){const l=wt.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),m=r*Math.sin(h),g=new ve(u,m);g.command=te.line}}var fl=Array.prototype.slice;function Yg(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}var K={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=fl.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let s in r)t[s]=r[s]}return t},defaults:function(t){const e=fl.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let s in r)t[s]===void 0&&(t[s]=r[s])}return t},each:function(t,e,n){const r=n||this,s=!Yg(t)&&Object.keys(t),o=(s||t).length;for(let a=0;a<o;a++){const l=s?s[a]:a;e.call(r,t[l],l,t)}return t},performance:He.performance&&He.performance.now?He.performance:Date},Ft={hasEventListeners:typeof He.addEventListener=="function",bind:function(t,e,n,r){return this.hasEventListeners?t.addEventListener(e,n,!!r):t.attachEvent("on"+e,n),Ft},unbind:function(t,e,n,r){return Ft.hasEventListeners?t.removeEventListeners(e,n,!!r):t.detachEvent("on"+e,n),Ft},getRequestAnimationFrame:function(){const t=["ms","moz","webkit","o"];let e=0,n=He.requestAnimationFrame;if(!n){for(let s=0;s<t.length;s++)n=He[t[s]+"RequestAnimationFrame"]||n;n=n||r}function r(s,o){const a=new Date().getTime(),l=Math.max(0,16-(a-e)),c=He.setTimeout(d,l);e=a+l;function d(){s(a+l)}return c}return n}},Ni=He.document?He.document.createElement("div"):{};Ni.id="help-two-load",Object.defineProperty(Ft,"temp",{enumerable:!0,get:function(){return K.isElement(Ni)&&!He.document.head.contains(Ni)&&(Ni.style.display="none",He.document.head.appendChild(Ni)),Ni}});var Rt=class extends Error{constructor(e){super(),w(this,"name","Two.js"),w(this,"message"),this.message=e}},Ug=He.devicePixelRatio||1;function Gg(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1}function Hs(t){return Ug/Gg(t)}var Fr=class{constructor(){w(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},lt,An=class extends Array{constructor(){super(),el(this,lt,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 Tt(this,lt)}set _events(e){Wg(this,lt,e)}get _bound(){return Tt(this,lt)._bound}set _bound(e){Tt(this,lt)._bound=e}addEventListener(){return Tt(this,lt).addEventListener.apply(this,arguments)}on(){return Tt(this,lt).on.apply(this,arguments)}bind(){return Tt(this,lt).bind.apply(this,arguments)}removeEventListener(){return Tt(this,lt).removeEventListener.apply(this,arguments)}off(){return Tt(this,lt).off.apply(this,arguments)}unbind(){return Tt(this,lt).unbind.apply(this,arguments)}dispatchEvent(){return Tt(this,lt).dispatchEvent.apply(this,arguments)}trigger(){return Tt(this,lt).trigger.apply(this,arguments)}listen(){return Tt(this,lt).listen.apply(this,arguments)}ignore(){return Tt(this,lt).ignore.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(X.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(X.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(X.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(X.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(X.Types.remove,e),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 e}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(e,n){const r=[];for(let s=0;s<this.length;s++){const o=this[s];let a;n?a=e.call(n,o,s):a=e(o,s),r.push(a)}return r}};lt=new WeakMap;var gl=class Mu extends X{constructor(){super(),w(this,"_flagId",!1),w(this,"_flagClassName",!1),w(this,"_renderer",{}),w(this,"_id",wt.Identifier+wt.uniqueId()),w(this,"_className",""),w(this,"classList",[]);for(let e in ml)Object.defineProperty(this,e,ml[e])}static fromObject(e){const n=new Mu().copy(e);return"id"in e&&(n.id=e.id),n}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){const e=this._renderer.type;return this._renderer={type:e},typeof this.unbind=="function"&&this.unbind(),this}};w(gl,"Properties",["renderer","id","className"]);var Pi=gl,ml={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}},Mr,pl={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};He.document&&(Mr=document.createElement("a"));var Xt=class Vt extends Pi{constructor(e,n){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 r in yl)Object.defineProperty(this,r,yl[r]);if(this._renderer.type="texture",this._renderer.flagOffset=Kg.bind(this),this._renderer.flagScale=Zg.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new Q,typeof n=="function"){const r=(function(){this.unbind(X.Types.load,r),typeof n=="function"&&n()}).bind(this);this.bind(X.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const n=new Vt().copy(e);return"id"in e&&(n.id=e.id),n}static getAbsoluteURL(e){return Mr?(Mr.href=e,Mr.href):e}static loadHeadlessBuffer(e,n){e.image.onload=n,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const n=Vt.getAbsoluteURL(e);if(Vt.ImageRegistry.contains(n))return Vt.ImageRegistry.get(n);let r;return _t.Image?(r=new _t.Image,_t.shim(r,"img")):He.document?pl.video.test(n)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,n){let r=e.image,s=Vt.getTag(r);e._flagImage&&(/canvas/i.test(s)?Vt.Register.canvas(e,n):(e._src=!_t.isHeadless&&r.getAttribute("two-src")||r.src,Vt.Register[s](e,n))),e._flagSrc&&(r||(r=Vt.getImage(e.src),e.image=r),s=Vt.getTag(r),Vt.Register[s](e,n))}clone(){const e=new Vt(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 Q?e.offset:new Q().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof Q?e.scale:new Q().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,Vt.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(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};w(Xt,"Properties",["src","loaded","repeat","scale","offset","image"]),w(Xt,"RegularExpressions",pl),w(Xt,"ImageRegistry",new Fr),w(Xt,"Register",{canvas:function(t,e){t._src="#"+t.id,Xt.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){const n=t.image,r=function(o){!_t.isHeadless&&n.removeEventListener&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),typeof e=="function"&&e()},s=function(o){throw!_t.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),new Rt("unable to load "+t.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!_t.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",s,!1)),t._src=Xt.getAbsoluteURL(t._src),!(!_t.isHeadless&&n&&n.getAttribute("two-src"))&&(_t.isHeadless||n.setAttribute("two-src",t.src),Xt.ImageRegistry.add(t.src,n),_t.isHeadless?Xt.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(_t.isHeadless)throw new Rt("video textures are not implemented in headless environments.");const n=function(s){t.image.removeEventListener("canplaythrough",n,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof e=="function"&&e()},r=function(s){throw t.image.removeEventListener("canplaythrough",n,!1),t.image.removeEventListener("error",r,!1),new Rt("unable to load "+t.src)};t._src=Xt.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),Xt.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?n():(t.image.addEventListener("canplaythrough",n,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var Pe=Xt,yl={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=Pe.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Pe.ImageRegistry.contains(n)?this._image=Pe.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(X.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(X.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof Q&&this._scale.unbind(X.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof Q&&this._scale.bind(X.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Kg(){this._flagOffset=!0}function Zg(){this._flagScale=!0}var Ws=class tn extends Pi{constructor(e,n,r){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 s in bl)Object.defineProperty(this,s,bl[s]);this._renderer.type="stop",this.offset=typeof e=="number"?e:tn.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof n=="string"?n:tn.Index<=0?"#fff":"#000",tn.Index=(tn.Index+1)%2}static fromObject(e){const n=new tn().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<tn.Properties.length;n++){const r=tn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new tn;return K.each(tn.Properties,function(r){n[r]=this[r]},this),e&&e.stops&&e.stops.push(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",K.each(tn.Properties,n=>{e[n]=this[n]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};w(Ws,"Index",0),w(Ws,"Properties",["offset","opacity","color"]);var Vn=Ws,bl={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},js=class vi extends Pi{constructor(e){super(),w(this,"_flagStops",!1),w(this,"_flagSpread",!1),w(this,"_flagUnits",!1),w(this,"_spread",""),w(this,"_units","");for(let n in _l)Object.defineProperty(this,n,_l[n]);this._renderer.type="gradient",this._renderer.flagStops=Qg.bind(this),this._renderer.bindStops=Jg.bind(this),this._renderer.unbindStops=em.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let n=e.stops;n&&n.length>0&&(n=n.map(s=>s instanceof Vn?s:new Vn().copy(s)));const r=new vi(n).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const n=this.stops.map(s=>s.clone()),r=new vi(n);return K.each(vi.Properties,s=>{r[s]=this[s]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let n=0;n<vi.Properties.length;n++){const r=vi.Properties[n];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(n=>n.toObject())};return K.each(vi.Properties,n=>{e[n]=this[n]},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}};w(js,"Stop",Vn),w(js,"Properties",["spread","stops","units"]);var Qe=js,_l={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(X.Types.insert,e).unbind(X.Types.remove,n),this._stops=new An((t||[]).slice(0)),this._stops.bind(X.Types.insert,e).bind(X.Types.remove,n),e(this._stops)}}};function Qg(){this._flagStops=!0}function Jg(t){let e=t.length;for(;e--;)t[e].bind(X.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function em(t){let e=t.length;for(;e--;)t[e].unbind(X.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}var qs=class Sr extends Qe{constructor(e,n,r,s,o){super(o),w(this,"_flagEndPoints",!1),w(this,"_left",null),w(this,"_right",null);for(let a in wl)Object.defineProperty(this,a,wl[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=tm.bind(this),this.left=new Q,this.right=new Q,typeof e=="number"&&(this.left.x=e),typeof n=="number"&&(this.left.y=n),typeof r=="number"&&(this.right.x=r),typeof s=="number"&&(this.right.y=s)}static fromObject(e){const n=new Sr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Sr.Properties.length;n++){const r=Sr.Properties[n];r in e&&(this[r]=e[r]instanceof Q?e[r]:new Q().copy(e[r]))}return this}clone(e){const n=this.stops.map(function(s){return s.clone()}),r=new Sr(this.left._x,this.left._y,this.right._x,this.right._y,n);return K.each(Qe.Properties,function(s){r[s]=this[s]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(X.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};w(qs,"Stop",Vn),w(qs,"Properties",["left","right"]);var We=qs,wl={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof Q&&this._left.unbind(X.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(X.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof Q&&this._right.unbind(X.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(X.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function tm(){this._flagEndPoints=!0}var Xs=class ki extends Qe{constructor(e,n,r,s,o,a){super(s),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 l in xl)Object.defineProperty(this,l,xl[l]);this._renderer.type="radial-gradient",this._renderer.flagCenter=nm.bind(this),this._renderer.flagFocal=im.bind(this),this.center=new Q,this.radius=typeof r=="number"?r:1,this.focal=new Q,typeof e=="number"&&(this.center.x=e),typeof n=="number"&&(this.center.y=n),this.focal.copy(this.center),typeof o=="number"&&(this.focal.x=o),typeof a=="number"&&(this.focal.y=a)}static fromObject(e){const n=new ki().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<ki.Properties.length;n++){const r=ki.Properties[n];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof Q?e[r]:new Q().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const n=this.stops.map(function(s){return s.clone()}),r=new ki(this.center._x,this.center._y,this._radius,n,this.focal._x,this.focal._y);return K.each(Qe.Properties.concat(ki.Properties),function(s){r[s]=this[s]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return K.each(ki.Properties,function(n){e[n]=this[n]},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}};w(Xs,"Stop",Vn),w(Xs,"Properties",["center","radius","focal"]);var je=Xs,xl={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(X.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(X.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(X.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(X.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function nm(){this._flagCenter=!0}function im(){this._flagFocal=!0}function vl(t,e){if(e===0||e===1)return!0;const r=t._length*e;let s=0;for(let o=0;o<t._lengths.length;o++){const a=t._lengths[o];if(s>=r)return r-s>=0;s+=a}return!1}function Ar(t,e){const n=t._length;if(e<=0)return 0;if(e>=n)return t._lengths.length-1;for(let r=0,s=0;r<t._lengths.length;r++){if(s+t._lengths[r]>=e)return e-=s,Math.max(r-1,0)+e/t._lengths[r];s+=t._lengths[r]}return-1}function kl(t,e,n){let r,s,o,a,l,c,d,h;const u=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,s=(u||e).x,c=(u||e).y,o=(m||t).x,d=(m||t).y,a=t.x,h=t.y,u&&e._relative&&(s+=e.x,c+=e.y),m&&t._relative&&(o+=t.x,d+=t.y),ll(r,l,s,c,o,d,a,h,n)}function Cl(t,e,n){let r,s,o,a,l,c,d,h;const u=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,s=(u||e).x,c=(u||e).y,o=(m||t).x,d=(m||t).y,a=t.x,h=t.y,u&&e._relative&&(s+=e.x,c+=e.y),m&&t._relative&&(o+=t.x,d+=t.y),Ls(r,l,s,c,o,d,a,h,n)}function Jn(t){switch(t.renderer.type){case"texture":return Pe.fromObject(t);case"gradient":return Qe.fromObject(t);case"linear-gradient":return We.fromObject(t);case"radial-gradient":return je.fromObject(t)}return t}var rm=Math.cos,sm=Math.sin,Sl=Math.tan,Ys=[],Bl=class Ot extends X{constructor(e,n,r,s,o,a){super(),w(this,"elements",new nn(9)),w(this,"manual",!1);let l=e;Array.isArray(l)||(l=Array.prototype.slice.call(arguments)),this.identity(),l.length>0&&this.set(l)}static Multiply(e,n,r){if(n.length<=3){const B=e;let k,R,$;const P=n[0]||0,I=n[1]||0,V=n[2]||0;return k=B[0]*P+B[1]*I+B[2]*V,R=B[3]*P+B[4]*I+B[5]*V,$=B[6]*P+B[7]*I+B[8]*V,[k,R,$]}const s=e[0],o=e[1],a=e[2],l=e[3],c=e[4],d=e[5],h=e[6],u=e[7],m=e[8],g=n[0],f=n[1],p=n[2],y=n[3],b=n[4],_=n[5],C=n[6],S=n[7],v=n[8];return r=r||new nn(9),r[0]=s*g+o*y+a*C,r[1]=s*f+o*b+a*S,r[2]=s*p+o*_+a*v,r[3]=l*g+c*y+d*C,r[4]=l*f+c*b+d*S,r[5]=l*p+c*_+d*v,r[6]=h*g+u*y+m*C,r[7]=h*f+u*b+m*S,r[8]=h*p+u*_+m*v,r}static fromObject(e){return new Ot().copy(e)}set(e,n,r,s,o,a,l,c,d){if(typeof n>"u"){const h=e;e=h[0],n=h[1],r=h[2],s=h[3],o=h[4],a=h[5],l=h[6],c=h[7],d=h[8]}return this.elements[0]=e,this.elements[1]=n,this.elements[2]=r,this.elements[3]=s,this.elements[4]=o,this.elements[5]=a,this.elements[6]=l,this.elements[7]=c,this.elements[8]=d,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]=Ot.Identity[0],this.elements[1]=Ot.Identity[1],this.elements[2]=Ot.Identity[2],this.elements[3]=Ot.Identity[3],this.elements[4]=Ot.Identity[4],this.elements[5]=Ot.Identity[5],this.elements[6]=Ot.Identity[6],this.elements[7]=Ot.Identity[7],this.elements[8]=Ot.Identity[8],this.trigger(X.Types.change)}multiply(e,n,r,s,o,a,l,c,d){if(typeof n>"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 r>"u"&&(r=1),typeof s>"u"){e=e||0,n=n||0,r=r||0,o=this.elements;const L=o[0]*e+o[1]*n+o[2]*r,D=o[3]*e+o[4]*n+o[5]*r,ee=o[6]*e+o[7]*n+o[8]*r;return[L,D,ee]}const h=this.elements,u=[e,n,r,s,o,a,l,c,d],m=h[0],g=h[1],f=h[2],p=h[3],y=h[4],b=h[5],_=h[6],C=h[7],S=h[8],v=u[0],B=u[1],k=u[2],R=u[3],$=u[4],P=u[5],I=u[6],V=u[7],A=u[8];return this.elements[0]=m*v+g*R+f*I,this.elements[1]=m*B+g*$+f*V,this.elements[2]=m*k+g*P+f*A,this.elements[3]=p*v+y*R+b*I,this.elements[4]=p*B+y*$+b*V,this.elements[5]=p*k+y*P+b*A,this.elements[6]=_*v+C*R+S*I,this.elements[7]=_*B+C*$+S*V,this.elements[8]=_*k+C*P+S*A,this.trigger(X.Types.change)}inverse(e){const n=this.elements;e=e||new Ot;const r=n[0],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],d=n[6],h=n[7],u=n[8],m=u*l-c*h,g=-u*a+c*d,f=h*a-l*d;let p=r*m+s*g+o*f;return p?(p=1/p,e.elements[0]=m*p,e.elements[1]=(-u*s+o*h)*p,e.elements[2]=(c*s-o*l)*p,e.elements[3]=g*p,e.elements[4]=(u*r-o*d)*p,e.elements[5]=(-c*r+o*a)*p,e.elements[6]=f*p,e.elements[7]=(-h*r+s*d)*p,e.elements[8]=(l*r-s*a)*p,e):null}scale(e,n){return arguments.length<=1&&(n=e),this.multiply(e,0,0,0,n,0,0,0,1)}rotate(e){const n=rm(e),r=sm(e);return this.multiply(n,-r,0,r,n,0,0,0,1)}translate(e,n){return this.multiply(1,0,e,0,1,n,0,0,1)}skewX(e){const n=Sl(e);return this.multiply(1,n,0,0,1,0,0,0,1)}skewY(e){const n=Sl(e);return this.multiply(1,0,0,n,1,0,0,0,1)}toString(e){return Ys.length=0,this.toTransformArray(e,Ys),Ys.map(Ne).join(" ")}toTransformArray(e,n){const r=this.elements,s=!!n,o=r[0],a=r[1],l=r[2],c=r[3],d=r[4],h=r[5];if(e){const u=r[6],m=r[7],g=r[8];if(s){n[0]=o,n[1]=c,n[2]=u,n[3]=a,n[4]=d,n[5]=m,n[6]=l,n[7]=h,n[8]=g;return}return[o,c,u,a,d,m,l,h,g]}if(s){n[0]=o,n[1]=c,n[2]=a,n[3]=d,n[4]=l,n[5]=h;return}return[o,c,a,d,l,h]}toArray(e,n){const r=this.elements,s=!!n,o=r[0],a=r[1],l=r[2],c=r[3],d=r[4],h=r[5];if(e){const u=r[6],m=r[7],g=r[8];if(s){n[0]=o,n[1]=a,n[2]=l,n[3]=c,n[4]=d,n[5]=h,n[6]=u,n[7]=m,n[8]=g;return}return[o,a,l,c,d,h,u,m,g]}if(s){n[0]=o,n[1]=a,n[2]=l,n[3]=c,n[4]=d,n[5]=h;return}return[o,a,l,c,d,h]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ot().copy(this)}};w(Bl,"Identity",[1,0,0,0,1,0,0,0,1]);var Fi=Bl;rl(Fi);var Tl=class Va extends Pi{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 Vr)Object.defineProperty(this,e,Vr[e]);this._renderer.flagMatrix=Rl.bind(this),this.isShape=!0,this.matrix=new Fi,this.worldMatrix=new Fi,this.position=new Q,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const n=new Va().copy(e);return"id"in e&&(n.id=e.id),n}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return Vr.position.get.apply(this,arguments)}set translation(e){Vr.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 Q?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 Q?e.scale:new Q(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 n=new Va;return n.position.copy(this.position),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._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 Q?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 Q?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}};w(Tl,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var On=Tl,Vr={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(X.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(X.Types.change,this._renderer.flagMatrix),Rl.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof Q&&this._scale.unbind(X.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof Q&&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(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Is(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Rl(){this._flagMatrix=!0}var Mi=Math.min,Ai=Math.max,om=Math.ceil,am=Math.floor,lm=new Q,Us=class Yn extends On{constructor(e,n,r,s){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,"_flagStrokeAttenuation",!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),w(this,"_strokeAttenuation",!0);for(let o in $l)Object.defineProperty(this,o,$l[o]);this._renderer.type="path",this._renderer.flagVertices=El.bind(this),this._renderer.bindVertices=Nl.bind(this),this._renderer.unbindVertices=Pl.bind(this),this._renderer.flagFill=Fl.bind(this),this._renderer.flagStroke=Ml.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!n,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(e){const n=typeof e.fill=="string"?e.fill:Jn(e.fill),r=typeof e.stroke=="string"?e.stroke:Jn(e.stroke),s=new Yn().copy(Os(Vs({},e),{fill:n,stroke:r}));return"id"in e&&(s.id=e.id),s}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let n=0;n<e.vertices.length;n++){const r=e.vertices[n];r instanceof ve?this.vertices.push(e.vertices[n].clone()):this.vertices.push(new ve().copy(r))}}for(let n=0;n<Yn.Properties.length;n++){const r=Yn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new Yn;for(let r=0;r<this.vertices.length;r++)n.vertices.push(this.vertices[r].clone());for(let r=0;r<Yn.Properties.length;r++){const s=Yn.Properties[r];n[s]=this[s]}return n.className=this.className,n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(n=>n.toObject()),K.each(Yn.Properties,n=>{typeof this[n]<"u"&&(this[n].toObject?e[n]=this[n].toObject():e[n]=this[n])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];typeof n.unbind=="function"&&n.unbind(),n.controls&&(n.controls.left&&typeof n.controls.left.unbind=="function"&&n.controls.left.unbind(),n.controls.right&&typeof n.controls.right.unbind=="function"&&n.controls.right.unbind())}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),n=e.width/2,r=e.height/2,s=e.left+e.width/2,o=e.top+e.height/2;for(let a=0;a<this.vertices.length;a++){const l=this.vertices[a];l.x-=s,l.y-=o,l.x+=n,l.y+=r}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=n,this.mask.translation.y-=o,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),n=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const o=this.vertices[s];o.x-=n,o.y-=r}return this.mask&&(this.mask.translation.x-=n,this.mask.translation.y-=r),this}getBoundingClientRect(e){let n,r,s,o,a,l,c=1/0,d=-1/0,h=1/0,u=-1/0;if(this._update(!0),n=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:m,scaleY:g}=Qn(n.elements[0],n.elements[3],n.elements[1],n.elements[4],n.elements[2],n.elements[5]);typeof m=="number"&&typeof g=="number"&&(r=Math.max(m,g)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(o=0;o<s;o++){l=this._renderer.vertices[o],a=this._renderer.vertices[(o+s-1)%s];const[m,g]=n.multiply(a.x,a.y),[f,p]=n.multiply(l.x,l.y);if(a.controls&&l.controls){let y=a.controls.right.x,b=a.controls.right.y;a.relative&&(y+=a.x,b+=a.y);let[_,C]=n.multiply(y,b),S=l.controls.left.x,v=l.controls.left.y;l.relative&&(S+=l.x,v+=l.y);let[B,k]=n.multiply(S,v);const R=cl(m,g,_,C,B,k,f,p);h=Mi(R.min.y-r,h),c=Mi(R.min.x-r,c),d=Ai(R.max.x+r,d),u=Ai(R.max.y+r,u)}else o<=1&&(h=Mi(g-r,h),c=Mi(m-r,c),d=Ai(m+r,d),u=Ai(g+r,u)),h=Mi(p-r,h),c=Mi(f-r,c),d=Ai(f+r,d),u=Ai(p+r,u)}return{top:h,left:c,right:d,bottom:u,width:d-c,height:u-h}}getPointAt(e,n){let r,s,o,a,l,c,d,h,u,m,g,f,p,y,b,_=this.length*Math.min(Math.max(e,0),1);const C=this.vertices.length,S=C-1;let v=null,B=null;for(let E=0,N=this._lengths.length,H=0;E<N;E++){if(H+this._lengths[E]>=_){this._closed?(r=Pt(E,C),s=Pt(E-1,C),E===0&&(r=s,s=E)):(r=E,s=Math.min(Math.max(E-1,0),S)),v=this.vertices[r],B=this.vertices[s],_-=H,this._lengths[E]!==0?e=_/this._lengths[E]:e=0;break}H+=this._lengths[E]}if(v===null||B===null)return null;if(v){if(!B)return v}else return B;b=B.controls&&B.controls.right,y=v.controls&&v.controls.left,l=B.x,m=B.y,c=(b||B).x,g=(b||B).y,d=(y||v).x,f=(y||v).y,h=v.x,p=v.y,b&&B.relative&&(c+=B.x,g+=B.y),y&&v.relative&&(d+=v.x,f+=v.y),a=ir(e,l,c,d,h),u=ir(e,m,g,f,p);const k=Nt(l,c,e),R=Nt(m,g,e),$=Nt(c,d,e),P=Nt(g,f,e),I=Nt(d,h,e),V=Nt(f,p,e),A=Nt(k,$,e),L=Nt(R,P,e),D=Nt($,I,e),ee=Nt(P,V,e);return K.isObject(n)?(n.x=a,n.y=u,n instanceof ve&&(n.controls.left.x=A,n.controls.left.y=L,n.controls.right.x=D,n.controls.right.y=ee,(typeof n.relative!="boolean"||n.relative)&&(n.controls.left.x-=a,n.controls.left.y-=u,n.controls.right.x-=a,n.controls.right.y-=u)),n.t=e,n):(o=new ve(a,u,A-a,L-u,D-a,ee-u,this._curved?te.curve:te.line),o.t=e,o)}plot(){if(this.curved)return hl(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?te.move:te.line;return this}subdivide(e){this._update();const n=this.vertices.length-1,r=this._closed||this.vertices[n]._command===te.close;let s=this.vertices[n],o=[],a;return K.each(this.vertices,function(l,c){if(c<=0&&!r){s=l;return}if(l.command===te.move){o.push(new ve(s.x,s.y)),c>0&&(o[o.length-1].command=te.line),s=l;return}a=Cl(l,s,e),o=o.concat(a),K.each(a,function(d,h){h<=0&&s.command===te.move?d.command=te.move:d.command=te.line}),c>=n&&(this._closed&&this._automatic&&(s=l,a=Cl(l,s,e),o=o.concat(a),K.each(a,function(d,h){h<=0&&s.command===te.move?d.command=te.move:d.command=te.line})),o.push(new ve(l.x,l.y)),o[o.length-1].command=r?te.close:te.line),s=l},this),this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,n){n||this._update();const s=this.vertices.length-1;let o=this.vertices[s],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),K.each(this.vertices,function(l,c){if(c<=0||l.command===te.move){o=l,this._lengths[c]=0;return}this._lengths[c]=kl(l,o,e),a+=this._lengths[c],o=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,n=this._closed,r=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),o=Ar(this,r*this._length),a=Ar(this,s*this._length),l=om(o),c=am(a);let d,h,u,m,g,f;for(this._renderer.vertices.length=0,f=0;f<e;f++)this._renderer.collection.length<=f&&this._renderer.collection.push(new ve),f>c&&!h?(g=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(s,g),g.command=this._renderer.collection[f].command,this._renderer.vertices.push(g),h=g,u=this._collection[f-1],u&&u.controls&&(g.relative?g.controls.right.clear():g.controls.right.copy(g),u.relative?this._renderer.collection[f-1].controls.right.copy(u.controls.right).lerp(Q.zero,1-g.t):this._renderer.collection[f-1].controls.right.copy(u.controls.right).lerp(u,1-g.t))):f>=l&&f<=c&&(g=this._renderer.collection[f].copy(this._collection[f]),this._renderer.vertices.push(g),f===c&&vl(this,s)?(h=g,!n&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):f===l&&vl(this,r)&&(d=g,d.command=te.move,!n&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));l>0&&!d&&(f=l-1,g=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(r,g),g.command=te.move,this._renderer.vertices.unshift(g),m=this._collection[f+1],m&&m.controls&&(g.controls.left.clear(),m.relative?this._renderer.collection[f+1].controls.left.copy(m.controls.left).lerp(Q.zero,g.t):(lm.copy(m),this._renderer.collection[f+1].controls.left.copy(m.controls.left).lerp(m,g.t))))}return On.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,On.prototype.flagReset.call(this),this}};w(Us,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),w(Us,"Utils",{getCurveLength:kl});var Se=Us,$l={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&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(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";K.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(X.Types.insert,e).unbind(X.Types.remove,n),t instanceof An?this._collection=t:this._collection=new An(t||[]),this._collection.bind(X.Types.insert,e).bind(X.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,K.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function El(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Nl(t){let e=t.length;for(;e--;)t[e].bind(X.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Pl(t){let e=t.length;for(;e--;)t[e].unbind(X.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Fl(){this._flagFill=!0}function Ml(){this._flagStroke=!0}var Al=class Br extends Se{constructor(e,n,r,s){const o=[new ve,new ve,new ve,new ve];super(o,!0,!1,!0),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_width",0),w(this,"_height",0),w(this,"_origin",null),this._renderer.type="rectangle";for(let a in Vl)Object.defineProperty(this,a,Vl[a]);this.width=typeof r=="number"?r:1,this.height=typeof s=="number"?s:1,this.origin=new Q,typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n),this._update()}static fromObject(e){const n=new Br().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Br.Properties.length;n++){const r=Br.Properties[n];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof Q&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,n=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new ve),this.vertices[0].set(-e,-n).sub(this._origin).command=te.move,this.vertices[1].set(e,-n).sub(this._origin).command=te.line,this.vertices[2].set(e,n).sub(this._origin).command=te.line,this.vertices[3].set(-e,n).sub(this._origin).command=te.line,this.vertices[4]&&(this.vertices[4].set(-e,-n).sub(this._origin).command=te.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const n=new Br(0,0,this.width,this.height);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Se.Properties.length;r++){const s=Se.Properties[r];n[s]instanceof Q?n[s].copy(this[s]):n[s]=this[s]}return e&&e.add(n),n}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}};w(Al,"Properties",["width","height","origin"]);var In=Al,Vl={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(X.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(X.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Ol=class Tr extends In{constructor(e,n,r,s,o,a){super(n,r,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),this._renderer.type="sprite";for(let l in Il)Object.defineProperty(this,l,Il[l]);this.noStroke(),this.noFill(),e instanceof Pe?this.texture=e:typeof e=="string"&&(this.texture=new Pe(e)),this.origin=new Q,this._update(),typeof s=="number"&&(this.columns=s),typeof o=="number"&&(this.rows=o),typeof a=="number"&&(this.frameRate=a),this.index=0}static fromObject(e){const n=new Tr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Tr.Properties.length;n++){const r=Tr.Properties[n];r in e&&(this[r]=e[r])}return this}play(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=K.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof n=="number"&&(this._lastFrame=n),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const n=new Tr(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&n.play(this._firstFrame,this._lastFrame),n.loop=this.loop,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,n=this._columns,r=this._rows;let s,o,a,l,c,d,h,u,m;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)){h=e.image.width,u=e.image.height,s=h/n,o=u/r,l=this._amount,this.width!==s&&(this.width=s),this.height!==o&&(this.height=o),this._playing&&this._frameRate>0&&(K.isNaN(this._lastFrame)&&(this._lastFrame=l-1),a=K.performance.now()-this._startTime,m=this._lastFrame+1,c=1e3*(m-this._firstFrame)/this._frameRate,this._loop?a=a%c:a=Math.min(a,c),d=Nt(this._firstFrame,m,a/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const g=this._index%n,f=Math.floor(this._index/n),p=-s*g+(h-s)/2,y=-o*f+(u-o)/2;p!==e.offset.x&&(e.offset.x=p),y!==e.offset.y&&(e.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};w(Ol,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var Or=Ol,Il={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},Gs,zl=class extends An{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),el(this,Gs,{}),this.attach(e),this.on(X.Types.insert,this.attach),this.on(X.Types.remove,this.detach)}get ids(){return Tt(this,Gs)}attach(e){for(let n=0;n<e.length;n++){const r=e[n];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let n=0;n<e.length;n++)delete this.ids[e[n].id];return this}};Gs=new WeakMap;var Ll=class Ci extends Se{constructor(e,n,r,s,o,a,l){const c=l||wt.Resolution*3,d=[];for(let h=0;h<c;h++)d.push(new ve);super(d,!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",at),w(this,"_innerRadius",0),w(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let h in Dl)Object.defineProperty(this,h,Dl[h]);typeof r=="number"&&(this.innerRadius=r),typeof s=="number"&&(this.outerRadius=s),typeof o=="number"&&(this.startAngle=o),typeof a=="number"&&(this.endAngle=a),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Ci().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Ci.Properties.length;n++){const r=Ci.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,n=this._endAngle,r=this._innerRadius,s=this._outerRadius,o=Pt(e,at)===Pt(n,at),a=r>0,l=this.vertices;let c=a?l.length/2:l.length,d,h=0,u,m,g,f,p,y,b,_,C;for(o?c--:a||(c-=2),u=0,m=c-1;u<c;u++){switch(g=u/m,f=l[h],p=g*(n-e)+e,y=(n-e)/c,b=s*Math.cos(p),_=s*Math.sin(p),u){case 0:d=te.move;break;default:d=te.curve}f.command=d,f.x=b,f.y=_,f.controls.left.clear(),f.controls.right.clear(),f.command===te.curve&&(C=s*y/Math.PI,f.controls.left.x=C*Math.cos(p-Ze),f.controls.left.y=C*Math.sin(p-Ze),f.controls.right.x=C*Math.cos(p+Ze),f.controls.right.y=C*Math.sin(p+Ze),u===1&&f.controls.left.multiplyScalar(2),u===m&&f.controls.right.multiplyScalar(2)),h++}if(a){for(o?(l[h].command=te.close,h++):(c--,m=c-1),u=0;u<c;u++)g=u/m,f=l[h],p=(1-g)*(n-e)+e,y=(n-e)/c,b=r*Math.cos(p),_=r*Math.sin(p),d=te.curve,u<=0&&(d=o?te.move:te.line),f.command=d,f.x=b,f.y=_,f.controls.left.clear(),f.controls.right.clear(),f.command===te.curve&&(C=r*y/Math.PI,f.controls.left.x=C*Math.cos(p+Ze),f.controls.left.y=C*Math.sin(p+Ze),f.controls.right.x=C*Math.cos(p-Ze),f.controls.right.y=C*Math.sin(p-Ze),u===1&&f.controls.left.multiplyScalar(2),u===m&&f.controls.right.multiplyScalar(2)),h++;l[h].copy(l[0]),l[h].command=te.line}else o||(l[h].command=te.line,l[h].x=0,l[h].y=0,h++,l[h].copy(l[0]),l[h].command=te.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 n=this.innerRadius,r=this.outerRadius,s=this.startAngle,o=this.endAngle,a=this.vertices.length,l=new Ci(0,0,n,r,s,o,a);l.translation.copy(this.translation),l.rotation=this.rotation,l.scale=this.scale,l.skewX=this.skewX,l.skewY=this.skewY,this.matrix.manual&&l.matrix.copy(this.matrix);for(let c=0;c<Se.Properties.length;c++){const d=Se.Properties[c];l[d]=this[d]}return e&&e.add(l),l}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let n=0;n<Ci.Properties.length;n++){const r=Ci.Properties[n];e[r]=this[r]}return e}};w(Ll,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Ks=Ll,Dl={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},Zs=Math.cos,Qs=Math.sin,Hl=class Si extends Se{constructor(e,n,r,s){const o=s?Math.max(s,2):4,a=[];for(let l=0;l<o;l++)a.push(new ve(0,0,0,0,0,0));super(a,!0,!0,!0),w(this,"_flagRadius",!1),w(this,"_radius",0),this._renderer.type="circle";for(let l in Wl)Object.defineProperty(this,l,Wl[l]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Si().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Si.Properties.length;n++){const r=Si.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const n=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,s=r*n;for(let o=0;o<this.vertices.length;o++){const l=o/e*at,c=r*Zs(l),d=r*Qs(l),h=s*Zs(l-Ze),u=s*Qs(l-Ze),m=s*Zs(l+Ze),g=s*Qs(l+Ze),f=this.vertices[o];f.command=o===0?te.move:te.curve,f.set(c,d),f.controls.left.set(h,u),f.controls.right.set(m,g)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const n=new Si(0,0,this.radius,this.vertices.length);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Se.Properties.length;r++){const s=Se.Properties[r];n[s]=this[s]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let n=0;n<Si.Properties.length;n++){const r=Si.Properties[n];e[r]=this[r]}return e}};w(Hl,"Properties",["radius"]);var Ir=Hl,Wl={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Js=Math.cos,eo=Math.sin,jl=class Bi extends Se{constructor(e,n,r,s,o){typeof s!="number"&&typeof r=="number"&&(s=r);const a=o?Math.max(o,2):4,l=[];for(let c=0;c<a;c++)l.push(new ve);super(l,!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 c in ql)Object.defineProperty(this,c,ql[c]);typeof r=="number"&&(this.width=r*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Bi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Bi.Properties.length;n++){const r=Bi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const n=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,s=this._height/2;for(let o=0;o<this.vertices.length;o++){const l=o/e*at,c=r*Js(l),d=s*eo(l),h=r*n*Js(l-Ze),u=s*n*eo(l-Ze),m=r*n*Js(l+Ze),g=s*n*eo(l+Ze),f=this.vertices[o];f.command=o===0?te.move:te.curve,f.set(c,d),f.controls.left.set(h,u),f.controls.right.set(m,g)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const n=this.width/2,r=this.height/2,s=this.vertices.length,o=new Bi(0,0,n,r,s);o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,o.skewX=this.skewX,o.skewY=this.skewY,this.matrix.manual&&o.matrix.copy(this.matrix);for(let a=0;a<Se.Properties.length;a++){const l=Se.Properties[a];o[l]=this[l]}return e&&e.add(o),o}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let n=0;n<Bi.Properties.length;n++){const r=Bi.Properties[n];e[r]=this[r]}return e}};w(jl,"Properties",["width","height"]);var zr=jl,ql={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},cm=Math.ceil,dm=Math.floor,Xl=class Un extends On{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,"_flagStrokeAttenuation",!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,"_strokeAttenuation",!0),w(this,"noFill",Se.prototype.noFill),w(this,"noStroke",Se.prototype.noStroke),w(this,"corner",Se.prototype.corner),w(this,"center",Se.prototype.center),w(this,"getBoundingClientRect",Se.prototype.getBoundingClientRect),w(this,"_updateLength",Se.prototype._updateLength);for(let n in Yl)Object.defineProperty(this,n,Yl[n]);this._renderer.type="points",this._renderer.flagVertices=El.bind(this),this._renderer.bindVertices=Nl.bind(this),this._renderer.unbindVertices=Pl.bind(this),this._renderer.flagFill=Fl.bind(this),this._renderer.flagStroke=Ml.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 n=typeof e.fill=="string"?e.fill:Jn(e.fill),r=typeof e.stroke=="string"?e.stroke:Jn(e.stroke),s=new Un().copy(Os(Vs({},e),{fill:n,stroke:r}));return"id"in e&&(s.id=e.id),s}copy(e){super.copy.call(this,e);for(let n=0;n<e.vertices.length;n++){const r=e.vertices[n];r instanceof ve?this.vertices.push(e.vertices[n].clone()):this.vertices.push(new ve().copy(r))}for(let n=0;n<Un.Properties.length;n++){const r=Un.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new Un;for(let r=0;r<this.vertices.length;r++)n.vertices.push(this.vertices[r].clone());for(let r=0;r<Un.Properties.length;r++){const s=Un.Properties[r];n[s]=this[s]}return n.className=this.className,n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(n=>n.toObject()),K.each(Un.Properties,function(n){typeof this[n]<"u"&&(this[n].toObject?e[n]=this[n].toObject():e[n]=this[n])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];typeof n.unbind=="function"&&n.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(e){this._update();let n=[];for(let r=0;r<this.vertices.length;r++){const s=this.vertices[r],o=this.vertices[r-1];if(!o)continue;const a=s.x,l=s.y,c=o.x,d=o.y,h=Ls(a,l,a,l,c,d,c,d,e);n=n.concat(h)}return this.vertices=n,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),n=Math.max(this._beginning,this._ending),r=Ar(this,e*this._length),s=Ar(this,n*this._length),o=cm(r),a=dm(s);let l=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=o&&d<=a&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[l*2+0]=c.x,this._renderer.vertices[l*2+1]=c.y,l++)}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}};w(Xl,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var to=Xl,Yl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&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(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(X.Types.insert,e).unbind(X.Types.remove,n),t instanceof An?this._collection=t:this._collection=new An(t||[]),this._collection.bind(X.Types.insert,e).bind(X.Types.remove,n),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},hm=Math.cos,um=Math.sin,Ul=class Ti extends Se{constructor(e,n,r,s){s=Math.max(s||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 o in Gl)Object.defineProperty(this,o,Gl[o]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Ti().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Ti.Properties.length;n++){const r=Ti.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,n=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let s=0;s<n;s++){const o=(s+.5)/e,a=at*o+Math.PI/2,l=this._width*hm(a)/2,c=this._height*um(a)/2;s>=r?this.vertices.push(new ve(l,c)):this.vertices[s].set(l,c),this.vertices[s].command=s===0?te.move:te.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const n=new Ti(0,0,0,this.sides);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.width=this.width,n.height=this.height,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Se.Properties.length;r++){const s=Se.Properties[r];n[s]=this[s]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let n=0;n<Ti.Properties.length;n++){const r=Ti.Properties[n];e[r]=this[r]}return e}};w(Ul,"Properties",["width","height","sides"]);var no=Ul,Gl={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},Kl=class Ri extends Se{constructor(e,n,r,s,o){typeof o>"u"&&typeof r=="number"&&typeof s=="number"&&(o=Math.floor(Math.min(r,s)/12));const a=[];for(let l=0;l<10;l++)a.push(new ve(0,0,0,0,0,0,l===0?te.move:te.curve));super(a),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 l in Zl)Object.defineProperty(this,l,Zl[l]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=fm.bind(this),typeof r=="number"&&(this.width=r),typeof s=="number"&&(this.height=s),(typeof o=="number"||o instanceof Q)&&(this.radius=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Ri().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Ri.Properties.length;n++){const r=Ri.Properties[n];if(r in e){const s=e[r];/radius/i.test(r)?this[r]=typeof s=="number"||s instanceof Q?s:new Q().copy(s):typeof s=="number"&&(this[r]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,n=this._height;let r,s;this._radius instanceof Q?(r=this._radius.x,s=this._radius.y):(r=this._radius,s=this._radius);let o,a=e/2,l=n/2;o=this.vertices[0],o.x=-(a-r),o.y=-l,o=this.vertices[1],o.x=a-r,o.y=-l,o.controls.left.clear(),o.controls.right.x=r,o.controls.right.y=0,o=this.vertices[2],o.x=a,o.y=-(l-s),o.controls.right.clear(),o.controls.left.clear(),o=this.vertices[3],o.x=a,o.y=l-s,o.controls.left.clear(),o.controls.right.x=0,o.controls.right.y=s,o=this.vertices[4],o.x=a-r,o.y=l,o.controls.right.clear(),o.controls.left.clear(),o=this.vertices[5],o.x=-(a-r),o.y=l,o.controls.left.clear(),o.controls.right.x=-r,o.controls.right.y=0,o=this.vertices[6],o.x=-a,o.y=l-s,o.controls.left.clear(),o.controls.right.clear(),o=this.vertices[7],o.x=-a,o.y=-(l-s),o.controls.left.clear(),o.controls.right.x=0,o.controls.right.y=-s,o=this.vertices[8],o.x=-(a-r),o.y=-l,o.controls.left.clear(),o.controls.right.clear(),o=this.vertices[9],o.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 n=this.width,r=this.height,s=this.radius,o=new Ri(0,0,n,r,s);o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,o.skewX=this.skewX,o.skewY=this.skewY,this.matrix.manual&&o.matrix.copy(this.matrix);for(let a=0;a<Se.Properties.length;a++){const l=Se.Properties[a];o[l]=this[l]}return e&&e.add(o),o}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let n=0;n<Ri.Properties.length;n++){const r=Ri.Properties[n];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};w(Kl,"Properties",["width","height","radius"]);var Lr=Kl,Zl={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof Q&&this._radius.unbind(X.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof Q&&this._radius.bind(X.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function fm(){this._flagRadius=!0}var gm=Math.cos,mm=Math.sin,Ql=class $i extends Se{constructor(e,n,r,s,o){arguments.length<=3&&(s=r,r=s/2),(typeof o!="number"||o<=0)&&(o=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 a in Jl)Object.defineProperty(this,a,Jl[a]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof s=="number"&&(this.outerRadius=s),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new $i().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<$i.Properties.length;n++){const r=$i.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,n=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let s=0;s<n;s++){const o=(s+.5)/e,a=at*o,l=(s%2?this._outerRadius:this._innerRadius)/2,c=l*gm(a),d=l*mm(a);s>=r?this.vertices.push(new ve(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?te.move:te.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const n=this.innerRadius,r=this.outerRadius,s=this.sides,o=new $i(0,0,n,r,s);o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,o.skewX=this.skewX,o.skewY=this.skewY,this.matrix.manual&&o.matrix.copy(this.matrix);for(let a=0;a<Se.Properties.length;a++){const l=Se.Properties[a];o[l]=this[l]}return e&&e.add(o),o}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let n=0;n<$i.Properties.length;n++){const r=$i.Properties[n];e[r]=this[r]}return e}};w(Ql,"Properties",["innerRadius","outerRadius","sides"]);var io=Ql,Jl={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},ro,ec=Math.min,tc=Math.max;He.document&&(ro=document.createElement("canvas"));var so=class It extends On{constructor(e,n,r,s){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,"_flagStrokeAttenuation",!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),w(this,"_strokeAttenuation",!0);for(let o in nc)Object.defineProperty(this,o,nc[o]);if(this._renderer.type="text",this._renderer.flagFill=pm.bind(this),this._renderer.flagStroke=ym.bind(this),this.value=e,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!K.isObject(s))return this;for(let o=0;o<It.Properties.length;o++){const a=It.Properties[o];a in s&&(this[a]=s[a])}}static Measure(e){if(ro){const n=ro.getContext("2d");n.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=n.measureText(e.value,0,0),s=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:s}}else{const n=this.value.length*this.size*It.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:n,height:r}}}static fromObject(e){const n=typeof e.fill=="string"?e.fill:Jn(e.fill),r=typeof e.stroke=="string"?e.stroke:Jn(e.stroke),s=new It().copy(Os(Vs({},e),{fill:n,stroke:r}));return"id"in e&&(s.id=e.id),s}copy(e){super.copy.call(this,e);for(let n=0;n<It.Properties.length;n++){const r=It.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new It(this.value);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale;for(let r=0;r<It.Properties.length;r++){const s=It.Properties[r];n[s]=this[s]}return this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let n=0;n<It.Properties.length;n++){const r=It.Properties[n];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let n,r,s,o,a;this._update(!0),n=e?this.matrix:this.worldMatrix;const{width:l,height:c}=It.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,s=l+d;break;case"right":r=-(l+d),s=d;break;default:r=-(l/2+d),s=l/2+d}switch(this.baseline){case"middle":o=-(c/2+d),a=c/2+d;break;default:o=-(c+d),a=d}const[h,u]=n.multiply(r,o),[m,g]=n.multiply(r,a),[f,p]=n.multiply(s,o),[y,b]=n.multiply(s,a);return o=ec(u,g,p,b),r=ec(h,m,f,y),s=tc(h,m,f,y),a=tc(u,g,p,b),{top:o,left:r,right:s,bottom:a,width:s-r,height:a-o}}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}};w(so,"Ratio",.6),w(so,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var sn=so,nc={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.unbind(X.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Qe||this._fill instanceof We||this._fill instanceof je||this._fill instanceof Pe)&&this._fill.bind(X.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&this._stroke.unbind(X.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Qe||this._stroke instanceof We||this._stroke instanceof je||this._stroke instanceof Pe)&&this._stroke.bind(X.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,K.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function pm(){this._flagFill=!0}function ym(){this._flagStroke=!0}var oo=class Qi extends In{constructor(e,n,r,s){super(n,r,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),this._renderer.type="image-sequence";for(let o in ic)Object.defineProperty(this,o,ic[o]);this._renderer.flagTextures=bm.bind(this),this._renderer.bindTextures=_m.bind(this),this._renderer.unbindTextures=wm.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(rc.bind(this)):typeof e=="string"&&(this.textures=[rc(e)]),this.origin=new Q,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Qi.DefaultFrameRate,this.index=0}static fromObject(e){const n=new Qi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Qi.Properties.length;n++){const r=Qi.Properties[n];r in e&&(this[r]=e[r])}return this}play(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=K.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof n=="number"&&(this._lastFrame=n),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const n=new Qi(this.textures,this.translation.x,this.translation.y,this.frameRate);return n._loop=this._loop,this._playing&&n.play(),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(n){return n.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const n=this.textures[e];typeof n.dispose=="function"?n.dispose():typeof n.unbind=="function"&&n.unbind()}return this}_update(){const e=this._textures;let n,r,s,o,a,l,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(o=this._amount,K.isNaN(this._lastFrame)&&(this._lastFrame=o-1),s=K.performance.now()-this._startTime,d=this._lastFrame+1,a=1e3*(d-this._firstFrame)/this._frameRate,this._loop?s=s%a:s=Math.min(s,a),c=Nt(this._firstFrame,d,s/a),c=Math.floor(c),c!==this._index&&(this._index=c,l=e[this._index],l.loaded&&(n=l.image.width,r=l.image.height,this.width!==n&&(this.width=n),this.height!==r&&(this.height=r),this.fill=l,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Pe))&&(l=e[this._index],l.loaded&&(n=l.image.width,r=l.image.height,this.width!==n&&(this.width=n),this.height!==r&&(this.height=r)),this.fill=l)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};w(oo,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(oo,"DefaultFrameRate",30);var ao=oo,ic={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(X.Types.insert,e).unbind(X.Types.remove,n),this._textures=new An((t||[]).slice(0)),this._textures.bind(X.Types.insert,e).bind(X.Types.remove,n),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function bm(){this._flagTextures=!0}function _m(t){let e=t.length;for(;e--;)t[e].bind(X.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function wm(t){let e=t.length;for(;e--;)t[e].unbind(X.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function rc(t){if(t instanceof Pe)return t;if(typeof t=="string")return new Pe(t)}var Dr=Math.min,Hr=Math.max,lo=class Gn extends On{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),w(this,"_strokeAttenuation",!0);for(let n in sc)Object.defineProperty(this,n,sc[n]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let n=0;n<e.length;n++)oc.call(this,e[n],this)}static RemoveChildren(e){for(let n=0;n<e.length;n++)oc.call(this,e[n])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const n=new Gn;for(let s=0;s<Gn.Properties.length;s++){const o=Gn.Properties[s];o in e&&(/(fill|stroke)/i.test(o)?n[o]=typeof e[o]=="string"?e[o]:Jn(e[o]):n[o]=e[o])}return"mask"in e&&(n.mask=r(e.mask)),"id"in e&&(n.id=e.id),n.children=e.children.map(r),n;function r(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return Ks.fromObject(s);case"circle":return Ir.fromObject(s);case"element":return Pi.fromObject(s);case"ellipse":return zr.fromObject(s);case"group":return Gn.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return ao.fromObject(s);case"path":return Se.fromObject(s);case"points":return to.fromObject(s);case"polygon":return no.fromObject(s);case"rectangle":return In.fromObject(s);case"rounded-rectangle":return Lr.fromObject(s);case"shape":return On.fromObject(s);case"sprite":return Or.fromObject(s);case"star":return io.fromObject(s);case"text":return sn.fromObject(s)}return s}}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let n=0;n<Gn.Properties.length;n++){const r=Gn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new Gn,r=this.children.map(function(s){return s.clone()});return n.add(r),n.opacity=this.opacity,this.mask&&(n.mask=this.mask),n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.className=this.className,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._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,K.each(this.children,(n,r)=>{e.children[r]=n.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const n=this.children[e];typeof n.dispose=="function"&&n.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}corner(){const e=this.getBoundingClientRect(!0);for(let n=0;n<this.children.length;n++){const r=this.children[n];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),n=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const o=this.children[s];o.isShape&&(o.translation.x-=n,o.translation.y-=r)}return this.mask&&(this.mask.translation.x-=n,this.mask.translation.y-=r),this}getById(e){let n=null;function r(s){if(s.id===e)return s;if(s.children){if(s.children.ids[e])return s.children.ids[e];for(let o=0;o<s.children.length;o++)if(n=r(s.children[o]),n)return n}return null}return r(this)}getByClassName(e){const n=[];function r(s){if(Array.prototype.indexOf.call(s.classList,e)>=0&&n.push(s),s.children)for(let o=0;o<s.children.length;o++){const a=s.children[o];r(a)}return n}return r(this)}getByType(e){const n=[];function r(s){if(s instanceof e&&n.push(s),s.children)for(let o=0;o<s.children.length;o++){const a=s.children[o];r(a)}return n}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let n=0;n<e.length;n++){const r=e[n];if(!(r&&r.id))continue;const s=Array.prototype.indexOf.call(this.children,r);s>=0&&this.children.splice(s,1),this.children.push(r)}return this}remove(e){const n=arguments.length,r=this.parent;if(n<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let s=0;s<e.length;s++){const o=e[s];if(!o||!this.children.ids[o.id])continue;const a=this.children.indexOf(o);a>=0&&this.children.splice(a,1)}return this}getBoundingClientRect(e){let n,r,s,o,a,l;this._update(!0);let c=1/0,d=-1/0,h=1/0,u=-1/0;const m=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let g=0;g<this.children.length;g++){const f=this.children[g];if(!(!f.visible||m.test(f._renderer.type))&&(n=f.getBoundingClientRect(e),s=typeof n.top!="number"||K.isNaN(n.top)||!isFinite(n.top),o=typeof n.left!="number"||K.isNaN(n.left)||!isFinite(n.left),a=typeof n.right!="number"||K.isNaN(n.right)||!isFinite(n.right),l=typeof n.bottom!="number"||K.isNaN(n.bottom)||!isFinite(n.bottom),!(s||o||a||l)))if(e){const[p,y]=r.multiply(n.left,n.top),[b,_]=r.multiply(n.right,n.top),[C,S]=r.multiply(n.left,n.bottom),[v,B]=r.multiply(n.right,n.bottom);h=Dr(y,_,S,B,h),c=Dr(p,b,C,v,c),d=Hr(p,b,C,v,d),u=Hr(y,_,S,B,u)}else h=Dr(n.top,h),c=Dr(n.left,c),d=Hr(n.right,d),u=Hr(n.bottom,u)}return{top:h,left:c,right:d,bottom:u,width:d-c,height:u-h}}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(n){n.subdivide.apply(n,e)}),this}_update(){let e,n,r;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),a=this.length;let l=0;const c=s*a,d=o*a;for(e=0;e<this.children.length;e++)r=this.children[e],n=r.length,c>l+n?(r.beginning=1,r.ending=1):d<l?(r.beginning=0,r.ending=0):c>l&&c<l+n?(r.beginning=(c-l)/n,r.ending=1):d>l&&d<l+n?(r.beginning=0,r.ending=(d-l)/n):(r.beginning=0,r.ending=1),l+=n}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}};w(lo,"Children",zl),w(lo,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var nt=lo,sc={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=nt.InsertChildren.bind(this),n=nt.RemoveChildren.bind(this),r=nt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new zl(t),this._children.bind(X.Types.insert,e),this._children.bind(X.Types.remove,n),this._children.bind(X.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,K.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function oc(t,e){const n=t.parent;let r;if(n===e){s();return}if(n&&n.children.ids[t.id]&&(r=Array.prototype.indexOf.call(n.children,t),n.children.splice(r,1),o()),e){s();return}o(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete t.parent;function s(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function o(){r=Array.prototype.indexOf.call(n.additions,t),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,t),r<0&&(n.subtractions.push(t),n._flagSubtractions=!0)}}var Wr=class extends Se{constructor(e,n,r,s){const o=[new ve(e,n),new ve(r,s)];super(o);for(let a in ac)Object.defineProperty(this,a,ac[a]);this.vertices[0].command=te.move,this.vertices[1].command=te.line,this.automatic=!1}};w(Wr,"Properties",["left","right"]);var ac={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(K.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=te.move;else{const e=new Rt("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(K.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=te.line;else{const e=new Rt("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},on={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},xm={start:"left",middle:"center",end:"right"},lc=["id","class","transform","xmlns","viewBox"],vm=["x","y","width","height","href","xlink:href"];function km(t){return xm[t]}function Cm(t){const e=t.getAttribute("dominant-baseline"),n=t.getAttribute("alignment-baseline");return e||n}function rr(t){return t.replace(/svg:/gi,"").toLowerCase()}function cc(t,e){if(e.x+=t.translateX,e.y+=t.translateY,e.x*=t.scaleX,e.y*=t.scaleY,t.rotation!==0){const n=e.length();e.x=n*Math.cos(t.rotation),e.y=n*Math.sin(t.rotation)}}function Sm(t,e){e||(e={});const n=t.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,"");e[l]=c}return e}function Bm(t){const e={},n=Tm(t),r=Math.max(n.length,t.style.length);for(let s=0;s<r;s++){const o=t.style[s],a=n[s];o&&(e[o]=t.style[o]),a&&(e[a]=t.getAttribute(a))}return e}function Tm(t){const e=t.getAttributeNames();for(let n=0;n<lc.length;n++){const r=lc[n],s=Array.prototype.indexOf.call(e,r);s>=0&&e.splice(s,1)}return e}function Rm(t,e){const n=e.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<t.children.length;u++){const m=t.children[u];"translation"in m?m.translation.add(r,s):"x"in m?m.x=r:"y"in m&&(m.y=s)}const l=typeof t.x=="number",c=typeof t.y=="number",d=typeof t.width=="number",h=typeof t.height=="number";return l&&(t.translation.x+=t.x),c&&(t.translation.y+=t.y),(d||h)&&(t.scale=new Q(1,1)),d&&(t.scale.x=t.width/o),h&&(t.scale.y=t.height/a),t.mask=new In(0,0,o,a),t.mask.origin.set(-o/2,-a/2),t}function Lt(t,e,n){const r={},s={},o={};let a,l,c,d,h,u,m,g,f,p,y,b,_,C,S,v,B;if(t===null)return r;if(He.getComputedStyle){const k=He.getComputedStyle(t);for(a=k.length;a--;)c=k[a],d=k[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<t.attributes.length;a++)u=t.attributes[a],/style/i.test(u.nodeName)?Sm(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&&K.defaults(r,n),K.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=t.gradientTransform&&t.gradientTransform.baseVal&&t.gradientTransform.baseVal.length>0?t.gradientTransform.baseVal[0].matrix:t.getCTM?t.getCTM():null,l===null))break;switch(m=Qn(l),e._renderer.type){case"linear-gradient":cc(m,e.left),cc(m,e.right);break;case"radial-gradient":e.center.x+=m.translateX,e.center.y+=m.translateY,e.focal.x+=m.translateX,e.focal.y+=m.translateY,e.radius*=Math.max(m.scaleX,m.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=t.transform&&t.transform.baseVal&&t.transform.baseVal.length>0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null,l===null))break;m=Qn(l),e.translation.set(m.translateX,m.translateY),e.rotation=Math.PI*(m.rotation/180),e.scale=new Q(m.scaleX,m.scaleY),g=parseFloat((r.x+"").replace("px")),f=parseFloat((r.y+"").replace("px")),g&&(e.translation.x=g),f&&(e.translation.y=f);break;case"visible":if(e instanceof nt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof nt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof nt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof nt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof nt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof nt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if(on.cssBackgroundImage.test(d)&&(p=d.replace(on.cssBackgroundImage,"$1"),ze.defs.current&&ze.defs.current.contains(p)&&(b=ze.defs.current.get(p),b&&b.childNodes.length>0)))switch(b=b.childNodes[0],_=rr(b.nodeName),e.mask=ze[_].call(this,b,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":h=(e instanceof nt?"_":"")+c,on.cssBackgroundImage.test(d)?(p=d.replace(on.cssBackgroundImage,"$1"),ze.defs.current&&ze.defs.current.contains(p)?(b=ze.defs.current.get(p),b.object||(_=rr(b.nodeName),b.object=ze[_].call(this,b,{})),b=b.object):(y=Em(this),b=y.getById(p)),e[h]=b):e[h]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(C=e instanceof Qe,S=e instanceof We,v=e instanceof je,C||S||v)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Rt("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof sn&&(e.family=d);break;case"font-size":e instanceof sn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Rt("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof sn&&(e.weight=d);break;case"font-style":e instanceof sn&&(e.style=d);break;case"text-decoration":e instanceof sn&&(e.decoration=d);break;case"line-height":e instanceof sn&&(e.leading=d);break}return Object.keys(t.dataset).length&&(e.dataset=t.dataset),r}function $m(t,e){for(let n=0,r=t.childNodes.length;n<r;n++){const s=t.childNodes[n];!s.id||rr(t.nodeName)==="#text"||e.add(s.id,s)}}function Em(t){for(;t.parent;)t=t.parent;return t.scene}var ze={svg:function(t){const e=ze.defs.current=new Fr,n=t.getElementsByTagName("defs");for(let f=0;f<n.length;f++)$m(n[f],e);const r=ze.g.call(this,t),s=t.getAttribute("viewBox"),o=t.getAttribute("x"),a=t.getAttribute("y"),l=t.getAttribute("width"),c=t.getAttribute("height");r.defs=e;const d=s!==null,h=o!==null,u=a!==null,m=l!==null,g=c!==null;return h&&(r.x=parseFloat(o.replace(on.unitSuffix,""))),u&&(r.y=parseFloat(a.replace(on.unitSuffix,""))),m&&(r.width=parseFloat(l.replace(on.unitSuffix,""))),g&&(r.height=parseFloat(c.replace(on.unitSuffix,""))),d&&Rm(r,s),delete ze.defs.current,r},defs:function(t){return null},use:function(t,e){let n;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return n=new Rt("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 Rt("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<t.attributes.length;c++){const d=t.attributes[c],h=vm.includes(d.nodeName),u=!a.hasAttribute(d.nodeName);(h||u)&&a.setAttribute(d.nodeName,d.value)}const l=rr(a.nodeName);return ze[l].call(this,a,e)},g:function(t,e){const n=new nt;Lt.call(this,t,n,e),this.add(n);const r=Bm.call(this,t);for(let s=0,o=t.childNodes.length;s<o;s++){const a=t.childNodes[s],l=a.nodeName;if(!l)return;const c=rr(l);if(c in ze){const d=ze[c].call(n,a,r);d&&!d.parent&&n.add(d)}}return n},polygon:function(t,e){let n;typeof t=="string"?n=t:n=t.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 Se(r,!0);return s.stroke="none",s.fill="black",Lt.call(this,t,s,e),s},polyline:function(t,e){const n=ze.polygon.call(this,t,e);return n.closed=!1,n},path:function(t,e){let n;typeof t=="string"?(n=t,t=null):n=t.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;K.each(h.slice(0),function(m,g){const f=m.slice(1).trim().match(on.path),p=m[0],y=p.toLowerCase();let b,_,C,S,v;const B=[];switch(g===0&&(h=[]),y){case"h":case"v":f.length>1&&(b=1);break;case"m":case"l":case"t":f.length>2&&(b=2);break;case"s":case"q":f.length>4&&(b=4);break;case"c":f.length>6&&(b=6);break;case"a":f.length>7&&(b=7);break}if(b){for(_=0,C=f.length,v=0;_<C;_+=b){if(S=p,v>0)switch(p){case"m":S="l";break;case"M":S="L";break}B.push(S+f.slice(_,_+b).join(" ")),v++}h=Array.prototype.concat.apply(h,B)}else h.push(m)}),K.each(h,function(m,g){let f,p,y;const b=m[0],_=b.toLowerCase();d=m.slice(1).trim().match(on.path),o=b===_;let C,S,v,B,k,R,$,P,I,V,A,L,D,ee,E,N,H;switch(_){case"z":if(g>=u)s=!0;else{p=l.x,y=l.y,f=new ve(p,y,void 0,void 0,void 0,void 0,te.close);for(let q=r.length-1;q>=0;q--){const Y=r[q];if(/m/i.test(Y.command)){l=Y;break}}}break;case"m":case"l":c=void 0,p=parseFloat(d[0]),y=parseFloat(d[1]),f=new ve(p,y,void 0,void 0,void 0,void 0,/m/i.test(_)?te.move:te.line),o&&f.addSelf(l),l=f;break;case"h":case"v":V=/h/i.test(_)?"x":"y",A=/x/i.test(V)?"y":"x",f=new ve(void 0,void 0,void 0,void 0,void 0,void 0,te.line),f[V]=parseFloat(d[0]),f[A]=l[A],o&&(f[V]+=l[V]),l=f;break;case"c":case"s":C=l.x,S=l.y,c||(c=new Q),/c/i.test(_)?(v=parseFloat(d[0]),B=parseFloat(d[1]),k=parseFloat(d[2]),R=parseFloat(d[3]),$=parseFloat(d[4]),P=parseFloat(d[5])):(I=Ds(l,c,o),v=I.x,B=I.y,k=parseFloat(d[0]),R=parseFloat(d[1]),$=parseFloat(d[2]),P=parseFloat(d[3])),o&&(v+=C,B+=S,k+=C,R+=S,$+=C,P+=S),l.controls.right.set(v-l.x,B-l.y),f=new ve($,P,k-$,R-P,void 0,void 0,te.curve),l=f,c=f.controls.left;break;case"t":case"q":C=l.x,S=l.y,c||(c=new Q),/q/i.test(_)?(v=parseFloat(d[0]),B=parseFloat(d[1]),k=parseFloat(d[0]),R=parseFloat(d[1]),$=parseFloat(d[2]),P=parseFloat(d[3])):(I=Ds(l,c,o),v=I.x,B=I.y,k=I.x,R=I.y,$=parseFloat(d[0]),P=parseFloat(d[1])),o&&(v+=C,B+=S,k+=C,R+=S,$+=C,P+=S),l.controls.right.set((v-l.x)*.33,(B-l.y)*.33),f=new ve($,P,k-$,R-P,void 0,void 0,te.curve),l=f,c=f.controls.left;break;case"a":C=l.x,S=l.y,D=parseFloat(d[0]),ee=parseFloat(d[1]),E=parseFloat(d[2]),N=parseFloat(d[3]),H=parseFloat(d[4]),$=parseFloat(d[5]),P=parseFloat(d[6]),o&&($+=C,P+=S),L=new ve($,P),L.command=te.arc,L.rx=D,L.ry=ee,L.xAxisRotation=E,L.largeArcFlag=N,L.sweepFlag=H,f=L,l=L,c=void 0;break}f&&(Array.isArray(f)?r=r.concat(f):r.push(f))})}n=new Se(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},K.each(n.vertices,function(l){l.subSelf(a.centroid)}),Lt.call(this,t,n,e),n.translation.addSelf(a.centroid),n},circle:function(t,e){const n=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),s=parseFloat(t.getAttribute("r")),o=new Ir(0,0,s);return o.stroke="none",o.fill="black",Lt.call(this,t,o,e),o.translation.x=n,o.translation.y=r,o},ellipse:function(t,e){const n=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),s=parseFloat(t.getAttribute("rx")),o=parseFloat(t.getAttribute("ry")),a=new zr(0,0,s,o);return a.stroke="none",a.fill="black",Lt.call(this,t,a,e),a.translation.x=n,a.translation.y=r,a},rect:function(t,e){const n=parseFloat(t.getAttribute("rx")),r=parseFloat(t.getAttribute("ry"));if(!K.isNaN(n)||!K.isNaN(r))return ze["rounded-rect"](t);const s=parseFloat(t.getAttribute("width")),o=parseFloat(t.getAttribute("height")),a=s/2,l=o/2,c=new In(0,0,s,o);return c.stroke="none",c.fill="black",Lt.call(this,t,c,e),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(t,e){const n=parseFloat(t.getAttribute("rx"))||0,r=parseFloat(t.getAttribute("ry"))||0,s=parseFloat(t.getAttribute("width")),o=parseFloat(t.getAttribute("height")),a=s/2,l=o/2,c=new Q(n,r),d=new Lr(0,0,s,o,c);return d.stroke="none",d.fill="black",Lt.call(this,t,d,e),d.translation.x+=a,d.translation.y+=l,d},line:function(t,e){const n=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),s=parseFloat(t.getAttribute("x2")),o=parseFloat(t.getAttribute("y2")),a=new Wr(n,r,s,o).noFill();return Lt.call(this,t,a,e),a},lineargradient:function(t,e){let n=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(t.getAttribute("x1")||0),o=parseFloat(t.getAttribute("y1")||0),a=parseFloat(t.getAttribute("x2")||0),l=parseFloat(t.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 m=0;m<t.children.length;m++){const g=t.children[m];let f=g.getAttribute("offset");/%/gi.test(f)&&(f=parseFloat(f.replace(/%/gi,""))/100),f=parseFloat(f);let p=g.getAttribute("stop-color"),y=g.getAttribute("stop-opacity"),b=g.getAttribute("style"),_;p===null&&(_=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,p=_&&_.length>1?_[1]:void 0),y===null?(_=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=_&&_.length>1?parseFloat(_[1]):1):y=parseFloat(y),h.push(new Vn(f,p,y))}const u=new We(s,o,a,l,h);return u.spread=r,u.units=n,Lt.call(this,t,u,e),u},radialgradient:function(t,e){let n=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(t.getAttribute("cx"))||0,o=parseFloat(t.getAttribute("cy"))||0,a=parseFloat(t.getAttribute("r")),l=parseFloat(t.getAttribute("fx")),c=parseFloat(t.getAttribute("fy"));K.isNaN(l)&&(l=s),K.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 g=0;g<t.children.length;g++){const f=t.children[g];let p=f.getAttribute("offset");/%/gi.test(p)&&(p=parseFloat(p.replace(/%/gi,""))/100),p=parseFloat(p);let y=f.getAttribute("stop-color"),b=f.getAttribute("stop-opacity"),_=f.getAttribute("style"),C;y===null&&(C=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,y=C&&C.length>1?C[1]:void 0),b===null?(C=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=C&&C.length>1?parseFloat(C[1]):1):b=parseFloat(b),u.push(new Vn(p,y,b))}const m=new je(s,o,a,u,l,c);return m.spread=r,m.units=n,Lt.call(this,t,m,e),m},text:function(t,e){const n=km(t.getAttribute("text-anchor"))||"left",r=Cm(t)||"baseline";let s="";t.childNodes.length>0&&t.childNodes[0].tagName==="TSPAN"?s=t.childNodes[0].textContent:s=t.textContent;const o=new sn(s);return Lt.call(this,t,o,e),o.alignment=n,o.baseline=r,o},clippath:function(t,e){return ze.defs.current&&!ze.defs.current.contains(t.id)&&ze.defs.current.add(t.id,t),null},image:function(t,e){let n;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return n=new Rt("encountered <image /> with no href."),console.warn(n.name,n.message),null;const s=parseFloat(t.getAttribute("x"))||0,o=parseFloat(t.getAttribute("y"))||0,a=parseFloat(t.getAttribute("width")),l=parseFloat(t.getAttribute("height")),c=new Or(r,s,o);return K.isNaN(a)||(c.width=a),K.isNaN(l)||(c.height=l),Lt.call(this,t,c,e),c}};function dc(t,e){const n=new XMLHttpRequest;return n.open("GET",t),n.onreadystatechange=function(){n.readyState===4&&n.status===200&&e(n.responseText)},n.send(),n}var co=class bn extends In{constructor(e,n,r,s,o,a){super(n,r,s||1,o||1),w(this,"_flagTexture",!1),w(this,"_flagMode",!1),w(this,"_texture",null),w(this,"_mode","fill"),this._renderer.type="image";for(let l in uc)Object.defineProperty(this,l,uc[l]);this.noStroke(),this.noFill(),e instanceof Pe?this.texture=e:typeof e=="string"&&(this.texture=new Pe(e)),typeof a=="string"&&(this.mode=a),this._update()}static fromObject(e){const n=new bn().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<bn.Properties.length;n++){const r=bn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new bn(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const n=e.image.width,r=e.image.height,s=this.width,o=this.height,a=s/n,l=o/r;switch(this._mode){case bn.Modes.fill:{const c=Math.max(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case bn.Modes.fit:{const c=Math.min(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case bn.Modes.crop:break;case bn.Modes.tile:{e.offset.x=(n-s)/2,e.offset.y=(r-o)/2,e.repeat="repeat";break}case bn.Modes.stretch:default:e.scale=new Q(a,l),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};w(co,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),w(co,"Properties",["texture","mode"]);var hc=co,uc={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(t){this._mode=t,this._flagMode=!0}}},ho=[],uo=Math.max,Nm=Math.min,fc=Math.abs,jr=Math.sin,qr=Math.cos,Pm=Math.acos,Xr=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(t){return t in Te?t:"path"},group:{renderChild:function(t){const e=Te.getRendererType(t._renderer.type);Te[e].render.call(t,this.ctx,!0,this.clip)},render:function(t){if(!this._visible)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);const r=this._mask,s=Yr(e),o=!s||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,o&&(t.save(),s||t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const a=Te.getRendererType(r._renderer.type);Te[a].render.call(r,t,!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,t)}return o&&t.restore(),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t,e,n){let r,s,o,a,l,c,d,h,u,m,g,f,p,y,b,_,C,S,v,B,k,R,$,P,I,V,A,L,D,ee,E,N,H,q;if(q=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,D=this._mask,ee=this._clip,l=this._opacity*(q||1),c=this._visible,!e&&(!c||ee||l===0))return this;if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,d=this._cap,h=this._join,u=this._miter,m=this._closed,g=this._renderer.vertices,f=g.length,p=f-1,E=Yr(r),H=this.dashes,E||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),D){const re=Te.getRendererType(D._renderer.type);Te[re].render.call(D,t,!0)}if(a)if(typeof a=="string")t.fillStyle=a;else{const re=Te.getRendererType(a._renderer.type);Te[re].render.call(a,t,this),t.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")t.strokeStyle=s;else{const re=Te.getRendererType(s._renderer.type);Te[re].render.call(s,t,this),t.strokeStyle=s._renderer.effect}o&&(t.lineWidth=rn(this)),u&&(t.miterLimit=u),h&&(t.lineJoin=h),!m&&d&&(t.lineCap=d)}typeof l=="number"&&(t.globalAlpha=l),H&&H.length>0&&(t.lineDashOffset=H.offset||0,t.setLineDash(H)),t.beginPath();let Y,F,M,Z,fe,ie,me;for(let re=0;re<f;re++)switch(_=g[re],A=_.x,L=_.y,_.command){case te.close:t.closePath();break;case te.arc:Y=_.rx,F=_.ry,M=_.xAxisRotation,Z=_.largeArcFlag,fe=_.sweepFlag,y=m?Pt(re-1,f):uo(re-1,0),b=g[y],ie=b.x,me=b.y,Te.renderSvgArcCommand(t,ie,me,Y,F,Z,fe,M,A,L);break;case te.curve:y=m?Pt(re-1,f):Math.max(re-1,0),b=g[y],$=b.controls&&b.controls.right||Q.zero,P=_.controls&&_.controls.left||Q.zero,b._relative?(k=$.x+b.x,R=$.y+b.y):(k=$.x,R=$.y),_._relative?(v=P.x+_.x,B=P.y+_.y):(v=P.x,B=P.y),t.bezierCurveTo(k,R,v,B,A,L),re>=p&&m&&(C=S,I=_.controls&&_.controls.right||Q.zero,V=C.controls&&C.controls.left||Q.zero,_._relative?(k=I.x+_.x,R=I.y+_.y):(k=I.x,R=I.y),C._relative?(v=V.x+C.x,B=V.y+C.y):(v=V.x,B=V.y),A=C.x,L=C.y,t.bezierCurveTo(k,R,v,B,A,L));break;case te.line:t.lineTo(A,L);break;case te.move:S=_,t.moveTo(A,L);break}return m&&t.closePath(),!ee&&!n&&(Te.isHidden.test(a)||(N=a._renderer&&a._renderer.offset,N&&(t.save(),t.translate(-a._renderer.offset.x,-a._renderer.offset.y),t.scale(a._renderer.scale.x,a._renderer.scale.y)),t.fill(),N&&t.restore()),Te.isHidden.test(s)||(N=s._renderer&&s._renderer.offset,N&&(t.save(),t.translate(-s._renderer.offset.x,-s._renderer.offset.y),t.scale(s._renderer.scale.x,s._renderer.scale.y),t.lineWidth=o/s._renderer.scale.x),t.stroke(),N&&t.restore())),E||t.restore(),ee&&!n&&t.clip(),H&&H.length>0&&t.setLineDash(ho),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t,e,n){let r,s,o,a,l,c,d,h,u,m,g,f,p,y,b,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(_||1),c=this._visible,!e&&(!c||l===0))return this;if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,h=this._renderer.collection,u=h.length,p=Yr(r),b=this.dashes,d=this._size,p||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")t.fillStyle=a;else{const v=Te.getRendererType(a._renderer.type);Te[v].render.call(a,t,this),t.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")t.strokeStyle=s;else{const v=Te.getRendererType(s._renderer.type);Te[v].render.call(s,t,this),t.strokeStyle=s._renderer.effect}o&&(t.lineWidth=rn(this))}typeof l=="number"&&(t.globalAlpha=l),b&&b.length>0&&(t.lineDashOffset=b.offset||0,t.setLineDash(b)),t.beginPath();let C=d*.5,S;this._sizeAttenuation||(S=this.worldMatrix.elements,S=Qn(S[0],S[3],S[1],S[4],S[2],S[5]),C/=Math.max(S.scaleX,S.scaleY));for(let v=0;v<u;v++)m=h[v],g=m.x,f=m.y,t.moveTo(g+C,f),t.arc(g,f,C,0,at);return n||(Te.isHidden.test(a)||(y=a._renderer&&a._renderer.offset,y&&(t.save(),t.translate(-a._renderer.offset.x,-a._renderer.offset.y),t.scale(a._renderer.scale.x,a._renderer.scale.y)),t.fill(),y&&t.restore()),Te.isHidden.test(s)||(y=s._renderer&&s._renderer.offset,y&&(t.save(),t.translate(-s._renderer.offset.x,-s._renderer.offset.y),t.scale(s._renderer.scale.x,s._renderer.scale.y),t.lineWidth=o/s._renderer.scale.x),t.stroke(),y&&t.restore())),p||t.restore(),b&&b.length>0&&t.setLineDash(ho),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t,e,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(!e&&(!o||l||s===0))return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,h=this._linewidth,u=this._fill,m=this._decoration,g=this._direction,f=Yr(c),p=u._renderer&&u._renderer.offset&&d._renderer&&d._renderer.offset,y=this.dashes,b=Te.alignments[this._alignment]||this._alignment,_=Te.baselines[this._baseline]||this._baseline;let C,S,v,B,k,R,$,P,I,V,A;if(f||(t.save(),t.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const L=Te.getRendererType(a._renderer.type);Te[L].render.call(a,t,!0)}if(p||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=b,t.textBaseline=_,t.direction=g,u)if(typeof u=="string")t.fillStyle=u;else{const L=Te.getRendererType(u._renderer.type);Te[L].render.call(u,t,this),t.fillStyle=u._renderer.effect}if(d){if(typeof d=="string")t.strokeStyle=d;else{const L=Te.getRendererType(d._renderer.type);Te[L].render.call(d,t,this),t.strokeStyle=d._renderer.effect}h&&(t.lineWidth=rn(this))}if(typeof s=="number"&&(t.globalAlpha=s),y&&y.length>0&&(t.lineDashOffset=y.offset||0,t.setLineDash(y)),!l&&!n&&(Te.isHidden.test(u)||(u._renderer&&u._renderer.offset?(R=u._renderer.scale.x,$=u._renderer.scale.y,t.save(),t.translate(-u._renderer.offset.x,-u._renderer.offset.y),t.scale(R,$),C=this._size/u._renderer.scale.y,S=this._leading/u._renderer.scale.y,t.font=[this._style,this._weight,C+"px/",S+"px",this._family].join(" "),v=u._renderer.offset.x/u._renderer.scale.x,B=u._renderer.offset.y/u._renderer.scale.y,t.fillText(this.value,v,B),t.restore()):t.fillText(this.value,0,0)),Te.isHidden.test(d)||(d._renderer&&d._renderer.offset?(R=d._renderer.scale.x,$=d._renderer.scale.y,t.save(),t.translate(-d._renderer.offset.x,-d._renderer.offset.y),t.scale(R,$),C=this._size/d._renderer.scale.y,S=this._leading/d._renderer.scale.y,t.font=[this._style,this._weight,C+"px/",S+"px",this._family].join(" "),v=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,k=h/d._renderer.scale.x,t.lineWidth=k,t.strokeText(this.value,v,B),t.restore()):t.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(m)){const L=t.measureText(this.value);let D=1;switch(m){case"underline":I=L.actualBoundingBoxDescent,A=L.actualBoundingBoxDescent;break;case"strikethrough":I=0,A=0,D=.5;break}switch(_){case"top":I+=this._size*D,A+=this._size*D;break;case"baseline":case"bottom":I-=this._size*D,A-=this._size*D;break}switch(b){case"left":case"start":P=0,V=L.width;break;case"right":case"end":P=-L.width,V=0;break;default:P=-L.width/2,V=L.width/2}t.lineWidth=Math.max(Math.floor(this._size/15),1),t.strokeStyle=t.fillStyle,t.beginPath(),t.moveTo(P,I),t.lineTo(V,A),t.stroke()}return f||t.restore(),l&&!n&&t.clip(),y&&y.length>0&&t.setLineDash(ho),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(e){if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=e.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=t.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 K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(e){if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=e.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=t.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 K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t){K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=t.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof Q||(this._renderer.offset=new Q),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof Q?(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 Q||(this._renderer.scale=new Q),this._scale instanceof Q?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(t,e,n,r,s,o,a,l,c,d){l=l*Math.PI/180,r=fc(r),s=fc(s);const h=(e-c)/2,u=(n-d)/2,m=qr(l)*h+jr(l)*u,g=-jr(l)*h+qr(l)*u,f=m*m,p=g*g;let y=r*r,b=s*s;const _=f/y+p/b;if(_>1){const L=Xr(_);r=L*r,s=L*s,y=r*r,b=s*s}const C=y*p+b*f,S=(y*b-C)/C;let v=Xr(uo(0,S));o===a&&(v=-v);const B=v*r*g/s,k=-v*s*m/r,R=qr(l)*B-jr(l)*k+(e+c)/2,$=jr(l)*B+qr(l)*k+(n+d)/2,P=gc(1,0,(m-B)/r,(g-k)/s),I=gc((m-B)/r,(g-k)/s,(-m-B)/r,(-g-k)/s)%at,V=P+I;Fm(t,R,$,r,s,P,V,a===0,l)}},ct=class extends X{constructor(t){super();const e=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new nt,this.scene.parent=this}setSize(t,e,n){return this.width=t,this.height=e,this.ratio=typeof n>"u"?Hs(this.ctx):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&K.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this.trigger(X.Types.resize,t,e,n)}render(){const t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Te.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};w(ct,"Utils",Te);function Fm(t,e,n,r,s,o,a,l,c){const d=a-o,h=Ei.Tolerance.epsilon,u=Math.abs(d)<h;let m=Pt(d,at);m<h&&(u?m=0:m=at),l===!0&&!u&&(m===at?m=-at:m=m-at);for(let g=0;g<wt.Resolution;g++){const f=g/(wt.Resolution-1),p=o+f*m;let y=e+r*Math.cos(p),b=n+s*Math.sin(p);if(c!==0){const _=Math.cos(c),C=Math.sin(c),S=y-e,v=b-n;y=S*_-v*C+e,b=S*C+v*_+n}t.lineTo(y,b)}}function gc(t,e,n,r){const s=t*n+e*r,o=Xr(t*t+e*e)*Xr(n*n+r*r);let a=Pm(uo(-1,Nm(1,s/o)));return t*r-e*n<0&&(a=-a),a}function Yr(t){return t[0]===1&&t[3]===0&&t[1]===0&&t[4]===1&&t[2]===0&&t[5]===0}var oe={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(t,e){const n=t,r=document.createElementNS(oe.ns,n);return n==="svg"&&(e=K.defaults(e||{},{version:oe.version})),e&&Object.keys(e).length>0&&oe.setAttributes(r,e),r},setAttributes:function(t,e){const n=Object.keys(e);for(let r=0;r<n.length;r++)/href/.test(n[r])?t.setAttributeNS(oe.xlink,n[r],e[n[r]]):t.setAttribute(n[r],e[n[r]]);return this},removeAttributes:function(t,e){for(let n in e)t.removeAttribute(n);return this},toString:function(t,e){let n=t.length,r=n-1,s,o="";for(let a=0;a<n;a++){const l=t[a],c=e?Pt(a-1,n):Math.max(a-1,0),d=t[c];let h,u,m,g,f,p,y,b,_,C,S,v,B,k,R,$=Ne(l.x),P=Ne(l.y);switch(l.command){case te.close:h=te.close;break;case te.arc:S=l.rx,v=l.ry,B=l.xAxisRotation,k=l.largeArcFlag,R=l.sweepFlag,h=te.arc+" "+S+" "+v+" "+B+" "+k+" "+R+" "+$+" "+P;break;case te.curve:y=d.controls&&d.controls.right||Q.zero,b=l.controls&&l.controls.left||Q.zero,d.relative?(m=Ne(y.x+d.x),g=Ne(y.y+d.y)):(m=Ne(y.x),g=Ne(y.y)),l.relative?(f=Ne(b.x+l.x),p=Ne(b.y+l.y)):(f=Ne(b.x),p=Ne(b.y)),h=(a===0?te.move:te.curve)+" "+m+" "+g+" "+f+" "+p+" "+$+" "+P;break;case te.move:s=l,h=te.move+" "+$+" "+P;break;default:h=l.command+" "+$+" "+P}a>=r&&e&&(l.command===te.curve&&(u=s,_=l.controls&&l.controls.right||l,C=u.controls&&u.controls.left||u,l.relative?(m=Ne(_.x+l.x),g=Ne(_.y+l.y)):(m=Ne(_.x),g=Ne(_.y)),u.relative?(f=Ne(C.x+u.x),p=Ne(C.y+u.y)):(f=Ne(C.x),p=Ne(C.y)),$=Ne(u.x),P=Ne(u.y),h+=" C "+m+" "+g+" "+f+" "+p+" "+$+" "+P),l.command!==te.close&&(h+=" Z")),o+=h+" "}return o},pointsToString:function(t,e){let n="";const r=e*.5;for(let s=0;s<t.length;s++){const o=t[s].x,a=t[s].y-r;n+=te.move+" "+o+" "+a+" ",n+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return n},getClip:function(t,e){let n=t._renderer.clip;return n||(n=t._renderer.clip=oe.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&e.defs.appendChild(n),n},getRendererType:function(t){return t in oe?t:"path"},defs:{update:function(t){const{defs:e}=t;if(e._flagUpdate){const n=Array.prototype.slice.call(e.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})"]`;t.querySelector(a)||e.removeChild(s)}e._flagUpdate=!1}}},group:{appendChild:function(t){const e=t._renderer.elem;if(!e)return;const n=e.nodeName;!n||/(radial|linear)gradient/i.test(n)||t._clip||this.elem.appendChild(e)},removeChild:function(t){const e=t._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||t._clip||this.elem.removeChild(e)},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){const e=oe.getRendererType(t._renderer.type);oe[e].render.call(t,this)},render:function(t){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=oe.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,n={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const s=this.children[r],o=oe.getRendererType(s._renderer.type);oe[o].render.call(s,t)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(oe.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(oe.group.removeChild,n),this._flagOrder&&this.children.forEach(oe.group.orderChild,n),this._flagMask)if(this._mask){const r=oe.getRendererType(this._mask._renderer.type);oe[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=oe.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=oe.getRendererType(this._stroke._renderer.type);oe[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=rn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?oe.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=oe.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=oe.getClip(this,t),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=oe.getRendererType(this._mask._renderer.type);oe[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const o=this.worldMatrix.elements,a=Qn(o[0],o[3],o[1],o[4],o[2],o[5]);r/=Math.max(a.scaleX,a.scaleY)}const s=oe.pointsToString(this._renderer.collection,r);e.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=oe.getRendererType(this._stroke._renderer.type);oe[r].render.call(this._stroke,t,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=rn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?oe.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=oe.createElement("path",e),t.appendChild(this._renderer.elem)),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=oe.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=oe.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=oe.getRendererType(this._stroke._renderer.type);oe[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=rn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?oe.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=oe.createElement("text",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=oe.getClip(this,t),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=oe.getRendererType(this._mask._renderer.type);oe[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||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?oe.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=oe.createElement("linearGradient",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let 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?oe.setAttributes(o._renderer.elem,a):o._renderer.elem=oe.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(t,e){K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||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?oe.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=oe.createElement("radialGradient",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let 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?oe.setAttributes(o._renderer.elem,a):o._renderer.elem=oe.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(t,e){K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||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 Q?(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 Q?(n.width*=this._scale.x,n.height*=this._scale.y):(n.width*=this._scale,n.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=n.width,r.height=n.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?oe.setAttributes(this._renderer.image,r):this._renderer.image=oe.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&oe.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=oe.createElement("pattern",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},mc=class extends X{constructor(t){super(),this.domElement=t.domElement||oe.createElement("svg"),this.scene=new nt,this.scene.parent=this,this.defs=oe.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,e){return this.width=t,this.height=e,oe.setAttributes(this.domElement,{width:t,height:e}),this.trigger(X.Types.resize,t,e)}render(){return oe.group.render.call(this.scene,this.domElement),oe.defs.update(this.domElement),this}};w(mc,"Utils",oe);var Dt={create:function(t,e,n){const r=t.createShader(t[n]);if(t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Rt("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
|
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
gl_FragColor = texel;
|
|
102
102
|
}
|
|
103
|
-
`}},Ur=Fi.Multiply,Mm=[1,0,0,0,1,0,0,0,1],zn=new nn(9),Am=ct.Utils,pc=new Q,fo=new nn([0,0,1,0,0,1,0,1,1,0,1,1]),be={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:He.document?He.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Fi,group:{removeChild:function(t,e){if(t.children)for(let n=0;n<t.children.length;n++)be.group.removeChild(t.children[n],e);t._renderer.texture&&(e.deleteTexture(t._renderer.texture),delete t._renderer.texture),t._renderer.positionBuffer&&(e.deleteBuffer(t._renderer.positionBuffer),delete t._renderer.positionBuffer)},render:function(t,e){if(!this._visible)return;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.parent,r=n._matrix&&n._matrix.manual||n._flagMatrix,s=this._matrix.manual||this._flagMatrix;if((r||s)&&(this._renderer.matrix||(this._renderer.matrix=new nn(9)),this._matrix.toTransformArray(!0,zn),Ur(zn,n._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof Q||(this._renderer.scale=new Q),this._scale instanceof Q?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(n._renderer.type)||(this._renderer.scale.x*=n._renderer.scale.x,this._renderer.scale.y*=n._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const a=ct.Utils.getRendererType(this._mask._renderer.type);be[a].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);let o;if(this._flagSubtractions)for(o=0;o<this.subtractions.length;o++)be.group.removeChild(this.subtractions[o],t);for(o=0;o<this.children.length;o++){const a=this.children[o],l=ct.Utils.getRendererType(a._renderer.type);be[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(t,e){let n,r,s,o,a,l,c,d,h,u,m,g,f,p;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,C=t.renderer.ratio,S=pc.copy(e._renderer.scale).multiply(C),v=e._stroke,B=e._linewidth,k=e._fill,R=e._renderer.opacity||e._opacity,$=e._cap,P=e._join,I=e._miter,V=e._closed,A=e.dashes,L=y.length,D=L-1;b.width=Math.max(Math.ceil(e._renderer.rect.width*S.x),1),b.height=Math.max(Math.ceil(e._renderer.rect.height*S.y),1);const ee=e._renderer.rect.centroid,E=ee.x,N=ee.y;if(_.clearRect(0,0,b.width,b.height),k)if(typeof k=="string")_.fillStyle=k;else{const me=ct.Utils.getRendererType(k._renderer.type);be[me].render.call(k,_,e),_.fillStyle=k._renderer.effect}if(v){if(typeof v=="string")_.strokeStyle=v;else{const me=ct.Utils.getRendererType(v._renderer.type);be[me].render.call(v,_,e),_.strokeStyle=v._renderer.effect}B&&(_.lineWidth=rn(e)),I&&(_.miterLimit=I),P&&(_.lineJoin=P),!V&&$&&(_.lineCap=$)}typeof R=="number"&&(_.globalAlpha=R),A&&A.length>0&&(_.lineDashOffset=A.offset||0,_.setLineDash(A));let H,q,Y,F,M,Z,fe,ie;_.save(),_.scale(S.x,S.y),_.translate(E,N),_.beginPath();for(let me=0;me<y.length;me++){const re=y[me];switch(g=re.x,f=re.y,re.command){case te.close:_.closePath();break;case te.arc:q=re.rx,Y=re.ry,F=re.xAxisRotation,M=re.largeArcFlag,Z=re.sweepFlag,n=V?Pt(me-1,L):Math.max(me-1,0),r=y[n],fe=r.x,ie=r.y,Am.renderSvgArcCommand(_,fe,ie,q,Y,M,Z,F,g,f);break;case te.curve:n=V?Pt(me-1,L):Math.max(me-1,0),r=y[n],d=r.controls&&r.controls.right||Q.zero,h=re.controls&&re.controls.left||Q.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),re._relative?(o=h.x+re.x,a=h.y+re.y):(o=h.x,a=h.y),_.bezierCurveTo(l,c,o,a,g,f),me>=D&&V&&(s=H,u=re.controls&&re.controls.right||Q.zero,m=s.controls&&s.controls.left||Q.zero,re._relative?(l=u.x+re.x,c=u.y+re.y):(l=u.x,c=u.y),s._relative?(o=m.x+s.x,a=m.y+s.y):(o=m.x,a=m.y),g=s.x,f=s.y,_.bezierCurveTo(l,c,o,a,g,f));break;case te.line:_.lineTo(g,f);break;case te.move:H=re,_.moveTo(g,f);break}}V&&_.closePath(),be.isHidden.test(k)||(p=k._renderer&&k._renderer.offset,p&&(_.save(),_.translate(-k._renderer.offset.x,-k._renderer.offset.y),_.scale(k._renderer.scale.x,k._renderer.scale.y)),_.fill(),p&&_.restore()),be.isHidden.test(v)||(p=v._renderer&&v._renderer.offset,p&&(_.save(),_.translate(-v._renderer.offset.x,-v._renderer.offset.y),_.scale(v._renderer.scale.x,v._renderer.scale.y),_.lineWidth=B/v._renderer.scale.x),_.stroke(),p&&_.restore()),_.restore()},getBoundingClientRect:function(t,e,n){let r=1/0,s=-1/0,o=1/0,a=-1/0,l,c;t.forEach(function(d){const h=d.x,u=d.y,m=d.controls;let g,f,p,y,b,_;o=Math.min(u,o),r=Math.min(h,r),s=Math.max(h,s),a=Math.max(u,a),d.controls&&(b=m.left,_=m.right,!(!b||!_)&&(g=d._relative?b.x+h:b.x,f=d._relative?b.y+u:b.y,p=d._relative?_.x+h:_.x,y=d._relative?_.y+u:_.y,!(!g||!f||!p||!y)&&(o=Math.min(f,y,o),r=Math.min(g,p,r),s=Math.max(g,p,s),a=Math.max(f,y,a))))}),typeof e=="number"&&(o-=e,r-=e,s+=e,a+=e),l=s-r,c=a-o,n.top=o,n.left=r,n.right=s,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-o},render:function(t,e,n){if(!this._visible||!this._opacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,s=ct.Utils.getRendererType(this._renderer.type),o=e[s],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof We&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof je&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Pe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof We&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof je&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Pe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new nn(9)),this._matrix.toTransformArray(!0,zn),Ur(zn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof Q||(this._renderer.scale=new Q);let u,m;this._scale instanceof Q?(u=this._scale.x*r._renderer.scale.x,m=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,m=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=m<0?-m:m,c&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const u=ct.Utils.getRendererType(this._mask._renderer.type);be[u].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,be.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),be.updateTexture.call(be,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==o&&(t.useProgram(o),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,fo,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const h=this._renderer.rect;return t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform4f(o.rect,h.left,h.top,h.right,h.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let n;const r=this.canvas,s=this.ctx,o=t.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,h=e.dashes,u=e._size*o;let m=u;be.isHidden.test(a)||(m+=l),r.width=sl(m),r.height=r.width;const g=m/r.width,f=r.width/2,p=r.height/2;if(s.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")s.fillStyle=c;else{const y=ct.Utils.getRendererType(c._renderer.type);be[y].render.call(c,s,e),s.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")s.strokeStyle=a;else{const y=ct.Utils.getRendererType(a._renderer.type);be[y].render.call(a,s,e),s.strokeStyle=a._renderer.effect}l&&(s.lineWidth=rn(e)/g)}typeof d=="number"&&(s.globalAlpha=d),h&&h.length>0&&(s.lineDashOffset=h.offset||0,s.setLineDash(h)),s.save(),s.translate(f,p),s.scale(be.precision,be.precision),s.beginPath(),s.arc(0,0,u/g*.5,0,at),s.restore(),closed&&s.closePath(),be.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(s.save(),s.translate(-c._renderer.offset.x,-c._renderer.offset.y),s.scale(c._renderer.scale.x,c._renderer.scale.y)),s.fill(),n&&s.restore()),be.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(s.save(),s.translate(-a._renderer.offset.x,-a._renderer.offset.y),s.scale(a._renderer.scale.x,a._renderer.scale.y),s.lineWidth=l/a._renderer.scale.x),s.stroke(),n&&s.restore())},render:function(t,e,n){if(!this._visible||!this._opacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const s=n||this.parent,o=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=s._matrix.manual||s._flagMatrix,h=this._matrix.manual||this._flagMatrix,u=this._renderer.parent!==s,m=this._renderer.vertices,g=this._renderer.collection.length,f=this._flagVertices,p=this._flagFill||this._fill instanceof We&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof je&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Pe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof We&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof je&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Pe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||s._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||h||u){this._renderer.matrix||(this._renderer.matrix=new nn(9)),this._matrix.toTransformArray(!0,zn),Ur(zn,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof Q||(this._renderer.scale=new Q);let y,b;this._scale instanceof Q?(y=this._scale.x*s._renderer.scale.x,b=this._scale.y*s._renderer.scale.y):(y=this._scale*s._renderer.scale.x,b=this._scale*s._renderer.scale.y),this._renderer.scale.x=y<0?-y:y,this._renderer.scale.y=b<0?-b:b,u&&(this._renderer.parent=s)}if(f){const y=this._renderer.positionBuffer;y&&t.deleteBuffer(y),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,m,t.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*s._renderer.opacity,be.updateTexture.call(be,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(be.isHidden.test(l)||(r+=c),r/=be.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==o&&(t.useProgram(o),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform1f(o.size,r*e.resolution.ratio),t.drawArrays(t.POINTS,0,g),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){const n=this.canvas,r=this.ctx,s=t.renderer.ratio,o=pc.copy(e._renderer.scale).multiply(s),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,h=e.dashes,u=e._decoration,m=e._direction;n.width=Math.max(Math.ceil(e._renderer.rect.width*o.x),1),n.height=Math.max(Math.ceil(e._renderer.rect.height*o.y),1);const g=e._renderer.rect.centroid,f=g.x,p=g.y;let y,b,_,C,S,v,B,k,R,$,P;const I=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),I||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=m,c)if(typeof c=="string")r.fillStyle=c;else{const V=ct.Utils.getRendererType(c._renderer.type);be[V].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const V=ct.Utils.getRendererType(a._renderer.type);be[V].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=rn(e))}if(typeof d=="number"&&(r.globalAlpha=d),h&&h.length>0&&(r.lineDashOffset=h.offset||0,r.setLineDash(h)),r.save(),r.scale(o.x,o.y),r.translate(f,p),be.isHidden.test(c)||(c._renderer&&c._renderer.offset?(v=c._renderer.scale.x,B=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(v,B),y=e._size/c._renderer.scale.y,b=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,C=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,C),r.restore()):r.fillText(e.value,0,0)),be.isHidden.test(a)||(a._renderer&&a._renderer.offset?(v=a._renderer.scale.x,B=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(v,B),y=e._size/a._renderer.scale.y,b=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,C=a._renderer.offset.y/a._renderer.scale.y,S=l/a._renderer.scale.x,r.lineWidth=S,r.strokeText(e.value,_,C),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(u)){const V=r.measureText(e.value);switch(u){case"underline":R=V.actualBoundingBoxDescent,P=V.actualBoundingBoxDescent;break;case"strikethrough":R=0,P=0;break}k=-V.width/2,$=V.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,R),r.lineTo($,P),r.stroke()}r.restore()},getBoundingClientRect:function(t,e){const n=be.ctx;n.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),n.textAlign="center",n.textBaseline=ct.Utils.baselines[t._baseline]||t._baseline;const r=n.measureText(t._value);let s=r.width,o=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!be.isHidden.test(this._stroke)&&(s+=this._linewidth*2,o+=this._linewidth*2);const a=s/2,l=o/2;switch(be.alignments[t._alignment]||t._alignment){case be.alignments.left:t.direction==="ltr"?(e.left=0,e.right=s):(e.left=-s,e.right=0);break;case be.alignments.right:t.direction==="ltr"?(e.left=-s,e.right=0):(e.left=0,e.right=s);break;default:e.left=-a,e.right=a}switch(t._baseline){case"bottom":e.top=-o,e.bottom=0;break;case"top":e.top=0,e.bottom=o;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=s,e.height=o,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(t,e,n){if(!this._visible||!this._opacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,s=e[this._renderer.type],o=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof We&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof je&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Pe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof We&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof je&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Pe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(o||a||l){this._renderer.matrix||(this._renderer.matrix=new nn(9)),this._matrix.toTransformArray(!0,zn),Ur(zn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof Q||(this._renderer.scale=new Q);let h,u;this._scale instanceof Q?(h=this._scale.x*r._renderer.scale.x,u=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,u=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=u<0?-u:u,l&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const h=ct.Utils.getRendererType(this._mask._renderer.type);be[h].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,be.text.getBoundingClientRect(this,this._renderer.rect),be.updateTexture.call(be,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==s&&(t.useProgram(s),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,fo,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,d.left,d.top,d.right,d.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=e.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=t.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 K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=e.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=t.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 K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t,e){if(!t.canvas.getContext("2d"))return;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=t.createPattern(n,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof Q||(this._renderer.offset=new Q),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,n&&(this._renderer.offset.x+=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof Q?(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 Q||(this._renderer.scale=new Q);let r,s;this._scale instanceof Q?(r=this._scale.x,s=this._scale.y):(r=this._scale,s=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=s<0?-s:s}return K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(t,e){const n=ct.Utils.getRendererType(e._renderer.type);if(this[n].updateCanvas.call(be,t,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&t.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=t.createTexture()),t.bindTexture(t.TEXTURE_2D,e._renderer.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR)},program:{create:function(t,e){let n,r,s;if(n=t.createProgram(),K.each(e,function(o){t.attachShader(n,o)}),t.linkProgram(n),r=t.getProgramParameter(n,t.LINK_STATUS),!r)throw s=t.getProgramInfoLog(n),t.deleteProgram(n),new Rt("unable to link program: "+s);return n}},extensions:{init:function(t){const e={},n=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<n.length;r++){const s=n[r];e[s]=be.extensions.get(t,s)}return e},get:function(t,e){return t.getExtension(e)||t.getExtension(`MOZ_${e}`)||t.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new Fr};be.ctx=be.canvas.getContext("2d");var yc=class extends X{constructor(t){super();let e,n,r,s;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(be.canvas=t.offscreenElement,be.ctx=be.canvas.getContext("2d")),this.scene=new nt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new nn(Mm),scale:1,opacity:1},this._flagMatrix=!0,t=K.defaults(t||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=t.overdraw,e=this.ctx=this.domElement.getContext("webgl",t)||this.domElement.getContext("experimental-webgl",t),!this.ctx)throw new Rt("unable to create a webgl context. Try using another renderer.");r=Dt.create(e,Dt.path.vertex,Dt.types.vertex),s=Dt.create(e,Dt.path.fragment,Dt.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=be.program.create(e,[r,s]),this.programs.text=this.programs.path,e.extensions=be.extensions.init(e),e.renderer=this,n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.rect=e.getUniformLocation(n,"u_rect");const o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,fo,e.STATIC_DRAW),r=Dt.create(e,Dt.points.vertex,Dt.types.vertex),s=Dt.create(e,Dt.points.fragment,Dt.types.fragment),n=this.programs.points=be.program.create(e,[r,s]),n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.size=e.getUniformLocation(n,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(t,e,n){let r,s;const o=this.ctx;return this.width=t,this.height=e,this.ratio=typeof n>"u"?Hs(o):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,K.isObject(this.domElement.style)&&K.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*this.ratio,s=e*this.ratio,o.viewport(0,0,r,s),this.programs.resolution.width=r,this.programs.resolution.height=s,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(X.Types.resize,t,e,n)}render(){const t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),be.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};w(yc,"Utils",be);var Vm=K.extend({Error:Rt,getRatio:Hs,read:ze,xhr:dc},K,_t,tl,nl),we=class Rr{constructor(e){w(this,"_events",new X),w(this,"type",""),w(this,"renderer",null),w(this,"scene",null),w(this,"width",0),w(this,"height",0),w(this,"frameCount",0),w(this,"timeDelta",0),w(this,"playing",!1);const n=K.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Rr.Types.svg,autostart:!1});if(K.each(n,function(r,s){/fullscreen/i.test(s)||/autostart/i.test(s)||(this[s]=r)},this),K.isElement(n.domElement)){const r=n.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=Rr.Types[r])}this.renderer=new Rr[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=Om.bind(this),this.fit.domElement=window,this.fit.attached=!0,K.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),K.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Ft.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=Im.bind(this),K.extend(this.renderer.domElement.style,{display:"block"})):typeof n.width=="number"&&typeof n.height=="number"&&(this.renderer.setSize(n.width,n.height,this.ratio),this.width=n.width,this.height=n.height),this.renderer.bind(X.Types.resize,zm.bind(this)),this.scene=this.renderer.scene,Rr.Instances.push(this),n.autostart&&sr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,sr.init(),this.trigger(X.Types.play)}pause(){return this.playing=!1,this.trigger(X.Types.pause)}setPlaying(e){this.playing=e}release(e){let n,r,s;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(n=0;n<e.vertices.length;n++)r=e.vertices[n],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(n=0;n<e.children.length;n++)s=e.children[n],this.release(s);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const o=this.renderer.ctx;e._renderer.texture&&(o.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(o.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}update(){const e=!!this._lastFrame,n=K.performance.now();e&&(this.timeDelta=parseFloat((n-this._lastFrame).toFixed(3))),this._lastFrame=n,this.fit&&this.fit.domElement&&!this.fit.attached&&(Ft.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,s=this.height,o=this.renderer;return(r!==o.width||s!==o.height)&&o.setSize(r,s,this.ratio),this.trigger(X.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(X.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,n,r,s){const o=new Wr(e,n,r,s);return this.scene.add(o),o}makeArrow(e,n,r,s,o){const a=typeof o=="number"?o:10,l=Math.atan2(s-n,r-e),c=[new ve(e,n,void 0,void 0,void 0,void 0,te.move),new ve(r,s,void 0,void 0,void 0,void 0,te.line),new ve(r-a*Math.cos(l-Math.PI/4),s-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,te.line),new ve(r,s,void 0,void 0,void 0,void 0,te.move),new ve(r-a*Math.cos(l+Math.PI/4),s-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,te.line)],d=new Se(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,n,r,s){const o=new In(e,n,r,s);return this.scene.add(o),o}makeRoundedRectangle(e,n,r,s,o){const a=new Lr(e,n,r,s,o);return this.scene.add(a),a}makeCircle(e,n,r,s){const o=new Ir(e,n,r,s);return this.scene.add(o),o}makeEllipse(e,n,r,s,o){const a=new zr(e,n,r,s,o);return this.scene.add(a),a}makeStar(e,n,r,s,o){const a=new io(e,n,r,s,o);return this.scene.add(a),a}makeCurve(e){const n=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<n;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new ve(l,c))}}const r=arguments[n-1],s=new Se(e,!(typeof r=="boolean"&&r),!0),o=s.getBoundingClientRect();return s.center().translation.set(o.left+o.width/2,o.top+o.height/2),this.scene.add(s),s}makePolygon(e,n,r,s){const o=new no(e,n,r,s);return this.scene.add(o),o}makeArcSegment(e,n,r,s,o,a,l){const c=new Ks(e,n,r,s,o,a,l);return this.scene.add(c),c}makePoints(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let o=0;o<n;o+=2){const a=arguments[o];if(typeof a!="number")break;const l=arguments[o+1];r.push(new Q(a,l))}}const s=new to(r);return this.scene.add(s),s}makePath(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<n;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new ve(c,d))}}const s=arguments[n-1],o=new Se(r,!(typeof s=="boolean"&&s)),a=o.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&o.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(o),o}makeText(e,n,r,s){const o=new sn(e,n,r,s);return this.add(o),o}makeLinearGradient(e,n,r,s){const o=Array.prototype.slice.call(arguments,4),a=new We(e,n,r,s,o);return this.add(a),a}makeRadialGradient(e,n,r){const s=Array.prototype.slice.call(arguments,3),o=new je(e,n,r,s);return this.add(o),o}makeSprite(e,n,r,s,o,a,l){const c=new Or(e,n,r,s,o,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,s,o,a){const l=new hc(e,n,r,s,o,a);return this.add(l),l}makeImageSequence(e,n,r,s,o){const a=new ao(e,n,r,s);return o&&a.play(),this.add(a),a}makeTexture(e,n){return new Pe(e,n)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const n=new nt;return this.scene.add(n),n.add(e),n}interpret(e,n,r){const s=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(s in ze))return null;const o=ze[s].call(this,e);return r?this.add(n&&o instanceof nt?o.children:o):o.parent&&o.remove(),o}load(e,n){const r=new nt;let s,o,a;const l=(function(c){for(Ft.temp.innerHTML=c,o=0;o<Ft.temp.children.length;o++)s=Ft.temp.children[o],a=this.interpret(s,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Ft.temp.children.length<=1?Ft.temp.children[0]:Ft.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(dc(e,l),r):(l(e),r)}};w(we,"NextFrameId",wt.NextFrameId),w(we,"Types",wt.Types),w(we,"Version",wt.Version),w(we,"PublishDate",wt.PublishDate),w(we,"Identifier",wt.Identifier),w(we,"Resolution",wt.Resolution),w(we,"AutoCalculateImportedMatrices",wt.AutoCalculateImportedMatrices),w(we,"Instances",wt.Instances),w(we,"uniqueId",wt.uniqueId),w(we,"Anchor",ve),w(we,"Collection",An),w(we,"Events",X),w(we,"Group",nt),w(we,"Matrix",Fi),w(we,"Path",Se),w(we,"Registry",Fr),w(we,"Element",Pi),w(we,"Shape",On),w(we,"Text",sn),w(we,"Vector",Q),w(we,"Gradient",Qe),w(we,"Image",hc),w(we,"ImageSequence",ao),w(we,"LinearGradient",We),w(we,"RadialGradient",je),w(we,"Sprite",Or),w(we,"Stop",Vn),w(we,"Texture",Pe),w(we,"ArcSegment",Ks),w(we,"Circle",Ir),w(we,"Ellipse",zr),w(we,"Line",Wr),w(we,"Points",to),w(we,"Polygon",no),w(we,"Rectangle",In),w(we,"RoundedRectangle",Lr),w(we,"Star",io),w(we,"CanvasRenderer",ct),w(we,"SVGRenderer",mc),w(we,"WebGLRenderer",yc),w(we,"Commands",te),w(we,"Utils",Vm);var an=we;function Om(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function Im(){const t=this.renderer.domElement.parentElement;if(!t){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=t.getBoundingClientRect(),n=this.width=e.width,r=this.height=e.height;this.renderer.setSize(n,r,this.ratio)}function zm(t,e){this.width=t,this.height=e,this.trigger(X.Types.resize,t,e)}var sr=Ft.getRequestAnimationFrame();function bc(){for(let t=0;t<an.Instances.length;t++){const e=an.Instances[t];e.playing&&e.update()}an.NextFrameId=sr(bc)}sr.init=function(){bc(),sr.init=function(){}};let ln;typeof window<"u"?ln=window:typeof global<"u"?ln=global:typeof self<"u"&&(ln=self);let _c;const ei=Math.PI*2,it=Math.PI*.5;function Lm(t,e,n,r,s,o){let a;return arguments.length<=1?(a=t.a,e=t.b,n=t.c,r=t.d,s=t.e,o=t.f):a=t,{translateX:s,translateY:o,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function Dm(t){_c=t}function Hm(t,e){e=e&&e.identity()||new _c;let n=t;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;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Ht(t,e,n){return n*(e-t)+t}function Vi(t,e){for(;t<0;)t+=e;return t%e}const wc=ln.Float32Array||Array,Wm=Math.floor;function cn(t){return Wm(t*1e6)/1e6}const he={move:"M",line:"L",curve:"C",close:"Z"};class U{constructor(){x(this,"_events",{});x(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let s=0,o=r.length;s<o;s++){e=r[s];let a=this._events[e];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[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];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(e,n,r){const s=this;e&&(o.obj=e,o.name=n,o.handler=r,e.on(n,o));function o(){r.apply(s,arguments)}return s}ignore(e,n,r){return e.off(n,r),this}}x(U,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),x(U,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const xc={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(U.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(U.Types.change))}}},st=class st extends U{constructor(n=0,r=0){super();x(this,"_x",0);x(this,"_y",0);for(let s in xc)Object.defineProperty(this,s,xc[s]);this.x=n,this.y=r}static add(n,r){return new st(n.x+r.x,n.y+r.y)}static sub(n,r){return new st(n.x-r.x,n.y-r.y)}static subtract(n,r){return st.sub(n,r)}static ratioBetween(n,r){return(n.x*r.x+n.y*r.y)/(n.length()*r.length())}static angleBetween(n,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const s=n.x-r.x,o=n.y-r.y;return Math.atan2(o,s)}static distanceBetween(n,r){return Math.sqrt(st.distanceBetweenSquared(n,r))}static distanceBetweenSquared(n,r){const s=n.x-r.x,o=n.y-r.y;return s*s+o*o}set(n,r){return this.x=n,this.y=r,this}copy(n){return this.x=n.x,this.y=n.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new st(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,s=this.y-n.y;return r*r+s*s}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const s=(n.x-this.x)*r+this.x,o=(n.y-this.y)*r+this.y;return this.set(s,o)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:cn(this.x),y:cn(this.y)}}rotate(n){const r=this.x,s=this.y,o=Math.cos(n),a=Math.sin(n);return this.x=r*o-s*a,this.y=r*a+s*o,this}};x(st,"zero",new st),x(st,"left",new st(-1,0)),x(st,"right",new st(1,0)),x(st,"up",new st(0,-1)),x(st,"down",new st(0,1));let ge=st;class Re extends ge{constructor(n=0,r=0,s=0,o=0,a=0,l=0,c=he.move){super(n,r);x(this,"controls",{left:new ge,right:new ge});x(this,"_command",he.move);x(this,"_relative",!0);x(this,"_rx",0);x(this,"_ry",0);x(this,"_xAxisRotation",0);x(this,"_largeArcFlag",0);x(this,"_sweepFlag",1);for(let h in vc)Object.defineProperty(this,h,vc[h]);this.command=c,this.relative=!0;const d=Re.makeBroadcast(this);this.controls.left.set(s,o).addEventListener(U.Types.change,d),this.controls.right.set(a,l).addEventListener(U.Types.change,d)}static makeBroadcast(n){return r;function r(){n._bound&&n.dispatchEvent(U.Types.change)}}static fromObject(n){return new Re().copy(n)}copy(n){return this.x=n.x,this.y=n.y,typeof n.command=="string"&&(this.command=n.command),n.controls&&(n.controls.left&&this.controls.left.copy(n.controls.left),n.controls.right&&this.controls.right.copy(n.controls.right)),typeof n.relative=="boolean"&&(this.relative=n.relative),typeof n.rx=="number"&&(this.rx=n.rx),typeof n.ry=="number"&&(this.ry=n.ry),typeof n.xAxisRotation=="number"&&(this.xAxisRotation=n.xAxisRotation),typeof n.largeArcFlag=="number"&&(this.largeArcFlag=n.largeArcFlag),typeof n.sweepFlag=="number"&&(this.sweepFlag=n.sweepFlag),this}clone(){return new Re().copy(this)}toObject(){return{x:cn(this.x),y:cn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:cn(this.rx),ry:cn(this.ry),xAxisRotation:cn(this.xAxisRotation),largeArcFlag:cn(this.largeArcFlag),sweepFlag:cn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const vc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(U.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(U.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(U.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(U.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(U.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(U.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(U.Types.change))}}};let jm=0;const go={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return jm++}},Gr={RecursionLimit:16,abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Kr(t,e,n,r,s){const o=1-t;return o*o*o*e+3*o*o*t*n+3*o*t*t*r+t*t*t*s}function kc(t,e,n,r,s,o,a,l,c){c=c||Gr.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Re(a,l)];const h=[];for(let u=0;u<d;u++){const m=u/d,g=Kr(m,t,n,s,a),f=Kr(m,e,r,o,l);h.push(new Re(g,f))}return h}function qm(t,e,n,r,s,o,a,l,c){if(t===n&&e===r&&s===a&&o===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-s)+3*(a-t),h=6*(t+s)-12*n,u=3*(n-t),m=9*(r-o)+3*(l-e),g=6*(e+o)-12*r,f=3*(r-e);function p(y){const b=(d*y+h)*y+u,_=(m*y+g)*y+f;return Math.sqrt(b*b+_*_)}return Ym(p,0,1,c||Gr.RecursionLimit)}function Xm(t,e,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,m,g,f,p,y,b;for(let v=0;v<2;++v){if(v===0?(u=6*t-12*n+6*s,h=-3*t+9*n-9*s+3*a,m=3*n-3*t):(u=6*e-12*r+6*o,h=-3*e+9*r-9*o+3*l,m=3*r-3*e),Math.abs(h)<.001){if(Math.abs(u)<.001)continue;g=-m/u,0<g&&g<1&&c.push(g);continue}y=u*u-4*m*h,b=Math.sqrt(y),!(y<0)&&(f=(-u+b)/(2*h),0<f&&f<1&&c.push(f),p=(-u-b)/(2*h),0<p&&p<1&&c.push(p))}let _=c.length,C=_,S;for(;_--;)g=c[_],S=1-g,d[0][_]=S*S*S*t+3*S*S*g*n+3*S*g*g*s+g*g*g*a,d[1][_]=S*S*S*e+3*S*S*g*r+3*S*g*g*o+g*g*g*l;return d[0][C]=t,d[1][C]=e,d[0][C+1]=a,d[1][C+1]=l,d[0].length=d[1].length=C+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 Ym(t,e,n,r){let s=Gr.abscissas[r-2],o=Gr.weights[r-2],a=.5*(n-e),l=a+e,c=0,d=r+1>>1,h=r&1?o[c++]*t(l):0;for(;c<d;){const u=a*s[c];h+=o[c++]*(t(l+u)+t(l-u))}return a*h}function Um(t,e){const n=t.length,r=n-1;for(let s=0;s<n;s++){const o=t[s],a=e?Vi(s-1,n):Math.max(s-1,0),l=e?Vi(s+1,n):Math.min(s+1,r),c=t[a],d=o,h=t[l];Gm(c,d,h),d.command=s===0?he.move:he.curve}}function Gm(t,e,n){const r=ge.angleBetween(t,e),s=ge.angleBetween(n,e);let o=ge.distanceBetween(t,e),a=ge.distanceBetween(n,e),l=(r+s)/2;return o<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(o*=.33,a*=.33,s<r?l+=it:l-=it,e.controls.left.x=Math.cos(l)*o,e.controls.left.y=Math.sin(l)*o,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let or=(yi=class extends U{constructor(){super();x(this,"_flagId",!1);x(this,"_flagClassName",!1);x(this,"_renderer",{});x(this,"_id",go.Identifier+go.uniqueId());x(this,"_className","");x(this,"classList",[]);for(let n in Cc)Object.defineProperty(this,n,Cc[n])}static fromObject(n){const r=new yi().copy(n);return"id"in n&&(r.id=n.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(n){return n.renderer&&typeof n.renderer.type=="string"&&(this.renderer.type=n.renderer.type),typeof n.className=="string"&&(this.className=n.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){const n=this._renderer.type;return this._renderer={type:n},typeof this.unbind=="function"&&this.unbind(),this}},x(yi,"Properties",["renderer","id","className"]),yi);const Cc={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}};class Zr extends Error{constructor(n){super();x(this,"name","Two.js");x(this,"message");this.message=n}}class Km{constructor(){x(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let Qr;const Sc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};ln.document&&(Qr=document.createElement("a"));const Xe=class Xe extends or{constructor(n,r){super();x(this,"_flagSrc",!1);x(this,"_flagImage",!1);x(this,"_flagVideo",!1);x(this,"_flagLoaded",!1);x(this,"_flagRepeat",!1);x(this,"_flagOffset",!1);x(this,"_flagScale",!1);x(this,"_src","");x(this,"_image",null);x(this,"_loaded",!1);x(this,"_repeat","no-repeat");x(this,"_scale",1);x(this,"_offset",null);for(let s in Bc)Object.defineProperty(this,s,Bc[s]);if(this._renderer.type="texture",this._renderer.flagOffset=Zm.bind(this),this._renderer.flagScale=Qm.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new ge,typeof r=="function"){const s=(function(){this.unbind(U.Types.load,s),typeof r=="function"&&r()}).bind(this);this.bind(U.Types.load,s)}if(typeof n=="string")this.src=n;else if(typeof n=="object"){const s=Object.prototype.toString.call(n);(s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]"||s==="[object HTMLVideoElement]"||s==="[object Image]")&&(this.image=n)}this._update()}fromObject(n){const r=new Xe().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return Qr?(Qr.href=n,Qr.href):n}static loadHeadlessBuffer(n,r){n.image.onload=r,n.image.src=n.src}static getTag(n){return n&&n.nodeName&&n.nodeName.toLowerCase()||"img"}static getImage(n){const r=Xe.getAbsoluteURL(n);if(Xe.ImageRegistry.contains(r))return Xe.ImageRegistry.get(r);let s;return ln.document?Sc.video.test(r)?s=document.createElement("video"):s=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),s.crossOrigin="anonymous",s.referrerPolicy="no-referrer",s}static load(n,r){let s=n.image,o=Xe.getTag(s);n._flagImage&&(/canvas/i.test(o)?Xe.Register.canvas(n,r):(n._src=s.getAttribute("two-src")||s.src,Xe.Register[o](n,r))),n._flagSrc&&(s||(s=Xe.getImage(n.src),n.image=s),o=Xe.getTag(s),Xe.Register[o](n,r))}clone(){const n=new Xe(this.src);return n.repeat=this.repeat,n.offset.copy(this.offset),n.scale=this.scale,n}copy(n){return this.src=n.src,this.repeat=n.repeat,this.offset=typeof n.offset=="number"||n.offset instanceof ge?n.offset:new ge().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof ge?n.scale:new ge().copy(n.scale),this}toObject(){const n=super.toObject.call(this);return n.renderer.type="texture",n.src=this.src,n.repeat=this.repeat,n.offset=this.offset.toObject(),n.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),n}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(U.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Xe.load(this,(function(){this.loaded=!0,this.trigger(U.Types.change).trigger(U.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};x(Xe,"Properties",["src","loaded","repeat","scale","offset","image"]),x(Xe,"RegularExpressions",Sc),x(Xe,"ImageRegistry",new Km),x(Xe,"Register",{canvas:function(n,r){n._src="#"+n.id,Xe.ImageRegistry.add(n.src,n.image),typeof r=="function"&&r()},img:function(n,r){const s=n.image,o=function(l){s.removeEventListener&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",o,!1),s.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof s.removeEventListener=="function"&&(s.removeEventListener("load",o,!1),s.removeEventListener("error",a,!1)),new Zr("unable to load "+n.src)};typeof s.width=="number"&&s.width>0&&typeof s.height=="number"&&s.height>0?o():typeof s.addEventListener=="function"&&(s.addEventListener("load",o,!1),s.addEventListener("error",a,!1)),n._src=Xe.getAbsoluteURL(n._src),!(s&&s.getAttribute("two-src"))&&(s.setAttribute("two-src",n.src),Xe.ImageRegistry.add(n.src,s),n.image.src=n.src)},video:function(n,r){const s=function(a){n.image.removeEventListener("canplaythrough",s,!1),n.image.removeEventListener("error",o,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof r=="function"&&r()},o=function(a){throw n.image.removeEventListener("canplaythrough",s,!1),n.image.removeEventListener("error",o,!1),new Zr("unable to load "+n.src)};n._src=Xe.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Xe.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?s():(n.image.addEventListener("canplaythrough",s,!1),n.image.addEventListener("error",o,!1),n.image.src=n.src,n.image.load())}});let qe=Xe;const Bc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=qe.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}qe.ImageRegistry.contains(n)?this._image=qe.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(U.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(U.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof ge&&this._scale.unbind(U.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof ge&&this._scale.bind(U.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Zm(){this._flagOffset=!0}function Qm(){this._flagScale=!0}class ti extends Array{constructor(){super();Aa(this,ot,new U);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 Bt(this,ot)}set _events(n){Fu(this,ot,n)}get _bound(){return Bt(this,ot)._bound}set _bound(n){Bt(this,ot)._bound=n}addEventListener(){return Bt(this,ot).addEventListener.apply(this,arguments)}on(){return Bt(this,ot).on.apply(this,arguments)}bind(){return Bt(this,ot).bind.apply(this,arguments)}removeEventListener(){return Bt(this,ot).removeEventListener.apply(this,arguments)}off(){return Bt(this,ot).off.apply(this,arguments)}unbind(){return Bt(this,ot).unbind.apply(this,arguments)}dispatchEvent(){return Bt(this,ot).dispatchEvent.apply(this,arguments)}trigger(){return Bt(this,ot).trigger.apply(this,arguments)}listen(){return Bt(this,ot).listen.apply(this,arguments)}ignore(){return Bt(this,ot).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(U.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(U.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(U.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(U.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(U.Types.remove,n),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(U.Types.insert,r),this.trigger(U.Types.order)}return n}sort(){return super.sort.apply(this,arguments),this.trigger(U.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(U.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(n,r){const s=[];for(let o=0;o<this.length;o++){const a=this[o];let l;r?l=n.call(r,a,o):l=n(a,o),s.push(l)}return s}}ot=new WeakMap;const Tc=Array.prototype.slice;function Jm(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const $e={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=Tc.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let s in r)t[s]=r[s]}return t},defaults:function(t){const e=Tc.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let s in r)t[s]===void 0&&(t[s]=r[s])}return t},each:function(t,e,n){const r=n||this,s=!Jm(t)&&Object.keys(t),o=(s||t).length;for(let a=0;a<o;a++){const l=s?s[a]:a;e.call(r,t[l],l,t)}return t},performance:ln.performance&&ln.performance.now?ln.performance:Date},Et=class Et extends or{constructor(n,r,s){super();x(this,"_flagOffset",!0);x(this,"_flagOpacity",!0);x(this,"_flagColor",!0);x(this,"_offset",0);x(this,"_opacity",1);x(this,"_color","#fff");for(let o in Rc)Object.defineProperty(this,o,Rc[o]);this._renderer.type="stop",this.offset=typeof n=="number"?n:Et.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof r=="string"?r:Et.Index<=0?"#fff":"#000",Et.Index=(Et.Index+1)%2}static fromObject(n){const r=new Et().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Et.Properties.length;r++){const s=Et.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new Et;return $e.each(Et.Properties,function(s){r[s]=this[s]},this),n&&n.stops&&n.stops.push(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="stop",$e.each(Et.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};x(Et,"Index",0),x(Et,"Properties",["offset","opacity","color"]);let ni=Et;const Rc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},fn=class fn extends or{constructor(n){super();x(this,"_flagStops",!1);x(this,"_flagSpread",!1);x(this,"_flagUnits",!1);x(this,"_spread","");x(this,"_units","");for(let r in $c)Object.defineProperty(this,r,$c[r]);this._renderer.type="gradient",this._renderer.flagStops=ep.bind(this),this._renderer.bindStops=tp.bind(this),this._renderer.unbindStops=np.bind(this),this.spread="pad",this.units="objectBoundingBox",n&&(this.stops=n)}static fromObject(n){let r=n.stops;r&&r.length>0&&(r=r.map(o=>o instanceof ni?o:new ni().copy(o)));const s=new fn(r).copy(n);return"id"in n&&(s.id=n.id),s}clone(n){const r=this.stops.map(o=>o.clone()),s=new fn(r);return $e.each(fn.Properties,o=>{s[o]=this[o]},this),n&&n.add(s),s}copy(n){super.copy.call(this,n);for(let r=0;r<fn.Properties.length;r++){const s=fn.Properties[r];s in n&&(this[s]=n[s])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return $e.each(fn.Properties,r=>{n[r]=this[r]},this),n}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(U.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};x(fn,"Stop",ni),x(fn,"Properties",["spread","stops","units"]);let Je=fn;const $c={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(U.Types.insert,e).unbind(U.Types.remove,n),this._stops=new ti((t||[]).slice(0)),this._stops.bind(U.Types.insert,e).bind(U.Types.remove,n),e(this._stops)}}};function ep(){this._flagStops=!0}function tp(t){let e=t.length;for(;e--;)t[e].bind(U.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function np(t){let e=t.length;for(;e--;)t[e].unbind(U.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const qn=class qn extends Je{constructor(n,r,s,o,a){super(a);x(this,"_flagEndPoints",!1);x(this,"_left",null);x(this,"_right",null);for(let l in Ec)Object.defineProperty(this,l,Ec[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=ip.bind(this),this.left=new ge,this.right=new ge,typeof n=="number"&&(this.left.x=n),typeof r=="number"&&(this.left.y=r),typeof s=="number"&&(this.right.x=s),typeof o=="number"&&(this.right.y=o)}static fromObject(n){const r=new qn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<qn.Properties.length;r++){const s=qn.Properties[r];s in n&&(this[s]=n[s]instanceof ge?n[s]:new ge().copy(n[s]))}return this}clone(n){const r=this.stops.map(function(o){return o.clone()}),s=new qn(this.left._x,this.left._y,this.right._x,this.right._y,r);return $e.each(Je.Properties,function(o){s[o]=this[o]},this),n&&n.add(s),s}toObject(){const n=super.toObject.call(this);return n.left=this.left.toObject(),n.right=this.right.toObject(),n}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(U.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};x(qn,"Stop",ni),x(qn,"Properties",["left","right"]);let xt=qn;const Ec={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof ge&&this._left.unbind(U.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(U.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof ge&&this._right.unbind(U.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(U.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function ip(){this._flagEndPoints=!0}const gn=class gn extends Je{constructor(n,r,s,o,a,l){super(o);x(this,"_flagRadius",!1);x(this,"_flagCenter",!1);x(this,"_flagFocal",!1);x(this,"_radius",0);x(this,"_center",null);x(this,"_focal",null);for(let c in Nc)Object.defineProperty(this,c,Nc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=rp.bind(this),this._renderer.flagFocal=sp.bind(this),this.center=new ge,this.radius=typeof s=="number"?s:1,this.focal=new ge,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new gn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<gn.Properties.length;r++){const s=gn.Properties[r];s in n&&(/(center|focal)i/.test(s)?this[s]=n[s]instanceof ge?n[s]:new ge().copy(n[s]):typeof n[s]=="number"&&(this[s]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(o){return o.clone()}),s=new gn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return $e.each(Je.Properties.concat(gn.Properties),function(o){s[o]=this[o]},this),n&&n.add(s),s}toObject(){const n=super.toObject.call(this);return $e.each(gn.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(U.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};x(gn,"Stop",ni),x(gn,"Properties",["center","radius","focal"]);let vt=gn;const Nc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(U.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(U.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(U.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(U.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function rp(){this._flagCenter=!0}function sp(){this._flagFocal=!0}function Pc(t,e){if(e===0||e===1)return!0;const r=t._length*e;let s=0;for(let o=0;o<t._lengths.length;o++){const a=t._lengths[o];if(s>=r)return r-s>=0;s+=a}return!1}function Jr(t,e){const n=t._length;if(e<=0)return 0;if(e>=n)return t._lengths.length-1;for(let r=0,s=0;r<t._lengths.length;r++){if(s+t._lengths[r]>=e)return e-=s,Math.max(r-1,0)+e/t._lengths[r];s+=t._lengths[r]}return-1}function Fc(t,e,n){let r,s,o,a,l,c,d,h;const u=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,s=(u||e).x,c=(u||e).y,o=(m||t).x,d=(m||t).y,a=t.x,h=t.y,u&&e._relative&&(s+=e.x,c+=e.y),m&&t._relative&&(o+=t.x,d+=t.y),qm(r,l,s,c,o,d,a,h,n)}function Mc(t,e,n){let r,s,o,a,l,c,d,h;const u=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,s=(u||e).x,c=(u||e).y,o=(m||t).x,d=(m||t).y,a=t.x,h=t.y,u&&e._relative&&(s+=e.x,c+=e.y),m&&t._relative&&(o+=t.x,d+=t.y),kc(r,l,s,c,o,d,a,h,n)}function ii(t){switch(t.renderer.type){case"texture":return qe.fromObject(t);case"gradient":return Je.fromObject(t);case"linear-gradient":return xt.fromObject(t);case"radial-gradient":return vt.fromObject(t)}return t}const op=Math.cos,ap=Math.sin,Ac=Math.tan,mo=[],Ct=class Ct extends U{constructor(n,r,s,o,a,l){super();x(this,"elements",new wc(9));x(this,"manual",!1);let c=n;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(n,r,s){if(r.length<=3){const k=n;let R,$,P;const I=r[0]||0,V=r[1]||0,A=r[2]||0;return R=k[0]*I+k[1]*V+k[2]*A,$=k[3]*I+k[4]*V+k[5]*A,P=k[6]*I+k[7]*V+k[8]*A,[R,$,P]}const o=n[0],a=n[1],l=n[2],c=n[3],d=n[4],h=n[5],u=n[6],m=n[7],g=n[8],f=r[0],p=r[1],y=r[2],b=r[3],_=r[4],C=r[5],S=r[6],v=r[7],B=r[8];return s=s||new wc(9),s[0]=o*f+a*b+l*S,s[1]=o*p+a*_+l*v,s[2]=o*y+a*C+l*B,s[3]=c*f+d*b+h*S,s[4]=c*p+d*_+h*v,s[5]=c*y+d*C+h*B,s[6]=u*f+m*b+g*S,s[7]=u*p+m*_+g*v,s[8]=u*y+m*C+g*B,s}static fromObject(n){return new Ct().copy(n)}set(n,r,s,o,a,l,c,d,h){if(typeof r>"u"){const u=n;n=u[0],r=u[1],s=u[2],o=u[3],a=u[4],l=u[5],c=u[6],d=u[7],h=u[8]}return this.elements[0]=n,this.elements[1]=r,this.elements[2]=s,this.elements[3]=o,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=h,this.trigger(U.Types.change)}copy(n){return this.elements[0]=n.elements[0],this.elements[1]=n.elements[1],this.elements[2]=n.elements[2],this.elements[3]=n.elements[3],this.elements[4]=n.elements[4],this.elements[5]=n.elements[5],this.elements[6]=n.elements[6],this.elements[7]=n.elements[7],this.elements[8]=n.elements[8],this.manual=n.manual,this.trigger(U.Types.change)}identity(){return this.elements[0]=Ct.Identity[0],this.elements[1]=Ct.Identity[1],this.elements[2]=Ct.Identity[2],this.elements[3]=Ct.Identity[3],this.elements[4]=Ct.Identity[4],this.elements[5]=Ct.Identity[5],this.elements[6]=Ct.Identity[6],this.elements[7]=Ct.Identity[7],this.elements[8]=Ct.Identity[8],this.trigger(U.Types.change)}multiply(n,r,s,o,a,l,c,d,h){if(typeof r>"u")return this.elements[0]*=n,this.elements[1]*=n,this.elements[2]*=n,this.elements[3]*=n,this.elements[4]*=n,this.elements[5]*=n,this.elements[6]*=n,this.elements[7]*=n,this.elements[8]*=n,this.trigger(U.Types.change);if(typeof s>"u"&&(s=1),typeof o>"u"){n=n||0,r=r||0,s=s||0,a=this.elements;const D=a[0]*n+a[1]*r+a[2]*s,ee=a[3]*n+a[4]*r+a[5]*s,E=a[6]*n+a[7]*r+a[8]*s;return[D,ee,E]}const u=this.elements,m=[n,r,s,o,a,l,c,d,h],g=u[0],f=u[1],p=u[2],y=u[3],b=u[4],_=u[5],C=u[6],S=u[7],v=u[8],B=m[0],k=m[1],R=m[2],$=m[3],P=m[4],I=m[5],V=m[6],A=m[7],L=m[8];return this.elements[0]=g*B+f*$+p*V,this.elements[1]=g*k+f*P+p*A,this.elements[2]=g*R+f*I+p*L,this.elements[3]=y*B+b*$+_*V,this.elements[4]=y*k+b*P+_*A,this.elements[5]=y*R+b*I+_*L,this.elements[6]=C*B+S*$+v*V,this.elements[7]=C*k+S*P+v*A,this.elements[8]=C*R+S*I+v*L,this.trigger(U.Types.change)}inverse(n){const r=this.elements;n=n||new Ct;const s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],d=r[5],h=r[6],u=r[7],m=r[8],g=m*c-d*u,f=-m*l+d*h,p=u*l-c*h;let y=s*g+o*f+a*p;return y?(y=1/y,n.elements[0]=g*y,n.elements[1]=(-m*o+a*u)*y,n.elements[2]=(d*o-a*c)*y,n.elements[3]=f*y,n.elements[4]=(m*s-a*h)*y,n.elements[5]=(-d*s+a*l)*y,n.elements[6]=p*y,n.elements[7]=(-u*s+o*h)*y,n.elements[8]=(c*s-o*l)*y,n):null}scale(n,r){return arguments.length<=1&&(r=n),this.multiply(n,0,0,0,r,0,0,0,1)}rotate(n){const r=op(n),s=ap(n);return this.multiply(r,-s,0,s,r,0,0,0,1)}translate(n,r){return this.multiply(1,0,n,0,1,r,0,0,1)}skewX(n){const r=Ac(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Ac(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return mo.length=0,this.toTransformArray(n,mo),mo.map(cn).join(" ")}toTransformArray(n,r){const s=this.elements,o=!!r,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],u=s[5];if(n){const m=s[6],g=s[7],f=s[8];if(o){r[0]=a,r[1]=d,r[2]=m,r[3]=l,r[4]=h,r[5]=g,r[6]=c,r[7]=u,r[8]=f;return}return[a,d,m,l,h,g,c,u,f]}if(o){r[0]=a,r[1]=d,r[2]=l,r[3]=h,r[4]=c,r[5]=u;return}return[a,d,l,h,c,u]}toArray(n,r){const s=this.elements,o=!!r,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],u=s[5];if(n){const m=s[6],g=s[7],f=s[8];if(o){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=h,r[5]=u,r[6]=m,r[7]=g,r[8]=f;return}return[a,l,c,d,h,u,m,g,f]}if(o){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=h,r[5]=u;return}return[a,l,c,d,h,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ct().copy(this)}};x(Ct,"Identity",[1,0,0,0,1,0,0,0,1]);let ar=Ct;Dm(ar);const Cr=class Cr extends or{constructor(){super();x(this,"_flagMatrix",!0);x(this,"_flagScale",!1);x(this,"_matrix",null);x(this,"_worldMatrix",null);x(this,"_position",null);x(this,"_rotation",0);x(this,"_scale",1);x(this,"_skewX",0);x(this,"_skewY",0);for(let n in es)Object.defineProperty(this,n,es[n]);this._renderer.flagMatrix=Vc.bind(this),this.isShape=!0,this.matrix=new ar,this.worldMatrix=new ar,this.position=new ge,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Cr().copy(n);return"id"in n&&(r.id=n.id),r}get renderer(){return this._renderer}set renderer(n){this._renderer=n}get translation(){return es.position.get.apply(this,arguments)}set translation(n){es.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof ge?this.position=n.position:this.position.copy(n.position)),"rotation"in n&&(this.rotation=n.rotation),"scale"in n&&(this.scale=typeof n.scale=="number"||n.scale instanceof ge?n.scale:new ge(n.scale.x,n.scale.y)),"skewX"in n&&(this.skewX=n.skewX),"skewY"in n&&(this.skewY=n.skewY),"matrix"in n&&n.matrix.manual&&(this.matrix.copy(n.matrix),this.matrix.manual=!0),this}clone(n){const r=new Cr;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof ge?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}_update(n){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof ge?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),n&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};x(Cr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let wn=Cr;const es={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(U.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(U.Types.change,this._renderer.flagMatrix),Vc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof ge&&this._scale.unbind(U.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof ge&&this._scale.bind(U.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Hm(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Vc(){this._flagMatrix=!0}const Oi=Math.min,Ii=Math.max,lp=Math.ceil,cp=Math.floor,dp=new ge,Gt=class Gt extends wn{constructor(n,r,s,o){super();x(this,"_flagVertices",!0);x(this,"_flagLength",!0);x(this,"_flagFill",!0);x(this,"_flagStroke",!0);x(this,"_flagLinewidth",!0);x(this,"_flagOpacity",!0);x(this,"_flagVisible",!0);x(this,"_flagCap",!0);x(this,"_flagJoin",!0);x(this,"_flagMiter",!0);x(this,"_flagStrokeAttenuation",!0);x(this,"_flagMask",!1);x(this,"_flagClip",!1);x(this,"_length",0);x(this,"_fill","#fff");x(this,"_stroke","#000");x(this,"_linewidth",1);x(this,"_opacity",1);x(this,"_visible",!0);x(this,"_cap","round");x(this,"_join","round");x(this,"_miter",4);x(this,"_closed",!0);x(this,"_curved",!1);x(this,"_automatic",!0);x(this,"_beginning",0);x(this,"_ending",1);x(this,"_mask",null);x(this,"_clip",!1);x(this,"_dashes",null);x(this,"_strokeAttenuation",!0);for(let a in Oc)Object.defineProperty(this,a,Oc[a]);this._renderer.type="path",this._renderer.flagVertices=Ic.bind(this),this._renderer.bindVertices=zc.bind(this),this._renderer.unbindVertices=Lc.bind(this),this._renderer.flagFill=Dc.bind(this),this._renderer.flagStroke=Hc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!s,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=n,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ii(n.fill),s=typeof n.stroke=="string"?n.stroke:ii(n.stroke),o=new Gt().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){if(super.copy.call(this,n),n.vertices){this.vertices=[];for(let r=0;r<n.vertices.length;r++){const s=n.vertices[r];s instanceof Re?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Re().copy(s))}}for(let r=0;r<Gt.Properties.length;r++){const s=Gt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new Gt;for(let s=0;s<this.vertices.length;s++)r.vertices.push(this.vertices[s].clone());for(let s=0;s<Gt.Properties.length;s++){const o=Gt.Properties[s];r[o]=this[o]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),$e.each(Gt.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,s=n.height/2,o=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=o,c.y-=a,c.x+=r,c.y+=s}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=s),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,s=n.top+n.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const a=this.vertices[o];a.x-=r,a.y-=s}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=s),this}getBoundingClientRect(n){let r,s,o,a,l,c,d=1/0,h=-1/0,u=1/0,m=-1/0;if(this._update(!0),r=n?this.matrix:this.worldMatrix,s=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:g,scaleY:f}=Lm(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof f=="number"&&(s=Math.max(g,f)*(this.linewidth||0)/2)}else s*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(a=0;a<o;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+o-1)%o];const[g,f]=r.multiply(l.x,l.y),[p,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let b=l.controls.right.x,_=l.controls.right.y;l.relative&&(b+=l.x,_+=l.y);let[C,S]=r.multiply(b,_),v=c.controls.left.x,B=c.controls.left.y;c.relative&&(v+=c.x,B+=c.y);let[k,R]=r.multiply(v,B);const $=Xm(g,f,C,S,k,R,p,y);u=Oi($.min.y-s,u),d=Oi($.min.x-s,d),h=Ii($.max.x+s,h),m=Ii($.max.y+s,m)}else a<=1&&(u=Oi(f-s,u),d=Oi(g-s,d),h=Ii(g+s,h),m=Ii(f+s,m)),u=Oi(y-s,u),d=Oi(p-s,d),h=Ii(p+s,h),m=Ii(y+s,m)}return{top:u,left:d,right:h,bottom:m,width:h-d,height:m-u}}getPointAt(n,r){let s,o,a,l,c,d,h,u,m,g,f,p,y,b,_,C=this.length*Math.min(Math.max(n,0),1);const S=this.vertices.length,v=S-1;let B=null,k=null;for(let N=0,H=this._lengths.length,q=0;N<H;N++){if(q+this._lengths[N]>=C){this._closed?(s=Vi(N,S),o=Vi(N-1,S),N===0&&(s=o,o=N)):(s=N,o=Math.min(Math.max(N-1,0),v)),B=this.vertices[s],k=this.vertices[o],C-=q,this._lengths[N]!==0?n=C/this._lengths[N]:n=0;break}q+=this._lengths[N]}if(B===null||k===null)return null;if(B){if(!k)return B}else return k;_=k.controls&&k.controls.right,b=B.controls&&B.controls.left,c=k.x,g=k.y,d=(_||k).x,f=(_||k).y,h=(b||B).x,p=(b||B).y,u=B.x,y=B.y,_&&k.relative&&(d+=k.x,f+=k.y),b&&B.relative&&(h+=B.x,p+=B.y),l=Kr(n,c,d,h,u),m=Kr(n,g,f,p,y);const R=Ht(c,d,n),$=Ht(g,f,n),P=Ht(d,h,n),I=Ht(f,p,n),V=Ht(h,u,n),A=Ht(p,y,n),L=Ht(R,P,n),D=Ht($,I,n),ee=Ht(P,V,n),E=Ht(I,A,n);return $e.isObject(r)?(r.x=l,r.y=m,r instanceof Re&&(r.controls.left.x=L,r.controls.left.y=D,r.controls.right.x=ee,r.controls.right.y=E,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=m,r.controls.right.x-=l,r.controls.right.y-=m)),r.t=n,r):(a=new Re(l,m,L-l,D-m,ee-l,E-m,this._curved?he.curve:he.line),a.t=n,a)}plot(){if(this.curved)return Um(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?he.move:he.line;return this}subdivide(n){this._update();const r=this.vertices.length-1,s=this._closed||this.vertices[r]._command===he.close;let o=this.vertices[r],a=[],l;return $e.each(this.vertices,function(c,d){if(d<=0&&!s){o=c;return}if(c.command===he.move){a.push(new Re(o.x,o.y)),d>0&&(a[a.length-1].command=he.line),o=c;return}l=Mc(c,o,n),a=a.concat(l),$e.each(l,function(h,u){u<=0&&o.command===he.move?h.command=he.move:h.command=he.line}),d>=r&&(this._closed&&this._automatic&&(o=c,l=Mc(c,o,n),a=a.concat(l),$e.each(l,function(h,u){u<=0&&o.command===he.move?h.command=he.move:h.command=he.line})),a.push(new Re(c.x,c.y)),a[a.length-1].command=s?he.close:he.line),o=c},this),this._automatic=!1,this._curved=!1,this.vertices=a,this}_updateLength(n,r){r||this._update();const o=this.vertices.length-1;let a=this.vertices[o],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),$e.each(this.vertices,function(c,d){if(d<=0||c.command===he.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Fc(c,a,n),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const n=this._collection.length,r=this._closed,s=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),a=Jr(this,s*this._length),l=Jr(this,o*this._length),c=lp(a),d=cp(l);let h,u,m,g,f,p;for(this._renderer.vertices.length=0,p=0;p<n;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Re),p>d&&!u?(f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,f),f.command=this._renderer.collection[p].command,this._renderer.vertices.push(f),u=f,m=this._collection[p-1],m&&m.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f),m.relative?this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(ge.zero,1-f.t):this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(m,1-f.t))):p>=c&&p<=d&&(f=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(f),p===d&&Pc(this,o)?(u=f,!r&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):p===c&&Pc(this,s)&&(h=f,h.command=he.move,!r&&h.controls&&(h.relative?h.controls.left.clear():h.controls.left.copy(h))));c>0&&!h&&(p=c-1,f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,f),f.command=he.move,this._renderer.vertices.unshift(f),g=this._collection[p+1],g&&g.controls&&(f.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(ge.zero,f.t):(dp.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,f.t))))}return wn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,wn.prototype.flagReset.call(this),this}};x(Gt,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),x(Gt,"Utils",{getCurveLength:Fc});let Ee=Gt;const Oc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.unbind(U.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.bind(U.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.unbind(U.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.bind(U.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";$e.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(U.Types.insert,e).unbind(U.Types.remove,n),t instanceof ti?this._collection=t:this._collection=new ti(t||[]),this._collection.bind(U.Types.insert,e).bind(U.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,$e.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Ic(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function zc(t){let e=t.length;for(;e--;)t[e].bind(U.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Lc(t){let e=t.length;for(;e--;)t[e].unbind(U.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Dc(){this._flagFill=!0}function Hc(){this._flagStroke=!0}const hp=Math.ceil,up=Math.floor,mn=class mn extends wn{constructor(n){super();x(this,"_flagVertices",!0);x(this,"_flagLength",!0);x(this,"_flagFill",!0);x(this,"_flagStroke",!0);x(this,"_flagLinewidth",!0);x(this,"_flagOpacity",!0);x(this,"_flagVisible",!0);x(this,"_flagSize",!0);x(this,"_flagSizeAttenuation",!0);x(this,"_flagStrokeAttenuation",!0);x(this,"_length",0);x(this,"_fill","#fff");x(this,"_stroke","#000");x(this,"_linewidth",1);x(this,"_opacity",1);x(this,"_visible",!0);x(this,"_size",1);x(this,"_sizeAttenuation",!1);x(this,"_beginning",0);x(this,"_ending",1);x(this,"_dashes",null);x(this,"_strokeAttenuation",!0);x(this,"noFill",Ee.prototype.noFill);x(this,"noStroke",Ee.prototype.noStroke);x(this,"corner",Ee.prototype.corner);x(this,"center",Ee.prototype.center);x(this,"getBoundingClientRect",Ee.prototype.getBoundingClientRect);x(this,"_updateLength",Ee.prototype._updateLength);for(let r in Wc)Object.defineProperty(this,r,Wc[r]);this._renderer.type="points",this._renderer.flagVertices=Ic.bind(this),this._renderer.bindVertices=zc.bind(this),this._renderer.unbindVertices=Lc.bind(this),this._renderer.flagFill=Dc.bind(this),this._renderer.flagStroke=Hc.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=n,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ii(n.fill),s=typeof n.stroke=="string"?n.stroke:ii(n.stroke),o=new mn().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const s=n.vertices[r];s instanceof Re?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Re().copy(s))}for(let r=0;r<mn.Properties.length;r++){const s=mn.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new mn;for(let s=0;s<this.vertices.length;s++)r.vertices.push(this.vertices[s].clone());for(let s=0;s<mn.Properties.length;s++){const o=mn.Properties[s];r[o]=this[o]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),$e.each(mn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(n){this._update();let r=[];for(let s=0;s<this.vertices.length;s++){const o=this.vertices[s],a=this.vertices[s-1];if(!a)continue;const l=o.x,c=o.y,d=a.x,h=a.y,u=kc(l,c,l,c,d,h,d,h,n);r=r.concat(u)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),s=Jr(this,n*this._length),o=Jr(this,r*this._length),a=hp(s),l=up(o);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let h=0;h<this._collection.length;h++)h>=a&&h<=l&&(d=this._collection[h],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}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}};x(mn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let ts=mn;const Wc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.unbind(U.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.bind(U.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.unbind(U.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.bind(U.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(U.Types.insert,e).unbind(U.Types.remove,n),t instanceof ti?this._collection=t:this._collection=new ti(t||[]),this._collection.bind(U.Types.insert,e).bind(U.Types.remove,n),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class jc extends ti{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);Aa(this,Rs,{});this.attach(n),this.on(U.Types.insert,this.attach),this.on(U.Types.remove,this.detach)}get ids(){return Bt(this,Rs)}attach(n){for(let r=0;r<n.length;r++){const s=n[r];s&&s.id&&(this.ids[s.id]=s)}return this}detach(n){for(let r=0;r<n.length;r++)delete this.ids[n[r].id];return this}}Rs=new WeakMap;const Sn=class Sn extends Ee{constructor(n,r,s,o,a,l,c){const d=c||go.Resolution*3,h=[];for(let u=0;u<d;u++)h.push(new Re);super(h,!0,!1,!0);x(this,"_flagStartAngle",!1);x(this,"_flagEndAngle",!1);x(this,"_flagInnerRadius",!1);x(this,"_flagOuterRadius",!1);x(this,"_startAngle",0);x(this,"_endAngle",ei);x(this,"_innerRadius",0);x(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let u in qc)Object.defineProperty(this,u,qc[u]);typeof s=="number"&&(this.innerRadius=s),typeof o=="number"&&(this.outerRadius=o),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Sn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Sn.Properties.length;r++){const s=Sn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const n=this._startAngle,r=this._endAngle,s=this._innerRadius,o=this._outerRadius,a=Vi(n,ei)===Vi(r,ei),l=s>0,c=this.vertices;let d=l?c.length/2:c.length,h,u=0,m,g,f,p,y,b,_,C,S;for(a?d--:l||(d-=2),m=0,g=d-1;m<d;m++){switch(f=m/g,p=c[u],y=f*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),C=o*Math.sin(y),m){case 0:h=he.move;break;default:h=he.curve}p.command=h,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===he.curve&&(S=o*b/Math.PI,p.controls.left.x=S*Math.cos(y-it),p.controls.left.y=S*Math.sin(y-it),p.controls.right.x=S*Math.cos(y+it),p.controls.right.y=S*Math.sin(y+it),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),u++}if(l){for(a?(c[u].command=he.close,u++):(d--,g=d-1),m=0;m<d;m++)f=m/g,p=c[u],y=(1-f)*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),C=s*Math.sin(y),h=he.curve,m<=0&&(h=a?he.move:he.line),p.command=h,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===he.curve&&(S=s*b/Math.PI,p.controls.left.x=S*Math.cos(y+it),p.controls.left.y=S*Math.sin(y+it),p.controls.right.x=S*Math.cos(y-it),p.controls.right.y=S*Math.sin(y-it),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),u++;c[u].copy(c[0]),c[u].command=he.line}else a||(c[u].command=he.line,c[u].x=0,c[u].y=0,u++,c[u].copy(c[0]),c[u].command=he.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,s=this.outerRadius,o=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Sn(0,0,r,s,o,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Ee.Properties.length;d++){const h=Ee.Properties[d];c[h]=this[h]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<Sn.Properties.length;r++){const s=Sn.Properties[r];n[s]=this[s]}return n}};x(Sn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let po=Sn;const qc={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},yo=Math.cos,bo=Math.sin,Bn=class Bn extends Ee{constructor(n,r,s,o){const a=o?Math.max(o,2):4,l=[];for(let c=0;c<a;c++)l.push(new Re(0,0,0,0,0,0));super(l,!0,!0,!0);x(this,"_flagRadius",!1);x(this,"_radius",0);this._renderer.type="circle";for(let c in Xc)Object.defineProperty(this,c,Xc[c]);typeof s=="number"&&(this.radius=s),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Bn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Bn.Properties.length;r++){const s=Bn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagRadius){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(n*2)),s=this._radius,o=s*r;for(let a=0;a<this.vertices.length;a++){const c=a/n*ei,d=s*yo(c),h=s*bo(c),u=o*yo(c-it),m=o*bo(c-it),g=o*yo(c+it),f=o*bo(c+it),p=this.vertices[a];p.command=a===0?he.move:he.curve,p.set(d,h),p.controls.left.set(u,m),p.controls.right.set(g,f)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new Bn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Ee.Properties.length;s++){const o=Ee.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<Bn.Properties.length;r++){const s=Bn.Properties[r];n[s]=this[s]}return n}};x(Bn,"Properties",["radius"]);let _o=Bn;const Xc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},wo=Math.cos,xo=Math.sin,Tn=class Tn extends Ee{constructor(n,r,s,o,a){typeof o!="number"&&typeof s=="number"&&(o=s);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Re);super(c,!0,!0,!0);x(this,"_flagWidth",!1);x(this,"_flagHeight",!1);x(this,"_width",0);x(this,"_height",0);this._renderer.type="ellipse";for(let d in Yc)Object.defineProperty(this,d,Yc[d]);typeof s=="number"&&(this.width=s*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Tn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Tn.Properties.length;r++){const s=Tn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),s=this._width/2,o=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/n*ei,d=s*wo(c),h=o*xo(c),u=s*r*wo(c-it),m=o*r*xo(c-it),g=s*r*wo(c+it),f=o*r*xo(c+it),p=this.vertices[a];p.command=a===0?he.move:he.curve,p.set(d,h),p.controls.left.set(u,m),p.controls.right.set(g,f)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,s=this.height/2,o=this.vertices.length,a=new Tn(0,0,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<Ee.Properties.length;l++){const c=Ee.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="ellipse";for(let r=0;r<Tn.Properties.length;r++){const s=Tn.Properties[r];n[s]=this[s]}return n}};x(Tn,"Properties",["width","height"]);let vo=Tn;const Yc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},fp=Math.cos,gp=Math.sin,Rn=class Rn extends Ee{constructor(n,r,s,o){o=Math.max(o||0,3);super();x(this,"_flagWidth",!1);x(this,"_flagHeight",!1);x(this,"_flagSides",!1);x(this,"_radius",0);x(this,"_width",0);x(this,"_height",0);x(this,"_sides",0);this._renderer.type="polygon";for(let a in Uc)Object.defineProperty(this,a,Uc[a]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof o=="number"&&(this.sides=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Rn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Rn.Properties.length;r++){const s=Rn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const n=this._sides,r=n+1;let s=this.vertices.length;s>n&&(this.vertices.splice(n-1,s-n),s=n);for(let o=0;o<r;o++){const a=(o+.5)/n,l=ei*a+Math.PI/2,c=this._width*fp(l)/2,d=this._height*gp(l)/2;o>=s?this.vertices.push(new Re(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?he.move:he.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=new Rn(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Ee.Properties.length;s++){const o=Ee.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<Rn.Properties.length;r++){const s=Rn.Properties[r];n[s]=this[s]}return n}};x(Rn,"Properties",["width","height","sides"]);let ko=Rn;const Uc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},bi=class bi extends Ee{constructor(n,r,s,o){const a=[new Re,new Re,new Re,new Re];super(a,!0,!1,!0);x(this,"_flagWidth",!1);x(this,"_flagHeight",!1);x(this,"_width",0);x(this,"_height",0);x(this,"_origin",null);this._renderer.type="rectangle";for(let l in Gc)Object.defineProperty(this,l,Gc[l]);this.width=typeof s=="number"?s:1,this.height=typeof o=="number"?o:1,this.origin=new ge,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new bi().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<bi.Properties.length;r++){const s=bi.Properties[r];s in n&&(typeof n[s]=="number"?this[s]=n[s]:this[s]instanceof ge&&this[s].copy(n[s]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const n=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Re),this.vertices[0].set(-n,-r).sub(this._origin).command=he.move,this.vertices[1].set(n,-r).sub(this._origin).command=he.line,this.vertices[2].set(n,r).sub(this._origin).command=he.line,this.vertices[3].set(-n,r).sub(this._origin).command=he.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=he.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new bi(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Ee.Properties.length;s++){const o=Ee.Properties[s];r[o]instanceof ge?r[o].copy(this[o]):r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="rectangle",n.width=this.width,n.height=this.height,n.origin=this.origin.toObject(),n}};x(bi,"Properties",["width","height","origin"]);let lr=bi;const Gc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(U.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(U.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},$n=class $n extends Ee{constructor(n,r,s,o,a){typeof a>"u"&&typeof s=="number"&&typeof o=="number"&&(a=Math.floor(Math.min(s,o)/12));const l=[];for(let c=0;c<10;c++)l.push(new Re(0,0,0,0,0,0,c===0?he.move:he.curve));super(l);x(this,"_flagWidth",!1);x(this,"_flagHeight",!1);x(this,"_flagRadius",!1);x(this,"_width",0);x(this,"_height",0);x(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in Kc)Object.defineProperty(this,c,Kc[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=mp.bind(this),typeof s=="number"&&(this.width=s),typeof o=="number"&&(this.height=o),(typeof a=="number"||a instanceof ge)&&(this.radius=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new $n().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<$n.Properties.length;r++){const s=$n.Properties[r];if(s in n){const o=n[s];/radius/i.test(s)?this[s]=typeof o=="number"||o instanceof ge?o:new ge().copy(o):typeof o=="number"&&(this[s]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const n=this._width,r=this._height;let s,o;this._radius instanceof ge?(s=this._radius.x,o=this._radius.y):(s=this._radius,o=this._radius);let a,l=n/2,c=r/2;a=this.vertices[0],a.x=-(l-s),a.y=-c,a=this.vertices[1],a.x=l-s,a.y=-c,a.controls.left.clear(),a.controls.right.x=s,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-o),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-o,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=o,a=this.vertices[4],a.x=l-s,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-s),a.y=c,a.controls.left.clear(),a.controls.right.x=-s,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-o,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-o),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-o,a=this.vertices[8],a.x=-(l-s),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.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(n){const r=this.width,s=this.height,o=this.radius,a=new $n(0,0,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<Ee.Properties.length;l++){const c=Ee.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<$n.Properties.length;r++){const s=$n.Properties[r];n[s]=this[s]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};x($n,"Properties",["width","height","radius"]);let Co=$n;const Kc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof ge&&this._radius.unbind(U.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof ge&&this._radius.bind(U.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function mp(){this._flagRadius=!0}const pp=Math.cos,yp=Math.sin,En=class En extends Ee{constructor(n,r,s,o,a){arguments.length<=3&&(o=s,s=o/2),(typeof a!="number"||a<=0)&&(a=5);super();x(this,"_flagInnerRadius",!1);x(this,"_flagOuterRadius",!1);x(this,"_flagSides",!1);x(this,"_innerRadius",0);x(this,"_outerRadius",0);x(this,"_sides",0);this._renderer.type="star";for(let l in Zc)Object.defineProperty(this,l,Zc[l]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.innerRadius=s),typeof o=="number"&&(this.outerRadius=o),typeof a=="number"&&(this.sides=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new En().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<En.Properties.length;r++){const s=En.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const n=this._sides*2,r=n+1;let s=this.vertices.length;s>n&&(this.vertices.splice(n-1,s-n),s=n);for(let o=0;o<r;o++){const a=(o+.5)/n,l=ei*a,c=(o%2?this._outerRadius:this._innerRadius)/2,d=c*pp(l),h=c*yp(l);o>=s?this.vertices.push(new Re(d,h)):this.vertices[o].set(d,h),this.vertices[o].command=o===0?he.move:he.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=this.innerRadius,s=this.outerRadius,o=this.sides,a=new En(0,0,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<Ee.Properties.length;l++){const c=Ee.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<En.Properties.length;r++){const s=En.Properties[r];n[s]=this[s]}return n}};x(En,"Properties",["innerRadius","outerRadius","sides"]);let So=En;const Zc={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}};let Bo;const Qc=Math.min,Jc=Math.max;ln.document&&(Bo=document.createElement("canvas"));const gt=class gt extends wn{constructor(n,r,s,o){super();x(this,"_flagValue",!0);x(this,"_flagFamily",!0);x(this,"_flagSize",!0);x(this,"_flagLeading",!0);x(this,"_flagAlignment",!0);x(this,"_flagBaseline",!0);x(this,"_flagStyle",!0);x(this,"_flagWeight",!0);x(this,"_flagDecoration",!0);x(this,"_flagFill",!0);x(this,"_flagStroke",!0);x(this,"_flagLinewidth",!0);x(this,"_flagOpacity",!0);x(this,"_flagVisible",!0);x(this,"_flagMask",!1);x(this,"_flagClip",!1);x(this,"_flagDirection",!0);x(this,"_flagStrokeAttenuation",!0);x(this,"_value","");x(this,"_family","sans-serif");x(this,"_size",13);x(this,"_leading",17);x(this,"_alignment","center");x(this,"_baseline","middle");x(this,"_style","normal");x(this,"_weight",500);x(this,"_decoration","none");x(this,"_direction","ltr");x(this,"_fill","#000");x(this,"_stroke","none");x(this,"_linewidth",1);x(this,"_opacity",1);x(this,"_visible",!0);x(this,"_mask",null);x(this,"_clip",!1);x(this,"_dashes",null);x(this,"_strokeAttenuation",!0);for(let a in ed)Object.defineProperty(this,a,ed[a]);if(this._renderer.type="text",this._renderer.flagFill=bp.bind(this),this._renderer.flagStroke=_p.bind(this),this.value=n,typeof r=="number"&&(this.translation.x=r),typeof s=="number"&&(this.translation.y=s),this.dashes=[],this.dashes.offset=0,!$e.isObject(o))return this;for(let a=0;a<gt.Properties.length;a++){const l=gt.Properties[a];l in o&&(this[l]=o[l])}}static Measure(n){if(Bo){const r=Bo.getContext("2d");r.font=[n._style,n._weight,`${n._size}px/${n._leading}px`,n._family].join(" ");const s=r.measureText(n.value,0,0),o=s.actualBoundingBoxDescent+s.actualBoundingBoxAscent;return{width:s.width,height:o}}else{const r=this.value.length*this.size*gt.Ratio,s=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:s}}}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ii(n.fill),s=typeof n.stroke=="string"?n.stroke:ii(n.stroke),o=new gt().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n);for(let r=0;r<gt.Properties.length;r++){const s=gt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new gt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let s=0;s<gt.Properties.length;s++){const o=gt.Properties[s];r[o]=this[o]}return this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);n.renderer.type="text";for(let r=0;r<gt.Properties.length;r++){const s=gt.Properties[r];n[s]=this[s]}return n}dispose(){return super.dispose(),typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,s,o,a,l;this._update(!0),r=n?this.matrix:this.worldMatrix;const{width:c,height:d}=gt.Measure(this),h=(this._linewidth||0)/2;switch(this.alignment){case"left":s=-h,o=c+h;break;case"right":s=-(c+h),o=h;break;default:s=-(c/2+h),o=c/2+h}switch(this.baseline){case"middle":a=-(d/2+h),l=d/2+h;break;default:a=-(d+h),l=h}const[u,m]=r.multiply(s,a),[g,f]=r.multiply(s,l),[p,y]=r.multiply(o,a),[b,_]=r.multiply(o,l);return a=Qc(m,f,y,_),s=Qc(u,g,p,b),o=Jc(u,g,p,b),l=Jc(m,f,y,_),{top:a,left:s,right:o,bottom:l,width:o-s,height:l-a}}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}};x(gt,"Ratio",.6),x(gt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let zi=gt;const ed={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.unbind(U.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.bind(U.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.unbind(U.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.bind(U.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,$e.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function bp(){this._flagFill=!0}function _p(){this._flagStroke=!0}const Nn=class Nn extends lr{constructor(n,r,s,o){super(r,s,0,0);x(this,"_flagTextures",!1);x(this,"_flagFrameRate",!1);x(this,"_flagIndex",!1);x(this,"_amount",1);x(this,"_duration",0);x(this,"_index",0);x(this,"_startTime",0);x(this,"_playing",!1);x(this,"_firstFrame",0);x(this,"_lastFrame",0);x(this,"_loop",!0);x(this,"_textures",null);x(this,"_frameRate",0);x(this,"_origin",null);this._renderer.type="image-sequence";for(let a in td)Object.defineProperty(this,a,td[a]);this._renderer.flagTextures=wp.bind(this),this._renderer.bindTextures=xp.bind(this),this._renderer.unbindTextures=vp.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(nd.bind(this)):typeof n=="string"&&(this.textures=[nd(n)]),this.origin=new ge,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=Nn.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Nn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Nn.Properties.length;r++){const s=Nn.Properties[r];s in n&&(this[s]=n[s])}return this}play(n,r,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=$e.performance.now(),typeof n=="number"&&(this._firstFrame=n),typeof r=="number"&&(this._lastFrame=r),typeof s=="function"?this._onLastFrame=s: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(n){const r=new Nn(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="image-sequence",n.textures=this.textures.map(function(r){return r.toObject()}),n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let n=0;n<this.textures.length;n++){const r=this.textures[n];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const n=this._textures;let r,s,o,a,l,c,d,h;return n&&(this._flagTextures&&(this._amount=n.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,$e.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=$e.performance.now()-this._startTime,h=this._lastFrame+1,l=1e3*(h-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),d=Ht(this._firstFrame,h,o/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=n[this._index],c.loaded&&(r=c.image.width,s=c.image.height,this.width!==r&&(this.width=r),this.height!==s&&(this.height=s),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof qe))&&(c=n[this._index],c.loaded&&(r=c.image.width,s=c.image.height,this.width!==r&&(this.width=r),this.height!==s&&(this.height=s)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};x(Nn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),x(Nn,"DefaultFrameRate",30);let To=Nn;const td={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(U.Types.insert,e).unbind(U.Types.remove,n),this._textures=new ti((t||[]).slice(0)),this._textures.bind(U.Types.insert,e).bind(U.Types.remove,n),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function wp(){this._flagTextures=!0}function xp(t){let e=t.length;for(;e--;)t[e].bind(U.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function vp(t){let e=t.length;for(;e--;)t[e].unbind(U.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function nd(t){if(t instanceof qe)return t;if(typeof t=="string")return new qe(t)}const _i=class _i extends lr{constructor(n,r,s,o,a,l){super(r,s,0,0);x(this,"_flagTexture",!1);x(this,"_flagColumns",!1);x(this,"_flagRows",!1);x(this,"_flagFrameRate",!1);x(this,"_flagIndex",!1);x(this,"_amount",1);x(this,"_duration",0);x(this,"_startTime",0);x(this,"_playing",!1);x(this,"_firstFrame",0);x(this,"_lastFrame",0);x(this,"_loop",!0);x(this,"_texture",null);x(this,"_columns",1);x(this,"_rows",1);x(this,"_frameRate",0);x(this,"_index",0);x(this,"_origin",null);this._renderer.type="sprite";for(let c in id)Object.defineProperty(this,c,id[c]);this.noStroke(),this.noFill(),n instanceof qe?this.texture=n:typeof n=="string"&&(this.texture=new qe(n)),this.origin=new ge,this._update(),typeof o=="number"&&(this.columns=o),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(n){const r=new _i().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<_i.Properties.length;r++){const s=_i.Properties[r];s in n&&(this[s]=n[s])}return this}play(n,r,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=$e.performance.now(),typeof n=="number"&&(this._firstFrame=n),typeof r=="number"&&(this._lastFrame=r),typeof s=="function"?this._onLastFrame=s: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(n){const r=new _i(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&r.play(this._firstFrame,this._lastFrame),r.loop=this.loop,r.firstFrame=this.firstFrame,r.lastFrame=this.lastFrame,n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="sprite",n.texture=this.texture.toObject(),n.columns=this.columns,n.rows=this.rows,n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const n=this._texture,r=this._columns,s=this._rows;let o,a,l,c,d,h,u,m,g;if(n&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=n),n.loaded)){u=n.image.width,m=n.image.height,o=u/r,a=m/s,c=this._amount,this.width!==o&&(this.width=o),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&($e.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=$e.performance.now()-this._startTime,g=this._lastFrame+1,d=1e3*(g-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),h=Ht(this._firstFrame,g,l/d),h=Math.floor(h),h!==this._index&&(this._index=h,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const f=this._index%r,p=Math.floor(this._index/r),y=-o*f+(u-o)/2,b=-a*p+(m-a)/2;y!==n.offset.x&&(n.offset.x=y),b!==n.offset.y&&(n.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};x(_i,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Ro=_i;const id={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},ns=Math.min,is=Math.max,Kt=class Kt extends wn{constructor(n){super();x(this,"_flagAdditions",!1);x(this,"_flagSubtractions",!1);x(this,"_flagOrder",!1);x(this,"_flagOpacity",!0);x(this,"_flagBeginning",!1);x(this,"_flagEnding",!1);x(this,"_flagLength",!1);x(this,"_flagMask",!1);x(this,"_fill","#fff");x(this,"_stroke","#000");x(this,"_linewidth",1);x(this,"_opacity",1);x(this,"_visible",!0);x(this,"_cap","round");x(this,"_join","round");x(this,"_miter",4);x(this,"_closed",!0);x(this,"_curved",!1);x(this,"_automatic",!0);x(this,"_beginning",0);x(this,"_ending",1);x(this,"_length",0);x(this,"_mask",null);x(this,"_strokeAttenuation",!0);for(let r in rd)Object.defineProperty(this,r,rd[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(n)?n:Array.prototype.slice.call(arguments)}static InsertChildren(n){for(let r=0;r<n.length;r++)sd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)sd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new Kt;for(let o=0;o<Kt.Properties.length;o++){const a=Kt.Properties[o];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:ii(n[a]):r[a]=n[a])}return"mask"in n&&(r.mask=s(n.mask)),"id"in n&&(r.id=n.id),r.children=n.children.map(s),r;function s(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return po.fromObject(o);case"circle":return _o.fromObject(o);case"element":return or.fromObject(o);case"ellipse":return vo.fromObject(o);case"group":return Kt.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return To.fromObject(o);case"path":return Ee.fromObject(o);case"points":return ts.fromObject(o);case"polygon":return ko.fromObject(o);case"rectangle":return lr.fromObject(o);case"rounded-rectangle":return Co.fromObject(o);case"shape":return wn.fromObject(o);case"sprite":return Ro.fromObject(o);case"star":return So.fromObject(o);case"text":return zi.fromObject(o)}return o}}copy(n){super.copy.call(this,n),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<Kt.Properties.length;r++){const s=Kt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new Kt,s=this.children.map(function(o){return o.clone()});return r.add(s),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,$e.each(this.children,(r,s)=>{n.children[s]=r.toObject()},this),n}dispose(){if(super.dispose(),this.children)for(let n=0;n<this.children.length;n++){const r=this.children[n];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}corner(){const n=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const s=this.children[r];s.translation.x-=n.left,s.translation.y-=n.top}return this.mask&&(this.mask.translation.x-=n.left,this.mask.translation.y-=n.top),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,s=n.top+n.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const a=this.children[o];a.isShape&&(a.translation.x-=r,a.translation.y-=s)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=s),this}getById(n){let r=null;function s(o){if(o.id===n)return o;if(o.children){if(o.children.ids[n])return o.children.ids[n];for(let a=0;a<o.children.length;a++)if(r=s(o.children[a]),r)return r}return null}return s(this)}getByClassName(n){const r=[];function s(o){if(Array.prototype.indexOf.call(o.classList,n)>=0&&r.push(o),o.children)for(let a=0;a<o.children.length;a++){const l=o.children[a];s(l)}return r}return s(this)}getByType(n){const r=[];function s(o){if(o instanceof n&&r.push(o),o.children)for(let a=0;a<o.children.length;a++){const l=o.children[a];s(l)}return r}return s(this)}add(n){n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let r=0;r<n.length;r++){const s=n[r];if(!(s&&s.id))continue;const o=Array.prototype.indexOf.call(this.children,s);o>=0&&this.children.splice(o,1),this.children.push(s)}return this}remove(n){const r=arguments.length,s=this.parent;if(r<=0&&s)return s.remove(this),this;n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let o=0;o<n.length;o++){const a=n[o];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(n){let r,s,o,a,l,c;this._update(!0);let d=1/0,h=-1/0,u=1/0,m=-1/0;const g=/texture|gradient/i;s=n?this.matrix:this.worldMatrix;for(let f=0;f<this.children.length;f++){const p=this.children[f];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),o=typeof r.top!="number"||$e.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||$e.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||$e.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||$e.isNaN(r.bottom)||!isFinite(r.bottom),!(o||a||l||c)))if(n){const[y,b]=s.multiply(r.left,r.top),[_,C]=s.multiply(r.right,r.top),[S,v]=s.multiply(r.left,r.bottom),[B,k]=s.multiply(r.right,r.bottom);u=ns(b,C,v,k,u),d=ns(y,_,S,B,d),h=is(y,_,S,B,h),m=is(b,C,v,k,m)}else u=ns(r.top,u),d=ns(r.left,d),h=is(r.right,h),m=is(r.bottom,m)}return{top:u,left:d,right:h,bottom:m,width:h-d,height:m-u}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,s;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=o*l,h=a*l;for(n=0;n<this.children.length;n++)s=this.children[n],r=s.length,d>c+r?(s.beginning=1,s.ending=1):h<c?(s.beginning=0,s.ending=0):d>c&&d<c+r?(s.beginning=(d-c)/r,s.ending=1):h>c&&h<c+r?(s.beginning=0,s.ending=(h-c)/r):(s.beginning=0,s.ending=1),c+=r}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}};x(Kt,"Children",jc),x(Kt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let xn=Kt;const rd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=xn.InsertChildren.bind(this),n=xn.RemoveChildren.bind(this),r=xn.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new jc(t),this._children.bind(U.Types.insert,e),this._children.bind(U.Types.remove,n),this._children.bind(U.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,$e.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function sd(t,e){const n=t.parent;let r;if(n===e){s();return}if(n&&n.children.ids[t.id]&&(r=Array.prototype.indexOf.call(n.children,t),n.children.splice(r,1),o()),e){s();return}o(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete t.parent;function s(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function o(){r=Array.prototype.indexOf.call(n.additions,t),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,t),r<0&&(n.subtractions.push(t),n._flagSubtractions=!0)}}class rs extends Ee{constructor(e,n,r,s){const o=[new Re(e,n),new Re(r,s)];super(o);for(let a in od)Object.defineProperty(this,a,od[a]);this.vertices[0].command=he.move,this.vertices[1].command=he.line,this.automatic=!1}}x(rs,"Properties",["left","right"]);const od={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if($e.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=he.move;else{const e=new Zr("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if($e.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=he.line;else{const e=new Zr("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class $o{constructor(e=0,n=0){this.x=e,this.y=n}}class ri{constructor(e=10,n=0,r="A"){x(this,"start",new $o);x(this,"end",new $o);this.width=e,this.angle=n,this.label=r}}const Ve={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},kp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Cp(t,e){return i.openBlock(),i.createElementBlock("svg",kp,[...e[0]||(e[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 ss=i.markRaw({name:"ion-close",render:Cp}),Sp={class:"mr-3 flex flex-col gap-2"},Bp=["onClick"],Tp={class:"h-full p-2"},Rp={},$p=i.defineComponent({...Rp,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(t,{emit:e}){const n=t,r=i.useTemplateRef("drawing-template-containers"),s=e;return i.onMounted(()=>{var o;(o=n.settings.allTemplates)==null||o.forEach((a,l)=>{var d;const c=(d=r.value)==null?void 0:d.at(l);c&&s("init-draw-template",c,a)})}),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=ss;return i.openBlock(),i.createBlock(i.unref(z.NScrollbar),{style:{"max-height":"12.5rem",width:"auto"},trigger:"none"},{default:i.withCtx(()=>[i.createElementVNode("div",Sp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(c,d)=>(i.openBlock(),i.createElementBlock("div",{key:d,class:"group relative"},[i.createVNode(i.unref(z.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===t.selectTemplateIndex}]),onClick:h=>s("template:select",d)},[i.createElementVNode("div",Tp,[i.createElementVNode("div",{ref_for:!0,ref:"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,Bp)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.label),1)]),_:2},1024),c.isCustom&&!c.isNewRec()?(i.openBlock(),i.createBlock(i.unref(z.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)]),_:1},8,["onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),ad=Zn($p,[["__scopeId","data-v-cf2c29de"]]),Ep={class:"flex gap-3"},Np={class:"kozyrek-preview w-fill h-[12.5rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},Pp={ref:"drawing-container",class:"size-full"},Fp={},ld=i.defineComponent({...Fp,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select"],setup(t,{emit:e}){const n=t,r=e,s=i.useTemplateRef("drawing-container");let o=[],a=[],l=[],c=null;const d=.75,h=i.computed(()=>n.value.configuratorParams.linesAngles.map((E,N)=>new ri(n.value.configuratorParams.linesWidths[N],E,`A-${N+1}`))),u=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),m=i.computed(()=>{var E,N;return n.value.configuratorParams.startTailType&&((E=n.settings.startTailConfigs)!=null&&E[n.value.configuratorParams.startTailType])?(N=n.settings.startTailConfigs)==null?void 0:N[n.value.configuratorParams.startTailType].points:[]}),g=i.computed(()=>{var E,N;return n.value.configuratorParams.endTailType&&((E=n.settings.endTailConfigs)!=null&&E[n.value.configuratorParams.endTailType])?(N=n.settings.endTailConfigs)==null?void 0:N[n.value.configuratorParams.endTailType].points:[]}),f=(E,N=!1)=>{E[0].start.x=0,E[0].start.y=0;let H=0;for(let q=0;q<E.length;q++){const Y=E[q],F=E[q-1]??new ri(0,H);H+=!N||q>1?F.angle:0;const M=(!N||q>0?Y.angle:0)+H;if(E[q].end.x=Y.width*Math.cos(M*Math.PI/180)+E[q].start.x,E[q].end.y=Y.width*Math.sin(M*Math.PI/180)+E[q].start.y,q<E.length-1){const Z=q+1;E[Z].start.x=E[q].end.x,E[Z].start.y=E[q].end.y}}return E},p=(E,N,H,q,Y=!1)=>{let F=f([...H,...q]);N.length>0&&(F=[...f(N),...F]);let M=0,Z=0,fe=0,ie=0;F.forEach(Ae=>{M=Math.min(M,Ae.start.x,Ae.end.x),Z=Math.min(Z,Ae.start.y,Ae.end.y),fe=Math.max(fe,Ae.start.x,Ae.end.x),ie=Math.max(ie,Ae.start.y,Ae.end.y)});let me,re;M===0&&Z===0&&fe===0&&ie===0?(me=1,re=1):(me=E.width/Math.abs(fe-M),re=(Y?E.height:E.height-Ve.colorSideLabel.size)/Math.abs(ie-Z));const Me=Math.min(me,re);return M=M<0?-M*Me:0,Z=Z<0?-Z*Me:0,[Me,M,Z]},y=E=>{const N=new ts([E]);return N._size=Ve.anchorPoint.size,N.fill=Ve.anchorPoint.color,N.stroke="transparent",N._linewidth=Ve.anchorPoint.strokeSize,l.push(N),N},b=(E,N)=>{if(l=[],n.settings.allowChangeFirstPoint){const H=E[0],q=new ge(H.vertices[0].x,H.vertices[0].y);q.bind(U.Types.change,()=>{H.vertices[0].copy(q)});const Y=y(q);N.add(Y)}E.forEach((H,q)=>{const Y=E[q+1],F=new ge(H.vertices[1].x,H.vertices[1].y);F.bind(U.Types.change,()=>{H.vertices[1].copy(F),Y!==void 0&&Y.vertices[0].copy(F)});const M=y(F);N.add(M)})},_=E=>E*(Math.PI/180),C=(E,N,H)=>{const q=N.vertices.length-1;E.position.x=N.vertices[q].x,E.position.y=N.vertices[q].y;const Y=Math.atan2(N.vertices[q].y-N.vertices[0].y,N.vertices[q].x-N.vertices[0].x);E.rotation=_(H)+Y},S=(E,N,H)=>{if(N.vertices[0]===void 0)return;E.position.x=N.vertices[0].x,E.position.y=N.vertices[0].y;const q=N.vertices.length-1,Y=Math.atan2(N.vertices[q].y-N.vertices[0].y,N.vertices[q].x-N.vertices[0].x);E.rotation=_(H)+Y},v=(E,N,H)=>{const q=new xn;if(E.length===0)return q;const Y=[];return[...E].reverse().forEach((F,M)=>{M!==0&&F.angle>0&&(F.angle*=-1),Y.push(F)}),E=f(Y,!0),S(q,N,E[0].angle),[N.vertices[0],N.vertices[1]].forEach(F=>{F.bind(U.Types.change,()=>{S(q,N,E[0].angle)})}),E.forEach(F=>{const M=F.start.x*H,Z=F.end.x*H,fe=F.start.y*H,ie=F.end.y*H,me=new rs(M,fe,Z,ie);me.linewidth=Ve.line.size,me.stroke=Ve.line.color,q.add(me)}),q},B=(E,N,H)=>{const q=new xn;return E.length===0||(E=f(E,!0),C(q,N,E[0].angle),[N.vertices[0],N.vertices[1]].forEach(Y=>{Y.bind(U.Types.change,()=>{C(q,N,E[0].angle)})}),E.forEach(Y=>{const F=Y.start.x*H,M=Y.end.x*H,Z=Y.start.y*H,fe=Y.end.y*H,ie=new rs(F,Z,M,fe);ie.linewidth=Ve.line.size,ie.stroke=Ve.line.color,q.add(ie)})),q},k=(E,N,H,q)=>{const Y=N.vertices[0].x+(N.vertices[1].x-N.vertices[0].x)/2-8*Math.sin(E.angle*Math.PI/180),F=N.vertices[0].y+(N.vertices[1].y-N.vertices[0].y)/2-8*Math.cos(E.angle*Math.PI/180),M=new zi(E.label,Y+10,F-10);let Z;M.size=Ve.lineLabel.size,M.weight=600,M.fill=Ve.lineLabel.color,M.id+=1,M.rotation=Ve.lineLabel.rotation,q>0&&(Z=new zi(`${E.angle}°`,N.vertices[0].x+25,N.vertices[0].y-25),Z.size=Ve.angleLabel.size,Z.weight=600,Z.fill=Ve.angleLabel.color,Z.rotation=Ve.angleLabel.rotation,Z.id+=q,o.push(Z),H.add(Z)),H.add(M),$(M,N,0,Z),$(M,N,1)},R=()=>{const{size:E}=Ve.colorSideLabel,N=0,H=0,q=u.value?E/2:E/2-E,Y=u.value?E/2-E:E/2,F=new xn;if(!c)return F;const M=5,Z=Math.atan2(Y-q,H-N),fe=[new Re(N,q,0,0,0,0,an.Commands.move),new Re(H,Y,0,0,0,0,an.Commands.line),new Re(H-M*Math.cos(Z-Math.PI/4),Y-M*Math.sin(Z-Math.PI/4),0,0,0,0,an.Commands.line),new Re(H,Y,0,0,0,0,an.Commands.move),new Re(H-M*Math.cos(Z+Math.PI/4),Y-M*Math.sin(Z+Math.PI/4),0,0,0,0,an.Commands.line)],ie=new Ee(fe,!1,!1,!0);ie.noFill(),ie.cap="round",ie.join="round",ie.linewidth=E/7,ie.stroke=Ve.colorSideLabel.color,F.add(ie);const me=new zi(u.value?"Цвет снизу":"Цвет сверху",10,0);me.size=E,me.weight=600,me.fill=Ve.colorSideLabel.color,me.alignment="left",F.add(me);const re=F.getBoundingClientRect();return F.position.x=(c.width-re.width)*d+10,F.position.y=u.value?c.height+re.height*2:re.height/2,F},$=(E,N,H,q)=>{N.vertices[H].bind(U.Types.change,()=>{const Y=N.vertices.length-1,F=Math.atan2(N.vertices[0].y-N.vertices[Y].y,N.vertices[0].x-N.vertices[Y].x)*180/Math.PI,M=N.vertices[0].x+(N.vertices[Y].x-N.vertices[0].x)/2-8*Math.sin(F*Math.PI/180),Z=N.vertices[0].y+(N.vertices[Y].y-N.vertices[0].y)/2-8*Math.cos(F*Math.PI/180);E.position.x=M+10,E.position.y=Z-10,E.rotation=-.5,q&&(q.position.x=N.vertices[0].x+25,q.position.y=N.vertices[0].y-25)})},P=(E,N,H,q,Y=!1)=>{var Oe;if(E.clear(),H.length===0){E.update();return}const F=f(H),[M,Z,fe]=p(E,N,F,q,Y),ie=new xn,me=new Array,re=new Array;Y||(o=[],a=[]),F.forEach((Le,pt)=>{const Zt=Le.start.x*M+Z,Qt=Le.end.x*M+Z,St=Le.start.y*M+fe,At=Le.end.y*M+fe,yt=new rs(Zt,St,Qt,At);yt.linewidth=Y?Ve.previewLine.size:Ve.line.size,yt.stroke=Y?Ve.previewLine.color:Ve.line.color,a.push(yt),me.push(yt),ie.add(yt),!Y&&Le.label!==""&&k(Le,yt,ie,pt)});const Me=me.at(-1);let Ae=ie.getBoundingClientRect();if(!Y){const Le=R();re.push(Le)}if(N.length>0){const Le=v(N,me[0],M);ie.add(Le)}if(q.length>0&&Me){const Le=B(q,Me,M);ie.add(Le)}if(re.push(ie),E.makeGroup(re),Ae=ie.getBoundingClientRect(),ie.position.x=0-Ae.left+(E.width-Ae.width)/(2*(Y?1:d)),ie.position.y=0-Ae.top+(E.height-Ae.height)/(2*(Y?1:d)),E.update(),!Y){const Le=((Oe=n.value.configuratorParams)==null?void 0:Oe.colorSide)==="top";ie.position.y=ie.position.y+Ve.colorSideLabel.size*Number(Le),b(me,ie),E.update()}},I=(E,N)=>{if(E&&!N.isNewRec()){const H=new an({width:E.scrollWidth,height:E.scrollHeight});H.appendTo(E),P(H,[],N.points,[],!0)}},V=()=>{c&&P(c,m.value,h.value,g.value,!1)},A=E=>E*(180/Math.PI),L=(E,N)=>{const H=E[1].x-E[0].x,q=E[1].y-E[0].y,Y=N[1].x-N[0].x,F=N[1].y-N[0].y;let M=Math.atan2(H*F-q*Y,H*Y+q*F);return M=A(M),Math.round(M)*-1},D=E=>{const N=a.map((H,q,Y)=>{const F=Y[q-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let M=Math.ceil(H._length/E/n.settings.lineWidthStep)*n.settings.lineWidthStep;const Z=o[q-1];M<(Y.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(M=Y.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),M>n.settings.maxLineWidth&&(M=n.settings.maxLineWidth);const fe=L(H.vertices,F.vertices);return Z&&(Z.value=`${fe}°`),new ri(M,fe,`A-${q+1}`)});r("pointer:move",N)},ee=E=>{let N=null,H;const q=Z=>{N=l.find(fe=>{const ie=fe.renderer;return(ie==null?void 0:ie.elem)===Z.target}),[H]=p(E,m.value,h.value.map(fe=>fe),g.value)},Y=Z=>{if(N){const fe=N.renderer,ie=fe==null?void 0:fe.elem;if(!ie)return;const me=ie.getBoundingClientRect();N.vertices[0].x-=me.x-(Z instanceof MouseEvent?Z.clientX:Z.targetTouches[0].clientX)+Ve.anchorPoint.size/2,N.vertices[0].y-=me.y-(Z instanceof MouseEvent?Z.clientY:Z.targetTouches[0].clientY)+Ve.anchorPoint.size/2,D(H),E.update()}},F=()=>{N&&r("pointer:up",h.value),N=null},M=s.value;M&&(M.addEventListener("touchstart",q),M.addEventListener("touchend",F),M.addEventListener("mousedown",q),M.addEventListener("mouseup",F),M.addEventListener("mousemove",Y),M.addEventListener("touchmove",Y))};return i.onMounted(()=>{s.value&&(c=new an({width:s.value.scrollWidth,height:s.value.scrollHeight,fullscreen:!1}).appendTo(s.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{V()},{deep:!0,immediate:!0}),ee(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(E,N)=>(i.openBlock(),i.createElementBlock("div",Ep,[i.createVNode(ad,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":N[0]||(N[0]=H=>r("template:select",H)),onInitDrawTemplate:I},null,8,["select-template-index","settings"]),i.createElementVNode("div",Np,[i.createElementVNode("div",Pp,null,512)])]))}}),Mp={class:"flex max-w-[50rem] flex-col gap-3"},Ap={},cd=i.defineComponent({...Ap,__name:"kozyrek-configurator",props:{settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(!1),o=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref(n.settings),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),h=i.ref({quantity:{},marker:{},length:{}}),u=i.ref(0),m=(k=0)=>{var $;const R=($=c.value.allTemplates)==null?void 0:$.at(k);R!==void 0&&(u.value=k,l.value.configuratorParams.linesWidths=R.points.map(P=>O.isArray(P)?P[0]:P.width),l.value.configuratorParams.linesAngles=R.points.map(P=>O.isArray(P)?P[1]:P.angle),b()),p(l.value.configuratorParams)},g=async()=>{const k=prompt("Введите название шаблона:");if(!k)return;a.value=!0;const R={label:k,points:l.value.configuratorParams.linesWidths.map(($,P)=>[$,l.value.configuratorParams.linesAngles[P]])};await G.HttpRequester.getInstance(G.ConfiguratorProvider).createTemplate(n.cartItem.category,R,h.value).then(()=>{c.value.addCustomTemplate(R),u.value=c.value.allTemplates.length-1}).catch(()=>{a.value=!1}),a.value=!1},f=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(u.value=c.value.allTemplates.length-1)},p=async k=>{b(),s.value=!0,await G.HttpRequester.getInstance(G.ConfiguratorProvider).searchProduct(n.cartItem.category,k,h.value).then(R=>{l.value.product=R}).catch(()=>{s.value=!1}),s.value=!1},y=()=>{o.value=!0,r("submit",l.value,h.value,()=>{o.value=!1})},b=()=>{const k={quantity:h.value.quantity,marker:h.value.marker};l.value.configuratorParams.linesWidths.forEach((R,$)=>{k[`lines_widths[${$+1}]`]={},k[`lines_angles[${$+1}]`]={}}),h.value=k},_=k=>{d.value.linesWidths=k.map(R=>R.width),d.value.linesAngles=k.map(R=>R.angle)},C=k=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,b(),f(),p(l.value.configuratorParams)},S=(k,R)=>{d.value.linesWidths=k,d.value.linesAngles=R},v=k=>{const R=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,$=0;l.value.configuratorParams.linesWidths.splice(k+1,0,R),l.value.configuratorParams.linesAngles.splice(k+1,0,$),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],b(),f(),p(l.value.configuratorParams)},B=k=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(k,1),l.value.configuratorParams.linesAngles.splice(k,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],b(),f(),p(l.value.configuratorParams))};return i.onBeforeMount(()=>{m()}),(k,R)=>{const $=z.NButton;return i.openBlock(),i.createElementBlock("div",Mp,[t.settings.allowShowTable?(i.openBlock(),i.createBlock($,{key:0,type:"tertiary",class:"self-end",onClick:R[0]||(R[0]=P=>r("click:view-switch"))},{default:i.withCtx(()=>[...R[3]||(R[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(ld,{value:l.value,"select-template-index":u.value,settings:c.value,"onPointer:up":C,"onPointer:move":_,"onTemplate:select":m},null,8,["value","select-template-index","settings"]),i.createVNode(Ua,{value:l.value,"onUpdate:value":R[1]||(R[1]=P=>l.value=P),"preview-params":d.value,validation:h.value,settings:c.value,"is-submit-processing":o.value,"is-product-searching":s.value,"select-template-index":u.value,"onUpdate:params":R[2]||(R[2]=P=>p(P)),"onUpdate:preview":S,onSubmit:y,"onClick:saveTemplate":g,"onClick:addLine":v,"onClick:removeLine":B},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])}}}),Vp={},Li=i.defineComponent({...Vp,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.value),a=i.computed(()=>i.inject("debounce-input-time",r.debounceTime)),l=O.debounce(()=>s("update:value",o.value),a.value),c=g=>{o.value=g,l()};i.watch(()=>r.value,g=>{o.value=g});const d=i.ref(null);return e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blur()},select:()=>{var g;return(g=d.value)==null?void 0:g.select()}}),(g,f)=>(i.openBlock(),i.createBlock(i.unref(z.NInputNumber),{ref_key:"inputReference",ref:d,value:o.value,"onUpdate:value":[f[0]||(f[0]=p=>o.value=p),c],clearable:t.clearable,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,validator:t.validator},{prefix:i.withCtx(()=>[i.renderSlot(g.$slots,"prefix")]),_:3},8,["value","clearable","placeholder","min","max","step","validator"]))}}),Op={key:0,class:"flex items-baseline gap-1"},Ip={key:0,class:"flex items-baseline gap-1"},zp={key:0},Lp={class:"text-lg font-semibold"},Dp={key:1,class:"text-red-500 text-sm mb-2"},Hp={class:"flex gap-3"},Wp={},dd=i.defineComponent({...Wp,__name:"mosquito-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:instructions-toggle","click:show-preview-drawer"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>bt.isPhoneDevice()),o=i.ref(O.cloneDeep(i.toRaw(n.value.configuratorParams))),a=i.computed(()=>n.settings.widthOverlaps[o.value.mountType]??0),l=i.computed(()=>n.settings.heightOverlaps[o.value.mountType]??0),c=i.computed(()=>n.settings.maxWidths[o.value.netType]),d=i.computed(()=>n.settings.maxHeights[o.value.netType]),h=i.computed(()=>{var S;const{width:p,height:y}=o.value,{quantity:b}=n.value,_=((S=n.value.product)==null?void 0:S.costRub)||0;if(!p||!y||!b||_===0)return null;const C=p*y/1e6;return(_*b*C).toLocaleString("ru-ru",{minimumFractionDigits:2})}),u=i.computed(()=>{const p=!!(o.value.width&&o.value.width>=n.settings.minWidth&&o.value.width<=n.settings.maxWidths[o.value.netType]),y=!!(o.value.height&&o.value.height>=n.settings.minHeight&&o.value.height<=n.settings.maxHeights[o.value.netType]),b=!!(n.value.quantity&&n.value.quantity>0);return p&&y&&b}),m=p=>{o.value.mountType=p,u.value&&(r("update:params",o.value),f("configuratorParams",o.value))},g=(p,y)=>{p&&p in o.value&&(o.value[p]=y??0),u.value&&(r("update:params",o.value),f("configuratorParams",o.value))},f=(p,y)=>{const b=new G.CartItemBase(n.value);b[p]=y,r("update:value",b)};return(p,y)=>{const b=z.NInput;return i.openBlock(),i.createBlock(i.unref(z.NForm),{class:"flex flex-col gap-2 px-4 md:max-w-96"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:o.value.netType,"onUpdate:value":[y[0]||(y[0]=_=>o.value.netType=_),g],options:t.settings.netType.map(_=>({label:t.settings.descriptions.net_type[_],value:_}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:o.value.color,"onUpdate:value":y[1]||(y[1]=_=>o.value.color=_),options:t.settings.color.map(_=>({label:t.settings.descriptions.color[_],value:_}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:o.value.mountType,"onUpdate:value":[y[2]||(y[2]=_=>o.value.mountType=_),m],options:t.settings.mountType.map(_=>({label:t.settings.descriptions.mount_type[_],value:_}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.width.feedback||"","show-feedback":t.validation.width.showFeedback||o.value.width>=t.settings.minWidth&&o.value.width<=t.settings.maxWidths[o.value.netType],"validation-status":t.validation.width.validationStatus||void 0,label:`Ширина светового проёма от ${t.settings.minWidth-a.value} ${c.value?" до "+(c.value-a.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.width.showFeedback&&o.value.width>=t.settings.minWidth&&o.value.width<=t.settings.maxWidths[o.value.netType]?(i.openBlock(),i.createElementBlock("div",Op,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(o.value.width),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:y[4]||(y[4]=_=>r("click:instructions-toggle"))},{default:i.withCtx(()=>[...y[11]||(y[11]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(Li,{value:o.value.width&&o.value.width-a.value||void 0,max:c.value-a.value,min:t.settings.minWidth-a.value,placeholder:"Введите ширину светового проёма",class:"w-full","onUpdate:value":y[3]||(y[3]=_=>g("width",(_&&_+a.value)??void 0))},null,8,["value","max","min"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.height.feedback||"","show-feedback":t.validation.height.showFeedback||o.value.height>=t.settings.minHeight&&o.value.height<=t.settings.maxHeights[o.value.netType],"validation-status":t.validation.height.validationStatus||void 0,label:`Высота светового проёма от ${t.settings.minHeight-l.value} ${d.value?" до "+(d.value-l.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&o.value.height>=t.settings.minHeight&&o.value.height<=t.settings.maxHeights[o.value.netType]?(i.openBlock(),i.createElementBlock("div",Ip,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(o.value.height),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:y[6]||(y[6]=_=>r("click:instructions-toggle"))},{default:i.withCtx(()=>[...y[12]||(y[12]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(Li,{value:o.value.height&&o.value.height-l.value||void 0,max:d.value-l.value,min:t.settings.minHeight-l.value,placeholder:"Введите высоту светового проёма",class:"w-full","onUpdate:value":y[5]||(y[5]=_=>g("height",(_&&_+l.value)??void 0))},null,8,["value","max","min"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.quantity.feedback||"","show-feedback":t.validation.quantity.showFeedback||!1,"validation-status":t.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:t.value.quantity,"onUpdate:value":y[7]||(y[7]=_=>t.value.quantity=_),min:1,validator:_=>Number.isInteger(_),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{feedback:t.validation.marker.feedback||"","show-feedback":t.validation.marker.showFeedback||!1,"validation-status":t.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(b,{value:t.value.marker,"onUpdate:value":y[8]||(y[8]=_=>t.value.marker=_),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(nr,{"is-product-searching":t.isProductSearching,product:t.value.product},null,8,["is-product-searching","product"]),h.value?(i.openBlock(),i.createElementBlock("div",zp,[y[13]||(y[13]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Lp,i.toDisplayString(h.value)+" ₽",1)])):i.createCommentVNode("",!0),u.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Dp," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",Hp,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!u.value,type:"primary",class:"self-start",onClick:y[9]||(y[9]=_=>r("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,type:"default",onClick:y[10]||(y[10]=_=>r("click:show-preview-drawer"))},{default:i.withCtx(()=>[...y[14]||(y[14]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1})}}}),jp="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",qp="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",Xp="/img/configurators/mosquitto/measurement-instructions/mount.png",Yp="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Up="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",Gp={class:"flex flex-col gap-6"},Kp={class:"flex gap-4"},Zp={class:"flex flex-col gap-2"},Qp={class:"flex gap-4"},Jp={class:"flex flex-col gap-2"},e0={class:"flex gap-4"},t0={class:"flex flex-col gap-2"},n0={},hd=i.defineComponent({...n0,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=bt.initRefDependingOnDeviceResolution("small","small","medium"),r=bt.initRefDependingOnDeviceResolution(.98,.95,.8),s=i.computed(()=>window.innerWidth*r.value),o=e;return(a,l)=>{const c=z.NText;return i.openBlock(),i.createBlock(i.unref(z.NModal),{show:t.show,"show-icon":!1,size:i.unref(n),style:i.normalizeStyle(`width: ${s.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>o("update:show",!1)),onEsc:l[1]||(l[1]=d=>o("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>o("update:show",!1))},{default:i.withCtx(()=>[i.createElementVNode("div",Gp,[i.createVNode(c,{type:"error",class:"text-base font-medium"},{default:i.withCtx(()=>[...l[3]||(l[3]=[i.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=i.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:jp,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),i.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:qp,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),i.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),i.createElementVNode("div",Kp,[l[9]||(l[9]=i.createElementVNode("img",{src:Xp,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Zp,[l[8]||(l[8]=i.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),i.createElementVNode("span",null,[l[4]||(l[4]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.frame)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=i.createElementVNode("br",null,null,-1)),l[7]||(l[7]=i.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),i.createElementVNode("div",Qp,[l[15]||(l[15]=i.createElementVNode("img",{src:Yp,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Jp,[l[14]||(l[14]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),i.createElementVNode("span",null,[l[10]||(l[10]=i.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=i.createElementVNode("br",null,null,-1)),l[13]||(l[13]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),i.createElementVNode("div",e0,[l[21]||(l[21]=i.createElementVNode("img",{src:Up,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",t0,[l[20]||(l[20]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),i.createElementVNode("span",null,[l[16]||(l[16]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.external_metal)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=i.createElementVNode("br",null,null,-1)),l[19]||(l[19]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),i0={class:"flex flex-col items-center justify-between rounded-xl"},r0={class:"img-preview relative flex justify-center"},s0={},o0=i.defineComponent({...s0,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(t,{emit:e}){const n=t,r=i.computed(()=>O.keys(n.settings.crossbarCount).find(o=>n.settings.crossbarCount[Number(o)]&&(!n.settings.crossbarCount[Number(o)+1]||n.configuratorParams.height<n.settings.crossbarCount[Number(o)+1]-n.settings.heightOverlaps[n.configuratorParams.mountType]))),s=e;return(o,a)=>{const l=z.NButton;return i.openBlock(),i.createElementBlock("div",i0,[i.createElementVNode("div",r0,[a[1]||(a[1]=i.createElementVNode("div",{class:"window"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["net",`net-${t.configuratorParams.netType}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["frame",`frame-${t.configuratorParams.color}`])},null,2),r.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${t.configuratorParams.color}`])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["mount",`mount-${t.configuratorParams.mountType}-${t.configuratorParams.color}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["cut-preview",`cut-preview-${t.configuratorParams.mountType}-${t.configuratorParams.color}`])},null,2)]),i.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>s("open-instructions"))},{default:i.withCtx(()=>[...a[2]||(a[2]=[i.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),Eo=Zn(o0,[["__scopeId","data-v-8b43aa68"]]),a0={class:"grid md:grid-cols-2"},l0={},ud=i.defineComponent({...l0,__name:"mosquito-configurator",props:{settings:{},cartItem:{}},emits:["submit"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>bt.isPhoneDevice()),o=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref({width:{},height:{},quantity:{},marker:{}}),d=i.ref(!1),h=i.ref(!1),u=async g=>{g.height>0&&g.width>0&&(d.value=!0,await G.HttpRequester.getInstance(G.ConfiguratorProvider).searchProduct(n.cartItem.category,g,c.value).then(f=>{l.value.product=f}).catch(()=>{d.value=!1}),d.value=!1)},m=()=>{h.value=!0,r("submit",l.value,c.value,()=>{h.value=!1})};return(g,f)=>{const p=ss;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(hd,{show:a.value,"onUpdate:show":f[0]||(f[0]=y=>a.value=y),"height-overlaps":t.settings.heightOverlaps,"width-overlaps":t.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",a0,[s.value?(i.openBlock(),i.createBlock(i.unref(z.NDrawer),{key:1,show:o.value,"onUpdate:show":f[4]||(f[4]=y=>o.value=y),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(z.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:f[2]||(f[2]=y=>o.value=!1)},{default:i.withCtx(()=>[i.createVNode(p)]),_:1})]),default:i.withCtx(()=>[i.createVNode(Eo,{"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:f[3]||(f[3]=y=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(Eo,{key:0,"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:f[1]||(f[1]=y=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(dd,{value:l.value,"onUpdate:value":f[5]||(f[5]=y=>l.value=y),validation:c.value,settings:t.settings,"is-product-searching":d.value,"is-submit-processing":h.value,"onUpdate:params":f[6]||(f[6]=y=>u(y)),onSubmit:f[7]||(f[7]=y=>m()),"onClick:instructionsToggle":f[8]||(f[8]=y=>a.value=!a.value),"onClick:showPreviewDrawer":f[9]||(f[9]=y=>o.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),c0={key:0},d0={},fd=i.defineComponent({...d0,__name:"strip-configurator-line-item",props:{value:{},index:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},validation:{default:()=>({})}},emits:["update:value","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=d=>{s("update:value",d??0,r.index,a)};i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{c()})});const c=()=>{var d;(d=o.value)==null||d.select()};return e({focusWidthInput:c}),(d,h)=>{var g;const u=Ya,m=Xa;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{label:`Полоса №${t.index+1}, мм`,required:!0,"validation-status":a.value||(g=t.validation)==null?void 0:g.validationStatus},{feedback:i.withCtx(()=>{var f,p;return[(f=t.validation)!=null&&f.showFeedback?(i.openBlock(),i.createElementBlock("span",c0,i.toDisplayString((p=t.validation)==null?void 0:p.feedback),1)):i.createCommentVNode("",!0),i.createVNode(nr,{"is-product-searching":a.value,product:t.product},null,8,["is-product-searching","product"])]}),default:i.withCtx(()=>[i.createVNode(i.unref(z.NDropdown),{trigger:"click",options:t.suggestionOption,placement:"bottom-start",size:"large",onSelect:l},{default:i.withCtx(()=>[i.createVNode(Li,{ref:"width-input-element",value:t.value,class:"w-full",min:t.settings.minLineWidth,step:t.settings.lineWidthStep,validator:f=>!!f&&f>=t.settings.minLineWidth&&f%t.settings.lineWidthStep===0,placeholder:"Введите ширину","onUpdate:value":l},null,8,["value","min","step","validator"])]),_:1},8,["options"]),i.createVNode(i.unref(z.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[0]||(h[0]=f=>s("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"]),i.createVNode(i.unref(z.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[1]||(h[1]=f=>s("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"])]),_:1},8,["label","validation-status"])}}}),h0={class:"my-2 flex w-full flex-col"},u0={key:0},f0={class:"text-lg font-semibold"},g0={class:"flex gap-3"},m0={},gd=i.defineComponent({...m0,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>n.value[0].configuratorParams.linesWidths.reduce((u,m)=>(u??0)+(m??0),0)),o=i.computed(()=>n.settings.width-s.value),a=i.computed(()=>!n.value.some(({product:u})=>!u)),l=i.computed(()=>o.value===0?void 0:[{label:`${(o.value>0?"Остаток +":"Излишек ")+o.value} мм.`,key:o.value}]),c=i.computed(()=>{const{length:u}=n.value[0];return!u||s.value!==n.settings.width?null:(O.reduce(n.value,(g,f)=>{var y;const p=((y=f.product)==null?void 0:y.costRub)||0;return g+p},0)*n.value[0].quantity*u).toLocaleString("ru-ru",{minimumFractionDigits:2})}),d=(u,m,g)=>{const f=n.value.at(m);if(f)if(u&&u>=n.settings.minLineWidth&&u%n.settings.lineWidthStep===0){const p={linesWidths:f.configuratorParams.linesWidths.toSpliced(m,1,u)};r("update:params",p,m,g),h("configuratorParams",p)}else f.product.id=-1},h=(u,m)=>{const g=n.value.map(f=>new G.CartItemBase(f));g.forEach(f=>{f[u]=m}),r("update:value",g)};return(u,m)=>{const g=z.NInput;return i.openBlock(),i.createBlock(i.unref(z.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>{var f;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.value,(p,y)=>(i.openBlock(),i.createBlock(fd,{key:y,"auto-focus":!0,index:y,value:p.configuratorParams.linesWidths.at(y)??null,product:p.product,settings:t.settings,validation:t.validation[`linesWidths.${y}`],"suggestion-option":l.value,"add-line-button-disabled":o.value<=0||t.value.length>=t.settings.maxLinesCount,"remove-line-button-disabled":t.value.length===1,"onUpdate:value":d,"onClick:addLine":m[0]||(m[0]=b=>r("click:add-line",b)),"onClick:removeLine":m[1]||(m[1]=b=>r("click:remove-line",b))},null,8,["index","value","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled"]))),128)),i.createElementVNode("div",h0,[o.value<0?(i.openBlock(),i.createBlock(i.unref(z.NText),{key:0,type:"error"},{default:i.withCtx(()=>[i.createTextVNode(" Сумма ширин всех полос должна быть равна "+i.toDisplayString(t.settings.width),1)]),_:1})):i.createCommentVNode("",!0),a.value&&t.value.length===t.settings.maxLinesCount&&o.value>0?(i.openBlock(),i.createBlock(i.unref(z.NText),{key:1,type:"error"},{default:i.withCtx(()=>[...m[7]||(m[7]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[m[8]||(m[8]=i.createTextVNode(" Остаток для резки: ",-1)),i.createVNode(i.unref(z.NText),{type:o.value>=0?"Success":"error"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(o.value),1)]),_:1},8,["type"]),i.createTextVNode(" из "+i.toDisplayString(t.settings.width)+" мм ",1)])]),i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!a.value||o.value<=0||t.value.length>=t.settings.maxLinesCount,type:"primary",class:"self-center",onClick:m[2]||(m[2]=p=>r("click:add-line",t.value.length))},{default:i.withCtx(()=>[...m[9]||(m[9]=[i.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["loading","disabled"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.length.feedback||"","show-feedback":t.validation.length.showFeedback||!1,"validation-status":t.validation.length.validationStatus||void 0,label:`Метраж ${t.settings.minLength?" от "+t.settings.minLength:""} ${t.settings.maxLength?" до "+t.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:n.value[0].length,max:t.settings.maxLength||void 0,min:t.settings.minLength,step:t.settings.lengthStep,validator:p=>p%t.settings.lengthStep===0,placeholder:"Введите метраж",class:"w-full","onUpdate:value":m[3]||(m[3]=p=>h("length",p??0))},null,8,["value","max","min","step","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.quantity.feedback||"","show-feedback":t.validation.quantity.showFeedback||!1,"validation-status":t.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:n.value[0].quantity,min:1,validator:p=>Number.isInteger(p),placeholder:"Введите количество",class:"w-full","onUpdate:value":m[4]||(m[4]=p=>h("quantity",p??0))},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{"show-feedback":!1,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(g,{value:n.value[0].marker,placeholder:"Введите маркировку","onUpdate:value":m[5]||(m[5]=p=>h("marker",p))},null,8,["value"])]),_:1}),c.value?(i.openBlock(),i.createElementBlock("div",u0,[m[10]||(m[10]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",f0,i.toDisplayString(c.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",g0,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!a.value||o.value!=0||!((f=t.value[0])!=null&&f.length)||t.value[0].length>t.settings.maxLength||t.value[0].length<t.settings.minLength||t.value[0].quantity===0,type:"primary",class:"self-start",onClick:m[6]||(m[6]=p=>r("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1})}}}),p0={class:"flex grow flex-col"},y0=["src"],b0={class:"w-full"},_0={},md=i.defineComponent({..._0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",p0,[i.createElementVNode("img",{src:"/img/configurators/strip/strip-"+t.value.length+".png",class:"w-full max-w-96 self-center",alt:"Штрипс"},null,8,y0),i.createElementVNode("div",b0,[i.createTextVNode(" Число полос можно указать от "+i.toDisplayString(t.settings.minLinesCount)+" до "+i.toDisplayString(t.settings.maxLinesCount)+". ",1),n[0]||(n[0]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Минимальная ширина полосы "+i.toDisplayString(t.settings.minLineWidth)+" мм. ",1),n[1]||(n[1]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина всех полос "+i.toDisplayString(t.settings.width)+" мм. ",1),n[2]||(n[2]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Шаг ширины полосы - "+i.toDisplayString(t.settings.lineWidthStep)+" мм. ",1)])]))}}),w0={class:"flex flex-col gap-2"},x0={class:"w-104 flex grow flex-col px-5"},v0={},pd=i.defineComponent({...v0,__name:"strip-configurator",props:{settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.cartItems),o=i.ref({width:{},length:{},quantity:{},marker:{}}),a=i.ref(!1),l=i.computed(()=>s.value[0].configuratorParams.linesWidths.reduce((m,g)=>(m??0)+(g??0),0)),c=m=>{m===void 0&&(m=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(p=>{p.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const f=new G.CartItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??n.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,f)},d=m=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(f=>{f.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete o[`linesWidths.${m}`],delete o[`linesWidths.${m}`])},h=async(m,g,f)=>{f.value=!0,o.value[`linesWidths.${g}`]={},await G.HttpRequester.getInstance(G.ConfiguratorProvider).searchProduct(s.value[g].category,{linesWidths:m.linesWidths.at(g)},o.value).then(p=>{s.value[g].product=p,g===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&l.value&&l.value<n.settings.width&&c()}).catch(()=>{s.value[g].product=new G.Product,o.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},f.value=!1}),f.value=!1},u=()=>{a.value=!0,r("submit",s.value,o.value,()=>{a.value=!1})};return(m,g)=>{const f=z.NButton;return i.openBlock(),i.createElementBlock("div",w0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(f,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[3]||(g[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",x0,[i.createVNode(md,{value:s.value,"onUpdate:value":g[1]||(g[1]=p=>s.value=p),settings:t.settings},null,8,["value","settings"]),i.createVNode(gd,{value:s.value,"onUpdate:value":g[2]||(g[2]=p=>s.value=p),validation:o.value,settings:t.settings,"is-submit-processing":a.value,"onUpdate:params":h,onSubmit:u,"onClick:addLine":c,"onClick:removeLine":d},null,8,["value","validation","settings","is-submit-processing"])])])}}}),k0={class:"flex flex-col gap-3"},C0={},yd=i.defineComponent({...C0,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(t,{emit:e}){const n=t,r=e,s=i.useTemplateRef("first-input-element"),o=i.ref(O.cloneDeep(i.toRaw(n.value.configuratorParams))),a=()=>{o.value.length>0&&o.value.width>0&&(r("update:params",o.value),l("configuratorParams",o.value))},l=(c,d)=>{const h=new G.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.onMounted(()=>{n.value.isNewRec()&&i.nextTick(()=>{var c;(c=s.value)==null||c.focus()})}),(c,d)=>{const h=z.NInput;return i.openBlock(),i.createBlock(i.unref(z.NForm),{disabled:t.isSubmitProcessing,class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.width.feedback||"","show-feedback":t.validation.width.showFeedback||!1,"validation-status":t.validation.width.validationStatus||void 0,label:`Ширина, ${t.settings.minWidth?" от "+t.settings.minWidth:""}${t.settings.maxWidth?" до "+t.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(Li,{ref:"first-input-element",value:o.value.width,"onUpdate:value":[d[0]||(d[0]=u=>o.value.width=u),a],class:"w-full",max:t.settings.maxWidth??void 0,min:t.settings.minWidth,validator:u=>!!u&&u>=t.settings.minWidth&&(!t.settings.maxWidth||u<=t.settings.maxWidth),placeholder:"Введите ширину"},null,8,["value","max","min","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.length.feedback||"","show-feedback":t.validation.length.showFeedback||!1,"validation-status":t.validation.length.validationStatus||void 0,label:`Длина, ${t.settings.minLength?" от "+t.settings.minLength:""}${t.settings.maxLength?" до "+t.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(Li,{value:o.value.length,"onUpdate:value":[d[1]||(d[1]=u=>o.value.length=u),a],placeholder:"Введите длину",max:t.settings.maxLength,min:t.settings.minLength,validator:u=>u>=t.settings.minLength&&u<=t.settings.maxLength,class:"w-full"},null,8,["value","max","min","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.quantity.feedback||"","show-feedback":t.validation.quantity.showFeedback||!1,"validation-status":t.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:t.value.quantity,placeholder:"Введите количество",min:1,validator:u=>u>0,class:"w-full","onUpdate:value":d[2]||(d[2]=u=>l("quantity",u??0))},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{feedback:t.validation.marker.feedback||"","show-feedback":t.validation.marker.showFeedback||!1,"validation-status":t.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(h,{value:t.value.marker,placeholder:"Введите маркировку","onUpdate:value":d[3]||(d[3]=u=>l("marker",u))},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(nr,{"is-product-searching":t.isProductSearching,product:t.value.product},null,8,["is-product-searching","product"]),i.createElementVNode("div",k0,[i.createVNode(i.unref(z.NButton),{disabled:t.value.product.isNewRec()||t.isProductSearching||t.isSubmitProcessing||t.value.length===0||t.value.width===0||t.value.quantity===0,type:"primary",class:"self-start",onClick:d[4]||(d[4]=u=>r("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["disabled"])}}}),S0={class:"flex flex-col gap-2"},B0={},bd=i.defineComponent({...B0,__name:"metal-for-doors-configurator",props:{settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.cartItem),o=i.ref({width:{},length:{},quantity:{},marker:{}}),a=i.ref(!1),l=i.ref(!1),c=async h=>{a.value=!0,await G.HttpRequester.getInstance(G.ConfiguratorProvider).searchProduct(n.cartItem.category,h,o.value).then(u=>{s.value.product=u}).catch(()=>{a.value=!1}),a.value=!1},d=()=>{l.value=!0,r("submit",s.value,o.value,()=>{l.value=!1})};return(h,u)=>{const m=z.NButton;return i.openBlock(),i.createElementBlock("div",S0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:u[0]||(u[0]=g=>r("click:view-switch"))},{default:i.withCtx(()=>[...u[4]||(u[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(yd,{value:s.value,"onUpdate:value":u[1]||(u[1]=g=>s.value=g),validation:o.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":u[2]||(u[2]=g=>c(g)),onSubmit:u[3]||(u[3]=g=>d())},null,8,["value","validation","settings","is-submit-processing"])])}}});class Di extends G.Identity{constructor(n,r){super();x(this,"label","");x(this,"points",[]);x(this,"isCustom",!1);x(this,"id",-1);x(this,"guid","");n?(this.label=n.label,this.points=n.points.map((s,o)=>O.isArray(s)?new ri(s[0],s[1],`A-${o+1}`):new ri(s.width,s.angle,`A-${o+1}`))):(this.label="-- Новая конфигурация --",this.points=[new ri(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class No extends Di{constructor(n){super(n);x(this,"isDefault");this.isDefault=n.isDefault??!1}}class _d{constructor(e){x(this,"minLineWidth");x(this,"maxLineWidth");x(this,"lineWidthStep");x(this,"minLineAngle");x(this,"maxLineAngle");x(this,"lineAngleStep");x(this,"stripMinWidth");x(this,"stripMaxWidth");x(this,"stripMinLength");x(this,"stripMaxLength");x(this,"allowShowTable");x(this,"showOnlyTemplates");x(this,"templates");x(this,"customTemplates",[]);x(this,"startTailConfigs");x(this,"endTailConfigs");x(this,"bendCountForExtended");x(this,"extendedProductCatalog");x(this,"allowChangeFirstPoint");x(this,"allowSaveTemplates");x(this,"userTemplatesPrefix");x(this,"lengthStep");var n,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(s=>new Di(s)),this.templates.forEach((s,o)=>{s.id=o}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(s=>new No(s)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(s=>new No(s)))??[],this.bendCountForExtended=e.bendCountForExtended,this.extendedProductCatalog=e.extendedProductCatalog,this.allowChangeFirstPoint=e.allowChangeFirstPoint,this.allowSaveTemplates=e.allowSaveTemplates,this.userTemplatesPrefix=e.userTemplatesPrefix,this.lengthStep=e.lengthStep,this.showOnlyTemplates||(this.customTemplates=e.customTemplates?Object.entries(e.customTemplates).map(([s,o])=>{const a=new Di(o);return a.isCustom=!0,a.id=+s,a}):[],this.customTemplates.push(new Di))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){var r,s;if(!this.allowSaveTemplates)return;const n=new Di(e);n.isCustom=!0,n.id=(((r=this.customTemplates.at(-1))==null?void 0:r.id)??((s=this.templates.at(-1))==null?void 0:s.id)??0)+1,this.customTemplates.splice(-1,0,n)}removeCustomTemplate(e){if(this.allowSaveTemplates)return;const n=this.customTemplates.findIndex(r=>r.id===e);n&&n!==-1&&this.customTemplates.splice(n,1)}}class T0{constructor(e){x(this,"minHeight");x(this,"maxHeights");x(this,"minWidth");x(this,"maxWidths");x(this,"netType");x(this,"color");x(this,"mountType");x(this,"descriptions");x(this,"crossbarCount");x(this,"heightOverlaps");x(this,"widthOverlaps");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Ps.objectToSnake(e.descriptions),this.maxHeights=e.maxHeights,this.maxWidths=e.maxWidths,this.minHeight=e.minHeight,this.minWidth=e.minWidth,this.mountType=e.mountType,this.netType=e.netType,this.heightOverlaps=Ps.objectToSnake(e.heightOverlaps),this.widthOverlaps=Ps.objectToSnake(e.widthOverlaps)}}const R0={key:0,class:"flex justify-center p-4"},$0={key:1,class:"p-4 text-center text-red-500"},E0={key:2,class:"!bg-white p-4 m-2 rounded-md justify-self-center"},N0={key:3,class:"p-4 text-center text-gray-500"},wd=i.defineComponent({__name:"dynamic-configurator",props:{eventEmitter:{},category:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(!1),o=i.ref(null),a=i.ref(null),l=i.computed(()=>{var g;return(g=n.category.properties)==null?void 0:g.configurator}),c=i.ref(null),d=i.ref(null),h=g=>{var p,y;const f={category:n.category,configurator:l.value,quantity:1};switch(l.value){case"kozyrek":{const b=g;c.value=new G.CartItemBase({...f,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:O.some(b.startTailConfigs,_=>_.isDefault)?(p=b.startTailConfigs)==null?void 0:p.findIndex(_=>_.isDefault):void 0,endTailType:O.some(b.endTailConfigs,_=>_.isDefault)?(y=b.endTailConfigs)==null?void 0:y.findIndex(_=>_.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=g;c.value=new G.CartItemBase({...f,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{d.value=[new G.CartItemBase({...f,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=g;c.value=new G.CartItemBase({...f,configuratorParams:{width:b.minWidth,length:b.minLength}});break}default:o.value=`Неподдерживаемый тип конфигуратора: ${l.value}.`}},u=async()=>{var g;if(!l.value){o.value="Тип конфигуратора не указан в свойствах категории.";return}s.value=!0,o.value=null;try{const p=await G.HttpRequester.getInstance(G.ConfiguratorProvider).getConfiguratorSettings(n.category);switch((g=n.category.properties)==null?void 0:g.configurator){case"kozyrek":a.value=new _d(p);break;case"mosquitto":a.value=new T0(p);break;default:a.value=p;break}h(a.value)}catch(f){"message"in f&&(f.value=`Ошибка при загрузке настроек конфигуратора: ${O.isError(f)?f.message:"Неизвестная ошибка"}.`)}finally{s.value=!1}},m=(g,f,p)=>{const y=b=>{p==null||p(),b&&h(a.value)};r("submit",O.isArray(g)?g[0]:g,f,y)};return i.onMounted(()=>{u()}),(g,f)=>{const p=z.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[s.value?(i.openBlock(),i.createElementBlock("div",R0,[i.createVNode(p,{size:"large"})])):o.value?(i.openBlock(),i.createElementBlock("div",$0,i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),a.value!==null&&(c.value!==null||d.value!==null)?(i.openBlock(),i.createElementBlock("div",E0,[l.value==="kozyrek"?(i.openBlock(),i.createBlock(cd,{key:0,settings:a.value,"cart-item":c.value,"onClick:viewSwitch":f[0]||(f[0]=y=>r("click:view-switch")),onSubmit:m},null,8,["settings","cart-item"])):l.value==="mosquitto"?(i.openBlock(),i.createBlock(ud,{key:1,settings:a.value,"cart-item":c.value,"onClick:viewSwitch":f[1]||(f[1]=y=>r("click:view-switch")),onSubmit:m},null,8,["settings","cart-item"])):l.value==="strip"?(i.openBlock(),i.createBlock(pd,{key:2,settings:a.value,"cart-items":d.value,"onClick:viewSwitch":f[2]||(f[2]=y=>r("click:view-switch")),onSubmit:m},null,8,["settings","cart-items"])):l.value==="metal_for_doors"?(i.openBlock(),i.createBlock(bd,{key:3,settings:a.value,"cart-item":c.value,"onClick:viewSwitch":f[3]||(f[3]=y=>r("click:view-switch")),onSubmit:m},null,8,["settings","cart-item"])):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("div",N0,' Конфигуратор "'+i.toDisplayString(l.value)+'" не поддерживается. ',1))],64)}}}),P0={key:0,class:"pt-0.5"},F0={key:0},M0={class:"line-through"},A0={key:0},V0={key:1},O0={class:"flex flex-row gap-1"},I0={key:0},z0={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},L0={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},D0={key:2,class:"flex flex-col"},H0={},W0=i.defineComponent({...H0,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:Function,default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function],default:!1},showCategoryRequiredButton:{type:[Boolean,String,Function],default:!1},showCategoryPinButton:{type:[Boolean,String,Function],default:!1},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function],default:!1},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},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(t){const e=t,n=i.inject($r,"medium"),r=i.computed(()=>{var F;return(F=e==null?void 0:e.filteredItems)==null?void 0:F[e.categoryItem.id]}),s=i.computed(()=>{var F,M;return O.isArray((F=e.categoryItem)==null?void 0:F.categories)&&((M=e.categoryItem.categories)==null?void 0:M.length)>0}),o=i.computed(()=>{var F;return O.isArray((F=e.categoryItem)==null?void 0:F.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([F,M])=>`${M} руб./${R(F)}`).join(", ")),l=i.computed(()=>O.isUndefined(e.filteredItems)||r.value==="*"?o.value:o.value.filter(F=>{var Z;const M=(Z=r.value)==null?void 0:Z.products;return O.isArray(M)&&M.includes(F.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>O.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),h=i.computed(()=>O.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),u=i.computed(()=>O.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),m=i.computed(()=>O.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var F;return((F=e.categoryItem.properties)==null?void 0:F.configurator)!==void 0&&(O.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)}),f=i.computed(()=>O.isNil(e.categoryContextButtonsConfig)?[]:O.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),p=i.computed(()=>new G.ClientCategory(e.categoryItem)),y=i.ref(!1),b=i.ref(!1),_=i.computed(()=>!O.isUndefined(e.isCategoryItemSelected)),C=i.computed(()=>O.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected),S=i.computed(()=>H.value&&bt.getDeviceTypeByResolution()===Ue.laptop?"auto":"fixed"),v=i.useTemplateRef("collapse-item-reference"),B=i.computed(()=>{var F,M;return(M=(F=e.categoryItem.properties)==null?void 0:F.templateCost)==null?void 0:M.priceCoefficient}),k=i.computed(()=>{var F,M;return(M=(F=e.categoryItem.properties)==null?void 0:F.templateCost)==null?void 0:M.increasePercent}),R=(F,M="ru-RU")=>0 .toLocaleString(M,{style:"currency",currency:F,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),$=F=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:F,target:v.value})},P=(F,M)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:M,isLoadingState:y,target:v.value})},I=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:v.value})},V=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:v.value})},A=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:v.value})},L=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:v.value})},D=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:v.value})},ee=F=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:F,target:v.value})},E=(F,M,Z)=>{e.eventEmitter.emit("configurator:submit",{cartItem:F,target:v.value,callback:Z,validation:M})},N=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem,target:v.value})},H=i.ref(0),q=i.computed(()=>H.value&&o.value.length>0?yg(o.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),Y=O.debounce(()=>{H.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",Y)}),window.addEventListener("resize",Y),Y(),(F,M)=>{const Z=z.NCheckbox,fe=sf,ie=z.NTooltip,me=tf,re=z.NTag,Me=Qu,Ae=Gu,Oe=z.NButton,Le=Xu,pt=La,Zt=za,Qt=Ia,St=Oa,At=z.NDropdown,yt=z.NDataTable,pn=z.NAlert,Pn=z.NSpin;return i.openBlock(),i.createBlock(Da,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":P},{"pre-arrow":i.withCtx(()=>{var De,ke;return[_.value?(i.openBlock(),i.createElementBlock("div",P0,[i.createVNode(Z,{checked:C.value,disabled:C.value==="disabled","onUpdate:checked":$},null,8,["checked","disabled"])])):i.createCommentVNode("",!0),!d.value&&((De=p.value)!=null&&De.isDisabled)?(i.openBlock(),i.createBlock(ie,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(fe,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[1]||(M[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((ke=p.value)==null?void 0:ke.isFavorite)??!1?(i.openBlock(),i.createBlock(ie,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(me,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[2]||(M[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var De,ke,Ie,J,se;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":t.categoryItem.isHidden,"text-gray-400":(De=p.value)==null?void 0:De.isDisabled})},[i.createVNode(ie,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[M[3]||(M[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:M[0]||(M[0]=i.withModifiers((...Ce)=>i.unref(O.noop)&&i.unref(O.noop)(...Ce),["prevent","stop"]))},[(ke=t.categoryItem.properties)!=null&&ke.m2Price?(i.openBlock(),i.createBlock(re,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((Ie=t.categoryItem.properties)==null?void 0:Ie.templateCost)&&t.categoryItem.properties.m2PriceRetail&&k.value}),round:""},{default:i.withCtx(()=>{var Ce;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(Ce=t.categoryItem.properties)!=null&&Ce.templateCost&&t.categoryItem.properties.m2PriceRetail&&k.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[k.value?(i.openBlock(),i.createBlock(re,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[k.value?(i.openBlock(),i.createElementBlock("span",F0,i.toDisplayString(k.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(re,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",M0,i.toDisplayString(t.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(J=t.categoryItem.properties)!=null&&J.templateCost?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[B.value||k.value?(i.openBlock(),i.createBlock(re,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var Ce;return[B.value?(i.openBlock(),i.createElementBlock("span",A0,i.toDisplayString((Ce=B.value)==null?void 0:Ce.name),1)):i.createCommentVNode("",!0),k.value?(i.openBlock(),i.createElementBlock("span",V0,i.toDisplayString(k.value>0?"+":"")+i.toDisplayString(k.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(re,{key:2,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),h.value&&((se=p.value)!=null&&se.manager)?(i.openBlock(),i.createBlock(re,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:L},{default:i.withCtx(()=>[i.createVNode(ie,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var Ce,Jt;return[i.createElementVNode("span",O0,[i.createVNode(Me),i.createTextVNode(" "+i.toDisplayString((Jt=(Ce=p.value)==null?void 0:Ce.manager)==null?void 0:Jt.name),1)])]}),default:i.withCtx(()=>{var Ce,Jt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((Jt=(Ce=p.value)==null?void 0:Ce.manager)==null?void 0:Jt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",I0,[i.createElementVNode("ul",z0,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(De,ke)=>(i.openBlock(),i.createElementBlock("li",{key:ke}," ("+i.toDisplayString(ke)+"): "+i.toDisplayString(De),1))),128)):i.createCommentVNode("",!0),t.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(t.categoryItem.properties,(De,ke)=>(i.openBlock(),i.createElementBlock("li",{key:ke}," ("+i.toDisplayString(ke)+"): "+i.toDisplayString(De),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var De;return[i.createElementVNode("div",L0,[d.value?(i.openBlock(),i.createBlock(ie,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,size:i.unref(n),onClick:I},{default:i.withCtx(()=>{var ke;return[(ke=p.value)!=null&&ke.isDisabled?(i.openBlock(),i.createBlock(fe,{key:1})):(i.openBlock(),i.createBlock(Ae,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var ke;return[(ke=p.value)!=null&&ke.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(p.value.hidingComment?`. Причина: '${p.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),h.value&&!((De=p.value)!=null&&De.manager)?(i.openBlock(),i.createBlock(ie,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,size:i.unref(n),onClick:A},{default:i.withCtx(()=>[i.createVNode(Le)]),_:1},8,["size"])]),default:i.withCtx(()=>{var ke,Ie,J;return[(ke=p.value)!=null&&ke.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((J=(Ie=p.value)==null?void 0:Ie.manager)==null?void 0:J.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock(ie,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,disabled:u.value==="disabled",size:i.unref(n),onClick:V},{default:i.withCtx(()=>{var ke;return[(ke=p.value)!=null&&ke.isRequired?(i.openBlock(),i.createBlock(Zt,{key:1})):(i.openBlock(),i.createBlock(pt,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[M[4]||(M[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(ie,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,size:i.unref(n),type:"primary",onClick:D},{default:i.withCtx(()=>[i.createVNode(Qt)]),_:1},8,["size"])]),default:i.withCtx(()=>[M[5]||(M[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),f.value.length>0?(i.openBlock(),i.createBlock(At,{key:4,options:f.value,size:i.unref(n),trigger:"click",onSelect:ee},{default:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(St)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(F.$slots,"default",{},()=>{var De,ke;return[s.value?(i.openBlock(),i.createBlock(vd,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||y.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((De=r.value)==null?void 0:De.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator"])):i.createCommentVNode("",!0),g.value?(i.openBlock(),i.createBlock(wd,{key:1,"event-emitter":t.eventEmitter,category:t.categoryItem,onSubmit:E,"onClick:viewSwitch":N},null,8,["event-emitter","category"])):c.value?(i.openBlock(),i.createElementBlock("div",D0,[((ke=t.categoryItem.properties)==null?void 0:ke.configurator)!==void 0?(i.openBlock(),i.createBlock(Oe,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:N},{default:i.withCtx(()=>[...M[6]||(M[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(yt,{columns:q.value,data:l.value,bordered:!0,loading:y.value,remote:!0,"row-key":Ie=>Ie.id,"table-layout":S.value,class:"mt-1"},null,8,["columns","data","loading","row-key","table-layout"])])):i.createCommentVNode("",!0),!y.value&&!b.value&&!s.value&&!c.value?(i.openBlock(),i.createBlock(pn,{key:3,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createBlock(pn,{key:4,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createBlock(Pn,{key:5,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...M[7]||(M[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),j0=Zn(W0,[["__scopeId","data-v-8ef5b448"]]),q0={class:"sc-collapse flex w-full flex-col"},X0={},xd=i.defineComponent({...X0,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(t,{emit:e}){const n=t,r=e,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",q0,[i.renderSlot(o.$slots,"default")]))}}),Y0={},vd=i.defineComponent({...Y0,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},client:{default:void 0},filteredItems:{default:void 0},isCategoryItemSelected:{},showCategoryHideForClientButton:{type:[Boolean,String,Function]},showCategoryRequiredButton:{type:[Boolean,String,Function]},showCategoryPinButton:{type:[Boolean,String,Function]},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function]},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},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(t){const e=t,n=i.inject($r,"medium"),r=i.computed(()=>O.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(o=>{var a;return!!((a=e.filteredItems)!=null&&a[o.id])})),s=(o,a)=>{if(O.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=z.NSpin,c=z.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(xd,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(j0,{key:d.id,"category-item":d,"event-emitter":t.eventEmitter,"filtered-items":s(d,t.filteredItems),"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator},null,8,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator"]))),128))]),_:1})):t.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),!t.hasProducts&&!t.loading&&t.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)}}}),U0={},kd=i.defineComponent({...U0,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.computed(()=>O.isArray(r.value)),a=new G.Reference,l=i.computed(()=>{const g=o.value?[]:a,f=O.isUndefined(r.value)?g:r.value;return O.isArray(f)?f.map(p=>p.id):f==null?void 0:f.id}),c=i.computed(()=>zt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue)),d=g=>{var f;if(O.isArray(g)){const p=g.length>0?g.map(y=>{var b;return(b=c.value.find(_=>_.value===y))==null?void 0:b.item}):[];s("update:value",p)}else{const p=g===a.id||(f=c.value.find(y=>y.value===g))==null?void 0:f.item;s("update:value",p)}},h=i.useTemplateRef("select-component");return e({focus:()=>{var g;return(g=h.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=h.value)==null?void 0:g.blur()}}),(g,f)=>(i.openBlock(),i.createBlock(i.unref(z.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":t.consistentMenuWidth,disabled:t.disabled||c.value.length===0,filterable:t.filterable,"max-tag-count":t.maxTagCount,multiple:o.value,options:c.value,placeholder:"",class:"w-full","onUpdate:value":d},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),G0={},K0=i.defineComponent({...G0,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{}},emits:["update:value"],setup(t,{emit:e}){var C,S;const n=t,r=e,s=()=>{const v=G.PriceCoefficient.getRetailPriceCoefficient();return O.unset(v,"isNewRec"),v},o=v=>!v||v.id===s().id,a=i.computed(()=>{var v;return((v=n.catalogItem)==null?void 0:v.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=v=>{var B,k,R,$;return v.id===s().id?(B=l.value)==null?void 0:B.getRetailCost():($=(R=(k=l.value)==null?void 0:k.priceCoefficients)==null?void 0:R.find(P=>P.coefficient.id===v.id))==null?void 0:$.cost},d=i.computed(()=>{var B;const v=[...((B=G.useReferencesStore().priceCoefficientsReference)==null?void 0:B.map(k=>structuredClone(i.toRaw(k))))??[],s()];return a.value&&v.forEach(k=>{var $;const R=c(k);R?k.name+=` (${R} ${($=l.value)==null?void 0:$.currency})`:k.name=""}),v.filter(k=>k.name!=="")}),h=i.ref(n.value.coefficient),u=i.ref(((S=(C=n.value)==null?void 0:C.value)==null?void 0:S.toString())??null),m=i.ref(null),g=i.computed(()=>{var v,B;return(B=(v=l.value)==null?void 0:v.priceCoefficients)==null?void 0:B.find(k=>k.coefficient.slug===G.PriceCoefficientEnum.K0)}),f=i.ref(void 0),p=()=>{var B,k,R;f.value=void 0;let v=Number.parseFloat(((B=u.value)==null?void 0:B.replace(",","."))??"");if(v=Number.isNaN(v)?void 0:v,a.value)if(h.value||u.value){const $=s(),P=c(h.value??$)??0,I=P+P*((v??0)/100);m.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(I),I>(((k=l.value)==null?void 0:k.getRetailCost())??I)&&(f.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&I<(((R=g.value)==null?void 0:R.cost)??0)&&(f.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else m.value=null;r("update:value",{value:Number.isNaN(v)?void 0:v,coefficient:o(h.value)?void 0:structuredClone(i.toRaw(h.value))})},y=v=>{O.isArray(v)||(h.value=v,!h.value&&u.value&&(h.value=s()),p())},b=()=>{h.value||(h.value=s()),p()},_=v=>{var k,R,$,P,I,V;const B=Number.parseFloat((v==null?void 0:v.replace(",","."))??"");if(a.value){let A=0;if(B<=0)h.value=void 0,u.value=null;else if(g.value&&B<(((k=g.value)==null?void 0:k.cost)??0))h.value=(R=g.value)==null?void 0:R.coefficient,A=(B-g.value.cost)*100/g.value.cost,f.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(B>((($=l.value)==null?void 0:$.getRetailCost())??B)){h.value=s();const L=((P=l.value)==null?void 0:P.getRetailCost())??0;A=(B-L)*100/L,f.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const L=(V=(I=l.value)==null?void 0:I.priceCoefficients)==null?void 0:V.filter(D=>D.cost<B);if(L&&L.length>0){const D=L.at(-1);h.value=D==null?void 0:D.coefficient,A=(B-((D==null?void 0:D.cost)??0))*100/((D==null?void 0:D.cost)??1)}f.value={validationStatus:void 0,feedback:void 0}}u.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(A),r("update:value",{value:Number.isNaN(A)?void 0:A,coefficient:o(h.value)?void 0:structuredClone(i.toRaw(h.value))})}else r("update:value",{value:Number.isNaN(B)?void 0:B,coefficient:void 0})};return i.onMounted(()=>{var v,B,k,R;n.calculationType===G.CalculationTypeEnum.m2Cost?m.value=((B=(v=n.value)==null?void 0:v.value)==null?void 0:B.toString())??null:!((k=n.value)!=null&&k.coefficient)&&((R=n.value)!=null&&R.value)&&(h.value=s()),p()}),(v,B)=>{var $,P,I;const k=z.NInput,R=z.NInputGroup;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{"show-label":!i.unref(O.isNil)(t.label),label:t.label,"show-feedback":!i.unref(O.isNil)((($=f.value)==null?void 0:$.feedback)??t.feedback),feedback:((P=f.value)==null?void 0:P.feedback)??t.feedback,"validation-status":((I=f.value)==null?void 0:I.validationStatus)??t.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&t.calculationType!==i.unref(G.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(G.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(R,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(kd,{class:"w-full min-w-0 flex-1",value:h.value,"reference-list":d.value,clearable:t.clearable,disabled:t.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"onUpdate:value":y},null,8,["value","reference-list","clearable","disabled"]),i.createVNode(k,{value:u.value,"onUpdate:value":[B[0]||(B[0]=V=>u.value=V),b],clearable:t.clearable,disabled:t.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[B[3]||(B[3]=i.createTextVNode("%",-1))]),_:2},[u.value&&!u.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[B[2]||(B[2]=i.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):i.createCommentVNode("",!0),a.value||t.calculationType===i.unref(G.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(k,{key:1,value:m.value,"onUpdate:value":[B[1]||(B[1]=V=>m.value=V),_],clearable:t.clearable,disabled:t.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var V;return[i.createTextVNode(i.toDisplayString((V=l.value)==null?void 0:V.currency),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):i.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),Z0={key:0,class:"flex flex-row gap-2.5"},Q0={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},J0={},Cd=i.defineComponent({...J0,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.show),a=i.ref(r.processing),l=bt.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=bt.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=i.computed(()=>window.innerWidth*c.value),h=()=>{s("opening"),o.value=!0,s("update:show",o.value)},u=(g="other")=>{if(a.value){s("processing:cancel",b=>{a.value=b});return}let f=!1;s("closing",g,()=>{f=!0}),f||(o.value=!1,s("update:show",o.value))},m=()=>{s("accept",f=>{a.value=f})};return i.watch(()=>r.show,g=>{g?h():u("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:h,close:u}),(g,f)=>{const p=z.NButton,y=z.NModal;return i.openBlock(),i.createBlock(y,{loading:a.value,show:o.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:t.title,"action-class":g.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:f[1]||(f[1]=b=>u("header")),onEsc:f[2]||(f[2]=b=>u("esc")),onMaskClick:f[3]||(f[3]=b=>u("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(g.$slots,"default")]),_:2},[g.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(g.$slots,"header")]),key:"0"}:void 0,g.$slots.action||g.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:i.withCtx(()=>[g.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",Z0,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Q0,[i.renderSlot(g.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(p,{key:0,disabled:a.value||!t.valid,size:i.unref(l),type:"primary",onClick:m},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(p,{key:1,size:i.unref(l),type:"default",onClick:f[0]||(f[0]=b=>u("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","action-class"])}}}),ey={class:"text-sm"},ty={class:"text-sm"},ny={},iy=i.defineComponent({...ny,__name:"add-product-to-cart-dialog",emits:["submit"],setup(t,{expose:e,emit:n}){const r=i.ref(null),s=i.ref(void 0),o=i.ref(null),a=n,l=i.ref({length:{},quantity:{},marker:{}}),c=i.ref(!1),d=i.computed(()=>{var y,b,_,C,S,v,B,k,R;if(!r.value)return"";const f=((b=(y=r.value)==null?void 0:y.properties)==null?void 0:b.minLength)??((C=(_=r.value)==null?void 0:_.properties)!=null&&C.ignoreMinCountCheck?0:(v=(S=r.value)==null?void 0:S.properties)==null?void 0:v.minCount),p=(k=(B=r.value)==null?void 0:B.properties)==null?void 0:k.maxLength;return f||p?`(${f?`от ${f}`:""}${f&&p?" ":""}${p?`до ${p}`:""} ${(R=r.value)==null?void 0:R.unit})`:""}),h=f=>{!r.value||!o.value||(G.UnitsHelper.productIsMeasurable(r.value)||delete o.value.length,c.value=!0,a("submit",o.value,l.value,()=>{c.value=!1,f(!1)}))},u=()=>{r.value=null,s.value=void 0,o.value=null,l.value=g()},m=(f,p)=>{var y,b,_,C;r.value=f,s.value=p,o.value=new G.CartItemBase(p??new G.CartItemBase({product:f,quantity:((y=f==null?void 0:f.properties)==null?void 0:y.minCount)??1,length:((b=f==null?void 0:f.properties)==null?void 0:b.minLength)||((_=f==null?void 0:f.properties)!=null&&_.ignoreMinCountCheck?0:(C=f==null?void 0:f.properties)==null?void 0:C.minCount)||0}))},g=()=>({length:{},quantity:{},marker:{}});return e({show:m,closeDialog:u}),(f,p)=>(i.openBlock(),i.createBlock(Cd,{show:!i.unref(O.isNil)(r.value)&&!i.unref(O.isNil)(o.value),title:`${s.value?"Изменение":"Добавление"} товара в корзину`,"accept-button":{show:!0,text:s.value?"Изменить":"В корзину"},processing:c.value,onAccept:h,onClosing:u},{default:i.withCtx(()=>[r.value&&o.value?(i.openBlock(),i.createBlock(i.unref(z.NForm),{key:0,class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.unref(G.UnitsHelper).productIsMeasurable(r.value)?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:0,required:!0,feedback:l.value.length.feedback||"","show-feedback":l.value.length.showFeedback||i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value)!==.01||!1,"validation-status":l.value.length.validationStatus||void 0,label:"Метраж, "+r.value.unit+d.value+"м."},i.createSlots({default:i.withCtx(()=>{var y,b;return[i.createVNode(i.unref(z.NInputNumber),{value:o.value.length,"onUpdate:value":p[0]||(p[0]=_=>o.value.length=_),max:((y=r.value.properties)==null?void 0:y.maxLength)||void 0,min:((b=r.value.properties)==null?void 0:b.minLength)||i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value),step:i.unref(G.UnitsHelper).getProductMultiplicity(r.value),validator:_=>{const C=i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value);return Math.round(_/C)*C===_},placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]}),_:2},[!l.value.length.feedback&&i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value)!==.01?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",ey,"Метраж должен быть кратен "+i.toDisplayString(i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status","label"])):i.createCommentVNode("",!0),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:l.value.quantity.feedback||"","show-feedback":l.value.quantity.showFeedback||i.unref(G.UnitsHelper).getProductMultiplicity(r.value)!==1||!1,"validation-status":l.value.quantity.validationStatus||void 0,label:"Количество"},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:o.value.quantity,"onUpdate:value":p[1]||(p[1]=y=>o.value.quantity=y),min:i.unref(G.UnitsHelper).getProductMultiplicity(r.value),step:i.unref(G.UnitsHelper).getProductMultiplicity(r.value),validator:y=>y%i.unref(G.UnitsHelper).getProductMultiplicity(r.value)===0,placeholder:"Введите количество",class:"w-full"},null,8,["value","min","step","validator"])]),_:2},[!l.value.quantity.feedback&&i.unref(G.UnitsHelper).getProductMultiplicity(r.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",ty,"Количество должно быть кратно "+i.toDisplayString(i.unref(G.UnitsHelper).getProductMultiplicity(r.value)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{feedback:l.value.marker.feedback||"","show-feedback":l.value.marker.showFeedback||!1,"validation-status":l.value.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:o.value.marker,"onUpdate:value":p[2]||(p[2]=y=>o.value.marker=y),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"]))}}),ry={class:"flex flex-row gap-1"},sy={class:"sc-client-name flex flex-col gap-1 text-base"},oy=["href"],ay={key:1,class:"text-sc-grey"},ly={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},cy={key:0},dy={key:1,class:"text-sm"},hy={},os=i.defineComponent({...hy,__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(t,{emit:e}){const n=t,r=e,s=i.computed(()=>n.client.lastLoginAt?Mn.format(n.client.lastLoginAt,G.AppConfigProvider.getConfig().dateFormats.uiDateWithTime):""),o=a=>{O.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Fs,d=z.NButton,h=z.NPopover;return i.openBlock(),i.createElementBlock("div",ry,[t.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=u=>a.$emit("click:client-info",t.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(h,{disabled:i.unref(O.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",sy,[i.createElementVNode("a",{href:t.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=u=>o(u))},[i.createElementVNode("span",{class:i.normalizeClass({"line-through":!t.client.isActive})},i.toDisplayString(t.client.name),3),t.showSalesDirection&&t.client.salesDirection?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"line-through":!t.client.isActive})}," ("+i.toDisplayString(t.client.salesDirection.name)+") ",3)):i.createCommentVNode("",!0),t.client.isActive?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",ay," [ Деактивирован ] "))],8,oy),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",ly," г. "+i.toDisplayString(t.client.city.name)+", "+i.toDisplayString(t.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[t.client.alternativeName?(i.openBlock(),i.createElementBlock("div",cy,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("span",dy," Последний вход: "+i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),uy={class:"text-base"},fy={},Sd=i.defineComponent({...fy,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("span",uy,i.toDisplayString(t.contragent.name),1))}}),gy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function my(t,e){return i.openBlock(),i.createElementBlock("svg",gy,[...e[0]||(e[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 py=i.markRaw({name:"tabler-mail",render:my}),yy=["href"],by={},_y=i.defineComponent({...by,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=py;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,yy)],2)}}}),wy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function xy(t,e){return i.openBlock(),i.createElementBlock("svg",wy,[...e[0]||(e[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 Bd=i.markRaw({name:"fa6-brands-viber",render:xy}),vy={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},ky=["id"],Cy=["id"],Sy=["fill"],By=["fill"];function Ty(t,e){return i.openBlock(),i.createElementBlock("svg",vy,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:t.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,ky),i.createElementVNode("linearGradient",{id:t.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,Cy)]),i.createElementVNode("path",{fill:"url(#"+t.idMap.SVGBRLHCcSy+")",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,Sy),i.createElementVNode("path",{fill:"url(#"+t.idMap.SVGHW6lecxh+")",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,By),e[2]||(e[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 Td=i.markRaw({name:"logos-whatsapp-icon",render:Ty,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),Ry={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},$y=["id"],Ey=["fill"];function Ny(t,e){return i.openBlock(),i.createElementBlock("svg",Ry,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:t.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,$y)]),i.createElementVNode("path",{fill:"url(#"+t.idMap.SVGuySfwdaH+")",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,Ey),e[1]||(e[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 Rd=i.markRaw({name:"logos-telegram",render:Ny,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),Py={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Fy(t,e){return i.openBlock(),i.createElementBlock("svg",Py,[...e[0]||(e[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 $d=i.markRaw({name:"ion-call",render:Fy}),My={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ay(t,e){return i.openBlock(),i.createElementBlock("svg",My,[...e[0]||(e[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 Vy=i.markRaw({name:"tabler-phone-call",render:Ay}),Oy={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},Iy=["href"],zy=["href"],Ly=["href"],Dy=["href"],Hy={},Wy=i.defineComponent({...Hy,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?Ji.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return O.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),s=i.computed(()=>{var l;return O.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var l;return O.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=Vy,h=$d,u=Rd,m=Td,g=Bd;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]=f=>a.value=!a.value),onFocusout:c[1]||(c[1]=f=>a.value=!1),onMouseleave:c[2]||(c[2]=f=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showPhoneIcon})},[t.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",Oy,[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,Iy)):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,zy)):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(m)],8,Ly)):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(g)],8,Dy)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),jy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function qy(t,e){return i.openBlock(),i.createElementBlock("svg",jy,[...e[0]||(e[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 Xy=i.markRaw({name:"mdi-envelope",render:qy}),Yy={class:"flex flex-col gap-1"},Uy={key:0,class:"mb-2 flex flex-col text-base"},Gy={key:0,class:"text-sc-dark-grey text-sm"},Ky={key:1,class:"whitespace-nowrap text-sm"},Zy={key:2,class:"whitespace-nowrap text-sm"},Qy={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},Jy=["href"],eb=["href"],tb=["href"],nb=["href"],ib=["href"],rb={key:0,class:"flex flex-col text-base"},sb={key:0,class:"text-sc-dark-grey text-sm"},ob={key:1,class:"mt-2 text-sm"},ab={key:0,class:"-mt-1"},lb={},cb=i.defineComponent({...lb,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(t){const e=t,n=i.computed(()=>{try{return e.contact.phone?Ji.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),r=i.computed(()=>{var c;return O.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),s=i.computed(()=>{var c;return O.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var c;return O.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("E.164"))??""}),a=i.computed(()=>r.value||e.contact.email),l=i.ref(!1);return(c,d)=>{var y,b;const h=$d,u=Rd,m=Td,g=Bd,f=Xy,p=z.NPopover;return i.openBlock(),i.createElementBlock("div",Yy,[i.createVNode(p,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var _,C,S,v;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(_=t.contact)!=null&&_.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.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,[t.fullView&&(t.contact.name||(C=t.contact)!=null&&C.position)?(i.openBlock(),i.createElementBlock("div",Uy,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(S=t.contact)!=null&&S.position?(i.openBlock(),i.createElementBlock("span",Gy,i.toDisplayString((v=t.contact)==null?void 0:v.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",Ky,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",Zy,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",Qy,[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,Jy)):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,eb)):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(m)],8,tb)):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(g)],8,nb)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(f)],8,ib)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var _,C,S,v;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",rb,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(_=t.contact)!=null&&_.position?(i.openBlock(),i.createElementBlock("span",sb,i.toDisplayString((C=t.contact)==null?void 0:C.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(S=t.contact)!=null&&S.comment?(i.openBlock(),i.createElementBlock("div",ob,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((v=t.contact)==null?void 0:v.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),t.fullView&&((y=t.contact)!=null&&y.comment)?(i.openBlock(),i.createElementBlock("div",ab,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((b=t.contact)==null?void 0:b.comment),1)])):i.createCommentVNode("",!0)])}}}),db={class:"flex flex-wrap gap-2"},hb={class:"flex flex-col"},ub={class:"flex flex-col"},fb={},gb=i.defineComponent({...fb,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>G.AppConfigProvider.getConfig().dateFormats.uiDate},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1}},emits:["update:date-range"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>{if(n.predefinedDateRanges)return n.predefinedDateRanges;if(n.useDefaultPredefinedDateRanges){const a={};return O.forOwn(G.DateTimeProvider.defaultDateRanges(),(l,c)=>{a[c]={label:l.label,from:l.from??void 0,to:l.to??void 0}}),a}}),o=(a,l)=>{r("update:date-range",{from:a?Mn.startOfDay(new Date(a)):void 0,to:l?Mn.endOfDay(new Date(l)):void 0})};return(a,l)=>{var h,u,m,g,f,p;const c=z.NButton,d=z.NDatePicker;return i.openBlock(),i.createElementBlock("div",db,[i.createVNode(d,{value:((u=(h=t.dateRange)==null?void 0:h.from)==null?void 0:u.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.to)&&y>((_=t.dateRange)==null?void 0:_.to)},disabled:(m=t.disabled)==null?void 0:m.from,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[0]||(l[0]=y=>{var b,_;return o(y,(_=(b=t.dateRange)==null?void 0:b.to)==null?void 0:_.getTime())})},i.createSlots({_:2},[s.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",hb,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var C,S;return o((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(S=y==null?void 0:y.to)==null?void 0:S.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((f=(g=t.dateRange)==null?void 0:g.to)==null?void 0:f.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.from)&&y<((_=t.dateRange)==null?void 0:_.from)},disabled:(p=t.disabled)==null?void 0:p.to,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[1]||(l[1]=y=>{var b,_;return o((_=(b=t.dateRange)==null?void 0:b.from)==null?void 0:_.getTime(),y)})},i.createSlots({_:2},[s.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",ub,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var C,S;return o((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(S=y==null?void 0:y.to)==null?void 0:S.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),mb={class:"sc-lbl-date text-nowrap"},pb={},Po=i.defineComponent({...pb,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean}},setup(t){const e=t,n=i.computed(()=>Mn.format(e.date,G.AppConfigProvider.getConfig().dateFormats.uiDate)),r=i.computed(()=>Mn.format(e.date,"HH:mm"));return(s,o)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",mb,i.toDisplayString(n.value),1),i.createElementVNode("span",{class:i.normalizeClass([{"text-sc-grey":t.isTimeSecondary,"ml-1":!t.isTimeOnSecondLine},"sc-lbl-time"])},i.toDisplayString(r.value),3)],2))}}),yb={class:"flex flex-row gap-2.5"},bb={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},_b={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},wb={class:"mb-0.5 sm:mb-0 sm:ml-3"},xb={},vb=i.defineComponent({...xb,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=ss,s=z.NButton,o=z.NPopover;return i.openBlock(),i.createElementBlock("div",yb,[i.createElementVNode("div",bb,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",_b,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",wb,[t.showCloseButton?(i.openBlock(),i.createBlock(o,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(s,{size:"small",type:"error",onClick:n[0]||(n[0]=a=>e.$emit("close"))},{default:i.withCtx(()=>[i.createVNode(r)]),_:1})]),default:i.withCtx(()=>[n[1]||(n[1]=i.createTextVNode(" Закрыть ",-1))]),_:1})):i.createCommentVNode("",!0)])])])])}}}),kb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Cb(t,e){return i.openBlock(),i.createElementBlock("svg",kb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const Sb=i.markRaw({name:"ion-download-outline",render:Cb}),Bb={},Tb=i.defineComponent({...Bb,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(t,{emit:e}){const n=t,r=e,s=i.ref([]),o=i.computed(()=>s.value.map(l=>(l.status=n.isError?"error":"finished",l))),a=l=>{s.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const h=new FileReader;h.addEventListener("load",()=>{c.content=h.result??"",r("update:file",c)}),h.readAsDataURL(d.file)};return(l,c)=>{const d=Sb;return i.openBlock(),i.createBlock(i.unref(z.NUpload),{"file-list":o.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:t.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NUploadDragger),null,{default:i.withCtx(()=>[i.renderSlot(l.$slots,"dragged-area",{},()=>[i.createElementVNode("div",null,[i.createVNode(d,{class:"text-2xl"}),i.createElementVNode("div",null,i.toDisplayString(t.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),Rb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $b(t,e){return i.openBlock(),i.createElementBlock("svg",Rb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const Eb=i.markRaw({name:"ion-checkmark-done-sharp",render:$b}),Nb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Pb(t,e){return i.openBlock(),i.createElementBlock("svg",Nb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const Fb=i.markRaw({name:"ion-options-outline",render:Pb}),Mb={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},Ab={class:"flex-auto"},Vb={class:"sticky top-0 flex flex-none flex-col justify-start gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},Ob={class:"flex flex-none flex-col-reverse justify-end gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},Ib={},Fo=i.defineComponent({...Ib,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(t,{emit:e}){const n=e,r=i.ref(!1),s=()=>{n("edit")},o=()=>{r.value=!1},a=()=>{r.value=!0,n("apply",o)},l=()=>{n("cancel",o)};return(c,d)=>{const h=Fb,u=z.NButton,m=z.NPopover,g=Eb,f=ss;return i.openBlock(),i.createElementBlock("div",Mb,[i.createElementVNode("div",Ab,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",Vb,[i.createElementVNode("div",Ob,[t.showEditButton?(i.openBlock(),i.createBlock(m,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:t.disabled||r.value,type:"info",ghost:"",size:"small",onClick:s},{default:i.withCtx(()=>[i.createVNode(h)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),t.showApplyButton?(i.openBlock(),i.createBlock(m,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:t.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),t.showCancelButton?(i.openBlock(),i.createBlock(m,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:t.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),zb={},Ed=i.defineComponent({...zb,__name:"inline-editable-item",props:{disabled:{type:Boolean,default:!1},showEditor:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!0}},emits:["editor:apply","editor:cancel"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.showEditor),o=l=>{r("editor:apply",d=>{s.value=!d,l()})},a=l=>{s.value=!1,l(),r("editor:cancel")};return i.onMounted(()=>{i.watch(()=>n.showEditor,l=>{s.value=l})}),(l,c)=>(i.openBlock(),i.createElementBlock("div",null,[s.value?(i.openBlock(),i.createBlock(Fo,{key:1,disabled:t.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:o,onCancel:a},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-editor-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(i.openBlock(),i.createBlock(Fo,{key:0,disabled:t.disabled,"show-edit-button":t.showEditButton,onEdit:c[0]||(c[0]=d=>s.value=!0)},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-viewer-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),Lb={},Db=i.defineComponent({...Lb,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.value),o=i.computed(()=>i.inject("debounce-input-time",n.debounceTime)),a=O.debounce(()=>r("update:value",s.value),o.value),l=c=>{s.value=c,a()};return i.watch(()=>n.value,c=>{s.value=c}),(c,d)=>(i.openBlock(),i.createBlock(i.unref(z.NInput),{value:s.value,"onUpdate:value":[d[0]||(d[0]=h=>s.value=h),l],clearable:t.clearable,placeholder:t.placeholder},{prefix:i.withCtx(()=>[i.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),Hb={},Wb=i.defineComponent({...Hb,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,s=i.ref((n.value??"").replaceAll(/\D*/g,"")),o=O.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(O.isString(c))s.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(O.isObject(c)){if(s.value=c.formatted,!c.valid)return;d=c instanceof Ji.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}n.debounceTime?o(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const h=Ji.parsePhoneNumberWithError(`+${d}`);h.isValid()?s.value=h.format("E.164"):h.getPossibleCountries().length>0&&(s.value=`+${d}`)}catch(h){if(h instanceof Ji.ParseError)s.value=d;else throw h}};return i.watch(()=>n.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=s.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),i.onBeforeMount(()=>l(s.value??"")),(c,d)=>(i.openBlock(),i.createBlock(i.unref(Au.VueTelInput),{modelValue:s.value,"onUpdate:modelValue":[d[0]||(d[0]=h=>s.value=h),a],"auto-default-country":!1,"auto-format":!0,"default-country":t.defaultCountry,disabled:t.disabled,"input-options":{placeholder:t.placeholder},"preferred-countries":t.preferredCountries,"only-countries":t.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),jb=Zn(Wb,[["__scopeId","data-v-751dbb0e"]]),qb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xb(t,e){return i.openBlock(),i.createElementBlock("svg",qb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const Yb=i.markRaw({name:"tabler-external-link",render:Xb}),Ub={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},Gb=["href"],Kb={},Zb=i.defineComponent({...Kb,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=Yb,s=z.NTooltip;return i.openBlock(),i.createBlock(s,{disabled:i.unref(O.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",Ub,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,Gb),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),Qb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Jb(t,e){return i.openBlock(),i.createElementBlock("svg",Qb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const e_=i.markRaw({name:"ion-remove-circle-outline",render:Jb});let as=[];const Nd=new WeakMap;function t_(){as.forEach(t=>t(...Nd.get(t))),as=[]}function Pd(t,...e){Nd.set(t,e),!as.includes(t)&&as.push(t)===1&&requestAnimationFrame(t_)}function cr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function dr(t){return t.composedPath()[0]||null}function hr(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function ur(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function Yt(t,e){const n=t.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+t+" is not a valid value.")}return e===void 0?r:r[e]}const Fd={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32",transparent:"#0000"};function n_(t,e,n){e/=100,n/=100;let r=(s,o=(s+t/60)%6)=>n-n*e*Math.max(Math.min(o,4-o,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function i_(t,e,n){e/=100,n/=100;let r=e*Math.min(n,1-n),s=(o,a=(o+t/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[s(0)*255,s(8)*255,s(4)*255]}const dn="^\\s*",hn="\\s*$",Ln="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Mt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",si="([0-9A-Fa-f])",oi="([0-9A-Fa-f]{2})",Md=new RegExp(`${dn}hsl\\s*\\(${Mt},${Ln},${Ln}\\)${hn}`),Ad=new RegExp(`${dn}hsv\\s*\\(${Mt},${Ln},${Ln}\\)${hn}`),Vd=new RegExp(`${dn}hsla\\s*\\(${Mt},${Ln},${Ln},${Mt}\\)${hn}`),Od=new RegExp(`${dn}hsva\\s*\\(${Mt},${Ln},${Ln},${Mt}\\)${hn}`),r_=new RegExp(`${dn}rgb\\s*\\(${Mt},${Mt},${Mt}\\)${hn}`),s_=new RegExp(`${dn}rgba\\s*\\(${Mt},${Mt},${Mt},${Mt}\\)${hn}`),o_=new RegExp(`${dn}#${si}${si}${si}${hn}`),a_=new RegExp(`${dn}#${oi}${oi}${oi}${hn}`),l_=new RegExp(`${dn}#${si}${si}${si}${si}${hn}`),c_=new RegExp(`${dn}#${oi}${oi}${oi}${oi}${hn}`);function $t(t){return parseInt(t,16)}function d_(t){try{let e;if(e=Vd.exec(t))return[cs(e[1]),Dn(e[5]),Dn(e[9]),li(e[13])];if(e=Md.exec(t))return[cs(e[1]),Dn(e[5]),Dn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function h_(t){try{let e;if(e=Od.exec(t))return[cs(e[1]),Dn(e[5]),Dn(e[9]),li(e[13])];if(e=Ad.exec(t))return[cs(e[1]),Dn(e[5]),Dn(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function ai(t){try{let e;if(e=a_.exec(t))return[$t(e[1]),$t(e[2]),$t(e[3]),1];if(e=r_.exec(t))return[dt(e[1]),dt(e[5]),dt(e[9]),1];if(e=s_.exec(t))return[dt(e[1]),dt(e[5]),dt(e[9]),li(e[13])];if(e=o_.exec(t))return[$t(e[1]+e[1]),$t(e[2]+e[2]),$t(e[3]+e[3]),1];if(e=c_.exec(t))return[$t(e[1]),$t(e[2]),$t(e[3]),li($t(e[4])/255)];if(e=l_.exec(t))return[$t(e[1]+e[1]),$t(e[2]+e[2]),$t(e[3]+e[3]),li($t(e[4]+e[4])/255)];if(t in Fd)return ai(Fd[t]);if(Md.test(t)||Vd.test(t)){const[n,r,s,o]=d_(t);return[...i_(n,r,s),o]}else if(Ad.test(t)||Od.test(t)){const[n,r,s,o]=h_(t);return[...n_(n,r,s),o]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function u_(t){return t>1?1:t<0?0:t}function Mo(t,e,n,r){return`rgba(${dt(t)}, ${dt(e)}, ${dt(n)}, ${u_(r)})`}function Ao(t,e,n,r,s){return dt((t*e*(1-r)+n*r)/s)}function f_(t,e){Array.isArray(t)||(t=ai(t)),Array.isArray(e)||(e=ai(e));const n=t[3],r=e[3],s=li(n+r-n*r);return Mo(Ao(t[0],n,e[0],r,s),Ao(t[1],n,e[1],r,s),Ao(t[2],n,e[2],r,s),s)}function Fe(t,e){const[n,r,s,o=1]=Array.isArray(t)?t:ai(t);return typeof e.alpha=="number"?Mo(n,r,s,e.alpha):Mo(n,r,s,o)}function ls(t,e){const[n,r,s,o=1]=Array.isArray(t)?t:ai(t),{lightness:a=1,alpha:l=1}=e;return g_([n*a,r*a,s*a,o*l])}function li(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function cs(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function dt(t){const e=Math.round(Number(t));return e>255?255:e<0?0:e}function Dn(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function g_(t){const[e,n,r]=t;return 3 in t?`rgba(${dt(e)}, ${dt(n)}, ${dt(r)}, ${li(t[3])})`:`rgba(${dt(e)}, ${dt(n)}, ${dt(r)}, 1)`}function m_(t=8){return Math.random().toString(16).slice(2,2+t)}function Id(t){return Array.isArray(t)?t:[t]}const Vo={STOP:"STOP"};function zd(t,e){const n=e(t);t.children!==void 0&&n!==Vo.STOP&&t.children.forEach(r=>zd(r,e))}function p_(t,e={}){const{preserveGroup:n=!1}=e,r=[],s=n?a=>{a.isLeaf||(r.push(a.key),o(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),o(a.children))};function o(a){a.forEach(s)}return o(t),r}function y_(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function b_(t){return t.children}function __(t){return t.key}function w_(){return!1}function x_(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function v_(t){return t.disabled===!0}function k_(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function C_(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function Oo(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Io(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function S_(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function B_(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function T_(t){return(t==null?void 0:t.type)==="group"}function R_(t){const e=new Map;return t.forEach((n,r)=>{e.set(n.key,r)}),n=>{var r;return(r=e.get(n))!==null&&r!==void 0?r:null}}class $_ extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function E_(t,e,n,r){return ds(e.concat(t),n,r,!1)}function N_(t,e){const n=new Set;return t.forEach(r=>{const s=e.treeNodeMap.get(r);if(s!==void 0){let o=s.parent;for(;o!==null&&!(o.disabled||n.has(o.key));)n.add(o.key),o=o.parent}}),n}function P_(t,e,n,r){const s=ds(e,n,r,!1),o=ds(t,n,r,!0),a=N_(t,n),l=[];return s.forEach(c=>{(o.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>s.delete(c)),s}function zo(t,e){const{checkedKeys:n,keysToCheck:r,keysToUncheck:s,indeterminateKeys:o,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=t;if(!a)return r!==void 0?{checkedKeys:S_(n,r),indeterminateKeys:Array.from(o)}:s!==void 0?{checkedKeys:B_(n,s),indeterminateKeys:Array.from(o)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(o)};const{levelTreeNodeMap:h}=e;let u;s!==void 0?u=P_(s,n,e,d):r!==void 0?u=E_(r,n,e,d):u=ds(n,e,d,!1);const m=c==="parent",g=c==="child"||l,f=u,p=new Set,y=Math.max.apply(null,Array.from(h.keys()));for(let b=y;b>=0;b-=1){const _=b===0,C=h.get(b);for(const S of C){if(S.isLeaf)continue;const{key:v,shallowLoaded:B}=S;if(g&&B&&S.children.forEach(P=>{!P.disabled&&!P.isLeaf&&P.shallowLoaded&&f.has(P.key)&&f.delete(P.key)}),S.disabled||!B)continue;let k=!0,R=!1,$=!0;for(const P of S.children){const I=P.key;if(!P.disabled){if($&&($=!1),f.has(I))R=!0;else if(p.has(I)){R=!0,k=!1;break}else if(k=!1,R)break}}k&&!$?(m&&S.children.forEach(P=>{!P.disabled&&f.has(P.key)&&f.delete(P.key)}),f.add(v)):R&&p.add(v),_&&g&&f.has(v)&&f.delete(v)}}return{checkedKeys:Array.from(f),indeterminateKeys:Array.from(p)}}function ds(t,e,n,r){const{treeNodeMap:s,getChildren:o}=e,a=new Set,l=new Set(t);return t.forEach(c=>{const d=s.get(c);d!==void 0&&zd(d,h=>{if(h.disabled)return Vo.STOP;const{key:u}=h;if(!a.has(u)&&(a.add(u),l.add(u),k_(h.rawNode,o))){if(r)return Vo.STOP;if(!n)throw new $_}})}),l}function F_(t,{includeGroup:e=!1,includeSelf:n=!0},r){var s;const o=r.treeNodeMap;let a=t==null?null:(s=o.get(t))!==null&&s!==void 0?s:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(e||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),n||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function M_(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function A_(t,e){const n=t.siblings,r=n.length,{index:s}=t;return e?n[(s+1)%r]:s===n.length-1?null:n[s+1]}function Ld(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const s=e==="prev"?V_:A_,o={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===t){if(!a)a=!0;else if(!t.disabled&&!t.isGroup){l=t;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const h=Lo(d,o);h!==null?l=h:c(s(d,n))}else{const h=s(d,!1);if(h!==null)c(h);else{const u=O_(d);u!=null&&u.isGroup?c(s(u,n)):n&&c(s(d,!0))}}}}return c(t),l}function V_(t,e){const n=t.siblings,r=n.length,{index:s}=t;return e?n[(s-1+r)%r]:s===0?null:n[s-1]}function O_(t){return t.parent}function Lo(t,e={}){const{reverse:n=!1}=e,{children:r}=t;if(r){const{length:s}=r,o=n?s-1:0,a=n?-1:s,l=n?-1:1;for(let c=o;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const h=Lo(d,e);if(h!==null)return h}else return d}}return null}const I_={getChild(){return this.ignored?null:Lo(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return Ld(this,"next",t)},getPrev(t={}){return Ld(this,"prev",t)}};function z_(t,e){const n=e?new Set(e):void 0,r=[];function s(o){o.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||n===void 0||n.has(a.key))&&s(a.children)})}return s(t),r}function L_(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var D_={};function Dd(t,e,n,r,s,o=null,a=0){const l=[];return t.forEach((c,d)=>{var h;D_.NODE_ENV!=="production"&&C_(c,s)&&console.error("[treemate]: node",c,"is invalid");const u=Object.create(r);if(u.rawNode=c,u.siblings=l,u.level=a,u.index=d,u.isFirstChild=d===0,u.isLastChild=d+1===t.length,u.parent=o,!u.ignored){const m=s(c);Array.isArray(m)&&(u.children=Dd(m,e,n,r,s,u,a+1))}l.push(u),e.set(u.key,u),n.has(a)||n.set(a,[]),(h=n.get(a))===null||h===void 0||h.push(u)}),l}function H_(t,e={}){var n;const r=new Map,s=new Map,{getDisabled:o=v_,getIgnored:a=w_,getIsGroup:l=T_,getKey:c=__}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:b_,h=e.ignoreEmptyChildren?S=>{const v=d(S);return Array.isArray(v)?v.length?v:null:v}:d,u=Object.assign({get key(){return c(this.rawNode)},get disabled(){return o(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return y_(this.rawNode,h)},get shallowLoaded(){return x_(this.rawNode,h)},get ignored(){return a(this.rawNode)},contains(S){return L_(this,S)}},I_),m=Dd(t,r,s,u,h);function g(S){if(S==null)return null;const v=r.get(S);return v&&!v.isGroup&&!v.ignored?v:null}function f(S){if(S==null)return null;const v=r.get(S);return v&&!v.ignored?v:null}function p(S,v){const B=f(S);return B?B.getPrev(v):null}function y(S,v){const B=f(S);return B?B.getNext(v):null}function b(S){const v=f(S);return v?v.getParent():null}function _(S){const v=f(S);return v?v.getChild():null}const C={treeNodes:m,treeNodeMap:r,levelTreeNodeMap:s,maxLevel:Math.max(...s.keys()),getChildren:h,getFlattenedNodes(S){return z_(m,S)},getNode:g,getPrev:p,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return M_(m)},getPath(S,v={}){return F_(S,v,C)},getCheckedKeys(S,v={}){const{cascade:B=!0,leafOnly:k=!1,checkStrategy:R="all",allowNotLoaded:$=!1}=v;return zo({checkedKeys:Oo(S),indeterminateKeys:Io(S),cascade:B,leafOnly:k,checkStrategy:R,allowNotLoaded:$},C)},check(S,v,B={}){const{cascade:k=!0,leafOnly:R=!1,checkStrategy:$="all",allowNotLoaded:P=!1}=B;return zo({checkedKeys:Oo(v),indeterminateKeys:Io(v),keysToCheck:S==null?[]:Id(S),cascade:k,leafOnly:R,checkStrategy:$,allowNotLoaded:P},C)},uncheck(S,v,B={}){const{cascade:k=!0,leafOnly:R=!1,checkStrategy:$="all",allowNotLoaded:P=!1}=B;return zo({checkedKeys:Oo(v),indeterminateKeys:Io(v),keysToUncheck:S==null?[]:Id(S),cascade:k,leafOnly:R,checkStrategy:$,allowNotLoaded:P},C)},getNonLeafKeys(S={}){return p_(m,S)}};return C}function hs(t){return t.composedPath()[0]}const W_={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function j_(t,e,n){if(t==="mousemoveoutside"){const r=s=>{e.contains(hs(s))||n(s)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const s=a=>{r=!e.contains(hs(a))},o=a=>{r&&(e.contains(hs(a))||n(a))};return{mousedown:s,mouseup:o,touchstart:s,touchend:o}}return console.error(`[evtd/create-trap-handler]: name \`${t}\` is invalid. This could be a bug of evtd.`),{}}function Hd(t,e,n){const r=W_[t];let s=r.get(e);s===void 0&&r.set(e,s=new WeakMap);let o=s.get(n);return o===void 0&&s.set(n,o=j_(t,e,n)),o}function q_(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const s=Hd(t,e,n);return Object.keys(s).forEach(o=>{kt(o,document,s[o],r)}),!0}return!1}function X_(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const s=Hd(t,e,n);return Object.keys(s).forEach(o=>{et(o,document,s[o],r)}),!0}return!1}function Y_(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const t=new WeakMap,e=new WeakMap;function n(){t.set(this,!0)}function r(){t.set(this,!0),e.set(this,!0)}function s(k,R,$){const P=k[R];return k[R]=function(){return $.apply(k,arguments),P.apply(k,arguments)},k}function o(k,R){k[R]=Event.prototype[R]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,R){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:R??l.get})}const h={bubble:{},capture:{}},u={};function m(){const k=function(R){const{type:$,eventPhase:P,bubbles:I}=R,V=hs(R);if(P===2)return;const A=P===1?"capture":"bubble";let L=V;const D=[];for(;L===null&&(L=window),D.push(L),L!==window;)L=L.parentNode||null;const ee=h.capture[$],E=h.bubble[$];if(s(R,"stopPropagation",n),s(R,"stopImmediatePropagation",r),d(R,c),A==="capture"){if(ee===void 0)return;for(let N=D.length-1;N>=0&&!t.has(R);--N){const H=D[N],q=ee.get(H);if(q!==void 0){a.set(R,H);for(const Y of q){if(e.has(R))break;Y(R)}}if(N===0&&!I&&E!==void 0){const Y=E.get(H);if(Y!==void 0)for(const F of Y){if(e.has(R))break;F(R)}}}}else if(A==="bubble"){if(E===void 0)return;for(let N=0;N<D.length&&!t.has(R);++N){const H=D[N],q=E.get(H);if(q!==void 0){a.set(R,H);for(const Y of q){if(e.has(R))break;Y(R)}}}}o(R,"stopPropagation"),o(R,"stopImmediatePropagation"),d(R)};return k.displayName="evtdUnifiedHandler",k}function g(){const k=function(R){const{type:$,eventPhase:P}=R;if(P!==2)return;const I=u[$];I!==void 0&&I.forEach(V=>V(R))};return k.displayName="evtdUnifiedWindowEventHandler",k}const f=m(),p=g();function y(k,R){const $=h[k];return $[R]===void 0&&($[R]=new Map,window.addEventListener(R,f,k==="capture")),$[R]}function b(k){return u[k]===void 0&&(u[k]=new Set,window.addEventListener(k,p)),u[k]}function _(k,R){let $=k.get(R);return $===void 0&&k.set(R,$=new Set),$}function C(k,R,$,P){const I=h[R][$];if(I!==void 0){const V=I.get(k);if(V!==void 0&&V.has(P))return!0}return!1}function S(k,R){const $=u[k];return!!($!==void 0&&$.has(R))}function v(k,R,$,P){let I;if(typeof P=="object"&&P.once===!0?I=ee=>{B(k,R,I,P),$(ee)}:I=$,q_(k,R,I,P))return;const A=P===!0||typeof P=="object"&&P.capture===!0?"capture":"bubble",L=y(A,k),D=_(L,R);if(D.has(I)||D.add(I),R===window){const ee=b(k);ee.has(I)||ee.add(I)}}function B(k,R,$,P){if(X_(k,R,$,P))return;const V=P===!0||typeof P=="object"&&P.capture===!0,A=V?"capture":"bubble",L=y(A,k),D=_(L,R);if(R===window&&!C(R,V?"bubble":"capture",k,$)&&S(k,$)){const E=u[k];E.delete($),E.size===0&&(window.removeEventListener(k,p),u[k]=void 0)}D.has($)&&D.delete($),D.size===0&&L.delete(R),L.size===0&&(window.removeEventListener(k,f,A==="capture"),h[A][k]=void 0)}return{on:v,off:B}}const{on:kt,off:et}=Y_(),Hi="@@mmoContext",U_={mounted(t,{value:e}){t[Hi]={handler:void 0},typeof e=="function"&&(t[Hi].handler=e,kt("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Hi];typeof e=="function"?n.handler?n.handler!==e&&(et("mousemoveoutside",t,n.handler),n.handler=e,kt("mousemoveoutside",t,e)):(t[Hi].handler=e,kt("mousemoveoutside",t,e)):n.handler&&(et("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Hi];e&&et("mousemoveoutside",t,e),t[Hi].handler=void 0}},Wi="@@coContext",us={mounted(t,{value:e,modifiers:n}){t[Wi]={handler:void 0},typeof e=="function"&&(t[Wi].handler=e,kt("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Wi];typeof e=="function"?r.handler?r.handler!==e&&(et("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,kt("clickoutside",t,e,{capture:n.capture})):(t[Wi].handler=e,kt("clickoutside",t,e,{capture:n.capture})):r.handler&&(et("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[Wi];n&&et("clickoutside",t,n,{capture:e.capture}),t[Wi].handler=void 0}};function G_(t,e){console.error(`[vdirs/${t}]: ${e}`)}class K_{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,n){const{elementZIndex:r}=this;if(n!==void 0){e.style.zIndex=`${n}`,r.delete(e);return}const{nextZIndex:s}=this;r.has(e)&&r.get(e)+1===this.nextZIndex||(e.style.zIndex=`${s}`,r.set(e,s),this.nextZIndex=s+1,this.squashState())}unregister(e,n){const{elementZIndex:r}=this;r.has(e)?r.delete(e):n===void 0&&G_("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:e}=this;e||(this.nextZIndex=2e3),this.nextZIndex-e>2500&&this.rearrange()}rearrange(){const e=Array.from(this.elementZIndex.entries());e.sort((n,r)=>n[1]-r[1]),this.nextZIndex=2e3,e.forEach(n=>{const r=n[0],s=this.nextZIndex++;`${s}`!==r.style.zIndex&&(r.style.zIndex=`${s}`)})}}const Do=new K_,ji="@@ziContext",Wd={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:s}=n;t[ji]={enabled:!!s,initialized:!1},s&&(Do.ensureZIndex(t,r),t[ji].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:s}=n,o=t[ji].enabled;s&&!o&&(Do.ensureZIndex(t,r),t[ji].initialized=!0),t[ji].enabled=!!s},unmounted(t,e){if(!t[ji].initialized)return;const{value:n={}}=e,{zIndex:r}=n;Do.unregister(t,r)}};function Z_(t){const e=i.ref(!!t.value);if(e.value)return i.readonly(e);const n=i.watch(t,r=>{r&&(e.value=!0,n())});return i.readonly(e)}function Wt(t){const e=i.computed(t),n=i.ref(e.value);return i.watch(e,r=>{n.value=r}),typeof t=="function"?n:{__v_isRef:!0,get value(){return n.value},set value(r){t.set(r)}}}const Q_=typeof window<"u";let qi,fr;(()=>{var t,e;qi=Q_?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,fr=!1,qi!==void 0?qi.then(()=>{fr=!0}):fr=!0})();function J_(t){if(fr)return;let e=!1;i.onMounted(()=>{fr||qi==null||qi.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function Ho(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function fs(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function jd(t,e){return i.computed(()=>{for(const n of e)if(t[n]!==void 0)return t[n];return t[e[e.length-1]]})}const e1=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function t1(){return e1}function Wo(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function jo(t,e=!0,n=[]){return t.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&n.push(i.createTextVNode(String(r)));return}if(Array.isArray(r)){jo(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&jo(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function qd(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const s=jo(r());if(s.length===1)return s[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let Hn=null;function Xd(){if(Hn===null&&(Hn=document.getElementById("v-binder-view-measurer"),Hn===null)){Hn=document.createElement("div"),Hn.id="v-binder-view-measurer";const{style:t}=Hn;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(Hn)}return Hn.getBoundingClientRect()}function n1(t,e){const n=Xd();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function qo(t){const e=t.getBoundingClientRect(),n=Xd();return{left:e.left-n.left,top:e.top-n.top,bottom:n.height+n.top-e.bottom,right:n.width+n.left-e.right,width:e.width,height:e.height}}function i1(t){return t.nodeType===9?null:t.parentNode}function Yd(t){if(t===null)return null;const e=i1(t);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:n,overflowX:r,overflowY:s}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(n+s+r))return e}return Yd(e)}const Ud=i.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(t){var e;i.provide("VBinder",(e=i.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const n=i.inject("VBinder",null),r=i.ref(null),s=b=>{r.value=b,n&&t.syncTargetWithParent&&n.setTargetRef(b)};let o=[];const a=()=>{let b=r.value;for(;b=Yd(b),b!==null;)o.push(b);for(const _ of o)kt("scroll",_,u,!0)},l=()=>{for(const b of o)et("scroll",b,u,!0);o=[]},c=new Set,d=b=>{c.size===0&&a(),c.has(b)||c.add(b)},h=b=>{c.has(b)&&c.delete(b),c.size===0&&l()},u=()=>{Pd(m)},m=()=>{c.forEach(b=>b())},g=new Set,f=b=>{g.size===0&&kt("resize",window,y),g.has(b)||g.add(b)},p=b=>{g.has(b)&&g.delete(b),g.size===0&&et("resize",window,y)},y=()=>{g.forEach(b=>b())};return i.onBeforeUnmount(()=>{et("resize",window,y),l()}),{targetRef:r,setTargetRef:s,addScrollListener:d,removeScrollListener:h,addResizeListener:f,removeResizeListener:p}},render(){return Wo("binder",this.$slots)}}),Gd=i.defineComponent({name:"Target",setup(){const{setTargetRef:t,syncTarget:e}=i.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:t,updated:t}}},render(){const{syncTarget:t,setTargetDirective:e}=this;return t?i.withDirectives(qd("follower",this.$slots),[[e]]):qd("follower",this.$slots)}}),r1="@css-render/vue3-ssr";function s1(t,e){return`<style cssr-id="${t}">
|
|
103
|
+
`}},Ur=Fi.Multiply,Mm=[1,0,0,0,1,0,0,0,1],zn=new nn(9),Am=ct.Utils,pc=new Q,fo=new nn([0,0,1,0,0,1,0,1,1,0,1,1]),be={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:He.document?He.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Fi,group:{removeChild:function(t,e){if(t.children)for(let n=0;n<t.children.length;n++)be.group.removeChild(t.children[n],e);t._renderer.texture&&(e.deleteTexture(t._renderer.texture),delete t._renderer.texture),t._renderer.positionBuffer&&(e.deleteBuffer(t._renderer.positionBuffer),delete t._renderer.positionBuffer)},render:function(t,e){if(!this._visible)return;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.parent,r=n._matrix&&n._matrix.manual||n._flagMatrix,s=this._matrix.manual||this._flagMatrix;if((r||s)&&(this._renderer.matrix||(this._renderer.matrix=new nn(9)),this._matrix.toTransformArray(!0,zn),Ur(zn,n._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof Q||(this._renderer.scale=new Q),this._scale instanceof Q?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(n._renderer.type)||(this._renderer.scale.x*=n._renderer.scale.x,this._renderer.scale.y*=n._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const a=ct.Utils.getRendererType(this._mask._renderer.type);be[a].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);let o;if(this._flagSubtractions)for(o=0;o<this.subtractions.length;o++)be.group.removeChild(this.subtractions[o],t);for(o=0;o<this.children.length;o++){const a=this.children[o],l=ct.Utils.getRendererType(a._renderer.type);be[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(t,e){let n,r,s,o,a,l,c,d,h,u,m,g,f,p;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,C=t.renderer.ratio,S=pc.copy(e._renderer.scale).multiply(C),v=e._stroke,B=e._linewidth,k=e._fill,R=e._renderer.opacity||e._opacity,$=e._cap,P=e._join,I=e._miter,V=e._closed,A=e.dashes,L=y.length,D=L-1;b.width=Math.max(Math.ceil(e._renderer.rect.width*S.x),1),b.height=Math.max(Math.ceil(e._renderer.rect.height*S.y),1);const ee=e._renderer.rect.centroid,E=ee.x,N=ee.y;if(_.clearRect(0,0,b.width,b.height),k)if(typeof k=="string")_.fillStyle=k;else{const me=ct.Utils.getRendererType(k._renderer.type);be[me].render.call(k,_,e),_.fillStyle=k._renderer.effect}if(v){if(typeof v=="string")_.strokeStyle=v;else{const me=ct.Utils.getRendererType(v._renderer.type);be[me].render.call(v,_,e),_.strokeStyle=v._renderer.effect}B&&(_.lineWidth=rn(e)),I&&(_.miterLimit=I),P&&(_.lineJoin=P),!V&&$&&(_.lineCap=$)}typeof R=="number"&&(_.globalAlpha=R),A&&A.length>0&&(_.lineDashOffset=A.offset||0,_.setLineDash(A));let H,q,Y,F,M,Z,fe,ie;_.save(),_.scale(S.x,S.y),_.translate(E,N),_.beginPath();for(let me=0;me<y.length;me++){const re=y[me];switch(g=re.x,f=re.y,re.command){case te.close:_.closePath();break;case te.arc:q=re.rx,Y=re.ry,F=re.xAxisRotation,M=re.largeArcFlag,Z=re.sweepFlag,n=V?Pt(me-1,L):Math.max(me-1,0),r=y[n],fe=r.x,ie=r.y,Am.renderSvgArcCommand(_,fe,ie,q,Y,M,Z,F,g,f);break;case te.curve:n=V?Pt(me-1,L):Math.max(me-1,0),r=y[n],d=r.controls&&r.controls.right||Q.zero,h=re.controls&&re.controls.left||Q.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),re._relative?(o=h.x+re.x,a=h.y+re.y):(o=h.x,a=h.y),_.bezierCurveTo(l,c,o,a,g,f),me>=D&&V&&(s=H,u=re.controls&&re.controls.right||Q.zero,m=s.controls&&s.controls.left||Q.zero,re._relative?(l=u.x+re.x,c=u.y+re.y):(l=u.x,c=u.y),s._relative?(o=m.x+s.x,a=m.y+s.y):(o=m.x,a=m.y),g=s.x,f=s.y,_.bezierCurveTo(l,c,o,a,g,f));break;case te.line:_.lineTo(g,f);break;case te.move:H=re,_.moveTo(g,f);break}}V&&_.closePath(),be.isHidden.test(k)||(p=k._renderer&&k._renderer.offset,p&&(_.save(),_.translate(-k._renderer.offset.x,-k._renderer.offset.y),_.scale(k._renderer.scale.x,k._renderer.scale.y)),_.fill(),p&&_.restore()),be.isHidden.test(v)||(p=v._renderer&&v._renderer.offset,p&&(_.save(),_.translate(-v._renderer.offset.x,-v._renderer.offset.y),_.scale(v._renderer.scale.x,v._renderer.scale.y),_.lineWidth=B/v._renderer.scale.x),_.stroke(),p&&_.restore()),_.restore()},getBoundingClientRect:function(t,e,n){let r=1/0,s=-1/0,o=1/0,a=-1/0,l,c;t.forEach(function(d){const h=d.x,u=d.y,m=d.controls;let g,f,p,y,b,_;o=Math.min(u,o),r=Math.min(h,r),s=Math.max(h,s),a=Math.max(u,a),d.controls&&(b=m.left,_=m.right,!(!b||!_)&&(g=d._relative?b.x+h:b.x,f=d._relative?b.y+u:b.y,p=d._relative?_.x+h:_.x,y=d._relative?_.y+u:_.y,!(!g||!f||!p||!y)&&(o=Math.min(f,y,o),r=Math.min(g,p,r),s=Math.max(g,p,s),a=Math.max(f,y,a))))}),typeof e=="number"&&(o-=e,r-=e,s+=e,a+=e),l=s-r,c=a-o,n.top=o,n.left=r,n.right=s,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-o},render:function(t,e,n){if(!this._visible||!this._opacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,s=ct.Utils.getRendererType(this._renderer.type),o=e[s],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof We&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof je&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Pe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof We&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof je&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Pe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new nn(9)),this._matrix.toTransformArray(!0,zn),Ur(zn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof Q||(this._renderer.scale=new Q);let u,m;this._scale instanceof Q?(u=this._scale.x*r._renderer.scale.x,m=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,m=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=m<0?-m:m,c&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const u=ct.Utils.getRendererType(this._mask._renderer.type);be[u].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,be.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),be.updateTexture.call(be,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==o&&(t.useProgram(o),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,fo,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const h=this._renderer.rect;return t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform4f(o.rect,h.left,h.top,h.right,h.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let n;const r=this.canvas,s=this.ctx,o=t.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,h=e.dashes,u=e._size*o;let m=u;be.isHidden.test(a)||(m+=l),r.width=sl(m),r.height=r.width;const g=m/r.width,f=r.width/2,p=r.height/2;if(s.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")s.fillStyle=c;else{const y=ct.Utils.getRendererType(c._renderer.type);be[y].render.call(c,s,e),s.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")s.strokeStyle=a;else{const y=ct.Utils.getRendererType(a._renderer.type);be[y].render.call(a,s,e),s.strokeStyle=a._renderer.effect}l&&(s.lineWidth=rn(e)/g)}typeof d=="number"&&(s.globalAlpha=d),h&&h.length>0&&(s.lineDashOffset=h.offset||0,s.setLineDash(h)),s.save(),s.translate(f,p),s.scale(be.precision,be.precision),s.beginPath(),s.arc(0,0,u/g*.5,0,at),s.restore(),closed&&s.closePath(),be.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(s.save(),s.translate(-c._renderer.offset.x,-c._renderer.offset.y),s.scale(c._renderer.scale.x,c._renderer.scale.y)),s.fill(),n&&s.restore()),be.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(s.save(),s.translate(-a._renderer.offset.x,-a._renderer.offset.y),s.scale(a._renderer.scale.x,a._renderer.scale.y),s.lineWidth=l/a._renderer.scale.x),s.stroke(),n&&s.restore())},render:function(t,e,n){if(!this._visible||!this._opacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const s=n||this.parent,o=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=s._matrix.manual||s._flagMatrix,h=this._matrix.manual||this._flagMatrix,u=this._renderer.parent!==s,m=this._renderer.vertices,g=this._renderer.collection.length,f=this._flagVertices,p=this._flagFill||this._fill instanceof We&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof je&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Pe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof We&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof je&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Pe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||s._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||h||u){this._renderer.matrix||(this._renderer.matrix=new nn(9)),this._matrix.toTransformArray(!0,zn),Ur(zn,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof Q||(this._renderer.scale=new Q);let y,b;this._scale instanceof Q?(y=this._scale.x*s._renderer.scale.x,b=this._scale.y*s._renderer.scale.y):(y=this._scale*s._renderer.scale.x,b=this._scale*s._renderer.scale.y),this._renderer.scale.x=y<0?-y:y,this._renderer.scale.y=b<0?-b:b,u&&(this._renderer.parent=s)}if(f){const y=this._renderer.positionBuffer;y&&t.deleteBuffer(y),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,m,t.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*s._renderer.opacity,be.updateTexture.call(be,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(be.isHidden.test(l)||(r+=c),r/=be.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==o&&(t.useProgram(o),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform1f(o.size,r*e.resolution.ratio),t.drawArrays(t.POINTS,0,g),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){const n=this.canvas,r=this.ctx,s=t.renderer.ratio,o=pc.copy(e._renderer.scale).multiply(s),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,h=e.dashes,u=e._decoration,m=e._direction;n.width=Math.max(Math.ceil(e._renderer.rect.width*o.x),1),n.height=Math.max(Math.ceil(e._renderer.rect.height*o.y),1);const g=e._renderer.rect.centroid,f=g.x,p=g.y;let y,b,_,C,S,v,B,k,R,$,P;const I=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),I||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=m,c)if(typeof c=="string")r.fillStyle=c;else{const V=ct.Utils.getRendererType(c._renderer.type);be[V].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const V=ct.Utils.getRendererType(a._renderer.type);be[V].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=rn(e))}if(typeof d=="number"&&(r.globalAlpha=d),h&&h.length>0&&(r.lineDashOffset=h.offset||0,r.setLineDash(h)),r.save(),r.scale(o.x,o.y),r.translate(f,p),be.isHidden.test(c)||(c._renderer&&c._renderer.offset?(v=c._renderer.scale.x,B=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(v,B),y=e._size/c._renderer.scale.y,b=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,C=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,C),r.restore()):r.fillText(e.value,0,0)),be.isHidden.test(a)||(a._renderer&&a._renderer.offset?(v=a._renderer.scale.x,B=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(v,B),y=e._size/a._renderer.scale.y,b=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,C=a._renderer.offset.y/a._renderer.scale.y,S=l/a._renderer.scale.x,r.lineWidth=S,r.strokeText(e.value,_,C),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(u)){const V=r.measureText(e.value);switch(u){case"underline":R=V.actualBoundingBoxDescent,P=V.actualBoundingBoxDescent;break;case"strikethrough":R=0,P=0;break}k=-V.width/2,$=V.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,R),r.lineTo($,P),r.stroke()}r.restore()},getBoundingClientRect:function(t,e){const n=be.ctx;n.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),n.textAlign="center",n.textBaseline=ct.Utils.baselines[t._baseline]||t._baseline;const r=n.measureText(t._value);let s=r.width,o=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!be.isHidden.test(this._stroke)&&(s+=this._linewidth*2,o+=this._linewidth*2);const a=s/2,l=o/2;switch(be.alignments[t._alignment]||t._alignment){case be.alignments.left:t.direction==="ltr"?(e.left=0,e.right=s):(e.left=-s,e.right=0);break;case be.alignments.right:t.direction==="ltr"?(e.left=-s,e.right=0):(e.left=0,e.right=s);break;default:e.left=-a,e.right=a}switch(t._baseline){case"bottom":e.top=-o,e.bottom=0;break;case"top":e.top=0,e.bottom=o;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=s,e.height=o,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(t,e,n){if(!this._visible||!this._opacity)return this;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,s=e[this._renderer.type],o=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof We&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof je&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Pe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof We&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof je&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Pe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(o||a||l){this._renderer.matrix||(this._renderer.matrix=new nn(9)),this._matrix.toTransformArray(!0,zn),Ur(zn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof Q||(this._renderer.scale=new Q);let h,u;this._scale instanceof Q?(h=this._scale.x*r._renderer.scale.x,u=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,u=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=u<0?-u:u,l&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const h=ct.Utils.getRendererType(this._mask._renderer.type);be[h].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,be.text.getBoundingClientRect(this,this._renderer.rect),be.updateTexture.call(be,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==s&&(t.useProgram(s),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,fo,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,d.left,d.top,d.right,d.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=e.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=t.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 K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=e.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=t.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 K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t,e){if(!t.canvas.getContext("2d"))return;K.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=t.createPattern(n,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof Q||(this._renderer.offset=new Q),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,n&&(this._renderer.offset.x+=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof Q?(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 Q||(this._renderer.scale=new Q);let r,s;this._scale instanceof Q?(r=this._scale.x,s=this._scale.y):(r=this._scale,s=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=s<0?-s:s}return K.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(t,e){const n=ct.Utils.getRendererType(e._renderer.type);if(this[n].updateCanvas.call(be,t,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&t.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=t.createTexture()),t.bindTexture(t.TEXTURE_2D,e._renderer.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR)},program:{create:function(t,e){let n,r,s;if(n=t.createProgram(),K.each(e,function(o){t.attachShader(n,o)}),t.linkProgram(n),r=t.getProgramParameter(n,t.LINK_STATUS),!r)throw s=t.getProgramInfoLog(n),t.deleteProgram(n),new Rt("unable to link program: "+s);return n}},extensions:{init:function(t){const e={},n=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<n.length;r++){const s=n[r];e[s]=be.extensions.get(t,s)}return e},get:function(t,e){return t.getExtension(e)||t.getExtension(`MOZ_${e}`)||t.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new Fr};be.ctx=be.canvas.getContext("2d");var yc=class extends X{constructor(t){super();let e,n,r,s;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(be.canvas=t.offscreenElement,be.ctx=be.canvas.getContext("2d")),this.scene=new nt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new nn(Mm),scale:1,opacity:1},this._flagMatrix=!0,t=K.defaults(t||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=t.overdraw,e=this.ctx=this.domElement.getContext("webgl",t)||this.domElement.getContext("experimental-webgl",t),!this.ctx)throw new Rt("unable to create a webgl context. Try using another renderer.");r=Dt.create(e,Dt.path.vertex,Dt.types.vertex),s=Dt.create(e,Dt.path.fragment,Dt.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=be.program.create(e,[r,s]),this.programs.text=this.programs.path,e.extensions=be.extensions.init(e),e.renderer=this,n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.rect=e.getUniformLocation(n,"u_rect");const o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,fo,e.STATIC_DRAW),r=Dt.create(e,Dt.points.vertex,Dt.types.vertex),s=Dt.create(e,Dt.points.fragment,Dt.types.fragment),n=this.programs.points=be.program.create(e,[r,s]),n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.size=e.getUniformLocation(n,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(t,e,n){let r,s;const o=this.ctx;return this.width=t,this.height=e,this.ratio=typeof n>"u"?Hs(o):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,K.isObject(this.domElement.style)&&K.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*this.ratio,s=e*this.ratio,o.viewport(0,0,r,s),this.programs.resolution.width=r,this.programs.resolution.height=s,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(X.Types.resize,t,e,n)}render(){const t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),be.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};w(yc,"Utils",be);var Vm=K.extend({Error:Rt,getRatio:Hs,read:ze,xhr:dc},K,_t,tl,nl),we=class Rr{constructor(e){w(this,"_events",new X),w(this,"type",""),w(this,"renderer",null),w(this,"scene",null),w(this,"width",0),w(this,"height",0),w(this,"frameCount",0),w(this,"timeDelta",0),w(this,"playing",!1);const n=K.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Rr.Types.svg,autostart:!1});if(K.each(n,function(r,s){/fullscreen/i.test(s)||/autostart/i.test(s)||(this[s]=r)},this),K.isElement(n.domElement)){const r=n.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=Rr.Types[r])}this.renderer=new Rr[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=Om.bind(this),this.fit.domElement=window,this.fit.attached=!0,K.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),K.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Ft.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=Im.bind(this),K.extend(this.renderer.domElement.style,{display:"block"})):typeof n.width=="number"&&typeof n.height=="number"&&(this.renderer.setSize(n.width,n.height,this.ratio),this.width=n.width,this.height=n.height),this.renderer.bind(X.Types.resize,zm.bind(this)),this.scene=this.renderer.scene,Rr.Instances.push(this),n.autostart&&sr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,sr.init(),this.trigger(X.Types.play)}pause(){return this.playing=!1,this.trigger(X.Types.pause)}setPlaying(e){this.playing=e}release(e){let n,r,s;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(n=0;n<e.vertices.length;n++)r=e.vertices[n],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(n=0;n<e.children.length;n++)s=e.children[n],this.release(s);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const o=this.renderer.ctx;e._renderer.texture&&(o.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(o.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}update(){const e=!!this._lastFrame,n=K.performance.now();e&&(this.timeDelta=parseFloat((n-this._lastFrame).toFixed(3))),this._lastFrame=n,this.fit&&this.fit.domElement&&!this.fit.attached&&(Ft.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,s=this.height,o=this.renderer;return(r!==o.width||s!==o.height)&&o.setSize(r,s,this.ratio),this.trigger(X.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(X.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,n,r,s){const o=new Wr(e,n,r,s);return this.scene.add(o),o}makeArrow(e,n,r,s,o){const a=typeof o=="number"?o:10,l=Math.atan2(s-n,r-e),c=[new ve(e,n,void 0,void 0,void 0,void 0,te.move),new ve(r,s,void 0,void 0,void 0,void 0,te.line),new ve(r-a*Math.cos(l-Math.PI/4),s-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,te.line),new ve(r,s,void 0,void 0,void 0,void 0,te.move),new ve(r-a*Math.cos(l+Math.PI/4),s-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,te.line)],d=new Se(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,n,r,s){const o=new In(e,n,r,s);return this.scene.add(o),o}makeRoundedRectangle(e,n,r,s,o){const a=new Lr(e,n,r,s,o);return this.scene.add(a),a}makeCircle(e,n,r,s){const o=new Ir(e,n,r,s);return this.scene.add(o),o}makeEllipse(e,n,r,s,o){const a=new zr(e,n,r,s,o);return this.scene.add(a),a}makeStar(e,n,r,s,o){const a=new io(e,n,r,s,o);return this.scene.add(a),a}makeCurve(e){const n=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<n;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new ve(l,c))}}const r=arguments[n-1],s=new Se(e,!(typeof r=="boolean"&&r),!0),o=s.getBoundingClientRect();return s.center().translation.set(o.left+o.width/2,o.top+o.height/2),this.scene.add(s),s}makePolygon(e,n,r,s){const o=new no(e,n,r,s);return this.scene.add(o),o}makeArcSegment(e,n,r,s,o,a,l){const c=new Ks(e,n,r,s,o,a,l);return this.scene.add(c),c}makePoints(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let o=0;o<n;o+=2){const a=arguments[o];if(typeof a!="number")break;const l=arguments[o+1];r.push(new Q(a,l))}}const s=new to(r);return this.scene.add(s),s}makePath(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<n;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new ve(c,d))}}const s=arguments[n-1],o=new Se(r,!(typeof s=="boolean"&&s)),a=o.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&o.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(o),o}makeText(e,n,r,s){const o=new sn(e,n,r,s);return this.add(o),o}makeLinearGradient(e,n,r,s){const o=Array.prototype.slice.call(arguments,4),a=new We(e,n,r,s,o);return this.add(a),a}makeRadialGradient(e,n,r){const s=Array.prototype.slice.call(arguments,3),o=new je(e,n,r,s);return this.add(o),o}makeSprite(e,n,r,s,o,a,l){const c=new Or(e,n,r,s,o,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,s,o,a){const l=new hc(e,n,r,s,o,a);return this.add(l),l}makeImageSequence(e,n,r,s,o){const a=new ao(e,n,r,s);return o&&a.play(),this.add(a),a}makeTexture(e,n){return new Pe(e,n)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const n=new nt;return this.scene.add(n),n.add(e),n}interpret(e,n,r){const s=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(s in ze))return null;const o=ze[s].call(this,e);return r?this.add(n&&o instanceof nt?o.children:o):o.parent&&o.remove(),o}load(e,n){const r=new nt;let s,o,a;const l=(function(c){for(Ft.temp.innerHTML=c,o=0;o<Ft.temp.children.length;o++)s=Ft.temp.children[o],a=this.interpret(s,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Ft.temp.children.length<=1?Ft.temp.children[0]:Ft.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(dc(e,l),r):(l(e),r)}};w(we,"NextFrameId",wt.NextFrameId),w(we,"Types",wt.Types),w(we,"Version",wt.Version),w(we,"PublishDate",wt.PublishDate),w(we,"Identifier",wt.Identifier),w(we,"Resolution",wt.Resolution),w(we,"AutoCalculateImportedMatrices",wt.AutoCalculateImportedMatrices),w(we,"Instances",wt.Instances),w(we,"uniqueId",wt.uniqueId),w(we,"Anchor",ve),w(we,"Collection",An),w(we,"Events",X),w(we,"Group",nt),w(we,"Matrix",Fi),w(we,"Path",Se),w(we,"Registry",Fr),w(we,"Element",Pi),w(we,"Shape",On),w(we,"Text",sn),w(we,"Vector",Q),w(we,"Gradient",Qe),w(we,"Image",hc),w(we,"ImageSequence",ao),w(we,"LinearGradient",We),w(we,"RadialGradient",je),w(we,"Sprite",Or),w(we,"Stop",Vn),w(we,"Texture",Pe),w(we,"ArcSegment",Ks),w(we,"Circle",Ir),w(we,"Ellipse",zr),w(we,"Line",Wr),w(we,"Points",to),w(we,"Polygon",no),w(we,"Rectangle",In),w(we,"RoundedRectangle",Lr),w(we,"Star",io),w(we,"CanvasRenderer",ct),w(we,"SVGRenderer",mc),w(we,"WebGLRenderer",yc),w(we,"Commands",te),w(we,"Utils",Vm);var an=we;function Om(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function Im(){const t=this.renderer.domElement.parentElement;if(!t){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=t.getBoundingClientRect(),n=this.width=e.width,r=this.height=e.height;this.renderer.setSize(n,r,this.ratio)}function zm(t,e){this.width=t,this.height=e,this.trigger(X.Types.resize,t,e)}var sr=Ft.getRequestAnimationFrame();function bc(){for(let t=0;t<an.Instances.length;t++){const e=an.Instances[t];e.playing&&e.update()}an.NextFrameId=sr(bc)}sr.init=function(){bc(),sr.init=function(){}};let ln;typeof window<"u"?ln=window:typeof global<"u"?ln=global:typeof self<"u"&&(ln=self);let _c;const ei=Math.PI*2,it=Math.PI*.5;function Lm(t,e,n,r,s,o){let a;return arguments.length<=1?(a=t.a,e=t.b,n=t.c,r=t.d,s=t.e,o=t.f):a=t,{translateX:s,translateY:o,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function Dm(t){_c=t}function Hm(t,e){e=e&&e.identity()||new _c;let n=t;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;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Ht(t,e,n){return n*(e-t)+t}function Vi(t,e){for(;t<0;)t+=e;return t%e}const wc=ln.Float32Array||Array,Wm=Math.floor;function cn(t){return Wm(t*1e6)/1e6}const he={move:"M",line:"L",curve:"C",close:"Z"};class U{constructor(){x(this,"_events",{});x(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let s=0,o=r.length;s<o;s++){e=r[s];let a=this._events[e];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[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];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(e,n,r){const s=this;e&&(o.obj=e,o.name=n,o.handler=r,e.on(n,o));function o(){r.apply(s,arguments)}return s}ignore(e,n,r){return e.off(n,r),this}}x(U,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),x(U,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const xc={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(U.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(U.Types.change))}}},st=class st extends U{constructor(n=0,r=0){super();x(this,"_x",0);x(this,"_y",0);for(let s in xc)Object.defineProperty(this,s,xc[s]);this.x=n,this.y=r}static add(n,r){return new st(n.x+r.x,n.y+r.y)}static sub(n,r){return new st(n.x-r.x,n.y-r.y)}static subtract(n,r){return st.sub(n,r)}static ratioBetween(n,r){return(n.x*r.x+n.y*r.y)/(n.length()*r.length())}static angleBetween(n,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const s=n.x-r.x,o=n.y-r.y;return Math.atan2(o,s)}static distanceBetween(n,r){return Math.sqrt(st.distanceBetweenSquared(n,r))}static distanceBetweenSquared(n,r){const s=n.x-r.x,o=n.y-r.y;return s*s+o*o}set(n,r){return this.x=n,this.y=r,this}copy(n){return this.x=n.x,this.y=n.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new st(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,s=this.y-n.y;return r*r+s*s}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const s=(n.x-this.x)*r+this.x,o=(n.y-this.y)*r+this.y;return this.set(s,o)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:cn(this.x),y:cn(this.y)}}rotate(n){const r=this.x,s=this.y,o=Math.cos(n),a=Math.sin(n);return this.x=r*o-s*a,this.y=r*a+s*o,this}};x(st,"zero",new st),x(st,"left",new st(-1,0)),x(st,"right",new st(1,0)),x(st,"up",new st(0,-1)),x(st,"down",new st(0,1));let ge=st;class Re extends ge{constructor(n=0,r=0,s=0,o=0,a=0,l=0,c=he.move){super(n,r);x(this,"controls",{left:new ge,right:new ge});x(this,"_command",he.move);x(this,"_relative",!0);x(this,"_rx",0);x(this,"_ry",0);x(this,"_xAxisRotation",0);x(this,"_largeArcFlag",0);x(this,"_sweepFlag",1);for(let h in vc)Object.defineProperty(this,h,vc[h]);this.command=c,this.relative=!0;const d=Re.makeBroadcast(this);this.controls.left.set(s,o).addEventListener(U.Types.change,d),this.controls.right.set(a,l).addEventListener(U.Types.change,d)}static makeBroadcast(n){return r;function r(){n._bound&&n.dispatchEvent(U.Types.change)}}static fromObject(n){return new Re().copy(n)}copy(n){return this.x=n.x,this.y=n.y,typeof n.command=="string"&&(this.command=n.command),n.controls&&(n.controls.left&&this.controls.left.copy(n.controls.left),n.controls.right&&this.controls.right.copy(n.controls.right)),typeof n.relative=="boolean"&&(this.relative=n.relative),typeof n.rx=="number"&&(this.rx=n.rx),typeof n.ry=="number"&&(this.ry=n.ry),typeof n.xAxisRotation=="number"&&(this.xAxisRotation=n.xAxisRotation),typeof n.largeArcFlag=="number"&&(this.largeArcFlag=n.largeArcFlag),typeof n.sweepFlag=="number"&&(this.sweepFlag=n.sweepFlag),this}clone(){return new Re().copy(this)}toObject(){return{x:cn(this.x),y:cn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:cn(this.rx),ry:cn(this.ry),xAxisRotation:cn(this.xAxisRotation),largeArcFlag:cn(this.largeArcFlag),sweepFlag:cn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const vc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(U.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(U.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(U.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(U.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(U.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(U.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(U.Types.change))}}};let jm=0;const go={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return jm++}},Gr={RecursionLimit:16,abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Kr(t,e,n,r,s){const o=1-t;return o*o*o*e+3*o*o*t*n+3*o*t*t*r+t*t*t*s}function kc(t,e,n,r,s,o,a,l,c){c=c||Gr.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Re(a,l)];const h=[];for(let u=0;u<d;u++){const m=u/d,g=Kr(m,t,n,s,a),f=Kr(m,e,r,o,l);h.push(new Re(g,f))}return h}function qm(t,e,n,r,s,o,a,l,c){if(t===n&&e===r&&s===a&&o===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-s)+3*(a-t),h=6*(t+s)-12*n,u=3*(n-t),m=9*(r-o)+3*(l-e),g=6*(e+o)-12*r,f=3*(r-e);function p(y){const b=(d*y+h)*y+u,_=(m*y+g)*y+f;return Math.sqrt(b*b+_*_)}return Ym(p,0,1,c||Gr.RecursionLimit)}function Xm(t,e,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,m,g,f,p,y,b;for(let v=0;v<2;++v){if(v===0?(u=6*t-12*n+6*s,h=-3*t+9*n-9*s+3*a,m=3*n-3*t):(u=6*e-12*r+6*o,h=-3*e+9*r-9*o+3*l,m=3*r-3*e),Math.abs(h)<.001){if(Math.abs(u)<.001)continue;g=-m/u,0<g&&g<1&&c.push(g);continue}y=u*u-4*m*h,b=Math.sqrt(y),!(y<0)&&(f=(-u+b)/(2*h),0<f&&f<1&&c.push(f),p=(-u-b)/(2*h),0<p&&p<1&&c.push(p))}let _=c.length,C=_,S;for(;_--;)g=c[_],S=1-g,d[0][_]=S*S*S*t+3*S*S*g*n+3*S*g*g*s+g*g*g*a,d[1][_]=S*S*S*e+3*S*S*g*r+3*S*g*g*o+g*g*g*l;return d[0][C]=t,d[1][C]=e,d[0][C+1]=a,d[1][C+1]=l,d[0].length=d[1].length=C+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 Ym(t,e,n,r){let s=Gr.abscissas[r-2],o=Gr.weights[r-2],a=.5*(n-e),l=a+e,c=0,d=r+1>>1,h=r&1?o[c++]*t(l):0;for(;c<d;){const u=a*s[c];h+=o[c++]*(t(l+u)+t(l-u))}return a*h}function Um(t,e){const n=t.length,r=n-1;for(let s=0;s<n;s++){const o=t[s],a=e?Vi(s-1,n):Math.max(s-1,0),l=e?Vi(s+1,n):Math.min(s+1,r),c=t[a],d=o,h=t[l];Gm(c,d,h),d.command=s===0?he.move:he.curve}}function Gm(t,e,n){const r=ge.angleBetween(t,e),s=ge.angleBetween(n,e);let o=ge.distanceBetween(t,e),a=ge.distanceBetween(n,e),l=(r+s)/2;return o<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(o*=.33,a*=.33,s<r?l+=it:l-=it,e.controls.left.x=Math.cos(l)*o,e.controls.left.y=Math.sin(l)*o,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let or=(yi=class extends U{constructor(){super();x(this,"_flagId",!1);x(this,"_flagClassName",!1);x(this,"_renderer",{});x(this,"_id",go.Identifier+go.uniqueId());x(this,"_className","");x(this,"classList",[]);for(let n in Cc)Object.defineProperty(this,n,Cc[n])}static fromObject(n){const r=new yi().copy(n);return"id"in n&&(r.id=n.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(n){return n.renderer&&typeof n.renderer.type=="string"&&(this.renderer.type=n.renderer.type),typeof n.className=="string"&&(this.className=n.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){const n=this._renderer.type;return this._renderer={type:n},typeof this.unbind=="function"&&this.unbind(),this}},x(yi,"Properties",["renderer","id","className"]),yi);const Cc={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}};class Zr extends Error{constructor(n){super();x(this,"name","Two.js");x(this,"message");this.message=n}}class Km{constructor(){x(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let Qr;const Sc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};ln.document&&(Qr=document.createElement("a"));const Xe=class Xe extends or{constructor(n,r){super();x(this,"_flagSrc",!1);x(this,"_flagImage",!1);x(this,"_flagVideo",!1);x(this,"_flagLoaded",!1);x(this,"_flagRepeat",!1);x(this,"_flagOffset",!1);x(this,"_flagScale",!1);x(this,"_src","");x(this,"_image",null);x(this,"_loaded",!1);x(this,"_repeat","no-repeat");x(this,"_scale",1);x(this,"_offset",null);for(let s in Bc)Object.defineProperty(this,s,Bc[s]);if(this._renderer.type="texture",this._renderer.flagOffset=Zm.bind(this),this._renderer.flagScale=Qm.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new ge,typeof r=="function"){const s=(function(){this.unbind(U.Types.load,s),typeof r=="function"&&r()}).bind(this);this.bind(U.Types.load,s)}if(typeof n=="string")this.src=n;else if(typeof n=="object"){const s=Object.prototype.toString.call(n);(s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]"||s==="[object HTMLVideoElement]"||s==="[object Image]")&&(this.image=n)}this._update()}fromObject(n){const r=new Xe().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return Qr?(Qr.href=n,Qr.href):n}static loadHeadlessBuffer(n,r){n.image.onload=r,n.image.src=n.src}static getTag(n){return n&&n.nodeName&&n.nodeName.toLowerCase()||"img"}static getImage(n){const r=Xe.getAbsoluteURL(n);if(Xe.ImageRegistry.contains(r))return Xe.ImageRegistry.get(r);let s;return ln.document?Sc.video.test(r)?s=document.createElement("video"):s=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),s.crossOrigin="anonymous",s.referrerPolicy="no-referrer",s}static load(n,r){let s=n.image,o=Xe.getTag(s);n._flagImage&&(/canvas/i.test(o)?Xe.Register.canvas(n,r):(n._src=s.getAttribute("two-src")||s.src,Xe.Register[o](n,r))),n._flagSrc&&(s||(s=Xe.getImage(n.src),n.image=s),o=Xe.getTag(s),Xe.Register[o](n,r))}clone(){const n=new Xe(this.src);return n.repeat=this.repeat,n.offset.copy(this.offset),n.scale=this.scale,n}copy(n){return this.src=n.src,this.repeat=n.repeat,this.offset=typeof n.offset=="number"||n.offset instanceof ge?n.offset:new ge().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof ge?n.scale:new ge().copy(n.scale),this}toObject(){const n=super.toObject.call(this);return n.renderer.type="texture",n.src=this.src,n.repeat=this.repeat,n.offset=this.offset.toObject(),n.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),n}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(U.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Xe.load(this,(function(){this.loaded=!0,this.trigger(U.Types.change).trigger(U.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};x(Xe,"Properties",["src","loaded","repeat","scale","offset","image"]),x(Xe,"RegularExpressions",Sc),x(Xe,"ImageRegistry",new Km),x(Xe,"Register",{canvas:function(n,r){n._src="#"+n.id,Xe.ImageRegistry.add(n.src,n.image),typeof r=="function"&&r()},img:function(n,r){const s=n.image,o=function(l){s.removeEventListener&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",o,!1),s.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof s.removeEventListener=="function"&&(s.removeEventListener("load",o,!1),s.removeEventListener("error",a,!1)),new Zr("unable to load "+n.src)};typeof s.width=="number"&&s.width>0&&typeof s.height=="number"&&s.height>0?o():typeof s.addEventListener=="function"&&(s.addEventListener("load",o,!1),s.addEventListener("error",a,!1)),n._src=Xe.getAbsoluteURL(n._src),!(s&&s.getAttribute("two-src"))&&(s.setAttribute("two-src",n.src),Xe.ImageRegistry.add(n.src,s),n.image.src=n.src)},video:function(n,r){const s=function(a){n.image.removeEventListener("canplaythrough",s,!1),n.image.removeEventListener("error",o,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof r=="function"&&r()},o=function(a){throw n.image.removeEventListener("canplaythrough",s,!1),n.image.removeEventListener("error",o,!1),new Zr("unable to load "+n.src)};n._src=Xe.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Xe.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?s():(n.image.addEventListener("canplaythrough",s,!1),n.image.addEventListener("error",o,!1),n.image.src=n.src,n.image.load())}});let qe=Xe;const Bc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=qe.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}qe.ImageRegistry.contains(n)?this._image=qe.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(U.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(U.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof ge&&this._scale.unbind(U.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof ge&&this._scale.bind(U.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Zm(){this._flagOffset=!0}function Qm(){this._flagScale=!0}class ti extends Array{constructor(){super();Aa(this,ot,new U);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 Bt(this,ot)}set _events(n){Fu(this,ot,n)}get _bound(){return Bt(this,ot)._bound}set _bound(n){Bt(this,ot)._bound=n}addEventListener(){return Bt(this,ot).addEventListener.apply(this,arguments)}on(){return Bt(this,ot).on.apply(this,arguments)}bind(){return Bt(this,ot).bind.apply(this,arguments)}removeEventListener(){return Bt(this,ot).removeEventListener.apply(this,arguments)}off(){return Bt(this,ot).off.apply(this,arguments)}unbind(){return Bt(this,ot).unbind.apply(this,arguments)}dispatchEvent(){return Bt(this,ot).dispatchEvent.apply(this,arguments)}trigger(){return Bt(this,ot).trigger.apply(this,arguments)}listen(){return Bt(this,ot).listen.apply(this,arguments)}ignore(){return Bt(this,ot).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(U.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(U.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(U.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(U.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(U.Types.remove,n),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(U.Types.insert,r),this.trigger(U.Types.order)}return n}sort(){return super.sort.apply(this,arguments),this.trigger(U.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(U.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(n,r){const s=[];for(let o=0;o<this.length;o++){const a=this[o];let l;r?l=n.call(r,a,o):l=n(a,o),s.push(l)}return s}}ot=new WeakMap;const Tc=Array.prototype.slice;function Jm(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const $e={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=Tc.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let s in r)t[s]=r[s]}return t},defaults:function(t){const e=Tc.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let s in r)t[s]===void 0&&(t[s]=r[s])}return t},each:function(t,e,n){const r=n||this,s=!Jm(t)&&Object.keys(t),o=(s||t).length;for(let a=0;a<o;a++){const l=s?s[a]:a;e.call(r,t[l],l,t)}return t},performance:ln.performance&&ln.performance.now?ln.performance:Date},Et=class Et extends or{constructor(n,r,s){super();x(this,"_flagOffset",!0);x(this,"_flagOpacity",!0);x(this,"_flagColor",!0);x(this,"_offset",0);x(this,"_opacity",1);x(this,"_color","#fff");for(let o in Rc)Object.defineProperty(this,o,Rc[o]);this._renderer.type="stop",this.offset=typeof n=="number"?n:Et.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof r=="string"?r:Et.Index<=0?"#fff":"#000",Et.Index=(Et.Index+1)%2}static fromObject(n){const r=new Et().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Et.Properties.length;r++){const s=Et.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new Et;return $e.each(Et.Properties,function(s){r[s]=this[s]},this),n&&n.stops&&n.stops.push(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="stop",$e.each(Et.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};x(Et,"Index",0),x(Et,"Properties",["offset","opacity","color"]);let ni=Et;const Rc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},fn=class fn extends or{constructor(n){super();x(this,"_flagStops",!1);x(this,"_flagSpread",!1);x(this,"_flagUnits",!1);x(this,"_spread","");x(this,"_units","");for(let r in $c)Object.defineProperty(this,r,$c[r]);this._renderer.type="gradient",this._renderer.flagStops=ep.bind(this),this._renderer.bindStops=tp.bind(this),this._renderer.unbindStops=np.bind(this),this.spread="pad",this.units="objectBoundingBox",n&&(this.stops=n)}static fromObject(n){let r=n.stops;r&&r.length>0&&(r=r.map(o=>o instanceof ni?o:new ni().copy(o)));const s=new fn(r).copy(n);return"id"in n&&(s.id=n.id),s}clone(n){const r=this.stops.map(o=>o.clone()),s=new fn(r);return $e.each(fn.Properties,o=>{s[o]=this[o]},this),n&&n.add(s),s}copy(n){super.copy.call(this,n);for(let r=0;r<fn.Properties.length;r++){const s=fn.Properties[r];s in n&&(this[s]=n[s])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return $e.each(fn.Properties,r=>{n[r]=this[r]},this),n}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(U.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};x(fn,"Stop",ni),x(fn,"Properties",["spread","stops","units"]);let Je=fn;const $c={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(U.Types.insert,e).unbind(U.Types.remove,n),this._stops=new ti((t||[]).slice(0)),this._stops.bind(U.Types.insert,e).bind(U.Types.remove,n),e(this._stops)}}};function ep(){this._flagStops=!0}function tp(t){let e=t.length;for(;e--;)t[e].bind(U.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function np(t){let e=t.length;for(;e--;)t[e].unbind(U.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const qn=class qn extends Je{constructor(n,r,s,o,a){super(a);x(this,"_flagEndPoints",!1);x(this,"_left",null);x(this,"_right",null);for(let l in Ec)Object.defineProperty(this,l,Ec[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=ip.bind(this),this.left=new ge,this.right=new ge,typeof n=="number"&&(this.left.x=n),typeof r=="number"&&(this.left.y=r),typeof s=="number"&&(this.right.x=s),typeof o=="number"&&(this.right.y=o)}static fromObject(n){const r=new qn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<qn.Properties.length;r++){const s=qn.Properties[r];s in n&&(this[s]=n[s]instanceof ge?n[s]:new ge().copy(n[s]))}return this}clone(n){const r=this.stops.map(function(o){return o.clone()}),s=new qn(this.left._x,this.left._y,this.right._x,this.right._y,r);return $e.each(Je.Properties,function(o){s[o]=this[o]},this),n&&n.add(s),s}toObject(){const n=super.toObject.call(this);return n.left=this.left.toObject(),n.right=this.right.toObject(),n}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(U.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};x(qn,"Stop",ni),x(qn,"Properties",["left","right"]);let xt=qn;const Ec={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof ge&&this._left.unbind(U.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(U.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof ge&&this._right.unbind(U.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(U.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function ip(){this._flagEndPoints=!0}const gn=class gn extends Je{constructor(n,r,s,o,a,l){super(o);x(this,"_flagRadius",!1);x(this,"_flagCenter",!1);x(this,"_flagFocal",!1);x(this,"_radius",0);x(this,"_center",null);x(this,"_focal",null);for(let c in Nc)Object.defineProperty(this,c,Nc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=rp.bind(this),this._renderer.flagFocal=sp.bind(this),this.center=new ge,this.radius=typeof s=="number"?s:1,this.focal=new ge,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new gn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<gn.Properties.length;r++){const s=gn.Properties[r];s in n&&(/(center|focal)i/.test(s)?this[s]=n[s]instanceof ge?n[s]:new ge().copy(n[s]):typeof n[s]=="number"&&(this[s]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(o){return o.clone()}),s=new gn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return $e.each(Je.Properties.concat(gn.Properties),function(o){s[o]=this[o]},this),n&&n.add(s),s}toObject(){const n=super.toObject.call(this);return $e.each(gn.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(U.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};x(gn,"Stop",ni),x(gn,"Properties",["center","radius","focal"]);let vt=gn;const Nc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(U.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(U.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(U.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(U.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function rp(){this._flagCenter=!0}function sp(){this._flagFocal=!0}function Pc(t,e){if(e===0||e===1)return!0;const r=t._length*e;let s=0;for(let o=0;o<t._lengths.length;o++){const a=t._lengths[o];if(s>=r)return r-s>=0;s+=a}return!1}function Jr(t,e){const n=t._length;if(e<=0)return 0;if(e>=n)return t._lengths.length-1;for(let r=0,s=0;r<t._lengths.length;r++){if(s+t._lengths[r]>=e)return e-=s,Math.max(r-1,0)+e/t._lengths[r];s+=t._lengths[r]}return-1}function Fc(t,e,n){let r,s,o,a,l,c,d,h;const u=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,s=(u||e).x,c=(u||e).y,o=(m||t).x,d=(m||t).y,a=t.x,h=t.y,u&&e._relative&&(s+=e.x,c+=e.y),m&&t._relative&&(o+=t.x,d+=t.y),qm(r,l,s,c,o,d,a,h,n)}function Mc(t,e,n){let r,s,o,a,l,c,d,h;const u=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,s=(u||e).x,c=(u||e).y,o=(m||t).x,d=(m||t).y,a=t.x,h=t.y,u&&e._relative&&(s+=e.x,c+=e.y),m&&t._relative&&(o+=t.x,d+=t.y),kc(r,l,s,c,o,d,a,h,n)}function ii(t){switch(t.renderer.type){case"texture":return qe.fromObject(t);case"gradient":return Je.fromObject(t);case"linear-gradient":return xt.fromObject(t);case"radial-gradient":return vt.fromObject(t)}return t}const op=Math.cos,ap=Math.sin,Ac=Math.tan,mo=[],Ct=class Ct extends U{constructor(n,r,s,o,a,l){super();x(this,"elements",new wc(9));x(this,"manual",!1);let c=n;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(n,r,s){if(r.length<=3){const k=n;let R,$,P;const I=r[0]||0,V=r[1]||0,A=r[2]||0;return R=k[0]*I+k[1]*V+k[2]*A,$=k[3]*I+k[4]*V+k[5]*A,P=k[6]*I+k[7]*V+k[8]*A,[R,$,P]}const o=n[0],a=n[1],l=n[2],c=n[3],d=n[4],h=n[5],u=n[6],m=n[7],g=n[8],f=r[0],p=r[1],y=r[2],b=r[3],_=r[4],C=r[5],S=r[6],v=r[7],B=r[8];return s=s||new wc(9),s[0]=o*f+a*b+l*S,s[1]=o*p+a*_+l*v,s[2]=o*y+a*C+l*B,s[3]=c*f+d*b+h*S,s[4]=c*p+d*_+h*v,s[5]=c*y+d*C+h*B,s[6]=u*f+m*b+g*S,s[7]=u*p+m*_+g*v,s[8]=u*y+m*C+g*B,s}static fromObject(n){return new Ct().copy(n)}set(n,r,s,o,a,l,c,d,h){if(typeof r>"u"){const u=n;n=u[0],r=u[1],s=u[2],o=u[3],a=u[4],l=u[5],c=u[6],d=u[7],h=u[8]}return this.elements[0]=n,this.elements[1]=r,this.elements[2]=s,this.elements[3]=o,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=h,this.trigger(U.Types.change)}copy(n){return this.elements[0]=n.elements[0],this.elements[1]=n.elements[1],this.elements[2]=n.elements[2],this.elements[3]=n.elements[3],this.elements[4]=n.elements[4],this.elements[5]=n.elements[5],this.elements[6]=n.elements[6],this.elements[7]=n.elements[7],this.elements[8]=n.elements[8],this.manual=n.manual,this.trigger(U.Types.change)}identity(){return this.elements[0]=Ct.Identity[0],this.elements[1]=Ct.Identity[1],this.elements[2]=Ct.Identity[2],this.elements[3]=Ct.Identity[3],this.elements[4]=Ct.Identity[4],this.elements[5]=Ct.Identity[5],this.elements[6]=Ct.Identity[6],this.elements[7]=Ct.Identity[7],this.elements[8]=Ct.Identity[8],this.trigger(U.Types.change)}multiply(n,r,s,o,a,l,c,d,h){if(typeof r>"u")return this.elements[0]*=n,this.elements[1]*=n,this.elements[2]*=n,this.elements[3]*=n,this.elements[4]*=n,this.elements[5]*=n,this.elements[6]*=n,this.elements[7]*=n,this.elements[8]*=n,this.trigger(U.Types.change);if(typeof s>"u"&&(s=1),typeof o>"u"){n=n||0,r=r||0,s=s||0,a=this.elements;const D=a[0]*n+a[1]*r+a[2]*s,ee=a[3]*n+a[4]*r+a[5]*s,E=a[6]*n+a[7]*r+a[8]*s;return[D,ee,E]}const u=this.elements,m=[n,r,s,o,a,l,c,d,h],g=u[0],f=u[1],p=u[2],y=u[3],b=u[4],_=u[5],C=u[6],S=u[7],v=u[8],B=m[0],k=m[1],R=m[2],$=m[3],P=m[4],I=m[5],V=m[6],A=m[7],L=m[8];return this.elements[0]=g*B+f*$+p*V,this.elements[1]=g*k+f*P+p*A,this.elements[2]=g*R+f*I+p*L,this.elements[3]=y*B+b*$+_*V,this.elements[4]=y*k+b*P+_*A,this.elements[5]=y*R+b*I+_*L,this.elements[6]=C*B+S*$+v*V,this.elements[7]=C*k+S*P+v*A,this.elements[8]=C*R+S*I+v*L,this.trigger(U.Types.change)}inverse(n){const r=this.elements;n=n||new Ct;const s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],d=r[5],h=r[6],u=r[7],m=r[8],g=m*c-d*u,f=-m*l+d*h,p=u*l-c*h;let y=s*g+o*f+a*p;return y?(y=1/y,n.elements[0]=g*y,n.elements[1]=(-m*o+a*u)*y,n.elements[2]=(d*o-a*c)*y,n.elements[3]=f*y,n.elements[4]=(m*s-a*h)*y,n.elements[5]=(-d*s+a*l)*y,n.elements[6]=p*y,n.elements[7]=(-u*s+o*h)*y,n.elements[8]=(c*s-o*l)*y,n):null}scale(n,r){return arguments.length<=1&&(r=n),this.multiply(n,0,0,0,r,0,0,0,1)}rotate(n){const r=op(n),s=ap(n);return this.multiply(r,-s,0,s,r,0,0,0,1)}translate(n,r){return this.multiply(1,0,n,0,1,r,0,0,1)}skewX(n){const r=Ac(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Ac(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return mo.length=0,this.toTransformArray(n,mo),mo.map(cn).join(" ")}toTransformArray(n,r){const s=this.elements,o=!!r,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],u=s[5];if(n){const m=s[6],g=s[7],f=s[8];if(o){r[0]=a,r[1]=d,r[2]=m,r[3]=l,r[4]=h,r[5]=g,r[6]=c,r[7]=u,r[8]=f;return}return[a,d,m,l,h,g,c,u,f]}if(o){r[0]=a,r[1]=d,r[2]=l,r[3]=h,r[4]=c,r[5]=u;return}return[a,d,l,h,c,u]}toArray(n,r){const s=this.elements,o=!!r,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],u=s[5];if(n){const m=s[6],g=s[7],f=s[8];if(o){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=h,r[5]=u,r[6]=m,r[7]=g,r[8]=f;return}return[a,l,c,d,h,u,m,g,f]}if(o){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=h,r[5]=u;return}return[a,l,c,d,h,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ct().copy(this)}};x(Ct,"Identity",[1,0,0,0,1,0,0,0,1]);let ar=Ct;Dm(ar);const Cr=class Cr extends or{constructor(){super();x(this,"_flagMatrix",!0);x(this,"_flagScale",!1);x(this,"_matrix",null);x(this,"_worldMatrix",null);x(this,"_position",null);x(this,"_rotation",0);x(this,"_scale",1);x(this,"_skewX",0);x(this,"_skewY",0);for(let n in es)Object.defineProperty(this,n,es[n]);this._renderer.flagMatrix=Vc.bind(this),this.isShape=!0,this.matrix=new ar,this.worldMatrix=new ar,this.position=new ge,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Cr().copy(n);return"id"in n&&(r.id=n.id),r}get renderer(){return this._renderer}set renderer(n){this._renderer=n}get translation(){return es.position.get.apply(this,arguments)}set translation(n){es.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof ge?this.position=n.position:this.position.copy(n.position)),"rotation"in n&&(this.rotation=n.rotation),"scale"in n&&(this.scale=typeof n.scale=="number"||n.scale instanceof ge?n.scale:new ge(n.scale.x,n.scale.y)),"skewX"in n&&(this.skewX=n.skewX),"skewY"in n&&(this.skewY=n.skewY),"matrix"in n&&n.matrix.manual&&(this.matrix.copy(n.matrix),this.matrix.manual=!0),this}clone(n){const r=new Cr;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof ge?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}_update(n){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof ge?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),n&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};x(Cr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let wn=Cr;const es={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(U.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(U.Types.change,this._renderer.flagMatrix),Vc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof ge&&this._scale.unbind(U.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof ge&&this._scale.bind(U.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Hm(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Vc(){this._flagMatrix=!0}const Oi=Math.min,Ii=Math.max,lp=Math.ceil,cp=Math.floor,dp=new ge,Gt=class Gt extends wn{constructor(n,r,s,o){super();x(this,"_flagVertices",!0);x(this,"_flagLength",!0);x(this,"_flagFill",!0);x(this,"_flagStroke",!0);x(this,"_flagLinewidth",!0);x(this,"_flagOpacity",!0);x(this,"_flagVisible",!0);x(this,"_flagCap",!0);x(this,"_flagJoin",!0);x(this,"_flagMiter",!0);x(this,"_flagStrokeAttenuation",!0);x(this,"_flagMask",!1);x(this,"_flagClip",!1);x(this,"_length",0);x(this,"_fill","#fff");x(this,"_stroke","#000");x(this,"_linewidth",1);x(this,"_opacity",1);x(this,"_visible",!0);x(this,"_cap","round");x(this,"_join","round");x(this,"_miter",4);x(this,"_closed",!0);x(this,"_curved",!1);x(this,"_automatic",!0);x(this,"_beginning",0);x(this,"_ending",1);x(this,"_mask",null);x(this,"_clip",!1);x(this,"_dashes",null);x(this,"_strokeAttenuation",!0);for(let a in Oc)Object.defineProperty(this,a,Oc[a]);this._renderer.type="path",this._renderer.flagVertices=Ic.bind(this),this._renderer.bindVertices=zc.bind(this),this._renderer.unbindVertices=Lc.bind(this),this._renderer.flagFill=Dc.bind(this),this._renderer.flagStroke=Hc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!s,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=n,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ii(n.fill),s=typeof n.stroke=="string"?n.stroke:ii(n.stroke),o=new Gt().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){if(super.copy.call(this,n),n.vertices){this.vertices=[];for(let r=0;r<n.vertices.length;r++){const s=n.vertices[r];s instanceof Re?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Re().copy(s))}}for(let r=0;r<Gt.Properties.length;r++){const s=Gt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new Gt;for(let s=0;s<this.vertices.length;s++)r.vertices.push(this.vertices[s].clone());for(let s=0;s<Gt.Properties.length;s++){const o=Gt.Properties[s];r[o]=this[o]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),$e.each(Gt.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,s=n.height/2,o=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=o,c.y-=a,c.x+=r,c.y+=s}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=s),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,s=n.top+n.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const a=this.vertices[o];a.x-=r,a.y-=s}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=s),this}getBoundingClientRect(n){let r,s,o,a,l,c,d=1/0,h=-1/0,u=1/0,m=-1/0;if(this._update(!0),r=n?this.matrix:this.worldMatrix,s=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:g,scaleY:f}=Lm(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof f=="number"&&(s=Math.max(g,f)*(this.linewidth||0)/2)}else s*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(a=0;a<o;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+o-1)%o];const[g,f]=r.multiply(l.x,l.y),[p,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let b=l.controls.right.x,_=l.controls.right.y;l.relative&&(b+=l.x,_+=l.y);let[C,S]=r.multiply(b,_),v=c.controls.left.x,B=c.controls.left.y;c.relative&&(v+=c.x,B+=c.y);let[k,R]=r.multiply(v,B);const $=Xm(g,f,C,S,k,R,p,y);u=Oi($.min.y-s,u),d=Oi($.min.x-s,d),h=Ii($.max.x+s,h),m=Ii($.max.y+s,m)}else a<=1&&(u=Oi(f-s,u),d=Oi(g-s,d),h=Ii(g+s,h),m=Ii(f+s,m)),u=Oi(y-s,u),d=Oi(p-s,d),h=Ii(p+s,h),m=Ii(y+s,m)}return{top:u,left:d,right:h,bottom:m,width:h-d,height:m-u}}getPointAt(n,r){let s,o,a,l,c,d,h,u,m,g,f,p,y,b,_,C=this.length*Math.min(Math.max(n,0),1);const S=this.vertices.length,v=S-1;let B=null,k=null;for(let N=0,H=this._lengths.length,q=0;N<H;N++){if(q+this._lengths[N]>=C){this._closed?(s=Vi(N,S),o=Vi(N-1,S),N===0&&(s=o,o=N)):(s=N,o=Math.min(Math.max(N-1,0),v)),B=this.vertices[s],k=this.vertices[o],C-=q,this._lengths[N]!==0?n=C/this._lengths[N]:n=0;break}q+=this._lengths[N]}if(B===null||k===null)return null;if(B){if(!k)return B}else return k;_=k.controls&&k.controls.right,b=B.controls&&B.controls.left,c=k.x,g=k.y,d=(_||k).x,f=(_||k).y,h=(b||B).x,p=(b||B).y,u=B.x,y=B.y,_&&k.relative&&(d+=k.x,f+=k.y),b&&B.relative&&(h+=B.x,p+=B.y),l=Kr(n,c,d,h,u),m=Kr(n,g,f,p,y);const R=Ht(c,d,n),$=Ht(g,f,n),P=Ht(d,h,n),I=Ht(f,p,n),V=Ht(h,u,n),A=Ht(p,y,n),L=Ht(R,P,n),D=Ht($,I,n),ee=Ht(P,V,n),E=Ht(I,A,n);return $e.isObject(r)?(r.x=l,r.y=m,r instanceof Re&&(r.controls.left.x=L,r.controls.left.y=D,r.controls.right.x=ee,r.controls.right.y=E,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=m,r.controls.right.x-=l,r.controls.right.y-=m)),r.t=n,r):(a=new Re(l,m,L-l,D-m,ee-l,E-m,this._curved?he.curve:he.line),a.t=n,a)}plot(){if(this.curved)return Um(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?he.move:he.line;return this}subdivide(n){this._update();const r=this.vertices.length-1,s=this._closed||this.vertices[r]._command===he.close;let o=this.vertices[r],a=[],l;return $e.each(this.vertices,function(c,d){if(d<=0&&!s){o=c;return}if(c.command===he.move){a.push(new Re(o.x,o.y)),d>0&&(a[a.length-1].command=he.line),o=c;return}l=Mc(c,o,n),a=a.concat(l),$e.each(l,function(h,u){u<=0&&o.command===he.move?h.command=he.move:h.command=he.line}),d>=r&&(this._closed&&this._automatic&&(o=c,l=Mc(c,o,n),a=a.concat(l),$e.each(l,function(h,u){u<=0&&o.command===he.move?h.command=he.move:h.command=he.line})),a.push(new Re(c.x,c.y)),a[a.length-1].command=s?he.close:he.line),o=c},this),this._automatic=!1,this._curved=!1,this.vertices=a,this}_updateLength(n,r){r||this._update();const o=this.vertices.length-1;let a=this.vertices[o],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),$e.each(this.vertices,function(c,d){if(d<=0||c.command===he.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Fc(c,a,n),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const n=this._collection.length,r=this._closed,s=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),a=Jr(this,s*this._length),l=Jr(this,o*this._length),c=lp(a),d=cp(l);let h,u,m,g,f,p;for(this._renderer.vertices.length=0,p=0;p<n;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Re),p>d&&!u?(f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,f),f.command=this._renderer.collection[p].command,this._renderer.vertices.push(f),u=f,m=this._collection[p-1],m&&m.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f),m.relative?this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(ge.zero,1-f.t):this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(m,1-f.t))):p>=c&&p<=d&&(f=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(f),p===d&&Pc(this,o)?(u=f,!r&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):p===c&&Pc(this,s)&&(h=f,h.command=he.move,!r&&h.controls&&(h.relative?h.controls.left.clear():h.controls.left.copy(h))));c>0&&!h&&(p=c-1,f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,f),f.command=he.move,this._renderer.vertices.unshift(f),g=this._collection[p+1],g&&g.controls&&(f.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(ge.zero,f.t):(dp.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,f.t))))}return wn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,wn.prototype.flagReset.call(this),this}};x(Gt,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),x(Gt,"Utils",{getCurveLength:Fc});let Ee=Gt;const Oc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.unbind(U.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.bind(U.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.unbind(U.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.bind(U.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";$e.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(U.Types.insert,e).unbind(U.Types.remove,n),t instanceof ti?this._collection=t:this._collection=new ti(t||[]),this._collection.bind(U.Types.insert,e).bind(U.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,$e.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Ic(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function zc(t){let e=t.length;for(;e--;)t[e].bind(U.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Lc(t){let e=t.length;for(;e--;)t[e].unbind(U.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Dc(){this._flagFill=!0}function Hc(){this._flagStroke=!0}const hp=Math.ceil,up=Math.floor,mn=class mn extends wn{constructor(n){super();x(this,"_flagVertices",!0);x(this,"_flagLength",!0);x(this,"_flagFill",!0);x(this,"_flagStroke",!0);x(this,"_flagLinewidth",!0);x(this,"_flagOpacity",!0);x(this,"_flagVisible",!0);x(this,"_flagSize",!0);x(this,"_flagSizeAttenuation",!0);x(this,"_flagStrokeAttenuation",!0);x(this,"_length",0);x(this,"_fill","#fff");x(this,"_stroke","#000");x(this,"_linewidth",1);x(this,"_opacity",1);x(this,"_visible",!0);x(this,"_size",1);x(this,"_sizeAttenuation",!1);x(this,"_beginning",0);x(this,"_ending",1);x(this,"_dashes",null);x(this,"_strokeAttenuation",!0);x(this,"noFill",Ee.prototype.noFill);x(this,"noStroke",Ee.prototype.noStroke);x(this,"corner",Ee.prototype.corner);x(this,"center",Ee.prototype.center);x(this,"getBoundingClientRect",Ee.prototype.getBoundingClientRect);x(this,"_updateLength",Ee.prototype._updateLength);for(let r in Wc)Object.defineProperty(this,r,Wc[r]);this._renderer.type="points",this._renderer.flagVertices=Ic.bind(this),this._renderer.bindVertices=zc.bind(this),this._renderer.unbindVertices=Lc.bind(this),this._renderer.flagFill=Dc.bind(this),this._renderer.flagStroke=Hc.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=n,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ii(n.fill),s=typeof n.stroke=="string"?n.stroke:ii(n.stroke),o=new mn().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const s=n.vertices[r];s instanceof Re?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Re().copy(s))}for(let r=0;r<mn.Properties.length;r++){const s=mn.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new mn;for(let s=0;s<this.vertices.length;s++)r.vertices.push(this.vertices[s].clone());for(let s=0;s<mn.Properties.length;s++){const o=mn.Properties[s];r[o]=this[o]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),$e.each(mn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(n){this._update();let r=[];for(let s=0;s<this.vertices.length;s++){const o=this.vertices[s],a=this.vertices[s-1];if(!a)continue;const l=o.x,c=o.y,d=a.x,h=a.y,u=kc(l,c,l,c,d,h,d,h,n);r=r.concat(u)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),s=Jr(this,n*this._length),o=Jr(this,r*this._length),a=hp(s),l=up(o);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let h=0;h<this._collection.length;h++)h>=a&&h<=l&&(d=this._collection[h],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}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}};x(mn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let ts=mn;const Wc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.unbind(U.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.bind(U.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.unbind(U.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.bind(U.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(U.Types.insert,e).unbind(U.Types.remove,n),t instanceof ti?this._collection=t:this._collection=new ti(t||[]),this._collection.bind(U.Types.insert,e).bind(U.Types.remove,n),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class jc extends ti{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);Aa(this,Rs,{});this.attach(n),this.on(U.Types.insert,this.attach),this.on(U.Types.remove,this.detach)}get ids(){return Bt(this,Rs)}attach(n){for(let r=0;r<n.length;r++){const s=n[r];s&&s.id&&(this.ids[s.id]=s)}return this}detach(n){for(let r=0;r<n.length;r++)delete this.ids[n[r].id];return this}}Rs=new WeakMap;const Sn=class Sn extends Ee{constructor(n,r,s,o,a,l,c){const d=c||go.Resolution*3,h=[];for(let u=0;u<d;u++)h.push(new Re);super(h,!0,!1,!0);x(this,"_flagStartAngle",!1);x(this,"_flagEndAngle",!1);x(this,"_flagInnerRadius",!1);x(this,"_flagOuterRadius",!1);x(this,"_startAngle",0);x(this,"_endAngle",ei);x(this,"_innerRadius",0);x(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let u in qc)Object.defineProperty(this,u,qc[u]);typeof s=="number"&&(this.innerRadius=s),typeof o=="number"&&(this.outerRadius=o),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Sn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Sn.Properties.length;r++){const s=Sn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const n=this._startAngle,r=this._endAngle,s=this._innerRadius,o=this._outerRadius,a=Vi(n,ei)===Vi(r,ei),l=s>0,c=this.vertices;let d=l?c.length/2:c.length,h,u=0,m,g,f,p,y,b,_,C,S;for(a?d--:l||(d-=2),m=0,g=d-1;m<d;m++){switch(f=m/g,p=c[u],y=f*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),C=o*Math.sin(y),m){case 0:h=he.move;break;default:h=he.curve}p.command=h,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===he.curve&&(S=o*b/Math.PI,p.controls.left.x=S*Math.cos(y-it),p.controls.left.y=S*Math.sin(y-it),p.controls.right.x=S*Math.cos(y+it),p.controls.right.y=S*Math.sin(y+it),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),u++}if(l){for(a?(c[u].command=he.close,u++):(d--,g=d-1),m=0;m<d;m++)f=m/g,p=c[u],y=(1-f)*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),C=s*Math.sin(y),h=he.curve,m<=0&&(h=a?he.move:he.line),p.command=h,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===he.curve&&(S=s*b/Math.PI,p.controls.left.x=S*Math.cos(y+it),p.controls.left.y=S*Math.sin(y+it),p.controls.right.x=S*Math.cos(y-it),p.controls.right.y=S*Math.sin(y-it),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),u++;c[u].copy(c[0]),c[u].command=he.line}else a||(c[u].command=he.line,c[u].x=0,c[u].y=0,u++,c[u].copy(c[0]),c[u].command=he.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,s=this.outerRadius,o=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Sn(0,0,r,s,o,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Ee.Properties.length;d++){const h=Ee.Properties[d];c[h]=this[h]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<Sn.Properties.length;r++){const s=Sn.Properties[r];n[s]=this[s]}return n}};x(Sn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let po=Sn;const qc={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},yo=Math.cos,bo=Math.sin,Bn=class Bn extends Ee{constructor(n,r,s,o){const a=o?Math.max(o,2):4,l=[];for(let c=0;c<a;c++)l.push(new Re(0,0,0,0,0,0));super(l,!0,!0,!0);x(this,"_flagRadius",!1);x(this,"_radius",0);this._renderer.type="circle";for(let c in Xc)Object.defineProperty(this,c,Xc[c]);typeof s=="number"&&(this.radius=s),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Bn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Bn.Properties.length;r++){const s=Bn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagRadius){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(n*2)),s=this._radius,o=s*r;for(let a=0;a<this.vertices.length;a++){const c=a/n*ei,d=s*yo(c),h=s*bo(c),u=o*yo(c-it),m=o*bo(c-it),g=o*yo(c+it),f=o*bo(c+it),p=this.vertices[a];p.command=a===0?he.move:he.curve,p.set(d,h),p.controls.left.set(u,m),p.controls.right.set(g,f)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new Bn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Ee.Properties.length;s++){const o=Ee.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<Bn.Properties.length;r++){const s=Bn.Properties[r];n[s]=this[s]}return n}};x(Bn,"Properties",["radius"]);let _o=Bn;const Xc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},wo=Math.cos,xo=Math.sin,Tn=class Tn extends Ee{constructor(n,r,s,o,a){typeof o!="number"&&typeof s=="number"&&(o=s);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Re);super(c,!0,!0,!0);x(this,"_flagWidth",!1);x(this,"_flagHeight",!1);x(this,"_width",0);x(this,"_height",0);this._renderer.type="ellipse";for(let d in Yc)Object.defineProperty(this,d,Yc[d]);typeof s=="number"&&(this.width=s*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Tn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Tn.Properties.length;r++){const s=Tn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),s=this._width/2,o=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/n*ei,d=s*wo(c),h=o*xo(c),u=s*r*wo(c-it),m=o*r*xo(c-it),g=s*r*wo(c+it),f=o*r*xo(c+it),p=this.vertices[a];p.command=a===0?he.move:he.curve,p.set(d,h),p.controls.left.set(u,m),p.controls.right.set(g,f)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,s=this.height/2,o=this.vertices.length,a=new Tn(0,0,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<Ee.Properties.length;l++){const c=Ee.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="ellipse";for(let r=0;r<Tn.Properties.length;r++){const s=Tn.Properties[r];n[s]=this[s]}return n}};x(Tn,"Properties",["width","height"]);let vo=Tn;const Yc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},fp=Math.cos,gp=Math.sin,Rn=class Rn extends Ee{constructor(n,r,s,o){o=Math.max(o||0,3);super();x(this,"_flagWidth",!1);x(this,"_flagHeight",!1);x(this,"_flagSides",!1);x(this,"_radius",0);x(this,"_width",0);x(this,"_height",0);x(this,"_sides",0);this._renderer.type="polygon";for(let a in Uc)Object.defineProperty(this,a,Uc[a]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof o=="number"&&(this.sides=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Rn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Rn.Properties.length;r++){const s=Rn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const n=this._sides,r=n+1;let s=this.vertices.length;s>n&&(this.vertices.splice(n-1,s-n),s=n);for(let o=0;o<r;o++){const a=(o+.5)/n,l=ei*a+Math.PI/2,c=this._width*fp(l)/2,d=this._height*gp(l)/2;o>=s?this.vertices.push(new Re(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?he.move:he.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=new Rn(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Ee.Properties.length;s++){const o=Ee.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<Rn.Properties.length;r++){const s=Rn.Properties[r];n[s]=this[s]}return n}};x(Rn,"Properties",["width","height","sides"]);let ko=Rn;const Uc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},bi=class bi extends Ee{constructor(n,r,s,o){const a=[new Re,new Re,new Re,new Re];super(a,!0,!1,!0);x(this,"_flagWidth",!1);x(this,"_flagHeight",!1);x(this,"_width",0);x(this,"_height",0);x(this,"_origin",null);this._renderer.type="rectangle";for(let l in Gc)Object.defineProperty(this,l,Gc[l]);this.width=typeof s=="number"?s:1,this.height=typeof o=="number"?o:1,this.origin=new ge,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new bi().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<bi.Properties.length;r++){const s=bi.Properties[r];s in n&&(typeof n[s]=="number"?this[s]=n[s]:this[s]instanceof ge&&this[s].copy(n[s]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const n=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Re),this.vertices[0].set(-n,-r).sub(this._origin).command=he.move,this.vertices[1].set(n,-r).sub(this._origin).command=he.line,this.vertices[2].set(n,r).sub(this._origin).command=he.line,this.vertices[3].set(-n,r).sub(this._origin).command=he.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=he.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new bi(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Ee.Properties.length;s++){const o=Ee.Properties[s];r[o]instanceof ge?r[o].copy(this[o]):r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="rectangle",n.width=this.width,n.height=this.height,n.origin=this.origin.toObject(),n}};x(bi,"Properties",["width","height","origin"]);let lr=bi;const Gc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(U.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(U.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},$n=class $n extends Ee{constructor(n,r,s,o,a){typeof a>"u"&&typeof s=="number"&&typeof o=="number"&&(a=Math.floor(Math.min(s,o)/12));const l=[];for(let c=0;c<10;c++)l.push(new Re(0,0,0,0,0,0,c===0?he.move:he.curve));super(l);x(this,"_flagWidth",!1);x(this,"_flagHeight",!1);x(this,"_flagRadius",!1);x(this,"_width",0);x(this,"_height",0);x(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in Kc)Object.defineProperty(this,c,Kc[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=mp.bind(this),typeof s=="number"&&(this.width=s),typeof o=="number"&&(this.height=o),(typeof a=="number"||a instanceof ge)&&(this.radius=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new $n().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<$n.Properties.length;r++){const s=$n.Properties[r];if(s in n){const o=n[s];/radius/i.test(s)?this[s]=typeof o=="number"||o instanceof ge?o:new ge().copy(o):typeof o=="number"&&(this[s]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const n=this._width,r=this._height;let s,o;this._radius instanceof ge?(s=this._radius.x,o=this._radius.y):(s=this._radius,o=this._radius);let a,l=n/2,c=r/2;a=this.vertices[0],a.x=-(l-s),a.y=-c,a=this.vertices[1],a.x=l-s,a.y=-c,a.controls.left.clear(),a.controls.right.x=s,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-o),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-o,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=o,a=this.vertices[4],a.x=l-s,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-s),a.y=c,a.controls.left.clear(),a.controls.right.x=-s,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-o,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-o),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-o,a=this.vertices[8],a.x=-(l-s),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.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(n){const r=this.width,s=this.height,o=this.radius,a=new $n(0,0,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<Ee.Properties.length;l++){const c=Ee.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<$n.Properties.length;r++){const s=$n.Properties[r];n[s]=this[s]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};x($n,"Properties",["width","height","radius"]);let Co=$n;const Kc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof ge&&this._radius.unbind(U.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof ge&&this._radius.bind(U.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function mp(){this._flagRadius=!0}const pp=Math.cos,yp=Math.sin,En=class En extends Ee{constructor(n,r,s,o,a){arguments.length<=3&&(o=s,s=o/2),(typeof a!="number"||a<=0)&&(a=5);super();x(this,"_flagInnerRadius",!1);x(this,"_flagOuterRadius",!1);x(this,"_flagSides",!1);x(this,"_innerRadius",0);x(this,"_outerRadius",0);x(this,"_sides",0);this._renderer.type="star";for(let l in Zc)Object.defineProperty(this,l,Zc[l]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.innerRadius=s),typeof o=="number"&&(this.outerRadius=o),typeof a=="number"&&(this.sides=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new En().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<En.Properties.length;r++){const s=En.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const n=this._sides*2,r=n+1;let s=this.vertices.length;s>n&&(this.vertices.splice(n-1,s-n),s=n);for(let o=0;o<r;o++){const a=(o+.5)/n,l=ei*a,c=(o%2?this._outerRadius:this._innerRadius)/2,d=c*pp(l),h=c*yp(l);o>=s?this.vertices.push(new Re(d,h)):this.vertices[o].set(d,h),this.vertices[o].command=o===0?he.move:he.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=this.innerRadius,s=this.outerRadius,o=this.sides,a=new En(0,0,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<Ee.Properties.length;l++){const c=Ee.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<En.Properties.length;r++){const s=En.Properties[r];n[s]=this[s]}return n}};x(En,"Properties",["innerRadius","outerRadius","sides"]);let So=En;const Zc={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}};let Bo;const Qc=Math.min,Jc=Math.max;ln.document&&(Bo=document.createElement("canvas"));const gt=class gt extends wn{constructor(n,r,s,o){super();x(this,"_flagValue",!0);x(this,"_flagFamily",!0);x(this,"_flagSize",!0);x(this,"_flagLeading",!0);x(this,"_flagAlignment",!0);x(this,"_flagBaseline",!0);x(this,"_flagStyle",!0);x(this,"_flagWeight",!0);x(this,"_flagDecoration",!0);x(this,"_flagFill",!0);x(this,"_flagStroke",!0);x(this,"_flagLinewidth",!0);x(this,"_flagOpacity",!0);x(this,"_flagVisible",!0);x(this,"_flagMask",!1);x(this,"_flagClip",!1);x(this,"_flagDirection",!0);x(this,"_flagStrokeAttenuation",!0);x(this,"_value","");x(this,"_family","sans-serif");x(this,"_size",13);x(this,"_leading",17);x(this,"_alignment","center");x(this,"_baseline","middle");x(this,"_style","normal");x(this,"_weight",500);x(this,"_decoration","none");x(this,"_direction","ltr");x(this,"_fill","#000");x(this,"_stroke","none");x(this,"_linewidth",1);x(this,"_opacity",1);x(this,"_visible",!0);x(this,"_mask",null);x(this,"_clip",!1);x(this,"_dashes",null);x(this,"_strokeAttenuation",!0);for(let a in ed)Object.defineProperty(this,a,ed[a]);if(this._renderer.type="text",this._renderer.flagFill=bp.bind(this),this._renderer.flagStroke=_p.bind(this),this.value=n,typeof r=="number"&&(this.translation.x=r),typeof s=="number"&&(this.translation.y=s),this.dashes=[],this.dashes.offset=0,!$e.isObject(o))return this;for(let a=0;a<gt.Properties.length;a++){const l=gt.Properties[a];l in o&&(this[l]=o[l])}}static Measure(n){if(Bo){const r=Bo.getContext("2d");r.font=[n._style,n._weight,`${n._size}px/${n._leading}px`,n._family].join(" ");const s=r.measureText(n.value,0,0),o=s.actualBoundingBoxDescent+s.actualBoundingBoxAscent;return{width:s.width,height:o}}else{const r=this.value.length*this.size*gt.Ratio,s=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:s}}}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ii(n.fill),s=typeof n.stroke=="string"?n.stroke:ii(n.stroke),o=new gt().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n);for(let r=0;r<gt.Properties.length;r++){const s=gt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new gt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let s=0;s<gt.Properties.length;s++){const o=gt.Properties[s];r[o]=this[o]}return this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);n.renderer.type="text";for(let r=0;r<gt.Properties.length;r++){const s=gt.Properties[r];n[s]=this[s]}return n}dispose(){return super.dispose(),typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,s,o,a,l;this._update(!0),r=n?this.matrix:this.worldMatrix;const{width:c,height:d}=gt.Measure(this),h=(this._linewidth||0)/2;switch(this.alignment){case"left":s=-h,o=c+h;break;case"right":s=-(c+h),o=h;break;default:s=-(c/2+h),o=c/2+h}switch(this.baseline){case"middle":a=-(d/2+h),l=d/2+h;break;default:a=-(d+h),l=h}const[u,m]=r.multiply(s,a),[g,f]=r.multiply(s,l),[p,y]=r.multiply(o,a),[b,_]=r.multiply(o,l);return a=Qc(m,f,y,_),s=Qc(u,g,p,b),o=Jc(u,g,p,b),l=Jc(m,f,y,_),{top:a,left:s,right:o,bottom:l,width:o-s,height:l-a}}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}};x(gt,"Ratio",.6),x(gt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let zi=gt;const ed={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.unbind(U.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof Je||this._fill instanceof xt||this._fill instanceof vt||this._fill instanceof qe)&&this._fill.bind(U.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.unbind(U.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof Je||this._stroke instanceof xt||this._stroke instanceof vt||this._stroke instanceof qe)&&this._stroke.bind(U.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,$e.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function bp(){this._flagFill=!0}function _p(){this._flagStroke=!0}const Nn=class Nn extends lr{constructor(n,r,s,o){super(r,s,0,0);x(this,"_flagTextures",!1);x(this,"_flagFrameRate",!1);x(this,"_flagIndex",!1);x(this,"_amount",1);x(this,"_duration",0);x(this,"_index",0);x(this,"_startTime",0);x(this,"_playing",!1);x(this,"_firstFrame",0);x(this,"_lastFrame",0);x(this,"_loop",!0);x(this,"_textures",null);x(this,"_frameRate",0);x(this,"_origin",null);this._renderer.type="image-sequence";for(let a in td)Object.defineProperty(this,a,td[a]);this._renderer.flagTextures=wp.bind(this),this._renderer.bindTextures=xp.bind(this),this._renderer.unbindTextures=vp.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(nd.bind(this)):typeof n=="string"&&(this.textures=[nd(n)]),this.origin=new ge,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=Nn.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Nn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Nn.Properties.length;r++){const s=Nn.Properties[r];s in n&&(this[s]=n[s])}return this}play(n,r,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=$e.performance.now(),typeof n=="number"&&(this._firstFrame=n),typeof r=="number"&&(this._lastFrame=r),typeof s=="function"?this._onLastFrame=s: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(n){const r=new Nn(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="image-sequence",n.textures=this.textures.map(function(r){return r.toObject()}),n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let n=0;n<this.textures.length;n++){const r=this.textures[n];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const n=this._textures;let r,s,o,a,l,c,d,h;return n&&(this._flagTextures&&(this._amount=n.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,$e.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=$e.performance.now()-this._startTime,h=this._lastFrame+1,l=1e3*(h-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),d=Ht(this._firstFrame,h,o/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=n[this._index],c.loaded&&(r=c.image.width,s=c.image.height,this.width!==r&&(this.width=r),this.height!==s&&(this.height=s),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof qe))&&(c=n[this._index],c.loaded&&(r=c.image.width,s=c.image.height,this.width!==r&&(this.width=r),this.height!==s&&(this.height=s)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};x(Nn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),x(Nn,"DefaultFrameRate",30);let To=Nn;const td={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(U.Types.insert,e).unbind(U.Types.remove,n),this._textures=new ti((t||[]).slice(0)),this._textures.bind(U.Types.insert,e).bind(U.Types.remove,n),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function wp(){this._flagTextures=!0}function xp(t){let e=t.length;for(;e--;)t[e].bind(U.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function vp(t){let e=t.length;for(;e--;)t[e].unbind(U.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function nd(t){if(t instanceof qe)return t;if(typeof t=="string")return new qe(t)}const _i=class _i extends lr{constructor(n,r,s,o,a,l){super(r,s,0,0);x(this,"_flagTexture",!1);x(this,"_flagColumns",!1);x(this,"_flagRows",!1);x(this,"_flagFrameRate",!1);x(this,"_flagIndex",!1);x(this,"_amount",1);x(this,"_duration",0);x(this,"_startTime",0);x(this,"_playing",!1);x(this,"_firstFrame",0);x(this,"_lastFrame",0);x(this,"_loop",!0);x(this,"_texture",null);x(this,"_columns",1);x(this,"_rows",1);x(this,"_frameRate",0);x(this,"_index",0);x(this,"_origin",null);this._renderer.type="sprite";for(let c in id)Object.defineProperty(this,c,id[c]);this.noStroke(),this.noFill(),n instanceof qe?this.texture=n:typeof n=="string"&&(this.texture=new qe(n)),this.origin=new ge,this._update(),typeof o=="number"&&(this.columns=o),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(n){const r=new _i().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<_i.Properties.length;r++){const s=_i.Properties[r];s in n&&(this[s]=n[s])}return this}play(n,r,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=$e.performance.now(),typeof n=="number"&&(this._firstFrame=n),typeof r=="number"&&(this._lastFrame=r),typeof s=="function"?this._onLastFrame=s: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(n){const r=new _i(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&r.play(this._firstFrame,this._lastFrame),r.loop=this.loop,r.firstFrame=this.firstFrame,r.lastFrame=this.lastFrame,n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="sprite",n.texture=this.texture.toObject(),n.columns=this.columns,n.rows=this.rows,n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const n=this._texture,r=this._columns,s=this._rows;let o,a,l,c,d,h,u,m,g;if(n&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=n),n.loaded)){u=n.image.width,m=n.image.height,o=u/r,a=m/s,c=this._amount,this.width!==o&&(this.width=o),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&($e.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=$e.performance.now()-this._startTime,g=this._lastFrame+1,d=1e3*(g-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),h=Ht(this._firstFrame,g,l/d),h=Math.floor(h),h!==this._index&&(this._index=h,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const f=this._index%r,p=Math.floor(this._index/r),y=-o*f+(u-o)/2,b=-a*p+(m-a)/2;y!==n.offset.x&&(n.offset.x=y),b!==n.offset.y&&(n.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};x(_i,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Ro=_i;const id={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},ns=Math.min,is=Math.max,Kt=class Kt extends wn{constructor(n){super();x(this,"_flagAdditions",!1);x(this,"_flagSubtractions",!1);x(this,"_flagOrder",!1);x(this,"_flagOpacity",!0);x(this,"_flagBeginning",!1);x(this,"_flagEnding",!1);x(this,"_flagLength",!1);x(this,"_flagMask",!1);x(this,"_fill","#fff");x(this,"_stroke","#000");x(this,"_linewidth",1);x(this,"_opacity",1);x(this,"_visible",!0);x(this,"_cap","round");x(this,"_join","round");x(this,"_miter",4);x(this,"_closed",!0);x(this,"_curved",!1);x(this,"_automatic",!0);x(this,"_beginning",0);x(this,"_ending",1);x(this,"_length",0);x(this,"_mask",null);x(this,"_strokeAttenuation",!0);for(let r in rd)Object.defineProperty(this,r,rd[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(n)?n:Array.prototype.slice.call(arguments)}static InsertChildren(n){for(let r=0;r<n.length;r++)sd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)sd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new Kt;for(let o=0;o<Kt.Properties.length;o++){const a=Kt.Properties[o];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:ii(n[a]):r[a]=n[a])}return"mask"in n&&(r.mask=s(n.mask)),"id"in n&&(r.id=n.id),r.children=n.children.map(s),r;function s(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return po.fromObject(o);case"circle":return _o.fromObject(o);case"element":return or.fromObject(o);case"ellipse":return vo.fromObject(o);case"group":return Kt.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return To.fromObject(o);case"path":return Ee.fromObject(o);case"points":return ts.fromObject(o);case"polygon":return ko.fromObject(o);case"rectangle":return lr.fromObject(o);case"rounded-rectangle":return Co.fromObject(o);case"shape":return wn.fromObject(o);case"sprite":return Ro.fromObject(o);case"star":return So.fromObject(o);case"text":return zi.fromObject(o)}return o}}copy(n){super.copy.call(this,n),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<Kt.Properties.length;r++){const s=Kt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new Kt,s=this.children.map(function(o){return o.clone()});return r.add(s),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,$e.each(this.children,(r,s)=>{n.children[s]=r.toObject()},this),n}dispose(){if(super.dispose(),this.children)for(let n=0;n<this.children.length;n++){const r=this.children[n];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}corner(){const n=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const s=this.children[r];s.translation.x-=n.left,s.translation.y-=n.top}return this.mask&&(this.mask.translation.x-=n.left,this.mask.translation.y-=n.top),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,s=n.top+n.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const a=this.children[o];a.isShape&&(a.translation.x-=r,a.translation.y-=s)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=s),this}getById(n){let r=null;function s(o){if(o.id===n)return o;if(o.children){if(o.children.ids[n])return o.children.ids[n];for(let a=0;a<o.children.length;a++)if(r=s(o.children[a]),r)return r}return null}return s(this)}getByClassName(n){const r=[];function s(o){if(Array.prototype.indexOf.call(o.classList,n)>=0&&r.push(o),o.children)for(let a=0;a<o.children.length;a++){const l=o.children[a];s(l)}return r}return s(this)}getByType(n){const r=[];function s(o){if(o instanceof n&&r.push(o),o.children)for(let a=0;a<o.children.length;a++){const l=o.children[a];s(l)}return r}return s(this)}add(n){n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let r=0;r<n.length;r++){const s=n[r];if(!(s&&s.id))continue;const o=Array.prototype.indexOf.call(this.children,s);o>=0&&this.children.splice(o,1),this.children.push(s)}return this}remove(n){const r=arguments.length,s=this.parent;if(r<=0&&s)return s.remove(this),this;n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let o=0;o<n.length;o++){const a=n[o];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(n){let r,s,o,a,l,c;this._update(!0);let d=1/0,h=-1/0,u=1/0,m=-1/0;const g=/texture|gradient/i;s=n?this.matrix:this.worldMatrix;for(let f=0;f<this.children.length;f++){const p=this.children[f];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),o=typeof r.top!="number"||$e.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||$e.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||$e.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||$e.isNaN(r.bottom)||!isFinite(r.bottom),!(o||a||l||c)))if(n){const[y,b]=s.multiply(r.left,r.top),[_,C]=s.multiply(r.right,r.top),[S,v]=s.multiply(r.left,r.bottom),[B,k]=s.multiply(r.right,r.bottom);u=ns(b,C,v,k,u),d=ns(y,_,S,B,d),h=is(y,_,S,B,h),m=is(b,C,v,k,m)}else u=ns(r.top,u),d=ns(r.left,d),h=is(r.right,h),m=is(r.bottom,m)}return{top:u,left:d,right:h,bottom:m,width:h-d,height:m-u}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,s;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=o*l,h=a*l;for(n=0;n<this.children.length;n++)s=this.children[n],r=s.length,d>c+r?(s.beginning=1,s.ending=1):h<c?(s.beginning=0,s.ending=0):d>c&&d<c+r?(s.beginning=(d-c)/r,s.ending=1):h>c&&h<c+r?(s.beginning=0,s.ending=(h-c)/r):(s.beginning=0,s.ending=1),c+=r}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}};x(Kt,"Children",jc),x(Kt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let xn=Kt;const rd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=xn.InsertChildren.bind(this),n=xn.RemoveChildren.bind(this),r=xn.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new jc(t),this._children.bind(U.Types.insert,e),this._children.bind(U.Types.remove,n),this._children.bind(U.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,$e.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function sd(t,e){const n=t.parent;let r;if(n===e){s();return}if(n&&n.children.ids[t.id]&&(r=Array.prototype.indexOf.call(n.children,t),n.children.splice(r,1),o()),e){s();return}o(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete t.parent;function s(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function o(){r=Array.prototype.indexOf.call(n.additions,t),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,t),r<0&&(n.subtractions.push(t),n._flagSubtractions=!0)}}class rs extends Ee{constructor(e,n,r,s){const o=[new Re(e,n),new Re(r,s)];super(o);for(let a in od)Object.defineProperty(this,a,od[a]);this.vertices[0].command=he.move,this.vertices[1].command=he.line,this.automatic=!1}}x(rs,"Properties",["left","right"]);const od={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if($e.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=he.move;else{const e=new Zr("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if($e.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=he.line;else{const e=new Zr("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class $o{constructor(e=0,n=0){this.x=e,this.y=n}}class ri{constructor(e=10,n=0,r="A"){x(this,"start",new $o);x(this,"end",new $o);this.width=e,this.angle=n,this.label=r}}const Ve={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},kp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Cp(t,e){return i.openBlock(),i.createElementBlock("svg",kp,[...e[0]||(e[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 ss=i.markRaw({name:"ion-close",render:Cp}),Sp={class:"mr-3 flex flex-col gap-2"},Bp=["onClick"],Tp={class:"h-full p-2"},Rp={},$p=i.defineComponent({...Rp,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(t,{emit:e}){const n=t,r=i.useTemplateRef("drawing-template-containers"),s=e;return i.onMounted(()=>{var o;(o=n.settings.allTemplates)==null||o.forEach((a,l)=>{var d;const c=(d=r.value)==null?void 0:d.at(l);c&&s("init-draw-template",c,a)})}),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=ss;return i.openBlock(),i.createBlock(i.unref(z.NScrollbar),{style:{"max-height":"12.5rem",width:"auto"},trigger:"none"},{default:i.withCtx(()=>[i.createElementVNode("div",Sp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(c,d)=>(i.openBlock(),i.createElementBlock("div",{key:d,class:"group relative"},[i.createVNode(i.unref(z.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===t.selectTemplateIndex}]),onClick:h=>s("template:select",d)},[i.createElementVNode("div",Tp,[i.createElementVNode("div",{ref_for:!0,ref:"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,Bp)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.label),1)]),_:2},1024),c.isCustom&&!c.isNewRec()?(i.openBlock(),i.createBlock(i.unref(z.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)]),_:1},8,["onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),ad=Zn($p,[["__scopeId","data-v-cf2c29de"]]),Ep={class:"flex gap-3"},Np={class:"kozyrek-preview w-fill h-[12.5rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},Pp={ref:"drawing-container",class:"size-full"},Fp={},ld=i.defineComponent({...Fp,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select"],setup(t,{emit:e}){const n=t,r=e,s=i.useTemplateRef("drawing-container");let o=[],a=[],l=[],c=null;const d=.75,h=i.computed(()=>n.value.configuratorParams.linesAngles.map((E,N)=>new ri(n.value.configuratorParams.linesWidths[N],E,`A-${N+1}`))),u=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),m=i.computed(()=>{var E,N;return n.value.configuratorParams.startTailType&&((E=n.settings.startTailConfigs)!=null&&E[n.value.configuratorParams.startTailType])?(N=n.settings.startTailConfigs)==null?void 0:N[n.value.configuratorParams.startTailType].points:[]}),g=i.computed(()=>{var E,N;return n.value.configuratorParams.endTailType&&((E=n.settings.endTailConfigs)!=null&&E[n.value.configuratorParams.endTailType])?(N=n.settings.endTailConfigs)==null?void 0:N[n.value.configuratorParams.endTailType].points:[]}),f=(E,N=!1)=>{E[0].start.x=0,E[0].start.y=0;let H=0;for(let q=0;q<E.length;q++){const Y=E[q],F=E[q-1]??new ri(0,H);H+=!N||q>1?F.angle:0;const M=(!N||q>0?Y.angle:0)+H;if(E[q].end.x=Y.width*Math.cos(M*Math.PI/180)+E[q].start.x,E[q].end.y=Y.width*Math.sin(M*Math.PI/180)+E[q].start.y,q<E.length-1){const Z=q+1;E[Z].start.x=E[q].end.x,E[Z].start.y=E[q].end.y}}return E},p=(E,N,H,q,Y=!1)=>{let F=f([...H,...q]);N.length>0&&(F=[...f(N),...F]);let M=0,Z=0,fe=0,ie=0;F.forEach(Ae=>{M=Math.min(M,Ae.start.x,Ae.end.x),Z=Math.min(Z,Ae.start.y,Ae.end.y),fe=Math.max(fe,Ae.start.x,Ae.end.x),ie=Math.max(ie,Ae.start.y,Ae.end.y)});let me,re;M===0&&Z===0&&fe===0&&ie===0?(me=1,re=1):(me=E.width/Math.abs(fe-M),re=(Y?E.height:E.height-Ve.colorSideLabel.size)/Math.abs(ie-Z));const Me=Math.min(me,re);return M=M<0?-M*Me:0,Z=Z<0?-Z*Me:0,[Me,M,Z]},y=E=>{const N=new ts([E]);return N._size=Ve.anchorPoint.size,N.fill=Ve.anchorPoint.color,N.stroke="transparent",N._linewidth=Ve.anchorPoint.strokeSize,l.push(N),N},b=(E,N)=>{if(l=[],n.settings.allowChangeFirstPoint){const H=E[0],q=new ge(H.vertices[0].x,H.vertices[0].y);q.bind(U.Types.change,()=>{H.vertices[0].copy(q)});const Y=y(q);N.add(Y)}E.forEach((H,q)=>{const Y=E[q+1],F=new ge(H.vertices[1].x,H.vertices[1].y);F.bind(U.Types.change,()=>{H.vertices[1].copy(F),Y!==void 0&&Y.vertices[0].copy(F)});const M=y(F);N.add(M)})},_=E=>E*(Math.PI/180),C=(E,N,H)=>{const q=N.vertices.length-1;E.position.x=N.vertices[q].x,E.position.y=N.vertices[q].y;const Y=Math.atan2(N.vertices[q].y-N.vertices[0].y,N.vertices[q].x-N.vertices[0].x);E.rotation=_(H)+Y},S=(E,N,H)=>{if(N.vertices[0]===void 0)return;E.position.x=N.vertices[0].x,E.position.y=N.vertices[0].y;const q=N.vertices.length-1,Y=Math.atan2(N.vertices[q].y-N.vertices[0].y,N.vertices[q].x-N.vertices[0].x);E.rotation=_(H)+Y},v=(E,N,H)=>{const q=new xn;if(E.length===0)return q;const Y=[];return[...E].reverse().forEach((F,M)=>{M!==0&&F.angle>0&&(F.angle*=-1),Y.push(F)}),E=f(Y,!0),S(q,N,E[0].angle),[N.vertices[0],N.vertices[1]].forEach(F=>{F.bind(U.Types.change,()=>{S(q,N,E[0].angle)})}),E.forEach(F=>{const M=F.start.x*H,Z=F.end.x*H,fe=F.start.y*H,ie=F.end.y*H,me=new rs(M,fe,Z,ie);me.linewidth=Ve.line.size,me.stroke=Ve.line.color,q.add(me)}),q},B=(E,N,H)=>{const q=new xn;return E.length===0||(E=f(E,!0),C(q,N,E[0].angle),[N.vertices[0],N.vertices[1]].forEach(Y=>{Y.bind(U.Types.change,()=>{C(q,N,E[0].angle)})}),E.forEach(Y=>{const F=Y.start.x*H,M=Y.end.x*H,Z=Y.start.y*H,fe=Y.end.y*H,ie=new rs(F,Z,M,fe);ie.linewidth=Ve.line.size,ie.stroke=Ve.line.color,q.add(ie)})),q},k=(E,N,H,q)=>{const Y=N.vertices[0].x+(N.vertices[1].x-N.vertices[0].x)/2-8*Math.sin(E.angle*Math.PI/180),F=N.vertices[0].y+(N.vertices[1].y-N.vertices[0].y)/2-8*Math.cos(E.angle*Math.PI/180),M=new zi(E.label,Y+10,F-10);let Z;M.size=Ve.lineLabel.size,M.weight=600,M.fill=Ve.lineLabel.color,M.id+=1,M.rotation=Ve.lineLabel.rotation,q>0&&(Z=new zi(`${E.angle}°`,N.vertices[0].x+25,N.vertices[0].y-25),Z.size=Ve.angleLabel.size,Z.weight=600,Z.fill=Ve.angleLabel.color,Z.rotation=Ve.angleLabel.rotation,Z.id+=q,o.push(Z),H.add(Z)),H.add(M),$(M,N,0,Z),$(M,N,1)},R=()=>{const{size:E}=Ve.colorSideLabel,N=0,H=0,q=u.value?E/2:E/2-E,Y=u.value?E/2-E:E/2,F=new xn;if(!c)return F;const M=5,Z=Math.atan2(Y-q,H-N),fe=[new Re(N,q,0,0,0,0,an.Commands.move),new Re(H,Y,0,0,0,0,an.Commands.line),new Re(H-M*Math.cos(Z-Math.PI/4),Y-M*Math.sin(Z-Math.PI/4),0,0,0,0,an.Commands.line),new Re(H,Y,0,0,0,0,an.Commands.move),new Re(H-M*Math.cos(Z+Math.PI/4),Y-M*Math.sin(Z+Math.PI/4),0,0,0,0,an.Commands.line)],ie=new Ee(fe,!1,!1,!0);ie.noFill(),ie.cap="round",ie.join="round",ie.linewidth=E/7,ie.stroke=Ve.colorSideLabel.color,F.add(ie);const me=new zi(u.value?"Цвет снизу":"Цвет сверху",10,0);me.size=E,me.weight=600,me.fill=Ve.colorSideLabel.color,me.alignment="left",F.add(me);const re=F.getBoundingClientRect();return F.position.x=(c.width-re.width)*d+10,F.position.y=u.value?c.height+re.height*2:re.height/2,F},$=(E,N,H,q)=>{N.vertices[H].bind(U.Types.change,()=>{const Y=N.vertices.length-1,F=Math.atan2(N.vertices[0].y-N.vertices[Y].y,N.vertices[0].x-N.vertices[Y].x)*180/Math.PI,M=N.vertices[0].x+(N.vertices[Y].x-N.vertices[0].x)/2-8*Math.sin(F*Math.PI/180),Z=N.vertices[0].y+(N.vertices[Y].y-N.vertices[0].y)/2-8*Math.cos(F*Math.PI/180);E.position.x=M+10,E.position.y=Z-10,E.rotation=-.5,q&&(q.position.x=N.vertices[0].x+25,q.position.y=N.vertices[0].y-25)})},P=(E,N,H,q,Y=!1)=>{var Oe;if(E.clear(),H.length===0){E.update();return}const F=f(H),[M,Z,fe]=p(E,N,F,q,Y),ie=new xn,me=new Array,re=new Array;Y||(o=[],a=[]),F.forEach((Le,pt)=>{const Zt=Le.start.x*M+Z,Qt=Le.end.x*M+Z,St=Le.start.y*M+fe,At=Le.end.y*M+fe,yt=new rs(Zt,St,Qt,At);yt.linewidth=Y?Ve.previewLine.size:Ve.line.size,yt.stroke=Y?Ve.previewLine.color:Ve.line.color,a.push(yt),me.push(yt),ie.add(yt),!Y&&Le.label!==""&&k(Le,yt,ie,pt)});const Me=me.at(-1);let Ae=ie.getBoundingClientRect();if(!Y){const Le=R();re.push(Le)}if(N.length>0){const Le=v(N,me[0],M);ie.add(Le)}if(q.length>0&&Me){const Le=B(q,Me,M);ie.add(Le)}if(re.push(ie),E.makeGroup(re),Ae=ie.getBoundingClientRect(),ie.position.x=0-Ae.left+(E.width-Ae.width)/(2*(Y?1:d)),ie.position.y=0-Ae.top+(E.height-Ae.height)/(2*(Y?1:d)),E.update(),!Y){const Le=((Oe=n.value.configuratorParams)==null?void 0:Oe.colorSide)==="top";ie.position.y=ie.position.y+Ve.colorSideLabel.size*Number(Le),b(me,ie),E.update()}},I=(E,N)=>{if(E&&!N.isNewRec()){const H=new an({width:E.scrollWidth,height:E.scrollHeight});H.appendTo(E),P(H,[],N.points,[],!0)}},V=()=>{c&&P(c,m.value,h.value,g.value,!1)},A=E=>E*(180/Math.PI),L=(E,N)=>{const H=E[1].x-E[0].x,q=E[1].y-E[0].y,Y=N[1].x-N[0].x,F=N[1].y-N[0].y;let M=Math.atan2(H*F-q*Y,H*Y+q*F);return M=A(M),Math.round(M)*-1},D=E=>{const N=a.map((H,q,Y)=>{const F=Y[q-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let M=Math.ceil(H._length/E/n.settings.lineWidthStep)*n.settings.lineWidthStep;const Z=o[q-1];M<(Y.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(M=Y.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),M>n.settings.maxLineWidth&&(M=n.settings.maxLineWidth);const fe=L(H.vertices,F.vertices);return Z&&(Z.value=`${fe}°`),new ri(M,fe,`A-${q+1}`)});r("pointer:move",N)},ee=E=>{let N=null,H;const q=Z=>{N=l.find(fe=>{const ie=fe.renderer;return(ie==null?void 0:ie.elem)===Z.target}),[H]=p(E,m.value,h.value.map(fe=>fe),g.value)},Y=Z=>{if(N){const fe=N.renderer,ie=fe==null?void 0:fe.elem;if(!ie)return;const me=ie.getBoundingClientRect();N.vertices[0].x-=me.x-(Z instanceof MouseEvent?Z.clientX:Z.targetTouches[0].clientX)+Ve.anchorPoint.size/2,N.vertices[0].y-=me.y-(Z instanceof MouseEvent?Z.clientY:Z.targetTouches[0].clientY)+Ve.anchorPoint.size/2,D(H),E.update()}},F=()=>{N&&r("pointer:up",h.value),N=null},M=s.value;M&&(M.addEventListener("touchstart",q),M.addEventListener("touchend",F),M.addEventListener("mousedown",q),M.addEventListener("mouseup",F),M.addEventListener("mousemove",Y),M.addEventListener("touchmove",Y))};return i.onMounted(()=>{s.value&&(c=new an({width:s.value.scrollWidth,height:s.value.scrollHeight,fullscreen:!1}).appendTo(s.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{V()},{deep:!0,immediate:!0}),ee(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(E,N)=>(i.openBlock(),i.createElementBlock("div",Ep,[i.createVNode(ad,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":N[0]||(N[0]=H=>r("template:select",H)),onInitDrawTemplate:I},null,8,["select-template-index","settings"]),i.createElementVNode("div",Np,[i.createElementVNode("div",Pp,null,512)])]))}}),Mp={class:"flex max-w-[50rem] flex-col gap-3"},Ap={},cd=i.defineComponent({...Ap,__name:"kozyrek-configurator",props:{settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(!1),o=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref(n.settings),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),h=i.ref({quantity:{},marker:{},length:{}}),u=i.ref(0),m=(k=0)=>{var $;const R=($=c.value.allTemplates)==null?void 0:$.at(k);R!==void 0&&(u.value=k,l.value.configuratorParams.linesWidths=R.points.map(P=>O.isArray(P)?P[0]:P.width),l.value.configuratorParams.linesAngles=R.points.map(P=>O.isArray(P)?P[1]:P.angle),b()),p(l.value.configuratorParams)},g=async()=>{const k=prompt("Введите название шаблона:");if(!k)return;a.value=!0;const R={label:k,points:l.value.configuratorParams.linesWidths.map(($,P)=>[$,l.value.configuratorParams.linesAngles[P]])};await G.HttpRequester.getInstance(G.ConfiguratorProvider).createTemplate(n.cartItem.category,R,h.value).then(()=>{c.value.addCustomTemplate(R),u.value=c.value.allTemplates.length-1}).catch(()=>{a.value=!1}),a.value=!1},f=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(u.value=c.value.allTemplates.length-1)},p=async k=>{b(),s.value=!0,await G.HttpRequester.getInstance(G.ConfiguratorProvider).searchProduct(n.cartItem.category,k,h.value).then(R=>{l.value.product=R}).catch(()=>{s.value=!1}),s.value=!1},y=()=>{o.value=!0,r("submit",l.value,h.value,()=>{o.value=!1})},b=()=>{const k={quantity:h.value.quantity,marker:h.value.marker};l.value.configuratorParams.linesWidths.forEach((R,$)=>{k[`lines_widths[${$+1}]`]={},k[`lines_angles[${$+1}]`]={}}),h.value=k},_=k=>{d.value.linesWidths=k.map(R=>R.width),d.value.linesAngles=k.map(R=>R.angle)},C=k=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,b(),f(),p(l.value.configuratorParams)},S=(k,R)=>{d.value.linesWidths=k,d.value.linesAngles=R},v=k=>{const R=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,$=0;l.value.configuratorParams.linesWidths.splice(k+1,0,R),l.value.configuratorParams.linesAngles.splice(k+1,0,$),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],b(),f(),p(l.value.configuratorParams)},B=k=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(k,1),l.value.configuratorParams.linesAngles.splice(k,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],b(),f(),p(l.value.configuratorParams))};return i.onBeforeMount(()=>{m()}),(k,R)=>{const $=z.NButton;return i.openBlock(),i.createElementBlock("div",Mp,[t.settings.allowShowTable?(i.openBlock(),i.createBlock($,{key:0,type:"tertiary",class:"self-end",onClick:R[0]||(R[0]=P=>r("click:view-switch"))},{default:i.withCtx(()=>[...R[3]||(R[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(ld,{value:l.value,"select-template-index":u.value,settings:c.value,"onPointer:up":C,"onPointer:move":_,"onTemplate:select":m},null,8,["value","select-template-index","settings"]),i.createVNode(Ua,{value:l.value,"onUpdate:value":R[1]||(R[1]=P=>l.value=P),"preview-params":d.value,validation:h.value,settings:c.value,"is-submit-processing":o.value,"is-product-searching":s.value,"select-template-index":u.value,"onUpdate:params":R[2]||(R[2]=P=>p(P)),"onUpdate:preview":S,onSubmit:y,"onClick:saveTemplate":g,"onClick:addLine":v,"onClick:removeLine":B},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])}}}),Vp={},Li=i.defineComponent({...Vp,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.value),a=i.computed(()=>i.inject("debounce-input-time",r.debounceTime)),l=O.debounce(()=>s("update:value",o.value),a.value),c=g=>{o.value=g,l()};i.watch(()=>r.value,g=>{o.value=g});const d=i.ref(null);return e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blur()},select:()=>{var g;return(g=d.value)==null?void 0:g.select()}}),(g,f)=>(i.openBlock(),i.createBlock(i.unref(z.NInputNumber),{ref_key:"inputReference",ref:d,value:o.value,"onUpdate:value":[f[0]||(f[0]=p=>o.value=p),c],clearable:t.clearable,"show-button":!1,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,validator:t.validator},{prefix:i.withCtx(()=>[i.renderSlot(g.$slots,"prefix")]),_:3},8,["value","clearable","placeholder","min","max","step","validator"]))}}),Op={key:0,class:"flex items-baseline gap-1"},Ip={key:0,class:"flex items-baseline gap-1"},zp={key:0},Lp={class:"text-lg font-semibold"},Dp={key:1,class:"text-red-500 text-sm mb-2"},Hp={class:"flex gap-3"},Wp={},dd=i.defineComponent({...Wp,__name:"mosquito-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:instructions-toggle","click:show-preview-drawer"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>bt.isPhoneDevice()),o=i.ref(O.cloneDeep(i.toRaw(n.value.configuratorParams))),a=i.computed(()=>n.settings.widthOverlaps[o.value.mountType]??0),l=i.computed(()=>n.settings.heightOverlaps[o.value.mountType]??0),c=i.computed(()=>n.settings.maxWidths[o.value.netType]),d=i.computed(()=>n.settings.maxHeights[o.value.netType]),h=i.computed(()=>{var S;const{width:p,height:y}=o.value,{quantity:b}=n.value,_=((S=n.value.product)==null?void 0:S.costRub)||0;if(!p||!y||!b||_===0)return null;const C=p*y/1e6;return(_*b*C).toLocaleString("ru-ru",{minimumFractionDigits:2})}),u=i.computed(()=>{const p=!!(o.value.width&&o.value.width>=n.settings.minWidth&&o.value.width<=n.settings.maxWidths[o.value.netType]),y=!!(o.value.height&&o.value.height>=n.settings.minHeight&&o.value.height<=n.settings.maxHeights[o.value.netType]),b=!!(n.value.quantity&&n.value.quantity>0);return p&&y&&b}),m=p=>{o.value.mountType=p,u.value&&(r("update:params",o.value),f("configuratorParams",o.value))},g=(p,y)=>{p&&p in o.value&&(o.value[p]=y??0),u.value&&(r("update:params",o.value),f("configuratorParams",o.value))},f=(p,y)=>{const b=new G.CartItemBase(n.value);b[p]=y,r("update:value",b)};return(p,y)=>{const b=z.NInput;return i.openBlock(),i.createBlock(i.unref(z.NForm),{class:"flex flex-col gap-2 px-4 md:max-w-96"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:o.value.netType,"onUpdate:value":[y[0]||(y[0]=_=>o.value.netType=_),g],options:t.settings.netType.map(_=>({label:t.settings.descriptions.net_type[_],value:_}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:o.value.color,"onUpdate:value":y[1]||(y[1]=_=>o.value.color=_),options:t.settings.color.map(_=>({label:t.settings.descriptions.color[_],value:_}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:o.value.mountType,"onUpdate:value":[y[2]||(y[2]=_=>o.value.mountType=_),m],options:t.settings.mountType.map(_=>({label:t.settings.descriptions.mount_type[_],value:_}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.width.feedback||"","show-feedback":t.validation.width.showFeedback||o.value.width>=t.settings.minWidth&&o.value.width<=t.settings.maxWidths[o.value.netType],"validation-status":t.validation.width.validationStatus||void 0,label:`Ширина светового проёма от ${t.settings.minWidth-a.value} ${c.value?" до "+(c.value-a.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.width.showFeedback&&o.value.width>=t.settings.minWidth&&o.value.width<=t.settings.maxWidths[o.value.netType]?(i.openBlock(),i.createElementBlock("div",Op,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(o.value.width),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:y[4]||(y[4]=_=>r("click:instructions-toggle"))},{default:i.withCtx(()=>[...y[11]||(y[11]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(Li,{value:o.value.width&&o.value.width-a.value||void 0,max:c.value-a.value,min:t.settings.minWidth-a.value,placeholder:"Введите ширину светового проёма",class:"w-full","onUpdate:value":y[3]||(y[3]=_=>g("width",(_&&_+a.value)??void 0))},null,8,["value","max","min"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.height.feedback||"","show-feedback":t.validation.height.showFeedback||o.value.height>=t.settings.minHeight&&o.value.height<=t.settings.maxHeights[o.value.netType],"validation-status":t.validation.height.validationStatus||void 0,label:`Высота светового проёма от ${t.settings.minHeight-l.value} ${d.value?" до "+(d.value-l.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&o.value.height>=t.settings.minHeight&&o.value.height<=t.settings.maxHeights[o.value.netType]?(i.openBlock(),i.createElementBlock("div",Ip,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(o.value.height),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:y[6]||(y[6]=_=>r("click:instructions-toggle"))},{default:i.withCtx(()=>[...y[12]||(y[12]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(Li,{value:o.value.height&&o.value.height-l.value||void 0,max:d.value-l.value,min:t.settings.minHeight-l.value,placeholder:"Введите высоту светового проёма",class:"w-full","onUpdate:value":y[5]||(y[5]=_=>g("height",(_&&_+l.value)??void 0))},null,8,["value","max","min"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.quantity.feedback||"","show-feedback":t.validation.quantity.showFeedback||!1,"validation-status":t.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:t.value.quantity,"onUpdate:value":y[7]||(y[7]=_=>t.value.quantity=_),min:1,"show-button":!1,validator:_=>Number.isInteger(_),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{feedback:t.validation.marker.feedback||"","show-feedback":t.validation.marker.showFeedback||!1,"validation-status":t.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(b,{value:t.value.marker,"onUpdate:value":y[8]||(y[8]=_=>t.value.marker=_),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(nr,{"is-product-searching":t.isProductSearching,product:t.value.product},null,8,["is-product-searching","product"]),h.value?(i.openBlock(),i.createElementBlock("div",zp,[y[13]||(y[13]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Lp,i.toDisplayString(h.value)+" ₽",1)])):i.createCommentVNode("",!0),u.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Dp," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",Hp,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!u.value,type:"primary",class:"self-start",onClick:y[9]||(y[9]=_=>r("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,type:"default",onClick:y[10]||(y[10]=_=>r("click:show-preview-drawer"))},{default:i.withCtx(()=>[...y[14]||(y[14]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1})}}}),jp="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",qp="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",Xp="/img/configurators/mosquitto/measurement-instructions/mount.png",Yp="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Up="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",Gp={class:"flex flex-col gap-6"},Kp={class:"flex gap-4"},Zp={class:"flex flex-col gap-2"},Qp={class:"flex gap-4"},Jp={class:"flex flex-col gap-2"},e0={class:"flex gap-4"},t0={class:"flex flex-col gap-2"},n0={},hd=i.defineComponent({...n0,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=bt.initRefDependingOnDeviceResolution("small","small","medium"),r=bt.initRefDependingOnDeviceResolution(.98,.95,.8),s=i.computed(()=>window.innerWidth*r.value),o=e;return(a,l)=>{const c=z.NText;return i.openBlock(),i.createBlock(i.unref(z.NModal),{show:t.show,"show-icon":!1,size:i.unref(n),style:i.normalizeStyle(`width: ${s.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>o("update:show",!1)),onEsc:l[1]||(l[1]=d=>o("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>o("update:show",!1))},{default:i.withCtx(()=>[i.createElementVNode("div",Gp,[i.createVNode(c,{type:"error",class:"text-base font-medium"},{default:i.withCtx(()=>[...l[3]||(l[3]=[i.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=i.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:jp,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),i.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:qp,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),i.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),i.createElementVNode("div",Kp,[l[9]||(l[9]=i.createElementVNode("img",{src:Xp,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Zp,[l[8]||(l[8]=i.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),i.createElementVNode("span",null,[l[4]||(l[4]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.frame)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=i.createElementVNode("br",null,null,-1)),l[7]||(l[7]=i.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),i.createElementVNode("div",Qp,[l[15]||(l[15]=i.createElementVNode("img",{src:Yp,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Jp,[l[14]||(l[14]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),i.createElementVNode("span",null,[l[10]||(l[10]=i.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=i.createElementVNode("br",null,null,-1)),l[13]||(l[13]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),i.createElementVNode("div",e0,[l[21]||(l[21]=i.createElementVNode("img",{src:Up,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",t0,[l[20]||(l[20]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),i.createElementVNode("span",null,[l[16]||(l[16]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.external_metal)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=i.createElementVNode("br",null,null,-1)),l[19]||(l[19]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),i0={class:"flex flex-col items-center justify-between rounded-xl"},r0={class:"img-preview relative flex justify-center"},s0={},o0=i.defineComponent({...s0,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(t,{emit:e}){const n=t,r=i.computed(()=>O.keys(n.settings.crossbarCount).find(o=>n.settings.crossbarCount[Number(o)]&&(!n.settings.crossbarCount[Number(o)+1]||n.configuratorParams.height<n.settings.crossbarCount[Number(o)+1]-n.settings.heightOverlaps[n.configuratorParams.mountType]))),s=e;return(o,a)=>{const l=z.NButton;return i.openBlock(),i.createElementBlock("div",i0,[i.createElementVNode("div",r0,[a[1]||(a[1]=i.createElementVNode("div",{class:"window"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["net",`net-${t.configuratorParams.netType}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["frame",`frame-${t.configuratorParams.color}`])},null,2),r.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${t.configuratorParams.color}`])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["mount",`mount-${t.configuratorParams.mountType}-${t.configuratorParams.color}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["cut-preview",`cut-preview-${t.configuratorParams.mountType}-${t.configuratorParams.color}`])},null,2)]),i.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>s("open-instructions"))},{default:i.withCtx(()=>[...a[2]||(a[2]=[i.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),Eo=Zn(o0,[["__scopeId","data-v-8b43aa68"]]),a0={class:"grid md:grid-cols-2"},l0={},ud=i.defineComponent({...l0,__name:"mosquito-configurator",props:{settings:{},cartItem:{}},emits:["submit"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>bt.isPhoneDevice()),o=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref({width:{},height:{},quantity:{},marker:{}}),d=i.ref(!1),h=i.ref(!1),u=async g=>{g.height>0&&g.width>0&&(d.value=!0,await G.HttpRequester.getInstance(G.ConfiguratorProvider).searchProduct(n.cartItem.category,g,c.value).then(f=>{l.value.product=f}).catch(()=>{d.value=!1}),d.value=!1)},m=()=>{h.value=!0,r("submit",l.value,c.value,()=>{h.value=!1})};return(g,f)=>{const p=ss;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(hd,{show:a.value,"onUpdate:show":f[0]||(f[0]=y=>a.value=y),"height-overlaps":t.settings.heightOverlaps,"width-overlaps":t.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",a0,[s.value?(i.openBlock(),i.createBlock(i.unref(z.NDrawer),{key:1,show:o.value,"onUpdate:show":f[4]||(f[4]=y=>o.value=y),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(z.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:f[2]||(f[2]=y=>o.value=!1)},{default:i.withCtx(()=>[i.createVNode(p)]),_:1})]),default:i.withCtx(()=>[i.createVNode(Eo,{"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:f[3]||(f[3]=y=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(Eo,{key:0,"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:f[1]||(f[1]=y=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(dd,{value:l.value,"onUpdate:value":f[5]||(f[5]=y=>l.value=y),validation:c.value,settings:t.settings,"is-product-searching":d.value,"is-submit-processing":h.value,"onUpdate:params":f[6]||(f[6]=y=>u(y)),onSubmit:f[7]||(f[7]=y=>m()),"onClick:instructionsToggle":f[8]||(f[8]=y=>a.value=!a.value),"onClick:showPreviewDrawer":f[9]||(f[9]=y=>o.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),c0={key:0},d0={},fd=i.defineComponent({...d0,__name:"strip-configurator-line-item",props:{value:{},index:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},validation:{default:()=>({})}},emits:["update:value","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=d=>{s("update:value",d??0,r.index,a)};i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{c()})});const c=()=>{var d;(d=o.value)==null||d.select()};return e({focusWidthInput:c}),(d,h)=>{var g;const u=Ya,m=Xa;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{label:`Полоса №${t.index+1}, мм`,required:!0,"validation-status":a.value||(g=t.validation)==null?void 0:g.validationStatus},{feedback:i.withCtx(()=>{var f,p;return[(f=t.validation)!=null&&f.showFeedback?(i.openBlock(),i.createElementBlock("span",c0,i.toDisplayString((p=t.validation)==null?void 0:p.feedback),1)):i.createCommentVNode("",!0),i.createVNode(nr,{"is-product-searching":a.value,product:t.product},null,8,["is-product-searching","product"])]}),default:i.withCtx(()=>[i.createVNode(i.unref(z.NDropdown),{trigger:"click",options:t.suggestionOption,placement:"bottom-start",size:"large",onSelect:l},{default:i.withCtx(()=>[i.createVNode(Li,{ref:"width-input-element",value:t.value,class:"w-full",min:t.settings.minLineWidth,step:t.settings.lineWidthStep,validator:f=>!!f&&f>=t.settings.minLineWidth&&f%t.settings.lineWidthStep===0,placeholder:"Введите ширину","onUpdate:value":l},null,8,["value","min","step","validator"])]),_:1},8,["options"]),i.createVNode(i.unref(z.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[0]||(h[0]=f=>s("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"]),i.createVNode(i.unref(z.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[1]||(h[1]=f=>s("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"])]),_:1},8,["label","validation-status"])}}}),h0={class:"my-2 flex w-full flex-col"},u0={key:0},f0={class:"text-lg font-semibold"},g0={class:"flex gap-3"},m0={},gd=i.defineComponent({...m0,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>n.value[0].configuratorParams.linesWidths.reduce((u,m)=>(u??0)+(m??0),0)),o=i.computed(()=>n.settings.width-s.value),a=i.computed(()=>!n.value.some(({product:u})=>!u)),l=i.computed(()=>o.value===0?void 0:[{label:`${(o.value>0?"Остаток +":"Излишек ")+o.value} мм.`,key:o.value}]),c=i.computed(()=>{const{length:u}=n.value[0];return!u||s.value!==n.settings.width?null:(O.reduce(n.value,(g,f)=>{var y;const p=((y=f.product)==null?void 0:y.costRub)||0;return g+p},0)*n.value[0].quantity*u).toLocaleString("ru-ru",{minimumFractionDigits:2})}),d=(u,m,g)=>{const f=n.value.at(m);if(f)if(u&&u>=n.settings.minLineWidth&&u%n.settings.lineWidthStep===0){const p={linesWidths:f.configuratorParams.linesWidths.toSpliced(m,1,u)};r("update:params",p,m,g),h("configuratorParams",p)}else f.product.id=-1},h=(u,m)=>{const g=n.value.map(f=>new G.CartItemBase(f));g.forEach(f=>{f[u]=m}),r("update:value",g)};return(u,m)=>{const g=z.NInput;return i.openBlock(),i.createBlock(i.unref(z.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>{var f;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.value,(p,y)=>(i.openBlock(),i.createBlock(fd,{key:y,"auto-focus":!0,index:y,value:p.configuratorParams.linesWidths.at(y)??null,product:p.product,settings:t.settings,validation:t.validation[`linesWidths.${y}`],"suggestion-option":l.value,"add-line-button-disabled":o.value<=0||t.value.length>=t.settings.maxLinesCount,"remove-line-button-disabled":t.value.length===1,"onUpdate:value":d,"onClick:addLine":m[0]||(m[0]=b=>r("click:add-line",b)),"onClick:removeLine":m[1]||(m[1]=b=>r("click:remove-line",b))},null,8,["index","value","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled"]))),128)),i.createElementVNode("div",h0,[o.value<0?(i.openBlock(),i.createBlock(i.unref(z.NText),{key:0,type:"error"},{default:i.withCtx(()=>[i.createTextVNode(" Сумма ширин всех полос должна быть равна "+i.toDisplayString(t.settings.width),1)]),_:1})):i.createCommentVNode("",!0),a.value&&t.value.length===t.settings.maxLinesCount&&o.value>0?(i.openBlock(),i.createBlock(i.unref(z.NText),{key:1,type:"error"},{default:i.withCtx(()=>[...m[7]||(m[7]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[m[8]||(m[8]=i.createTextVNode(" Остаток для резки: ",-1)),i.createVNode(i.unref(z.NText),{type:o.value>=0?"Success":"error"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(o.value),1)]),_:1},8,["type"]),i.createTextVNode(" из "+i.toDisplayString(t.settings.width)+" мм ",1)])]),i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!a.value||o.value<=0||t.value.length>=t.settings.maxLinesCount,type:"primary",class:"self-center",onClick:m[2]||(m[2]=p=>r("click:add-line",t.value.length))},{default:i.withCtx(()=>[...m[9]||(m[9]=[i.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["loading","disabled"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.length.feedback||"","show-feedback":t.validation.length.showFeedback||!1,"validation-status":t.validation.length.validationStatus||void 0,label:`Метраж ${t.settings.minLength?" от "+t.settings.minLength:""} ${t.settings.maxLength?" до "+t.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:n.value[0].length,"show-button":!1,max:t.settings.maxLength||void 0,min:t.settings.minLength,step:t.settings.lengthStep,validator:p=>p%t.settings.lengthStep===0,placeholder:"Введите метраж",class:"w-full","onUpdate:value":m[3]||(m[3]=p=>h("length",p??0))},null,8,["value","max","min","step","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.quantity.feedback||"","show-feedback":t.validation.quantity.showFeedback||!1,"validation-status":t.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:n.value[0].quantity,"show-button":!1,min:1,validator:p=>Number.isInteger(p),placeholder:"Введите количество",class:"w-full","onUpdate:value":m[4]||(m[4]=p=>h("quantity",p??0))},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{"show-feedback":!1,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(g,{value:n.value[0].marker,placeholder:"Введите маркировку","onUpdate:value":m[5]||(m[5]=p=>h("marker",p))},null,8,["value"])]),_:1}),c.value?(i.openBlock(),i.createElementBlock("div",u0,[m[10]||(m[10]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",f0,i.toDisplayString(c.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",g0,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!a.value||o.value!=0||!((f=t.value[0])!=null&&f.length)||t.value[0].length>t.settings.maxLength||t.value[0].length<t.settings.minLength||t.value[0].quantity===0,type:"primary",class:"self-start",onClick:m[6]||(m[6]=p=>r("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1})}}}),p0={class:"flex grow flex-col"},y0=["src"],b0={class:"w-full"},_0={},md=i.defineComponent({..._0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",p0,[i.createElementVNode("img",{src:"/img/configurators/strip/strip-"+t.value.length+".png",class:"w-full max-w-96 self-center",alt:"Штрипс"},null,8,y0),i.createElementVNode("div",b0,[i.createTextVNode(" Число полос можно указать от "+i.toDisplayString(t.settings.minLinesCount)+" до "+i.toDisplayString(t.settings.maxLinesCount)+". ",1),n[0]||(n[0]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Минимальная ширина полосы "+i.toDisplayString(t.settings.minLineWidth)+" мм. ",1),n[1]||(n[1]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина всех полос "+i.toDisplayString(t.settings.width)+" мм. ",1),n[2]||(n[2]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Шаг ширины полосы - "+i.toDisplayString(t.settings.lineWidthStep)+" мм. ",1)])]))}}),w0={class:"flex flex-col gap-2"},x0={class:"w-104 flex grow flex-col px-5"},v0={},pd=i.defineComponent({...v0,__name:"strip-configurator",props:{settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.cartItems),o=i.ref({width:{},length:{},quantity:{},marker:{}}),a=i.ref(!1),l=i.computed(()=>s.value[0].configuratorParams.linesWidths.reduce((m,g)=>(m??0)+(g??0),0)),c=m=>{m===void 0&&(m=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(p=>{p.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const f=new G.CartItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??n.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,f)},d=m=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(f=>{f.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete o[`linesWidths.${m}`],delete o[`linesWidths.${m}`])},h=async(m,g,f)=>{f.value=!0,o.value[`linesWidths.${g}`]={},await G.HttpRequester.getInstance(G.ConfiguratorProvider).searchProduct(s.value[g].category,{linesWidths:m.linesWidths.at(g)},o.value).then(p=>{s.value[g].product=p,g===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&l.value&&l.value<n.settings.width&&c()}).catch(()=>{s.value[g].product=new G.Product,o.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},f.value=!1}),f.value=!1},u=()=>{a.value=!0,r("submit",s.value,o.value,()=>{a.value=!1})};return(m,g)=>{const f=z.NButton;return i.openBlock(),i.createElementBlock("div",w0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(f,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[3]||(g[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",x0,[i.createVNode(md,{value:s.value,"onUpdate:value":g[1]||(g[1]=p=>s.value=p),settings:t.settings},null,8,["value","settings"]),i.createVNode(gd,{value:s.value,"onUpdate:value":g[2]||(g[2]=p=>s.value=p),validation:o.value,settings:t.settings,"is-submit-processing":a.value,"onUpdate:params":h,onSubmit:u,"onClick:addLine":c,"onClick:removeLine":d},null,8,["value","validation","settings","is-submit-processing"])])])}}}),k0={class:"flex flex-col gap-3"},C0={},yd=i.defineComponent({...C0,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(t,{emit:e}){const n=t,r=e,s=i.useTemplateRef("first-input-element"),o=i.ref(O.cloneDeep(i.toRaw(n.value.configuratorParams))),a=()=>{o.value.length>0&&o.value.width>0&&(r("update:params",o.value),l("configuratorParams",o.value))},l=(c,d)=>{const h=new G.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.onMounted(()=>{n.value.isNewRec()&&i.nextTick(()=>{var c;(c=s.value)==null||c.focus()})}),(c,d)=>{const h=z.NInput;return i.openBlock(),i.createBlock(i.unref(z.NForm),{disabled:t.isSubmitProcessing,class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.width.feedback||"","show-feedback":t.validation.width.showFeedback||!1,"validation-status":t.validation.width.validationStatus||void 0,label:`Ширина, ${t.settings.minWidth?" от "+t.settings.minWidth:""}${t.settings.maxWidth?" до "+t.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(Li,{ref:"first-input-element",value:o.value.width,"onUpdate:value":[d[0]||(d[0]=u=>o.value.width=u),a],class:"w-full",max:t.settings.maxWidth??void 0,min:t.settings.minWidth,validator:u=>!!u&&u>=t.settings.minWidth&&(!t.settings.maxWidth||u<=t.settings.maxWidth),placeholder:"Введите ширину"},null,8,["value","max","min","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.length.feedback||"","show-feedback":t.validation.length.showFeedback||!1,"validation-status":t.validation.length.validationStatus||void 0,label:`Длина, ${t.settings.minLength?" от "+t.settings.minLength:""}${t.settings.maxLength?" до "+t.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(Li,{value:o.value.length,"onUpdate:value":[d[1]||(d[1]=u=>o.value.length=u),a],placeholder:"Введите длину",max:t.settings.maxLength,min:t.settings.minLength,validator:u=>u>=t.settings.minLength&&u<=t.settings.maxLength,class:"w-full"},null,8,["value","max","min","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:t.validation.quantity.feedback||"","show-feedback":t.validation.quantity.showFeedback||!1,"validation-status":t.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:t.value.quantity,placeholder:"Введите количество","show-button":!1,min:1,validator:u=>u>0,class:"w-full","onUpdate:value":d[2]||(d[2]=u=>l("quantity",u??0))},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{feedback:t.validation.marker.feedback||"","show-feedback":t.validation.marker.showFeedback||!1,"validation-status":t.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(h,{value:t.value.marker,placeholder:"Введите маркировку","onUpdate:value":d[3]||(d[3]=u=>l("marker",u))},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(nr,{"is-product-searching":t.isProductSearching,product:t.value.product},null,8,["is-product-searching","product"]),i.createElementVNode("div",k0,[i.createVNode(i.unref(z.NButton),{disabled:t.value.product.isNewRec()||t.isProductSearching||t.isSubmitProcessing||t.value.length===0||t.value.width===0||t.value.quantity===0,type:"primary",class:"self-start",onClick:d[4]||(d[4]=u=>r("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["disabled"])}}}),S0={class:"flex flex-col gap-2"},B0={},bd=i.defineComponent({...B0,__name:"metal-for-doors-configurator",props:{settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.cartItem),o=i.ref({width:{},length:{},quantity:{},marker:{}}),a=i.ref(!1),l=i.ref(!1),c=async h=>{a.value=!0,await G.HttpRequester.getInstance(G.ConfiguratorProvider).searchProduct(n.cartItem.category,h,o.value).then(u=>{s.value.product=u}).catch(()=>{a.value=!1}),a.value=!1},d=()=>{l.value=!0,r("submit",s.value,o.value,()=>{l.value=!1})};return(h,u)=>{const m=z.NButton;return i.openBlock(),i.createElementBlock("div",S0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:u[0]||(u[0]=g=>r("click:view-switch"))},{default:i.withCtx(()=>[...u[4]||(u[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(yd,{value:s.value,"onUpdate:value":u[1]||(u[1]=g=>s.value=g),validation:o.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":u[2]||(u[2]=g=>c(g)),onSubmit:u[3]||(u[3]=g=>d())},null,8,["value","validation","settings","is-submit-processing"])])}}});class Di extends G.Identity{constructor(n,r){super();x(this,"label","");x(this,"points",[]);x(this,"isCustom",!1);x(this,"id",-1);x(this,"guid","");n?(this.label=n.label,this.points=n.points.map((s,o)=>O.isArray(s)?new ri(s[0],s[1],`A-${o+1}`):new ri(s.width,s.angle,`A-${o+1}`))):(this.label="-- Новая конфигурация --",this.points=[new ri(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class No extends Di{constructor(n){super(n);x(this,"isDefault");this.isDefault=n.isDefault??!1}}class _d{constructor(e){x(this,"minLineWidth");x(this,"maxLineWidth");x(this,"lineWidthStep");x(this,"minLineAngle");x(this,"maxLineAngle");x(this,"lineAngleStep");x(this,"stripMinWidth");x(this,"stripMaxWidth");x(this,"stripMinLength");x(this,"stripMaxLength");x(this,"allowShowTable");x(this,"showOnlyTemplates");x(this,"templates");x(this,"customTemplates",[]);x(this,"startTailConfigs");x(this,"endTailConfigs");x(this,"bendCountForExtended");x(this,"extendedProductCatalog");x(this,"allowChangeFirstPoint");x(this,"allowSaveTemplates");x(this,"userTemplatesPrefix");x(this,"lengthStep");var n,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(s=>new Di(s)),this.templates.forEach((s,o)=>{s.id=o}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(s=>new No(s)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(s=>new No(s)))??[],this.bendCountForExtended=e.bendCountForExtended,this.extendedProductCatalog=e.extendedProductCatalog,this.allowChangeFirstPoint=e.allowChangeFirstPoint,this.allowSaveTemplates=e.allowSaveTemplates,this.userTemplatesPrefix=e.userTemplatesPrefix,this.lengthStep=e.lengthStep,this.showOnlyTemplates||(this.customTemplates=e.customTemplates?Object.entries(e.customTemplates).map(([s,o])=>{const a=new Di(o);return a.isCustom=!0,a.id=+s,a}):[],this.customTemplates.push(new Di))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){var r,s;if(!this.allowSaveTemplates)return;const n=new Di(e);n.isCustom=!0,n.id=(((r=this.customTemplates.at(-1))==null?void 0:r.id)??((s=this.templates.at(-1))==null?void 0:s.id)??0)+1,this.customTemplates.splice(-1,0,n)}removeCustomTemplate(e){if(this.allowSaveTemplates)return;const n=this.customTemplates.findIndex(r=>r.id===e);n&&n!==-1&&this.customTemplates.splice(n,1)}}class T0{constructor(e){x(this,"minHeight");x(this,"maxHeights");x(this,"minWidth");x(this,"maxWidths");x(this,"netType");x(this,"color");x(this,"mountType");x(this,"descriptions");x(this,"crossbarCount");x(this,"heightOverlaps");x(this,"widthOverlaps");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Ps.objectToSnake(e.descriptions),this.maxHeights=e.maxHeights,this.maxWidths=e.maxWidths,this.minHeight=e.minHeight,this.minWidth=e.minWidth,this.mountType=e.mountType,this.netType=e.netType,this.heightOverlaps=Ps.objectToSnake(e.heightOverlaps),this.widthOverlaps=Ps.objectToSnake(e.widthOverlaps)}}const R0={key:0,class:"flex justify-center p-4"},$0={key:1,class:"p-4 text-center text-red-500"},E0={key:2,class:"!bg-white p-4 m-2 rounded-md justify-self-center"},N0={key:3,class:"p-4 text-center text-gray-500"},wd=i.defineComponent({__name:"dynamic-configurator",props:{eventEmitter:{},category:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(!1),o=i.ref(null),a=i.ref(null),l=i.computed(()=>{var g;return(g=n.category.properties)==null?void 0:g.configurator}),c=i.ref(null),d=i.ref(null),h=g=>{var p,y;const f={category:n.category,configurator:l.value,quantity:1};switch(l.value){case"kozyrek":{const b=g;c.value=new G.CartItemBase({...f,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:O.some(b.startTailConfigs,_=>_.isDefault)?(p=b.startTailConfigs)==null?void 0:p.findIndex(_=>_.isDefault):void 0,endTailType:O.some(b.endTailConfigs,_=>_.isDefault)?(y=b.endTailConfigs)==null?void 0:y.findIndex(_=>_.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=g;c.value=new G.CartItemBase({...f,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{d.value=[new G.CartItemBase({...f,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=g;c.value=new G.CartItemBase({...f,configuratorParams:{width:b.minWidth,length:b.minLength}});break}default:o.value=`Неподдерживаемый тип конфигуратора: ${l.value}.`}},u=async()=>{var g;if(!l.value){o.value="Тип конфигуратора не указан в свойствах категории.";return}s.value=!0,o.value=null;try{const p=await G.HttpRequester.getInstance(G.ConfiguratorProvider).getConfiguratorSettings(n.category);switch((g=n.category.properties)==null?void 0:g.configurator){case"kozyrek":a.value=new _d(p);break;case"mosquitto":a.value=new T0(p);break;default:a.value=p;break}h(a.value)}catch(f){"message"in f&&(f.value=`Ошибка при загрузке настроек конфигуратора: ${O.isError(f)?f.message:"Неизвестная ошибка"}.`)}finally{s.value=!1}},m=(g,f,p)=>{const y=b=>{p==null||p(),b&&h(a.value)};r("submit",O.isArray(g)?g[0]:g,f,y)};return i.onMounted(()=>{u()}),(g,f)=>{const p=z.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[s.value?(i.openBlock(),i.createElementBlock("div",R0,[i.createVNode(p,{size:"large"})])):o.value?(i.openBlock(),i.createElementBlock("div",$0,i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),a.value!==null&&(c.value!==null||d.value!==null)?(i.openBlock(),i.createElementBlock("div",E0,[l.value==="kozyrek"?(i.openBlock(),i.createBlock(cd,{key:0,settings:a.value,"cart-item":c.value,"onClick:viewSwitch":f[0]||(f[0]=y=>r("click:view-switch")),onSubmit:m},null,8,["settings","cart-item"])):l.value==="mosquitto"?(i.openBlock(),i.createBlock(ud,{key:1,settings:a.value,"cart-item":c.value,"onClick:viewSwitch":f[1]||(f[1]=y=>r("click:view-switch")),onSubmit:m},null,8,["settings","cart-item"])):l.value==="strip"?(i.openBlock(),i.createBlock(pd,{key:2,settings:a.value,"cart-items":d.value,"onClick:viewSwitch":f[2]||(f[2]=y=>r("click:view-switch")),onSubmit:m},null,8,["settings","cart-items"])):l.value==="metal_for_doors"?(i.openBlock(),i.createBlock(bd,{key:3,settings:a.value,"cart-item":c.value,"onClick:viewSwitch":f[3]||(f[3]=y=>r("click:view-switch")),onSubmit:m},null,8,["settings","cart-item"])):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("div",N0,' Конфигуратор "'+i.toDisplayString(l.value)+'" не поддерживается. ',1))],64)}}}),P0={key:0,class:"pt-0.5"},F0={key:0},M0={class:"line-through"},A0={key:0},V0={key:1},O0={class:"flex flex-row gap-1"},I0={key:0},z0={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},L0={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},D0={key:2,class:"flex flex-col"},H0={},W0=i.defineComponent({...H0,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:Function,default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function],default:!1},showCategoryRequiredButton:{type:[Boolean,String,Function],default:!1},showCategoryPinButton:{type:[Boolean,String,Function],default:!1},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function],default:!1},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},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(t){const e=t,n=i.inject($r,"medium"),r=i.computed(()=>{var F;return(F=e==null?void 0:e.filteredItems)==null?void 0:F[e.categoryItem.id]}),s=i.computed(()=>{var F,M;return O.isArray((F=e.categoryItem)==null?void 0:F.categories)&&((M=e.categoryItem.categories)==null?void 0:M.length)>0}),o=i.computed(()=>{var F;return O.isArray((F=e.categoryItem)==null?void 0:F.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([F,M])=>`${M} руб./${R(F)}`).join(", ")),l=i.computed(()=>O.isUndefined(e.filteredItems)||r.value==="*"?o.value:o.value.filter(F=>{var Z;const M=(Z=r.value)==null?void 0:Z.products;return O.isArray(M)&&M.includes(F.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>O.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),h=i.computed(()=>O.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),u=i.computed(()=>O.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),m=i.computed(()=>O.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var F;return((F=e.categoryItem.properties)==null?void 0:F.configurator)!==void 0&&(O.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)}),f=i.computed(()=>O.isNil(e.categoryContextButtonsConfig)?[]:O.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),p=i.computed(()=>new G.ClientCategory(e.categoryItem)),y=i.ref(!1),b=i.ref(!1),_=i.computed(()=>!O.isUndefined(e.isCategoryItemSelected)),C=i.computed(()=>O.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected),S=i.computed(()=>H.value&&bt.getDeviceTypeByResolution()===Ue.laptop?"auto":"fixed"),v=i.useTemplateRef("collapse-item-reference"),B=i.computed(()=>{var F,M;return(M=(F=e.categoryItem.properties)==null?void 0:F.templateCost)==null?void 0:M.priceCoefficient}),k=i.computed(()=>{var F,M;return(M=(F=e.categoryItem.properties)==null?void 0:F.templateCost)==null?void 0:M.increasePercent}),R=(F,M="ru-RU")=>0 .toLocaleString(M,{style:"currency",currency:F,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),$=F=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:F,target:v.value})},P=(F,M)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:M,isLoadingState:y,target:v.value})},I=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:v.value})},V=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:v.value})},A=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:v.value})},L=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:v.value})},D=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:v.value})},ee=F=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:F,target:v.value})},E=(F,M,Z)=>{e.eventEmitter.emit("configurator:submit",{cartItem:F,target:v.value,callback:Z,validation:M})},N=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem,target:v.value})},H=i.ref(0),q=i.computed(()=>H.value&&o.value.length>0?yg(o.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),Y=O.debounce(()=>{H.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",Y)}),window.addEventListener("resize",Y),Y(),(F,M)=>{const Z=z.NCheckbox,fe=sf,ie=z.NTooltip,me=tf,re=z.NTag,Me=Qu,Ae=Gu,Oe=z.NButton,Le=Xu,pt=La,Zt=za,Qt=Ia,St=Oa,At=z.NDropdown,yt=z.NDataTable,pn=z.NAlert,Pn=z.NSpin;return i.openBlock(),i.createBlock(Da,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":P},{"pre-arrow":i.withCtx(()=>{var De,ke;return[_.value?(i.openBlock(),i.createElementBlock("div",P0,[i.createVNode(Z,{checked:C.value,disabled:C.value==="disabled","onUpdate:checked":$},null,8,["checked","disabled"])])):i.createCommentVNode("",!0),!d.value&&((De=p.value)!=null&&De.isDisabled)?(i.openBlock(),i.createBlock(ie,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(fe,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[1]||(M[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((ke=p.value)==null?void 0:ke.isFavorite)??!1?(i.openBlock(),i.createBlock(ie,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(me,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[2]||(M[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var De,ke,Ie,J,se;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":t.categoryItem.isHidden,"text-gray-400":(De=p.value)==null?void 0:De.isDisabled})},[i.createVNode(ie,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[M[3]||(M[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:M[0]||(M[0]=i.withModifiers((...Ce)=>i.unref(O.noop)&&i.unref(O.noop)(...Ce),["prevent","stop"]))},[(ke=t.categoryItem.properties)!=null&&ke.m2Price?(i.openBlock(),i.createBlock(re,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((Ie=t.categoryItem.properties)==null?void 0:Ie.templateCost)&&t.categoryItem.properties.m2PriceRetail&&k.value}),round:""},{default:i.withCtx(()=>{var Ce;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(Ce=t.categoryItem.properties)!=null&&Ce.templateCost&&t.categoryItem.properties.m2PriceRetail&&k.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[k.value?(i.openBlock(),i.createBlock(re,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[k.value?(i.openBlock(),i.createElementBlock("span",F0,i.toDisplayString(k.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(re,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",M0,i.toDisplayString(t.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(J=t.categoryItem.properties)!=null&&J.templateCost?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[B.value||k.value?(i.openBlock(),i.createBlock(re,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var Ce;return[B.value?(i.openBlock(),i.createElementBlock("span",A0,i.toDisplayString((Ce=B.value)==null?void 0:Ce.name),1)):i.createCommentVNode("",!0),k.value?(i.openBlock(),i.createElementBlock("span",V0,i.toDisplayString(k.value>0?"+":"")+i.toDisplayString(k.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(re,{key:2,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),h.value&&((se=p.value)!=null&&se.manager)?(i.openBlock(),i.createBlock(re,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:L},{default:i.withCtx(()=>[i.createVNode(ie,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var Ce,Jt;return[i.createElementVNode("span",O0,[i.createVNode(Me),i.createTextVNode(" "+i.toDisplayString((Jt=(Ce=p.value)==null?void 0:Ce.manager)==null?void 0:Jt.name),1)])]}),default:i.withCtx(()=>{var Ce,Jt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((Jt=(Ce=p.value)==null?void 0:Ce.manager)==null?void 0:Jt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",I0,[i.createElementVNode("ul",z0,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(De,ke)=>(i.openBlock(),i.createElementBlock("li",{key:ke}," ("+i.toDisplayString(ke)+"): "+i.toDisplayString(De),1))),128)):i.createCommentVNode("",!0),t.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(t.categoryItem.properties,(De,ke)=>(i.openBlock(),i.createElementBlock("li",{key:ke}," ("+i.toDisplayString(ke)+"): "+i.toDisplayString(De),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var De;return[i.createElementVNode("div",L0,[d.value?(i.openBlock(),i.createBlock(ie,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,size:i.unref(n),onClick:I},{default:i.withCtx(()=>{var ke;return[(ke=p.value)!=null&&ke.isDisabled?(i.openBlock(),i.createBlock(fe,{key:1})):(i.openBlock(),i.createBlock(Ae,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var ke;return[(ke=p.value)!=null&&ke.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(p.value.hidingComment?`. Причина: '${p.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),h.value&&!((De=p.value)!=null&&De.manager)?(i.openBlock(),i.createBlock(ie,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,size:i.unref(n),onClick:A},{default:i.withCtx(()=>[i.createVNode(Le)]),_:1},8,["size"])]),default:i.withCtx(()=>{var ke,Ie,J;return[(ke=p.value)!=null&&ke.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((J=(Ie=p.value)==null?void 0:Ie.manager)==null?void 0:J.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock(ie,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,disabled:u.value==="disabled",size:i.unref(n),onClick:V},{default:i.withCtx(()=>{var ke;return[(ke=p.value)!=null&&ke.isRequired?(i.openBlock(),i.createBlock(Zt,{key:1})):(i.openBlock(),i.createBlock(pt,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[M[4]||(M[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(ie,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,size:i.unref(n),type:"primary",onClick:D},{default:i.withCtx(()=>[i.createVNode(Qt)]),_:1},8,["size"])]),default:i.withCtx(()=>[M[5]||(M[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),f.value.length>0?(i.openBlock(),i.createBlock(At,{key:4,options:f.value,size:i.unref(n),trigger:"click",onSelect:ee},{default:i.withCtx(()=>[i.createVNode(Oe,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(St)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(F.$slots,"default",{},()=>{var De,ke;return[s.value?(i.openBlock(),i.createBlock(vd,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||y.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((De=r.value)==null?void 0:De.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator"])):i.createCommentVNode("",!0),g.value?(i.openBlock(),i.createBlock(wd,{key:1,"event-emitter":t.eventEmitter,category:t.categoryItem,onSubmit:E,"onClick:viewSwitch":N},null,8,["event-emitter","category"])):c.value?(i.openBlock(),i.createElementBlock("div",D0,[((ke=t.categoryItem.properties)==null?void 0:ke.configurator)!==void 0?(i.openBlock(),i.createBlock(Oe,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:N},{default:i.withCtx(()=>[...M[6]||(M[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(yt,{columns:q.value,data:l.value,bordered:!0,loading:y.value,remote:!0,"row-key":Ie=>Ie.id,"table-layout":S.value,class:"mt-1"},null,8,["columns","data","loading","row-key","table-layout"])])):i.createCommentVNode("",!0),!y.value&&!b.value&&!s.value&&!c.value?(i.openBlock(),i.createBlock(pn,{key:3,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createBlock(pn,{key:4,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createBlock(Pn,{key:5,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...M[7]||(M[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),j0=Zn(W0,[["__scopeId","data-v-8ef5b448"]]),q0={class:"sc-collapse flex w-full flex-col"},X0={},xd=i.defineComponent({...X0,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(t,{emit:e}){const n=t,r=e,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",q0,[i.renderSlot(o.$slots,"default")]))}}),Y0={},vd=i.defineComponent({...Y0,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},client:{default:void 0},filteredItems:{default:void 0},isCategoryItemSelected:{},showCategoryHideForClientButton:{type:[Boolean,String,Function]},showCategoryRequiredButton:{type:[Boolean,String,Function]},showCategoryPinButton:{type:[Boolean,String,Function]},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function]},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},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(t){const e=t,n=i.inject($r,"medium"),r=i.computed(()=>O.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(o=>{var a;return!!((a=e.filteredItems)!=null&&a[o.id])})),s=(o,a)=>{if(O.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=z.NSpin,c=z.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(xd,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(j0,{key:d.id,"category-item":d,"event-emitter":t.eventEmitter,"filtered-items":s(d,t.filteredItems),"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator},null,8,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator"]))),128))]),_:1})):t.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),!t.hasProducts&&!t.loading&&t.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)}}}),U0={},kd=i.defineComponent({...U0,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.computed(()=>O.isArray(r.value)),a=new G.Reference,l=i.computed(()=>{const g=o.value?[]:a,f=O.isUndefined(r.value)?g:r.value;return O.isArray(f)?f.map(p=>p.id):f==null?void 0:f.id}),c=i.computed(()=>zt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue)),d=g=>{var f;if(O.isArray(g)){const p=g.length>0?g.map(y=>{var b;return(b=c.value.find(_=>_.value===y))==null?void 0:b.item}):[];s("update:value",p)}else{const p=g===a.id||(f=c.value.find(y=>y.value===g))==null?void 0:f.item;s("update:value",p)}},h=i.useTemplateRef("select-component");return e({focus:()=>{var g;return(g=h.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=h.value)==null?void 0:g.blur()}}),(g,f)=>(i.openBlock(),i.createBlock(i.unref(z.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":t.consistentMenuWidth,disabled:t.disabled||c.value.length===0,filterable:t.filterable,"max-tag-count":t.maxTagCount,multiple:o.value,options:c.value,placeholder:"",class:"w-full","onUpdate:value":d},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),G0={},K0=i.defineComponent({...G0,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{}},emits:["update:value"],setup(t,{emit:e}){var C,S;const n=t,r=e,s=()=>{const v=G.PriceCoefficient.getRetailPriceCoefficient();return O.unset(v,"isNewRec"),v},o=v=>!v||v.id===s().id,a=i.computed(()=>{var v;return((v=n.catalogItem)==null?void 0:v.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=v=>{var B,k,R,$;return v.id===s().id?(B=l.value)==null?void 0:B.getRetailCost():($=(R=(k=l.value)==null?void 0:k.priceCoefficients)==null?void 0:R.find(P=>P.coefficient.id===v.id))==null?void 0:$.cost},d=i.computed(()=>{var B;const v=[...((B=G.useReferencesStore().priceCoefficientsReference)==null?void 0:B.map(k=>structuredClone(i.toRaw(k))))??[],s()];return a.value&&v.forEach(k=>{var $;const R=c(k);R?k.name+=` (${R} ${($=l.value)==null?void 0:$.currency})`:k.name=""}),v.filter(k=>k.name!=="")}),h=i.ref(n.value.coefficient),u=i.ref(((S=(C=n.value)==null?void 0:C.value)==null?void 0:S.toString())??null),m=i.ref(null),g=i.computed(()=>{var v,B;return(B=(v=l.value)==null?void 0:v.priceCoefficients)==null?void 0:B.find(k=>k.coefficient.slug===G.PriceCoefficientEnum.K0)}),f=i.ref(void 0),p=()=>{var B,k,R;f.value=void 0;let v=Number.parseFloat(((B=u.value)==null?void 0:B.replace(",","."))??"");if(v=Number.isNaN(v)?void 0:v,a.value)if(h.value||u.value){const $=s(),P=c(h.value??$)??0,I=P+P*((v??0)/100);m.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(I),I>(((k=l.value)==null?void 0:k.getRetailCost())??I)&&(f.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&I<(((R=g.value)==null?void 0:R.cost)??0)&&(f.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else m.value=null;r("update:value",{value:Number.isNaN(v)?void 0:v,coefficient:o(h.value)?void 0:structuredClone(i.toRaw(h.value))})},y=v=>{O.isArray(v)||(h.value=v,!h.value&&u.value&&(h.value=s()),p())},b=()=>{h.value||(h.value=s()),p()},_=v=>{var k,R,$,P,I,V;const B=Number.parseFloat((v==null?void 0:v.replace(",","."))??"");if(a.value){let A=0;if(B<=0)h.value=void 0,u.value=null;else if(g.value&&B<(((k=g.value)==null?void 0:k.cost)??0))h.value=(R=g.value)==null?void 0:R.coefficient,A=(B-g.value.cost)*100/g.value.cost,f.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(B>((($=l.value)==null?void 0:$.getRetailCost())??B)){h.value=s();const L=((P=l.value)==null?void 0:P.getRetailCost())??0;A=(B-L)*100/L,f.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const L=(V=(I=l.value)==null?void 0:I.priceCoefficients)==null?void 0:V.filter(D=>D.cost<B);if(L&&L.length>0){const D=L.at(-1);h.value=D==null?void 0:D.coefficient,A=(B-((D==null?void 0:D.cost)??0))*100/((D==null?void 0:D.cost)??1)}f.value={validationStatus:void 0,feedback:void 0}}u.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(A),r("update:value",{value:Number.isNaN(A)?void 0:A,coefficient:o(h.value)?void 0:structuredClone(i.toRaw(h.value))})}else r("update:value",{value:Number.isNaN(B)?void 0:B,coefficient:void 0})};return i.onMounted(()=>{var v,B,k,R;n.calculationType===G.CalculationTypeEnum.m2Cost?m.value=((B=(v=n.value)==null?void 0:v.value)==null?void 0:B.toString())??null:!((k=n.value)!=null&&k.coefficient)&&((R=n.value)!=null&&R.value)&&(h.value=s()),p()}),(v,B)=>{var $,P,I;const k=z.NInput,R=z.NInputGroup;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{"show-label":!i.unref(O.isNil)(t.label),label:t.label,"show-feedback":!i.unref(O.isNil)((($=f.value)==null?void 0:$.feedback)??t.feedback),feedback:((P=f.value)==null?void 0:P.feedback)??t.feedback,"validation-status":((I=f.value)==null?void 0:I.validationStatus)??t.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&t.calculationType!==i.unref(G.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(G.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(R,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(kd,{class:"w-full min-w-0 flex-1",value:h.value,"reference-list":d.value,clearable:t.clearable,disabled:t.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"onUpdate:value":y},null,8,["value","reference-list","clearable","disabled"]),i.createVNode(k,{value:u.value,"onUpdate:value":[B[0]||(B[0]=V=>u.value=V),b],clearable:t.clearable,disabled:t.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[B[3]||(B[3]=i.createTextVNode("%",-1))]),_:2},[u.value&&!u.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[B[2]||(B[2]=i.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):i.createCommentVNode("",!0),a.value||t.calculationType===i.unref(G.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(k,{key:1,value:m.value,"onUpdate:value":[B[1]||(B[1]=V=>m.value=V),_],clearable:t.clearable,disabled:t.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var V;return[i.createTextVNode(i.toDisplayString((V=l.value)==null?void 0:V.currency),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):i.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),Z0={key:0,class:"flex flex-row gap-2.5"},Q0={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},J0={},Cd=i.defineComponent({...J0,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.show),a=i.ref(r.processing),l=bt.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=bt.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=i.computed(()=>window.innerWidth*c.value),h=()=>{s("opening"),o.value=!0,s("update:show",o.value)},u=(g="other")=>{if(a.value){s("processing:cancel",b=>{a.value=b});return}let f=!1;s("closing",g,()=>{f=!0}),f||(o.value=!1,s("update:show",o.value))},m=()=>{s("accept",f=>{a.value=f})};return i.watch(()=>r.show,g=>{g?h():u("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:h,close:u}),(g,f)=>{const p=z.NButton,y=z.NModal;return i.openBlock(),i.createBlock(y,{loading:a.value,show:o.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:t.title,"action-class":g.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:f[1]||(f[1]=b=>u("header")),onEsc:f[2]||(f[2]=b=>u("esc")),onMaskClick:f[3]||(f[3]=b=>u("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(g.$slots,"default")]),_:2},[g.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(g.$slots,"header")]),key:"0"}:void 0,g.$slots.action||g.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:i.withCtx(()=>[g.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",Z0,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Q0,[i.renderSlot(g.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(p,{key:0,disabled:a.value||!t.valid,size:i.unref(l),type:"primary",onClick:m},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(p,{key:1,size:i.unref(l),type:"default",onClick:f[0]||(f[0]=b=>u("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","action-class"])}}}),ey={class:"text-sm"},ty={class:"text-sm"},ny={},iy=i.defineComponent({...ny,__name:"add-product-to-cart-dialog",emits:["submit"],setup(t,{expose:e,emit:n}){const r=i.ref(null),s=i.ref(void 0),o=i.ref(null),a=n,l=i.ref({length:{},quantity:{},marker:{}}),c=i.ref(!1),d=i.computed(()=>{var y,b,_,C,S,v,B,k,R;if(!r.value)return"";const f=((b=(y=r.value)==null?void 0:y.properties)==null?void 0:b.minLength)??((C=(_=r.value)==null?void 0:_.properties)!=null&&C.ignoreMinCountCheck?0:(v=(S=r.value)==null?void 0:S.properties)==null?void 0:v.minCount),p=(k=(B=r.value)==null?void 0:B.properties)==null?void 0:k.maxLength;return f||p?`(${f?`от ${f}`:""}${f&&p?" ":""}${p?`до ${p}`:""} ${(R=r.value)==null?void 0:R.unit})`:""}),h=f=>{!r.value||!o.value||(G.UnitsHelper.productIsMeasurable(r.value)||delete o.value.length,c.value=!0,a("submit",o.value,l.value,()=>{c.value=!1,f(!1)}))},u=()=>{r.value=null,s.value=void 0,o.value=null,l.value=g()},m=(f,p)=>{var y,b,_,C;r.value=f,s.value=p,o.value=new G.CartItemBase(p??new G.CartItemBase({product:f,quantity:((y=f==null?void 0:f.properties)==null?void 0:y.minCount)??1,length:((b=f==null?void 0:f.properties)==null?void 0:b.minLength)||((_=f==null?void 0:f.properties)!=null&&_.ignoreMinCountCheck?0:(C=f==null?void 0:f.properties)==null?void 0:C.minCount)||0}))},g=()=>({length:{},quantity:{},marker:{}});return e({show:m,closeDialog:u}),(f,p)=>(i.openBlock(),i.createBlock(Cd,{show:!i.unref(O.isNil)(r.value)&&!i.unref(O.isNil)(o.value),title:`${s.value?"Изменение":"Добавление"} товара в корзину`,"accept-button":{show:!0,text:s.value?"Изменить":"В корзину"},processing:c.value,onAccept:h,onClosing:u},{default:i.withCtx(()=>[r.value&&o.value?(i.openBlock(),i.createBlock(i.unref(z.NForm),{key:0,class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.unref(G.UnitsHelper).productIsMeasurable(r.value)?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:0,required:!0,feedback:l.value.length.feedback||"","show-feedback":l.value.length.showFeedback||i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value)!==.01||!1,"validation-status":l.value.length.validationStatus||void 0,label:"Метраж, "+r.value.unit+d.value+"м."},i.createSlots({default:i.withCtx(()=>{var y,b;return[i.createVNode(i.unref(z.NInputNumber),{value:o.value.length,"onUpdate:value":p[0]||(p[0]=_=>o.value.length=_),"show-button":!1,max:((y=r.value.properties)==null?void 0:y.maxLength)||void 0,min:((b=r.value.properties)==null?void 0:b.minLength)||i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value),step:i.unref(G.UnitsHelper).getProductMultiplicity(r.value),validator:_=>{const C=i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value);return Math.round(_/C)*C===_},placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]}),_:2},[!l.value.length.feedback&&i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value)!==.01?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",ey,"Метраж должен быть кратен "+i.toDisplayString(i.unref(G.UnitsHelper).getProductLengthMultiplicity(r.value)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status","label"])):i.createCommentVNode("",!0),i.createVNode(i.unref(z.NFormItem),{required:!0,feedback:l.value.quantity.feedback||"","show-feedback":l.value.quantity.showFeedback||i.unref(G.UnitsHelper).getProductMultiplicity(r.value)!==1||!1,"validation-status":l.value.quantity.validationStatus||void 0,label:"Количество"},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:o.value.quantity,"onUpdate:value":p[1]||(p[1]=y=>o.value.quantity=y),"show-button":!1,min:i.unref(G.UnitsHelper).getProductMultiplicity(r.value),step:i.unref(G.UnitsHelper).getProductMultiplicity(r.value),validator:y=>y%i.unref(G.UnitsHelper).getProductMultiplicity(r.value)===0,placeholder:"Введите количество",class:"w-full"},null,8,["value","min","step","validator"])]),_:2},[!l.value.quantity.feedback&&i.unref(G.UnitsHelper).getProductMultiplicity(r.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",ty,"Количество должно быть кратно "+i.toDisplayString(i.unref(G.UnitsHelper).getProductMultiplicity(r.value)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(z.NFormItem),{feedback:l.value.marker.feedback||"","show-feedback":l.value.marker.showFeedback||!1,"validation-status":l.value.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:o.value.marker,"onUpdate:value":p[2]||(p[2]=y=>o.value.marker=y),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"]))}}),ry={class:"flex flex-row gap-1"},sy={class:"sc-client-name flex flex-col gap-1 text-base"},oy=["href"],ay={key:1,class:"text-sc-grey"},ly={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},cy={key:0},dy={key:1,class:"text-sm"},hy={},os=i.defineComponent({...hy,__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(t,{emit:e}){const n=t,r=e,s=i.computed(()=>n.client.lastLoginAt?Mn.format(n.client.lastLoginAt,G.AppConfigProvider.getConfig().dateFormats.uiDateWithTime):""),o=a=>{O.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Fs,d=z.NButton,h=z.NPopover;return i.openBlock(),i.createElementBlock("div",ry,[t.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=u=>a.$emit("click:client-info",t.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(h,{disabled:i.unref(O.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",sy,[i.createElementVNode("a",{href:t.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=u=>o(u))},[i.createElementVNode("span",{class:i.normalizeClass({"line-through":!t.client.isActive})},i.toDisplayString(t.client.name),3),t.showSalesDirection&&t.client.salesDirection?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"line-through":!t.client.isActive})}," ("+i.toDisplayString(t.client.salesDirection.name)+") ",3)):i.createCommentVNode("",!0),t.client.isActive?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",ay," [ Деактивирован ] "))],8,oy),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",ly," г. "+i.toDisplayString(t.client.city.name)+", "+i.toDisplayString(t.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[t.client.alternativeName?(i.openBlock(),i.createElementBlock("div",cy,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("span",dy," Последний вход: "+i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),uy={class:"text-base"},fy={},Sd=i.defineComponent({...fy,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("span",uy,i.toDisplayString(t.contragent.name),1))}}),gy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function my(t,e){return i.openBlock(),i.createElementBlock("svg",gy,[...e[0]||(e[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 py=i.markRaw({name:"tabler-mail",render:my}),yy=["href"],by={},_y=i.defineComponent({...by,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=py;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,yy)],2)}}}),wy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function xy(t,e){return i.openBlock(),i.createElementBlock("svg",wy,[...e[0]||(e[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 Bd=i.markRaw({name:"fa6-brands-viber",render:xy}),vy={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},ky=["id"],Cy=["id"],Sy=["fill"],By=["fill"];function Ty(t,e){return i.openBlock(),i.createElementBlock("svg",vy,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:t.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,ky),i.createElementVNode("linearGradient",{id:t.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,Cy)]),i.createElementVNode("path",{fill:"url(#"+t.idMap.SVGBRLHCcSy+")",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,Sy),i.createElementVNode("path",{fill:"url(#"+t.idMap.SVGHW6lecxh+")",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,By),e[2]||(e[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 Td=i.markRaw({name:"logos-whatsapp-icon",render:Ty,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),Ry={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},$y=["id"],Ey=["fill"];function Ny(t,e){return i.openBlock(),i.createElementBlock("svg",Ry,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:t.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,$y)]),i.createElementVNode("path",{fill:"url(#"+t.idMap.SVGuySfwdaH+")",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,Ey),e[1]||(e[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 Rd=i.markRaw({name:"logos-telegram",render:Ny,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),Py={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Fy(t,e){return i.openBlock(),i.createElementBlock("svg",Py,[...e[0]||(e[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 $d=i.markRaw({name:"ion-call",render:Fy}),My={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ay(t,e){return i.openBlock(),i.createElementBlock("svg",My,[...e[0]||(e[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 Vy=i.markRaw({name:"tabler-phone-call",render:Ay}),Oy={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},Iy=["href"],zy=["href"],Ly=["href"],Dy=["href"],Hy={},Wy=i.defineComponent({...Hy,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?Ji.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return O.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),s=i.computed(()=>{var l;return O.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var l;return O.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=Vy,h=$d,u=Rd,m=Td,g=Bd;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]=f=>a.value=!a.value),onFocusout:c[1]||(c[1]=f=>a.value=!1),onMouseleave:c[2]||(c[2]=f=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showPhoneIcon})},[t.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",Oy,[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,Iy)):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,zy)):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(m)],8,Ly)):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(g)],8,Dy)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),jy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function qy(t,e){return i.openBlock(),i.createElementBlock("svg",jy,[...e[0]||(e[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 Xy=i.markRaw({name:"mdi-envelope",render:qy}),Yy={class:"flex flex-col gap-1"},Uy={key:0,class:"mb-2 flex flex-col text-base"},Gy={key:0,class:"text-sc-dark-grey text-sm"},Ky={key:1,class:"whitespace-nowrap text-sm"},Zy={key:2,class:"whitespace-nowrap text-sm"},Qy={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},Jy=["href"],eb=["href"],tb=["href"],nb=["href"],ib=["href"],rb={key:0,class:"flex flex-col text-base"},sb={key:0,class:"text-sc-dark-grey text-sm"},ob={key:1,class:"mt-2 text-sm"},ab={key:0,class:"-mt-1"},lb={},cb=i.defineComponent({...lb,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(t){const e=t,n=i.computed(()=>{try{return e.contact.phone?Ji.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),r=i.computed(()=>{var c;return O.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),s=i.computed(()=>{var c;return O.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var c;return O.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("E.164"))??""}),a=i.computed(()=>r.value||e.contact.email),l=i.ref(!1);return(c,d)=>{var y,b;const h=$d,u=Rd,m=Td,g=Bd,f=Xy,p=z.NPopover;return i.openBlock(),i.createElementBlock("div",Yy,[i.createVNode(p,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var _,C,S,v;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(_=t.contact)!=null&&_.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.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,[t.fullView&&(t.contact.name||(C=t.contact)!=null&&C.position)?(i.openBlock(),i.createElementBlock("div",Uy,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(S=t.contact)!=null&&S.position?(i.openBlock(),i.createElementBlock("span",Gy,i.toDisplayString((v=t.contact)==null?void 0:v.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",Ky,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",Zy,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",Qy,[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,Jy)):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,eb)):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(m)],8,tb)):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(g)],8,nb)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(f)],8,ib)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var _,C,S,v;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",rb,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(_=t.contact)!=null&&_.position?(i.openBlock(),i.createElementBlock("span",sb,i.toDisplayString((C=t.contact)==null?void 0:C.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(S=t.contact)!=null&&S.comment?(i.openBlock(),i.createElementBlock("div",ob,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((v=t.contact)==null?void 0:v.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),t.fullView&&((y=t.contact)!=null&&y.comment)?(i.openBlock(),i.createElementBlock("div",ab,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((b=t.contact)==null?void 0:b.comment),1)])):i.createCommentVNode("",!0)])}}}),db={class:"flex flex-wrap gap-2"},hb={class:"flex flex-col"},ub={class:"flex flex-col"},fb={},gb=i.defineComponent({...fb,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>G.AppConfigProvider.getConfig().dateFormats.uiDate},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1}},emits:["update:date-range"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>{if(n.predefinedDateRanges)return n.predefinedDateRanges;if(n.useDefaultPredefinedDateRanges){const a={};return O.forOwn(G.DateTimeProvider.defaultDateRanges(),(l,c)=>{a[c]={label:l.label,from:l.from??void 0,to:l.to??void 0}}),a}}),o=(a,l)=>{r("update:date-range",{from:a?Mn.startOfDay(new Date(a)):void 0,to:l?Mn.endOfDay(new Date(l)):void 0})};return(a,l)=>{var h,u,m,g,f,p;const c=z.NButton,d=z.NDatePicker;return i.openBlock(),i.createElementBlock("div",db,[i.createVNode(d,{value:((u=(h=t.dateRange)==null?void 0:h.from)==null?void 0:u.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.to)&&y>((_=t.dateRange)==null?void 0:_.to)},disabled:(m=t.disabled)==null?void 0:m.from,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[0]||(l[0]=y=>{var b,_;return o(y,(_=(b=t.dateRange)==null?void 0:b.to)==null?void 0:_.getTime())})},i.createSlots({_:2},[s.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",hb,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var C,S;return o((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(S=y==null?void 0:y.to)==null?void 0:S.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((f=(g=t.dateRange)==null?void 0:g.to)==null?void 0:f.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.from)&&y<((_=t.dateRange)==null?void 0:_.from)},disabled:(p=t.disabled)==null?void 0:p.to,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[1]||(l[1]=y=>{var b,_;return o((_=(b=t.dateRange)==null?void 0:b.from)==null?void 0:_.getTime(),y)})},i.createSlots({_:2},[s.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",ub,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var C,S;return o((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(S=y==null?void 0:y.to)==null?void 0:S.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),mb={class:"sc-lbl-date text-nowrap"},pb={},Po=i.defineComponent({...pb,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean}},setup(t){const e=t,n=i.computed(()=>Mn.format(e.date,G.AppConfigProvider.getConfig().dateFormats.uiDate)),r=i.computed(()=>Mn.format(e.date,"HH:mm"));return(s,o)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",mb,i.toDisplayString(n.value),1),i.createElementVNode("span",{class:i.normalizeClass([{"text-sc-grey":t.isTimeSecondary,"ml-1":!t.isTimeOnSecondLine},"sc-lbl-time"])},i.toDisplayString(r.value),3)],2))}}),yb={class:"flex flex-row gap-2.5"},bb={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},_b={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},wb={class:"mb-0.5 sm:mb-0 sm:ml-3"},xb={},vb=i.defineComponent({...xb,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=ss,s=z.NButton,o=z.NPopover;return i.openBlock(),i.createElementBlock("div",yb,[i.createElementVNode("div",bb,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",_b,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",wb,[t.showCloseButton?(i.openBlock(),i.createBlock(o,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(s,{size:"small",type:"error",onClick:n[0]||(n[0]=a=>e.$emit("close"))},{default:i.withCtx(()=>[i.createVNode(r)]),_:1})]),default:i.withCtx(()=>[n[1]||(n[1]=i.createTextVNode(" Закрыть ",-1))]),_:1})):i.createCommentVNode("",!0)])])])])}}}),kb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Cb(t,e){return i.openBlock(),i.createElementBlock("svg",kb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const Sb=i.markRaw({name:"ion-download-outline",render:Cb}),Bb={},Tb=i.defineComponent({...Bb,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(t,{emit:e}){const n=t,r=e,s=i.ref([]),o=i.computed(()=>s.value.map(l=>(l.status=n.isError?"error":"finished",l))),a=l=>{s.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const h=new FileReader;h.addEventListener("load",()=>{c.content=h.result??"",r("update:file",c)}),h.readAsDataURL(d.file)};return(l,c)=>{const d=Sb;return i.openBlock(),i.createBlock(i.unref(z.NUpload),{"file-list":o.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:t.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NUploadDragger),null,{default:i.withCtx(()=>[i.renderSlot(l.$slots,"dragged-area",{},()=>[i.createElementVNode("div",null,[i.createVNode(d,{class:"text-2xl"}),i.createElementVNode("div",null,i.toDisplayString(t.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),Rb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $b(t,e){return i.openBlock(),i.createElementBlock("svg",Rb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const Eb=i.markRaw({name:"ion-checkmark-done-sharp",render:$b}),Nb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Pb(t,e){return i.openBlock(),i.createElementBlock("svg",Nb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const Fb=i.markRaw({name:"ion-options-outline",render:Pb}),Mb={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},Ab={class:"flex-auto"},Vb={class:"sticky top-0 flex flex-none flex-col justify-start gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},Ob={class:"flex flex-none flex-col-reverse justify-end gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},Ib={},Fo=i.defineComponent({...Ib,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(t,{emit:e}){const n=e,r=i.ref(!1),s=()=>{n("edit")},o=()=>{r.value=!1},a=()=>{r.value=!0,n("apply",o)},l=()=>{n("cancel",o)};return(c,d)=>{const h=Fb,u=z.NButton,m=z.NPopover,g=Eb,f=ss;return i.openBlock(),i.createElementBlock("div",Mb,[i.createElementVNode("div",Ab,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",Vb,[i.createElementVNode("div",Ob,[t.showEditButton?(i.openBlock(),i.createBlock(m,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:t.disabled||r.value,type:"info",ghost:"",size:"small",onClick:s},{default:i.withCtx(()=>[i.createVNode(h)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),t.showApplyButton?(i.openBlock(),i.createBlock(m,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:t.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),t.showCancelButton?(i.openBlock(),i.createBlock(m,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:t.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),zb={},Ed=i.defineComponent({...zb,__name:"inline-editable-item",props:{disabled:{type:Boolean,default:!1},showEditor:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!0}},emits:["editor:apply","editor:cancel"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.showEditor),o=l=>{r("editor:apply",d=>{s.value=!d,l()})},a=l=>{s.value=!1,l(),r("editor:cancel")};return i.onMounted(()=>{i.watch(()=>n.showEditor,l=>{s.value=l})}),(l,c)=>(i.openBlock(),i.createElementBlock("div",null,[s.value?(i.openBlock(),i.createBlock(Fo,{key:1,disabled:t.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:o,onCancel:a},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-editor-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(i.openBlock(),i.createBlock(Fo,{key:0,disabled:t.disabled,"show-edit-button":t.showEditButton,onEdit:c[0]||(c[0]=d=>s.value=!0)},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-viewer-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),Lb={},Db=i.defineComponent({...Lb,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.value),o=i.computed(()=>i.inject("debounce-input-time",n.debounceTime)),a=O.debounce(()=>r("update:value",s.value),o.value),l=c=>{s.value=c,a()};return i.watch(()=>n.value,c=>{s.value=c}),(c,d)=>(i.openBlock(),i.createBlock(i.unref(z.NInput),{value:s.value,"onUpdate:value":[d[0]||(d[0]=h=>s.value=h),l],clearable:t.clearable,placeholder:t.placeholder},{prefix:i.withCtx(()=>[i.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),Hb={},Wb=i.defineComponent({...Hb,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,s=i.ref((n.value??"").replaceAll(/\D*/g,"")),o=O.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(O.isString(c))s.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(O.isObject(c)){if(s.value=c.formatted,!c.valid)return;d=c instanceof Ji.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}n.debounceTime?o(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const h=Ji.parsePhoneNumberWithError(`+${d}`);h.isValid()?s.value=h.format("E.164"):h.getPossibleCountries().length>0&&(s.value=`+${d}`)}catch(h){if(h instanceof Ji.ParseError)s.value=d;else throw h}};return i.watch(()=>n.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=s.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),i.onBeforeMount(()=>l(s.value??"")),(c,d)=>(i.openBlock(),i.createBlock(i.unref(Au.VueTelInput),{modelValue:s.value,"onUpdate:modelValue":[d[0]||(d[0]=h=>s.value=h),a],"auto-default-country":!1,"auto-format":!0,"default-country":t.defaultCountry,disabled:t.disabled,"input-options":{placeholder:t.placeholder},"preferred-countries":t.preferredCountries,"only-countries":t.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),jb=Zn(Wb,[["__scopeId","data-v-751dbb0e"]]),qb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xb(t,e){return i.openBlock(),i.createElementBlock("svg",qb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const Yb=i.markRaw({name:"tabler-external-link",render:Xb}),Ub={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},Gb=["href"],Kb={},Zb=i.defineComponent({...Kb,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=Yb,s=z.NTooltip;return i.openBlock(),i.createBlock(s,{disabled:i.unref(O.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",Ub,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,Gb),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),Qb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Jb(t,e){return i.openBlock(),i.createElementBlock("svg",Qb,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const e_=i.markRaw({name:"ion-remove-circle-outline",render:Jb});let as=[];const Nd=new WeakMap;function t_(){as.forEach(t=>t(...Nd.get(t))),as=[]}function Pd(t,...e){Nd.set(t,e),!as.includes(t)&&as.push(t)===1&&requestAnimationFrame(t_)}function cr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function dr(t){return t.composedPath()[0]||null}function hr(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function ur(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function Yt(t,e){const n=t.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+t+" is not a valid value.")}return e===void 0?r:r[e]}const Fd={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32",transparent:"#0000"};function n_(t,e,n){e/=100,n/=100;let r=(s,o=(s+t/60)%6)=>n-n*e*Math.max(Math.min(o,4-o,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function i_(t,e,n){e/=100,n/=100;let r=e*Math.min(n,1-n),s=(o,a=(o+t/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[s(0)*255,s(8)*255,s(4)*255]}const dn="^\\s*",hn="\\s*$",Ln="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Mt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",si="([0-9A-Fa-f])",oi="([0-9A-Fa-f]{2})",Md=new RegExp(`${dn}hsl\\s*\\(${Mt},${Ln},${Ln}\\)${hn}`),Ad=new RegExp(`${dn}hsv\\s*\\(${Mt},${Ln},${Ln}\\)${hn}`),Vd=new RegExp(`${dn}hsla\\s*\\(${Mt},${Ln},${Ln},${Mt}\\)${hn}`),Od=new RegExp(`${dn}hsva\\s*\\(${Mt},${Ln},${Ln},${Mt}\\)${hn}`),r_=new RegExp(`${dn}rgb\\s*\\(${Mt},${Mt},${Mt}\\)${hn}`),s_=new RegExp(`${dn}rgba\\s*\\(${Mt},${Mt},${Mt},${Mt}\\)${hn}`),o_=new RegExp(`${dn}#${si}${si}${si}${hn}`),a_=new RegExp(`${dn}#${oi}${oi}${oi}${hn}`),l_=new RegExp(`${dn}#${si}${si}${si}${si}${hn}`),c_=new RegExp(`${dn}#${oi}${oi}${oi}${oi}${hn}`);function $t(t){return parseInt(t,16)}function d_(t){try{let e;if(e=Vd.exec(t))return[cs(e[1]),Dn(e[5]),Dn(e[9]),li(e[13])];if(e=Md.exec(t))return[cs(e[1]),Dn(e[5]),Dn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function h_(t){try{let e;if(e=Od.exec(t))return[cs(e[1]),Dn(e[5]),Dn(e[9]),li(e[13])];if(e=Ad.exec(t))return[cs(e[1]),Dn(e[5]),Dn(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function ai(t){try{let e;if(e=a_.exec(t))return[$t(e[1]),$t(e[2]),$t(e[3]),1];if(e=r_.exec(t))return[dt(e[1]),dt(e[5]),dt(e[9]),1];if(e=s_.exec(t))return[dt(e[1]),dt(e[5]),dt(e[9]),li(e[13])];if(e=o_.exec(t))return[$t(e[1]+e[1]),$t(e[2]+e[2]),$t(e[3]+e[3]),1];if(e=c_.exec(t))return[$t(e[1]),$t(e[2]),$t(e[3]),li($t(e[4])/255)];if(e=l_.exec(t))return[$t(e[1]+e[1]),$t(e[2]+e[2]),$t(e[3]+e[3]),li($t(e[4]+e[4])/255)];if(t in Fd)return ai(Fd[t]);if(Md.test(t)||Vd.test(t)){const[n,r,s,o]=d_(t);return[...i_(n,r,s),o]}else if(Ad.test(t)||Od.test(t)){const[n,r,s,o]=h_(t);return[...n_(n,r,s),o]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function u_(t){return t>1?1:t<0?0:t}function Mo(t,e,n,r){return`rgba(${dt(t)}, ${dt(e)}, ${dt(n)}, ${u_(r)})`}function Ao(t,e,n,r,s){return dt((t*e*(1-r)+n*r)/s)}function f_(t,e){Array.isArray(t)||(t=ai(t)),Array.isArray(e)||(e=ai(e));const n=t[3],r=e[3],s=li(n+r-n*r);return Mo(Ao(t[0],n,e[0],r,s),Ao(t[1],n,e[1],r,s),Ao(t[2],n,e[2],r,s),s)}function Fe(t,e){const[n,r,s,o=1]=Array.isArray(t)?t:ai(t);return typeof e.alpha=="number"?Mo(n,r,s,e.alpha):Mo(n,r,s,o)}function ls(t,e){const[n,r,s,o=1]=Array.isArray(t)?t:ai(t),{lightness:a=1,alpha:l=1}=e;return g_([n*a,r*a,s*a,o*l])}function li(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function cs(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function dt(t){const e=Math.round(Number(t));return e>255?255:e<0?0:e}function Dn(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function g_(t){const[e,n,r]=t;return 3 in t?`rgba(${dt(e)}, ${dt(n)}, ${dt(r)}, ${li(t[3])})`:`rgba(${dt(e)}, ${dt(n)}, ${dt(r)}, 1)`}function m_(t=8){return Math.random().toString(16).slice(2,2+t)}function Id(t){return Array.isArray(t)?t:[t]}const Vo={STOP:"STOP"};function zd(t,e){const n=e(t);t.children!==void 0&&n!==Vo.STOP&&t.children.forEach(r=>zd(r,e))}function p_(t,e={}){const{preserveGroup:n=!1}=e,r=[],s=n?a=>{a.isLeaf||(r.push(a.key),o(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),o(a.children))};function o(a){a.forEach(s)}return o(t),r}function y_(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function b_(t){return t.children}function __(t){return t.key}function w_(){return!1}function x_(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function v_(t){return t.disabled===!0}function k_(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function C_(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function Oo(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Io(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function S_(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function B_(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function T_(t){return(t==null?void 0:t.type)==="group"}function R_(t){const e=new Map;return t.forEach((n,r)=>{e.set(n.key,r)}),n=>{var r;return(r=e.get(n))!==null&&r!==void 0?r:null}}class $_ extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function E_(t,e,n,r){return ds(e.concat(t),n,r,!1)}function N_(t,e){const n=new Set;return t.forEach(r=>{const s=e.treeNodeMap.get(r);if(s!==void 0){let o=s.parent;for(;o!==null&&!(o.disabled||n.has(o.key));)n.add(o.key),o=o.parent}}),n}function P_(t,e,n,r){const s=ds(e,n,r,!1),o=ds(t,n,r,!0),a=N_(t,n),l=[];return s.forEach(c=>{(o.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>s.delete(c)),s}function zo(t,e){const{checkedKeys:n,keysToCheck:r,keysToUncheck:s,indeterminateKeys:o,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=t;if(!a)return r!==void 0?{checkedKeys:S_(n,r),indeterminateKeys:Array.from(o)}:s!==void 0?{checkedKeys:B_(n,s),indeterminateKeys:Array.from(o)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(o)};const{levelTreeNodeMap:h}=e;let u;s!==void 0?u=P_(s,n,e,d):r!==void 0?u=E_(r,n,e,d):u=ds(n,e,d,!1);const m=c==="parent",g=c==="child"||l,f=u,p=new Set,y=Math.max.apply(null,Array.from(h.keys()));for(let b=y;b>=0;b-=1){const _=b===0,C=h.get(b);for(const S of C){if(S.isLeaf)continue;const{key:v,shallowLoaded:B}=S;if(g&&B&&S.children.forEach(P=>{!P.disabled&&!P.isLeaf&&P.shallowLoaded&&f.has(P.key)&&f.delete(P.key)}),S.disabled||!B)continue;let k=!0,R=!1,$=!0;for(const P of S.children){const I=P.key;if(!P.disabled){if($&&($=!1),f.has(I))R=!0;else if(p.has(I)){R=!0,k=!1;break}else if(k=!1,R)break}}k&&!$?(m&&S.children.forEach(P=>{!P.disabled&&f.has(P.key)&&f.delete(P.key)}),f.add(v)):R&&p.add(v),_&&g&&f.has(v)&&f.delete(v)}}return{checkedKeys:Array.from(f),indeterminateKeys:Array.from(p)}}function ds(t,e,n,r){const{treeNodeMap:s,getChildren:o}=e,a=new Set,l=new Set(t);return t.forEach(c=>{const d=s.get(c);d!==void 0&&zd(d,h=>{if(h.disabled)return Vo.STOP;const{key:u}=h;if(!a.has(u)&&(a.add(u),l.add(u),k_(h.rawNode,o))){if(r)return Vo.STOP;if(!n)throw new $_}})}),l}function F_(t,{includeGroup:e=!1,includeSelf:n=!0},r){var s;const o=r.treeNodeMap;let a=t==null?null:(s=o.get(t))!==null&&s!==void 0?s:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(e||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),n||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function M_(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function A_(t,e){const n=t.siblings,r=n.length,{index:s}=t;return e?n[(s+1)%r]:s===n.length-1?null:n[s+1]}function Ld(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const s=e==="prev"?V_:A_,o={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===t){if(!a)a=!0;else if(!t.disabled&&!t.isGroup){l=t;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const h=Lo(d,o);h!==null?l=h:c(s(d,n))}else{const h=s(d,!1);if(h!==null)c(h);else{const u=O_(d);u!=null&&u.isGroup?c(s(u,n)):n&&c(s(d,!0))}}}}return c(t),l}function V_(t,e){const n=t.siblings,r=n.length,{index:s}=t;return e?n[(s-1+r)%r]:s===0?null:n[s-1]}function O_(t){return t.parent}function Lo(t,e={}){const{reverse:n=!1}=e,{children:r}=t;if(r){const{length:s}=r,o=n?s-1:0,a=n?-1:s,l=n?-1:1;for(let c=o;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const h=Lo(d,e);if(h!==null)return h}else return d}}return null}const I_={getChild(){return this.ignored?null:Lo(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return Ld(this,"next",t)},getPrev(t={}){return Ld(this,"prev",t)}};function z_(t,e){const n=e?new Set(e):void 0,r=[];function s(o){o.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||n===void 0||n.has(a.key))&&s(a.children)})}return s(t),r}function L_(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var D_={};function Dd(t,e,n,r,s,o=null,a=0){const l=[];return t.forEach((c,d)=>{var h;D_.NODE_ENV!=="production"&&C_(c,s)&&console.error("[treemate]: node",c,"is invalid");const u=Object.create(r);if(u.rawNode=c,u.siblings=l,u.level=a,u.index=d,u.isFirstChild=d===0,u.isLastChild=d+1===t.length,u.parent=o,!u.ignored){const m=s(c);Array.isArray(m)&&(u.children=Dd(m,e,n,r,s,u,a+1))}l.push(u),e.set(u.key,u),n.has(a)||n.set(a,[]),(h=n.get(a))===null||h===void 0||h.push(u)}),l}function H_(t,e={}){var n;const r=new Map,s=new Map,{getDisabled:o=v_,getIgnored:a=w_,getIsGroup:l=T_,getKey:c=__}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:b_,h=e.ignoreEmptyChildren?S=>{const v=d(S);return Array.isArray(v)?v.length?v:null:v}:d,u=Object.assign({get key(){return c(this.rawNode)},get disabled(){return o(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return y_(this.rawNode,h)},get shallowLoaded(){return x_(this.rawNode,h)},get ignored(){return a(this.rawNode)},contains(S){return L_(this,S)}},I_),m=Dd(t,r,s,u,h);function g(S){if(S==null)return null;const v=r.get(S);return v&&!v.isGroup&&!v.ignored?v:null}function f(S){if(S==null)return null;const v=r.get(S);return v&&!v.ignored?v:null}function p(S,v){const B=f(S);return B?B.getPrev(v):null}function y(S,v){const B=f(S);return B?B.getNext(v):null}function b(S){const v=f(S);return v?v.getParent():null}function _(S){const v=f(S);return v?v.getChild():null}const C={treeNodes:m,treeNodeMap:r,levelTreeNodeMap:s,maxLevel:Math.max(...s.keys()),getChildren:h,getFlattenedNodes(S){return z_(m,S)},getNode:g,getPrev:p,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return M_(m)},getPath(S,v={}){return F_(S,v,C)},getCheckedKeys(S,v={}){const{cascade:B=!0,leafOnly:k=!1,checkStrategy:R="all",allowNotLoaded:$=!1}=v;return zo({checkedKeys:Oo(S),indeterminateKeys:Io(S),cascade:B,leafOnly:k,checkStrategy:R,allowNotLoaded:$},C)},check(S,v,B={}){const{cascade:k=!0,leafOnly:R=!1,checkStrategy:$="all",allowNotLoaded:P=!1}=B;return zo({checkedKeys:Oo(v),indeterminateKeys:Io(v),keysToCheck:S==null?[]:Id(S),cascade:k,leafOnly:R,checkStrategy:$,allowNotLoaded:P},C)},uncheck(S,v,B={}){const{cascade:k=!0,leafOnly:R=!1,checkStrategy:$="all",allowNotLoaded:P=!1}=B;return zo({checkedKeys:Oo(v),indeterminateKeys:Io(v),keysToUncheck:S==null?[]:Id(S),cascade:k,leafOnly:R,checkStrategy:$,allowNotLoaded:P},C)},getNonLeafKeys(S={}){return p_(m,S)}};return C}function hs(t){return t.composedPath()[0]}const W_={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function j_(t,e,n){if(t==="mousemoveoutside"){const r=s=>{e.contains(hs(s))||n(s)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const s=a=>{r=!e.contains(hs(a))},o=a=>{r&&(e.contains(hs(a))||n(a))};return{mousedown:s,mouseup:o,touchstart:s,touchend:o}}return console.error(`[evtd/create-trap-handler]: name \`${t}\` is invalid. This could be a bug of evtd.`),{}}function Hd(t,e,n){const r=W_[t];let s=r.get(e);s===void 0&&r.set(e,s=new WeakMap);let o=s.get(n);return o===void 0&&s.set(n,o=j_(t,e,n)),o}function q_(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const s=Hd(t,e,n);return Object.keys(s).forEach(o=>{kt(o,document,s[o],r)}),!0}return!1}function X_(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const s=Hd(t,e,n);return Object.keys(s).forEach(o=>{et(o,document,s[o],r)}),!0}return!1}function Y_(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const t=new WeakMap,e=new WeakMap;function n(){t.set(this,!0)}function r(){t.set(this,!0),e.set(this,!0)}function s(k,R,$){const P=k[R];return k[R]=function(){return $.apply(k,arguments),P.apply(k,arguments)},k}function o(k,R){k[R]=Event.prototype[R]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,R){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:R??l.get})}const h={bubble:{},capture:{}},u={};function m(){const k=function(R){const{type:$,eventPhase:P,bubbles:I}=R,V=hs(R);if(P===2)return;const A=P===1?"capture":"bubble";let L=V;const D=[];for(;L===null&&(L=window),D.push(L),L!==window;)L=L.parentNode||null;const ee=h.capture[$],E=h.bubble[$];if(s(R,"stopPropagation",n),s(R,"stopImmediatePropagation",r),d(R,c),A==="capture"){if(ee===void 0)return;for(let N=D.length-1;N>=0&&!t.has(R);--N){const H=D[N],q=ee.get(H);if(q!==void 0){a.set(R,H);for(const Y of q){if(e.has(R))break;Y(R)}}if(N===0&&!I&&E!==void 0){const Y=E.get(H);if(Y!==void 0)for(const F of Y){if(e.has(R))break;F(R)}}}}else if(A==="bubble"){if(E===void 0)return;for(let N=0;N<D.length&&!t.has(R);++N){const H=D[N],q=E.get(H);if(q!==void 0){a.set(R,H);for(const Y of q){if(e.has(R))break;Y(R)}}}}o(R,"stopPropagation"),o(R,"stopImmediatePropagation"),d(R)};return k.displayName="evtdUnifiedHandler",k}function g(){const k=function(R){const{type:$,eventPhase:P}=R;if(P!==2)return;const I=u[$];I!==void 0&&I.forEach(V=>V(R))};return k.displayName="evtdUnifiedWindowEventHandler",k}const f=m(),p=g();function y(k,R){const $=h[k];return $[R]===void 0&&($[R]=new Map,window.addEventListener(R,f,k==="capture")),$[R]}function b(k){return u[k]===void 0&&(u[k]=new Set,window.addEventListener(k,p)),u[k]}function _(k,R){let $=k.get(R);return $===void 0&&k.set(R,$=new Set),$}function C(k,R,$,P){const I=h[R][$];if(I!==void 0){const V=I.get(k);if(V!==void 0&&V.has(P))return!0}return!1}function S(k,R){const $=u[k];return!!($!==void 0&&$.has(R))}function v(k,R,$,P){let I;if(typeof P=="object"&&P.once===!0?I=ee=>{B(k,R,I,P),$(ee)}:I=$,q_(k,R,I,P))return;const A=P===!0||typeof P=="object"&&P.capture===!0?"capture":"bubble",L=y(A,k),D=_(L,R);if(D.has(I)||D.add(I),R===window){const ee=b(k);ee.has(I)||ee.add(I)}}function B(k,R,$,P){if(X_(k,R,$,P))return;const V=P===!0||typeof P=="object"&&P.capture===!0,A=V?"capture":"bubble",L=y(A,k),D=_(L,R);if(R===window&&!C(R,V?"bubble":"capture",k,$)&&S(k,$)){const E=u[k];E.delete($),E.size===0&&(window.removeEventListener(k,p),u[k]=void 0)}D.has($)&&D.delete($),D.size===0&&L.delete(R),L.size===0&&(window.removeEventListener(k,f,A==="capture"),h[A][k]=void 0)}return{on:v,off:B}}const{on:kt,off:et}=Y_(),Hi="@@mmoContext",U_={mounted(t,{value:e}){t[Hi]={handler:void 0},typeof e=="function"&&(t[Hi].handler=e,kt("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Hi];typeof e=="function"?n.handler?n.handler!==e&&(et("mousemoveoutside",t,n.handler),n.handler=e,kt("mousemoveoutside",t,e)):(t[Hi].handler=e,kt("mousemoveoutside",t,e)):n.handler&&(et("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Hi];e&&et("mousemoveoutside",t,e),t[Hi].handler=void 0}},Wi="@@coContext",us={mounted(t,{value:e,modifiers:n}){t[Wi]={handler:void 0},typeof e=="function"&&(t[Wi].handler=e,kt("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Wi];typeof e=="function"?r.handler?r.handler!==e&&(et("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,kt("clickoutside",t,e,{capture:n.capture})):(t[Wi].handler=e,kt("clickoutside",t,e,{capture:n.capture})):r.handler&&(et("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[Wi];n&&et("clickoutside",t,n,{capture:e.capture}),t[Wi].handler=void 0}};function G_(t,e){console.error(`[vdirs/${t}]: ${e}`)}class K_{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,n){const{elementZIndex:r}=this;if(n!==void 0){e.style.zIndex=`${n}`,r.delete(e);return}const{nextZIndex:s}=this;r.has(e)&&r.get(e)+1===this.nextZIndex||(e.style.zIndex=`${s}`,r.set(e,s),this.nextZIndex=s+1,this.squashState())}unregister(e,n){const{elementZIndex:r}=this;r.has(e)?r.delete(e):n===void 0&&G_("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:e}=this;e||(this.nextZIndex=2e3),this.nextZIndex-e>2500&&this.rearrange()}rearrange(){const e=Array.from(this.elementZIndex.entries());e.sort((n,r)=>n[1]-r[1]),this.nextZIndex=2e3,e.forEach(n=>{const r=n[0],s=this.nextZIndex++;`${s}`!==r.style.zIndex&&(r.style.zIndex=`${s}`)})}}const Do=new K_,ji="@@ziContext",Wd={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:s}=n;t[ji]={enabled:!!s,initialized:!1},s&&(Do.ensureZIndex(t,r),t[ji].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:s}=n,o=t[ji].enabled;s&&!o&&(Do.ensureZIndex(t,r),t[ji].initialized=!0),t[ji].enabled=!!s},unmounted(t,e){if(!t[ji].initialized)return;const{value:n={}}=e,{zIndex:r}=n;Do.unregister(t,r)}};function Z_(t){const e=i.ref(!!t.value);if(e.value)return i.readonly(e);const n=i.watch(t,r=>{r&&(e.value=!0,n())});return i.readonly(e)}function Wt(t){const e=i.computed(t),n=i.ref(e.value);return i.watch(e,r=>{n.value=r}),typeof t=="function"?n:{__v_isRef:!0,get value(){return n.value},set value(r){t.set(r)}}}const Q_=typeof window<"u";let qi,fr;(()=>{var t,e;qi=Q_?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,fr=!1,qi!==void 0?qi.then(()=>{fr=!0}):fr=!0})();function J_(t){if(fr)return;let e=!1;i.onMounted(()=>{fr||qi==null||qi.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function Ho(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function fs(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function jd(t,e){return i.computed(()=>{for(const n of e)if(t[n]!==void 0)return t[n];return t[e[e.length-1]]})}const e1=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function t1(){return e1}function Wo(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function jo(t,e=!0,n=[]){return t.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&n.push(i.createTextVNode(String(r)));return}if(Array.isArray(r)){jo(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&jo(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function qd(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const s=jo(r());if(s.length===1)return s[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let Hn=null;function Xd(){if(Hn===null&&(Hn=document.getElementById("v-binder-view-measurer"),Hn===null)){Hn=document.createElement("div"),Hn.id="v-binder-view-measurer";const{style:t}=Hn;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(Hn)}return Hn.getBoundingClientRect()}function n1(t,e){const n=Xd();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function qo(t){const e=t.getBoundingClientRect(),n=Xd();return{left:e.left-n.left,top:e.top-n.top,bottom:n.height+n.top-e.bottom,right:n.width+n.left-e.right,width:e.width,height:e.height}}function i1(t){return t.nodeType===9?null:t.parentNode}function Yd(t){if(t===null)return null;const e=i1(t);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:n,overflowX:r,overflowY:s}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(n+s+r))return e}return Yd(e)}const Ud=i.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(t){var e;i.provide("VBinder",(e=i.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const n=i.inject("VBinder",null),r=i.ref(null),s=b=>{r.value=b,n&&t.syncTargetWithParent&&n.setTargetRef(b)};let o=[];const a=()=>{let b=r.value;for(;b=Yd(b),b!==null;)o.push(b);for(const _ of o)kt("scroll",_,u,!0)},l=()=>{for(const b of o)et("scroll",b,u,!0);o=[]},c=new Set,d=b=>{c.size===0&&a(),c.has(b)||c.add(b)},h=b=>{c.has(b)&&c.delete(b),c.size===0&&l()},u=()=>{Pd(m)},m=()=>{c.forEach(b=>b())},g=new Set,f=b=>{g.size===0&&kt("resize",window,y),g.has(b)||g.add(b)},p=b=>{g.has(b)&&g.delete(b),g.size===0&&et("resize",window,y)},y=()=>{g.forEach(b=>b())};return i.onBeforeUnmount(()=>{et("resize",window,y),l()}),{targetRef:r,setTargetRef:s,addScrollListener:d,removeScrollListener:h,addResizeListener:f,removeResizeListener:p}},render(){return Wo("binder",this.$slots)}}),Gd=i.defineComponent({name:"Target",setup(){const{setTargetRef:t,syncTarget:e}=i.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:t,updated:t}}},render(){const{syncTarget:t,setTargetDirective:e}=this;return t?i.withDirectives(qd("follower",this.$slots),[[e]]):qd("follower",this.$slots)}}),r1="@css-render/vue3-ssr";function s1(t,e){return`<style cssr-id="${t}">
|
|
104
104
|
${e}
|
|
105
105
|
</style>`}function o1(t,e,n){const{styles:r,ids:s}=n;s.has(t)||r!==null&&(s.add(t),r.push(s1(t,e)))}const a1=typeof document<"u";function ci(){if(a1)return;const t=i.inject(r1,null);if(t!==null)return{adapter:(e,n)=>o1(e,n,t),context:t}}function Kd(t,e){console.error(`[vueuc/${t}]: ${e}`)}function l1(t){let e=0;for(let n=0;n<t.length;++n)t[n]==="&"&&++e;return e}const Zd=/\s*,(?![^(]*\))\s*/g,c1=/\s+/g;function d1(t,e){const n=[];return e.split(Zd).forEach(r=>{let s=l1(r);if(s){if(s===1){t.forEach(a=>{n.push(r.replace("&",a))});return}}else{t.forEach(a=>{n.push((a&&a+" ")+r)});return}let o=[r];for(;s--;){const a=[];o.forEach(l=>{t.forEach(c=>{a.push(l.replace("&",c))})}),o=a}o.forEach(a=>n.push(a))}),n}function h1(t,e){const n=[];return e.split(Zd).forEach(r=>{t.forEach(s=>{n.push((s&&s+" ")+r)})}),n}function u1(t){let e=[""];return t.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?e=d1(e,n):e=h1(e,n))}),e.join(", ").replace(c1," ")}function Qd(t){if(!t)return;const e=t.parentElement;e&&e.removeChild(t)}function gs(t,e){return(e??document.head).querySelector(`style[cssr-id="${t}"]`)}function f1(t){const e=document.createElement("style");return e.setAttribute("cssr-id",t),e}function ms(t){return t?/^\s*@(s|m)/.test(t):!1}const g1=/[A-Z]/g;function Jd(t){return t.replace(g1,e=>"-"+e.toLowerCase())}function m1(t,e=" "){return typeof t=="object"&&t!==null?` {
|
|
106
106
|
`+Object.entries(t).map(n=>e+` ${Jd(n[0])}: ${n[1]};`).join(`
|
|
@@ -819,5 +819,5 @@ ${s}
|
|
|
819
819
|
`),ue("select-menu",`
|
|
820
820
|
margin: 4px 0;
|
|
821
821
|
box-shadow: var(--n-menu-box-shadow);
|
|
822
|
-
`,[fu({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})])]);function Bs(t){return t.type==="group"}function yu(t){return t.type==="ignored"}function ga(t,e){try{return!!(1+e.toString().toLowerCase().indexOf(t.trim().toLowerCase()))}catch{return!1}}function hv(t,e){return{getIsGroup:Bs,getIgnored:yu,getKey(r){return Bs(r)?r.name||r.key||"key-required":r[t]},getChildren(r){return r[e]}}}function uv(t,e,n,r){if(!e)return t;function s(o){if(!Array.isArray(o))return[];const a=[];for(const l of o)if(Bs(l)){const c=s(l[r]);c.length&&a.push(Object.assign({},l,{[r]:c}))}else{if(yu(l))continue;e(n,l)&&a.push(l)}return a}return s(t)}function fv(t,e,n){const r=new Map;return t.forEach(s=>{Bs(s)?s[n].forEach(o=>{r.set(o[e],o)}):r.set(s[e],s)}),r}var gv={};const mv=Object.assign(Object.assign({},ut.props),{to:kn.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},keyboard:{type:Boolean,default:!0},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,menuSize:{type:String},filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:Function,placement:{type:String,default:"bottom-start"},widthMode:{type:String,default:"trigger"},tag:Boolean,onCreate:Function,fallbackOption:{type:[Function,Boolean],default:void 0},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],ellipsisTagPopoverProps:Object,consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},childrenField:{type:String,default:"children"},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,nodeProps:Function,ignoreComposition:{type:Boolean,default:!0},showOnFocus:Boolean,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:"show"},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,showCheckmark:{type:Boolean,default:!0},onChange:[Function,Array],items:Array}),pv=i.defineComponent({name:"Select",props:mv,slots:Object,setup(t){gv.NODE_ENV!=="production"&&i.watchEffect(()=>{t.items!==void 0&&jn("select","`items` is deprecated, please use `options` instead."),t.onChange!==void 0&&jn("select","`on-change` is deprecated, please use `on-update:value` instead.")});const{mergedClsPrefixRef:e,mergedBorderedRef:n,namespaceRef:r,inlineThemeDisabled:s}=gi(t),o=ut("Select","-select",dv,cv,t,e),a=i.ref(t.defaultValue),l=i.toRef(t,"value"),c=Ho(l,a),d=i.ref(!1),h=i.ref(""),u=jd(t,["items","options"]),m=i.ref([]),g=i.ref([]),f=i.computed(()=>g.value.concat(m.value).concat(u.value)),p=i.computed(()=>{const{filter:T}=t;if(T)return T;const{labelField:j,valueField:ne}=t;return(le,ce)=>{if(!ce)return!1;const pe=ce[j];if(typeof pe=="string")return ga(le,pe);const _e=ce[ne];return typeof _e=="string"?ga(le,_e):typeof _e=="number"?ga(le,String(_e)):!1}}),y=i.computed(()=>{if(t.remote)return u.value;{const{value:T}=f,{value:j}=h;return!j.length||!t.filterable?T:uv(T,p.value,j,t.childrenField)}}),b=i.computed(()=>{const{valueField:T,childrenField:j}=t,ne=hv(T,j);return H_(y.value,ne)}),_=i.computed(()=>fv(f.value,t.valueField,t.childrenField)),C=i.ref(!1),S=Ho(i.toRef(t,"show"),C),v=i.ref(null),B=i.ref(null),k=i.ref(null),{localeRef:R}=Qh("Select"),$=i.computed(()=>{var T;return(T=t.placeholder)!==null&&T!==void 0?T:R.value.placeholder}),P=[],I=i.ref(new Map),V=i.computed(()=>{const{fallbackOption:T}=t;if(T===void 0){const{labelField:j,valueField:ne}=t;return le=>({[j]:String(le),[ne]:le})}return T===!1?!1:j=>Object.assign(T(j),{value:j})});function A(T){const j=t.remote,{value:ne}=I,{value:le}=_,{value:ce}=V,pe=[];return T.forEach(_e=>{if(le.has(_e))pe.push(le.get(_e));else if(j&&ne.has(_e))pe.push(ne.get(_e));else if(ce){const xe=ce(_e);xe&&pe.push(xe)}}),pe}const L=i.computed(()=>{if(t.multiple){const{value:T}=c;return Array.isArray(T)?A(T):[]}return null}),D=i.computed(()=>{const{value:T}=c;return!t.multiple&&!Array.isArray(T)?T===null?null:A([T])[0]||null:null}),ee=xw(t),{mergedSizeRef:E,mergedDisabledRef:N,mergedStatusRef:H}=ee;function q(T,j){const{onChange:ne,"onUpdate:value":le,onUpdateValue:ce}=t,{nTriggerFormChange:pe,nTriggerFormInput:_e}=ee;ne&&ht(ne,T,j),ce&&ht(ce,T,j),le&&ht(le,T,j),a.value=T,pe(),_e()}function Y(T){const{onBlur:j}=t,{nTriggerFormBlur:ne}=ee;j&&ht(j,T),ne()}function F(){const{onClear:T}=t;T&&ht(T)}function M(T){const{onFocus:j,showOnFocus:ne}=t,{nTriggerFormFocus:le}=ee;j&&ht(j,T),le(),ne&&re()}function Z(T){const{onSearch:j}=t;j&&ht(j,T)}function fe(T){const{onScroll:j}=t;j&&ht(j,T)}function ie(){var T;const{remote:j,multiple:ne}=t;if(j){const{value:le}=I;if(ne){const{valueField:ce}=t;(T=L.value)===null||T===void 0||T.forEach(pe=>{le.set(pe[ce],pe)})}else{const ce=D.value;ce&&le.set(ce[t.valueField],ce)}}}function me(T){const{onUpdateShow:j,"onUpdate:show":ne}=t;j&&ht(j,T),ne&&ht(ne,T),C.value=T}function re(){N.value||(me(!0),C.value=!0,t.filterable&&Xn())}function Me(){me(!1)}function Ae(){h.value="",g.value=P}const Oe=i.ref(!1);function Le(){t.filterable&&(Oe.value=!0)}function pt(){t.filterable&&(Oe.value=!1,S.value||Ae())}function Zt(){N.value||(S.value?t.filterable?Xn():Me():re())}function Qt(T){var j,ne;!((ne=(j=k.value)===null||j===void 0?void 0:j.selfRef)===null||ne===void 0)&&ne.contains(T.relatedTarget)||(d.value=!1,Y(T),Me())}function St(T){M(T),d.value=!0}function At(){d.value=!0}function yt(T){var j;!((j=v.value)===null||j===void 0)&&j.$el.contains(T.relatedTarget)||(d.value=!1,Y(T),Me())}function pn(){var T;(T=v.value)===null||T===void 0||T.focus(),Me()}function Pn(T){var j;S.value&&(!((j=v.value)===null||j===void 0)&&j.$el.contains(dr(T))||Me())}function De(T){if(!Array.isArray(T))return[];if(V.value)return Array.from(T);{const{remote:j}=t,{value:ne}=_;if(j){const{value:le}=I;return T.filter(ce=>ne.has(ce)||le.has(ce))}else return T.filter(le=>ne.has(le))}}function ke(T){Ie(T.rawNode)}function Ie(T){if(N.value)return;const{tag:j,remote:ne,clearFilterAfterSelect:le,valueField:ce}=t;if(j&&!ne){const{value:pe}=g,_e=pe[0]||null;if(_e){const xe=m.value;xe.length?xe.push(_e):m.value=[_e],g.value=P}}if(ne&&I.value.set(T[ce],T),t.multiple){const pe=De(c.value),_e=pe.findIndex(xe=>xe===T[ce]);if(~_e){if(pe.splice(_e,1),j&&!ne){const xe=J(T[ce]);~xe&&(m.value.splice(xe,1),le&&(h.value=""))}}else pe.push(T[ce]),le&&(h.value="");q(pe,A(pe))}else{if(j&&!ne){const pe=J(T[ce]);~pe?m.value=[m.value[pe]]:m.value=P}Gi(),Me(),q(T[ce],T)}}function J(T){return m.value.findIndex(ne=>ne[t.valueField]===T)}function se(T){S.value||re();const{value:j}=T.target;h.value=j;const{tag:ne,remote:le}=t;if(Z(j),ne&&!le){if(!j){g.value=P;return}const{onCreate:ce}=t,pe=ce?ce(j):{[t.labelField]:j,[t.valueField]:j},{valueField:_e,labelField:xe}=t;u.value.some(Ye=>Ye[_e]===pe[_e]||Ye[xe]===pe[xe])||m.value.some(Ye=>Ye[_e]===pe[_e]||Ye[xe]===pe[xe])?g.value=P:g.value=[pe]}}function Ce(T){T.stopPropagation();const{multiple:j}=t;!j&&t.filterable&&Me(),F(),j?q([],[]):q(null,null)}function Jt(T){!cr(T,"action")&&!cr(T,"empty")&&!cr(T,"header")&&T.preventDefault()}function Ui(T){fe(T)}function wi(T){var j,ne,le,ce,pe;if(!t.keyboard){T.preventDefault();return}switch(T.key){case" ":if(t.filterable)break;T.preventDefault();case"Enter":if(!(!((j=v.value)===null||j===void 0)&&j.isComposing)){if(S.value){const _e=(ne=k.value)===null||ne===void 0?void 0:ne.getPendingTmNode();_e?ke(_e):t.filterable||(Me(),Gi())}else if(re(),t.tag&&Oe.value){const _e=g.value[0];if(_e){const xe=_e[t.valueField],{value:Ye}=c;t.multiple&&Array.isArray(Ye)&&Ye.includes(xe)||Ie(_e)}}}T.preventDefault();break;case"ArrowUp":if(T.preventDefault(),t.loading)return;S.value&&((le=k.value)===null||le===void 0||le.prev());break;case"ArrowDown":if(T.preventDefault(),t.loading)return;S.value?(ce=k.value)===null||ce===void 0||ce.next():re();break;case"Escape":S.value&&(yw(T),Me()),(pe=v.value)===null||pe===void 0||pe.focus();break}}function Gi(){var T;(T=v.value)===null||T===void 0||T.focus()}function Xn(){var T;(T=v.value)===null||T===void 0||T.focusInput()}function xi(){var T;S.value&&((T=B.value)===null||T===void 0||T.syncPosition())}ie(),i.watch(i.toRef(t,"options"),ie);const Ki={focus:()=>{var T;(T=v.value)===null||T===void 0||T.focus()},focusInput:()=>{var T;(T=v.value)===null||T===void 0||T.focusInput()},blur:()=>{var T;(T=v.value)===null||T===void 0||T.blur()},blurInput:()=>{var T;(T=v.value)===null||T===void 0||T.blurInput()}},en=i.computed(()=>{const{self:{menuBoxShadow:T}}=o.value;return{"--n-menu-box-shadow":T}}),Fn=s?mi("select",void 0,en,t):void 0;return Object.assign(Object.assign({},Ki),{mergedStatus:H,mergedClsPrefix:e,mergedBordered:n,namespace:r,treeMate:b,isMounted:fs(),triggerRef:v,menuRef:k,pattern:h,uncontrolledShow:C,mergedShow:S,adjustedTo:kn(t),uncontrolledValue:a,mergedValue:c,followerRef:B,localizedPlaceholder:$,selectedOption:D,selectedOptions:L,mergedSize:E,mergedDisabled:N,focused:d,activeWithoutMenuOpen:Oe,inlineThemeDisabled:s,onTriggerInputFocus:Le,onTriggerInputBlur:pt,handleTriggerOrMenuResize:xi,handleMenuFocus:At,handleMenuBlur:yt,handleMenuTabOut:pn,handleTriggerClick:Zt,handleToggle:ke,handleDeleteOption:Ie,handlePatternInput:se,handleClear:Ce,handleTriggerBlur:Qt,handleTriggerFocus:St,handleKeydown:wi,handleMenuAfterLeave:Ae,handleMenuClickOutside:Pn,handleMenuScroll:Ui,handleMenuKeydown:wi,handleMenuMousedown:Jt,mergedTheme:o,cssVars:s?void 0:en,themeClass:Fn==null?void 0:Fn.themeClass,onRender:Fn==null?void 0:Fn.onRender})},render(){return i.h("div",{class:`${this.mergedClsPrefix}-select`},i.h(Ud,null,{default:()=>[i.h(Gd,null,{default:()=>i.h(av,{ref:"triggerRef",inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,labelField:this.labelField,valueField:this.valueField,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus,onResize:this.handleTriggerOrMenuResize,ignoreComposition:this.ignoreComposition},{arrow:()=>{var t,e;return[(e=(t=this.$slots).arrow)===null||e===void 0?void 0:e.call(t)]}})}),i.h(dh,{ref:"followerRef",show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===kn.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?"target":void 0,minWidth:"target",placement:this.placement},{default:()=>i.h(i.Transition,{name:"fade-in-scale-up-transition",appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var t,e,n;return this.mergedShow||this.displayDirective==="show"?((t=this.onRender)===null||t===void 0||t.call(this),i.withDirectives(i.h(Vx,Object.assign({},this.menuProps,{ref:"menuRef",onResize:this.handleTriggerOrMenuResize,inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,(e=this.menuProps)===null||e===void 0?void 0:e.class],clsPrefix:this.mergedClsPrefix,focusable:!0,labelField:this.labelField,valueField:this.valueField,autoPending:!0,nodeProps:this.nodeProps,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:this.menuSize,renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[(n=this.menuProps)===null||n===void 0?void 0:n.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,showCheckmark:this.showCheckmark,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange}),{empty:()=>{var r,s;return[(s=(r=this.$slots).empty)===null||s===void 0?void 0:s.call(r)]},header:()=>{var r,s;return[(s=(r=this.$slots).header)===null||s===void 0?void 0:s.call(r)]},action:()=>{var r,s;return[(s=(r=this.$slots).action)===null||s===void 0?void 0:s.call(r)]}}),this.displayDirective==="show"?[[i.vShow,this.mergedShow],[us,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[us,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}}),yv={},bu=i.defineComponent({...yv,__name:"searchable-reference-select",props:{searchDataHandler:{},optionsListConverter:{},renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minSearchTermLength)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.computed(()=>O.isArray(r.value)),a=i.computed(()=>o.value?r.value.map(_=>_.id):r.value?r.value.id:null),l=i.ref(o.value?r.optionsListConverter(r.value):r.value?r.optionsListConverter([r.value]):[]),c=i.computed(()=>l.value.map(_=>({..._,class:r.wrapContent?`${_.class} consistent-menu-width`:_.class}))),d=i.ref(!1),h=i.useTemplateRef("select-component"),u=_=>{_.length<r.minTermLength||(d.value=!0,r.searchDataHandler(_,d).then(C=>{if(O.isEmpty(C))return;const S=o.value?r.value:r.value?[r.value]:[],v=C.filter(B=>!S.some(k=>k.id===B.id));l.value=r.optionsListConverter([...S,...v])}).finally(()=>{d.value=!1}))};let m="";const g=O.debounce(()=>u(m),800),f=_=>{m=_,g()},p=_=>{var C;if(O.isArray(_)){const S=_.length>0?_.map(v=>{var B;return i.toRaw((B=l.value.find(k=>k.value===v))==null?void 0:B.item)}):[];s("update:value",S)}else if(_>0){const S=i.toRaw((C=l.value.find(v=>v.value===_))==null?void 0:C.item);s("update:value",S)}else s("update:value",null)};return e({focus:()=>{var _;return(_=h.value)==null?void 0:_.focusInput()},blur:()=>{var _;return(_=h.value)==null?void 0:_.blurInput()}}),(_,C)=>(i.openBlock(),i.createBlock(i.unref(pv),{ref:"select-component","clear-filter-after-select":!0,clearable:t.clearable,"consistent-menu-width":t.consistentMenuWidth,disabled:t.disabled,filterable:!0,loading:d.value,multiple:o.value,options:c.value,placeholder:t.placeholder,remote:!0,value:a.value,"render-label":t.renderLabel,"render-tag":t.renderTag,onSearch:f,"onUpdate:value":p},null,8,["clearable","consistent-menu-width","disabled","loading","multiple","options","placeholder","value","render-label","render-tag"]))}}),bv={},_u=i.defineComponent({...bv,__name:"searchable-product-select",props:{renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minSearchTermLength)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""},searchType:{}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.useTemplateRef("select-component"),a=async u=>r.searchType==="categories"?G.HttpRequester.getInstance(G.ProductCategoryDataProvider).publicSimpleSearch(u):r.searchType==="products"?G.HttpRequester.getInstance(G.ProductDataProvider).publicSimpleSearch(u):new Promise(m=>{m([])}),l=u=>r.searchType==="categories"?zt.convertReferencesToSelectOptionsList(u,!0,!1,!1,m=>m!=null&&m.isNewRec()?"-":m.name):r.searchType==="products"?zt.convertReferencesToSelectOptionsList(u,!0,!1,!1,m=>m!=null&&m.isNewRec()?"-":`[${m.code}] ${m.name}`):[],c=(u,m)=>{if(r.renderLabel)return r.renderLabel(u,m);if(r.searchType==="products"){const g=u.item;return i.h("div",{},[i.h("span",{class:"text-sc-grey mr-2.5"},g.code),i.h("span",{},[g.name])])}if(r.searchType==="categories"){const g=u.item;return i.h("div",{},[g.name])}};return e({focus:()=>{var u;return(u=o.value)==null?void 0:u.focus()},blur:()=>{var u;return(u=o.value)==null?void 0:u.blur()}}),(u,m)=>(i.openBlock(),i.createBlock(bu,{ref:"select-component",value:t.value,clearable:t.clearable,disabled:t.disabled,placeholder:t.placeholder,"search-data-handler":a,"options-list-converter":l,"consistent-menu-width":t.consistentMenuWidth,"wrap-content":t.wrapContent,"min-term-length":t.minTermLength,"render-label":c,"render-tag":t.renderTag,"onUpdate:value":m[0]||(m[0]=g=>s("update:value",g))},null,8,["value","clearable","disabled","placeholder","consistent-menu-width","wrap-content","min-term-length","render-tag"]))}}),_v={class:"col-span-2 flex flex-row gap-2.5"},wv={class:"flex-1"},xv={class:"text-sc-grey"},vv={class:"ml-2.5"},kv={key:0,class:"flex-none"},Cv={},Sv=i.defineComponent({...Cv,__name:"products-list",props:{value:{},searchType:{},minTermLength:{default:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minSearchTermLength)??3}},disabled:{type:Boolean}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(null),o=()=>structuredClone(i.toRaw(n.value)),a=i.ref(o()),l=()=>{r("update:value",a.value.map(u=>i.toRaw(u)))},c=u=>{u&&(a.value=[...a.value.map(m=>i.toRaw(m)),...(O.isArray(u)?u:[u]).filter(m=>!a.value.some(g=>g.id===m.id))],i.nextTick(()=>{s.value=null}),l())},d=u=>{u&&(a.value=a.value.map(m=>m.id===u.id?u:i.toRaw(m)),l())},h=u=>{a.value=a.value.filter(m=>m.id!==u.id),l()};return i.watch(()=>n.value,()=>{a.value=o()}),(u,m)=>{const g=z.NListItem,f=e_,p=z.NButton,y=z.NList;return i.openBlock(),i.createBlock(y,{"show-divider":!1,hoverable:!0},{header:i.withCtx(()=>[i.renderSlot(u.$slots,"header")]),footer:i.withCtx(()=>[i.createVNode(_u,{value:s.value,"onUpdate:value":[m[0]||(m[0]=b=>s.value=b),c],clearable:!0,disabled:t.disabled,"min-term-length":t.minTermLength,"search-type":t.searchType,placeholder:"Введите название"},null,8,["value","disabled","min-term-length","search-type"])]),default:i.withCtx(()=>[a.value.length===0?(i.openBlock(),i.createBlock(g,{key:0,class:"text-center text-sm text-gray-600"},{default:i.withCtx(()=>[...m[1]||(m[1]=[i.createTextVNode(" --- Список пуст --- ",-1)])]),_:1})):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,b=>(i.openBlock(),i.createBlock(g,{key:b.id},{suffix:i.withCtx(()=>[i.createVNode(p,{disabled:t.disabled,quaternary:"",type:"error",onClick:_=>h(b)},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled","onClick"])]),default:i.withCtx(()=>[i.createElementVNode("div",_v,[i.createElementVNode("span",wv,[i.createElementVNode("span",xv,i.toDisplayString(b.code),1),i.createElementVNode("span",vv,i.toDisplayString(b.name),1)]),u.$slots["item-extra"]?(i.openBlock(),i.createElementBlock("div",kv,[i.renderSlot(u.$slots,"item-extra",{item:b,updateItemCallback:d})])):i.createCommentVNode("",!0)])]),_:2},1024))),128))]),_:3})}}}),Bv={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Tv(t,e){return i.openBlock(),i.createElementBlock("svg",Bv,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M13 4a1 1 0 0 1 1 1h4a1 1 0 0 1 .783.378l.074.108l3 5l.055.103l.04.107l.029.109l.016.11L22 11v6a1 1 0 0 1-1 1h-1.171a3.001 3.001 0 0 1-5.658 0H9.829a3.001 3.001 0 0 1-5.658 0H3a1 1 0 0 1-1-1V6a2 2 0 0 1 2-2zM7 16a1 1 0 1 0 0 2a1 1 0 0 0 0-2m10 0a1 1 0 1 0 0 2a1 1 0 0 0 0-2m.434-9H14v3h5.234z"},null,-1)])])}const Rv=i.markRaw({name:"tabler-truck-filled",render:Tv}),$v={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ev(t,e){return i.openBlock(),i.createElementBlock("svg",$v,[...e[0]||(e[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M5 17a2 2 0 1 0 4 0a2 2 0 1 0-4 0m10 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"}),i.createElementVNode("path",{d:"M5 17H3v-4M2 5h11v12m-4 0h6m4 0h2v-6h-8m0-5h5l3 5M3 9h4"})],-1)])])}const Nv=i.markRaw({name:"tabler-truck-delivery",render:Ev}),Pv={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fv(t,e){return i.openBlock(),i.createElementBlock("svg",Pv,[...e[0]||(e[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M2 3h1a2 2 0 0 1 2 2v10a2 2 0 0 0 2 2h15"}),i.createElementVNode("path",{d:"M9 9a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-4a3 3 0 0 1-3-3zM7 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0m9 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"})],-1)])])}const Mv=i.markRaw({name:"tabler-truck-loading",render:Fv}),Av={class:"flex flex-col gap-1"},Vv={key:0,class:"flex flex-row gap-1 text-base"},Ov={key:1,class:"text-sc-dark-grey text-sm"},Iv={class:"text-sc-grey mr-1.5"},zv={key:0},Lv={key:1},Dv={key:2},Hv={},Ts=i.defineComponent({...Hv,__name:"order-delivery-label",props:{delivery:{},showType:{type:Boolean,default:!0},showDetails:{type:Boolean,default:!0}},setup(t){const e=i.computed(()=>{var s;return(s=G.useReferencesStore().deliveryTypeReference)==null?void 0:s.find(o=>o.id===r.delivery.type)}),n=i.computed(()=>Mn.format(r.delivery.date,"dd.MM.yyyy")),r=t;return(s,o)=>{var d,h,u,m,g,f,p,y;const a=Mv,l=Nv,c=Rv;return i.openBlock(),i.createElementBlock("div",Av,[t.showType?(i.openBlock(),i.createElementBlock("span",Vv,[((d=e.value)==null?void 0:d.slug)==="self_delivery"?(i.openBlock(),i.createBlock(a,{key:0})):i.createCommentVNode("",!0),((h=e.value)==null?void 0:h.slug)==="delivery"?(i.openBlock(),i.createBlock(l,{key:1})):i.createCommentVNode("",!0),((u=e.value)==null?void 0:u.slug)==="transport_company_delivery"?(i.openBlock(),i.createBlock(c,{key:2})):i.createCommentVNode("",!0),i.createElementVNode("span",null,i.toDisplayString((m=e.value)==null?void 0:m.name),1)])):i.createCommentVNode("",!0),t.showDetails?(i.openBlock(),i.createElementBlock("span",Ov,[i.createElementVNode("span",Iv,i.toDisplayString(n.value),1),(f=(g=t.delivery)==null?void 0:g.address)!=null&&f.address?(i.openBlock(),i.createElementBlock("span",zv,i.toDisplayString(t.delivery.address.address),1)):i.createCommentVNode("",!0),(y=(p=t.delivery)==null?void 0:p.warehouse)!=null&&y.address?(i.openBlock(),i.createElementBlock("span",Lv,"со склада "+i.toDisplayString(t.delivery.warehouse.address),1)):(i.openBlock(),i.createElementBlock("span",Dv,"(не указано)"))])):i.createCommentVNode("",!0)])}}}),Wv={class:"flex flex-col gap-2.5"},jv={class:"text-base"},qv=["href"],Xv={class:"text-sc-grey"},Yv={},wu=i.defineComponent({...Yv,__name:"order-common-info",props:{order:{},fields:{},orderUrl:{}},setup(t){const e=t,n=i.computed(()=>e.fields.includes(Ke.Id)?e.order.id:void 0),r=i.computed(()=>{var l,c;return e.fields.includes(Ke.Status)?(c=(l=G.useReferencesStore().orderStatusReference)==null?void 0:l.find(d=>d.id===(e.order.status??-1)))==null?void 0:c.name:void 0}),s=i.computed(()=>e.fields.includes(Ke.CreatedAt)),o=i.computed(()=>e.fields.includes(Ke.ClientInfo)?e.order.client:void 0),a=i.computed(()=>e.fields.includes(Ke.DeliveryInfo)?e.order.delivery:void 0);return(l,c)=>(i.openBlock(),i.createElementBlock("div",Wv,[i.createElementVNode("span",jv,[n.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:t.orderUrl.replace(":id",t.order.id.toString()),target:"_blank",class:"text-sc-dark-grey"}," #"+i.toDisplayString(n.value),9,qv)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[c[0]||(c[0]=i.createTextVNode(" от ",-1)),i.createVNode(Po,{date:t.order.createdAt,"is-time-secondary":!0},null,8,["date"])],64)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[c[1]||(c[1]=i.createTextVNode(" - ",-1)),i.createElementVNode("span",Xv,i.toDisplayString(r.value),1)],64)):i.createCommentVNode("",!0)]),o.value?(i.openBlock(),i.createBlock(os,{key:0,client:o.value,class:"ml-3"},null,8,["client"])):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(Ts,{key:1,delivery:a.value,class:"ml-3"},null,8,["delivery"])):i.createCommentVNode("",!0)]))}}),Uv={},xu=i.defineComponent({...Uv,__name:"order-payment",props:{payment:{}},setup(t){const e=t,n=i.computed(()=>{var r;return(r=G.useReferencesStore().paymentTypeReference)==null?void 0:r.find(s=>s.id===e.payment.type)});return(r,s)=>{var o;return i.openBlock(),i.createElementBlock("span",null,i.toDisplayString(((o=n.value)==null?void 0:o.name)??"-"),1)}}}),Gv={class:"flex flex-row gap-1.5"},Kv={class:"flex-none text-nowrap"},Zv={class:"flex flex-1 flex-col"},Qv={class:"mt-2.5 grid grid-flow-col grid-rows-2 gap-1 text-base"},Jv={key:0},ek={key:1},tk={},vu=i.defineComponent({...tk,__name:"order-product-info",props:{product:{},index:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",Gv,[i.createElementVNode("span",Kv,i.toDisplayString(t.index+1)+".",1),i.createElementVNode("div",Zv,[i.createVNode(tr,{product:t.product.product,"show-planning-dates":!1},null,8,["product"]),i.createElementVNode("div",Qv,[n[0]||(n[0]=i.createElementVNode("span",null,"Кол-во",-1)),t.product.product.getIsMeasurable()?(i.openBlock(),i.createElementBlock("span",Jv,i.toDisplayString(`${t.product.length} ${t.product.product.unit} x ${t.product.quantity} шт.`),1)):(i.openBlock(),i.createElementBlock("span",ek,i.toDisplayString(`${t.product.quantity} ${t.product.product.unit}`),1)),n[1]||(n[1]=i.createElementVNode("span",null,"Цена за ед.",-1)),i.createElementVNode("span",null,i.toDisplayString(`${t.product.costOneRub.toLocaleString("ru-ru",{minimumFractionDigits:2})} ${t.product.currency}`),1),n[2]||(n[2]=i.createElementVNode("span",null,"Сумма",-1)),i.createElementVNode("span",null,i.toDisplayString(`${t.product.cost.toLocaleString("ru-ru",{minimumFractionDigits:2})} ${t.product.currency}`),1)])])]))}}),nk={},ik=i.defineComponent({...nk,__name:"order-items-list",props:{order:{}},setup(t){const e=()=>{const s=[{title:"№ п.п.",key:"id",resizable:!0,width:50,render:(o,a)=>i.h("span",{class:"text-base"},[a+1,"."])},{title:"Артикул",key:"codeNumber",resizable:!0,minWidth:120,render:o=>i.h("span",{class:"text-base"},[o.product.code])},{title:"Наименование",key:"name",resizable:!0,render:o=>i.h(tr,{product:o.product,showCode:!1,showPlanningDates:!1})},{title:"Кол-во",key:"quantity",resizable:!0,minWidth:100,render:o=>i.h("span",{class:"text-nowrap text-base"},o.product.getIsMeasurable()?[`${o.length} ${o.product.unit} x ${o.quantity} шт.`]:[`${o.quantity} ${o.product.unit}`])},{title:"Цена за ед.",key:"costOneRub",resizable:!0,minWidth:100,render:o=>i.h("span",{class:"text-base"},[`${o.costOneRub.toLocaleString("ru-ru",{minimumFractionDigits:2})} ${o.currency}`])},{title:"Сумма",key:"cost",resizable:!0,minWidth:100,render:o=>i.h("span",{class:"text-base"},[`${o.cost.toLocaleString("ru-ru",{minimumFractionDigits:2})} ${o.currency}`])}];switch(bt.getDeviceTypeByResolution()){case Ue.phone:case Ue.tablet:return[{title:"",key:"items",resizable:!0,render:(o,a)=>i.h(vu,{product:o,index:a})}];case Ue.laptop:return s;default:return s}},n=i.ref(e()),r=()=>{n.value=e()};return i.onMounted(()=>{r(),window.addEventListener("resize",r)}),i.onUnmounted(()=>{window.removeEventListener("resize",r)}),(s,o)=>{const a=z.NDataTable;return i.openBlock(),i.createElementBlock(i.Fragment,null,[o[0]||(o[0]=i.createElementVNode("h3",null,"Список позиций",-1)),i.createVNode(a,{columns:n.value,data:t.order.products,"row-key":l=>l.id,"bottom-bordered":!1,bordered:!1},null,8,["columns","data","row-key"])],64)}}}),ku=Zn(ik,[["__scopeId","data-v-b15b9b70"]]),rk={class:"text-base"},sk={},ma=i.defineComponent({...sk,__name:"user-short-info",props:{user:{},showUserType:{type:Boolean,default:!0},extraInfoOnSecondLine:{type:Boolean,default:!0}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass({"flex flex-col":t.showUserType&&t.extraInfoOnSecondLine})},[i.createElementVNode("span",rk,i.toDisplayString(t.user.name),1),t.showUserType?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass([{"ml-1":!t.extraInfoOnSecondLine},"text-sc-grey"])}," ["+i.toDisplayString(t.user.type)+"] ",3)):i.createCommentVNode("",!0)],2))}}),ok={class:"ml-4 grid grid-cols-3 gap-1.5 text-base"},ak={class:"col-span-2"},lk={class:"col-span-2"},ck={class:"btn btn-primary",href:"{{ invoice }}"},dk={},Cu=i.defineComponent({...dk,__name:"order-details",props:{order:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",null,[n[11]||(n[11]=i.createElementVNode("h3",null,"Детали заказа",-1)),i.createElementVNode("div",ok,[t.order.creator.id!==t.order.client.id?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[n[0]||(n[0]=i.createElementVNode("span",null,"Создал",-1)),i.createVNode(ma,{user:t.order.creator,class:"col-span-2"},null,8,["user"])],64)):i.createCommentVNode("",!0),n[10]||(n[10]=i.createElementVNode("span",null,"Клиент",-1)),i.createVNode(os,{client:t.order.client,class:"col-span-2"},null,8,["client"]),t.order.contragent?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[n[1]||(n[1]=i.createElementVNode("span",null,"Контрагент",-1)),i.createVNode(Sd,{contragent:t.order.contragent,class:"col-span-2"},null,8,["contragent"])],64)):i.createCommentVNode("",!0),t.order.image?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[n[2]||(n[2]=i.createElementVNode("span",null,"Графический файл клиента",-1)),n[3]||(n[3]=i.createElementVNode("a",{class:"fancybox col-span-2",href:"{{ order.image }}"}," Посмотреть ",-1))],64)):i.createCommentVNode("",!0),t.order.barcode?(i.openBlock(),i.createElementBlock(i.Fragment,{key:3},[n[4]||(n[4]=i.createElementVNode("span",null,"Штрих-код",-1)),i.createElementVNode("span",ak,i.toDisplayString(t.order.barcode),1)],64)):i.createCommentVNode("",!0),t.order.payment?(i.openBlock(),i.createElementBlock(i.Fragment,{key:4},[n[5]||(n[5]=i.createElementVNode("span",null,"Оплата",-1)),i.createVNode(xu,{payment:t.order.payment,class:"col-span-2"},null,8,["payment"])],64)):i.createCommentVNode("",!0),t.order.delivery?(i.openBlock(),i.createElementBlock(i.Fragment,{key:5},[n[6]||(n[6]=i.createElementVNode("span",null,"Доставка",-1)),i.createVNode(Ts,{delivery:t.order.delivery,class:"col-span-2"},null,8,["delivery"])],64)):i.createCommentVNode("",!0),t.order.comment?(i.openBlock(),i.createElementBlock(i.Fragment,{key:6},[n[7]||(n[7]=i.createElementVNode("span",null,"Комментарий",-1)),i.createElementVNode("span",lk,i.toDisplayString(t.order.comment),1)],64)):i.createCommentVNode("",!0),t.order.attachedUser?(i.openBlock(),i.createElementBlock(i.Fragment,{key:7},[n[8]||(n[8]=i.createElementVNode("span",null,"Закреплен за",-1)),i.createVNode(ma,{user:t.order.attachedUser,class:"col-span-2"},null,8,["user"])],64)):i.createCommentVNode("",!0),t.order.invoices&&t.order.invoices.length>0?(i.openBlock(),i.createElementBlock(i.Fragment,{key:8},[n[9]||(n[9]=i.createElementVNode("span",null,"Прикрепленные счета",-1)),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.order.invoices,(r,s)=>(i.openBlock(),i.createElementBlock("div",{key:s,class:"col-span-2"},[i.createElementVNode("a",ck," Скачать счет №"+i.toDisplayString(s+1),1)]))),128))],64)):i.createCommentVNode("",!0)])]))}}),hk={key:0},uk={class:"text-sc-dark-grey my-2 text-center"},fk={key:1,class:"text-sc-dark-grey my-2 text-center"},gk={key:2},mk={class:"text-sc-dark-grey mt-4 text-right font-bold"},pk={class:"text-sc-primary"},yk={},Su=i.defineComponent({...yk,__name:"order-info",props:{order:{}},setup(t){const e=t,n=i.ref(!1),r=i.ref(new G.Order(e.order)),s=()=>{n.value=!0,G.HttpRequester.getInstance(G.OrdersDataProvider).getOrder(e.order.id).then(a=>{r.value=a}).finally(()=>{n.value=!1})},o=i.computed(()=>(r.value.products??[]).reduce((a,l)=>a+l.costRub,0).toLocaleString("ru-ru",{minimumFractionDigits:2}));return i.onMounted(()=>{s()}),(a,l)=>{const c=z.NSpin;return n.value?(i.openBlock(),i.createElementBlock("div",hk,[i.createElementVNode("div",uk,[i.createVNode(c,{size:"small",class:"mb-2.5 align-middle"}),l[0]||(l[0]=i.createElementVNode("div",null,[i.createElementVNode("span",null,"Загрузка данных ...")],-1))])])):r.value.products.length===0?(i.openBlock(),i.createElementBlock("div",fk," --- Не удалось загрузить данные о заказе --- ")):(i.openBlock(),i.createElementBlock("div",gk,[i.createVNode(ku,{order:r.value},null,8,["order"]),i.createElementVNode("div",mk,[l[1]||(l[1]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",pk,i.toDisplayString(o.value)+" ₽",1)]),i.createVNode(Cu,{order:r.value},null,8,["order"])]))}}}),bk={},_k=i.defineComponent({...bk,__name:"orders-list",props:{fields:{},orderUrl:{},filters:{},sort:{},pagination:{}},setup(t){const e=t,n=()=>structuredClone(i.toRaw(e.sort??{field:"id",direction:"desc"})),r=i.ref(n()),s=i.ref([]),o=i.ref(!1),a=i.computed(()=>G.useReferencesStore().orderStatusReference),l=()=>{const p=e.fields.length>0?e.fields:[Ke.CreatedAt,Ke.Id,Ke.DeliveryInfo,Ke.Status,Ke.SalesDirections,Ke.AttachedUser],y={title:"???",key:"undefined",render:()=>i.h("span",{},["--- unknown ---"])},b={type:"expand",expandable:O.constant(!0),renderExpand:C=>i.h(Su,{order:C,class:"pl-10 pt-3 pb-10"}),width:"30"},_=[{title:"Дата заказа",key:Ke.CreatedAt,resizable:!0,minWidth:100,render:C=>i.h(Po,{date:C.createdAt,isTimeSecondary:!0,isTimeOnSecondLine:!0,class:"text-base"})},{title:"Номер заказа",key:Ke.Id,resizable:!0,minWidth:70,render:C=>i.h("a",{href:e.orderUrl.replace(":id",C.id.toString()),target:"_blank",class:"text-base"},C.id)},{title:"Клиент",key:Ke.ClientInfo,resizable:!0,render:C=>i.h(os,{client:C.client})},{title:"Тип доставки",key:Ke.DeliveryInfo,resizable:!0,render:C=>i.h(Ts,{delivery:C.delivery})},{title:"Статус",key:Ke.Status,resizable:!0,minWidth:90,render:C=>{var S,v;return i.h("span",{class:"text-base"},[((v=(S=a.value)==null?void 0:S.find(B=>B.id===(C.status??-1)))==null?void 0:v.name)??""])}},{title:"Напр. продаж",key:Ke.SalesDirections,resizable:!0,minWidth:70,render:C=>i.h("span",{class:"text-base"},[C.salesDirection.name])},{title:"Закреплено за",key:Ke.AttachedUser,resizable:!0,render:C=>{var S;return i.h("span",{class:"text-base"},[(S=C==null?void 0:C.attachedUser)==null?void 0:S.name])}}];switch(bt.getDeviceTypeByResolution()){case Ue.phone:case Ue.tablet:return[b,{key:"order",title:"Заказ",resizable:!0,render:C=>i.h(wu,{order:C,fields:p,orderUrl:e.orderUrl})}];case Ue.laptop:return[b,...p.map(C=>_.find(S=>S.key===C)??y)];default:return[y]}},c=i.ref(l()),d=i.ref(new G.DataTablePagination(e.pagination??{page:1,pageSize:10,itemCount:0,pageCount:1,pageSlot:5,pageSizes:[10,15,25],showSizePicker:!1})),h=()=>{e.filters&&(o.value=!0,G.HttpRequester.getInstance(G.OrdersDataProvider).getOrders(e.filters,r.value,{page:d.value.page,pageSize:d.value.pageSize}).then(p=>{d.value.itemCount!==p.meta.total&&(d.value.itemCount=p.meta.total),d.value.page!==p.meta.currentPage&&(d.value.page=p.meta.currentPage),d.value.pageCount!==p.meta.lastPage&&(d.value.pageCount=p.meta.lastPage),d.value.pageSize!==p.meta.perPage&&(d.value.pageSize=p.meta.perPage),s.value=p.data}).finally(()=>{o.value=!1}))},u=p=>{d.value.page=p,h()},m=p=>{d.value.pageSize=p,h()},g=p=>{O.isNull(p)?r.value=n():(r.value.field=p.columnKey.toString(),r.value.direction=p.order==="ascend"?"asc":"desc"),c.value.forEach(y=>{if(Object.hasOwn(y,"sortOrder")){const b=y;b.sortOrder=b.key===(p==null?void 0:p.columnKey)&&(p!=null&&p.sorter)&&p.order!==!1?p.order:!1}}),h()},f=()=>{c.value=l()};return i.watch(()=>e.filters,()=>{h()}),i.watch(()=>e.sort,()=>{r.value=n(),h()}),i.onMounted(()=>{f(),window.addEventListener("resize",f),i.nextTick(()=>{h()})}),i.onUnmounted(()=>{window.removeEventListener("resize",f)}),(p,y)=>{const b=z.NDataTable;return i.openBlock(),i.createBlock(b,{columns:c.value,data:s.value,"row-key":_=>_.id,pagination:d.value,loading:o.value,remote:!0,bordered:!1,"bottom-bordered":!1,"sticky-expanded-rows":!0,"pagination-behavior-on-filter":"first","onUpdate:page":u,"onUpdate:pageSize":m,"onUpdate:sorter":g},null,8,["columns","data","row-key","pagination","loading"])}}}),wk=Zn(_k,[["__scopeId","data-v-7c4554f4"]]),xk=["href"],vk={class:"text-sc-dark-grey"},kk={},Ck=i.defineComponent({...kk,__name:"short-text-order-info",props:{order:{},orderLink:{}},emits:["click:order-id"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>Mn.format(n.order.createdAt,G.AppConfigProvider.getConfig().dateFormats.uiDateWithTime)),o=a=>{O.isNil(n.orderLink)&&(a.preventDefault(),a.stopPropagation()),r("click:order-id",n.order,a)};return(a,l)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("span",null,[l[1]||(l[1]=i.createTextVNode(" #",-1)),i.createElementVNode("a",{href:t.orderLink??"#",onClick:l[0]||(l[0]=c=>o(c))},i.toDisplayString(t.order.id),9,xk),i.createTextVNode(" от "+i.toDisplayString(s.value),1),t.order.isApproved1c?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" (подтверждён)")],64)):i.createCommentVNode("",!0)]),l[2]||(l[2]=i.createTextVNode(", ",-1)),i.createElementVNode("span",vk,"автор: "+i.toDisplayString(t.order.creator.name)+" ["+i.toDisplayString(t.order.creator.type)+"]",1)],64))}}),Sk={class:"sc-page flex flex-col"},Bk={class:"my-2 flex flex-row items-end"},Tk={class:"sc-title grow"},Rk={key:0,class:"sc-title-buttons flex-1 grow-0"},$k={class:"flex flex-col justify-end gap-1 sm:mt-0 sm:flex-row"},Ek={key:0,class:"sc-title-extra mt-2 sm:mt-4"},Nk={},Bu=i.defineComponent({...Nk,__name:"page",props:{title:{}},setup(t){return(e,n)=>{const r=z.NH1;return i.openBlock(),i.createElementBlock("div",Sk,[i.createElementVNode("div",Bk,[i.createElementVNode("div",Tk,[i.renderSlot(e.$slots,"title",{},()=>[i.createVNode(r,{class:"m-0 leading-none lg:mb-3 lg:leading-normal"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.title??""),1)]),_:1})])]),e.$slots["title-buttons"]?(i.openBlock(),i.createElementBlock("div",Rk,[i.createElementVNode("div",$k,[i.renderSlot(e.$slots,"title-buttons")])])):i.createCommentVNode("",!0)]),e.$slots["title-extra"]?(i.openBlock(),i.createElementBlock("div",Ek,[i.renderSlot(e.$slots,"title-extra")])):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default")])}}}),Pk={class:"overflow-hidden transition-all duration-300"},Fk={class:"text-lg font-medium leading-none"},Mk={},Tu=i.defineComponent({...Mk,__name:"sliding-content-with-drawer",props:{drawerWidth:{type:[Number,Function],default:void 0},showDrawer:{type:Boolean,default:!1},title:{default:""}},emits:["update:show-drawer"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(0),o=i.ref(n.showDrawer),a=()=>{switch(bt.getDeviceTypeByResolution()){case Ue.phone:return window.innerWidth*.66;case Ue.tablet:return window.innerWidth*.5;default:return window.innerWidth*.33}},l=()=>{o.value?O.isUndefined(n.drawerWidth)?s.value=a():s.value=O.isFunction(n.drawerWidth)?n.drawerWidth():n.drawerWidth:s.value=0};return i.watch(()=>n.drawerWidth,()=>{l()}),i.watch(()=>o.value,()=>{l(),r("update:show-drawer",o.value)}),i.watch(()=>n.showDrawer,c=>{o.value=c}),i.onUnmounted(()=>{window.removeEventListener("resize",l)}),l(),window.addEventListener("resize",l),(c,d)=>{const h=z.NDrawerContent,u=z.NDrawer;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",Pk,[i.createElementVNode("div",{style:i.normalizeStyle(`margin-left: ${s.value}px;`),class:"w-full"},[i.renderSlot(c.$slots,"default")],4)]),i.createVNode(u,{show:o.value,"onUpdate:show":d[0]||(d[0]=m=>o.value=m),resizable:!0,width:s.value,placement:"left"},{default:i.withCtx(()=>[i.createVNode(h,{closable:""},{header:i.withCtx(()=>[i.renderSlot(c.$slots,"drawer-header",{},()=>[i.createElementVNode("div",Fk,i.toDisplayString(t.title),1)])]),default:i.withCtx(()=>[i.renderSlot(c.$slots,"drawer-content")]),footer:i.withCtx(()=>[i.renderSlot(c.$slots,"drawer-footer")]),_:3})]),_:3},8,["show","width"])],64)}}}),Ak={key:0,ref:"panel-component-ref",class:"sc-page-panel flex flex-row gap-2.5 sm:gap-8"},Vk={key:0},Ok={class:"sc-page-preview-panel grow"},Ik={key:1,class:"sc-page-preview-panel-extra flex-none"},zk={},Lk=i.defineComponent({...zk,__name:"page-with-sliding-panel",props:{title:{},isShowPanelButtonVisible:{type:Boolean,default:!0},showPanelButtonText:{default:""},panelTitle:{default:""}},setup(t,{expose:e}){const n=i.ref(!1),r=()=>{n.value=!0},s=()=>{n.value=!1},o=i.useTemplateRef("panel-component-ref");return e({scrollToTopOfPanel:l=>{var c;(c=o.value)==null||c.scrollIntoView({behavior:"smooth"}),l&&i.nextTick(()=>{var d,h;window.scrollTo({top:(((h=(d=o.value)==null?void 0:d.getBoundingClientRect())==null?void 0:h.top)??0)+window.pageYOffset+l,behavior:"smooth"})})},showPanel:r,closePanel:s}),(l,c)=>{const d=z.NButton;return i.openBlock(),i.createBlock(Bu,{title:t.title},i.createSlots({default:i.withCtx(()=>[l.$slots["preview-panel"]||l.$slots["preview-panel-extra"]||t.isShowPanelButtonVisible?(i.openBlock(),i.createElementBlock("div",Ak,[t.isShowPanelButtonVisible?(i.openBlock(),i.createElementBlock("div",Vk,[i.renderSlot(l.$slots,"show-panel-button",{onClickHandler:()=>{n.value=!0}},()=>[i.createVNode(d,{class:"flex-none sm:px-10 sm:py-4",onClick:c[0]||(c[0]=h=>n.value=!0)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.showPanelButtonText),1)]),_:1})])])):i.createCommentVNode("",!0),i.createElementVNode("div",Ok,[i.renderSlot(l.$slots,"preview-panel")]),l.$slots["preview-panel-extra"]?(i.openBlock(),i.createElementBlock("div",Ik,[i.renderSlot(l.$slots,"preview-panel-extra")])):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),i.createVNode(Tu,{"show-drawer":n.value,"onUpdate:showDrawer":c[1]||(c[1]=h=>n.value=h),title:t.panelTitle},i.createSlots({"drawer-content":i.withCtx(()=>[i.renderSlot(l.$slots,"panel-content")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"default")]),_:2},[l.$slots["panel-header"]?{name:"drawer-header",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"panel-header")]),key:"0"}:void 0,l.$slots["panel-bottom"]?{name:"drawer-footer",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"panel-bottom")]),key:"1"}:void 0]),1032,["show-drawer","title"])]),_:2},[l.$slots.title?{name:"title",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"title")]),key:"0"}:void 0,l.$slots["title-buttons"]?{name:"title-buttons",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"title-buttons")]),key:"1"}:void 0,l.$slots["title-extra"]?{name:"title-extra",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"title-extra")]),key:"2"}:void 0]),1032,["title"])}}}),Dk={},Hk=i.defineComponent({...Dk,__name:"manager-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!0},managerReferenceList:{default:()=>[]},disabledManagerReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},showEmptyValue:{type:Boolean,default:!1},groupBySalesDirection:{type:Boolean,default:!1}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.computed(()=>O.isArray(r.value)),a=i.computed(()=>{var g;return O.isArray(r.value)?r.value.map(f=>f.id):((g=r.value)==null?void 0:g.id)??null}),l=i.computed(()=>{var p;let g=r.showEmptyValue?[G.ManagerDataFactory.generateUndefinedManagerInstance(),...r.managerReferenceList]:r.managerReferenceList,f=r.disabledManagerReferenceList.map(y=>y.id);if(r.showActualOnly){const y=O.isArray(r.value)?r.value.map(b=>b.id):[(p=r.value)==null?void 0:p.id];f=O.union(f,r.managerReferenceList.filter(b=>!b.isActive).map(b=>b.id)),g=r.managerReferenceList.filter(b=>b.isActive||y.includes(b.id))}return zt.convertReferencesToSelectOptionsList(g,!0,r.groupBySalesDirection?{key:"item.salesDirection.id",label:"item.salesDirection.name"}:!1,!1,y=>{const b=!r.groupBySalesDirection||r.groupBySalesDirection&&O.some(o.value?r.value:[r.value],["id",y.id])?` (${y.salesDirection.name}) `:"";return y.salesDirection.isNewRec()?y.name:`${y.name}${b}${y.isActive?"":" [Не активен]"}`},y=>f.includes(y.id)&&y.isActive)}),c=i.computed(()=>l.value.map(g=>({...g,class:r.wrapContent?`${g.class} consistent-menu-width`:g.class}))),d=i.useTemplateRef("select-component"),h=g=>{if(O.isArray(g)){const f=g.length>0?g.filter(p=>!O.some(r.disabledManagerReferenceList,["id",p])).map(p=>r.managerReferenceList.find(y=>y.id===p)).filter(p=>!O.isNil(p)):[];s("update:value",f)}else{const f=g>0&&!O.some(r.disabledManagerReferenceList,["id",g])?r.managerReferenceList.find(p=>p.id===g):new G.Manager;s("update:value",f??new G.Manager)}};return i.watch(()=>r.value,()=>{var g,f;(f=(g=d.value)==null?void 0:g.$forceUpdate)==null||f.call(g)},{deep:!0}),i.watch(()=>r.disabledManagerReferenceList,g=>{if(g.length>0&&r.value)if(o.value){const f=r.value;O.some(f,p=>O.some(g,["id",p.id]))&&s("update:value",f.filter(p=>!O.some(g,["id",p.id])))}else{const f=r.value;O.some(g,["id",f.id])&&s("update:value",new G.Manager)}}),e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focusInput()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blurInput()}}),(g,f)=>(i.openBlock(),i.createBlock(i.unref(z.NSelect),{ref:"select-component",value:a.value,clearable:t.clearable,disabled:l.value.length===0,"consistent-menu-width":t.consistentMenuWidth,multiple:o.value,options:c.value,placeholder:"","onUpdate:value":h},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),Wk={class:"m-0.5 flex flex-col p-0.5"},jk={class:"flex flex-row gap-1"},qk={key:0},Xk={key:1},Yk={key:2},Uk={key:3},Gk={class:"flex flex-row gap-1"},Kk={key:0},Zk={key:1},Qk={key:2},Jk={key:3},e2={},Ru=i.defineComponent({...e2,__name:"address-suggestion-label",props:{addr:{},selected:{type:Boolean}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",Wk,[i.createElementVNode("span",jk,[t.addr.postIndex?(i.openBlock(),i.createElementBlock("span",qk,i.toDisplayString(t.addr.postIndex)+", ",1)):i.createCommentVNode("",!0),t.addr.city?(i.openBlock(),i.createElementBlock("span",Xk,i.toDisplayString(t.addr.city)+", ",1)):i.createCommentVNode("",!0),t.addr.locality?(i.openBlock(),i.createElementBlock("span",Yk,i.toDisplayString(t.addr.locality)+", ",1)):i.createCommentVNode("",!0),t.addr.region?(i.openBlock(),i.createElementBlock("span",Uk,i.toDisplayString(t.addr.region)+", ",1)):i.createCommentVNode("",!0)]),i.createElementVNode("span",Gk,[t.addr.street?(i.openBlock(),i.createElementBlock("span",Kk,i.toDisplayString(t.addr.street)+", ",1)):i.createCommentVNode("",!0),t.addr.building?(i.openBlock(),i.createElementBlock("span",Zk,i.toDisplayString(t.addr.building)+", ",1)):i.createCommentVNode("",!0),t.addr.buildingPart?(i.openBlock(),i.createElementBlock("span",Qk,i.toDisplayString(t.addr.buildingPart)+", ",1)):i.createCommentVNode("",!0),t.addr.apartments?(i.openBlock(),i.createElementBlock("span",Jk,i.toDisplayString(t.addr.apartments)+", ",1)):i.createCommentVNode("",!0)])]))}}),pa={clearable:!1,value:"",field:void 0,disabled:!1},t2={},n2=i.defineComponent({...t2,__name:"address-suggestion",props:i.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},searchDataHandler:{type:Function}},{...pa,minTermLength:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minSearchTermLength)??3},searchDataHandler:void 0}),emits:["select","update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.value),a=i.ref(!1),l=i.ref([]),c=i.computed(()=>l.value.map(p=>({label:p[r.field??"addressString"]??"-",value:p.id})));i.watch(()=>r.value,p=>{o.value=p}),i.watch(o,()=>{s("update:value",o.value)});const d=O.debounce(()=>h(),800),h=async()=>{!o.value||o.value.length<r.minTermLength||(a.value=!0,l.value=await(r.searchDataHandler?r.searchDataHandler(o.value,a):G.HttpRequester.getInstance(G.DataSuggestionProvider).searchAddresses(o.value)).finally(()=>{a.value=!1}))},u=(p,y)=>{const b=l.value.find(_=>_.id===p.value)||{};return i.h(Ru,{addr:b,selected:y},{default:O.constant("-")})},m=p=>{d.cancel();const y=l.value.find(b=>b.id===p)||{};s("select",y)},g=i.ref(null);function f(){g.value.focus()}return e({focus:f}),(p,y)=>{const b=z.NAutoComplete;return i.openBlock(),i.createBlock(b,{ref_key:"autoCompleteElement",ref:g,value:o.value,"onUpdate:value":[y[0]||(y[0]=_=>o.value=_),i.unref(d)],clearable:t.clearable,disabled:t.disabled,loading:a.value,options:c.value,"render-label":u,placeholder:"",onSelect:m},null,8,["value","clearable","disabled","loading","options","onUpdate:value"])}}}),i2={class:"m-0.5 flex flex-col p-0.5"},r2={class:"font-medium"},s2={class:"flex flex-row gap-1 text-xs font-light text-blue-800"},o2={key:0},a2={key:1},l2={},$u=i.defineComponent({...l2,__name:"bank-suggestion-label",props:{bank:{},selected:{type:Boolean}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",i2,[i.createElementVNode("span",r2,i.toDisplayString(t.bank.name),1),i.createElementVNode("span",s2,[t.bank.bic?(i.openBlock(),i.createElementBlock("span",o2," БИК: "+i.toDisplayString(t.bank.bic),1)):i.createCommentVNode("",!0),t.bank.inn?(i.openBlock(),i.createElementBlock("span",a2," ИНН: "+i.toDisplayString(t.bank.inn),1)):i.createCommentVNode("",!0)])]))}}),c2={},d2=i.defineComponent({...c2,__name:"bank-suggestion",props:i.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{}},{...pa,minTermLength:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minSearchTermLength)??3}}),emits:["select","update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.value),a=i.ref(!1),l=i.ref([]),c=i.computed(()=>l.value.map(p=>({label:p[r.field??"_"]??"-",value:p.id})));i.watch(()=>r.value,p=>{o.value=p}),i.watch(o,()=>{s("update:value",o.value)});const d=O.debounce(()=>h(),800),h=async()=>{if(!(!o.value||o.value.length<r.minTermLength)){a.value=!0;try{l.value=await G.HttpRequester.getInstance(G.DataSuggestionProvider).searchBank(o.value)}finally{a.value=!1}}},u=(p,y)=>{const b=l.value.find(_=>_.id===p.value)||{};return i.h($u,{bank:b,selected:y},{default:O.constant("-")})},m=p=>{d.cancel();const y=l.value.find(b=>b.id===p)||{};s("select",y)},g=i.ref(null);function f(){g.value.focus()}return e({focus:f}),(p,y)=>{const b=z.NAutoComplete;return i.openBlock(),i.createBlock(b,{ref_key:"autoCompleteElement",ref:g,value:o.value,"onUpdate:value":[y[0]||(y[0]=_=>o.value=_),i.unref(d)],clearable:t.clearable,disabled:t.disabled,loading:a.value,options:c.value,"render-label":u,placeholder:"",onSelect:m},null,8,["value","clearable","disabled","loading","options","onUpdate:value"])}}}),h2={class:"font-medium"},u2={key:0,class:"flex flex-row gap-2"},f2={key:0,class:"text-xs font-light text-blue-800"},g2={key:1,class:"text-sc-dark-grey text-xs font-light"},m2={},Eu=i.defineComponent({...m2,__name:"org-suggestion-label",props:{org:{},selected:{type:Boolean}},setup(t){const e=t,n=i.computed(()=>{var s,o;return((o=(s=e.org.rawData)==null?void 0:s.state)==null?void 0:o.liquidationDate)??!1}),r=i.computed(()=>{var s,o;return((o=(s=e.org.rawData)==null?void 0:s.address)==null?void 0:o.value)??""});return(s,o)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(`m-0.5 flex flex-col p-0.5 ${n.value?"line-through":""}`)},[i.createElementVNode("span",h2,i.toDisplayString(t.org.name),1),t.org.inn||r.value?(i.openBlock(),i.createElementBlock("div",u2,[t.org.inn?(i.openBlock(),i.createElementBlock("span",f2,i.toDisplayString(t.org.inn),1)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("span",g2,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],2))}}),p2={},y2=i.defineComponent({...p2,__name:"org-suggestion",props:i.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},allowSelectTerminated:{type:Boolean}},{...pa,minTermLength:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minSearchTermLength)??3}}),emits:["select","update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.value),a=i.ref(!1),l=i.ref([]),c=y=>{var b,_;return!!(((_=(b=y.rawData)==null?void 0:b.state)==null?void 0:_.liquidationDate)??!1)},d=i.computed(()=>zt.convertReferencesToSelectOptionsList(l.value,!1,!1,!1,y=>y[r.field??"_"]??"-",y=>!r.allowSelectTerminated&&c(y)));i.watch(()=>r.value,y=>{o.value=y}),i.watch(o,()=>{s("update:value",o.value)});const h=O.debounce(()=>u(),800),u=async()=>{if(!(!o.value||o.value.length<r.minTermLength)){a.value=!0;try{l.value=await G.HttpRequester.getInstance(G.DataSuggestionProvider).searchOrganization(o.value)}finally{a.value=!1}}},m=(y,b)=>{const _=l.value.find(C=>C.id===y.value)||{};return i.h(Eu,{org:_,selected:b},{default:O.constant("-")})},g=y=>{h.cancel();const b=l.value.find(_=>_.id===y)||{};(r.allowSelectTerminated||!c(b))&&s("select",b)},f=i.ref(null);function p(){f.value.focus()}return e({focus:p}),(y,b)=>{const _=z.NAutoComplete;return i.openBlock(),i.createBlock(_,{ref_key:"autoCompleteElement",ref:f,value:o.value,"onUpdate:value":[b[0]||(b[0]=C=>o.value=C),i.unref(h)],clearable:t.clearable,disabled:t.disabled,loading:a.value,options:d.value,"render-label":m,placeholder:"",onSelect:g},null,8,["value","clearable","disabled","loading","options","onUpdate:value"])}}}),b2={},_2=i.defineComponent({...b2,__name:"button-with-confirm-action",props:{disabled:{type:Boolean,default:!1},dialogTitle:{default:""},dialogContent:{default:""},disableConfirm:{type:Boolean,default:!1},popoverText:{default:""},type:{default:"default"},size:{default:"small"},quaternary:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["accept"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(!1),o=()=>{r("accept",()=>{s.value=!1})},a=()=>{n.disableConfirm?o():s.value=!0};return(l,c)=>{const d=z.NButton,h=z.NPopover,u=z.NModal;return i.openBlock(),i.createElementBlock("div",null,[i.createVNode(h,{disabled:t.popoverText.length===0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(d,{disabled:t.disabled,ghost:t.ghost,loading:t.loading,size:t.size,type:t.type,quaternary:t.quaternary,circle:t.circle,onClick:a},{default:i.withCtx(()=>[i.renderSlot(l.$slots,"default")]),_:3},8,["disabled","ghost","loading","size","type","quaternary","circle"])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.popoverText),1)]),_:3},8,["disabled"]),i.createVNode(u,{show:s.value,"onUpdate:show":c[1]||(c[1]=m=>s.value=m),content:t.dialogContent,closable:!1,"mask-closable":!1,"show-icon":!1,title:t.dialogTitle,"action-class":"",preset:"dialog"},{action:i.withCtx(()=>[i.createVNode(d,{type:"primary",class:"px-8",onClick:o},{default:i.withCtx(()=>[...c[2]||(c[2]=[i.createTextVNode(" Да ",-1)])]),_:1}),i.createVNode(d,{type:"default",onClick:c[0]||(c[0]=m=>s.value=!1)},{default:i.withCtx(()=>[...c[3]||(c[3]=[i.createTextVNode(" Отмена ",-1)])]),_:1})]),_:1},8,["show","content","title"])])}}}),w2={key:0,class:"whitespace-pre-line"},x2={key:1,class:"text-sc-dark-grey"},v2={},k2=i.defineComponent({...v2,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.comment);i.watch(()=>s.value,l=>{s.value=l});const o=l=>{r("update:comment",s.value,l)},a=()=>{s.value=n.comment};return(l,c)=>{const d=z.NInput;return i.openBlock(),i.createBlock(Ed,{disabled:t.disabled,"onEditor:apply":o,"onEditor:cancel":a},{viewer:i.withCtx(()=>[i.createElementVNode("div",null,[t.comment?(i.openBlock(),i.createElementBlock("span",w2,i.toDisplayString(t.comment),1)):(i.openBlock(),i.createElementBlock("span",x2," - Комментарий отсутствует - "))])]),editor:i.withCtx(()=>[i.createVNode(d,{value:s.value,"onUpdate:value":c[0]||(c[0]=h=>s.value=h),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),C2={key:0,class:"text-sm"},S2={key:1},B2={},T2=i.defineComponent({...B2,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,s)=>(i.openBlock(),i.createElementBlock("span",null,[t.wrapAsSmall&&t.debt!==0?(i.openBlock(),i.createElementBlock("span",C2,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),i.createElementVNode("span",{class:i.normalizeClass({"text-green-700":t.debt>0,"text-red-700":t.debt<0})},i.toDisplayString(t.debt)+" ₽ ",3)])):i.createCommentVNode("",!0),!t.wrapAsSmall&&t.debt!==0?(i.openBlock(),i.createElementBlock("span",S2,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),i.createElementVNode("span",{class:i.normalizeClass({"text-green-700":t.debt>0,"text-red-700":t.debt<0})},i.toDisplayString(t.debt)+" ₽ ",3)])):i.createCommentVNode("",!0)]))}}),R2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $2(t,e){return i.openBlock(),i.createElementBlock("svg",R2,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const E2=i.markRaw({name:"ion-warning",render:$2}),N2={},P2=i.defineComponent({...N2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(t){return(e,n)=>{const r=E2,s=z.NPopover;return i.openBlock(),i.createBlock(s,{disabled:t.popoverText.length===0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(r,{class:i.normalizeClass(`ml-0.5 ${t.iconClass}`)},null,8,["class"])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.popoverText),1)]),_:1},8,["disabled"])}}}),mt=class mt{static init(e,n){mt.messagesService&&mt.notificationsService||(mt.messagesService=e,mt.notificationsService=n)}static getMessagesService(){if(!mt.messagesService)throw new Error("UI provider is not initialized.");return mt.messagesService}static getNotificationsService(){if(!mt.notificationsService)throw new Error("UI provider is not initialized.");return mt.notificationsService}static showNotificationsForErrorResponseData(e,n={}){var r,s;if(O.isEmpty(e.errors)){const o=(s=(r=e.rawError)==null?void 0:r.config)==null?void 0:s.url,a=o?` [ ${o} ]`:"";mt.notificationsService?mt.notificationsService.error({title:"Ошибка выполнения/обработки запроса",content:e.message,meta:`#${e.status}${a}: ${e.statusText}`,duration:3e3}):console.log("Show notification error response data: UI provider is not initialized.",e)}else for(const o in e.errors)Object.prototype.hasOwnProperty.call(n,o)?n[o]=new G.FieldValidationResultData(e.errors[o].toString(),"error"):mt.messagesService?mt.messagesService.error(e.errors[o].toString()):console.log("Show notification error response data: UI provider is not initialized.",e.errors[o])}};x(mt,"messagesService"),x(mt,"notificationsService");let ya=mt;const F2=i.computed(()=>G.useReferencesStore().deliveryTypeReference??[]),M2=i.computed(()=>G.useReferencesStore().managersList??[]),A2=i.computed(()=>G.useReferencesStore().opfReference??[]),V2=i.computed(()=>G.useReferencesStore().partnerGroupsReference??[]),O2=i.computed(()=>G.useReferencesStore().priceCoefficientsReference??[]),I2=i.computed(()=>G.useReferencesStore().productFilesTypesReference??[]),z2=i.computed(()=>G.useReferencesStore().resourceTypesReference),L2=i.computed(()=>G.useReferencesStore().salesDirectionsReference??[]),D2=i.computed(()=>G.useReferencesStore().warehousesReference??[]),H2=i.computed(()=>zt.convertReferencesToSelectOptionsList(G.useReferencesStore().channelPrimaryInterestsReference??[],!0,!1,!0)),W2=i.computed(()=>zt.convertReferencesToSelectOptionsList(G.useReferencesStore().sourcePrimaryInterestsReference??[],!0,!1,!0)),j2=t=>G.HttpRequester.getInstance(G.ReferenceDataProvider).searchCity(t),q2=t=>zt.convertReferencesToSelectOptionsList(t,!0,!1,!1,e=>{var n,r,s;return e!=null&&e.isNewRec()?"-":`${e.name}, ${(n=e==null?void 0:e.region)==null?void 0:n.name}, ${(s=(r=e==null?void 0:e.region)==null?void 0:r.country)==null?void 0:s.name}`},e=>e==null?void 0:e.isNewRec());W.AddProductToCartDialog=iy,W.ConfiguratorSettingsKozyrek=_d,W.ContentHelper=Kn,W.KozyrekLine=ri,W.KozyrekTailTemplate=No,W.KozyrekTemplate=Di,W.OrdersTableFields=Ke,W.Point=$o,W.ScAddressSuggestion=n2,W.ScAddressSuggestionLabel=Ru,W.ScBankSuggestion=d2,W.ScBankSuggestionLabel=$u,W.ScBaseDialog=Cd,W.ScButtonWithConfirmAction=_2,W.ScCategoryCollapse=vd,W.ScClientNameWithShortInfo=os,W.ScCollapse=xd,W.ScCollapseItem=Da,W.ScCommentEditor=k2,W.ScConfiguratorsProductInfo=nr,W.ScContragentWithShortInfo=Sd,W.ScDateRange=gb,W.ScDateTimeLabel=Po,W.ScDebouncedInput=Db,W.ScDebouncedInputNumber=Li,W.ScDebt=T2,W.ScDialogHeader=vb,W.ScDynamicConfigurator=wd,W.ScEmail=_y,W.ScExternalLink=Zb,W.ScImageGallery=qa,W.ScInlineEditableItem=Ed,W.ScInlineView=Fo,W.ScKozyrekConfigurator=cd,W.ScKozyrekConfiguratorParamsForm=Ua,W.ScKozyrekConfiguratorPreview=ld,W.ScKozyrekConfiguratorTemplates=ad,W.ScLightGallery=ja,W.ScManagerSelect=Hk,W.ScMetalForDoorsConfigurator=bd,W.ScMetalForDoorsConfiguratorForm=yd,W.ScMosquitoConfigurator=ud,W.ScMosquitoConfiguratorForm=dd,W.ScMosquitoConfiguratorMeasurementInstructions=hd,W.ScMosquitoConfiguratorPreview=Eo,W.ScOrderCommonInfo=wu,W.ScOrderDeliveryLabel=Ts,W.ScOrderDetails=Cu,W.ScOrderInfo=Su,W.ScOrderItemsList=ku,W.ScOrderPayment=xu,W.ScOrderProductInfo=vu,W.ScOrdersList=wk,W.ScOrgSuggestion=y2,W.ScOrgSuggestionLabel=Eu,W.ScPage=Bu,W.ScPageWithSlidingPanel=Lk,W.ScPersonContactsBlock=cb,W.ScPhone=Wy,W.ScPhoneInput=jb,W.ScProductName=tr,W.ScProductsList=Sv,W.ScReferenceSelect=kd,W.ScSearchableProductSelect=_u,W.ScSearchableReferenceSelect=bu,W.ScSetClientPriceFormItem=K0,W.ScShortTextOrderInfo=Ck,W.ScSingleFileUploadSelector=Tb,W.ScSlidingContentWithDrawer=Tu,W.ScStripConfigurator=pd,W.ScStripConfiguratorForm=gd,W.ScStripConfiguratorLineItem=fd,W.ScStripConfiguratorPreview=md,W.ScUserShortInfo=ma,W.ScWarningIcon=P2,W.SelectOptionHelper=zt,W.UiNotificationProvider=ya,W.WindowResolutionEnum=Ue,W.WindowResolutionProvider=bt,W.channelPrimaryInterestOptionsList=H2,W.componentSizeInjectionKey=$r,W.deliveryTypeReferenceList=F2,W.managersReferenceList=M2,W.naiveUiTheme=kf,W.opfReferenceList=A2,W.partnerGroupReferenceList=V2,W.priceCoefficientsReferenceList=O2,W.productFilesTypesReferenceList=I2,W.renderConfig=Ve,W.resourceReferencesList=z2,W.salesDirectionsReferenceList=L2,W.searchCityReferenceDataHandler=j2,W.searchCityReferenceLabelRenderer=q2,W.sourcePrimaryInterestOptionsList=W2,W.warehousesReferenceList=D2,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|
|
822
|
+
`,[fu({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})])]);function Bs(t){return t.type==="group"}function yu(t){return t.type==="ignored"}function ga(t,e){try{return!!(1+e.toString().toLowerCase().indexOf(t.trim().toLowerCase()))}catch{return!1}}function hv(t,e){return{getIsGroup:Bs,getIgnored:yu,getKey(r){return Bs(r)?r.name||r.key||"key-required":r[t]},getChildren(r){return r[e]}}}function uv(t,e,n,r){if(!e)return t;function s(o){if(!Array.isArray(o))return[];const a=[];for(const l of o)if(Bs(l)){const c=s(l[r]);c.length&&a.push(Object.assign({},l,{[r]:c}))}else{if(yu(l))continue;e(n,l)&&a.push(l)}return a}return s(t)}function fv(t,e,n){const r=new Map;return t.forEach(s=>{Bs(s)?s[n].forEach(o=>{r.set(o[e],o)}):r.set(s[e],s)}),r}var gv={};const mv=Object.assign(Object.assign({},ut.props),{to:kn.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},keyboard:{type:Boolean,default:!0},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,menuSize:{type:String},filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:Function,placement:{type:String,default:"bottom-start"},widthMode:{type:String,default:"trigger"},tag:Boolean,onCreate:Function,fallbackOption:{type:[Function,Boolean],default:void 0},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],ellipsisTagPopoverProps:Object,consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},childrenField:{type:String,default:"children"},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,nodeProps:Function,ignoreComposition:{type:Boolean,default:!0},showOnFocus:Boolean,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:"show"},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,showCheckmark:{type:Boolean,default:!0},onChange:[Function,Array],items:Array}),pv=i.defineComponent({name:"Select",props:mv,slots:Object,setup(t){gv.NODE_ENV!=="production"&&i.watchEffect(()=>{t.items!==void 0&&jn("select","`items` is deprecated, please use `options` instead."),t.onChange!==void 0&&jn("select","`on-change` is deprecated, please use `on-update:value` instead.")});const{mergedClsPrefixRef:e,mergedBorderedRef:n,namespaceRef:r,inlineThemeDisabled:s}=gi(t),o=ut("Select","-select",dv,cv,t,e),a=i.ref(t.defaultValue),l=i.toRef(t,"value"),c=Ho(l,a),d=i.ref(!1),h=i.ref(""),u=jd(t,["items","options"]),m=i.ref([]),g=i.ref([]),f=i.computed(()=>g.value.concat(m.value).concat(u.value)),p=i.computed(()=>{const{filter:T}=t;if(T)return T;const{labelField:j,valueField:ne}=t;return(le,ce)=>{if(!ce)return!1;const pe=ce[j];if(typeof pe=="string")return ga(le,pe);const _e=ce[ne];return typeof _e=="string"?ga(le,_e):typeof _e=="number"?ga(le,String(_e)):!1}}),y=i.computed(()=>{if(t.remote)return u.value;{const{value:T}=f,{value:j}=h;return!j.length||!t.filterable?T:uv(T,p.value,j,t.childrenField)}}),b=i.computed(()=>{const{valueField:T,childrenField:j}=t,ne=hv(T,j);return H_(y.value,ne)}),_=i.computed(()=>fv(f.value,t.valueField,t.childrenField)),C=i.ref(!1),S=Ho(i.toRef(t,"show"),C),v=i.ref(null),B=i.ref(null),k=i.ref(null),{localeRef:R}=Qh("Select"),$=i.computed(()=>{var T;return(T=t.placeholder)!==null&&T!==void 0?T:R.value.placeholder}),P=[],I=i.ref(new Map),V=i.computed(()=>{const{fallbackOption:T}=t;if(T===void 0){const{labelField:j,valueField:ne}=t;return le=>({[j]:String(le),[ne]:le})}return T===!1?!1:j=>Object.assign(T(j),{value:j})});function A(T){const j=t.remote,{value:ne}=I,{value:le}=_,{value:ce}=V,pe=[];return T.forEach(_e=>{if(le.has(_e))pe.push(le.get(_e));else if(j&&ne.has(_e))pe.push(ne.get(_e));else if(ce){const xe=ce(_e);xe&&pe.push(xe)}}),pe}const L=i.computed(()=>{if(t.multiple){const{value:T}=c;return Array.isArray(T)?A(T):[]}return null}),D=i.computed(()=>{const{value:T}=c;return!t.multiple&&!Array.isArray(T)?T===null?null:A([T])[0]||null:null}),ee=xw(t),{mergedSizeRef:E,mergedDisabledRef:N,mergedStatusRef:H}=ee;function q(T,j){const{onChange:ne,"onUpdate:value":le,onUpdateValue:ce}=t,{nTriggerFormChange:pe,nTriggerFormInput:_e}=ee;ne&&ht(ne,T,j),ce&&ht(ce,T,j),le&&ht(le,T,j),a.value=T,pe(),_e()}function Y(T){const{onBlur:j}=t,{nTriggerFormBlur:ne}=ee;j&&ht(j,T),ne()}function F(){const{onClear:T}=t;T&&ht(T)}function M(T){const{onFocus:j,showOnFocus:ne}=t,{nTriggerFormFocus:le}=ee;j&&ht(j,T),le(),ne&&re()}function Z(T){const{onSearch:j}=t;j&&ht(j,T)}function fe(T){const{onScroll:j}=t;j&&ht(j,T)}function ie(){var T;const{remote:j,multiple:ne}=t;if(j){const{value:le}=I;if(ne){const{valueField:ce}=t;(T=L.value)===null||T===void 0||T.forEach(pe=>{le.set(pe[ce],pe)})}else{const ce=D.value;ce&&le.set(ce[t.valueField],ce)}}}function me(T){const{onUpdateShow:j,"onUpdate:show":ne}=t;j&&ht(j,T),ne&&ht(ne,T),C.value=T}function re(){N.value||(me(!0),C.value=!0,t.filterable&&Xn())}function Me(){me(!1)}function Ae(){h.value="",g.value=P}const Oe=i.ref(!1);function Le(){t.filterable&&(Oe.value=!0)}function pt(){t.filterable&&(Oe.value=!1,S.value||Ae())}function Zt(){N.value||(S.value?t.filterable?Xn():Me():re())}function Qt(T){var j,ne;!((ne=(j=k.value)===null||j===void 0?void 0:j.selfRef)===null||ne===void 0)&&ne.contains(T.relatedTarget)||(d.value=!1,Y(T),Me())}function St(T){M(T),d.value=!0}function At(){d.value=!0}function yt(T){var j;!((j=v.value)===null||j===void 0)&&j.$el.contains(T.relatedTarget)||(d.value=!1,Y(T),Me())}function pn(){var T;(T=v.value)===null||T===void 0||T.focus(),Me()}function Pn(T){var j;S.value&&(!((j=v.value)===null||j===void 0)&&j.$el.contains(dr(T))||Me())}function De(T){if(!Array.isArray(T))return[];if(V.value)return Array.from(T);{const{remote:j}=t,{value:ne}=_;if(j){const{value:le}=I;return T.filter(ce=>ne.has(ce)||le.has(ce))}else return T.filter(le=>ne.has(le))}}function ke(T){Ie(T.rawNode)}function Ie(T){if(N.value)return;const{tag:j,remote:ne,clearFilterAfterSelect:le,valueField:ce}=t;if(j&&!ne){const{value:pe}=g,_e=pe[0]||null;if(_e){const xe=m.value;xe.length?xe.push(_e):m.value=[_e],g.value=P}}if(ne&&I.value.set(T[ce],T),t.multiple){const pe=De(c.value),_e=pe.findIndex(xe=>xe===T[ce]);if(~_e){if(pe.splice(_e,1),j&&!ne){const xe=J(T[ce]);~xe&&(m.value.splice(xe,1),le&&(h.value=""))}}else pe.push(T[ce]),le&&(h.value="");q(pe,A(pe))}else{if(j&&!ne){const pe=J(T[ce]);~pe?m.value=[m.value[pe]]:m.value=P}Gi(),Me(),q(T[ce],T)}}function J(T){return m.value.findIndex(ne=>ne[t.valueField]===T)}function se(T){S.value||re();const{value:j}=T.target;h.value=j;const{tag:ne,remote:le}=t;if(Z(j),ne&&!le){if(!j){g.value=P;return}const{onCreate:ce}=t,pe=ce?ce(j):{[t.labelField]:j,[t.valueField]:j},{valueField:_e,labelField:xe}=t;u.value.some(Ye=>Ye[_e]===pe[_e]||Ye[xe]===pe[xe])||m.value.some(Ye=>Ye[_e]===pe[_e]||Ye[xe]===pe[xe])?g.value=P:g.value=[pe]}}function Ce(T){T.stopPropagation();const{multiple:j}=t;!j&&t.filterable&&Me(),F(),j?q([],[]):q(null,null)}function Jt(T){!cr(T,"action")&&!cr(T,"empty")&&!cr(T,"header")&&T.preventDefault()}function Ui(T){fe(T)}function wi(T){var j,ne,le,ce,pe;if(!t.keyboard){T.preventDefault();return}switch(T.key){case" ":if(t.filterable)break;T.preventDefault();case"Enter":if(!(!((j=v.value)===null||j===void 0)&&j.isComposing)){if(S.value){const _e=(ne=k.value)===null||ne===void 0?void 0:ne.getPendingTmNode();_e?ke(_e):t.filterable||(Me(),Gi())}else if(re(),t.tag&&Oe.value){const _e=g.value[0];if(_e){const xe=_e[t.valueField],{value:Ye}=c;t.multiple&&Array.isArray(Ye)&&Ye.includes(xe)||Ie(_e)}}}T.preventDefault();break;case"ArrowUp":if(T.preventDefault(),t.loading)return;S.value&&((le=k.value)===null||le===void 0||le.prev());break;case"ArrowDown":if(T.preventDefault(),t.loading)return;S.value?(ce=k.value)===null||ce===void 0||ce.next():re();break;case"Escape":S.value&&(yw(T),Me()),(pe=v.value)===null||pe===void 0||pe.focus();break}}function Gi(){var T;(T=v.value)===null||T===void 0||T.focus()}function Xn(){var T;(T=v.value)===null||T===void 0||T.focusInput()}function xi(){var T;S.value&&((T=B.value)===null||T===void 0||T.syncPosition())}ie(),i.watch(i.toRef(t,"options"),ie);const Ki={focus:()=>{var T;(T=v.value)===null||T===void 0||T.focus()},focusInput:()=>{var T;(T=v.value)===null||T===void 0||T.focusInput()},blur:()=>{var T;(T=v.value)===null||T===void 0||T.blur()},blurInput:()=>{var T;(T=v.value)===null||T===void 0||T.blurInput()}},en=i.computed(()=>{const{self:{menuBoxShadow:T}}=o.value;return{"--n-menu-box-shadow":T}}),Fn=s?mi("select",void 0,en,t):void 0;return Object.assign(Object.assign({},Ki),{mergedStatus:H,mergedClsPrefix:e,mergedBordered:n,namespace:r,treeMate:b,isMounted:fs(),triggerRef:v,menuRef:k,pattern:h,uncontrolledShow:C,mergedShow:S,adjustedTo:kn(t),uncontrolledValue:a,mergedValue:c,followerRef:B,localizedPlaceholder:$,selectedOption:D,selectedOptions:L,mergedSize:E,mergedDisabled:N,focused:d,activeWithoutMenuOpen:Oe,inlineThemeDisabled:s,onTriggerInputFocus:Le,onTriggerInputBlur:pt,handleTriggerOrMenuResize:xi,handleMenuFocus:At,handleMenuBlur:yt,handleMenuTabOut:pn,handleTriggerClick:Zt,handleToggle:ke,handleDeleteOption:Ie,handlePatternInput:se,handleClear:Ce,handleTriggerBlur:Qt,handleTriggerFocus:St,handleKeydown:wi,handleMenuAfterLeave:Ae,handleMenuClickOutside:Pn,handleMenuScroll:Ui,handleMenuKeydown:wi,handleMenuMousedown:Jt,mergedTheme:o,cssVars:s?void 0:en,themeClass:Fn==null?void 0:Fn.themeClass,onRender:Fn==null?void 0:Fn.onRender})},render(){return i.h("div",{class:`${this.mergedClsPrefix}-select`},i.h(Ud,null,{default:()=>[i.h(Gd,null,{default:()=>i.h(av,{ref:"triggerRef",inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,labelField:this.labelField,valueField:this.valueField,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus,onResize:this.handleTriggerOrMenuResize,ignoreComposition:this.ignoreComposition},{arrow:()=>{var t,e;return[(e=(t=this.$slots).arrow)===null||e===void 0?void 0:e.call(t)]}})}),i.h(dh,{ref:"followerRef",show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===kn.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?"target":void 0,minWidth:"target",placement:this.placement},{default:()=>i.h(i.Transition,{name:"fade-in-scale-up-transition",appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var t,e,n;return this.mergedShow||this.displayDirective==="show"?((t=this.onRender)===null||t===void 0||t.call(this),i.withDirectives(i.h(Vx,Object.assign({},this.menuProps,{ref:"menuRef",onResize:this.handleTriggerOrMenuResize,inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,(e=this.menuProps)===null||e===void 0?void 0:e.class],clsPrefix:this.mergedClsPrefix,focusable:!0,labelField:this.labelField,valueField:this.valueField,autoPending:!0,nodeProps:this.nodeProps,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:this.menuSize,renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[(n=this.menuProps)===null||n===void 0?void 0:n.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,showCheckmark:this.showCheckmark,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange}),{empty:()=>{var r,s;return[(s=(r=this.$slots).empty)===null||s===void 0?void 0:s.call(r)]},header:()=>{var r,s;return[(s=(r=this.$slots).header)===null||s===void 0?void 0:s.call(r)]},action:()=>{var r,s;return[(s=(r=this.$slots).action)===null||s===void 0?void 0:s.call(r)]}}),this.displayDirective==="show"?[[i.vShow,this.mergedShow],[us,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[us,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}}),yv={},bu=i.defineComponent({...yv,__name:"searchable-reference-select",props:{searchDataHandler:{},optionsListConverter:{},renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minLength.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.computed(()=>O.isArray(r.value)),a=i.computed(()=>o.value?r.value.map(_=>_.id):r.value?r.value.id:null),l=i.ref(o.value?r.optionsListConverter(r.value):r.value?r.optionsListConverter([r.value]):[]),c=i.computed(()=>l.value.map(_=>({..._,class:r.wrapContent?`${_.class} consistent-menu-width`:_.class}))),d=i.ref(!1),h=i.useTemplateRef("select-component"),u=_=>{_.length<r.minTermLength||(d.value=!0,r.searchDataHandler(_,d).then(C=>{if(O.isEmpty(C))return;const S=o.value?r.value:r.value?[r.value]:[],v=C.filter(B=>!S.some(k=>k.id===B.id));l.value=r.optionsListConverter([...S,...v])}).finally(()=>{d.value=!1}))};let m="";const g=O.debounce(()=>u(m),800),f=_=>{m=_,g()},p=_=>{var C;if(O.isArray(_)){const S=_.length>0?_.map(v=>{var B;return i.toRaw((B=l.value.find(k=>k.value===v))==null?void 0:B.item)}):[];s("update:value",S)}else if(_>0){const S=i.toRaw((C=l.value.find(v=>v.value===_))==null?void 0:C.item);s("update:value",S)}else s("update:value",null)};return e({focus:()=>{var _;return(_=h.value)==null?void 0:_.focusInput()},blur:()=>{var _;return(_=h.value)==null?void 0:_.blurInput()}}),(_,C)=>(i.openBlock(),i.createBlock(i.unref(pv),{ref:"select-component","clear-filter-after-select":!0,clearable:t.clearable,"consistent-menu-width":t.consistentMenuWidth,disabled:t.disabled,filterable:!0,loading:d.value,multiple:o.value,options:c.value,placeholder:t.placeholder,remote:!0,value:a.value,"render-label":t.renderLabel,"render-tag":t.renderTag,onSearch:f,"onUpdate:value":p},null,8,["clearable","consistent-menu-width","disabled","loading","multiple","options","placeholder","value","render-label","render-tag"]))}}),bv={},_u=i.defineComponent({...bv,__name:"searchable-product-select",props:{renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minLength.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""},searchType:{}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.useTemplateRef("select-component"),a=async u=>r.searchType==="categories"?G.HttpRequester.getInstance(G.ProductCategoryDataProvider).publicSimpleSearch(u):r.searchType==="products"?G.HttpRequester.getInstance(G.ProductDataProvider).publicSimpleSearch(u):new Promise(m=>{m([])}),l=u=>r.searchType==="categories"?zt.convertReferencesToSelectOptionsList(u,!0,!1,!1,m=>m!=null&&m.isNewRec()?"-":m.name):r.searchType==="products"?zt.convertReferencesToSelectOptionsList(u,!0,!1,!1,m=>m!=null&&m.isNewRec()?"-":`[${m.code}] ${m.name}`):[],c=(u,m)=>{if(r.renderLabel)return r.renderLabel(u,m);if(r.searchType==="products"){const g=u.item;return i.h("div",{},[i.h("span",{class:"text-sc-grey mr-2.5"},g.code),i.h("span",{},[g.name])])}if(r.searchType==="categories"){const g=u.item;return i.h("div",{},[g.name])}};return e({focus:()=>{var u;return(u=o.value)==null?void 0:u.focus()},blur:()=>{var u;return(u=o.value)==null?void 0:u.blur()}}),(u,m)=>(i.openBlock(),i.createBlock(bu,{ref:"select-component",value:t.value,clearable:t.clearable,disabled:t.disabled,placeholder:t.placeholder,"search-data-handler":a,"options-list-converter":l,"consistent-menu-width":t.consistentMenuWidth,"wrap-content":t.wrapContent,"min-term-length":t.minTermLength,"render-label":c,"render-tag":t.renderTag,"onUpdate:value":m[0]||(m[0]=g=>s("update:value",g))},null,8,["value","clearable","disabled","placeholder","consistent-menu-width","wrap-content","min-term-length","render-tag"]))}}),_v={class:"col-span-2 flex flex-row gap-2.5"},wv={class:"flex-1"},xv={class:"text-sc-grey"},vv={class:"ml-2.5"},kv={key:0,class:"flex-none"},Cv={},Sv=i.defineComponent({...Cv,__name:"products-list",props:{value:{},searchType:{},minTermLength:{default:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minLength.searchTerm)??3}},disabled:{type:Boolean}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(null),o=()=>structuredClone(i.toRaw(n.value)),a=i.ref(o()),l=()=>{r("update:value",a.value.map(u=>i.toRaw(u)))},c=u=>{u&&(a.value=[...a.value.map(m=>i.toRaw(m)),...(O.isArray(u)?u:[u]).filter(m=>!a.value.some(g=>g.id===m.id))],i.nextTick(()=>{s.value=null}),l())},d=u=>{u&&(a.value=a.value.map(m=>m.id===u.id?u:i.toRaw(m)),l())},h=u=>{a.value=a.value.filter(m=>m.id!==u.id),l()};return i.watch(()=>n.value,()=>{a.value=o()}),(u,m)=>{const g=z.NListItem,f=e_,p=z.NButton,y=z.NList;return i.openBlock(),i.createBlock(y,{"show-divider":!1,hoverable:!0},{header:i.withCtx(()=>[i.renderSlot(u.$slots,"header")]),footer:i.withCtx(()=>[i.createVNode(_u,{value:s.value,"onUpdate:value":[m[0]||(m[0]=b=>s.value=b),c],clearable:!0,disabled:t.disabled,"min-term-length":t.minTermLength,"search-type":t.searchType,placeholder:"Введите название"},null,8,["value","disabled","min-term-length","search-type"])]),default:i.withCtx(()=>[a.value.length===0?(i.openBlock(),i.createBlock(g,{key:0,class:"text-center text-sm text-gray-600"},{default:i.withCtx(()=>[...m[1]||(m[1]=[i.createTextVNode(" --- Список пуст --- ",-1)])]),_:1})):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,b=>(i.openBlock(),i.createBlock(g,{key:b.id},{suffix:i.withCtx(()=>[i.createVNode(p,{disabled:t.disabled,quaternary:"",type:"error",onClick:_=>h(b)},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled","onClick"])]),default:i.withCtx(()=>[i.createElementVNode("div",_v,[i.createElementVNode("span",wv,[i.createElementVNode("span",xv,i.toDisplayString(b.code),1),i.createElementVNode("span",vv,i.toDisplayString(b.name),1)]),u.$slots["item-extra"]?(i.openBlock(),i.createElementBlock("div",kv,[i.renderSlot(u.$slots,"item-extra",{item:b,updateItemCallback:d})])):i.createCommentVNode("",!0)])]),_:2},1024))),128))]),_:3})}}}),Bv={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Tv(t,e){return i.openBlock(),i.createElementBlock("svg",Bv,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M13 4a1 1 0 0 1 1 1h4a1 1 0 0 1 .783.378l.074.108l3 5l.055.103l.04.107l.029.109l.016.11L22 11v6a1 1 0 0 1-1 1h-1.171a3.001 3.001 0 0 1-5.658 0H9.829a3.001 3.001 0 0 1-5.658 0H3a1 1 0 0 1-1-1V6a2 2 0 0 1 2-2zM7 16a1 1 0 1 0 0 2a1 1 0 0 0 0-2m10 0a1 1 0 1 0 0 2a1 1 0 0 0 0-2m.434-9H14v3h5.234z"},null,-1)])])}const Rv=i.markRaw({name:"tabler-truck-filled",render:Tv}),$v={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ev(t,e){return i.openBlock(),i.createElementBlock("svg",$v,[...e[0]||(e[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M5 17a2 2 0 1 0 4 0a2 2 0 1 0-4 0m10 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"}),i.createElementVNode("path",{d:"M5 17H3v-4M2 5h11v12m-4 0h6m4 0h2v-6h-8m0-5h5l3 5M3 9h4"})],-1)])])}const Nv=i.markRaw({name:"tabler-truck-delivery",render:Ev}),Pv={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fv(t,e){return i.openBlock(),i.createElementBlock("svg",Pv,[...e[0]||(e[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M2 3h1a2 2 0 0 1 2 2v10a2 2 0 0 0 2 2h15"}),i.createElementVNode("path",{d:"M9 9a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-4a3 3 0 0 1-3-3zM7 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0m9 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"})],-1)])])}const Mv=i.markRaw({name:"tabler-truck-loading",render:Fv}),Av={class:"flex flex-col gap-1"},Vv={key:0,class:"flex flex-row gap-1 text-base"},Ov={key:1,class:"text-sc-dark-grey text-sm"},Iv={class:"text-sc-grey mr-1.5"},zv={key:0},Lv={key:1},Dv={key:2},Hv={},Ts=i.defineComponent({...Hv,__name:"order-delivery-label",props:{delivery:{},showType:{type:Boolean,default:!0},showDetails:{type:Boolean,default:!0}},setup(t){const e=i.computed(()=>{var s;return(s=G.useReferencesStore().deliveryTypeReference)==null?void 0:s.find(o=>o.id===r.delivery.type)}),n=i.computed(()=>Mn.format(r.delivery.date,"dd.MM.yyyy")),r=t;return(s,o)=>{var d,h,u,m,g,f,p,y;const a=Mv,l=Nv,c=Rv;return i.openBlock(),i.createElementBlock("div",Av,[t.showType?(i.openBlock(),i.createElementBlock("span",Vv,[((d=e.value)==null?void 0:d.slug)==="self_delivery"?(i.openBlock(),i.createBlock(a,{key:0})):i.createCommentVNode("",!0),((h=e.value)==null?void 0:h.slug)==="delivery"?(i.openBlock(),i.createBlock(l,{key:1})):i.createCommentVNode("",!0),((u=e.value)==null?void 0:u.slug)==="transport_company_delivery"?(i.openBlock(),i.createBlock(c,{key:2})):i.createCommentVNode("",!0),i.createElementVNode("span",null,i.toDisplayString((m=e.value)==null?void 0:m.name),1)])):i.createCommentVNode("",!0),t.showDetails?(i.openBlock(),i.createElementBlock("span",Ov,[i.createElementVNode("span",Iv,i.toDisplayString(n.value),1),(f=(g=t.delivery)==null?void 0:g.address)!=null&&f.address?(i.openBlock(),i.createElementBlock("span",zv,i.toDisplayString(t.delivery.address.address),1)):i.createCommentVNode("",!0),(y=(p=t.delivery)==null?void 0:p.warehouse)!=null&&y.address?(i.openBlock(),i.createElementBlock("span",Lv,"со склада "+i.toDisplayString(t.delivery.warehouse.address),1)):(i.openBlock(),i.createElementBlock("span",Dv,"(не указано)"))])):i.createCommentVNode("",!0)])}}}),Wv={class:"flex flex-col gap-2.5"},jv={class:"text-base"},qv=["href"],Xv={class:"text-sc-grey"},Yv={},wu=i.defineComponent({...Yv,__name:"order-common-info",props:{order:{},fields:{},orderUrl:{}},setup(t){const e=t,n=i.computed(()=>e.fields.includes(Ke.Id)?e.order.id:void 0),r=i.computed(()=>{var l,c;return e.fields.includes(Ke.Status)?(c=(l=G.useReferencesStore().orderStatusReference)==null?void 0:l.find(d=>d.id===(e.order.status??-1)))==null?void 0:c.name:void 0}),s=i.computed(()=>e.fields.includes(Ke.CreatedAt)),o=i.computed(()=>e.fields.includes(Ke.ClientInfo)?e.order.client:void 0),a=i.computed(()=>e.fields.includes(Ke.DeliveryInfo)?e.order.delivery:void 0);return(l,c)=>(i.openBlock(),i.createElementBlock("div",Wv,[i.createElementVNode("span",jv,[n.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:t.orderUrl.replace(":id",t.order.id.toString()),target:"_blank",class:"text-sc-dark-grey"}," #"+i.toDisplayString(n.value),9,qv)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[c[0]||(c[0]=i.createTextVNode(" от ",-1)),i.createVNode(Po,{date:t.order.createdAt,"is-time-secondary":!0},null,8,["date"])],64)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[c[1]||(c[1]=i.createTextVNode(" - ",-1)),i.createElementVNode("span",Xv,i.toDisplayString(r.value),1)],64)):i.createCommentVNode("",!0)]),o.value?(i.openBlock(),i.createBlock(os,{key:0,client:o.value,class:"ml-3"},null,8,["client"])):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(Ts,{key:1,delivery:a.value,class:"ml-3"},null,8,["delivery"])):i.createCommentVNode("",!0)]))}}),Uv={},xu=i.defineComponent({...Uv,__name:"order-payment",props:{payment:{}},setup(t){const e=t,n=i.computed(()=>{var r;return(r=G.useReferencesStore().paymentTypeReference)==null?void 0:r.find(s=>s.id===e.payment.type)});return(r,s)=>{var o;return i.openBlock(),i.createElementBlock("span",null,i.toDisplayString(((o=n.value)==null?void 0:o.name)??"-"),1)}}}),Gv={class:"flex flex-row gap-1.5"},Kv={class:"flex-none text-nowrap"},Zv={class:"flex flex-1 flex-col"},Qv={class:"mt-2.5 grid grid-flow-col grid-rows-2 gap-1 text-base"},Jv={key:0},ek={key:1},tk={},vu=i.defineComponent({...tk,__name:"order-product-info",props:{product:{},index:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",Gv,[i.createElementVNode("span",Kv,i.toDisplayString(t.index+1)+".",1),i.createElementVNode("div",Zv,[i.createVNode(tr,{product:t.product.product,"show-planning-dates":!1},null,8,["product"]),i.createElementVNode("div",Qv,[n[0]||(n[0]=i.createElementVNode("span",null,"Кол-во",-1)),t.product.product.getIsMeasurable()?(i.openBlock(),i.createElementBlock("span",Jv,i.toDisplayString(`${t.product.length} ${t.product.product.unit} x ${t.product.quantity} шт.`),1)):(i.openBlock(),i.createElementBlock("span",ek,i.toDisplayString(`${t.product.quantity} ${t.product.product.unit}`),1)),n[1]||(n[1]=i.createElementVNode("span",null,"Цена за ед.",-1)),i.createElementVNode("span",null,i.toDisplayString(`${t.product.costOneRub.toLocaleString("ru-ru",{minimumFractionDigits:2})} ${t.product.currency}`),1),n[2]||(n[2]=i.createElementVNode("span",null,"Сумма",-1)),i.createElementVNode("span",null,i.toDisplayString(`${t.product.cost.toLocaleString("ru-ru",{minimumFractionDigits:2})} ${t.product.currency}`),1)])])]))}}),nk={},ik=i.defineComponent({...nk,__name:"order-items-list",props:{order:{}},setup(t){const e=()=>{const s=[{title:"№ п.п.",key:"id",resizable:!0,width:50,render:(o,a)=>i.h("span",{class:"text-base"},[a+1,"."])},{title:"Артикул",key:"codeNumber",resizable:!0,minWidth:120,render:o=>i.h("span",{class:"text-base"},[o.product.code])},{title:"Наименование",key:"name",resizable:!0,render:o=>i.h(tr,{product:o.product,showCode:!1,showPlanningDates:!1})},{title:"Кол-во",key:"quantity",resizable:!0,minWidth:100,render:o=>i.h("span",{class:"text-nowrap text-base"},o.product.getIsMeasurable()?[`${o.length} ${o.product.unit} x ${o.quantity} шт.`]:[`${o.quantity} ${o.product.unit}`])},{title:"Цена за ед.",key:"costOneRub",resizable:!0,minWidth:100,render:o=>i.h("span",{class:"text-base"},[`${o.costOneRub.toLocaleString("ru-ru",{minimumFractionDigits:2})} ${o.currency}`])},{title:"Сумма",key:"cost",resizable:!0,minWidth:100,render:o=>i.h("span",{class:"text-base"},[`${o.cost.toLocaleString("ru-ru",{minimumFractionDigits:2})} ${o.currency}`])}];switch(bt.getDeviceTypeByResolution()){case Ue.phone:case Ue.tablet:return[{title:"",key:"items",resizable:!0,render:(o,a)=>i.h(vu,{product:o,index:a})}];case Ue.laptop:return s;default:return s}},n=i.ref(e()),r=()=>{n.value=e()};return i.onMounted(()=>{r(),window.addEventListener("resize",r)}),i.onUnmounted(()=>{window.removeEventListener("resize",r)}),(s,o)=>{const a=z.NDataTable;return i.openBlock(),i.createElementBlock(i.Fragment,null,[o[0]||(o[0]=i.createElementVNode("h3",null,"Список позиций",-1)),i.createVNode(a,{columns:n.value,data:t.order.products,"row-key":l=>l.id,"bottom-bordered":!1,bordered:!1},null,8,["columns","data","row-key"])],64)}}}),ku=Zn(ik,[["__scopeId","data-v-b15b9b70"]]),rk={class:"text-base"},sk={},ma=i.defineComponent({...sk,__name:"user-short-info",props:{user:{},showUserType:{type:Boolean,default:!0},extraInfoOnSecondLine:{type:Boolean,default:!0}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass({"flex flex-col":t.showUserType&&t.extraInfoOnSecondLine})},[i.createElementVNode("span",rk,i.toDisplayString(t.user.name),1),t.showUserType?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass([{"ml-1":!t.extraInfoOnSecondLine},"text-sc-grey"])}," ["+i.toDisplayString(t.user.type)+"] ",3)):i.createCommentVNode("",!0)],2))}}),ok={class:"ml-4 grid grid-cols-3 gap-1.5 text-base"},ak={class:"col-span-2"},lk={class:"col-span-2"},ck={class:"btn btn-primary",href:"{{ invoice }}"},dk={},Cu=i.defineComponent({...dk,__name:"order-details",props:{order:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",null,[n[11]||(n[11]=i.createElementVNode("h3",null,"Детали заказа",-1)),i.createElementVNode("div",ok,[t.order.creator.id!==t.order.client.id?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[n[0]||(n[0]=i.createElementVNode("span",null,"Создал",-1)),i.createVNode(ma,{user:t.order.creator,class:"col-span-2"},null,8,["user"])],64)):i.createCommentVNode("",!0),n[10]||(n[10]=i.createElementVNode("span",null,"Клиент",-1)),i.createVNode(os,{client:t.order.client,class:"col-span-2"},null,8,["client"]),t.order.contragent?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[n[1]||(n[1]=i.createElementVNode("span",null,"Контрагент",-1)),i.createVNode(Sd,{contragent:t.order.contragent,class:"col-span-2"},null,8,["contragent"])],64)):i.createCommentVNode("",!0),t.order.image?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[n[2]||(n[2]=i.createElementVNode("span",null,"Графический файл клиента",-1)),n[3]||(n[3]=i.createElementVNode("a",{class:"fancybox col-span-2",href:"{{ order.image }}"}," Посмотреть ",-1))],64)):i.createCommentVNode("",!0),t.order.barcode?(i.openBlock(),i.createElementBlock(i.Fragment,{key:3},[n[4]||(n[4]=i.createElementVNode("span",null,"Штрих-код",-1)),i.createElementVNode("span",ak,i.toDisplayString(t.order.barcode),1)],64)):i.createCommentVNode("",!0),t.order.payment?(i.openBlock(),i.createElementBlock(i.Fragment,{key:4},[n[5]||(n[5]=i.createElementVNode("span",null,"Оплата",-1)),i.createVNode(xu,{payment:t.order.payment,class:"col-span-2"},null,8,["payment"])],64)):i.createCommentVNode("",!0),t.order.delivery?(i.openBlock(),i.createElementBlock(i.Fragment,{key:5},[n[6]||(n[6]=i.createElementVNode("span",null,"Доставка",-1)),i.createVNode(Ts,{delivery:t.order.delivery,class:"col-span-2"},null,8,["delivery"])],64)):i.createCommentVNode("",!0),t.order.comment?(i.openBlock(),i.createElementBlock(i.Fragment,{key:6},[n[7]||(n[7]=i.createElementVNode("span",null,"Комментарий",-1)),i.createElementVNode("span",lk,i.toDisplayString(t.order.comment),1)],64)):i.createCommentVNode("",!0),t.order.attachedUser?(i.openBlock(),i.createElementBlock(i.Fragment,{key:7},[n[8]||(n[8]=i.createElementVNode("span",null,"Закреплен за",-1)),i.createVNode(ma,{user:t.order.attachedUser,class:"col-span-2"},null,8,["user"])],64)):i.createCommentVNode("",!0),t.order.invoices&&t.order.invoices.length>0?(i.openBlock(),i.createElementBlock(i.Fragment,{key:8},[n[9]||(n[9]=i.createElementVNode("span",null,"Прикрепленные счета",-1)),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.order.invoices,(r,s)=>(i.openBlock(),i.createElementBlock("div",{key:s,class:"col-span-2"},[i.createElementVNode("a",ck," Скачать счет №"+i.toDisplayString(s+1),1)]))),128))],64)):i.createCommentVNode("",!0)])]))}}),hk={key:0},uk={class:"text-sc-dark-grey my-2 text-center"},fk={key:1,class:"text-sc-dark-grey my-2 text-center"},gk={key:2},mk={class:"text-sc-dark-grey mt-4 text-right font-bold"},pk={class:"text-sc-primary"},yk={},Su=i.defineComponent({...yk,__name:"order-info",props:{order:{}},setup(t){const e=t,n=i.ref(!1),r=i.ref(new G.Order(e.order)),s=()=>{n.value=!0,G.HttpRequester.getInstance(G.OrdersDataProvider).getOrder(e.order.id).then(a=>{r.value=a}).finally(()=>{n.value=!1})},o=i.computed(()=>(r.value.products??[]).reduce((a,l)=>a+l.costRub,0).toLocaleString("ru-ru",{minimumFractionDigits:2}));return i.onMounted(()=>{s()}),(a,l)=>{const c=z.NSpin;return n.value?(i.openBlock(),i.createElementBlock("div",hk,[i.createElementVNode("div",uk,[i.createVNode(c,{size:"small",class:"mb-2.5 align-middle"}),l[0]||(l[0]=i.createElementVNode("div",null,[i.createElementVNode("span",null,"Загрузка данных ...")],-1))])])):r.value.products.length===0?(i.openBlock(),i.createElementBlock("div",fk," --- Не удалось загрузить данные о заказе --- ")):(i.openBlock(),i.createElementBlock("div",gk,[i.createVNode(ku,{order:r.value},null,8,["order"]),i.createElementVNode("div",mk,[l[1]||(l[1]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",pk,i.toDisplayString(o.value)+" ₽",1)]),i.createVNode(Cu,{order:r.value},null,8,["order"])]))}}}),bk={},_k=i.defineComponent({...bk,__name:"orders-list",props:{fields:{},orderUrl:{},filters:{},sort:{},pagination:{}},setup(t){const e=t,n=()=>structuredClone(i.toRaw(e.sort??{field:"id",direction:"desc"})),r=i.ref(n()),s=i.ref([]),o=i.ref(!1),a=i.computed(()=>G.useReferencesStore().orderStatusReference),l=()=>{const p=e.fields.length>0?e.fields:[Ke.CreatedAt,Ke.Id,Ke.DeliveryInfo,Ke.Status,Ke.SalesDirections,Ke.AttachedUser],y={title:"???",key:"undefined",render:()=>i.h("span",{},["--- unknown ---"])},b={type:"expand",expandable:O.constant(!0),renderExpand:C=>i.h(Su,{order:C,class:"pl-10 pt-3 pb-10"}),width:"30"},_=[{title:"Дата заказа",key:Ke.CreatedAt,resizable:!0,minWidth:100,render:C=>i.h(Po,{date:C.createdAt,isTimeSecondary:!0,isTimeOnSecondLine:!0,class:"text-base"})},{title:"Номер заказа",key:Ke.Id,resizable:!0,minWidth:70,render:C=>i.h("a",{href:e.orderUrl.replace(":id",C.id.toString()),target:"_blank",class:"text-base"},C.id)},{title:"Клиент",key:Ke.ClientInfo,resizable:!0,render:C=>i.h(os,{client:C.client})},{title:"Тип доставки",key:Ke.DeliveryInfo,resizable:!0,render:C=>i.h(Ts,{delivery:C.delivery})},{title:"Статус",key:Ke.Status,resizable:!0,minWidth:90,render:C=>{var S,v;return i.h("span",{class:"text-base"},[((v=(S=a.value)==null?void 0:S.find(B=>B.id===(C.status??-1)))==null?void 0:v.name)??""])}},{title:"Напр. продаж",key:Ke.SalesDirections,resizable:!0,minWidth:70,render:C=>i.h("span",{class:"text-base"},[C.salesDirection.name])},{title:"Закреплено за",key:Ke.AttachedUser,resizable:!0,render:C=>{var S;return i.h("span",{class:"text-base"},[(S=C==null?void 0:C.attachedUser)==null?void 0:S.name])}}];switch(bt.getDeviceTypeByResolution()){case Ue.phone:case Ue.tablet:return[b,{key:"order",title:"Заказ",resizable:!0,render:C=>i.h(wu,{order:C,fields:p,orderUrl:e.orderUrl})}];case Ue.laptop:return[b,...p.map(C=>_.find(S=>S.key===C)??y)];default:return[y]}},c=i.ref(l()),d=i.ref(new G.DataTablePagination(e.pagination??{page:1,pageSize:10,itemCount:0,pageCount:1,pageSlot:5,pageSizes:[10,15,25],showSizePicker:!1})),h=()=>{e.filters&&(o.value=!0,G.HttpRequester.getInstance(G.OrdersDataProvider).getOrders(e.filters,r.value,{page:d.value.page,pageSize:d.value.pageSize}).then(p=>{d.value.itemCount!==p.meta.total&&(d.value.itemCount=p.meta.total),d.value.page!==p.meta.currentPage&&(d.value.page=p.meta.currentPage),d.value.pageCount!==p.meta.lastPage&&(d.value.pageCount=p.meta.lastPage),d.value.pageSize!==p.meta.perPage&&(d.value.pageSize=p.meta.perPage),s.value=p.data}).finally(()=>{o.value=!1}))},u=p=>{d.value.page=p,h()},m=p=>{d.value.pageSize=p,h()},g=p=>{O.isNull(p)?r.value=n():(r.value.field=p.columnKey.toString(),r.value.direction=p.order==="ascend"?"asc":"desc"),c.value.forEach(y=>{if(Object.hasOwn(y,"sortOrder")){const b=y;b.sortOrder=b.key===(p==null?void 0:p.columnKey)&&(p!=null&&p.sorter)&&p.order!==!1?p.order:!1}}),h()},f=()=>{c.value=l()};return i.watch(()=>e.filters,()=>{h()}),i.watch(()=>e.sort,()=>{r.value=n(),h()}),i.onMounted(()=>{f(),window.addEventListener("resize",f),i.nextTick(()=>{h()})}),i.onUnmounted(()=>{window.removeEventListener("resize",f)}),(p,y)=>{const b=z.NDataTable;return i.openBlock(),i.createBlock(b,{columns:c.value,data:s.value,"row-key":_=>_.id,pagination:d.value,loading:o.value,remote:!0,bordered:!1,"bottom-bordered":!1,"sticky-expanded-rows":!0,"pagination-behavior-on-filter":"first","onUpdate:page":u,"onUpdate:pageSize":m,"onUpdate:sorter":g},null,8,["columns","data","row-key","pagination","loading"])}}}),wk=Zn(_k,[["__scopeId","data-v-7c4554f4"]]),xk=["href"],vk={class:"text-sc-dark-grey"},kk={},Ck=i.defineComponent({...kk,__name:"short-text-order-info",props:{order:{},orderLink:{}},emits:["click:order-id"],setup(t,{emit:e}){const n=t,r=e,s=i.computed(()=>Mn.format(n.order.createdAt,G.AppConfigProvider.getConfig().dateFormats.uiDateWithTime)),o=a=>{O.isNil(n.orderLink)&&(a.preventDefault(),a.stopPropagation()),r("click:order-id",n.order,a)};return(a,l)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("span",null,[l[1]||(l[1]=i.createTextVNode(" #",-1)),i.createElementVNode("a",{href:t.orderLink??"#",onClick:l[0]||(l[0]=c=>o(c))},i.toDisplayString(t.order.id),9,xk),i.createTextVNode(" от "+i.toDisplayString(s.value),1),t.order.isApproved1c?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" (подтверждён)")],64)):i.createCommentVNode("",!0)]),l[2]||(l[2]=i.createTextVNode(", ",-1)),i.createElementVNode("span",vk,"автор: "+i.toDisplayString(t.order.creator.name)+" ["+i.toDisplayString(t.order.creator.type)+"]",1)],64))}}),Sk={class:"sc-page flex flex-col"},Bk={class:"my-2 flex flex-row items-end"},Tk={class:"sc-title grow"},Rk={key:0,class:"sc-title-buttons flex-1 grow-0"},$k={class:"flex flex-col justify-end gap-1 sm:mt-0 sm:flex-row"},Ek={key:0,class:"sc-title-extra mt-2 sm:mt-4"},Nk={},Bu=i.defineComponent({...Nk,__name:"page",props:{title:{}},setup(t){return(e,n)=>{const r=z.NH1;return i.openBlock(),i.createElementBlock("div",Sk,[i.createElementVNode("div",Bk,[i.createElementVNode("div",Tk,[i.renderSlot(e.$slots,"title",{},()=>[i.createVNode(r,{class:"m-0 leading-none lg:mb-3 lg:leading-normal"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.title??""),1)]),_:1})])]),e.$slots["title-buttons"]?(i.openBlock(),i.createElementBlock("div",Rk,[i.createElementVNode("div",$k,[i.renderSlot(e.$slots,"title-buttons")])])):i.createCommentVNode("",!0)]),e.$slots["title-extra"]?(i.openBlock(),i.createElementBlock("div",Ek,[i.renderSlot(e.$slots,"title-extra")])):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default")])}}}),Pk={class:"overflow-hidden transition-all duration-300"},Fk={class:"text-lg font-medium leading-none"},Mk={},Tu=i.defineComponent({...Mk,__name:"sliding-content-with-drawer",props:{drawerWidth:{type:[Number,Function],default:void 0},showDrawer:{type:Boolean,default:!1},title:{default:""}},emits:["update:show-drawer"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(0),o=i.ref(n.showDrawer),a=()=>{switch(bt.getDeviceTypeByResolution()){case Ue.phone:return window.innerWidth*.66;case Ue.tablet:return window.innerWidth*.5;default:return window.innerWidth*.33}},l=()=>{o.value?O.isUndefined(n.drawerWidth)?s.value=a():s.value=O.isFunction(n.drawerWidth)?n.drawerWidth():n.drawerWidth:s.value=0};return i.watch(()=>n.drawerWidth,()=>{l()}),i.watch(()=>o.value,()=>{l(),r("update:show-drawer",o.value)}),i.watch(()=>n.showDrawer,c=>{o.value=c}),i.onUnmounted(()=>{window.removeEventListener("resize",l)}),l(),window.addEventListener("resize",l),(c,d)=>{const h=z.NDrawerContent,u=z.NDrawer;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",Pk,[i.createElementVNode("div",{style:i.normalizeStyle(`margin-left: ${s.value}px;`),class:"w-full"},[i.renderSlot(c.$slots,"default")],4)]),i.createVNode(u,{show:o.value,"onUpdate:show":d[0]||(d[0]=m=>o.value=m),resizable:!0,width:s.value,placement:"left"},{default:i.withCtx(()=>[i.createVNode(h,{closable:""},{header:i.withCtx(()=>[i.renderSlot(c.$slots,"drawer-header",{},()=>[i.createElementVNode("div",Fk,i.toDisplayString(t.title),1)])]),default:i.withCtx(()=>[i.renderSlot(c.$slots,"drawer-content")]),footer:i.withCtx(()=>[i.renderSlot(c.$slots,"drawer-footer")]),_:3})]),_:3},8,["show","width"])],64)}}}),Ak={key:0,ref:"panel-component-ref",class:"sc-page-panel flex flex-row gap-2.5 sm:gap-8"},Vk={key:0},Ok={class:"sc-page-preview-panel grow"},Ik={key:1,class:"sc-page-preview-panel-extra flex-none"},zk={},Lk=i.defineComponent({...zk,__name:"page-with-sliding-panel",props:{title:{},isShowPanelButtonVisible:{type:Boolean,default:!0},showPanelButtonText:{default:""},panelTitle:{default:""}},setup(t,{expose:e}){const n=i.ref(!1),r=()=>{n.value=!0},s=()=>{n.value=!1},o=i.useTemplateRef("panel-component-ref");return e({scrollToTopOfPanel:l=>{var c;(c=o.value)==null||c.scrollIntoView({behavior:"smooth"}),l&&i.nextTick(()=>{var d,h;window.scrollTo({top:(((h=(d=o.value)==null?void 0:d.getBoundingClientRect())==null?void 0:h.top)??0)+window.pageYOffset+l,behavior:"smooth"})})},showPanel:r,closePanel:s}),(l,c)=>{const d=z.NButton;return i.openBlock(),i.createBlock(Bu,{title:t.title},i.createSlots({default:i.withCtx(()=>[l.$slots["preview-panel"]||l.$slots["preview-panel-extra"]||t.isShowPanelButtonVisible?(i.openBlock(),i.createElementBlock("div",Ak,[t.isShowPanelButtonVisible?(i.openBlock(),i.createElementBlock("div",Vk,[i.renderSlot(l.$slots,"show-panel-button",{onClickHandler:()=>{n.value=!0}},()=>[i.createVNode(d,{class:"flex-none sm:px-10 sm:py-4",onClick:c[0]||(c[0]=h=>n.value=!0)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.showPanelButtonText),1)]),_:1})])])):i.createCommentVNode("",!0),i.createElementVNode("div",Ok,[i.renderSlot(l.$slots,"preview-panel")]),l.$slots["preview-panel-extra"]?(i.openBlock(),i.createElementBlock("div",Ik,[i.renderSlot(l.$slots,"preview-panel-extra")])):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),i.createVNode(Tu,{"show-drawer":n.value,"onUpdate:showDrawer":c[1]||(c[1]=h=>n.value=h),title:t.panelTitle},i.createSlots({"drawer-content":i.withCtx(()=>[i.renderSlot(l.$slots,"panel-content")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"default")]),_:2},[l.$slots["panel-header"]?{name:"drawer-header",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"panel-header")]),key:"0"}:void 0,l.$slots["panel-bottom"]?{name:"drawer-footer",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"panel-bottom")]),key:"1"}:void 0]),1032,["show-drawer","title"])]),_:2},[l.$slots.title?{name:"title",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"title")]),key:"0"}:void 0,l.$slots["title-buttons"]?{name:"title-buttons",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"title-buttons")]),key:"1"}:void 0,l.$slots["title-extra"]?{name:"title-extra",fn:i.withCtx(()=>[i.renderSlot(l.$slots,"title-extra")]),key:"2"}:void 0]),1032,["title"])}}}),Dk={},Hk=i.defineComponent({...Dk,__name:"manager-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!0},managerReferenceList:{default:()=>[]},disabledManagerReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},showEmptyValue:{type:Boolean,default:!1},groupBySalesDirection:{type:Boolean,default:!1}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.computed(()=>O.isArray(r.value)),a=i.computed(()=>{var g;return O.isArray(r.value)?r.value.map(f=>f.id):((g=r.value)==null?void 0:g.id)??null}),l=i.computed(()=>{var p;let g=r.showEmptyValue?[G.ManagerDataFactory.generateUndefinedManagerInstance(),...r.managerReferenceList]:r.managerReferenceList,f=r.disabledManagerReferenceList.map(y=>y.id);if(r.showActualOnly){const y=O.isArray(r.value)?r.value.map(b=>b.id):[(p=r.value)==null?void 0:p.id];f=O.union(f,r.managerReferenceList.filter(b=>!b.isActive).map(b=>b.id)),g=r.managerReferenceList.filter(b=>b.isActive||y.includes(b.id))}return zt.convertReferencesToSelectOptionsList(g,!0,r.groupBySalesDirection?{key:"item.salesDirection.id",label:"item.salesDirection.name"}:!1,!1,y=>{const b=!r.groupBySalesDirection||r.groupBySalesDirection&&O.some(o.value?r.value:[r.value],["id",y.id])?` (${y.salesDirection.name}) `:"";return y.salesDirection.isNewRec()?y.name:`${y.name}${b}${y.isActive?"":" [Не активен]"}`},y=>f.includes(y.id)&&y.isActive)}),c=i.computed(()=>l.value.map(g=>({...g,class:r.wrapContent?`${g.class} consistent-menu-width`:g.class}))),d=i.useTemplateRef("select-component"),h=g=>{if(O.isArray(g)){const f=g.length>0?g.filter(p=>!O.some(r.disabledManagerReferenceList,["id",p])).map(p=>r.managerReferenceList.find(y=>y.id===p)).filter(p=>!O.isNil(p)):[];s("update:value",f)}else{const f=g>0&&!O.some(r.disabledManagerReferenceList,["id",g])?r.managerReferenceList.find(p=>p.id===g):new G.Manager;s("update:value",f??new G.Manager)}};return i.watch(()=>r.value,()=>{var g,f;(f=(g=d.value)==null?void 0:g.$forceUpdate)==null||f.call(g)},{deep:!0}),i.watch(()=>r.disabledManagerReferenceList,g=>{if(g.length>0&&r.value)if(o.value){const f=r.value;O.some(f,p=>O.some(g,["id",p.id]))&&s("update:value",f.filter(p=>!O.some(g,["id",p.id])))}else{const f=r.value;O.some(g,["id",f.id])&&s("update:value",new G.Manager)}}),e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focusInput()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blurInput()}}),(g,f)=>(i.openBlock(),i.createBlock(i.unref(z.NSelect),{ref:"select-component",value:a.value,clearable:t.clearable,disabled:l.value.length===0,"consistent-menu-width":t.consistentMenuWidth,multiple:o.value,options:c.value,placeholder:"","onUpdate:value":h},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),Wk={class:"m-0.5 flex flex-col p-0.5"},jk={class:"flex flex-row gap-1"},qk={key:0},Xk={key:1},Yk={key:2},Uk={key:3},Gk={class:"flex flex-row gap-1"},Kk={key:0},Zk={key:1},Qk={key:2},Jk={key:3},e2={},Ru=i.defineComponent({...e2,__name:"address-suggestion-label",props:{addr:{},selected:{type:Boolean}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",Wk,[i.createElementVNode("span",jk,[t.addr.postIndex?(i.openBlock(),i.createElementBlock("span",qk,i.toDisplayString(t.addr.postIndex)+", ",1)):i.createCommentVNode("",!0),t.addr.city?(i.openBlock(),i.createElementBlock("span",Xk,i.toDisplayString(t.addr.city)+", ",1)):i.createCommentVNode("",!0),t.addr.locality?(i.openBlock(),i.createElementBlock("span",Yk,i.toDisplayString(t.addr.locality)+", ",1)):i.createCommentVNode("",!0),t.addr.region?(i.openBlock(),i.createElementBlock("span",Uk,i.toDisplayString(t.addr.region)+", ",1)):i.createCommentVNode("",!0)]),i.createElementVNode("span",Gk,[t.addr.street?(i.openBlock(),i.createElementBlock("span",Kk,i.toDisplayString(t.addr.street)+", ",1)):i.createCommentVNode("",!0),t.addr.building?(i.openBlock(),i.createElementBlock("span",Zk,i.toDisplayString(t.addr.building)+", ",1)):i.createCommentVNode("",!0),t.addr.buildingPart?(i.openBlock(),i.createElementBlock("span",Qk,i.toDisplayString(t.addr.buildingPart)+", ",1)):i.createCommentVNode("",!0),t.addr.apartments?(i.openBlock(),i.createElementBlock("span",Jk,i.toDisplayString(t.addr.apartments)+", ",1)):i.createCommentVNode("",!0)])]))}}),pa={clearable:!1,value:"",field:void 0,disabled:!1},t2={},n2=i.defineComponent({...t2,__name:"address-suggestion",props:i.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},searchDataHandler:{type:Function}},{...pa,minTermLength:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minLength.searchTerm)??3},searchDataHandler:void 0}),emits:["select","update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.value),a=i.ref(!1),l=i.ref([]),c=i.computed(()=>l.value.map(p=>({label:p[r.field??"addressString"]??"-",value:p.id})));i.watch(()=>r.value,p=>{o.value=p}),i.watch(o,()=>{s("update:value",o.value)});const d=O.debounce(()=>h(),800),h=async()=>{!o.value||o.value.length<r.minTermLength||(a.value=!0,l.value=await(r.searchDataHandler?r.searchDataHandler(o.value,a):G.HttpRequester.getInstance(G.DataSuggestionProvider).searchAddresses(o.value)).finally(()=>{a.value=!1}))},u=(p,y)=>{const b=l.value.find(_=>_.id===p.value)||{};return i.h(Ru,{addr:b,selected:y},{default:O.constant("-")})},m=p=>{d.cancel();const y=l.value.find(b=>b.id===p)||{};s("select",y)},g=i.ref(null);function f(){g.value.focus()}return e({focus:f}),(p,y)=>{const b=z.NAutoComplete;return i.openBlock(),i.createBlock(b,{ref_key:"autoCompleteElement",ref:g,value:o.value,"onUpdate:value":[y[0]||(y[0]=_=>o.value=_),i.unref(d)],clearable:t.clearable,disabled:t.disabled,loading:a.value,options:c.value,"render-label":u,placeholder:"",onSelect:m},null,8,["value","clearable","disabled","loading","options","onUpdate:value"])}}}),i2={class:"m-0.5 flex flex-col p-0.5"},r2={class:"font-medium"},s2={class:"flex flex-row gap-1 text-xs font-light text-blue-800"},o2={key:0},a2={key:1},l2={},$u=i.defineComponent({...l2,__name:"bank-suggestion-label",props:{bank:{},selected:{type:Boolean}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",i2,[i.createElementVNode("span",r2,i.toDisplayString(t.bank.name),1),i.createElementVNode("span",s2,[t.bank.bic?(i.openBlock(),i.createElementBlock("span",o2," БИК: "+i.toDisplayString(t.bank.bic),1)):i.createCommentVNode("",!0),t.bank.inn?(i.openBlock(),i.createElementBlock("span",a2," ИНН: "+i.toDisplayString(t.bank.inn),1)):i.createCommentVNode("",!0)])]))}}),c2={},d2=i.defineComponent({...c2,__name:"bank-suggestion",props:i.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{}},{...pa,minTermLength:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minLength.searchTerm)??3}}),emits:["select","update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.value),a=i.ref(!1),l=i.ref([]),c=i.computed(()=>l.value.map(p=>({label:p[r.field??"_"]??"-",value:p.id})));i.watch(()=>r.value,p=>{o.value=p}),i.watch(o,()=>{s("update:value",o.value)});const d=O.debounce(()=>h(),800),h=async()=>{if(!(!o.value||o.value.length<r.minTermLength)){a.value=!0;try{l.value=await G.HttpRequester.getInstance(G.DataSuggestionProvider).searchBank(o.value)}finally{a.value=!1}}},u=(p,y)=>{const b=l.value.find(_=>_.id===p.value)||{};return i.h($u,{bank:b,selected:y},{default:O.constant("-")})},m=p=>{d.cancel();const y=l.value.find(b=>b.id===p)||{};s("select",y)},g=i.ref(null);function f(){g.value.focus()}return e({focus:f}),(p,y)=>{const b=z.NAutoComplete;return i.openBlock(),i.createBlock(b,{ref_key:"autoCompleteElement",ref:g,value:o.value,"onUpdate:value":[y[0]||(y[0]=_=>o.value=_),i.unref(d)],clearable:t.clearable,disabled:t.disabled,loading:a.value,options:c.value,"render-label":u,placeholder:"",onSelect:m},null,8,["value","clearable","disabled","loading","options","onUpdate:value"])}}}),h2={class:"font-medium"},u2={key:0,class:"flex flex-row gap-2"},f2={key:0,class:"text-xs font-light text-blue-800"},g2={key:1,class:"text-sc-dark-grey text-xs font-light"},m2={},Eu=i.defineComponent({...m2,__name:"org-suggestion-label",props:{org:{},selected:{type:Boolean}},setup(t){const e=t,n=i.computed(()=>{var s,o;return((o=(s=e.org.rawData)==null?void 0:s.state)==null?void 0:o.liquidationDate)??!1}),r=i.computed(()=>{var s,o;return((o=(s=e.org.rawData)==null?void 0:s.address)==null?void 0:o.value)??""});return(s,o)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(`m-0.5 flex flex-col p-0.5 ${n.value?"line-through":""}`)},[i.createElementVNode("span",h2,i.toDisplayString(t.org.name),1),t.org.inn||r.value?(i.openBlock(),i.createElementBlock("div",u2,[t.org.inn?(i.openBlock(),i.createElementBlock("span",f2,i.toDisplayString(t.org.inn),1)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("span",g2,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],2))}}),p2={},y2=i.defineComponent({...p2,__name:"org-suggestion",props:i.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},allowSelectTerminated:{type:Boolean}},{...pa,minTermLength:()=>{var t;return((t=G.AppConfigProvider.getConfig())==null?void 0:t.minLength.searchTerm)??3}}),emits:["select","update:value"],setup(t,{expose:e,emit:n}){const r=t,s=n,o=i.ref(r.value),a=i.ref(!1),l=i.ref([]),c=y=>{var b,_;return!!(((_=(b=y.rawData)==null?void 0:b.state)==null?void 0:_.liquidationDate)??!1)},d=i.computed(()=>zt.convertReferencesToSelectOptionsList(l.value,!1,!1,!1,y=>y[r.field??"_"]??"-",y=>!r.allowSelectTerminated&&c(y)));i.watch(()=>r.value,y=>{o.value=y}),i.watch(o,()=>{s("update:value",o.value)});const h=O.debounce(()=>u(),800),u=async()=>{if(!(!o.value||o.value.length<r.minTermLength)){a.value=!0;try{l.value=await G.HttpRequester.getInstance(G.DataSuggestionProvider).searchOrganization(o.value)}finally{a.value=!1}}},m=(y,b)=>{const _=l.value.find(C=>C.id===y.value)||{};return i.h(Eu,{org:_,selected:b},{default:O.constant("-")})},g=y=>{h.cancel();const b=l.value.find(_=>_.id===y)||{};(r.allowSelectTerminated||!c(b))&&s("select",b)},f=i.ref(null);function p(){f.value.focus()}return e({focus:p}),(y,b)=>{const _=z.NAutoComplete;return i.openBlock(),i.createBlock(_,{ref_key:"autoCompleteElement",ref:f,value:o.value,"onUpdate:value":[b[0]||(b[0]=C=>o.value=C),i.unref(h)],clearable:t.clearable,disabled:t.disabled,loading:a.value,options:d.value,"render-label":m,placeholder:"",onSelect:g},null,8,["value","clearable","disabled","loading","options","onUpdate:value"])}}}),b2={},_2=i.defineComponent({...b2,__name:"button-with-confirm-action",props:{disabled:{type:Boolean,default:!1},dialogTitle:{default:""},dialogContent:{default:""},disableConfirm:{type:Boolean,default:!1},popoverText:{default:""},type:{default:"default"},size:{default:"small"},quaternary:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["accept"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(!1),o=()=>{r("accept",()=>{s.value=!1})},a=()=>{n.disableConfirm?o():s.value=!0};return(l,c)=>{const d=z.NButton,h=z.NPopover,u=z.NModal;return i.openBlock(),i.createElementBlock("div",null,[i.createVNode(h,{disabled:t.popoverText.length===0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(d,{disabled:t.disabled,ghost:t.ghost,loading:t.loading,size:t.size,type:t.type,quaternary:t.quaternary,circle:t.circle,onClick:a},{default:i.withCtx(()=>[i.renderSlot(l.$slots,"default")]),_:3},8,["disabled","ghost","loading","size","type","quaternary","circle"])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.popoverText),1)]),_:3},8,["disabled"]),i.createVNode(u,{show:s.value,"onUpdate:show":c[1]||(c[1]=m=>s.value=m),content:t.dialogContent,closable:!1,"mask-closable":!1,"show-icon":!1,title:t.dialogTitle,"action-class":"",preset:"dialog"},{action:i.withCtx(()=>[i.createVNode(d,{type:"primary",class:"px-8",onClick:o},{default:i.withCtx(()=>[...c[2]||(c[2]=[i.createTextVNode(" Да ",-1)])]),_:1}),i.createVNode(d,{type:"default",onClick:c[0]||(c[0]=m=>s.value=!1)},{default:i.withCtx(()=>[...c[3]||(c[3]=[i.createTextVNode(" Отмена ",-1)])]),_:1})]),_:1},8,["show","content","title"])])}}}),w2={key:0,class:"whitespace-pre-line"},x2={key:1,class:"text-sc-dark-grey"},v2={},k2=i.defineComponent({...v2,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(t,{emit:e}){const n=t,r=e,s=i.ref(n.comment);i.watch(()=>s.value,l=>{s.value=l});const o=l=>{r("update:comment",s.value,l)},a=()=>{s.value=n.comment};return(l,c)=>{const d=z.NInput;return i.openBlock(),i.createBlock(Ed,{disabled:t.disabled,"onEditor:apply":o,"onEditor:cancel":a},{viewer:i.withCtx(()=>[i.createElementVNode("div",null,[t.comment?(i.openBlock(),i.createElementBlock("span",w2,i.toDisplayString(t.comment),1)):(i.openBlock(),i.createElementBlock("span",x2," - Комментарий отсутствует - "))])]),editor:i.withCtx(()=>[i.createVNode(d,{value:s.value,"onUpdate:value":c[0]||(c[0]=h=>s.value=h),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),C2={key:0,class:"text-sm"},S2={key:1},B2={},T2=i.defineComponent({...B2,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,s)=>(i.openBlock(),i.createElementBlock("span",null,[t.wrapAsSmall&&t.debt!==0?(i.openBlock(),i.createElementBlock("span",C2,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),i.createElementVNode("span",{class:i.normalizeClass({"text-green-700":t.debt>0,"text-red-700":t.debt<0})},i.toDisplayString(t.debt)+" ₽ ",3)])):i.createCommentVNode("",!0),!t.wrapAsSmall&&t.debt!==0?(i.openBlock(),i.createElementBlock("span",S2,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),i.createElementVNode("span",{class:i.normalizeClass({"text-green-700":t.debt>0,"text-red-700":t.debt<0})},i.toDisplayString(t.debt)+" ₽ ",3)])):i.createCommentVNode("",!0)]))}}),R2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $2(t,e){return i.openBlock(),i.createElementBlock("svg",R2,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const E2=i.markRaw({name:"ion-warning",render:$2}),N2={},P2=i.defineComponent({...N2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(t){return(e,n)=>{const r=E2,s=z.NPopover;return i.openBlock(),i.createBlock(s,{disabled:t.popoverText.length===0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(r,{class:i.normalizeClass(`ml-0.5 ${t.iconClass}`)},null,8,["class"])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.popoverText),1)]),_:1},8,["disabled"])}}}),mt=class mt{static init(e,n){mt.messagesService&&mt.notificationsService||(mt.messagesService=e,mt.notificationsService=n)}static getMessagesService(){if(!mt.messagesService)throw new Error("UI provider is not initialized.");return mt.messagesService}static getNotificationsService(){if(!mt.notificationsService)throw new Error("UI provider is not initialized.");return mt.notificationsService}static showNotificationsForErrorResponseData(e,n={}){var r,s;if(O.isEmpty(e.errors)){const o=(s=(r=e.rawError)==null?void 0:r.config)==null?void 0:s.url,a=o?` [ ${o} ]`:"";mt.notificationsService?mt.notificationsService.error({title:"Ошибка выполнения/обработки запроса",content:e.message,meta:`#${e.status}${a}: ${e.statusText}`,duration:3e3}):console.log("Show notification error response data: UI provider is not initialized.",e)}else for(const o in e.errors)Object.prototype.hasOwnProperty.call(n,o)?n[o]=new G.FieldValidationResultData(e.errors[o].toString(),"error"):mt.messagesService?mt.messagesService.error(e.errors[o].toString()):console.log("Show notification error response data: UI provider is not initialized.",e.errors[o])}};x(mt,"messagesService"),x(mt,"notificationsService");let ya=mt;const F2=i.computed(()=>G.useReferencesStore().deliveryTypeReference??[]),M2=i.computed(()=>G.useReferencesStore().managersList??[]),A2=i.computed(()=>G.useReferencesStore().opfReference??[]),V2=i.computed(()=>G.useReferencesStore().partnerGroupsReference??[]),O2=i.computed(()=>G.useReferencesStore().priceCoefficientsReference??[]),I2=i.computed(()=>G.useReferencesStore().productFilesTypesReference??[]),z2=i.computed(()=>G.useReferencesStore().resourceTypesReference),L2=i.computed(()=>G.useReferencesStore().salesDirectionsReference??[]),D2=i.computed(()=>G.useReferencesStore().warehousesReference??[]),H2=i.computed(()=>zt.convertReferencesToSelectOptionsList(G.useReferencesStore().channelPrimaryInterestsReference??[],!0,!1,!0)),W2=i.computed(()=>zt.convertReferencesToSelectOptionsList(G.useReferencesStore().sourcePrimaryInterestsReference??[],!0,!1,!0)),j2=t=>G.HttpRequester.getInstance(G.ReferenceDataProvider).searchCity(t),q2=t=>zt.convertReferencesToSelectOptionsList(t,!0,!1,!1,e=>{var n,r,s;return e!=null&&e.isNewRec()?"-":`${e.name}, ${(n=e==null?void 0:e.region)==null?void 0:n.name}, ${(s=(r=e==null?void 0:e.region)==null?void 0:r.country)==null?void 0:s.name}`},e=>e==null?void 0:e.isNewRec());W.AddProductToCartDialog=iy,W.ConfiguratorSettingsKozyrek=_d,W.ContentHelper=Kn,W.KozyrekLine=ri,W.KozyrekTailTemplate=No,W.KozyrekTemplate=Di,W.OrdersTableFields=Ke,W.Point=$o,W.ScAddressSuggestion=n2,W.ScAddressSuggestionLabel=Ru,W.ScBankSuggestion=d2,W.ScBankSuggestionLabel=$u,W.ScBaseDialog=Cd,W.ScButtonWithConfirmAction=_2,W.ScCategoryCollapse=vd,W.ScClientNameWithShortInfo=os,W.ScCollapse=xd,W.ScCollapseItem=Da,W.ScCommentEditor=k2,W.ScConfiguratorsProductInfo=nr,W.ScContragentWithShortInfo=Sd,W.ScDateRange=gb,W.ScDateTimeLabel=Po,W.ScDebouncedInput=Db,W.ScDebouncedInputNumber=Li,W.ScDebt=T2,W.ScDialogHeader=vb,W.ScDynamicConfigurator=wd,W.ScEmail=_y,W.ScExternalLink=Zb,W.ScImageGallery=qa,W.ScInlineEditableItem=Ed,W.ScInlineView=Fo,W.ScKozyrekConfigurator=cd,W.ScKozyrekConfiguratorParamsForm=Ua,W.ScKozyrekConfiguratorPreview=ld,W.ScKozyrekConfiguratorTemplates=ad,W.ScLightGallery=ja,W.ScManagerSelect=Hk,W.ScMetalForDoorsConfigurator=bd,W.ScMetalForDoorsConfiguratorForm=yd,W.ScMosquitoConfigurator=ud,W.ScMosquitoConfiguratorForm=dd,W.ScMosquitoConfiguratorMeasurementInstructions=hd,W.ScMosquitoConfiguratorPreview=Eo,W.ScOrderCommonInfo=wu,W.ScOrderDeliveryLabel=Ts,W.ScOrderDetails=Cu,W.ScOrderInfo=Su,W.ScOrderItemsList=ku,W.ScOrderPayment=xu,W.ScOrderProductInfo=vu,W.ScOrdersList=wk,W.ScOrgSuggestion=y2,W.ScOrgSuggestionLabel=Eu,W.ScPage=Bu,W.ScPageWithSlidingPanel=Lk,W.ScPersonContactsBlock=cb,W.ScPhone=Wy,W.ScPhoneInput=jb,W.ScProductName=tr,W.ScProductsList=Sv,W.ScReferenceSelect=kd,W.ScSearchableProductSelect=_u,W.ScSearchableReferenceSelect=bu,W.ScSetClientPriceFormItem=K0,W.ScShortTextOrderInfo=Ck,W.ScSingleFileUploadSelector=Tb,W.ScSlidingContentWithDrawer=Tu,W.ScStripConfigurator=pd,W.ScStripConfiguratorForm=gd,W.ScStripConfiguratorLineItem=fd,W.ScStripConfiguratorPreview=md,W.ScUserShortInfo=ma,W.ScWarningIcon=P2,W.SelectOptionHelper=zt,W.UiNotificationProvider=ya,W.WindowResolutionEnum=Ue,W.WindowResolutionProvider=bt,W.channelPrimaryInterestOptionsList=H2,W.componentSizeInjectionKey=$r,W.deliveryTypeReferenceList=F2,W.managersReferenceList=M2,W.naiveUiTheme=kf,W.opfReferenceList=A2,W.partnerGroupReferenceList=V2,W.priceCoefficientsReferenceList=O2,W.productFilesTypesReferenceList=I2,W.renderConfig=Ve,W.resourceReferencesList=z2,W.salesDirectionsReferenceList=L2,W.searchCityReferenceDataHandler=j2,W.searchCityReferenceLabelRenderer=q2,W.sourcePrimaryInterestOptionsList=W2,W.warehousesReferenceList=D2,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|
|
823
823
|
//# sourceMappingURL=sc-vue-ui-lib.umd.cjs.map
|