@archilogic/floor-plan-sdk 3.1.5-v3-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fpe.css +8 -0
- package/fpe.esm.js +254 -0
- package/fpe.js +254 -0
- package/package.json +22 -0
package/fpe.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Archilogic Floor Plan Engine SDK v3.1.5 build 231110-141122-4ae6ce
|
|
3
|
+
|
|
4
|
+
(c) 2023 Archilogic AG
|
|
5
|
+
|
|
6
|
+
License: According to your license agreement with Archilogic AG
|
|
7
|
+
*/
|
|
8
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).FloorPlanEngine=e()}(this,(function(){"use strict";function t(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function e(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?t(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(t,e,i,r,n,o,s){try{var a=t[o](s),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,n)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var s=t.apply(e,r);function a(t){i(s,n,o,a,h,"next",t)}function h(t){i(s,n,o,a,h,"throw",t)}a(void 0)}))}}function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var o={api:{microServicesUrl:"https://microservices.archilogic.com",spaceApiV2Url:"https://api.archilogic.com/v2",storageUrl:"https://storage.3d.io",staticProductCache:"/archilogic/product/json",staticProductThumb:"/archilogic/product/thumb",staticMatLib:"/archilogic/matlib",sdkVersion:"3.1.5",productDataCacheAge:864e5,productContourCacheAge:864e6},computeMergedSpace:!1,computeConnectedSpaces:!1,loadWallRelations:!1,debug:!1,editable:{},editorId:"floor-plan-engine",exposeInstance:!1,hideElements:[],maxHistorySteps:20,panZoom:!0,planRotation:0,preserveViewbox:"center-center",roomStampSize:null,selectElements:!1,selectAllowList:["interior","group","polyfloor"],showFloorPlan:!1,showSpaceDividers:!1,showCeilingLamps:!1,showFloorTextures:!1,snapWallContours:!1,snapSpaces:!0,transformElements:!0,updateFloors:!1,xrayMode:!1,destroyOnDomRemove:!1,ui:{menu:!0,measure:!0,rotatePlan:!1,zoomExtents:!0,scale:!0,coordinates:!1},shortcuts:{measureConfirm:"Enter",measureCancel:"Escape",measureUndo:"Backspace"},spaceLabelMapping:{},theme:{background:{color:"#f3f5f8",showGrid:!1},wallContours:!1,showAssetTextures:!1,elements:{roomStamp:{showArea:!0,showUsage:!0}}},units:{system:"metric",digits:0,roomDimensions:"area"}};function s(t,e,i){this.name="JsonRpcError",this.message=t||"There was a problem. Please check your internet connection and try again.",this.stack=(new Error).stack,this.code=e,this.data=i}function a(t){return h.apply(this,arguments)}function h(){return(h=r((function*(t){if(t.status>=200&&t.status<400)return t;var e=yield t.text();try{var i=yield JSON.parse(e);return"string"==typeof i.error?Promise.reject(i.error):i.error&&void 0!==i.error.code?Promise.reject(new s(i.error.message,i.error.code,i.error.data)):Promise.reject(i)}catch(t){return Promise.reject(e)}}))).apply(this,arguments)}function l(t){return t.json()}function u(t,e,i=!1){var r={"Content-Type":"application/json"};i||(r["x-token"]=o.api.accessToken),o.api.sdkVersion&&(r["x-sdk-version"]=o.api.sdkVersion);var n=o.api.microServicesUrl+t;return fetch(n,{method:"POST",headers:r,credentials:"omit",body:JSON.stringify(e)}).then(a,(t=>{throw t})).then(l,(t=>{throw t})).then((t=>{if(t.ok)return t.result;throw t}),(t=>{throw t})).catch((t=>Promise.reject(t)))}var p={scene:{read:function(t,e){return function(t,e,i){var r=new URL(o.api.spaceApiV2Url+t);i&&Object.keys(i).forEach((t=>r.searchParams.append(t,i[t])));var n={"Content-Type":"application/json"};o.api.sdkVersion&&(n["x-sdk-version"]=o.api.sdkVersion);var{publishableToken:s,authorization:h}=e;if(h)n.Authorization=h;else{if(!s)return Promise.reject("Either authorization or publishableToken must be provided in accessToken.");r.searchParams.append("pubtoken",s)}return fetch(r,{method:"GET",headers:n,body:JSON.stringify(i)}).then(a).then(l)}("/floor/".concat(t,"/scene-structure"),e)}},product:{read:function(t){return function(t){return fetch(t).then(a,(t=>{throw t})).then(l,(t=>{throw t})).catch((t=>Promise.reject(t)))}(o.api.storageUrl+o.api.staticProductCache+"/"+t+".json")}},data3d:{getOutline:function(t){return u("/data3d/get-outline",{data3dKey:t},!0)},getDimensions:function(t){return u("/data3d/get-dimensions",{data3dKey:t},!0)}}},c=e({},p),d={version:"6.4.2.2",use_lines:!0,use_xyz:!1},f=function(t,e){var i;if(void 0===Object.getOwnPropertyNames){for(i in e.prototype)void 0!==t.prototype[i]&&t.prototype[i]!==Object.prototype[i]||(t.prototype[i]=e.prototype[i]);for(i in e)void 0===t[i]&&(t[i]=e[i]);t.$baseCtor=e}else{for(var r=Object.getOwnPropertyNames(e.prototype),n=0;n<r.length;n++)void 0===Object.getOwnPropertyDescriptor(t.prototype,r[n])&&Object.defineProperty(t.prototype,r[n],Object.getOwnPropertyDescriptor(e.prototype,r[n]));for(i in e)void 0===t[i]&&(t[i]=e[i]);t.$baseCtor=e}};d.Path=function(){return[]},d.Path.prototype.push=Array.prototype.push,d.Paths=function(){return[]},d.Paths.prototype.push=Array.prototype.push,d.PolyNode=function(){this.m_Parent=null,this.m_polygon=new d.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},d.PolyNode.prototype.IsHoleNode=function(){for(var t=!0,e=this.m_Parent;null!==e;)t=!t,e=e.m_Parent;return t},d.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},d.PolyNode.prototype.Contour=function(){return this.m_polygon},d.PolyNode.prototype.AddChild=function(t){var e=this.m_Childs.length;this.m_Childs.push(t),t.m_Parent=this,t.m_Index=e},d.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},d.PolyNode.prototype.GetNextSiblingUp=function(){return null===this.m_Parent?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},d.PolyNode.prototype.Childs=function(){return this.m_Childs},d.PolyNode.prototype.Parent=function(){return this.m_Parent},d.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},d.PolyTree=function(){this.m_AllPolys=[],d.PolyNode.call(this)},d.PolyTree.prototype.Clear=function(){for(var t=0,e=this.m_AllPolys.length;t<e;t++)this.m_AllPolys[t]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},d.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},d.PolyTree.prototype.Total=function(){var t=this.m_AllPolys.length;return t>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&t--,t},f(d.PolyTree,d.PolyNode),d.Clear=function(t){t.length=0},d.PI=3.141592653589793,d.PI2=6.283185307179586,d.FPoint=function(){var t=arguments,e=t.length;if(this.X=0,this.Y=0,d.use_xyz)if(this.Z=0,3===e)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(2===e)this.X=t[0],this.Y=t[1],this.Z=0;else if(1===e)if(t[0]instanceof d.FPoint){var i=t[0];this.X=i.X,this.Y=i.Y,this.Z=0}else{void 0===(r=t[0]).Z&&(r.Z=0),this.X=r.X,this.Y=r.Y,this.Z=r.Z}else this.X=0,this.Y=0,this.Z=0;else if(2===e)this.X=t[0],this.Y=t[1];else if(1===e)if(t[0]instanceof d.FPoint){i=t[0];this.X=i.X,this.Y=i.Y}else{var r=t[0];this.X=r.X,this.Y=r.Y}else this.X=0,this.Y=0},d.FPoint.op_Equality=function(t,e){return t.X===e.X&&t.Y===e.Y},d.FPoint.op_Inequality=function(t,e){return t.X!==e.X||t.Y!==e.Y},d.FPoint0=function(){this.X=0,this.Y=0,d.use_xyz&&(this.Z=0)},d.FPoint0.prototype=d.FPoint.prototype,d.FPoint1=function(t){this.X=t.X,this.Y=t.Y,d.use_xyz&&(void 0===t.Z?this.Z=0:this.Z=t.Z)},d.FPoint1.prototype=d.FPoint.prototype,d.FPoint1dp=function(t){this.X=t.X,this.Y=t.Y,d.use_xyz&&(this.Z=0)},d.FPoint1dp.prototype=d.FPoint.prototype,d.FPoint2=function(t,e,i){this.X=t,this.Y=e,d.use_xyz&&(this.Z=void 0===i?0:i)},d.FPoint2.prototype=d.FPoint.prototype,d.FRect=function(){var t=arguments,e=t.length;if(4===e)this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3];else if(1===e){var i=t[0];this.left=i.left,this.top=i.top,this.right=i.right,this.bottom=i.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},d.FRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},d.FRect0.prototype=d.FRect.prototype,d.FRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom},d.FRect1.prototype=d.FRect.prototype,d.FRect4=function(t,e,i,r){this.left=t,this.top=e,this.right=i,this.bottom=r},d.FRect4.prototype=d.FRect.prototype,d.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},d.PolyType={ptSubject:0,ptClip:1},d.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},d.JoinType={jtSquare:0,jtRound:1,jtMiter:2},d.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},d.EdgeSide={esLeft:0,esRight:1},d.Direction={dRightToLeft:0,dLeftToRight:1},d.TEdge=function(){this.Bot=new d.FPoint0,this.Curr=new d.FPoint0,this.Top=new d.FPoint0,this.Delta=new d.FPoint0,this.Dx=0,this.PolyTyp=d.PolyType.ptSubject,this.Side=d.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},d.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new d.FPoint0},d.MyIntersectNodeSort=function(){},d.MyIntersectNodeSort.Compare=function(t,e){var i=e.Pt.Y-t.Pt.Y;return i>0?1:i<0?-1:0},d.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},d.Scanbeam=function(){this.Y=0,this.Next=null},d.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},d.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},d.OutPt=function(){this.Idx=0,this.Pt=new d.FPoint0,this.Next=null,this.Prev=null},d.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new d.FPoint0},d.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},d.ClipperBase.horizontal=-34e37,d.ClipperBase.Skip=-2,d.ClipperBase.Unassigned=-1,d.ClipperBase.tolerance=1e-20,d.ClipperBase.maxValue=Math.sqrt(Number.MAX_VALUE),d.ClipperBase.minValue=Math.sqrt(Number.MIN_VALUE),d.ClipperBase.near_zero=function(t){return t>-d.ClipperBase.tolerance&&t<d.ClipperBase.tolerance},d.ClipperBase.IsHorizontal=function(t){return 0===t.Delta.Y},d.ClipperBase.prototype.PointIsVertex=function(t,e){var i=e;do{if(d.FPoint.op_Equality(i.Pt,t))return!0;i=i.Next}while(i!==e);return!1},d.ClipperBase.prototype.PointOnLineSegment=function(t,e,i){return t.X===e.X&&t.Y===e.Y||t.X===i.X&&t.Y===i.Y||t.X>e.X==t.X<i.X&&t.Y>e.Y==t.Y<i.Y&&(t.X-e.X)*(i.Y-e.Y)==(i.X-e.X)*(t.Y-e.Y)},d.ClipperBase.prototype.PointOnPolygon=function(t,e){for(var i=e;;){if(this.PointOnLineSegment(t,i.Pt,i.Next.Pt))return!0;if((i=i.Next)===e)break}return!1},d.ClipperBase.prototype.SlopesEqual=d.ClipperBase.SlopesEqual=function(){var t,e,i,r,n,o,s=arguments,a=s.length;return 2===a?(t=s[0],e=s[1],t.Delta.Y*e.Delta.X==t.Delta.X*e.Delta.Y):3===a?(i=s[0],r=s[1],n=s[2],(i.Y-r.Y)*(r.X-n.X)-(i.X-r.X)*(r.Y-n.Y)==0):(i=s[0],r=s[1],n=s[2],o=s[3],(i.Y-r.Y)*(n.X-o.X)-(i.X-r.X)*(n.Y-o.Y)==0)},d.ClipperBase.SlopesEqual3=function(t,e){return t.Delta.Y*e.Delta.X==t.Delta.X*e.Delta.Y},d.ClipperBase.SlopesEqual4=function(t,e,i){return(t.Y-e.Y)*(e.X-i.X)-(t.X-e.X)*(e.Y-i.Y)==0},d.ClipperBase.SlopesEqual5=function(t,e,i,r){return(t.Y-e.Y)*(i.X-r.X)-(t.X-e.X)*(i.Y-r.Y)==0},d.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var t=0,e=this.m_edges.length;t<e;++t){for(var i=0,r=this.m_edges[t].length;i<r;++i)this.m_edges[t][i]=null;d.Clear(this.m_edges[t])}d.Clear(this.m_edges),this.m_HasOpenPaths=!1},d.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(var t=this;null!==this.m_MinimaList;){var e=t.m_MinimaList.Next;t.m_MinimaList=null,t.m_MinimaList=e}this.m_CurrentLM=null},d.ClipperBase.prototype.RangeTest=function(t){(t.X>d.ClipperBase.maxValue||t.X<-d.ClipperBase.maxValue||t.Y>d.ClipperBase.maxValue||t.Y<-d.ClipperBase.maxValue||t.X>0&&t.X<d.ClipperBase.minValue||t.Y>0&&t.Y<d.ClipperBase.minValue||t.X<0&&t.X>-d.ClipperBase.minValue||t.Y<0&&t.Y>-d.ClipperBase.minValue)&&d.Error("Coordinate outside allowed range in RangeTest().")},d.ClipperBase.prototype.InitEdge=function(t,e,i,r){t.Next=e,t.Prev=i,t.Curr.X=r.X,t.Curr.Y=r.Y,d.use_xyz&&(t.Curr.Z=r.Z),t.OutIdx=-1},d.ClipperBase.prototype.InitEdge2=function(t,e){t.Curr.Y>=t.Next.Curr.Y?(t.Bot.X=t.Curr.X,t.Bot.Y=t.Curr.Y,d.use_xyz&&(t.Bot.Z=t.Curr.Z),t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y,d.use_xyz&&(t.Top.Z=t.Next.Curr.Z)):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,d.use_xyz&&(t.Top.Z=t.Curr.Z),t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y,d.use_xyz&&(t.Bot.Z=t.Next.Curr.Z)),this.SetDx(t),t.PolyTyp=e},d.ClipperBase.prototype.FindNextLocMin=function(t){for(var e;;){for(;d.FPoint.op_Inequality(t.Bot,t.Prev.Bot)||d.FPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!==d.ClipperBase.horizontal&&t.Prev.Dx!==d.ClipperBase.horizontal)break;for(;t.Prev.Dx===d.ClipperBase.horizontal;)t=t.Prev;for(e=t;t.Dx===d.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!==t.Prev.Bot.Y){e.Prev.Bot.X<t.Bot.X&&(t=e);break}}return t},d.ClipperBase.prototype.ProcessBound=function(t,e){var i,r,n=t;if(n.OutIdx===d.ClipperBase.Skip){if(t=n,e){for(;t.Top.Y===t.Next.Bot.Y;)t=t.Next;for(;t!==n&&t.Dx===d.ClipperBase.horizontal;)t=t.Prev}else{for(;t.Top.Y===t.Prev.Bot.Y;)t=t.Prev;for(;t!==n&&t.Dx===d.ClipperBase.horizontal;)t=t.Next}if(t===n)n=e?t.Next:t.Prev;else{t=e?n.Next:n.Prev;var o=new d.LocalMinima;o.Next=null,o.Y=t.Bot.Y,o.LeftBound=null,o.RightBound=t,t.WindDelta=0,n=this.ProcessBound(t,e),this.InsertLocalMinima(o)}return n}if(t.Dx===d.ClipperBase.horizontal&&((i=e?t.Prev:t.Next).Dx===d.ClipperBase.horizontal?i.Bot.X!==t.Bot.X&&i.Top.X!==t.Bot.X&&this.ReverseHorizontal(t):i.Bot.X!==t.Bot.X&&this.ReverseHorizontal(t)),i=t,e){for(;n.Top.Y===n.Next.Bot.Y&&n.Next.OutIdx!==d.ClipperBase.Skip;)n=n.Next;if(n.Dx===d.ClipperBase.horizontal&&n.Next.OutIdx!==d.ClipperBase.Skip){for(r=n;r.Prev.Dx===d.ClipperBase.horizontal;)r=r.Prev;r.Prev.Top.X>n.Next.Top.X&&(n=r.Prev)}for(;t!==n;)t.NextInLML=t.Next,t.Dx===d.ClipperBase.horizontal&&t!==i&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),t=t.Next;t.Dx===d.ClipperBase.horizontal&&t!==i&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),n=n.Next}else{for(;n.Top.Y===n.Prev.Bot.Y&&n.Prev.OutIdx!==d.ClipperBase.Skip;)n=n.Prev;if(n.Dx===d.ClipperBase.horizontal&&n.Prev.OutIdx!==d.ClipperBase.Skip){for(r=n;r.Next.Dx===d.ClipperBase.horizontal;)r=r.Next;(r.Next.Top.X===n.Prev.Top.X||r.Next.Top.X>n.Prev.Top.X)&&(n=r.Next)}for(;t!==n;)t.NextInLML=t.Prev,t.Dx===d.ClipperBase.horizontal&&t!==i&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),t=t.Prev;t.Dx===d.ClipperBase.horizontal&&t!==i&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),n=n.Prev}return n},d.ClipperBase.prototype.AddPath=function(t,e,i){var r=this;d.use_lines?i||e!==d.PolyType.ptClip||d.Error("AddPath: Open paths must be subject."):i||d.Error("AddPath: Open paths have been disabled.");var n=t.length-1;if(i)for(;n>0&&d.FPoint.op_Equality(t[n],t[0]);)--n;for(;n>0&&d.FPoint.op_Equality(t[n],t[n-1]);)--n;if(i&&n<2||!i&&n<1)return!1;for(var o=new Array,s=0;s<=n;s++)o.push(new d.TEdge);var a=!0;o[1].Curr.X=t[1].X,o[1].Curr.Y=t[1].Y,d.use_xyz&&(o[1].Curr.Z=t[1].Z),this.RangeTest(t[0]),this.RangeTest(t[n]),this.InitEdge(o[0],o[1],o[n],t[0]),this.InitEdge(o[n],o[0],o[n-1],t[n]);for(s=n-1;s>=1;--s)r.RangeTest(t[s]),r.InitEdge(o[s],o[s+1],o[s-1],t[s]);for(var h,l=o[0],u=l,p=l;;)if(u.Curr!==u.Next.Curr||!i&&u.Next===l){if(u.Prev===u.Next)break;if(!i||!d.ClipperBase.SlopesEqual4(u.Prev.Curr,u.Curr,u.Next.Curr)||r.PreserveCollinear&&r.Pt2IsBetweenPt1AndPt3(u.Prev.Curr,u.Curr,u.Next.Curr)){if((u=u.Next)===p||!i&&u.Next===l)break}else u===l&&(l=u.Next),p=u=(u=r.RemoveEdge(u)).Prev}else{if(u===u.Next)break;u===l&&(l=u.Next),p=u=r.RemoveEdge(u)}if(!i&&u===u.Next||i&&u.Prev===u.Next)return!1;i||(this.m_HasOpenPaths=!0,l.Prev.OutIdx=d.ClipperBase.Skip),u=l;do{r.InitEdge2(u,e),u=u.Next,a&&u.Curr.Y!==l.Curr.Y&&(a=!1)}while(u!==l);if(a){if(i)return!1;for(u.Prev.OutIdx=d.ClipperBase.Skip,(f=new d.LocalMinima).Next=null,f.Y=u.Bot.Y,f.LeftBound=null,f.RightBound=u,f.RightBound.Side=d.EdgeSide.esRight,f.RightBound.WindDelta=0;u.Bot.X!==u.Prev.Top.X&&r.ReverseHorizontal(u),u.Next.OutIdx!==d.ClipperBase.Skip;)u.NextInLML=u.Next,u=u.Next;return this.InsertLocalMinima(f),this.m_edges.push(o),!0}this.m_edges.push(o);var c=null;for(d.FPoint.op_Equality(u.Prev.Bot,u.Prev.Top)&&(u=u.Next);(u=r.FindNextLocMin(u))!==c;){var f;null===c&&(c=u),(f=new d.LocalMinima).Next=null,f.Y=u.Bot.Y,u.Dx<u.Prev.Dx?(f.LeftBound=u.Prev,f.RightBound=u,h=!1):(f.LeftBound=u,f.RightBound=u.Prev,h=!0),f.LeftBound.Side=d.EdgeSide.esLeft,f.RightBound.Side=d.EdgeSide.esRight,i?f.LeftBound.Next===f.RightBound?f.LeftBound.WindDelta=-1:f.LeftBound.WindDelta=1:f.LeftBound.WindDelta=0,f.RightBound.WindDelta=-f.LeftBound.WindDelta,(u=r.ProcessBound(f.LeftBound,h)).OutIdx===d.ClipperBase.Skip&&(u=r.ProcessBound(u,h));var v=r.ProcessBound(f.RightBound,!h);v.OutIdx===d.ClipperBase.Skip&&(v=r.ProcessBound(v,!h)),f.LeftBound.OutIdx===d.ClipperBase.Skip?f.LeftBound=null:f.RightBound.OutIdx===d.ClipperBase.Skip&&(f.RightBound=null),r.InsertLocalMinima(f),h||(u=v)}return!0},d.ClipperBase.prototype.AddPaths=function(t,e,i){for(var r=!1,n=0,o=t.length;n<o;++n)this.AddPath(t[n],e,i)&&(r=!0);return r},d.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(t,e,i){return!(d.FPoint.op_Equality(t,i)||d.FPoint.op_Equality(t,e)||d.FPoint.op_Equality(i,e))&&(t.X!==i.X?e.X>t.X==e.X<i.X:e.Y>t.Y==e.Y<i.Y)},d.ClipperBase.prototype.RemoveEdge=function(t){t.Prev.Next=t.Next,t.Next.Prev=t.Prev;var e=t.Next;return t.Prev=null,e},d.ClipperBase.prototype.SetDx=function(t){t.Delta.X=t.Top.X-t.Bot.X,t.Delta.Y=t.Top.Y-t.Bot.Y,0===t.Delta.Y?t.Dx=d.ClipperBase.horizontal:t.Dx=t.Delta.X/t.Delta.Y},d.ClipperBase.prototype.InsertLocalMinima=function(t){if(null===this.m_MinimaList)this.m_MinimaList=t;else if(t.Y>=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var e=this.m_MinimaList;null!==e.Next&&t.Y<e.Next.Y;)e=e.Next;t.Next=e.Next,e.Next=t}},d.ClipperBase.prototype.PopLocalMinima=function(t,e){return e.v=this.m_CurrentLM,null!==this.m_CurrentLM&&this.m_CurrentLM.Y===t&&(this.m_CurrentLM=this.m_CurrentLM.Next,!0)},d.ClipperBase.prototype.ReverseHorizontal=function(t){var e=t.Top.X;t.Top.X=t.Bot.X,t.Bot.X=e,d.use_xyz&&(e=t.Top.Z,t.Top.Z=t.Bot.Z,t.Bot.Z=e)},d.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,null!==this.m_CurrentLM){this.m_Scanbeam=null;for(var t=this.m_MinimaList;null!==t;){this.InsertScanbeam(t.Y);var e=t.LeftBound;null!==e&&(e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,d.use_xyz&&(e.Curr.Z=e.Bot.Z),e.OutIdx=d.ClipperBase.Unassigned),null!==(e=t.RightBound)&&(e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,d.use_xyz&&(e.Curr.Z=e.Bot.Z),e.OutIdx=d.ClipperBase.Unassigned),t=t.Next}this.m_ActiveEdges=null}},d.ClipperBase.prototype.InsertScanbeam=function(t){if(null===this.m_Scanbeam)this.m_Scanbeam=new d.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=t;else if(t>this.m_Scanbeam.Y){var e=new d.Scanbeam;e.Y=t,e.Next=this.m_Scanbeam,this.m_Scanbeam=e}else{for(var i=this.m_Scanbeam;null!==i.Next&&t<=i.Next.Y;)i=i.Next;if(t===i.Y)return;var r=new d.Scanbeam;r.Y=t,r.Next=i.Next,i.Next=r}},d.ClipperBase.prototype.PopScanbeam=function(t){return null===this.m_Scanbeam?(t.v=0,!1):(t.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},d.ClipperBase.prototype.LocalMinimaPending=function(){return null!==this.m_CurrentLM},d.ClipperBase.prototype.CreateOutRec=function(){var t=new d.OutRec;return t.Idx=d.ClipperBase.Unassigned,t.IsHole=!1,t.IsOpen=!1,t.FirstLeft=null,t.Pts=null,t.BottomPt=null,t.PolyNode=null,this.m_PolyOuts.push(t),t.Idx=this.m_PolyOuts.length-1,t},d.ClipperBase.prototype.DisposeOutRec=function(t){var e=this.m_PolyOuts[t];e.Pts=null,e=null,this.m_PolyOuts[t]=null},d.ClipperBase.prototype.UpdateEdgeIntoAEL=function(t){null===t.NextInLML&&d.Error("UpdateEdgeIntoAEL: invalid call");var e=t.PrevInAEL,i=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,null!==e?e.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,null!==i&&(i.PrevInAEL=t.NextInLML),t.NextInLML.Side=t.Side,t.NextInLML.WindDelta=t.WindDelta,t.NextInLML.WindCnt=t.WindCnt,t.NextInLML.WindCnt2=t.WindCnt2,(t=t.NextInLML).Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=e,t.NextInAEL=i,d.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t},d.ClipperBase.prototype.SwapPositionsInAEL=function(t,e){if(t.NextInAEL!==t.PrevInAEL&&e.NextInAEL!==e.PrevInAEL){if(t.NextInAEL===e){var i=e.NextInAEL;null!==i&&(i.PrevInAEL=t);var r=t.PrevInAEL;null!==r&&(r.NextInAEL=e),e.PrevInAEL=r,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=i}else if(e.NextInAEL===t){var n=t.NextInAEL;null!==n&&(n.PrevInAEL=e);var o=e.PrevInAEL;null!==o&&(o.NextInAEL=t),t.PrevInAEL=o,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=n}else{var s=t.NextInAEL,a=t.PrevInAEL;t.NextInAEL=e.NextInAEL,null!==t.NextInAEL&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=e.PrevInAEL,null!==t.PrevInAEL&&(t.PrevInAEL.NextInAEL=t),e.NextInAEL=s,null!==e.NextInAEL&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=a,null!==e.PrevInAEL&&(e.PrevInAEL.NextInAEL=e)}null===t.PrevInAEL?this.m_ActiveEdges=t:null===e.PrevInAEL&&(this.m_ActiveEdges=e)}},d.ClipperBase.prototype.DeleteFromAEL=function(t){var e=t.PrevInAEL,i=t.NextInAEL;null===e&&null===i&&t!==this.m_ActiveEdges||(null!==e?e.NextInAEL=i:this.m_ActiveEdges=i,null!==i&&(i.PrevInAEL=e),t.NextInAEL=null,t.PrevInAEL=null)},d.Clipper=function(t){void 0===t&&(t=0),this.m_PolyOuts=null,this.m_ClipType=d.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=d.PolyFillType.pftEvenOdd,this.m_SubjFillType=d.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,d.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=d.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=0!=(1&t),this.StrictlySimple=0!=(2&t),this.PreserveCollinear=0!=(4&t),d.use_xyz&&(this.ZFillFunction=null)},d.Clipper.ioReverseSolution=1,d.Clipper.ioStrictlySimple=2,d.Clipper.ioPreserveCollinear=4,d.Clipper.prototype.Clear=function(){0!==this.m_edges.length&&(this.DisposeAllPolyPts(),d.ClipperBase.prototype.Clear.call(this))},d.Clipper.prototype.InsertMaxima=function(t){var e=new d.Maxima;if(e.X=t,null===this.m_Maxima)this.m_Maxima=e,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(t<this.m_Maxima.X)e.Next=this.m_Maxima,e.Prev=null,this.m_Maxima=e;else{for(var i=this.m_Maxima;null!==i.Next&&t>=i.Next.X;)i=i.Next;if(t===i.X)return;e.Next=i.Next,e.Prev=i,null!==i.Next&&(i.Next.Prev=e),i.Next=e}},d.Clipper.prototype.Execute=function(){var t=arguments,e=t.length,i=t[1]instanceof d.PolyTree;if(4===e&&!i){var r=t[0],n=t[1],o=t[2],s=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&d.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,d.Clear(n),this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=r,this.m_UsingPolyTree=!1;try{(h=this.ExecuteInternal())&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return h}if(4===e&&i){r=t[0];var a=t[1];o=t[2],s=t[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=r,this.m_UsingPolyTree=!0;try{var h;(h=this.ExecuteInternal())&&this.BuildResult2(a)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return h}if(2===e&&!i){r=t[0],n=t[1];return this.Execute(r,n,d.PolyFillType.pftEvenOdd,d.PolyFillType.pftEvenOdd)}if(2===e&&i){r=t[0],a=t[1];return this.Execute(r,a,d.PolyFillType.pftEvenOdd,d.PolyFillType.pftEvenOdd)}},d.Clipper.prototype.FixHoleLinkage=function(t){if(null!==t.FirstLeft&&(t.IsHole===t.FirstLeft.IsHole||null===t.FirstLeft.Pts)){for(var e=t.FirstLeft;null!==e&&(e.IsHole===t.IsHole||null===e.Pts);)e=e.FirstLeft;t.FirstLeft=e}},d.Clipper.prototype.ExecuteInternal=function(){var t=this;try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var e,i,r,n={},o={};if(!this.PopScanbeam(n))return!1;for(this.InsertLocalMinimaIntoAEL(n.v);this.PopScanbeam(o)||this.LocalMinimaPending();){if(t.ProcessHorizontals(),t.m_GhostJoins.length=0,!t.ProcessIntersections(o.v))return!1;t.ProcessEdgesAtTopOfScanbeam(o.v),n.v=o.v,t.InsertLocalMinimaIntoAEL(n.v)}for(i=0,r=this.m_PolyOuts.length;i<r;i++)null===(e=t.m_PolyOuts[i]).Pts||e.IsOpen||(e.IsHole^t.ReverseSolution)==t.Area$1(e)>0&&t.ReversePolyPtLinks(e.Pts);for(this.JoinCommonEdges(),i=0,r=this.m_PolyOuts.length;i<r;i++)null!==(e=t.m_PolyOuts[i]).Pts&&(e.IsOpen?t.FixupOutPolyline(e):t.FixupOutPolygon(e));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},d.Clipper.prototype.DisposeAllPolyPts=function(){for(var t=0,e=this.m_PolyOuts.length;t<e;++t)this.DisposeOutRec(t);d.Clear(this.m_PolyOuts)},d.Clipper.prototype.AddJoin=function(t,e,i){var r=new d.Join;r.OutPt1=t,r.OutPt2=e,r.OffPt.X=i.X,r.OffPt.Y=i.Y,d.use_xyz&&(r.OffPt.Z=i.Z),this.m_Joins.push(r)},d.Clipper.prototype.AddGhostJoin=function(t,e){var i=new d.Join;i.OutPt1=t,i.OffPt.X=e.X,i.OffPt.Y=e.Y,d.use_xyz&&(i.OffPt.Z=e.Z),this.m_GhostJoins.push(i)},d.Clipper.prototype.SetZ=function(t,e,i){if(null!==this.ZFillFunction){if(0!==t.Z||null===this.ZFillFunction)return;d.FPoint.op_Equality(t,e.Bot)?t.Z=e.Bot.Z:d.FPoint.op_Equality(t,e.Top)?t.Z=e.Top.Z:d.FPoint.op_Equality(t,i.Bot)?t.Z=i.Bot.Z:d.FPoint.op_Equality(t,i.Top)?t.Z=i.Top.Z:this.ZFillFunction(e.Bot,e.Top,i.Bot,i.Top,t)}},d.Clipper.prototype.InsertLocalMinimaIntoAEL=function(t){for(var e,i,r=this,n={};this.PopLocalMinima(t,n);){e=n.v.LeftBound,i=n.v.RightBound;var o=null;if(null===e?(r.InsertEdgeIntoAEL(i,null),r.SetWindingCount(i),r.IsContributing(i)&&(o=r.AddOutPt(i,i.Bot))):null===i?(r.InsertEdgeIntoAEL(e,null),r.SetWindingCount(e),r.IsContributing(e)&&(o=r.AddOutPt(e,e.Bot)),r.InsertScanbeam(e.Top.Y)):(r.InsertEdgeIntoAEL(e,null),r.InsertEdgeIntoAEL(i,e),r.SetWindingCount(e),i.WindCnt=e.WindCnt,i.WindCnt2=e.WindCnt2,r.IsContributing(e)&&(o=r.AddLocalMinPoly(e,i,e.Bot)),r.InsertScanbeam(e.Top.Y)),null!==i&&(d.ClipperBase.IsHorizontal(i)?(null!==i.NextInLML&&r.InsertScanbeam(i.NextInLML.Top.Y),r.AddEdgeToSEL(i)):r.InsertScanbeam(i.Top.Y)),null!==e&&null!==i){if(null!==o&&d.ClipperBase.IsHorizontal(i)&&r.m_GhostJoins.length>0&&0!==i.WindDelta)for(var s=0,a=this.m_GhostJoins.length;s<a;s++){var h=r.m_GhostJoins[s];r.HorzSegmentsOverlap(h.OutPt1.Pt.X,h.OffPt.X,i.Bot.X,i.Top.X)&&r.AddJoin(h.OutPt1,o,h.OffPt)}if(e.OutIdx>=0&&null!==e.PrevInAEL&&e.PrevInAEL.Curr.X===e.Bot.X&&e.PrevInAEL.OutIdx>=0&&d.ClipperBase.SlopesEqual5(e.PrevInAEL.Curr,e.PrevInAEL.Top,e.Curr,e.Top)&&0!==e.WindDelta&&0!==e.PrevInAEL.WindDelta){var l=r.AddOutPt(e.PrevInAEL,e.Bot);r.AddJoin(o,l,e.Top)}if(e.NextInAEL!==i){if(i.OutIdx>=0&&i.PrevInAEL.OutIdx>=0&&d.ClipperBase.SlopesEqual5(i.PrevInAEL.Curr,i.PrevInAEL.Top,i.Curr,i.Top)&&0!==i.WindDelta&&0!==i.PrevInAEL.WindDelta){l=r.AddOutPt(i.PrevInAEL,i.Bot);r.AddJoin(o,l,i.Top)}var u=e.NextInAEL;if(null!==u)for(;u!==i;)r.IntersectEdges(i,u,e.Curr),u=u.NextInAEL}}}},d.Clipper.prototype.InsertEdgeIntoAEL=function(t,e){if(null===this.m_ActiveEdges)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(null===e&&this.E2InsertsBeforeE1(this.m_ActiveEdges,t))t.PrevInAEL=null,t.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=t,this.m_ActiveEdges=t;else{for(null===e&&(e=this.m_ActiveEdges);null!==e.NextInAEL&&!this.E2InsertsBeforeE1(e.NextInAEL,t);)e=e.NextInAEL;t.NextInAEL=e.NextInAEL,null!==e.NextInAEL&&(e.NextInAEL.PrevInAEL=t),t.PrevInAEL=e,e.NextInAEL=t}},d.Clipper.prototype.E2InsertsBeforeE1=function(t,e){return e.Curr.X===t.Curr.X?e.Top.Y>t.Top.Y?e.Top.X<d.Clipper.TopX(t,e.Top.Y):t.Top.X>d.Clipper.TopX(e,t.Top.Y):e.Curr.X<t.Curr.X},d.Clipper.prototype.IsEvenOddFillType=function(t){return t.PolyTyp===d.PolyType.ptSubject?this.m_SubjFillType===d.PolyFillType.pftEvenOdd:this.m_ClipFillType===d.PolyFillType.pftEvenOdd},d.Clipper.prototype.IsEvenOddAltFillType=function(t){return t.PolyTyp===d.PolyType.ptSubject?this.m_ClipFillType===d.PolyFillType.pftEvenOdd:this.m_SubjFillType===d.PolyFillType.pftEvenOdd},d.Clipper.prototype.IsContributing=function(t){var e,i;switch(t.PolyTyp===d.PolyType.ptSubject?(e=this.m_SubjFillType,i=this.m_ClipFillType):(e=this.m_ClipFillType,i=this.m_SubjFillType),e){case d.PolyFillType.pftEvenOdd:if(0===t.WindDelta&&1!==t.WindCnt)return!1;break;case d.PolyFillType.pftNonZero:if(1!==Math.abs(t.WindCnt))return!1;break;case d.PolyFillType.pftPositive:if(1!==t.WindCnt)return!1;break;default:if(-1!==t.WindCnt)return!1}switch(this.m_ClipType){case d.ClipType.ctIntersection:switch(i){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return 0!==t.WindCnt2;case d.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case d.ClipType.ctUnion:switch(i){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return 0===t.WindCnt2;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case d.ClipType.ctDifference:if(t.PolyTyp===d.PolyType.ptSubject)switch(i){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return 0===t.WindCnt2;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(i){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return 0!==t.WindCnt2;case d.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case d.ClipType.ctXor:if(0!==t.WindDelta)return!0;switch(i){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return 0===t.WindCnt2;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}}return!0},d.Clipper.prototype.SetWindingCount=function(t){for(var e=t.PrevInAEL;null!==e&&(e.PolyTyp!==t.PolyTyp||0===e.WindDelta);)e=e.PrevInAEL;if(null===e){var i=t.PolyTyp===d.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;0===t.WindDelta?t.WindCnt=i===d.PolyFillType.pftNegative?-1:1:t.WindCnt=t.WindDelta,t.WindCnt2=0,e=this.m_ActiveEdges}else if(0===t.WindDelta&&this.m_ClipType!==d.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;else if(this.IsEvenOddFillType(t)){if(0===t.WindDelta){for(var r=!0,n=e.PrevInAEL;null!==n;)n.PolyTyp===e.PolyTyp&&0!==n.WindDelta&&(r=!r),n=n.PrevInAEL;t.WindCnt=r?0:1}else t.WindCnt=t.WindDelta;t.WindCnt2=e.WindCnt2,e=e.NextInAEL}else e.WindCnt*e.WindDelta<0?Math.abs(e.WindCnt)>1?e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta:t.WindCnt=0===t.WindDelta?1:t.WindDelta:0===t.WindDelta?t.WindCnt=e.WindCnt<0?e.WindCnt-1:e.WindCnt+1:e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;if(this.IsEvenOddAltFillType(t))for(;e!==t;)0!==e.WindDelta&&(t.WindCnt2=0===t.WindCnt2?1:0),e=e.NextInAEL;else for(;e!==t;)t.WindCnt2+=e.WindDelta,e=e.NextInAEL},d.Clipper.prototype.AddEdgeToSEL=function(t){null===this.m_SortedEdges?(this.m_SortedEdges=t,t.PrevInSEL=null,t.NextInSEL=null):(t.NextInSEL=this.m_SortedEdges,t.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=t,this.m_SortedEdges=t)},d.Clipper.prototype.PopEdgeFromSEL=function(t){if(t.v=this.m_SortedEdges,null===t.v)return!1;var e=t.v;return this.m_SortedEdges=t.v.NextInSEL,null!==this.m_SortedEdges&&(this.m_SortedEdges.PrevInSEL=null),e.NextInSEL=null,e.PrevInSEL=null,!0},d.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;null!==t;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL},d.Clipper.prototype.SwapPositionsInSEL=function(t,e){if(!(null===t.NextInSEL&&null===t.PrevInSEL||null===e.NextInSEL&&null===e.PrevInSEL)){if(t.NextInSEL===e)null!==(i=e.NextInSEL)&&(i.PrevInSEL=t),null!==(r=t.PrevInSEL)&&(r.NextInSEL=e),e.PrevInSEL=r,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=i;else if(e.NextInSEL===t){null!==(i=t.NextInSEL)&&(i.PrevInSEL=e),null!==(r=e.PrevInSEL)&&(r.NextInSEL=t),t.PrevInSEL=r,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=i}else{var i=t.NextInSEL,r=t.PrevInSEL;t.NextInSEL=e.NextInSEL,null!==t.NextInSEL&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=e.PrevInSEL,null!==t.PrevInSEL&&(t.PrevInSEL.NextInSEL=t),e.NextInSEL=i,null!==e.NextInSEL&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=r,null!==e.PrevInSEL&&(e.PrevInSEL.NextInSEL=e)}null===t.PrevInSEL?this.m_SortedEdges=t:null===e.PrevInSEL&&(this.m_SortedEdges=e)}},d.Clipper.prototype.AddLocalMaxPoly=function(t,e,i){this.AddOutPt(t,i),0===e.WindDelta&&this.AddOutPt(e,i),t.OutIdx===e.OutIdx?(t.OutIdx=-1,e.OutIdx=-1):t.OutIdx<e.OutIdx?this.AppendPolygon(t,e):this.AppendPolygon(e,t)},d.Clipper.prototype.AddLocalMinPoly=function(t,e,i){var r,n,o;if(d.ClipperBase.IsHorizontal(e)||t.Dx>e.Dx?(r=this.AddOutPt(t,i),e.OutIdx=t.OutIdx,t.Side=d.EdgeSide.esLeft,e.Side=d.EdgeSide.esRight,o=(n=t).PrevInAEL===e?e.PrevInAEL:n.PrevInAEL):(r=this.AddOutPt(e,i),t.OutIdx=e.OutIdx,t.Side=d.EdgeSide.esRight,e.Side=d.EdgeSide.esLeft,o=(n=e).PrevInAEL===t?t.PrevInAEL:n.PrevInAEL),null!==o&&o.OutIdx>=0&&o.Top.Y<i.Y&&n.Top.Y<i.Y){var s=d.Clipper.TopX(o,i.Y),a=d.Clipper.TopX(n,i.Y);if(s===a&&0!==n.WindDelta&&0!==o.WindDelta&&d.ClipperBase.SlopesEqual5(new d.FPoint2(s,i.Y),o.Top,new d.FPoint2(a,i.Y),n.Top)){var h=this.AddOutPt(o,i);this.AddJoin(r,h,n.Top)}}return r},d.Clipper.prototype.AddOutPt=function(t,e){if(t.OutIdx<0){(r=this.CreateOutRec()).IsOpen=0===t.WindDelta;var i=new d.OutPt;return r.Pts=i,i.Idx=r.Idx,i.Pt.X=e.X,i.Pt.Y=e.Y,d.use_xyz&&(i.Pt.Z=e.Z),i.Next=i,i.Prev=i,r.IsOpen||this.SetHoleState(t,r),t.OutIdx=r.Idx,i}var r,n=(r=this.m_PolyOuts[t.OutIdx]).Pts,o=t.Side===d.EdgeSide.esLeft;return o&&d.FPoint.op_Equality(e,n.Pt)?n:!o&&d.FPoint.op_Equality(e,n.Prev.Pt)?n.Prev:((i=new d.OutPt).Idx=r.Idx,i.Pt.X=e.X,i.Pt.Y=e.Y,d.use_xyz&&(i.Pt.Z=e.Z),i.Next=n,i.Prev=n.Prev,i.Prev.Next=i,n.Prev=i,o&&(r.Pts=i),i)},d.Clipper.prototype.GetLastOutPt=function(t){var e=this.m_PolyOuts[t.OutIdx];return t.Side===d.EdgeSide.esLeft?e.Pts:e.Pts.Prev},d.Clipper.prototype.SwapPoints=function(t,e){var i=new d.FPoint1(t.Value);t.Value.X=e.Value.X,t.Value.Y=e.Value.Y,d.use_xyz&&(t.Value.Z=e.Value.Z),e.Value.X=i.X,e.Value.Y=i.Y,d.use_xyz&&(e.Value.Z=i.Z)},d.Clipper.prototype.HorzSegmentsOverlap=function(t,e,i,r){var n;return t>e&&(n=t,t=e,e=n),i>r&&(n=i,i=r,r=n),t<r&&i<e},d.Clipper.prototype.SetHoleState=function(t,e){for(var i=t.PrevInAEL,r=null;null!==i;)i.OutIdx>=0&&0!==i.WindDelta&&(null===r?r=i:r.OutIdx===i.OutIdx&&(r=null)),i=i.PrevInAEL;null===r?(e.FirstLeft=null,e.IsHole=!1):(e.FirstLeft=this.m_PolyOuts[r.OutIdx],e.IsHole=!e.FirstLeft.IsHole)},d.Clipper.prototype.GetDx=function(t,e){return t.Y===e.Y?d.ClipperBase.horizontal:(e.X-t.X)/(e.Y-t.Y)},d.Clipper.prototype.FirstIsBottomPt=function(t,e){for(var i=t.Prev;d.FPoint.op_Equality(i.Pt,t.Pt)&&i!==t;)i=i.Prev;var r=Math.abs(this.GetDx(t.Pt,i.Pt));for(i=t.Next;d.FPoint.op_Equality(i.Pt,t.Pt)&&i!==t;)i=i.Next;var n=Math.abs(this.GetDx(t.Pt,i.Pt));for(i=e.Prev;d.FPoint.op_Equality(i.Pt,e.Pt)&&i!==e;)i=i.Prev;var o=Math.abs(this.GetDx(e.Pt,i.Pt));for(i=e.Next;d.FPoint.op_Equality(i.Pt,e.Pt)&&i!==e;)i=i.Next;var s=Math.abs(this.GetDx(e.Pt,i.Pt));return Math.max(r,n)===Math.max(o,s)&&Math.min(r,n)===Math.min(o,s)?this.Area(t)>0:r>=o&&r>=s||n>=o&&n>=s},d.Clipper.prototype.GetBottomPt=function(t){for(var e=null,i=t.Next;i!==t;)i.Pt.Y>t.Pt.Y?(t=i,e=null):i.Pt.Y===t.Pt.Y&&i.Pt.X<=t.Pt.X&&(i.Pt.X<t.Pt.X?(e=null,t=i):i.Next!==t&&i.Prev!==t&&(e=i)),i=i.Next;if(null!==e)for(;e!==i;)for(this.FirstIsBottomPt(i,e)||(t=e),e=e.Next;d.FPoint.op_Inequality(e.Pt,t.Pt);)e=e.Next;return t},d.Clipper.prototype.GetLowermostRec=function(t,e){null===t.BottomPt&&(t.BottomPt=this.GetBottomPt(t.Pts)),null===e.BottomPt&&(e.BottomPt=this.GetBottomPt(e.Pts));var i=t.BottomPt,r=e.BottomPt;return i.Pt.Y>r.Pt.Y?t:i.Pt.Y<r.Pt.Y?e:i.Pt.X<r.Pt.X?t:i.Pt.X>r.Pt.X||i.Next===i?e:r.Next===r||this.FirstIsBottomPt(i,r)?t:e},d.Clipper.prototype.OutRec1RightOfOutRec2=function(t,e){do{if((t=t.FirstLeft)===e)return!0}while(null!==t);return!1},d.Clipper.prototype.GetOutRec=function(t){for(var e=this.m_PolyOuts[t];e!==this.m_PolyOuts[e.Idx];)e=this.m_PolyOuts[e.Idx];return e},d.Clipper.prototype.AppendPolygon=function(t,e){var i,r=this.m_PolyOuts[t.OutIdx],n=this.m_PolyOuts[e.OutIdx];i=this.OutRec1RightOfOutRec2(r,n)?n:this.OutRec1RightOfOutRec2(n,r)?r:this.GetLowermostRec(r,n);var o=r.Pts,s=o.Prev,a=n.Pts,h=a.Prev;t.Side===d.EdgeSide.esLeft?e.Side===d.EdgeSide.esLeft?(this.ReversePolyPtLinks(a),a.Next=o,o.Prev=a,s.Next=h,h.Prev=s,r.Pts=h):(h.Next=o,o.Prev=h,a.Prev=s,s.Next=a,r.Pts=a):e.Side===d.EdgeSide.esRight?(this.ReversePolyPtLinks(a),s.Next=h,h.Prev=s,a.Next=o,o.Prev=a):(s.Next=a,a.Prev=s,o.Prev=h,h.Next=o),r.BottomPt=null,i===n&&(n.FirstLeft!==r&&(r.FirstLeft=n.FirstLeft),r.IsHole=n.IsHole),n.Pts=null,n.BottomPt=null,n.FirstLeft=r;var l=t.OutIdx,u=e.OutIdx;t.OutIdx=-1,e.OutIdx=-1;for(var p=this.m_ActiveEdges;null!==p;){if(p.OutIdx===u){p.OutIdx=l,p.Side=t.Side;break}p=p.NextInAEL}n.Idx=r.Idx},d.Clipper.prototype.ReversePolyPtLinks=function(t){if(null!==t){var e,i;e=t;do{i=e.Next,e.Next=e.Prev,e.Prev=i,e=i}while(e!==t)}},d.Clipper.SwapSides=function(t,e){var i=t.Side;t.Side=e.Side,e.Side=i},d.Clipper.SwapPolyIndexes=function(t,e){var i=t.OutIdx;t.OutIdx=e.OutIdx,e.OutIdx=i},d.Clipper.prototype.IntersectEdges=function(t,e,i){var r=t.OutIdx>=0,n=e.OutIdx>=0;if(d.use_xyz&&this.SetZ(i,t,e),!d.use_lines||0!==t.WindDelta&&0!==e.WindDelta){if(t.PolyTyp===e.PolyTyp)if(this.IsEvenOddFillType(t)){var o=t.WindCnt;t.WindCnt=e.WindCnt,e.WindCnt=o}else t.WindCnt+e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt+=e.WindDelta,e.WindCnt-t.WindDelta==0?e.WindCnt=-e.WindCnt:e.WindCnt-=t.WindDelta;else this.IsEvenOddFillType(e)?t.WindCnt2=0===t.WindCnt2?1:0:t.WindCnt2+=e.WindDelta,this.IsEvenOddFillType(t)?e.WindCnt2=0===e.WindCnt2?1:0:e.WindCnt2-=t.WindDelta;var s,a,h,l,u,p;switch(t.PolyTyp===d.PolyType.ptSubject?(s=this.m_SubjFillType,h=this.m_ClipFillType):(s=this.m_ClipFillType,h=this.m_SubjFillType),e.PolyTyp===d.PolyType.ptSubject?(a=this.m_SubjFillType,l=this.m_ClipFillType):(a=this.m_ClipFillType,l=this.m_SubjFillType),s){case d.PolyFillType.pftPositive:u=t.WindCnt;break;case d.PolyFillType.pftNegative:u=-t.WindCnt;break;default:u=Math.abs(t.WindCnt)}switch(a){case d.PolyFillType.pftPositive:p=e.WindCnt;break;case d.PolyFillType.pftNegative:p=-e.WindCnt;break;default:p=Math.abs(e.WindCnt)}if(r&&n)0!==u&&1!==u||0!==p&&1!==p||t.PolyTyp!==e.PolyTyp&&this.m_ClipType!==d.ClipType.ctXor?this.AddLocalMaxPoly(t,e,i):(this.AddOutPt(t,i),this.AddOutPt(e,i),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if(r)0!==p&&1!==p||(this.AddOutPt(t,i),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if(n)0!==u&&1!==u||(this.AddOutPt(e,i),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if(!(0!==u&&1!==u||0!==p&&1!==p)){var c,f;switch(h){case d.PolyFillType.pftPositive:c=t.WindCnt2;break;case d.PolyFillType.pftNegative:c=-t.WindCnt2;break;default:c=Math.abs(t.WindCnt2)}switch(l){case d.PolyFillType.pftPositive:f=e.WindCnt2;break;case d.PolyFillType.pftNegative:f=-e.WindCnt2;break;default:f=Math.abs(e.WindCnt2)}if(t.PolyTyp!==e.PolyTyp)this.AddLocalMinPoly(t,e,i);else if(1===u&&1===p)switch(this.m_ClipType){case d.ClipType.ctIntersection:c>0&&f>0&&this.AddLocalMinPoly(t,e,i);break;case d.ClipType.ctUnion:c<=0&&f<=0&&this.AddLocalMinPoly(t,e,i);break;case d.ClipType.ctDifference:(t.PolyTyp===d.PolyType.ptClip&&c>0&&f>0||t.PolyTyp===d.PolyType.ptSubject&&c<=0&&f<=0)&&this.AddLocalMinPoly(t,e,i);break;case d.ClipType.ctXor:this.AddLocalMinPoly(t,e,i)}else d.Clipper.SwapSides(t,e)}}else{if(0===t.WindDelta&&0===e.WindDelta)return;t.PolyTyp===e.PolyTyp&&t.WindDelta!==e.WindDelta&&this.m_ClipType===d.ClipType.ctUnion?0===t.WindDelta?n&&(this.AddOutPt(t,i),r&&(t.OutIdx=-1)):r&&(this.AddOutPt(e,i),n&&(e.OutIdx=-1)):t.PolyTyp!==e.PolyTyp&&(0!==t.WindDelta||1!==Math.abs(e.WindCnt)||this.m_ClipType===d.ClipType.ctUnion&&0!==e.WindCnt2?0!==e.WindDelta||1!==Math.abs(t.WindCnt)||this.m_ClipType===d.ClipType.ctUnion&&0!==t.WindCnt2||(this.AddOutPt(e,i),n&&(e.OutIdx=-1)):(this.AddOutPt(t,i),r&&(t.OutIdx=-1)))}},d.Clipper.prototype.DeleteFromSEL=function(t){var e=t.PrevInSEL,i=t.NextInSEL;null===e&&null===i&&t!==this.m_SortedEdges||(null!==e?e.NextInSEL=i:this.m_SortedEdges=i,null!==i&&(i.PrevInSEL=e),t.NextInSEL=null,t.PrevInSEL=null)},d.Clipper.prototype.ProcessHorizontals=function(){for(var t={};this.PopEdgeFromSEL(t);)this.ProcessHorizontal(t.v)},d.Clipper.prototype.GetHorzDirection=function(t,e){t.Bot.X<t.Top.X?(e.Left=t.Bot.X,e.Right=t.Top.X,e.Dir=d.Direction.dLeftToRight):(e.Left=t.Top.X,e.Right=t.Bot.X,e.Dir=d.Direction.dRightToLeft)},d.Clipper.prototype.ProcessHorizontal=function(t){var e=this,i={Dir:null,Left:null,Right:null};this.GetHorzDirection(t,i);for(var r=i.Dir,n=i.Left,o=i.Right,s=0===t.WindDelta,a=t,h=null;null!==a.NextInLML&&d.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;null===a.NextInLML&&(h=this.GetMaximaPair(a));var l=this.m_Maxima;if(null!==l)if(r===d.Direction.dLeftToRight){for(;null!==l&&l.X<=t.Bot.X;)l=l.Next;null!==l&&l.X>=a.Top.X&&(l=null)}else{for(;null!==l.Next&&l.Next.X<t.Bot.X;)l=l.Next;l.X<=a.Top.X&&(l=null)}for(var u=null;;){for(var p=t===a,c=e.GetNextInAEL(t,r);null!==c;){if(null!==l)if(r===d.Direction.dLeftToRight)for(;null!==l&&l.X<c.Curr.X;)t.OutIdx>=0&&!s&&e.AddOutPt(t,new d.FPoint2(l.X,t.Bot.Y)),l=l.Next;else for(;null!==l&&l.X>c.Curr.X;)t.OutIdx>=0&&!s&&e.AddOutPt(t,new d.FPoint2(l.X,t.Bot.Y)),l=l.Prev;if(r===d.Direction.dLeftToRight&&c.Curr.X>o||r===d.Direction.dRightToLeft&&c.Curr.X<n)break;if(c.Curr.X===t.Top.X&&null!==t.NextInLML&&c.Dx<t.NextInLML.Dx)break;if(t.OutIdx>=0&&!s){d.use_xyz&&(r===d.Direction.dLeftToRight?e.SetZ(c.Curr,t,c):e.SetZ(c.Curr,c,t)),u=e.AddOutPt(t,c.Curr);for(var f=e.m_SortedEdges;null!==f;){if(f.OutIdx>=0&&e.HorzSegmentsOverlap(t.Bot.X,t.Top.X,f.Bot.X,f.Top.X)){var v=e.GetLastOutPt(f);e.AddJoin(v,u,f.Top)}f=f.NextInSEL}e.AddGhostJoin(u,t.Bot)}if(c===h&&p)return t.OutIdx>=0&&e.AddLocalMaxPoly(t,h,t.Top),e.DeleteFromAEL(t),void e.DeleteFromAEL(h);if(r===d.Direction.dLeftToRight){var y=new d.FPoint2(c.Curr.X,t.Curr.Y);e.IntersectEdges(t,c,y)}else{y=new d.FPoint2(c.Curr.X,t.Curr.Y);e.IntersectEdges(c,t,y)}var g=e.GetNextInAEL(c,r);e.SwapPositionsInAEL(t,c),c=g}if(null===t.NextInLML||!d.ClipperBase.IsHorizontal(t.NextInLML))break;(t=e.UpdateEdgeIntoAEL(t)).OutIdx>=0&&e.AddOutPt(t,t.Bot),i={Dir:r,Left:n,Right:o},e.GetHorzDirection(t,i),r=i.Dir,n=i.Left,o=i.Right}if(t.OutIdx>=0&&null===u){u=this.GetLastOutPt(t);for(f=this.m_SortedEdges;null!==f;){if(f.OutIdx>=0&&e.HorzSegmentsOverlap(t.Bot.X,t.Top.X,f.Bot.X,f.Top.X)){v=e.GetLastOutPt(f);e.AddJoin(v,u,f.Top)}f=f.NextInSEL}this.AddGhostJoin(u,t.Top)}if(null!==t.NextInLML)if(t.OutIdx>=0){if(u=this.AddOutPt(t,t.Top),0===(t=this.UpdateEdgeIntoAEL(t)).WindDelta)return;var m=t.PrevInAEL;g=t.NextInAEL;if(null!==m&&m.Curr.X===t.Bot.X&&m.Curr.Y===t.Bot.Y&&0===m.WindDelta&&m.OutIdx>=0&&m.Curr.Y>m.Top.Y&&d.ClipperBase.SlopesEqual3(t,m)){v=this.AddOutPt(m,t.Bot);this.AddJoin(u,v,t.Top)}else if(null!==g&&g.Curr.X===t.Bot.X&&g.Curr.Y===t.Bot.Y&&0!==g.WindDelta&&g.OutIdx>=0&&g.Curr.Y>g.Top.Y&&d.ClipperBase.SlopesEqual3(t,g)){v=this.AddOutPt(g,t.Bot);this.AddJoin(u,v,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t)},d.Clipper.prototype.GetNextInAEL=function(t,e){return e===d.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL},d.Clipper.prototype.IsMinima=function(t){return null!==t&&t.Prev.NextInLML!==t&&t.Next.NextInLML!==t},d.Clipper.prototype.IsMaxima=function(t,e){return null!==t&&t.Top.Y===e&&null===t.NextInLML},d.Clipper.prototype.IsIntermediate=function(t,e){return t.Top.Y===e&&null!==t.NextInLML},d.Clipper.prototype.GetMaximaPair=function(t){return d.FPoint.op_Equality(t.Next.Top,t.Top)&&null===t.Next.NextInLML?t.Next:d.FPoint.op_Equality(t.Prev.Top,t.Top)&&null===t.Prev.NextInLML?t.Prev:null},d.Clipper.prototype.GetMaximaPairEx=function(t){var e=this.GetMaximaPair(t);return null===e||e.OutIdx===d.ClipperBase.Skip||e.NextInAEL===e.PrevInAEL&&!d.ClipperBase.IsHorizontal(e)?null:e},d.Clipper.prototype.ProcessIntersections=function(t){if(null===this.m_ActiveEdges)return!0;try{if(this.BuildIntersectList(t),0===this.m_IntersectList.length)return!0;if(1!==this.m_IntersectList.length&&!this.FixupIntersectionOrder())return!1;this.ProcessIntersectList()}catch(t){this.m_SortedEdges=null,this.m_IntersectList.length=0,d.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},d.Clipper.prototype.BuildIntersectList=function(t){var e=this;if(null!==this.m_ActiveEdges){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;null!==i;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i.Curr.X=d.Clipper.TopX(i,t),i=i.NextInAEL;for(var r=!0;r&&null!==this.m_SortedEdges;){for(r=!1,i=e.m_SortedEdges;null!==i.NextInSEL;){var n=i.NextInSEL,o=new d.FPoint0;if(i.Curr.X>n.Curr.X){e.IntersectPoint(i,n,o),o.Y<t&&(o=new d.FPoint2(d.Clipper.TopX(i,t),t));var s=new d.IntersectNode;s.Edge1=i,s.Edge2=n,s.Pt.X=o.X,s.Pt.Y=o.Y,d.use_xyz&&(s.Pt.Z=o.Z),e.m_IntersectList.push(s),e.SwapPositionsInSEL(i,n),r=!0}else i=n}if(null===i.PrevInSEL)break;i.PrevInSEL.NextInSEL=null}this.m_SortedEdges=null}},d.Clipper.prototype.EdgesAdjacent=function(t){return t.Edge1.NextInSEL===t.Edge2||t.Edge1.PrevInSEL===t.Edge2},d.Clipper.IntersectNodeSort=function(t,e){return e.Pt.Y-t.Pt.Y},d.Clipper.prototype.FixupIntersectionOrder=function(){var t=this;this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,i=0;i<e;i++){if(!t.EdgesAdjacent(t.m_IntersectList[i])){for(var r=i+1;r<e&&!this.EdgesAdjacent(this.m_IntersectList[r]);)r++;if(r===e)return!1;var n=t.m_IntersectList[i];t.m_IntersectList[i]=t.m_IntersectList[r],t.m_IntersectList[r]=n}t.SwapPositionsInSEL(t.m_IntersectList[i].Edge1,t.m_IntersectList[i].Edge2)}return!0},d.Clipper.prototype.ProcessIntersectList=function(){for(var t=this,e=0,i=this.m_IntersectList.length;e<i;e++){var r=t.m_IntersectList[e];t.IntersectEdges(r.Edge1,r.Edge2,r.Pt),t.SwapPositionsInAEL(r.Edge1,r.Edge2)}this.m_IntersectList.length=0},d.Clipper.TopX=function(t,e){return e===t.Top.Y?t.Top.X:t.Bot.X+t.Dx*(e-t.Bot.Y)},d.Clipper.prototype.IntersectPoint=function(t,e,i){var r,n;if(i.X=0,i.Y=0,t.Dx===e.Dx)return i.Y=t.Curr.Y,void(i.X=d.Clipper.TopX(t,i.Y));if(0===t.Delta.X)i.X=t.Bot.X,d.ClipperBase.IsHorizontal(e)?i.Y=e.Bot.Y:(n=e.Bot.Y-e.Bot.X/e.Dx,i.Y=i.X/e.Dx+n);else if(0===e.Delta.X)i.X=e.Bot.X,d.ClipperBase.IsHorizontal(t)?i.Y=t.Bot.Y:(r=t.Bot.Y-t.Bot.X/t.Dx,i.Y=i.X/t.Dx+r);else{r=t.Bot.X-t.Bot.Y*t.Dx;var o=((n=e.Bot.X-e.Bot.Y*e.Dx)-r)/(t.Dx-e.Dx);i.Y=o,Math.abs(t.Dx)<Math.abs(e.Dx)?i.X=t.Dx*o+r:i.X=e.Dx*o+n}if(i.Y<t.Top.Y||i.Y<e.Top.Y){if(t.Top.Y>e.Top.Y)return i.Y=t.Top.Y,i.X=d.Clipper.TopX(e,t.Top.Y),i.X<t.Top.X;i.Y=e.Top.Y,Math.abs(t.Dx)<Math.abs(e.Dx)?i.X=d.Clipper.TopX(t,i.Y):i.X=d.Clipper.TopX(e,i.Y)}i.Y>t.Curr.Y&&(i.Y=t.Curr.Y,Math.abs(t.Dx)>Math.abs(e.Dx)?i.X=d.Clipper.TopX(e,i.Y):i.X=d.Clipper.TopX(t,i.Y))},d.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var e=this,i=this.m_ActiveEdges;null!==i;){var r=e.IsMaxima(i,t);if(r){var n=e.GetMaximaPairEx(i);r=null===n||!d.ClipperBase.IsHorizontal(n)}if(r){e.StrictlySimple&&e.InsertMaxima(i.Top.X);var o=i.PrevInAEL;e.DoMaxima(i),i=null===o?e.m_ActiveEdges:o.NextInAEL}else{if(e.IsIntermediate(i,t)&&d.ClipperBase.IsHorizontal(i.NextInLML)?((i=e.UpdateEdgeIntoAEL(i)).OutIdx>=0&&e.AddOutPt(i,i.Bot),e.AddEdgeToSEL(i)):(i.Curr.X=d.Clipper.TopX(i,t),i.Curr.Y=t),d.use_xyz&&(i.Top.Y===t?i.Curr.Z=i.Top.Z:i.Bot.Y===t?i.Curr.Z=i.Bot.Z:i.Curr.Z=0),e.StrictlySimple){o=i.PrevInAEL;if(i.OutIdx>=0&&0!==i.WindDelta&&null!==o&&o.OutIdx>=0&&o.Curr.X===i.Curr.X&&0!==o.WindDelta){var s=new d.FPoint1(i.Curr);d.use_xyz&&e.SetZ(s,o,i);var a=e.AddOutPt(o,s),h=e.AddOutPt(i,s);e.AddJoin(a,h,s)}}i=i.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,i=this.m_ActiveEdges;null!==i;){if(e.IsIntermediate(i,t)){a=null;i.OutIdx>=0&&(a=e.AddOutPt(i,i.Top));o=(i=e.UpdateEdgeIntoAEL(i)).PrevInAEL;var l=i.NextInAEL;if(null!==o&&o.Curr.X===i.Bot.X&&o.Curr.Y===i.Bot.Y&&null!==a&&o.OutIdx>=0&&o.Curr.Y===o.Top.Y&&d.ClipperBase.SlopesEqual5(i.Curr,i.Top,o.Curr,o.Top)&&0!==i.WindDelta&&0!==o.WindDelta){h=e.AddOutPt(ePrev2,i.Bot);e.AddJoin(a,h,i.Top)}else if(null!==l&&l.Curr.X===i.Bot.X&&l.Curr.Y===i.Bot.Y&&null!==a&&l.OutIdx>=0&&l.Curr.Y===l.Top.Y&&d.ClipperBase.SlopesEqual5(i.Curr,i.Top,l.Curr,l.Top)&&0!==i.WindDelta&&0!==l.WindDelta){h=e.AddOutPt(l,i.Bot);e.AddJoin(a,h,i.Top)}}i=i.NextInAEL}},d.Clipper.prototype.DoMaxima=function(t){var e=this.GetMaximaPairEx(t);if(null===e)return t.OutIdx>=0&&this.AddOutPt(t,t.Top),void this.DeleteFromAEL(t);for(var i=t.NextInAEL;null!==i&&i!==e;)this.IntersectEdges(t,i,t.Top),this.SwapPositionsInAEL(t,i),i=t.NextInAEL;-1===t.OutIdx&&-1===e.OutIdx?(this.DeleteFromAEL(t),this.DeleteFromAEL(e)):t.OutIdx>=0&&e.OutIdx>=0?(t.OutIdx>=0&&this.AddLocalMaxPoly(t,e,t.Top),this.DeleteFromAEL(t),this.DeleteFromAEL(e)):d.use_lines&&0===t.WindDelta?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=d.ClipperBase.Unassigned),this.DeleteFromAEL(t),e.OutIdx>=0&&(this.AddOutPt(e,t.Top),e.OutIdx=d.ClipperBase.Unassigned),this.DeleteFromAEL(e)):d.Error("DoMaxima error")},d.Clipper.ReversePaths=function(t){for(var e=0,i=t.length;e<i;e++)t[e].reverse()},d.Clipper.Orientation=function(t){return d.Clipper.Area(t)>=0},d.Clipper.prototype.PointCount=function(t){if(null===t)return 0;var e=0,i=t;do{e++,i=i.Next}while(i!==t);return e},d.Clipper.prototype.BuildResult=function(t){d.Clear(t);for(var e=0,i=this.m_PolyOuts.length;e<i;e++){var r=this.m_PolyOuts[e];if(null!==r.Pts){var n=r.Pts.Prev,o=this.PointCount(n);if(!(o<2)){for(var s=new Array(o),a=0;a<o;a++)s[a]=n.Pt,n=n.Prev;t.push(s)}}}},d.Clipper.prototype.BuildResult2=function(t){var e=this;t.Clear();for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=e.m_PolyOuts[i],o=e.PointCount(n.Pts);if(!(n.IsOpen&&o<2||!n.IsOpen&&o<3)){e.FixHoleLinkage(n);var s=new d.PolyNode;t.m_AllPolys.push(s),n.PolyNode=s,s.m_polygon.length=o;for(var a=n.Pts.Prev,h=0;h<o;h++)s.m_polygon[h]=a.Pt,a=a.Prev}}for(i=0,r=this.m_PolyOuts.length;i<r;i++){null!==(n=e.m_PolyOuts[i]).PolyNode&&(n.IsOpen?(n.PolyNode.IsOpen=!0,t.AddChild(n.PolyNode)):null!==n.FirstLeft&&null!==n.FirstLeft.PolyNode?n.FirstLeft.PolyNode.AddChild(n.PolyNode):t.AddChild(n.PolyNode))}},d.Clipper.prototype.FixupOutPolyline=function(t){for(var e=t.Pts,i=e.Prev;e!==i;)if(e=e.Next,d.FPoint.op_Equality(e.Pt,e.Prev.Pt)){e===i&&(i=e.Prev);var r=e.Prev;r.Next=e.Next,e.Next.Prev=r,e=r}e===e.Prev&&(t.Pts=null)},d.Clipper.prototype.FixupOutPolygon=function(t){var e=null;t.BottomPt=null;for(var i=t.Pts,r=this.PreserveCollinear||this.StrictlySimple;;){if(i.Prev===i||i.Prev===i.Next)return void(t.Pts=null);if(d.FPoint.op_Equality(i.Pt,i.Next.Pt)||d.FPoint.op_Equality(i.Pt,i.Prev.Pt)||d.ClipperBase.SlopesEqual4(i.Prev.Pt,i.Pt,i.Next.Pt)&&(!r||!this.Pt2IsBetweenPt1AndPt3(i.Prev.Pt,i.Pt,i.Next.Pt)))e=null,i.Prev.Next=i.Next,i.Next.Prev=i.Prev,i=i.Prev;else{if(i===e)break;null===e&&(e=i),i=i.Next}}t.Pts=i},d.Clipper.prototype.DupOutPt=function(t,e){var i=new d.OutPt;return i.Pt.X=t.Pt.X,i.Pt.Y=t.Pt.Y,d.use_xyz&&(i.Pt.Z=t.Pt.Z),i.Idx=t.Idx,e?(i.Next=t.Next,i.Prev=t,t.Next.Prev=i,t.Next=i):(i.Prev=t.Prev,i.Next=t,t.Prev.Next=i,t.Prev=i),i},d.Clipper.prototype.GetOverlap=function(t,e,i,r,n){return t<e?i<r?(n.Left=Math.max(t,i),n.Right=Math.min(e,r)):(n.Left=Math.max(t,r),n.Right=Math.min(e,i)):i<r?(n.Left=Math.max(e,i),n.Right=Math.min(t,r)):(n.Left=Math.max(e,r),n.Right=Math.min(t,i)),n.Left<n.Right},d.Clipper.prototype.JoinHorz=function(t,e,i,r,n,o){var s=t.Pt.X>e.Pt.X?d.Direction.dRightToLeft:d.Direction.dLeftToRight,a=i.Pt.X>r.Pt.X?d.Direction.dRightToLeft:d.Direction.dLeftToRight;if(s===a)return!1;if(s===d.Direction.dLeftToRight){for(;t.Next.Pt.X<=n.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y===n.Y;)t=t.Next;o&&t.Pt.X!==n.X&&(t=t.Next),e=this.DupOutPt(t,!o),d.FPoint.op_Inequality(e.Pt,n)&&((t=e).Pt.X=n.X,t.Pt.Y=n.Y,d.use_xyz&&(t.Pt.Z=n.Z),e=this.DupOutPt(t,!o))}else{for(;t.Next.Pt.X>=n.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y===n.Y;)t=t.Next;o||t.Pt.X===n.X||(t=t.Next),e=this.DupOutPt(t,o),d.FPoint.op_Inequality(e.Pt,n)&&((t=e).Pt.X=n.X,t.Pt.Y=n.Y,d.use_xyz&&(t.Pt.Z=n.Z),e=this.DupOutPt(t,o))}if(a===d.Direction.dLeftToRight){for(;i.Next.Pt.X<=n.X&&i.Next.Pt.X>=i.Pt.X&&i.Next.Pt.Y===n.Y;)i=i.Next;o&&i.Pt.X!==n.X&&(i=i.Next),r=this.DupOutPt(i,!o),d.FPoint.op_Inequality(r.Pt,n)&&((i=r).Pt.X=n.X,i.Pt.Y=n.Y,d.use_xyz&&(i.Pt.Z=n.Z),r=this.DupOutPt(i,!o))}else{for(;i.Next.Pt.X>=n.X&&i.Next.Pt.X<=i.Pt.X&&i.Next.Pt.Y===n.Y;)i=i.Next;o||i.Pt.X===n.X||(i=i.Next),r=this.DupOutPt(i,o),d.FPoint.op_Inequality(r.Pt,n)&&((i=r).Pt.X=n.X,i.Pt.Y=n.Y,d.use_xyz&&(i.Pt.Z=n.Z),r=this.DupOutPt(i,o))}return s===d.Direction.dLeftToRight===o?(t.Prev=i,i.Next=t,e.Next=r,r.Prev=e):(t.Next=i,i.Prev=t,e.Prev=r,r.Next=e),!0},d.Clipper.prototype.JoinPoints=function(t,e,i){var r=t.OutPt1,n=new d.OutPt,o=t.OutPt2,s=new d.OutPt,a=t.OutPt1.Pt.Y===t.OffPt.Y;if(a&&d.FPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&d.FPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){if(e!==i)return!1;for(n=t.OutPt1.Next;n!==r&&d.FPoint.op_Equality(n.Pt,t.OffPt);)n=n.Next;var h=n.Pt.Y>t.OffPt.Y;for(s=t.OutPt2.Next;s!==o&&d.FPoint.op_Equality(s.Pt,t.OffPt);)s=s.Next;return h!==s.Pt.Y>t.OffPt.Y&&(h?(n=this.DupOutPt(r,!1),s=this.DupOutPt(o,!0),r.Prev=o,o.Next=r,n.Next=s,s.Prev=n,t.OutPt1=r,t.OutPt2=n,!0):(n=this.DupOutPt(r,!0),s=this.DupOutPt(o,!1),r.Next=o,o.Prev=r,n.Prev=s,s.Next=n,t.OutPt1=r,t.OutPt2=n,!0))}if(a){for(n=r;r.Prev.Pt.Y===r.Pt.Y&&r.Prev!==n&&r.Prev!==o;)r=r.Prev;for(;n.Next.Pt.Y===n.Pt.Y&&n.Next!==r&&n.Next!==o;)n=n.Next;if(n.Next===r||n.Next===o)return!1;for(s=o;o.Prev.Pt.Y===o.Pt.Y&&o.Prev!==s&&o.Prev!==n;)o=o.Prev;for(;s.Next.Pt.Y===s.Pt.Y&&s.Next!==o&&s.Next!==r;)s=s.Next;if(s.Next===o||s.Next===r)return!1;var l={Left:null,Right:null};if(!this.GetOverlap(r.Pt.X,n.Pt.X,o.Pt.X,s.Pt.X,l))return!1;var u,p=l.Left,c=l.Right,f=new d.FPoint0;return r.Pt.X>=p&&r.Pt.X<=c?(f.X=r.Pt.X,f.Y=r.Pt.Y,d.use_xyz&&(f.Z=r.Pt.Z),u=r.Pt.X>n.Pt.X):o.Pt.X>=p&&o.Pt.X<=c?(f.X=o.Pt.X,f.Y=o.Pt.Y,d.use_xyz&&(f.Z=o.Pt.Z),u=o.Pt.X>s.Pt.X):n.Pt.X>=p&&n.Pt.X<=c?(f.X=n.Pt.X,f.Y=n.Pt.Y,d.use_xyz&&(f.Z=n.Pt.Z),u=n.Pt.X>r.Pt.X):(f.X=s.Pt.X,f.Y=s.Pt.Y,d.use_xyz&&(f.Z=s.Pt.Z),u=s.Pt.X>o.Pt.X),t.OutPt1=r,t.OutPt2=o,this.JoinHorz(r,n,o,s,f,u)}for(n=r.Next;d.FPoint.op_Equality(n.Pt,r.Pt)&&n!==r;)n=n.Next;var v=n.Pt.Y>r.Pt.Y||!d.ClipperBase.SlopesEqual4(r.Pt,n.Pt,t.OffPt);if(v){for(n=r.Prev;d.FPoint.op_Equality(n.Pt,r.Pt)&&n!==r;)n=n.Prev;if(n.Pt.Y>r.Pt.Y||!d.ClipperBase.SlopesEqual4(r.Pt,n.Pt,t.OffPt))return!1}for(s=o.Next;d.FPoint.op_Equality(s.Pt,o.Pt)&&s!==o;)s=s.Next;var y=s.Pt.Y>o.Pt.Y||!d.ClipperBase.SlopesEqual4(o.Pt,s.Pt,t.OffPt);if(y){for(s=o.Prev;d.FPoint.op_Equality(s.Pt,o.Pt)&&s!==o;)s=s.Prev;if(s.Pt.Y>o.Pt.Y||!d.ClipperBase.SlopesEqual4(o.Pt,s.Pt,t.OffPt))return!1}return n!==r&&s!==o&&n!==s&&(e!==i||v!==y)&&(v?(n=this.DupOutPt(r,!1),s=this.DupOutPt(o,!0),r.Prev=o,o.Next=r,n.Next=s,s.Prev=n,t.OutPt1=r,t.OutPt2=n,!0):(n=this.DupOutPt(r,!0),s=this.DupOutPt(o,!1),r.Next=o,o.Prev=r,n.Prev=s,s.Next=n,t.OutPt1=r,t.OutPt2=n,!0))},d.Clipper.GetBounds=function(t){for(var e=0,i=t.length;e<i&&0===t[e].length;)e++;if(e===i)return new d.FRect(0,0,0,0);var r=new d.FRect;for(r.left=t[e][0].X,r.right=r.left,r.top=t[e][0].Y,r.bottom=r.top;e<i;e++)for(var n=0,o=t[e].length;n<o;n++)t[e][n].X<r.left?r.left=t[e][n].X:t[e][n].X>r.right&&(r.right=t[e][n].X),t[e][n].Y<r.top?r.top=t[e][n].Y:t[e][n].Y>r.bottom&&(r.bottom=t[e][n].Y);return r},d.Clipper.prototype.GetBounds2=function(t){var e=t,i=new d.FRect;for(i.left=t.Pt.X,i.right=t.Pt.X,i.top=t.Pt.Y,i.bottom=t.Pt.Y,t=t.Next;t!==e;)t.Pt.X<i.left&&(i.left=t.Pt.X),t.Pt.X>i.right&&(i.right=t.Pt.X),t.Pt.Y<i.top&&(i.top=t.Pt.Y),t.Pt.Y>i.bottom&&(i.bottom=t.Pt.Y),t=t.Next;return i},d.Clipper.PointInPolygon=function(t,e){var i=0,r=e.length;if(r<3)return 0;for(var n=e[0],o=1;o<=r;++o){var s=o===r?e[0]:e[o];if(s.Y===t.Y&&(s.X===t.X||n.Y===t.Y&&s.X>t.X==n.X<t.X))return-1;if(n.Y<t.Y!=s.Y<t.Y)if(n.X>=t.X)if(s.X>t.X)i=1-i;else{if(0===(a=(n.X-t.X)*(s.Y-t.Y)-(s.X-t.X)*(n.Y-t.Y)))return-1;a>0==s.Y>n.Y&&(i=1-i)}else if(s.X>t.X){var a;if(0===(a=(n.X-t.X)*(s.Y-t.Y)-(s.X-t.X)*(n.Y-t.Y)))return-1;a>0==s.Y>n.Y&&(i=1-i)}n=s}return i},d.Clipper.prototype.PointInPolygon=function(t,e){var i=0,r=e,n=t.X,o=t.Y,s=e.Pt.X,a=e.Pt.Y;do{var h=(e=e.Next).Pt.X,l=e.Pt.Y;if(l===o&&(h===n||a===o&&h>n==s<n))return-1;if(a<o!=l<o)if(s>=n)if(h>n)i=1-i;else{if(0===(u=(s-n)*(l-o)-(h-n)*(a-o)))return-1;u>0==l>a&&(i=1-i)}else if(h>n){var u;if(0===(u=(s-n)*(l-o)-(h-n)*(a-o)))return-1;u>0==l>a&&(i=1-i)}s=h,a=l}while(r!==e);return i},d.Clipper.prototype.Poly2ContainsPoly1=function(t,e){var i=t;do{var r=this.PointInPolygon(i.Pt,e);if(r>=0)return r>0;i=i.Next}while(i!==t);return!0},d.Clipper.prototype.FixupFirstLefts1=function(t,e){for(var i,r,n=0,o=this.m_PolyOuts.length;n<o;n++)i=this.m_PolyOuts[n],r=d.Clipper.ParseFirstLeft(i.FirstLeft),null!==i.Pts&&r===t&&this.Poly2ContainsPoly1(i.Pts,e.Pts)&&(i.FirstLeft=e)},d.Clipper.prototype.FixupFirstLefts2=function(t,e){for(var i,r,n=this,o=e.FirstLeft,s=0,a=this.m_PolyOuts.length;s<a;s++)null!==(i=n.m_PolyOuts[s]).Pts&&i!==e&&i!==t&&((r=d.Clipper.ParseFirstLeft(i.FirstLeft))!==o&&r!==t&&r!==e||(n.Poly2ContainsPoly1(i.Pts,t.Pts)?i.FirstLeft=t:n.Poly2ContainsPoly1(i.Pts,e.Pts)?i.FirstLeft=e:i.FirstLeft!==t&&i.FirstLeft!==e||(i.FirstLeft=o)))},d.Clipper.prototype.FixupFirstLefts3=function(t,e){for(var i,r,n=0,o=this.m_PolyOuts.length;n<o;n++)i=this.m_PolyOuts[n],r=d.Clipper.ParseFirstLeft(i.FirstLeft),null!==i.Pts&&r===t&&(i.FirstLeft=e)},d.Clipper.ParseFirstLeft=function(t){for(;null!==t&&null===t.Pts;)t=t.FirstLeft;return t},d.Clipper.prototype.JoinCommonEdges=function(){for(var t=this,e=0,i=this.m_Joins.length;e<i;e++){var r,n=t.m_Joins[e],o=t.GetOutRec(n.OutPt1.Idx),s=t.GetOutRec(n.OutPt2.Idx);if(null!==o.Pts&&null!==s.Pts)if(!o.IsOpen&&!s.IsOpen)r=o===s?o:t.OutRec1RightOfOutRec2(o,s)?s:t.OutRec1RightOfOutRec2(s,o)?o:t.GetLowermostRec(o,s),t.JoinPoints(n,o,s)&&(o===s?(o.Pts=n.OutPt1,o.BottomPt=null,(s=t.CreateOutRec()).Pts=n.OutPt2,t.UpdateOutPtIdxs(s),t.Poly2ContainsPoly1(s.Pts,o.Pts)?(s.IsHole=!o.IsHole,s.FirstLeft=o,t.m_UsingPolyTree&&t.FixupFirstLefts2(s,o),(s.IsHole^t.ReverseSolution)==t.Area$1(s)>0&&t.ReversePolyPtLinks(s.Pts)):t.Poly2ContainsPoly1(o.Pts,s.Pts)?(s.IsHole=o.IsHole,o.IsHole=!s.IsHole,s.FirstLeft=o.FirstLeft,o.FirstLeft=s,t.m_UsingPolyTree&&t.FixupFirstLefts2(o,s),(o.IsHole^t.ReverseSolution)==t.Area$1(o)>0&&t.ReversePolyPtLinks(o.Pts)):(s.IsHole=o.IsHole,s.FirstLeft=o.FirstLeft,t.m_UsingPolyTree&&t.FixupFirstLefts1(o,s))):(s.Pts=null,s.BottomPt=null,s.Idx=o.Idx,o.IsHole=r.IsHole,r===s&&(o.FirstLeft=s.FirstLeft),s.FirstLeft=o,t.m_UsingPolyTree&&t.FixupFirstLefts3(s,o)))}},d.Clipper.prototype.UpdateOutPtIdxs=function(t){var e=t.Pts;do{e.Idx=t.Idx,e=e.Prev}while(e!==t.Pts)},d.Clipper.prototype.DoSimplePolygons=function(){for(var t=this,e=0;e<this.m_PolyOuts.length;){var i=t.m_PolyOuts[e++],r=i.Pts;if(null!==r&&!i.IsOpen)do{for(var n=r.Next;n!==i.Pts;){if(d.FPoint.op_Equality(r.Pt,n.Pt)&&n.Next!==r&&n.Prev!==r){var o=r.Prev,s=n.Prev;r.Prev=s,s.Next=r,n.Prev=o,o.Next=n,i.Pts=r;var a=t.CreateOutRec();a.Pts=n,t.UpdateOutPtIdxs(a),t.Poly2ContainsPoly1(a.Pts,i.Pts)?(a.IsHole=!i.IsHole,a.FirstLeft=i,t.m_UsingPolyTree&&t.FixupFirstLefts2(a,i)):t.Poly2ContainsPoly1(i.Pts,a.Pts)?(a.IsHole=i.IsHole,i.IsHole=!a.IsHole,a.FirstLeft=i.FirstLeft,i.FirstLeft=a,t.m_UsingPolyTree&&t.FixupFirstLefts2(i,a)):(a.IsHole=i.IsHole,a.FirstLeft=i.FirstLeft,t.m_UsingPolyTree&&t.FixupFirstLefts1(i,a)),n=r}n=n.Next}r=r.Next}while(r!==i.Pts)}},d.Clipper.Area=function(t){if(!Array.isArray(t))return 0;var e=t.length;if(e<3)return 0;for(var i=0,r=0,n=e-1;r<e;++r)i+=(t[n].X+t[r].X)*(t[n].Y-t[r].Y),n=r;return.5*-i},d.Clipper.prototype.Area=function(t){var e=t;if(null===t)return 0;var i=0;do{i+=(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next}while(t!==e);return.5*i},d.Clipper.prototype.Area$1=function(t){return this.Area(t.Pts)},d.Clipper.SimplifyPolygon=function(t,e){var i=new Array,r=new d.Clipper(0);return r.StrictlySimple=!0,r.AddPath(t,d.PolyType.ptSubject,!0),r.Execute(d.ClipType.ctUnion,i,e,e),i},d.Clipper.SimplifyPolygons=function(t,e){void 0===e&&(e=d.PolyFillType.pftEvenOdd);var i=new Array,r=new d.Clipper(0);return r.StrictlySimple=!0,r.AddPaths(t,d.PolyType.ptSubject,!0),r.Execute(d.ClipType.ctUnion,i,e,e),i},d.Clipper.DistanceSqrd=function(t,e){var i=t.X-e.X,r=t.Y-e.Y;return i*i+r*r},d.Clipper.DistanceFromLineSqrd=function(t,e,i){var r=e.Y-i.Y,n=i.X-e.X,o=r*e.X+n*e.Y;return(o=r*t.X+n*t.Y-o)*o/(r*r+n*n)},d.Clipper.SlopesNearCollinear=function(t,e,i,r){return Math.abs(t.X-e.X)>Math.abs(t.Y-e.Y)?t.X>e.X==t.X<i.X?d.Clipper.DistanceFromLineSqrd(t,e,i)<r:e.X>t.X==e.X<i.X?d.Clipper.DistanceFromLineSqrd(e,t,i)<r:d.Clipper.DistanceFromLineSqrd(i,t,e)<r:t.Y>e.Y==t.Y<i.Y?d.Clipper.DistanceFromLineSqrd(t,e,i)<r:e.Y>t.Y==e.Y<i.Y?d.Clipper.DistanceFromLineSqrd(e,t,i)<r:d.Clipper.DistanceFromLineSqrd(i,t,e)<r},d.Clipper.PointsAreClose=function(t,e,i){var r=t.X-e.X,n=t.Y-e.Y;return r*r+n*n<=i},d.Clipper.ExcludeOp=function(t){var e=t.Prev;return e.Next=t.Next,t.Next.Prev=e,e.Idx=0,e},d.Clipper.CleanPolygon=function(t,e){void 0===e&&(e=1.415);var i=t.length;if(0===i)return new Array;for(var r=new Array(i),n=0;n<i;++n)r[n]=new d.OutPt;for(n=0;n<i;++n)r[n].Pt=t[n],r[n].Next=r[(n+1)%i],r[n].Next.Prev=r[n],r[n].Idx=0;for(var o=e*e,s=r[0];0===s.Idx&&s.Next!==s.Prev;)d.Clipper.PointsAreClose(s.Pt,s.Prev.Pt,o)?(s=d.Clipper.ExcludeOp(s),i--):d.Clipper.PointsAreClose(s.Prev.Pt,s.Next.Pt,o)?(d.Clipper.ExcludeOp(s.Next),s=d.Clipper.ExcludeOp(s),i-=2):d.Clipper.SlopesNearCollinear(s.Prev.Pt,s.Pt,s.Next.Pt,o)?(s=d.Clipper.ExcludeOp(s),i--):(s.Idx=1,s=s.Next);i<3&&(i=0);var a=new Array(i);for(n=0;n<i;++n)a[n]=new d.FPoint1(s.Pt),s=s.Next;return r=null,a},d.Clipper.CleanPolygons=function(t,e){for(var i=new Array(t.length),r=0,n=t.length;r<n;r++)i[r]=d.Clipper.CleanPolygon(t[r],e);return i},d.Clipper.Minkowski=function(t,e,i,r){var n=r?1:0,o=t.length,s=e.length,a=new Array;if(i)for(var h=0;h<s;h++){for(var l=new Array(o),u=0,p=t.length,c=t[u];u<p;c=t[++u])l[u]=new d.FPoint2(e[h].X+c.X,e[h].Y+c.Y);a.push(l)}else for(h=0;h<s;h++){for(l=new Array(o),u=0,p=t.length,c=t[u];u<p;c=t[++u])l[u]=new d.FPoint2(e[h].X-c.X,e[h].Y-c.Y);a.push(l)}var f=new Array;for(h=0;h<s-1+n;h++)for(u=0;u<o;u++){var v=new Array;v.push(a[h%s][u%o]),v.push(a[(h+1)%s][u%o]),v.push(a[(h+1)%s][(u+1)%o]),v.push(a[h%s][(u+1)%o]),d.Clipper.Orientation(v)||v.reverse(),f.push(v)}return f},d.Clipper.MinkowskiSum=function(t,e,i){if(e[0]instanceof Array){h=e;for(var r=new d.Paths,n=(s=new d.Clipper,0);n<h.length;++n){var o=d.Clipper.Minkowski(t,h[n],!0,i);if(s.AddPaths(o,d.PolyType.ptSubject,!0),i){a=d.Clipper.TranslatePath(h[n],t[0]);s.AddPath(a,d.PolyType.ptClip,!0)}}return s.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftNonZero,d.PolyFillType.pftNonZero),r}var s,a=e,h=d.Clipper.Minkowski(t,a,!0,i);return(s=new d.Clipper).AddPaths(h,d.PolyType.ptSubject,!0),s.Execute(d.ClipType.ctUnion,h,d.PolyFillType.pftNonZero,d.PolyFillType.pftNonZero),h},d.Clipper.TranslatePath=function(t,e){for(var i=new d.Path,r=0;r<t.length;r++)i.push(new d.FPoint2(t[r].X+e.X,t[r].Y+e.Y));return i},d.Clipper.MinkowskiDiff=function(t,e){var i=d.Clipper.Minkowski(t,e,!1,!0),r=new d.Clipper;return r.AddPaths(i,d.PolyType.ptSubject,!0),r.Execute(d.ClipType.ctUnion,i,d.PolyFillType.pftNonZero,d.PolyFillType.pftNonZero),i},d.Clipper.PolyTreeToPaths=function(t){var e=new Array;return d.Clipper.AddPolyNodeToPaths(t,d.Clipper.NodeType.ntAny,e),e},d.Clipper.AddPolyNodeToPaths=function(t,e,i){var r=!0;switch(e){case d.Clipper.NodeType.ntOpen:return;case d.Clipper.NodeType.ntClosed:r=!t.IsOpen}t.m_polygon.length>0&&r&&i.push(t.m_polygon);for(var n=0,o=t.Childs(),s=o.length,a=o[n];n<s;a=o[++n])d.Clipper.AddPolyNodeToPaths(a,e,i)},d.Clipper.OpenPathsFromPolyTree=function(t){for(var e=new d.Paths,i=0,r=t.ChildCount();i<r;i++)t.Childs()[i].IsOpen&&e.push(t.Childs()[i].m_polygon);return e},d.Clipper.ClosedPathsFromPolyTree=function(t){var e=new d.Paths;return d.Clipper.AddPolyNodeToPaths(t,d.Clipper.NodeType.ntClosed,e),e},f(d.Clipper,d.ClipperBase),d.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},d.ClipperOffset=function(t,e){void 0===t&&(t=2),void 0===e&&(e=d.ClipperOffset.def_arc_tolerance),this.m_destPolys=new d.Paths,this.m_srcPoly=new d.Path,this.m_destPoly=new d.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new d.FPoint0,this.m_polyNodes=new d.PolyNode,this.MiterLimit=t,this.ArcTolerance=e,this.m_lowest.X=-1},d.ClipperOffset.two_pi=6.28318530717959,d.ClipperOffset.def_arc_tolerance=.25,d.ClipperOffset.prototype.Clear=function(){d.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},d.ClipperOffset.prototype.AddPath=function(t,e,i){var r=t.length-1;if(!(r<0)){var n=new d.PolyNode;if(n.m_jointype=e,n.m_endtype=i,i===d.EndType.etClosedLine||i===d.EndType.etClosedPolygon)for(;r>0&&d.FPoint.op_Equality(t[0],t[r]);)r--;n.m_polygon.push(t[0]);for(var o=0,s=0,a=1;a<=r;a++)d.FPoint.op_Inequality(n.m_polygon[o],t[a])&&(o++,n.m_polygon.push(t[a]),(t[a].Y>n.m_polygon[s].Y||t[a].Y===n.m_polygon[s].Y&&t[a].X<n.m_polygon[s].X)&&(s=o));if(!(i===d.EndType.etClosedPolygon&&o<2)&&(this.m_polyNodes.AddChild(n),i===d.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new d.FPoint2(this.m_polyNodes.ChildCount()-1,s);else{var h=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[s].Y>h.Y||n.m_polygon[s].Y===h.Y&&n.m_polygon[s].X<h.X)&&(this.m_lowest=new d.FPoint2(this.m_polyNodes.ChildCount()-1,s))}}},d.ClipperOffset.prototype.AddPaths=function(t,e,i){for(var r=0,n=t.length;r<n;r++)this.AddPath(t[r],e,i)},d.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!d.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var t=0;t<this.m_polyNodes.ChildCount();t++){((e=this.m_polyNodes.Childs()[t]).m_endtype===d.EndType.etClosedPolygon||e.m_endtype===d.EndType.etClosedLine&&d.Clipper.Orientation(e.m_polygon))&&e.m_polygon.reverse()}else for(t=0;t<this.m_polyNodes.ChildCount();t++){var e;(e=this.m_polyNodes.Childs()[t]).m_endtype!==d.EndType.etClosedLine||d.Clipper.Orientation(e.m_polygon)||e.m_polygon.reverse()}},d.ClipperOffset.GetUnitNormal=function(t,e){var i=e.X-t.X,r=e.Y-t.Y;if(0===i&&0===r)return new d.FPoint2(0,0);var n=1/Math.sqrt(i*i+r*r);return i*=n,r*=n,new d.FPoint2(r,-i)},d.ClipperOffset.prototype.DoOffset=function(t){var e=this;if(this.m_destPolys=new Array,this.m_delta=t,d.ClipperBase.near_zero(t))for(var i=0;i<this.m_polyNodes.ChildCount();i++){(o=e.m_polyNodes.Childs()[i]).m_endtype===d.EndType.etClosedPolygon&&e.m_destPolys.push(o.m_polygon)}else{var r;this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5,r=this.ArcTolerance<=0?d.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*d.ClipperOffset.def_arc_tolerance?Math.abs(t)*d.ClipperOffset.def_arc_tolerance:this.ArcTolerance;var n=3.14159265358979/Math.acos(1-r/Math.abs(t));this.m_sin=Math.sin(d.ClipperOffset.two_pi/n),this.m_cos=Math.cos(d.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/d.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(i=0;i<this.m_polyNodes.ChildCount();i++){var o=e.m_polyNodes.Childs()[i];e.m_srcPoly=o.m_polygon;var s=e.m_srcPoly.length;if(!(0===s||t<=0&&(s<3||o.m_endtype!==d.EndType.etClosedPolygon)))if(e.m_destPoly=new Array,1!==s){e.m_normals.length=0;for(c=0;c<s-1;c++)e.m_normals.push(d.ClipperOffset.GetUnitNormal(e.m_srcPoly[c],e.m_srcPoly[c+1]));if(o.m_endtype===d.EndType.etClosedLine||o.m_endtype===d.EndType.etClosedPolygon?e.m_normals.push(d.ClipperOffset.GetUnitNormal(e.m_srcPoly[s-1],e.m_srcPoly[0])):e.m_normals.push(new d.FPoint1(e.m_normals[s-2])),o.m_endtype===d.EndType.etClosedPolygon){var a=s-1;for(c=0;c<s;c++)a=e.OffsetPoint(c,a,o.m_jointype);e.m_destPolys.push(e.m_destPoly)}else if(o.m_endtype===d.EndType.etClosedLine){for(a=s-1,c=0;c<s;c++)a=e.OffsetPoint(c,a,o.m_jointype);e.m_destPolys.push(e.m_destPoly),e.m_destPoly=new Array;var h=e.m_normals[s-1];for(c=s-1;c>0;c--)e.m_normals[c]=new d.FPoint2(-e.m_normals[c-1].X,-e.m_normals[c-1].Y);e.m_normals[0]=new d.FPoint2(-h.X,-h.Y),a=0;for(c=s-1;c>=0;c--)a=e.OffsetPoint(c,a,o.m_jointype);e.m_destPolys.push(e.m_destPoly)}else{var l;for(a=0,c=1;c<s-1;++c)a=e.OffsetPoint(c,a,o.m_jointype);if(o.m_endtype===d.EndType.etOpenButt){c=s-1;l=new d.FPoint2(e.m_srcPoly[c].X+e.m_normals[c].X*t,e.m_srcPoly[c].Y+e.m_normals[c].Y*t),e.m_destPoly.push(l),l=new d.FPoint2(e.m_srcPoly[c].X-e.m_normals[c].X*t,e.m_srcPoly[c].Y-e.m_normals[c].Y*t),e.m_destPoly.push(l)}else{c=s-1;a=s-2,e.m_sinA=0,e.m_normals[c]=new d.FPoint2(-e.m_normals[c].X,-e.m_normals[c].Y),o.m_endtype===d.EndType.etOpenSquare?e.DoSquare(c,a):e.DoRound(c,a)}for(c=s-1;c>0;c--)e.m_normals[c]=new d.FPoint2(-e.m_normals[c-1].X,-e.m_normals[c-1].Y);e.m_normals[0]=new d.FPoint2(-e.m_normals[1].X,-e.m_normals[1].Y);for(c=(a=s-1)-1;c>0;--c)a=e.OffsetPoint(c,a,o.m_jointype);o.m_endtype===d.EndType.etOpenButt?(l=new d.FPoint2(e.m_srcPoly[0].X-e.m_normals[0].X*t,e.m_srcPoly[0].Y-e.m_normals[0].Y*t),e.m_destPoly.push(l),l=new d.FPoint2(e.m_srcPoly[0].X+e.m_normals[0].X*t,e.m_srcPoly[0].Y+e.m_normals[0].Y*t),e.m_destPoly.push(l)):(a=1,e.m_sinA=0,o.m_endtype===d.EndType.etOpenSquare?e.DoSquare(0,1):e.DoRound(0,1)),e.m_destPolys.push(e.m_destPoly)}}else{if(o.m_jointype===d.JoinType.jtRound)for(var u=1,p=0,c=1;c<=n;c++){e.m_destPoly.push(new d.FPoint2(e.m_srcPoly[0].X+u*t,e.m_srcPoly[0].Y+p*t));var f=u;u=u*e.m_cos-e.m_sin*p,p=f*e.m_sin+p*e.m_cos}else{u=-1,p=-1;for(var c=0;c<4;++c)e.m_destPoly.push(new d.FPoint2(e.m_srcPoly[0].X+u*t,e.m_srcPoly[0].Y+p*t)),u<0?u=1:p<0?p=1:u=-1}e.m_destPolys.push(e.m_destPoly)}}}},d.ClipperOffset.prototype.Execute=function(){var t=arguments,e=t[0]instanceof d.PolyTree;if(e){o=t[0],s=t[1];if(o.Clear(),this.FixOrientations(),this.DoOffset(s),(n=new d.Clipper(0)).AddPaths(this.m_destPolys,d.PolyType.ptSubject,!0),s>0)n.Execute(d.ClipType.ctUnion,o,d.PolyFillType.pftPositive,d.PolyFillType.pftPositive);else{h=d.Clipper.GetBounds(this.m_destPolys);if((a=new d.Path).push(new d.FPoint2(h.left-10,h.bottom+10)),a.push(new d.FPoint2(h.right+10,h.bottom+10)),a.push(new d.FPoint2(h.right+10,h.top-10)),a.push(new d.FPoint2(h.left-10,h.top-10)),n.AddPath(a,d.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(d.ClipType.ctUnion,o,d.PolyFillType.pftNegative,d.PolyFillType.pftNegative),1===o.ChildCount()&&o.Childs()[0].ChildCount()>0){var i=o.Childs()[0];o.Childs()[0]=i.Childs()[0],o.Childs()[0].m_Parent=o;for(var r=1;r<i.ChildCount();r++)o.AddChild(i.Childs()[r])}else o.Clear()}}else{var n,o=t[0],s=t[1];if(d.Clear(o),this.FixOrientations(),this.DoOffset(s),(n=new d.Clipper(0)).AddPaths(this.m_destPolys,d.PolyType.ptSubject,!0),s>0)n.Execute(d.ClipType.ctUnion,o,d.PolyFillType.pftPositive,d.PolyFillType.pftPositive);else{var a,h=d.Clipper.GetBounds(this.m_destPolys);(a=new d.Path).push(new d.FPoint2(h.left-10,h.bottom+10)),a.push(new d.FPoint2(h.right+10,h.bottom+10)),a.push(new d.FPoint2(h.right+10,h.top-10)),a.push(new d.FPoint2(h.left-10,h.top-10)),n.AddPath(a,d.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(d.ClipType.ctUnion,o,d.PolyFillType.pftNegative,d.PolyFillType.pftNegative),o.length>0&&o.splice(0,1)}}},d.ClipperOffset.prototype.OffsetPoint=function(t,e,i){if(this.m_sinA=this.m_normals[e].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[e].Y,0===this.m_sinA)return e;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new d.FPoint2(this.m_srcPoly[t].X+this.m_normals[e].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[e].Y*this.m_delta)),this.m_destPoly.push(new d.FPoint1(this.m_srcPoly[t])),this.m_destPoly.push(new d.FPoint2(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta));else switch(i){case d.JoinType.jtMiter:var r=this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y+1;r>=this.m_miterLim?this.DoMiter(t,e,r):this.DoSquare(t,e);break;case d.JoinType.jtSquare:this.DoSquare(t,e);break;case d.JoinType.jtRound:this.DoRound(t,e)}return e=t},d.ClipperOffset.prototype.DoSquare=function(t,e){var i=Math.tan(Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y)/4);this.m_destPoly.push(new d.FPoint2(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[e].X-this.m_normals[e].Y*i),this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[e].Y+this.m_normals[e].X*i))),this.m_destPoly.push(new d.FPoint2(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*i),this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*i)))},d.ClipperOffset.prototype.DoMiter=function(t,e,i){var r=this.m_delta/i;this.m_destPoly.push(new d.FPoint2(this.m_srcPoly[t].X+(this.m_normals[e].X+this.m_normals[t].X)*r,this.m_srcPoly[t].Y+(this.m_normals[e].Y+this.m_normals[t].Y)*r))},d.ClipperOffset.prototype.DoRound=function(t,e){for(var i,r=this,n=Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y),o=Math.max(Math.round(this.m_StepsPerRad*Math.abs(n)),1),s=this.m_normals[e].X,a=this.m_normals[e].Y,h=0;h<o;++h)r.m_destPoly.push(new d.FPoint2(r.m_srcPoly[t].X+s*r.m_delta,r.m_srcPoly[t].Y+a*r.m_delta)),i=s,s=s*r.m_cos-r.m_sin*a,a=i*r.m_sin+a*r.m_cos;this.m_destPoly.push(new d.FPoint2(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta))},d.Error=function(t){try{throw new Error(t)}catch(t){alert(t.message)}},d.JS={},d.JS.AreaOfPolygon=function(t){return d.Clipper.Area(t)},d.JS.AreaOfPolygons=function(t){for(var e=0,i=0;i<t.length;i++)e+=d.Clipper.Area(t[i]);return e},d.JS.BoundsOfPath=function(t){return d.JS.BoundsOfPaths([t])},d.JS.BoundsOfPaths=function(t){return d.Clipper.GetBounds(t)},d.JS.Clean=function(t,e){if(!(t instanceof Array))return[];var i=t[0]instanceof Array;t=d.JS.Clone(t);if("number"!=typeof e||null===e)return d.Error("Delta is not a number in Clean()."),t;if(0===t.length||1===t.length&&0===t[0].length||e<0)return t;i||(t=[t]);for(var r,n,o,s,a,h,l,u=t.length,p=[],c=0;c<u;c++)if(0!==(r=(n=t[c]).length))if(r<3)o=n,p.push(o);else{for(o=n,s=e*e,a=n[0],h=1,l=1;l<r;l++)(n[l].X-a.X)*(n[l].X-a.X)+(n[l].Y-a.Y)*(n[l].Y-a.Y)<=s||(o[h]=n[l],a=n[l],h++);a=n[h-1],(n[0].X-a.X)*(n[0].X-a.X)+(n[0].Y-a.Y)*(n[0].Y-a.Y)<=s&&h--,h<r&&o.splice(h,r-h),o.length&&p.push(o)}return!i&&p.length?p=p[0]:i||0!==p.length?i&&0===p.length&&(p=[[]]):p=[],p},d.JS.Clone=function(t){if(!(t instanceof Array))return[];if(0===t.length)return[];if(1===t.length&&0===t[0].length)return[[]];var e=t[0]instanceof Array;e||(t=[t]);var i,r,n,o,s=t.length,a=new Array(s);for(r=0;r<s;r++){for(i=t[r].length,o=new Array(i),n=0;n<i;n++)o[n]={X:t[r][n].X,Y:t[r][n].Y};a[r]=o}return e||(a=a[0]),a},d.JS.Lighten=function(t,e){if(!(t instanceof Array))return[];if("number"!=typeof e||null===e)return d.Error("Tolerance is not a number in Lighten()."),d.JS.Clone(t);if(0===t.length||1===t.length&&0===t[0].length||e<0)return d.JS.Clone(t);var i,r,n,o,s,a,h,l,u,p,c,f,v,y,g,m,_=t[0]instanceof Array;_||(t=[t]);var x=t.length,b=e*e,P=[];for(i=0;i<x;i++)if(0!==(a=(n=t[i]).length)){for(o=0;o<1e6;o++){for(s=[],n[(a=n.length)-1].X!==n[0].X||n[a-1].Y!==n[0].Y?(c=1,n.push({X:n[0].X,Y:n[0].Y}),a=n.length):c=0,p=[],r=0;r<a-2;r++)h=n[r],u=n[r+1],l=n[r+2],g=h.X,m=h.Y,f=l.X-g,v=l.Y-m,0===f&&0===v||((y=((u.X-g)*f+(u.Y-m)*v)/(f*f+v*v))>1?(g=l.X,m=l.Y):y>0&&(g+=f*y,m+=v*y)),(f=u.X-g)*f+(v=u.Y-m)*v<=b&&(p[r+1]=1,r++);for(s.push({X:n[0].X,Y:n[0].Y}),r=1;r<a-1;r++)p[r]||s.push({X:n[r].X,Y:n[r].Y});if(s.push({X:n[a-1].X,Y:n[a-1].Y}),c&&n.pop(),!p.length)break;n=s}s[(a=s.length)-1].X===s[0].X&&s[a-1].Y===s[0].Y&&s.pop(),s.length>2&&P.push(s)}return _||(P=P[0]),void 0===P&&(P=[]),P},d.JS.PerimeterOfPath=function(t,e){if(void 0===t)return 0;var i,r,n=Math.sqrt,o=0,s=0,a=0,h=0,l=0,u=t.length;if(u<2)return 0;for(e&&(t[u]=t[0],u++);--u;)s=(i=t[u]).X,a=i.Y,o+=n((s-(h=(r=t[u-1]).X))*(s-h)+(a-(l=r.Y))*(a-l));return e&&t.pop(),o},d.JS.PerimeterOfPaths=function(t,e){for(var i=0,r=0;r<t.length;r++)i+=d.JS.PerimeterOfPath(t[r],e);return i},d.ExPolygons=function(){return[]},d.ExPolygon=function(){this.outer=null,this.holes=null},d.JS.AddOuterPolyNodeToExPolygons=function(t,e){var i=new d.ExPolygon;i.outer=t.Contour();var r,n,o,s,a,h,l=t.Childs(),u=l.length;for(i.holes=new Array(u),o=0;o<u;o++)for(r=l[o],i.holes[o]=r.Contour(),s=0,h=(a=r.Childs()).length;s<h;s++)n=a[s],d.JS.AddOuterPolyNodeToExPolygons(n,e);e.push(i)},d.JS.ExPolygonsToPaths=function(t){var e,i,r,n,o=new d.Paths;for(e=0,r=t.length;e<r;e++)for(o.push(t[e].outer),i=0,n=t[e].holes.length;i<n;i++)o.push(t[e].holes[i]);return o},d.JS.PolyTreeToExPolygons=function(t){var e,i,r,n,o=new d.ExPolygons;for(i=0,n=(r=t.Childs()).length;i<n;i++)e=r[i],d.JS.AddOuterPolyNodeToExPolygons(e,o);return o};var v=d;function y(t,e){return t<e?-1:t>e?1:0}var g=Object.freeze({__proto__:null,default:class{constructor(t=[],e=y){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}}peek(){return this.data[0]}_up(t){for(var{data:e,compare:i}=this,r=e[t];t>0;){var n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r}_down(t){for(var{data:e,compare:i}=this,r=this.length>>1,n=e[t];t<r;){var o=1+(t<<1),s=e[o],a=o+1;if(a<this.length&&i(e[a],s)<0&&(o=a,s=e[a]),i(s,n)>=0)break;e[t]=s,t=o}e[t]=n}}}),m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})})),e}function x(t){var e={exports:{}};return t(e,e.exports),e.exports}var b=_(g);b.default&&(b=b.default);var P=E,w=E;function E(t,e,i){var r,n,o,s;e=e||1;for(var a=0;a<t[0].length;a++){var h=t[0][a];(!a||h[0]<r)&&(r=h[0]),(!a||h[1]<n)&&(n=h[1]),(!a||h[0]>o)&&(o=h[0]),(!a||h[1]>s)&&(s=h[1])}var l=o-r,u=s-n,p=Math.min(l,u),c=p/2;if(0===p){var d=[r,n];return d.distance=0,d}for(var f=new b(void 0,T),v=r;v<o;v+=p)for(var y=n;y<s;y+=p)f.push(new C(v+c,y+c,c,t));var g=function(t){for(var e=0,i=0,r=0,n=t[0],o=0,s=n.length,a=s-1;o<s;a=o++){var h=n[o],l=n[a],u=h[0]*l[1]-l[0]*h[1];i+=(h[0]+l[0])*u,r+=(h[1]+l[1])*u,e+=3*u}return 0===e?new C(n[0][0],n[0][1],0,t):new C(i/e,r/e,0,t)}(t),m=new C(r+l/2,n+u/2,0,t);m.d>g.d&&(g=m);for(var _=f.length;f.length;){var x=f.pop();x.d>g.d&&(g=x,i&&console.log("found best %d after %d probes",Math.round(1e4*x.d)/1e4,_)),x.max-g.d<=e||(c=x.h/2,f.push(new C(x.x-c,x.y-c,c,t)),f.push(new C(x.x+c,x.y-c,c,t)),f.push(new C(x.x-c,x.y+c,c,t)),f.push(new C(x.x+c,x.y+c,c,t)),_+=4)}i&&(console.log("num probes: "+_),console.log("best distance: "+g.d));var P=[g.x,g.y];return P.distance=g.d,P}function T(t,e){return e.max-t.max}function C(t,e,i,r){this.x=t,this.y=e,this.h=i,this.d=function(t,e,i){for(var r=!1,n=1/0,o=0;o<i.length;o++)for(var s=i[o],a=0,h=s.length,l=h-1;a<h;l=a++){var u=s[a],p=s[l];u[1]>e!=p[1]>e&&t<(p[0]-u[0])*(e-u[1])/(p[1]-u[1])+u[0]&&(r=!r),n=Math.min(n,I(t,e,u,p))}return 0===n?0:(r?1:-1)*Math.sqrt(n)}(t,e,r),this.max=this.d+this.h*Math.SQRT2}function I(t,e,i,r){var n=i[0],o=i[1],s=r[0]-n,a=r[1]-o;if(0!==s||0!==a){var h=((t-n)*s+(e-o)*a)/(s*s+a*a);h>1?(n=r[0],o=r[1]):h>0&&(n+=s*h,o+=a*h)}return(s=t-n)*s+(a=e-o)*a}P.default=w;var S,O="undefined"!=typeof Float32Array?Float32Array:Array;function A(){var t=new O(6);return O!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function M(){var t=new O(2);return O!=Float32Array&&(t[0]=0,t[1]=0),t}function L(t,e){var i=new O(2);return i[0]=t,i[1]=e,i}function N(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function R(t,e){return t[0]*e[0]+t[1]*e[1]}function D(t,e,i){var r=e[0],n=e[1];return t[0]=i[0]*r+i[2]*n+i[4],t[1]=i[1]*r+i[3]*n+i[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),M();var k=new Uint8Array(16);function F(){if(!S&&!(S="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S(k)}var B=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(t){return"string"==typeof t&&B.test(t)}for(var z=[],X=0;X<256;++X)z.push((X+256).toString(16).substr(1));function j(t,e,i){var r=(t=t||{}).random||(t.rng||F)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){i=i||0;for(var n=0;n<16;++n)e[i+n]=r[n];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(z[t[e+0]]+z[t[e+1]]+z[t[e+2]]+z[t[e+3]]+"-"+z[t[e+4]]+z[t[e+5]]+"-"+z[t[e+6]]+z[t[e+7]]+"-"+z[t[e+8]]+z[t[e+9]]+"-"+z[t[e+10]]+z[t[e+11]]+z[t[e+12]]+z[t[e+13]]+z[t[e+14]]+z[t[e+15]]).toLowerCase();if(!U(i))throw TypeError("Stringified UUID is invalid");return i}(r)}function Y(){}Y.prototype={on:function(t,e,i){var r=this.e||(this.e={});return(r[t]||(r[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){var r=this;function n(){r.off(t,n),e.apply(i,arguments)}return n._=e,this.on(t,n,i)},emit:function(t){for(var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),r=0,n=i.length;r<n;r++)i[r].fn.apply(i[r].ctx,e);return this},off:function(t,e){var i=this.e||(this.e={}),r=i[t],n=[];if(r&&e)for(var o=0,s=r.length;o<s;o++)r[o].fn!==e&&r[o].fn._!==e&&n.push(r[o]);return n.length?i[t]=n:delete i[t],this}};var H=Y,G=Y;H.TinyEmitter=G;var W,V,q=x((function(t,e){var i=function(){var t={},e=Math.PI/180,i=180/Math.PI,r=6378137,n=20037508.342789244;function o(t){return Number(t)===t&&t%1!=0}function s(e){if(e=e||{},this.size=e.size||256,this.expansion=!0===e.antimeridian?2:1,!t[this.size]){var i=this.size,r=t[this.size]={};r.Bc=[],r.Cc=[],r.zc=[],r.Ac=[];for(var n=0;n<30;n++)r.Bc.push(i/360),r.Cc.push(i/(2*Math.PI)),r.zc.push(i/2),r.Ac.push(i),i*=2}this.Bc=t[this.size].Bc,this.Cc=t[this.size].Cc,this.zc=t[this.size].zc,this.Ac=t[this.size].Ac}return s.prototype.px=function(t,i){if(o(i)){var r=this.size*Math.pow(2,i),n=r/2,s=r/360,a=r/(2*Math.PI),h=r,l=Math.min(Math.max(Math.sin(e*t[1]),-.9999),.9999),u=n+t[0]*s,p=n+.5*Math.log((1+l)/(1-l))*-a;return u>h*this.expansion&&(u=h*this.expansion),p>h&&(p=h),[u,p]}n=this.zc[i],l=Math.min(Math.max(Math.sin(e*t[1]),-.9999),.9999),u=Math.round(n+t[0]*this.Bc[i]),p=Math.round(n+.5*Math.log((1+l)/(1-l))*-this.Cc[i]);return u>this.Ac[i]*this.expansion&&(u=this.Ac[i]*this.expansion),p>this.Ac[i]&&(p=this.Ac[i]),[u,p]},s.prototype.ll=function(t,e){if(o(e)){var r=this.size*Math.pow(2,e),n=r/360,s=r/(2*Math.PI),a=r/2,h=(t[1]-a)/-s;return[(t[0]-a)/n,i*(2*Math.atan(Math.exp(h))-.5*Math.PI)]}h=(t[1]-this.zc[e])/-this.Cc[e];return[(t[0]-this.zc[e])/this.Bc[e],i*(2*Math.atan(Math.exp(h))-.5*Math.PI)]},s.prototype.bbox=function(t,e,i,r,n){r&&(e=Math.pow(2,i)-1-e);var o=[t*this.size,(+e+1)*this.size],s=[(+t+1)*this.size,e*this.size],a=this.ll(o,i).concat(this.ll(s,i));return"900913"===n?this.convert(a,"900913"):a},s.prototype.xyz=function(t,e,i,r){"900913"===r&&(t=this.convert(t,"WGS84"));var n=[t[0],t[1]],o=[t[2],t[3]],s=this.px(n,e),a=this.px(o,e),h=[Math.floor(s[0]/this.size),Math.floor((a[0]-1)/this.size)],l=[Math.floor(a[1]/this.size),Math.floor((s[1]-1)/this.size)],u={minX:Math.min.apply(Math,h)<0?0:Math.min.apply(Math,h),minY:Math.min.apply(Math,l)<0?0:Math.min.apply(Math,l),maxX:Math.max.apply(Math,h),maxY:Math.max.apply(Math,l)};if(i){var p={minY:Math.pow(2,e)-1-u.maxY,maxY:Math.pow(2,e)-1-u.minY};u.minY=p.minY,u.maxY=p.maxY}return u},s.prototype.convert=function(t,e){return"900913"===e?this.forward(t.slice(0,2)).concat(this.forward(t.slice(2,4))):this.inverse(t.slice(0,2)).concat(this.inverse(t.slice(2,4)))},s.prototype.forward=function(t){var i=[r*t[0]*e,r*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return i[0]>n&&(i[0]=n),i[0]<-n&&(i[0]=-n),i[1]>n&&(i[1]=n),i[1]<-n&&(i[1]=-n),i},s.prototype.inverse=function(t){return[t[0]*i/r,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/r)))*i]},s}();t.exports=i}));function Z(t,e){var i;return i=e?st(e):{x:0,y:0,z:0},J(st(t),i)}function J(t,e){e||(e={x:0,y:0,z:0});var i=rt(e,t);return Math.sqrt(i.x*i.x+i.y*i.y+i.z*i.z)}function K(t,e){e||(e={x:0,z:0});var i=nt(e,t);return Math.sqrt(i.x*i.x+i.z*i.z)}function Q(t){var e=K(t);return{x:t.x/e,z:t.z/e}}function $(t,e){return t||(t={x:0,z:0}),ht(180*Math.atan2(-e.z+t.z,e.x-t.x)/Math.PI,2)}function tt(t,e,i,r){return{x:((r.x-i.x)*(e.x*t.z-t.x*e.z)-(e.x-t.x)*(r.x*i.z-i.x*r.z))/((r.z-i.z)*(e.x-t.x)-(e.z-t.z)*(r.x-i.x)),z:((t.z-e.z)*(r.x*i.z-i.x*r.z)-(i.z-r.z)*(e.x*t.z-t.x*e.z))/((r.z-i.z)*(e.x-t.x)-(e.z-t.z)*(r.x-i.x))}}function et(t,e,i,r=0){var n,o,s=nt(t,e),a=nt(t,i),h=nt(i,e),l=J((n=st(s),o=st(a),{x:n.y*o.z-n.z*o.y,y:n.z*o.x-n.x*o.z,z:n.x*o.y-n.y*o.x})),u=function(t,e){return t.x*e.x+t.z*e.z}(h,s);return ht(l,4)<=2*r&&u>=0&&K(s)<=K(h)}function it(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function rt(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function nt(t,e){return{x:t.x-e.x,z:t.z-e.z}}function ot(t,e){return{x:t.x*e,z:t.z*e}}function st(t){return{x:t.x,y:(null==t?void 0:t.y)||0,z:t.z}}function at(t){return 2==t.length?{x:t[0],y:0,z:t[1]}:{x:t[0],y:t[1],z:t[2]}}function ht(t,e=0){var i=Math.pow(10,e);return Math.round(t*i)/i}function lt(t){var e=xt(t),i=v.Clipper.GetBounds(e);return{x:i.left,x2:i.right,z:i.top,z2:i.bottom,length:i.right-i.left,width:i.bottom-i.top}}function ut(t){if(!Array.isArray(t))throw new Error("Union failed, input not Array");if(!t.length||!t[0])throw new Error("Union failed, empty Array");var e=xt(t),i=[e[0]],r=e.slice(1),n=new v.Clipper;n.AddPaths(i,v.PolyType.ptSubject,!0),n.AddPaths(r,v.PolyType.ptClip,!0);var o=new v.Paths;return n.Execute(v.ClipType.ctUnion,o,v.PolyFillType.pftNonZero,v.PolyFillType.pftNonZero),bt(o)}function pt(t,e=.1,i,r){if(void 0===i&&(i=v.EndType.etClosedPolygon),!(t=r?t:mt(t)).length||!t[0].length)return[];e=e&&"number"==typeof e?e:.1;var n=xt(t),o=new v.ClipperOffset(2),s=new v.Paths;return o.AddPaths(n,v.JoinType.jtMiter,i),o.Execute(s,e),bt(s)}function ct(t,e,i,r){if(!Array.isArray(t))throw new Error("Difference failed, input not Array");if(!t.length||!t[0])throw new Error("Difference failed, empty Array");var n=xt(t),o=xt(i?pt(e,i):e),s=new v.Clipper;s.AddPaths(n,v.PolyType.ptSubject,!r),s.AddPaths(o,v.PolyType.ptClip,!0);var a=r?new v.PolyTree:new v.Paths;return s.Execute(v.ClipType.ctDifference,a,v.PolyFillType.pftNonZero,v.PolyFillType.pftNonZero),bt(r?v.Clipper.PolyTreeToPaths(a):a)}function dt(t=[],e=[],i=!1){if(!Array.isArray(t))throw new Error("Intersection failed, input not Array");if(!t.length||!t[0])throw new Error("Intersection failed, empty Array");var r=xt(t),n=e.length&&xt(e),o=n?r:[r[0]],s=n||r.slice(1),a=new v.Clipper;a.AddPaths(o,v.PolyType.ptSubject,!i),a.AddPaths(s,v.PolyType.ptClip,!0);var h=v.PolyFillType.pftNonZero,l=v.PolyFillType.pftNonZero,u=v.ClipType.ctIntersection,p=i?new v.PolyTree:new v.Paths;return a.Execute(u,p,h,l),bt(i?v.Clipper.PolyTreeToPaths(p):p)}function ft(t,e,i=[]){var r=new v.FPoint(t[0],t[1]),n=xt([e])[0],o=v.Clipper.PointInPolygon(r,n);return i.forEach((e=>{var i=ft(t,e);1===i?o=0:-1===i&&(o=-1)})),o}function vt(t,e,i=[]){var r=new v.FPoint(t[0],t[1]),n=e[0],o=v.Clipper.PointInPolygon(r,n);return i.forEach((e=>{var i=ft(t,e);1===i?o=0:-1===i&&(o=-1)})),o}function yt(t){var e=xt([t]);return v.JS.AreaOfPolygon(e[0])}function gt(t){return Math.abs(yt(t))}function mt(t,e=.01){var i=xt(t);return bt(v.Clipper.CleanPolygons(i,e))}function _t(t,e=.01){return mt([t],e)[0]}function xt(t=[]){for(var e=[],i=0;i<t.length;i++){var r=t[i]||[];e[i]=[];for(var n=0;n<r.length;n++){var o=r[n];Number.isFinite(o[0])&&Number.isFinite(o[1])?e[i][n]={X:o[0],Y:o[1]}:console.warn("invalid number",o[0],o[1])}}var s=[];for(var a of e){!a.length?console.warn("empty polygon"):s.push(a)}if(!s.length)throw new Error("empty polygon invalid input");return s}function bt(t){for(var e=[],i=0;i<t.length;i++){var r=t[i]||[];e[i]=[];for(var n=0;n<r.length;n++){var o=r[n];e[i][n]=[o.X,o.Y]}}return e}function Pt(t,e,i=1e-4){return![t[0]-e[0],t[1]-e[1]].some((t=>Math.abs(t)>i))}function wt(t,e,i){if(t.length!=e.length)return!1;var r=!0;if(t.forEach(((t,i)=>{t.length!=e[i].length&&(r=!1)})),!r)return!1;for(var n=!0,o=function(r){var o=Pt(t[r][0],e[r][0]),s=0;return o||(s=e[r].findIndex((e=>Pt(t[r][0],e)))),s<0?(n=!1,"break"):t[r].every(((t,n)=>{var o=n+s<=e[r].length-1?n+s:n+s-e[r].length;return Pt(t,e[r][o],i)}))?void 0:(n=!1,"break")},s=0;s<t.length;s++){if("break"===o(s))break}return n}function Et(t,e=!0){for(var i=0,r=e?t.length:t.length-1,n=0;n<r;n++){i+=K({x:t[n][0],z:t[n][1]},{x:t[n<t.length-1?n+1:0][0],z:t[n<t.length-1?n+1:0][1]})}return i}function Tt(t,e){var i,r,n=Ct(t[0],t[1]);if(0==n)return[];for(var o=[(t[1][0]-t[0][0])/n,(t[1][1]-t[0][1])/n],s=[-o[1],o[0]],a=[],h=0;h<e.length;h++){if(0!=Ct(i=e[h],r=e[(h+1)%e.length])){var l=[r[0]-i[0],r[1]-i[1]];if(Math.abs(At(s,i)-At(s,t[0]))<=.01&&Math.abs(At(s,r)-At(s,t[0]))<=.01)if(Mt(l,o)){var u=At(l,i)>At(l,t[0])?i:t[0],p=At(l,r)<At(l,t[1])?r:t[1];if(At(l,u)<At(l,p)){var c=u==i?0:Ct(i,u);a.push({l:Ct(u,p),pos:c,start:u,end:p,edgeIdx:h})}}else if(Mt(l,[-o[0],-o[1]])){var d=At(l,i)>At(l,t[1])?i:t[1],f=At(l,r)<At(l,t[0])?r:t[0];if(At(l,d)<At(l,f)){var v=d==i?0:Ct(i,d);a.push({l:Ct(d,f),pos:v,start:d,end:f,edgeIdx:h})}}}}return a}function Ct(t,e){var i=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(i*i+r*r)}function It(t){var{min:e,max:i}=function(t){var e=[1/0,1/0],i=[-1/0,-1/0];return t.forEach((t=>{t[0]<e[0]&&(e[0]=t[0]),t[1]<e[1]&&(e[1]=t[1]),t[0]>i[0]&&(i[0]=t[0]),t[1]>i[1]&&(i[1]=t[1])})),{min:e,max:i}}(t);return[e[0]+(i[0]-e[0])/2,e[1]+(i[1]-e[1])/2]}function St(t,e){e=e||It(t);var i=t.map((t=>[t[0]-e[0],t[1]-e[1]]));return{center:e,polygon:i}}function Ot(t=[]){var e=[...t];return Pt(e[0],e[e.length-1])||e.push(e[0]),e}function At(t,e){return t[0]*e[0]+t[1]*e[1]}function Mt(t,e,i=.01){var r=Math.atan2(t[1],t[0]),n=Math.atan2(e[1],e[0]),o=Math.abs(r-n);return o<=i||o>=2*Math.PI-i}function Lt(t,e=[]){return gt(t)<.1?It(t):P([t,...e],.1)}function Nt(t,e,i=!1){var r=0,n=e.x,o=e.z;if(e.controlLine&&e.w&&(r="front"===e.controlLine?e.w:"center"===e.controlLine?e.w/2:0),r){var s=e.ry/180*Math.PI;n-=r*Math.sin(s),o-=r*Math.cos(s)}var a,h,l=t.ry||0,u=e.ry||0,p=L(t.x,t.z),c=L(n,o),d=-u*Math.PI/180,f=A(),v=M();h=c,(a=f)[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=h[0],a[5]=h[1],function(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],h=e[5],l=Math.sin(i),u=Math.cos(i);t[0]=r*u+o*l,t[1]=n*u+s*l,t[2]=r*-l+o*u,t[3]=n*-l+s*u,t[4]=a,t[5]=h}(f,f,d),D(v,p,f);var y={x:v[0],z:v[1],y:t.y+e.y||0,ry:l+u};return i?Object.assign(t,y):Object.assign({},t,y)}function Rt(t,e,i=!1){var r=0,n=e.x,o=e.z;if(e.controlLine&&e.w&&(r="front"===e.controlLine?e.w:"center"===e.controlLine?e.w/2:0),r){var s=e.ry/180*Math.PI;n-=r*Math.sin(s),o-=r*Math.cos(s)}var a=t.ry||0,h=e.ry||0,l=L(t.x,t.z),u=L(n,o),p=h*Math.PI/180,c=A(),d=M(),f=M();!function(t,e){t[0]=-e[0],t[1]=-e[1]}(f,u),function(t,e){var i=Math.sin(e),r=Math.cos(e);t[0]=r,t[1]=i,t[2]=-i,t[3]=r,t[4]=0,t[5]=0}(c,p),function(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],h=e[5],l=i[0],u=i[1];t[0]=r,t[1]=n,t[2]=o,t[3]=s,t[4]=r*l+o*u+a,t[5]=n*l+s*u+h}(c,c,f),D(d,l,c);var v={x:d[0],z:d[1],y:t.y-e.y||0,ry:a-h};return i?Object.assign(t,v):Object.assign({},t,v)}function Dt(t){if("object"!=typeof t)throw new Error("Get el data, invalid type");var i,r,n,o,s,a,h,l,u,p,c,d,{x:f,z:v,l:y,ry:g}=e({},t),m="a:helper:spaceDivider"===t.type;if(!m&&!Number.isFinite(t.w)||!Number.isFinite(y)||!Number.isFinite(f)||!Number.isFinite(v)){var _={type:t.type,id:t.id,x:f,z:v,l:y,ry:g,w:t.w};throw new Error("Get el vectors, params missing ".concat(JSON.stringify(_)))}return i=g/180*Math.PI,r=t.barCounter?t.w+.25:t.w,m&&(r=0),s={x:r*Math.sin(i),z:r*Math.cos(i)},a=m?s:Q(s),l=Q(h={x:y*Math.cos(i),z:-y*Math.sin(i)}),n=t.barCounter?f+-.25*a.x:f,o=t.barCounter?v+-.25*a.z:v,d=0,"front"===t.controlLine?d=-t.w:"center"===t.controlLine&&(d=-t.w/2),{l1:c={x:n,z:o},l2:{x:n+h.x,z:o+h.z},p1:u={x:c.x+a.x*d,z:c.z+a.z*d},p2:p={x:u.x+h.x,z:u.z+h.z},p3:{x:u.x+s.x,z:u.z+s.z},p4:{x:p.x+s.x,z:p.z+s.z},w:s,l:h,nW:a,nL:l}}function kt(t){var e,i;return"column"===t.type?i=function(t){if("column"===t.type){var e=[];if("square"===t.shape){var i=t.l/2;e=Ft(t,e=[[-i,-i],[i,-i],[i,i],[-i,i]])}else if("circle"===t.shape)for(var r=2*Math.PI/25,n=0,o=t.l/2,s=0;s<25;s++)e.push([t.x-o*Math.cos(n),t.z+o*Math.sin(n)]),n+=r;else"polygon"===t.shape&&(e=Ft(t,t.polygon));return e}}(t):(e=Dt(t),i=("a:helper:spaceDivider"===t.type?[e.l1,e.l2]:[e.p1,e.p2,e.p4,e.p3]).map((t=>[t.x,t.z]))),i}function Ft(t,e){return e.map((e=>{var i=Nt({x:e[0],z:e[1]},t);return[i.x,i.z]}))}(V=W||(W={}))[V.etOpenSquare=0]="etOpenSquare",V[V.etOpenRound=1]="etOpenRound",V[V.etOpenButt=2]="etOpenButt",V[V.etClosedLine=3]="etClosedLine",V[V.etClosedPolygon=4]="etClosedPolygon";var Bt=(t,e={})=>{var i={},r=e.keepTransient;return Object.keys(t).forEach((e=>{var n="_"===e.slice(0,1);"_ryOrg"!==e?n&&!r||null!==t[e]&&void 0!==t[e]&&"children"!==e&&(i[e]=t[e]):i.ry=t[e]})),t.children?i.children=t.children.map((t=>Bt(t,e))):i.children=[],i};function Ut(t,e){var i=Rt(t,e);return t.parent.removeChild(t),e.addChild(Bt(i),{setDefaults:!1})}function zt(t){return t.children.slice().forEach((t=>{"group"===t.type&&(zt(t),Xt(t))})),t}function Xt(t){for(var e=t.parent,i=[],r=t.children.length-1;r>=0;r--){var n=t.children[r],o=Bt(Nt(n,t));t.removeChild(n);var s=e.addChild(o,{setDefaults:!1});i.push(s)}return e.removeChild(t),i}function jt(t,e){for(var i=[],r=t.map(gt),n=0;n<t.length;n++)for(var o=t[n],s=0;s<e.length;s++){if(ft(e[s][0],o))if(i[s])r[i[s]]>r[n]&&(i[s]=n);else i[s]=n}var a=[];return i.forEach(((t,i)=>{a[t]||(a[t]=[]),a[t].push(e[i])})),a}function Yt(t){return{counterClockwise:t.filter((t=>yt(t)>0)),clockwise:t.filter((t=>yt(t)<0))}}function Ht(t){var e=[...t];return yt(e)<0?e:e.reverse()}function Gt(t){var e=[...t];return yt(e)>0?e:e.reverse()}function Wt({uuid:t,scene:e,node:i}){if(!(i=i||e.nodesById[t]))return[];var r=i.getWorldPosition();if(!r.polygon||!r.polygon.length)throw new Error("Invalid space"+JSON.stringify(r,null,2));var n=Gt(r.polygon);if(!(n=_t(n))||!n.length)return console.warn("Space",i.id,"is too small and will be ignored, area:",Math.round(1e3*yt(i.polygon))/1e3),[];var o=r.polygonHoles||[];return o=(o=o.map((t=>_t(Ht(t)))).filter((t=>t.length))).filter((t=>t.length)),[Ft(r,n),...o.map((t=>Ft(r,t)))]}function Vt({uuid:t,polygons:e,scene:i,structureEls:r,openingsOnly:n=!1}){var o;if(0==(o=(null==e?void 0:e.length)?e:Wt({uuid:t,scene:i})).length)return console.warn("Space node not found or polygon too small"),{openings:[],walls:{polylines:[],length:0},gaps:{polylines:[],length:0},polygons:[]};var{openings:s,walls:a}=r||qt(i),h=n?{wallPolylines:[],wallLength:0,gapPolylines:[],gapLength:0}:function(t=[],e=[]){var i=.005;if(!t.length||!e.length||!e[0].length)return console.warn("no polyline or wall to match"),{wallPolylines:[],wallLength:0,gapPolylines:[],gapLength:0};var r=t.map((t=>t.contour)).filter((t=>null==t?void 0:t.length)),n=[Ot(e[0]),...e.slice(1).map(Ot)],o=r.map((t=>pt([t],i)[0])),s=dt(n,o,!0),a=ct(n,o,0,!0),h={wallPolylines:[],wallLength:0,gapPolylines:[],gapLength:0};for(var l of s){var u=Et(l,!1);!u||u<.1||(h.wallPolylines.push(l),h.wallLength+=u)}for(var p of a){var c=Et(p,!1);!c||c<.1||(h.gapPolylines.push(p),h.gapLength+=c)}return h}(a,o),l=s.filter((t=>{for(var e=0;e<o.length;e++){var i=o[e],r=Zt(t,i);if(r){for(var n of(t.line=r,t.segments=Tt(r,i),t.segments))n.edgeIdx=[e,n.edgeIdx];return!0}}return!1}));return{openings:l,walls:{polylines:h.wallPolylines,length:h.wallLength},gaps:{polylines:h.gapPolylines,length:h.gapLength},polygons:o}}function qt(t){var e=t.nodesByType.window,i=t.nodesByType.door,r=e.concat(i).filter((t=>{var e=t.parent;return"wall"!==e.type&&console.log(t.type,"not in wall",t.id),"wall"===e.type})),n=t.nodesByType.column.map((t=>t.getWorldPosition())),o=t.nodesByType.wall.map((t=>t.getWorldPosition())),s=t.nodesByType["a:helper:spaceDivider"].map((t=>t.getWorldPosition())),a=(o=o.filter((t=>((t.l<=0||t.w<=0)&&console.warn("invalid wall"),t.l>0&&t.w>0)))).map((t=>({node:t,contour:kt(t)}))),h=n.map((t=>({node:t,contour:kt(t)}))),l=s.map((t=>({node:t,contour:kt(t)})));return{openings:r.map((t=>{var e=t.parent,i=t.getWorldPosition();return i.w=e.w,{node:i,contour:kt(i)}})),walls:a,dividers:l,columns:h}}function Zt(t,e){var i,r=Gt(e),n=t.contour,o=[[n[0][0]+(n[3][0]-n[0][0])/2,n[0][1]+(n[3][1]-n[0][1])/2],[n[1][0]+(n[2][0]-n[1][0])/2,n[1][1]+(n[2][1]-n[1][1])/2]],s=[o[0][0]+(o[1][0]-o[0][0])/2,o[0][1]+(o[1][1]-o[0][1])/2],a=[o[1][0]-o[0][0],o[1][1]-o[0][1]],h=(i=a,Math.sqrt(i[0]*i[0]+i[1]*i[1])),l=[-a[1]/h,a[0]/h],u=t.node.w,p=[[s[0]-l[0]*u,s[1]-l[1]*u],[s[0]+l[0]*u,s[1]+l[1]*u],s],c=[];for(var d of r)c.push({x:d[0],z:d[1]});var f=[];for(var v of n)f.push({x:v[0],z:v[1]});var y=[];for(var g of p)y.push(vt(g,xt([r])));return y[0]===y[1]?function(t,e){for(var i of e)if(et(i,t[0],t[1],.001))return[[t[0].x,t[0].z],[t[1].x,t[1].z]];for(var r of e)if(et(r,t[2],t[3],.001))return[[t[2].x,t[2].z],[t[3].x,t[3].z]];return!1}(f,c):y[0]?y[2]?[n[2],n[3]]:[n[0],n[1]]:y[2]?[n[0],n[1]]:[n[2],n[3]]}function Jt({scene:t,spaces:e}){var i=t.nodesByType.polyfloor,{walls:r,openings:n,dividers:o,columns:s}=qt(t),a=i.map((i=>{var a=function(t,e){var i={},r=[e.polygon,...e.polygonHoles||[]],n=e.getWorldPosition();return r.forEach(((e,r)=>{e.forEach(((o,s)=>{var a=s<e.length-1?s+1:0,h=[o,e[a]],l=Ft(n,h),u=r+"-"+s;i[u]={},t.forEach((t=>{var e=Tt([l[0],l[1]],t.contour);e[0]&&(i[u][t.node.id]=e[0].edgeIdx)}))}))})),i}([...r,...n,...o,...s],i),h={};return Object.entries(a).forEach((([e,i])=>{Object.entries(i).forEach((([i,r])=>{h[i]||(h[i]={node:t.nodesById[i],relation:"edge",edgeRelations:[]});var n=parseInt(e.split("-")[0]),o=parseInt(e.split("-")[1]);h[i].edgeRelations.push({edgeIndex:[n,o],nodeContourIndex:r})}))})),(null==e?void 0:e.find((t=>t.id===i.id))).interiors.forEach((e=>{h[e.id]={node:t.nodesById[e.id],relation:"contained"}})),{node:i,relationsById:h,relationsByEdgeIndex:a}}));return a}function Kt(t,e="",i=!1,r,n){var o,s,a={"a:helper:spaceDivider":["plan","level","group"],wall:["plan","level","group"],interior:["plan","level","interior","group","level"],window:["plan","level","wall"],door:["plan","level","wall"],polyfloor:["plan","level"],group:["plan","level","group"]},h=i?(o=Bt(t),JSON.parse(JSON.stringify(o))):t,l=[];if(i&&r&&(h=Nt(h,r)),n||h.type!==e){if(n&&h.id===n)return[h]}else l.push(h);var u=0;if(h.children&&(!a[e]||a[e].includes(h.type)))for(var p=0;p<h.children.length;p++){var c=h.children[p];"level"===c.type&&u++,u>1||(s=Kt(c,e,i,h,n),l=l.concat(s))}return l}function Qt(t,e){return Kt(t,e,!0)}var $t={"a:helper:spaceDivider":[],"a:reference:externalId":[],"a:relation:wall":[],"a:settings:display":[],"a:settings:generatedGroup":[],box:[],"camera-bookmark":[],closet:[],column:[],curtain:[],door:[],floor:[],floorplan:[],group:[],interior:[],kitchen:[],level:[],marker:[],object:[],plan:[],polybox:[],polyfloor:[],railing:[],roomStamp:[],stairs:[],tag:[],wall:[],window:[]},te=Object.keys($t);function ee(t,e={}){var i=ie(t,{});return ne(t,null,null,i),e.exportIdMap&&(t.idMap=i),t}function ie(t,e){return void 0!==t.id&&(e[t.id]=j()),t.children.forEach((t=>ie(t,e))),e}var re=t=>"[object Object]"===Object.prototype.toString.call(t);function ne(t,e,i,r){var n;"string"==typeof t?(void 0!==e&&void 0!==i&&r[t]&&(e[i]=r[t]),"string"==typeof i&&void 0!==e&&void 0!==i&&r[i]&&(e[r[i]]=t,delete e[i])):(re(t)||(n=t,"[object Array]"===Object.prototype.toString.call(n)))&&(re(t)&&t.type&&void 0===t.id&&(t.id=j()),Object.entries(t).forEach((([e,i])=>ne(i,t,e,r))))}var oe={colorDiffuse:{type:"array"},colorSpecular:{type:"array"},wireframeColor:{type:"array"},size:{type:"array"},specularCoef:{type:"number"},opacity:{type:"number"},wireframeOpacity:{type:"number"},wireframeThickness:{type:"number"},wireframeThresholdAngle:{type:"number"},lightEmissionCoef:{type:"number"},bsdfType:{type:"string"},wrap:{type:"string"},receiveRealTimeShadows:{type:"boolean"},hideAfterBaking:{type:"boolean"},castRealTimeShadows:{type:"boolean"},no2dOutline:{type:"boolean"},mapDiffuse:{type:"string"},mapDiffusePreview:{type:"string"},mapDiffuseSource:{type:"string"},mapDiffuseKey:{type:"string"},mapSpecular:{type:"string"},mapSpecularPreview:{type:"string"},mapSpecularSource:{type:"string"},mapSpecularKey:{type:"string"},mapNormal:{type:"string"},mapNormalPreview:{type:"string"},mapNormalSource:{type:"string"},mapNormalKey:{type:"string"},mapAlpha:{type:"string"},mapAlphaPreview:{type:"string"},mapAlphaSource:{type:"string"},mapAlphaKey:{type:"string"}},se=t=>{var e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"number"!==e||Number.isFinite(t)?e:"undefined"},ae={group:"a:settings:generatedGroup"},he={properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"},ry:{type:"number"},id:{type:"string"}}};class le{constructor({node:t,parent:e,scene:i,emitter:r,options:n={}}){var o;if("object"!=typeof t)throw new Error("node has to be type object: "+t);if(!t.type)throw new Error("node invalid, type is missing: "+JSON.stringify(t));void 0===n.setDefaults&&(n.setDefaults=!1),void 0===n.regenerateIds&&(n.regenerateIds=!1),this._scene=i,this._emitter=r;var s=t.children||[];t.children=[],!t.id||n.setDefaults||n.regenerateIds?this._update(fe(t,this.schema,n)):this._update(t),this._parent=e,e&&e.children.push(this),(null==(o=this._scene)?void 0:o.registerNode)&&this._scene.registerNode(this);var a="add-child";this._emitter&&this._emitter.emit(a,{node:e,args:this,options:n,event:a}),s.filter((t=>(t.type||console.warn("Prevent import from scene structure: Invalid type",t.type+""),t.type))).forEach((t=>this.addChild(t,n)))}get parent(){return this._parent}get scene(){return this._scene}get schema(){var t;return null==(t=this._scene)?void 0:t.schema}_update(t={}){var e,i,r=null==(i=null==(e=this._scene)?void 0:e.schema)?void 0:i[this.type],{properties:n}=r||he;for(var o in t){var s=null==n?void 0:n[o];if(!r||s||"_"===o[0]){var{minimum:a,maximum:h,type:l,enum:u}=s||{};if("number"===l){if("string"==typeof t[o]&&(t[o]=Number(t[o]),console.log(this.type+"."+o,"converted from string to number")),!Number.isFinite(t[o]))throw new Error("".concat(this.type,".").concat(o," = ").concat(t[o]," is invalid"));var p=Number.isFinite(a)&&t[o]<a,c=Number.isFinite(h)&&t[o]>h;if(p||c){var d=p?"min:"+a:"max:"+h;throw new Error("".concat(this.type,".").concat(o," = ").concat(t[o]," is out of range ").concat(d))}}if("string"===l){if("string"!=typeof t[o])throw new Error("".concat(this.type,".").concat(o," = '").concat(t[o],"' is invalid"));if(u&&!u.includes(t[o]))throw new Error("".concat(this.type,".").concat(o," = '").concat(t[o],"' is invalid"))}("_isSelected"!==o||t[o])&&("_highlight"!==o||t[o])?this[o]=t[o]:delete this[o]}else delete t[o]}}set(t={},e={}){if(this.locked&&!e.force){var i=[];for(var r in t)switch(r){case"locked":case"_highlight":case"_isSelected":i.push(r)}if(!(i.length>0))return void console.log("Node ID ".concat(this.id," is locked and cannot be altered."));var n={};for(var o of i)n[o]=t[o];t=n}t.id&&delete t.id,t.src&&delete t.src,t.children&&delete t.children;var s={};for(var a in t)s[a]=this[a];try{this._update(t)}catch(t){return void console.warn(t.message)}if(this._emitter){var h=0,l=0;for(var u in t)switch(t[u]===s[u]&&(delete t[u],delete s[u]),h++,u){case"x":case"y":case"z":case"ry":l++}var p=l===h?"set-transform":"set";Object.keys(t).length&&this._emitter.emit(p,{node:this,args:t,prevState:s,options:e,event:p})}}setTransform({x:t,y:e,z:i,ry:r}={},n={}){if(!this.locked||n.force){var o={},s={};if(void 0!==t){var a=Number(t);this.x!==a&&Number.isFinite(a)&&(s.x=this.x,o.x=this.x=a)}if(void 0!==e){var h=Number(e);this.y!==h&&Number.isFinite(h)&&(s.y=this.y,o.y=this.y=h)}if(void 0!==i){var l=Number(i);this.z!==l&&Number.isFinite(l)&&(s.z=this.z,o.z=this.z=l)}if(void 0!==r){var u=Number(r);this.ry!==u&&Number.isFinite(u)&&(s.ry=this.ry,o.ry=this.ry=u)}var p="set-transform";this._emitter&&Object.keys(o).length&&this._emitter.emit(p,{node:this,args:o,prevState:s,options:n,event:p})}else console.log("Node ID ".concat(this.id," is locked and cannot be altered."))}setMaterials(t={},i={}){var r=this;if(!this.locked||i.force){var n=Object.keys(oe),o={},s=0,a={},h=function(e){var i=t[e],h=se(i),l="string"===h,u="object"===h&&Object.keys(i).every((t=>{var e,r=n.includes(t),o=r&&se(i[t])===(null==(e=oe[t])?void 0:e.type);return r&&o}));(l||u)&&(a[e]=r[e],o[e]=t[e],s++)};for(var l in t)h(l);if(s<1)console.log("no valid material definitions in",t);else{var u=e(e({},this.materials||{}),t);try{this._update({materials:u})}catch(t){return void console.warn(t.message)}var p="set-materials";this._emitter&&this._emitter.emit(p,{node:this,args:t,prevState:a,options:i,event:p})}}else console.log("Node ID ".concat(this.id," is locked and cannot set materials."))}setTransient(t={},i={}){var r={},n=0,o={};for(var s in t)"_"===s[0]&&(o[s]=this[s],r[s]=t[s],n++);if(n<1)console.log("no transient values in",t,"use underscore");else{try{this._update(e({},r))}catch(t){return void console.warn(t.message)}var a="set-transient";this._emitter&&this._emitter.emit(a,{node:this,args:t,prevState:o,options:i,event:a})}}setHighlight(t={},i={}){var r,n={_highlight:this._highlight},{fill:o,fillOpacity:s,outline:a,outlineWidth:h}=t;o&&Array.isArray(o)&&(r={fill:o,fillOpacity:s}),a&&Array.isArray(a)&&(r=e(e({},r||{}),{},{outline:a,outlineWidth:h}));var l={_highlight:r};try{this._update(l)}catch(t){return void console.warn(t.message)}var u="set-transient";this._emitter&&this._emitter.emit(u,{node:this,args:l,prevState:n,options:i,event:u})}find(t={}){return t.id||t.type&&"string"==typeof t.type&&te.includes(t.type)?(this.traverse((i=>{e||(t.id&&i.id===t.id||t.type&&i.type===t.type)&&(e=i)})),e):(console.warn("type missing or invalid"),null);var e}findAll(t={}){if(!t.type||"string"!=typeof t.type||!te.includes(t.type))return console.warn("type missing or invalid"),[];var e=[];return this.traverse((i=>i.type===t.type&&e.push(i))),e}addChild(t,e={}){var i,r;if(t.type&&"string"==typeof t.type&&te.includes(t.type))if(!this.locked||["level","plan"].includes(this.type)||e.force){if(!t.id||!(null==(r=null==(i=this.scene)?void 0:i.nodesById)?void 0:r[t.id])||e.regenerateIds)return void 0===e.setDefaults&&(e.setDefaults=!0),new le({node:t,parent:this,scene:this._scene,emitter:this._emitter,options:e});console.warn("Node with id ".concat(t.id," already exists and can not be added - use options.regenerateIds = true"))}else console.log("Node ID ".concat(this.id," is locked and cannot add children."));else console.warn("type missing or invalid")}removeChild(t,e={}){var i;if(t.id)if(!this.locked||["level","plan"].includes(this.type)||e.force){for(var r,n=0;n<this.children.length;n++)if(this.children[n].id===t.id){r=n;break}if(Number.isFinite(r)){for(var o=t.children||[],s=o.length-1;s>=0;s--)t instanceof le&&o[s]&&t.removeChild(o[s],e);(null==(i=this._scene)?void 0:i.unregisterNode)&&this._scene.unregisterNode(t),this.children.splice(r,1);var a="remove-child";this._emitter&&this._emitter.emit(a,{node:this,args:t,options:e,event:a}),((null==t?void 0:t.getReferringNodes)?t.getReferringNodes():[]).forEach((t=>t.remove(e)))}else console.warn("Node does not exist or is already removed",t)}else console.log("Node ID ".concat(this.id," is locked and cannot remove children."));else console.error("not valid")}remove(t){!this.locked||t.force?this.parent.removeChild(this,t):console.warn("Node ID ".concat(this.id," is locked and cannot be removed."))}getReferringNodes(){var t,e,i=[],r=null==(t=this._scene)?void 0:t.nodesByType["a:relation:"+this.type];r&&r.forEach((t=>{var e;(null==(e=null==t?void 0:t.nodeIds)?void 0:e.hasOwnProperty(this.id))&&i.push(t)}));var n=ae[this.type]||"a:settings:"+this.type,o=null==(e=this._scene)?void 0:e.nodesByType[n];return o&&o.forEach((t=>{(null==t?void 0:t.nodeId)==this.id&&i.push(t)})),i}getWorldPosition(){return ce(this)}getLocalPositionFromWorld(t){var e=this.getParents();return(null==e?void 0:e.length)&&e.reverse().forEach((e=>{t=Rt(t,e)})),t}getParents(){return de(this)}toJson(t={}){var e=Bt(this,t),i=JSON.parse(JSON.stringify(e));return t.regenerateIds&&ee(i,t),i}traverse(t){"function"==typeof t&&(t(this),this.children.forEach((e=>{e.traverse(t)})))}}var ue,pe,ce=(t,e)=>{var i=e?e.parent:t.parent;if(!i)return console.warn("no parent found"),t;var r=Nt(t,i);return i.parent&&(r=ce(r,i)),r},de=t=>{var e=[],i=t.parent;return i&&e.push(i),(null==i?void 0:i.parent)&&(e=e.concat(de(i))),e},fe=(t,e,{setDefaults:i,regenerateIds:r})=>{if(!e&&i)throw new Error("schema is missing");if(!t)throw new Error("node missing");var n,o=e&&e[t.type];if(o&&i){if(n=((t,e)=>{if(e&&e.properties){var i={};return Object.keys(e.properties).forEach((t=>{var r=e.properties[t],n=r.const||r.default;void 0!==n&&(i[t]=n)})),"interior"!==t||i.src||(i.src="!7dddc882-1def-4497-80e3-d1de834a1a7b"),JSON.parse(JSON.stringify(i))}console.warn("schema is missing for type ".concat(t))})(t.type,o),!n)throw new Error("no defaults found")}else n={};var s=Object.assign(n,t);if(!s)throw new Error("applying defaults failed");return t.id&&!r||(s.id=j()),s};(pe=ue||(ue={})).residential="residential",pe.office="office";var ve={work:{name:"Work",isHidden:!0,description:"space for individual head-down work",spaceUsage:{privateOffice:{name:"Private office",category:[ue.office]},openWorkspace:{name:"Open workspace",category:[ue.office]},enclosedWorkspace:{name:"Enclosed workspace",category:[ue.office]},closedWorkspace:{name:"Closed workspace",isDeprecated:!0,category:[ue.office]},executiveOffice:{name:"Executive office",isDeprecated:!0,category:[ue.office]}}},meet:{name:"Meet",isHidden:!0,spaceUsage:{meetingRoom:{name:"Meeting room",category:[ue.office]},hub:{name:"Hub",category:[ue.office]},assembly:{name:"Assembly",category:[ue.office]},boardRoom:{name:"Board Room",category:[ue.office]},trainingRoom:{name:"Training Room",category:[ue.office]},collaboration:{name:"Collaboration",isDeprecated:!0,category:[ue.office]}}},live:{name:"live",isHidden:!0,spaceUsage:{living:{name:"Living",category:[ue.residential]},dining:{name:"Dining",category:[ue.residential]},dining_living:{name:"Living & Dining",category:[ue.residential]},homeOffice:{name:"Home office",category:[ue.residential]},bedroom:{name:"Bedroom",category:[ue.residential]}}},socialize:{name:"Socialize",isHidden:!0,spaceUsage:{lobby:{name:"Lobby",category:[ue.office,ue.residential]},reception:{name:"Reception",category:[ue.office]},lounge:{name:"Lounge",category:[ue.office]},cafe:{name:"Cafe",category:[ue.office]},canteen:{name:"Canteen",category:[ue.office]},pantry:{name:"Pantry",category:[ue.office]},terrace:{name:"Terrace",isOutdoor:!0,category:[ue.office,ue.residential]},balcony:{name:"Balcony",isOutdoor:!0,category:[ue.office,ue.residential]},rooftop:{name:"Rooftop",isOutdoor:!0,category:[ue.office,ue.residential]},courtyard:{name:"Courtyard",isOutdoor:!0,category:[ue.office,ue.residential]},garden:{name:"Garden",isOutdoor:!0,category:[ue.residential]},common:{name:"Common",isDeprecated:!0,category:[ue.office]}}},support:{name:"Support",isHidden:!0,spaceUsage:{printStation:{name:"Print station",category:[ue.office]},storage:{name:"Storage",category:[ue.residential,ue.office]},mailRoom:{name:"Mail room",category:[ue.office]},operationalRoom:{name:"Operational room",category:[ue.office]},serviceRoom:{name:"Service room",category:[ue.office]},laundryRoom:{name:"Laundry room",category:[ue.residential]},operate:{name:"Operate",isDeprecated:!0,category:[ue.office]},services:{name:"Services",isDeprecated:!0,category:[ue.office,ue.residential]}}},care:{name:"Care",isHidden:!0,spaceUsage:{kitchen:{name:"Kitchen",category:[ue.residential]},wellnessRoom:{name:"Wellness room",category:[ue.office]},restroom:{name:"Restroom",category:[ue.office]},bathroom:{name:"Bathroom",category:[ue.residential]},shower:{name:"Shower",category:[ue.office,ue.residential]},toilet:{name:"Toilet",category:[ue.residential]}}},circulate:{name:"Circulate",isHidden:!0,spaceUsage:{corridor:{name:"Corridor",category:[ue.residential,ue.office]},staircase:{name:"Staircase",category:[ue.residential,ue.office]},elevator:{name:"Elevator",category:[ue.residential,ue.office]},foyer:{name:"Foyer",category:[ue.residential,ue.office]},garage:{name:"Garage",category:[ue.residential,ue.office]}}},void:{isHidden:!0,name:"Void",spaceUsage:{shaft:{name:"Shaft",category:[ue.residential,ue.office]},buildingOpening:{name:"Building opening",category:[ue.residential,ue.office]},floorOpening:{name:"Floor opening",category:[ue.residential,ue.office]}}},undefined:{isHidden:!0,spaceUsage:{undefined:{name:"",category:[ue.residential,ue.office],isHidden:!0}}}},ye={};Object.keys(ve).forEach((t=>{var i=ve[t];ye[t]={name:i.name,type:"program",category:[]},i.isHidden&&(ye[t].isHidden=i.isHidden);var r={};Object.keys(ve[t].spaceUsage).forEach((i=>{var n=ve[t].spaceUsage[i];ye[i]=e(e({},n),{},{type:"space",program:t}),n.category.forEach((t=>{r[t]=!0}))})),ye[t].category=Object.keys(r)}));var ge=(t="")=>{"officeWorking"===t?t="work":"officeMeeting"===t&&(t="meet");var e=ye[t];return e?e.name:""},me=(t="")=>{var e,i=ye[t];return i&&(e="program"===i.type?t:i.program),e};function _e({scene:t,uuid:e}){var i=t.nodesByType.polyfloor;e&&(i=i.filter((t=>t.id===e)));var r=t.nodesByType.interior.map((t=>t.getWorldPosition())),n=i.map((e=>{var i=Wt({node:e});if(i.length){var n=Math.abs(i.reduce(((t,e)=>t+yt(e)),0)),o=Lt(i[0],i.slice(1)),s=lt(i),{interiors:a}=function({uuid:t,polygons:e,scene:i,interiors:r}){var n,o=(n=e&&e.length?e:Wt({uuid:t,scene:i}))[0],s=n.slice(1);return o=pt([o],.05)[0],r||(r=i.nodesByType.interior.map((t=>t.getWorldPosition()))),{interiors:r.filter((t=>{if(t.src&&t.x&&t.z)return ft([t.x,t.z],o,s)}))}}({polygons:i,scene:t,interiors:r});return{node:e,boundingBox:s,id:e.id,usage:e.usage,usageName:ge(e.usage),program:me(e.usage),polygons:i,interiors:a,area:n,center:o,customId:e.customId,name:e.name}}}));return n.flatMap((t=>t?[t]:[]))}function xe(t){var e=.01,i=t.nodesByType.column.map((t=>t.getWorldPosition())),r=t.nodesByType.wall.map((t=>t.getWorldPosition())),n=t.nodesByType["a:helper:spaceDivider"].map((t=>t.getWorldPosition())).map(kt);n=pt(n,e,0,!0);var o=[...r,...i].map((t=>{var i=kt(t);if(i.length&&yt(i))return i=pt([i],e)[0]})).flatMap((t=>t?[t]:[])),s=o.length?ut([...o,...n]):[];s.length&&(s=mt(s).filter((t=>t.length)));var{clockwise:a,counterClockwise:h}=Yt(s);a.length&&(a=a.map((t=>{var i=pt([t],e);if(i.length)return(i=i.sort(((t,e)=>gt(t)>gt(e)?-1:1)))[0]})).flatMap((t=>t&&yt(t)>.1?[t]:[])).map(Gt));var l=h.sort(((t,e)=>gt(t)>gt(e)?-1:1)),u=l.length?l[0]:[];u.length&&(u=pt([u],-.01)[0]);var p=jt(a,h);return{spaces:a,holes:p=p.map((t=>t.length?t.map((t=>pt([t],-.01)[0])).filter((t=>t)).map(Ht):t)),outline:u}}class be{constructor({schema:t}={}){this.sceneId=null,this.node=null,this._apiVersion="2.2.0",this.nodesById={},this.nodesByType=JSON.parse(JSON.stringify($t)),this.nodesByName={},this._schema=t||{},this._emitter=new G}get emitter(){return this._emitter}get schema(){return this._schema}set schema(t){"object"==typeof t&&(this._schema=t)}loadSceneStructure(t,e={}){if(this._emitter.emit("scene-structure-loading",this),!t||"plan"!==t.type)throw new Error("invalid sceneStructure");this.nodesById={},this.nodesByType=JSON.parse(JSON.stringify($t)),this.node=null;var i=JSON.parse(JSON.stringify(t));return Number.isFinite(e.planRotation)&&(i._ryOrg=t.ry,i.ry=e.planRotation),this.node=new le({node:i,scene:this,emitter:this.emitter,options:e}),this.setSceneType(),this._emitter.emit("scene-structure-loaded",this),this.node}setSceneType(){var t=this.node.class;if(null==t?void 0:t.length)t.includes("residential")?this.type="residential":t.includes("commercial")&&(this.type="commercial");else{var e=this.nodesByType.polyfloor.map((t=>t.usage));e.includes("bedroom")?this.type="residential":(e.includes("work")||e.includes("meetingRoom")||e.includes("openWorkspace"))&&(this.type="commercial")}}getFloorArea(){var t=_e({scene:this}).reduce(((t,e)=>t+e.area),0);return Math.round(10*t)/10}registerNode(t){this.nodesById[t.id]&&console.error("Duplicate id",t.id),this.nodesById[t.id]=t,this.nodesByType[t.type]=this.nodesByType[t.type]||[],this.nodesByType[t.type].push(t),t.name&&(this.nodesByName[t.name]=this.nodesByName[t.name]||[],this.nodesByName[t.name].push(t))}unregisterNode(t){t.id&&delete this.nodesById[t.id];var e=(e,i)=>{if(e[t[i]]){var r=e[t[i]].findIndex((e=>e.id===t.id));Number.isFinite(r)&&e[t[i]].splice(r,1)}};e(this.nodesByType,"type"),e(this.nodesByName,"name")}on(t,e,i){t&&e?this._emitter.on(t,e,i):console.log("invalid event listener")}once(t,e,i){t&&e?this._emitter.once(t,e,i):console.log("invalid event listener")}off(t,e){t&&e?this._emitter.off(t,e):console.log("invalid request")}emit(t,e,i,r,n){this._emitter.emit(t,e,i,r,n)}get apiVersion(){return this._apiVersion}}function Pe(t,e){return{type:"line",start:t,end:e}}function we(t,e,i,r=!1){return{type:"rect",position:t,width:e,height:i,isContour:r}}function Ee(t,e){return{type:"circle",position:t,r:e}}new q({size:256});var Te=({points:t,oldRotation:i,newRotation:r,rootNode:n})=>t.map((t=>{var o={ry:0,x:t[0],z:t[1],y:0};return Rt(o,{x:n.x,y:n.y,z:n.z,ry:i},!0),[(o=Nt(o,e(e({},n),{},{ry:r}))).x,o.z]})),Ce=({gfx:t,points:e,state:i,doneDrawing:r=!1})=>{var n=[{type:"polygon",points:r?e:[...e,i.snapCursor.pos],isContour:!0,props:{fill:16777215,fillOpacity:1,isContour:!0,stroke:4605266,strokeWidth:.5,native:!0}}];t.draw({shapes:n})},Ie=(t,e)=>t.map(((i,r)=>{var n=t[r+1]||t[0];return((t,e)=>{var i=(t.x*e.x+t.y*e.y)/(Math.sqrt(t.x*t.x+t.y*t.y)*Math.sqrt(e.x*e.x+e.y*e.y));return(-.6981317007977321*i*i-.8726646259971648)*i+1.5707963267948966})({x:i[0]-e[0],y:i[1]-e[1]},{x:n[0]-e[0],y:n[1]-e[1]})})),Se={start:!0,end:!0,drag:!0},Oe={x:"number",z:"number",ry:"number"},Ae={box:Oe,closet:Se,column:Oe,curtain:Se,door:Se,floor:{x:"number",z:"number",l:"number"},floorplan:Oe,group:Oe,interior:Oe,object:Oe,kitchen:Se,polybox:e(e({},Oe),{},{polygon:!0}),polyfloor:{},railing:Se,stairs:Se,wall:Se,"a:helper:spaceDivider":Se,window:Se};function Me(t){var i,r,n,o;if(!this)throw new Error("Viewport context is missing");var s=this._dragStart||{},a=t.data.global||{},h=Math.abs(a.x-s.x),l=Math.abs(a.y-s.y);if(h<5&&l<5&&!this.isDragging){var u,p=(new Date).getTime();if(this.lastClick){var c=p-this.lastClick.time,d=this.lastClick.pos&&Math.max(Math.abs(a.x-this.lastClick.pos.x),Math.abs(a.y-this.lastClick.pos.y));u=c<400&&d<10}var f=null==t||null===(i=t.target)||void 0===i||null===(r=i._handlerType)||void 0===r?void 0:r.includes("polygon-point");this.lastClick={time:p,pos:e({},a)};var v=this._getState(),y=u?"dblclick":"click",g=null===(n=t.target)||void 0===n?void 0:n._nodeId,{x:m,y:_}=(null===(o=t.data)||void 0===o?void 0:o.global)||{},x=v.getPlanPosition([m,_]);v.cursor=[...x];var b={sourceEvent:t,nodeId:g,pos:x,isDoubleClick:!!u,polygonClick:f&&t.target._handlerType};if(null!=g&&g.length&&g.includes("marker_")){var P,w,E,T,C=g.replace("marker_",""),I=v.markerPins.find((t=>t.id===C)),S=null===(P=I.events)||void 0===P||null===(w=P.click)||void 0===w?void 0:w.callback,O=null===(E=I.events)||void 0===E||null===(T=E.click)||void 0===T?void 0:T.context;if(S)return void(O?S.bind(O)(b):S(b))}if(v._splitWallHelper)return v._splitWallHelper.split(),void v.setActive({nodeId:v.active[0].id});v.emit(y,b)}}function Le(t){var e=this._getState();"Viewport"===t.target.constructor.name&&e.setActive();var{x:i,y:r}=t.data.global;e.windowPos=[i,r],e.lastSceneClick=e.getPlanPosition(e.windowPos),e.rightClick=!0}function Ne({sourceEvent:t,nodeId:e,state:i,forceSelect:r=!1,activateGroup:n=!1,isDoubleClick:o,isMultiselect:s,polygonClick:a}={}){var h=(null==t?void 0:t.currentTarget)||i&&i._getViewport();i=i||h&&h._getState();var l=s||t&&t.data.originalEvent.shiftKey;if(i&&h&&i.settings.selectElements&&(!i.isDragging||i.altKey)&&h._getHandler&&!i.isMeasuring&&!i.isCreatingElement){if(i.rightClick)return i.emit("context-menu",{sourceEvent:t,nodeId:e}),void(i.rightClick=!1);var u=h._getHandler();if(o){var p,c,d=null===(p=i.active[0])||void 0===p?void 0:p.type;if(null!==(c=Ae[d])&&void 0!==c&&c.polygon){var{x:f,y:v}=t.data.global,y=i.getPlanPosition([f,v]);if(a)(({handler:t,index:e,state:i})=>{if(i.active[0].polygon.length<4)i.setMessage("A polygon requires at least 3 points");else if(!isNaN(e)){var r=i.active[0].polygon.slice();r.splice(e,1),i.active[0].set({polygon:r}),t._update({handler:t,state:i})}})({handler:u,index:Number(a.split("_")[1]),state:i});else(({handler:t,pos:e,state:i})=>{var r=i.active[0].getLocalPositionFromWorld({x:e[0],z:e[1]}),{x:n,z:o}=Rt(r,i.active[0]),s=Ie(i.active[0].polygon,[n,o]),a=s.indexOf(Math.max(...s)),h=i.active[0].polygon.slice();h.splice(a+1,0,[n,o]),i.active[0].set({polygon:h}),t._update({handler:t,state:i})})({handler:u,pos:y,state:i});return}n=!0}if(i.active.length&&i.active.forEach((t=>{i.scene.nodesById[t.id]&&t.setTransient({_isSelected:!1})})),e){l||(i.active=[]);var g=l&&i.active.findIndex((t=>t.id===e)),m=Number.isFinite(g)&&g>=0;m&&i.active.splice(g,1);var _=i.scene.nodesById[e],x=!!i.active.find((t=>"polyfloor"===t.type));if(i.active.length>0&&(x&&"polyfloor"!==_.type||!x&&"polyfloor"===_.type))return i.active.forEach((t=>t.setTransient({_isSelected:!0}))),void i.emit("select",{node:i.active[0]});if(!_)return;if(i.settings.selectAllowList.length&&!i.settings.selectAllowList.includes(_.type))return i.active=[],i.activeGroup=null,u.visible=!1,void i.emit("select",{});var b,P=_.getParents(),w=i.activeGroup&&P.some((t=>t.id===i.activeGroup));if(!r)for(var E of P){if("group"!==E.type||i.activeGroup===E.id)break;b=E}var T=!!b||"group"===_.type;if(i.activeGroup&&!w)return i.emit("draw-xray",{xrayMode:!1}),i.activeGroup=null,void(u.visible=!1);if(n&&T)return i.activeGroup&&i.emit("draw-xray",{xrayMode:!1}),i.activeGroup=b?b.id:e,i.emit("draw-xray",{xrayMode:!0}),u.visible=!1,i.active=[],void i.emit("select",{});if(b?i.active.push(b):m||i.active.push(_),i.active.forEach((t=>t.setTransient({_isSelected:!0}))),t&&t.data){var{x:C,y:I}=t.data.global;i.windowPos=[C,I],i.lastSceneClick=i.getPlanPosition(i.windowPos)}var S=i.active[0].getWorldPosition();u.visible=!0,u.x=S.x*i.scale,u.y=S.z*i.scale,u.rotation=Math.PI/180*-S.ry,1===i.active.length&&i.active[0].locked||i.emit("handler",{handler:u,state:i}),i.viewportNeedsUpdate=!0}else i.active=[],i.activeGroup&&i.emit("draw-xray",{xrayMode:!1}),i.activeGroup=null,u.visible=!1;i.emit("select",{node:i.active[0]})}}var Re=o.debug;function De({walls:t,data:e,options:i={updateState:!0,singleConnect:!1,preservePos:!1}}){if(t){e||(e=t.map(Dt));var r=t.every((t=>"a:helper:spaceDivider"===t.type)),n=i.actionId,o=t[0].ry<=180?t[0].ry:t[0].ry-180,s=t[1].ry<=180?t[1].ry:t[1].ry-180,a=Math.abs(parseInt(o)-parseInt(s));if(a<1)return{};if(i.preservePos&&a>170&&a<190)return{};var h,l,u,p,c,d,f,v,y,g,m,_,x,b,P=2,w=[e[0].p1,e[1].p1],E=[e[0].p2,e[1].p2],T=[e[0].p3,e[1].p3],C=[e[0].p4,e[1].p4],I=[e[0].nL,e[1].nL],S=[],O=[e[0].w,e[1].w],A=[],M=[],L=[],N=[],R=[];for(h=tt(w[0],E[0],w[1],E[1]),u=rt(l=tt(w[0],E[0],T[1],C[1]),O[1]),c=rt(p=tt(T[0],C[0],w[1],E[1]),O[0]),f=rt(d=tt(T[0],C[0],T[1],C[1]),O[0]),v=rt(d,O[1]),b=0;b<P;b++)y=Z(w[b],h),(g=Z(E[b],h))>y?(A[b]=g,N[b]={x:E[b].x,z:E[b].z},L[b]=!1,R[b]=y>20):(A[b]=y,N[b]={x:w[b].x,z:w[b].z},L[b]=!0,R[b]=g>20),S[b]={x:(N[b].x-h.x)/A[b],z:(N[b].z-h.z)/A[b]},M[b]=Z(N[b],b<1?f:v);if(R[0]&&R[1])return Re&&console.log("intersection too far away"),{};if(_=ke(I[0],I[1]),(x=ke(S[0],S[1]))<10)return Re&&console.log("angle too small"),{};i.singleConnect&&(P=1);var D=[];for(b=0;b<P;b++){r?m=h:Math.round(_)>=88&&Math.round(_)<=92?m=L[0]===L[1]?M[0]<A[0]?_>90?b<1?l:v:b<1?f:v:_>90&&b<1?c:h:M[0]<A[0]?b<1?l:u:b<1?c:p:_<90?x<=90||M[0]<A[0]?m=h:M[0]>A[0]&&(m=b<1?f:v):x<=90?m=b<1?l:u:M[0]<A[0]?m=b<1?c:p:M[0]>A[0]&&(m=b<1?l:u);var k=t[b].l;if(!m)return Re&&console.log("pSnap failed"),{};var F=Z(N[b],m);if(Math.abs(F-k)>.5&&Re&&console.log("delta",ht(F-k),"new",ht(F),"old",ht(k)),L[b])t[b].set({l:F},{updateState:i.updateState,actionId:n}),D[b]="end";else{"back"!==t[b].controlLine&&(m.x+=-e[b].p1.x+e[b].l1.x,m.z+=-e[b].p1.z+e[b].l1.z),t[b].set({x:m.x,z:m.z,l:F},{updateState:i.updateState,actionId:n}),D[b]="start";var B=t[b].children||[];if(B.length>0)for(var U=0;U<B.length;U++){var z=B[U].x-k+F;z=Math.max(0,z),z=Math.min(F-B[U].l,z),B[U].set({x:z},{updateState:i.updateState,actionId:n})}}}return{walls:t,connections:D}}}function ke(t,e){return ht(180*Math.acos(t.x*e.x+t.z*e.z)/Math.PI,2)}var Fe=({state:t,wall1:e,wall2:i,rel1:r,rel2:n,actionId:o})=>{if(e&&i){var s=[...Be({state:t,wall:e}),...Be({state:t,wall:i})].reduce(((t,e)=>t.find((t=>t.node.id===e.node.id))?t:t.concat(e)),[]);if(!s.some((t=>{var o=t.node.nodeIds;return o[e.id]&&o[i.id]&&o[e.id]===r&&o[i.id]===n}))){s.forEach((t=>{var s=t.node.nodeIds;"edge"!==r&&s[e.id]&&s[e.id]===r&&t.node.remove({actionId:o}),"edge"!==n&&s[i.id]&&s[i.id]===n&&t.node.remove({actionId:o})}));var a={type:"a:relation:wall",nodeIds:{[e.id]:r,[i.id]:n}};return t.getActiveLevel().addChild(a,{actionId:o})}}},Be=({state:t,wall:e})=>t.computed.relations.walls.filter((t=>Object.keys(t.node.nodeIds).includes(e.id))),Ue=(t,e,i,r=!1)=>{var n=e.find((e=>e.id===Object.keys(t.nodeIds)[0]));if(n&&n.id){var o,s,a,h,l=Object.keys(t.nodeIds),u=l.map((e=>{var r=i.scene.nodesById[e];return r&&{relation:t.nodeIds[r.id],node:r}})).filter((t=>t));if(u.length<2)return console.log("invalid wall relation"),void t.remove();if(l.forEach((i=>{"start"===t.nodeIds[i]&&(o=e.find((t=>t.id===i))),"edge"===t.nodeIds[i]&&(s=e.find((t=>t.id===i))),"end"===t.nodeIds[i]&&(a=e.find((t=>t.id===i)))})),o){var{x:p,z:c}=o;h=[p,c]}else if(a){var d=Dt(a).l2;h=[d.x,d.z]}return h?{node:t,point:h,isEdge:!!s,relatedNodes:u}:(console.log("invalid wall relation"),void t.remove())}r&&t.remove()},ze=t=>{if(!t.settings.loadWallRelations)return[];var e=t.scene.nodesByType["a:relation:wall"]||[];if(!e.length)return[];var i=t.scene.nodesByType.wall.map((t=>t.getWorldPosition())),r=t.scene.nodesByType["a:helper:spaceDivider"].map((t=>t.getWorldPosition()));return e.map((e=>Ue(e,i.concat(r),t))).filter((t=>t))},Xe=(t,e=[],i)=>{e.forEach((e=>{var r=e.isEdge;De({walls:e.relatedNodes.sort(((t,e)=>"edge"===t.relation?1:"edge"===e.relation?-1:void 0)).map((t=>t.node)),options:{updateState:!1,singleConnect:r,actionId:i}}),((t,e,i)=>{if(t.computed.relations.walls){var r=Ue(e,i,t,!0),n=t.computed.relations.walls.findIndex((t=>t.node.id===e.id));r?t.computed.relations.walls[n]=r:t.computed.relations.walls.splice(n,1)}})(t,e.node,[e.relatedNodes[0].node.getWorldPosition(),e.relatedNodes[1].node.getWorldPosition()])}))},je="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Ye="object"==typeof je&&je&&je.Object===Object&&je,He="object"==typeof self&&self&&self.Object===Object&&self,Ge=Ye||He||Function("return this")(),We=Ge.Symbol,Ve=Object.prototype,qe=Ve.hasOwnProperty,Ze=Ve.toString,Je=We?We.toStringTag:void 0;var Ke=Object.prototype.toString;var Qe=We?We.toStringTag:void 0;function $e(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Qe&&Qe in Object(t)?function(t){var e=qe.call(t,Je),i=t[Je];try{t[Je]=void 0;var r=!0}catch(t){}var n=Ze.call(t);return r&&(e?t[Je]=i:delete t[Je]),n}(t):function(t){return Ke.call(t)}(t)}function ti(t){return null!=t&&"object"==typeof t}function ei(t){return"symbol"==typeof t||ti(t)&&"[object Symbol]"==$e(t)}function ii(t,e){for(var i=-1,r=null==t?0:t.length,n=Array(r);++i<r;)n[i]=e(t[i],i,t);return n}var ri=Array.isArray,ni=We?We.prototype:void 0,oi=ni?ni.toString:void 0;function si(t){if("string"==typeof t)return t;if(ri(t))return ii(t,si)+"";if(ei(t))return oi?oi.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}var ai=/\s/;var hi=/^\s+/;function li(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&ai.test(t.charAt(e)););return e}(t)+1).replace(hi,""):t}function ui(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var pi=/^[-+]0x[0-9a-f]+$/i,ci=/^0b[01]+$/i,di=/^0o[0-7]+$/i,fi=parseInt;function vi(t){if("number"==typeof t)return t;if(ei(t))return NaN;if(ui(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ui(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=li(t);var i=ci.test(t);return i||di.test(t)?fi(t.slice(2),i?2:8):pi.test(t)?NaN:+t}function yi(t){return t}function gi(t){if(!ui(t))return!1;var e=$e(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var mi=Ge["__core-js_shared__"],_i=function(){var t=/[^.]+$/.exec(mi&&mi.keys&&mi.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();var xi=Function.prototype.toString;function bi(t){if(null!=t){try{return xi.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var Pi=/^\[object .+?Constructor\]$/,wi=Function.prototype,Ei=Object.prototype,Ti=wi.toString,Ci=Ei.hasOwnProperty,Ii=RegExp("^"+Ti.call(Ci).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Si(t){return!(!ui(t)||(e=t,_i&&_i in e))&&(gi(t)?Ii:Pi).test(bi(t));var e}function Oi(t,e){var i=function(t,e){return null==t?void 0:t[e]}(t,e);return Si(i)?i:void 0}var Ai=Oi(Ge,"WeakMap"),Mi=Object.create,Li=function(){function t(){}return function(e){if(!ui(e))return{};if(Mi)return Mi(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}();function Ni(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function Ri(t,e){var i=-1,r=t.length;for(e||(e=Array(r));++i<r;)e[i]=t[i];return e}var Di=Date.now;var ki,Fi,Bi,Ui=function(){try{var t=Oi(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),zi=Ui,Xi=zi?function(t,e){return zi(t,"toString",{configurable:!0,enumerable:!1,value:(i=e,function(){return i}),writable:!0});var i}:yi,ji=(ki=Xi,Fi=0,Bi=0,function(){var t=Di(),e=16-(t-Bi);if(Bi=t,e>0){if(++Fi>=800)return arguments[0]}else Fi=0;return ki.apply(void 0,arguments)}),Yi=ji;var Hi=/^(?:0|[1-9]\d*)$/;function Gi(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&Hi.test(t))&&t>-1&&t%1==0&&t<e}function Wi(t,e,i){"__proto__"==e&&zi?zi(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}function Vi(t,e){return t===e||t!=t&&e!=e}var qi=Object.prototype.hasOwnProperty;function Zi(t,e,i){var r=t[e];qi.call(t,e)&&Vi(r,i)&&(void 0!==i||e in t)||Wi(t,e,i)}function Ji(t,e,i,r){var n=!i;i||(i={});for(var o=-1,s=e.length;++o<s;){var a=e[o],h=r?r(i[a],t[a],a,i,t):void 0;void 0===h&&(h=t[a]),n?Wi(i,a,h):Zi(i,a,h)}return i}var Ki=Math.max;function Qi(t,e){return Yi(function(t,e,i){return e=Ki(void 0===e?t.length-1:e,0),function(){for(var r=arguments,n=-1,o=Ki(r.length-e,0),s=Array(o);++n<o;)s[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=i(s),Ni(t,this,a)}}(t,e,yi),t+"")}function $i(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function tr(t){return null!=t&&$i(t.length)&&!gi(t)}function er(t,e,i){if(!ui(i))return!1;var r=typeof e;return!!("number"==r?tr(i)&&Gi(e,i.length):"string"==r&&e in i)&&Vi(i[e],t)}var ir=Object.prototype;function rr(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ir)}function nr(t){return ti(t)&&"[object Arguments]"==$e(t)}var or=Object.prototype,sr=or.hasOwnProperty,ar=or.propertyIsEnumerable,hr=nr(function(){return arguments}())?nr:function(t){return ti(t)&&sr.call(t,"callee")&&!ar.call(t,"callee")},lr=hr;var ur="object"==typeof exports&&exports&&!exports.nodeType&&exports,pr=ur&&"object"==typeof module&&module&&!module.nodeType&&module,cr=pr&&pr.exports===ur?Ge.Buffer:void 0,dr=(cr?cr.isBuffer:void 0)||function(){return!1},fr={};function vr(t){return function(e){return t(e)}}fr["[object Float32Array]"]=fr["[object Float64Array]"]=fr["[object Int8Array]"]=fr["[object Int16Array]"]=fr["[object Int32Array]"]=fr["[object Uint8Array]"]=fr["[object Uint8ClampedArray]"]=fr["[object Uint16Array]"]=fr["[object Uint32Array]"]=!0,fr["[object Arguments]"]=fr["[object Array]"]=fr["[object ArrayBuffer]"]=fr["[object Boolean]"]=fr["[object DataView]"]=fr["[object Date]"]=fr["[object Error]"]=fr["[object Function]"]=fr["[object Map]"]=fr["[object Number]"]=fr["[object Object]"]=fr["[object RegExp]"]=fr["[object Set]"]=fr["[object String]"]=fr["[object WeakMap]"]=!1;var yr="object"==typeof exports&&exports&&!exports.nodeType&&exports,gr=yr&&"object"==typeof module&&module&&!module.nodeType&&module,mr=gr&&gr.exports===yr&&Ye.process,_r=function(){try{var t=gr&&gr.require&&gr.require("util").types;return t||mr&&mr.binding&&mr.binding("util")}catch(t){}}(),xr=_r,br=xr&&xr.isTypedArray,Pr=br?vr(br):function(t){return ti(t)&&$i(t.length)&&!!fr[$e(t)]},wr=Object.prototype.hasOwnProperty;function Er(t,e){var i=ri(t),r=!i&&lr(t),n=!i&&!r&&dr(t),o=!i&&!r&&!n&&Pr(t),s=i||r||n||o,a=s?function(t,e){for(var i=-1,r=Array(t);++i<t;)r[i]=e(i);return r}(t.length,String):[],h=a.length;for(var l in t)!e&&!wr.call(t,l)||s&&("length"==l||n&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Gi(l,h))||a.push(l);return a}function Tr(t,e){return function(i){return t(e(i))}}var Cr=Tr(Object.keys,Object),Ir=Object.prototype.hasOwnProperty;function Sr(t){return tr(t)?Er(t):function(t){if(!rr(t))return Cr(t);var e=[];for(var i in Object(t))Ir.call(t,i)&&"constructor"!=i&&e.push(i);return e}(t)}var Or=Object.prototype.hasOwnProperty;function Ar(t){if(!ui(t))return function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e}(t);var e=rr(t),i=[];for(var r in t)("constructor"!=r||!e&&Or.call(t,r))&&i.push(r);return i}function Mr(t){return tr(t)?Er(t,!0):Ar(t)}var Lr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Nr=/^\w*$/;function Rr(t,e){if(ri(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!ei(t))||(Nr.test(t)||!Lr.test(t)||null!=e&&t in Object(e))}var Dr=Oi(Object,"create");var kr=Object.prototype.hasOwnProperty;var Fr=Object.prototype.hasOwnProperty;function Br(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function Ur(t,e){for(var i=t.length;i--;)if(Vi(t[i][0],e))return i;return-1}Br.prototype.clear=function(){this.__data__=Dr?Dr(null):{},this.size=0},Br.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Br.prototype.get=function(t){var e=this.__data__;if(Dr){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return kr.call(e,t)?e[t]:void 0},Br.prototype.has=function(t){var e=this.__data__;return Dr?void 0!==e[t]:Fr.call(e,t)},Br.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Dr&&void 0===e?"__lodash_hash_undefined__":e,this};var zr=Array.prototype.splice;function Xr(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}Xr.prototype.clear=function(){this.__data__=[],this.size=0},Xr.prototype.delete=function(t){var e=this.__data__,i=Ur(e,t);return!(i<0)&&(i==e.length-1?e.pop():zr.call(e,i,1),--this.size,!0)},Xr.prototype.get=function(t){var e=this.__data__,i=Ur(e,t);return i<0?void 0:e[i][1]},Xr.prototype.has=function(t){return Ur(this.__data__,t)>-1},Xr.prototype.set=function(t,e){var i=this.__data__,r=Ur(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this};var jr=Oi(Ge,"Map");function Yr(t,e){var i,r,n=t.__data__;return("string"==(r=typeof(i=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?n["string"==typeof e?"string":"hash"]:n.map}function Hr(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}Hr.prototype.clear=function(){this.size=0,this.__data__={hash:new Br,map:new(jr||Xr),string:new Br}},Hr.prototype.delete=function(t){var e=Yr(this,t).delete(t);return this.size-=e?1:0,e},Hr.prototype.get=function(t){return Yr(this,t).get(t)},Hr.prototype.has=function(t){return Yr(this,t).has(t)},Hr.prototype.set=function(t,e){var i=Yr(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this};function Gr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var i=function(){var r=arguments,n=e?e.apply(this,r):r[0],o=i.cache;if(o.has(n))return o.get(n);var s=t.apply(this,r);return i.cache=o.set(n,s)||o,s};return i.cache=new(Gr.Cache||Hr),i}Gr.Cache=Hr;var Wr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Vr=/\\(\\)?/g,qr=function(t){var e=Gr(t,(function(t){return 500===i.size&&i.clear(),t})),i=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Wr,(function(t,i,r,n){e.push(r?n.replace(Vr,"$1"):i||t)})),e})),Zr=qr;function Jr(t,e){return ri(t)?t:Rr(t,e)?[t]:Zr(function(t){return null==t?"":si(t)}(t))}function Kr(t){if("string"==typeof t||ei(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Qr(t,e){for(var i=0,r=(e=Jr(e,t)).length;null!=t&&i<r;)t=t[Kr(e[i++])];return i&&i==r?t:void 0}function $r(t,e){for(var i=-1,r=e.length,n=t.length;++i<r;)t[n+i]=e[i];return t}var tn=We?We.isConcatSpreadable:void 0;function en(t){return ri(t)||lr(t)||!!(tn&&t&&t[tn])}function rn(t,e,i,r,n){var o=-1,s=t.length;for(i||(i=en),n||(n=[]);++o<s;){var a=t[o];e>0&&i(a)?e>1?rn(a,e-1,i,r,n):$r(n,a):r||(n[n.length]=a)}return n}var nn=Tr(Object.getPrototypeOf,Object),on=Function.prototype,sn=Object.prototype,an=on.toString,hn=sn.hasOwnProperty,ln=an.call(Object);function un(t){var e=this.__data__=new Xr(t);this.size=e.size}un.prototype.clear=function(){this.__data__=new Xr,this.size=0},un.prototype.delete=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i},un.prototype.get=function(t){return this.__data__.get(t)},un.prototype.has=function(t){return this.__data__.has(t)},un.prototype.set=function(t,e){var i=this.__data__;if(i instanceof Xr){var r=i.__data__;if(!jr||r.length<199)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new Hr(r)}return i.set(t,e),this.size=i.size,this};var pn="object"==typeof exports&&exports&&!exports.nodeType&&exports,cn=pn&&"object"==typeof module&&module&&!module.nodeType&&module,dn=cn&&cn.exports===pn?Ge.Buffer:void 0,fn=dn?dn.allocUnsafe:void 0;function vn(t,e){if(e)return t.slice();var i=t.length,r=fn?fn(i):new t.constructor(i);return t.copy(r),r}function yn(){return[]}var gn=Object.prototype.propertyIsEnumerable,mn=Object.getOwnPropertySymbols,_n=mn?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var i=-1,r=null==t?0:t.length,n=0,o=[];++i<r;){var s=t[i];e(s,i,t)&&(o[n++]=s)}return o}(mn(t),(function(e){return gn.call(t,e)})))}:yn,xn=_n;var bn=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)$r(e,xn(t)),t=nn(t);return e}:yn;function Pn(t,e,i){var r=e(t);return ri(t)?r:$r(r,i(t))}function wn(t){return Pn(t,Sr,xn)}function En(t){return Pn(t,Mr,bn)}var Tn=Oi(Ge,"DataView"),Cn=Oi(Ge,"Promise"),In=Oi(Ge,"Set"),Sn="[object Map]",On="[object Promise]",An="[object Set]",Mn="[object WeakMap]",Ln="[object DataView]",Nn=bi(Tn),Rn=bi(jr),Dn=bi(Cn),kn=bi(In),Fn=bi(Ai),Bn=$e;(Tn&&Bn(new Tn(new ArrayBuffer(1)))!=Ln||jr&&Bn(new jr)!=Sn||Cn&&Bn(Cn.resolve())!=On||In&&Bn(new In)!=An||Ai&&Bn(new Ai)!=Mn)&&(Bn=function(t){var e=$e(t),i="[object Object]"==e?t.constructor:void 0,r=i?bi(i):"";if(r)switch(r){case Nn:return Ln;case Rn:return Sn;case Dn:return On;case kn:return An;case Fn:return Mn}return e});var Un=Bn,zn=Object.prototype.hasOwnProperty;var Xn=Ge.Uint8Array;function jn(t){var e=new t.constructor(t.byteLength);return new Xn(e).set(new Xn(t)),e}var Yn=/\w*$/;var Hn=We?We.prototype:void 0,Gn=Hn?Hn.valueOf:void 0;function Wn(t,e){var i=e?jn(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}function Vn(t,e,i){var r,n,o,s=t.constructor;switch(e){case"[object ArrayBuffer]":return jn(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var i=e?jn(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}(t,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Wn(t,i);case"[object Map]":case"[object Set]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(o=new(n=t).constructor(n.source,Yn.exec(n))).lastIndex=n.lastIndex,o;case"[object Symbol]":return r=t,Gn?Object(Gn.call(r)):{}}}function qn(t){return"function"!=typeof t.constructor||rr(t)?{}:Li(nn(t))}var Zn=xr&&xr.isMap,Jn=Zn?vr(Zn):function(t){return ti(t)&&"[object Map]"==Un(t)};var Kn=xr&&xr.isSet,Qn=Kn?vr(Kn):function(t){return ti(t)&&"[object Set]"==Un(t)},$n="[object Arguments]",to="[object Function]",eo="[object Object]",io={};function ro(t,e,i,r,n,o){var s,a=1&e,h=2&e,l=4&e;if(i&&(s=n?i(t,r,n,o):i(t)),void 0!==s)return s;if(!ui(t))return t;var u=ri(t);if(u){if(s=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&zn.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!a)return Ri(t,s)}else{var p=Un(t),c=p==to||"[object GeneratorFunction]"==p;if(dr(t))return vn(t,a);if(p==eo||p==$n||c&&!n){if(s=h||c?{}:qn(t),!a)return h?function(t,e){return Ji(t,bn(t),e)}(t,function(t,e){return t&&Ji(e,Mr(e),t)}(s,t)):function(t,e){return Ji(t,xn(t),e)}(t,function(t,e){return t&&Ji(e,Sr(e),t)}(s,t))}else{if(!io[p])return n?t:{};s=Vn(t,p,a)}}o||(o=new un);var d=o.get(t);if(d)return d;o.set(t,s),Qn(t)?t.forEach((function(r){s.add(ro(r,e,i,r,t,o))})):Jn(t)&&t.forEach((function(r,n){s.set(n,ro(r,e,i,n,t,o))}));var f=u?void 0:(l?h?En:wn:h?Mr:Sr)(t);return function(t,e){for(var i=-1,r=null==t?0:t.length;++i<r&&!1!==e(t[i],i,t););}(f||t,(function(r,n){f&&(r=t[n=r]),Zi(s,n,ro(r,e,i,n,t,o))})),s}io[$n]=io["[object Array]"]=io["[object ArrayBuffer]"]=io["[object DataView]"]=io["[object Boolean]"]=io["[object Date]"]=io["[object Float32Array]"]=io["[object Float64Array]"]=io["[object Int8Array]"]=io["[object Int16Array]"]=io["[object Int32Array]"]=io["[object Map]"]=io["[object Number]"]=io[eo]=io["[object RegExp]"]=io["[object Set]"]=io["[object String]"]=io["[object Symbol]"]=io["[object Uint8Array]"]=io["[object Uint8ClampedArray]"]=io["[object Uint16Array]"]=io["[object Uint32Array]"]=!0,io["[object Error]"]=io[to]=io["[object WeakMap]"]=!1;function no(t){return ro(t,5)}function oo(t){var e=-1,i=null==t?0:t.length;for(this.__data__=new Hr;++e<i;)this.add(t[e])}function so(t,e){for(var i=-1,r=null==t?0:t.length;++i<r;)if(e(t[i],i,t))return!0;return!1}oo.prototype.add=oo.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},oo.prototype.has=function(t){return this.__data__.has(t)};function ao(t,e,i,r,n,o){var s=1&i,a=t.length,h=e.length;if(a!=h&&!(s&&h>a))return!1;var l=o.get(t),u=o.get(e);if(l&&u)return l==e&&u==t;var p=-1,c=!0,d=2&i?new oo:void 0;for(o.set(t,e),o.set(e,t);++p<a;){var f=t[p],v=e[p];if(r)var y=s?r(v,f,p,e,t,o):r(f,v,p,t,e,o);if(void 0!==y){if(y)continue;c=!1;break}if(d){if(!so(e,(function(t,e){if(s=e,!d.has(s)&&(f===t||n(f,t,i,r,o)))return d.push(e);var s}))){c=!1;break}}else if(f!==v&&!n(f,v,i,r,o)){c=!1;break}}return o.delete(t),o.delete(e),c}function ho(t){var e=-1,i=Array(t.size);return t.forEach((function(t,r){i[++e]=[r,t]})),i}function lo(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=t})),i}var uo=We?We.prototype:void 0,po=uo?uo.valueOf:void 0;var co=Object.prototype.hasOwnProperty;var fo="[object Arguments]",vo="[object Array]",yo="[object Object]",go=Object.prototype.hasOwnProperty;function mo(t,e,i,r,n,o){var s=ri(t),a=ri(e),h=s?vo:Un(t),l=a?vo:Un(e),u=(h=h==fo?yo:h)==yo,p=(l=l==fo?yo:l)==yo,c=h==l;if(c&&dr(t)){if(!dr(e))return!1;s=!0,u=!1}if(c&&!u)return o||(o=new un),s||Pr(t)?ao(t,e,i,r,n,o):function(t,e,i,r,n,o,s){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new Xn(t),new Xn(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Vi(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=ho;case"[object Set]":var h=1&r;if(a||(a=lo),t.size!=e.size&&!h)return!1;var l=s.get(t);if(l)return l==e;r|=2,s.set(t,e);var u=ao(a(t),a(e),r,n,o,s);return s.delete(t),u;case"[object Symbol]":if(po)return po.call(t)==po.call(e)}return!1}(t,e,h,i,r,n,o);if(!(1&i)){var d=u&&go.call(t,"__wrapped__"),f=p&&go.call(e,"__wrapped__");if(d||f){var v=d?t.value():t,y=f?e.value():e;return o||(o=new un),n(v,y,i,r,o)}}return!!c&&(o||(o=new un),function(t,e,i,r,n,o){var s=1&i,a=wn(t),h=a.length;if(h!=wn(e).length&&!s)return!1;for(var l=h;l--;){var u=a[l];if(!(s?u in e:co.call(e,u)))return!1}var p=o.get(t),c=o.get(e);if(p&&c)return p==e&&c==t;var d=!0;o.set(t,e),o.set(e,t);for(var f=s;++l<h;){var v=t[u=a[l]],y=e[u];if(r)var g=s?r(y,v,u,e,t,o):r(v,y,u,t,e,o);if(!(void 0===g?v===y||n(v,y,i,r,o):g)){d=!1;break}f||(f="constructor"==u)}if(d&&!f){var m=t.constructor,_=e.constructor;m==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof m&&m instanceof m&&"function"==typeof _&&_ instanceof _||(d=!1)}return o.delete(t),o.delete(e),d}(t,e,i,r,n,o))}function _o(t,e,i,r,n){return t===e||(null==t||null==e||!ti(t)&&!ti(e)?t!=t&&e!=e:mo(t,e,i,r,_o,n))}function xo(t){return t==t&&!ui(t)}function bo(t,e){return function(i){return null!=i&&(i[t]===e&&(void 0!==e||t in Object(i)))}}function Po(t){var e=function(t){for(var e=Sr(t),i=e.length;i--;){var r=e[i],n=t[r];e[i]=[r,n,xo(n)]}return e}(t);return 1==e.length&&e[0][2]?bo(e[0][0],e[0][1]):function(i){return i===t||function(t,e,i,r){var n=i.length,o=n,s=!r;if(null==t)return!o;for(t=Object(t);n--;){var a=i[n];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++n<o;){var h=(a=i[n])[0],l=t[h],u=a[1];if(s&&a[2]){if(void 0===l&&!(h in t))return!1}else{var p=new un;if(r)var c=r(l,u,h,t,e,p);if(!(void 0===c?_o(u,l,3,r,p):c))return!1}}return!0}(i,t,e)}}function wo(t,e){return null!=t&&e in Object(t)}function Eo(t,e){return null!=t&&function(t,e,i){for(var r=-1,n=(e=Jr(e,t)).length,o=!1;++r<n;){var s=Kr(e[r]);if(!(o=null!=t&&i(t,s)))break;t=t[s]}return o||++r!=n?o:!!(n=null==t?0:t.length)&&$i(n)&&Gi(s,n)&&(ri(t)||lr(t))}(t,e,wo)}function To(t,e){return Rr(t)&&xo(e)?bo(Kr(t),e):function(i){var r=function(t,e,i){var r=null==t?void 0:Qr(t,e);return void 0===r?i:r}(i,t);return void 0===r&&r===e?Eo(i,t):_o(e,r,3)}}function Co(t){return Rr(t)?(e=Kr(t),function(t){return null==t?void 0:t[e]}):function(t){return function(e){return Qr(e,t)}}(t);var e}function Io(t){return"function"==typeof t?t:null==t?yi:"object"==typeof t?ri(t)?To(t[0],t[1]):Po(t):Co(t)}var So,Oo=function(t,e,i){for(var r=-1,n=Object(t),o=i(t),s=o.length;s--;){var a=o[So?s:++r];if(!1===e(n[a],a,n))break}return t},Ao=Oo;var Mo=function(t,e){return function(i,r){if(null==i)return i;if(!tr(i))return t(i,r);for(var n=i.length,o=e?n:-1,s=Object(i);(e?o--:++o<n)&&!1!==r(s[o],o,s););return i}}((function(t,e){return t&&Ao(t,e,Sr)})),Lo=Mo,No=function(){return Ge.Date.now()},Ro=Math.max,Do=Math.min;function ko(t,e,i){var r,n,o,s,a,h,l=0,u=!1,p=!1,c=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){var i=r,o=n;return r=n=void 0,l=e,s=t.apply(o,i)}function f(t){return l=t,a=setTimeout(y,e),u?d(t):s}function v(t){var i=t-h;return void 0===h||i>=e||i<0||p&&t-l>=o}function y(){var t=No();if(v(t))return g(t);a=setTimeout(y,function(t){var i=e-(t-h);return p?Do(i,o-(t-l)):i}(t))}function g(t){return a=void 0,c&&r?d(t):(r=n=void 0,s)}function m(){var t=No(),i=v(t);if(r=arguments,n=this,h=t,i){if(void 0===a)return f(h);if(p)return clearTimeout(a),a=setTimeout(y,e),d(h)}return void 0===a&&(a=setTimeout(y,e)),s}return e=vi(e)||0,ui(i)&&(u=!!i.leading,o=(p="maxWait"in i)?Ro(vi(i.maxWait)||0,e):o,c="trailing"in i?!!i.trailing:c),m.cancel=function(){void 0!==a&&clearTimeout(a),l=0,r=h=n=a=void 0},m.flush=function(){return void 0===a?s:g(No())},m}function Fo(t,e,i){(void 0!==i&&!Vi(t[e],i)||void 0===i&&!(e in t))&&Wi(t,e,i)}function Bo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Uo(t,e,i,r,n,o,s){var a=Bo(t,i),h=Bo(e,i),l=s.get(h);if(l)Fo(t,i,l);else{var u,p=o?o(a,h,i+"",t,e,s):void 0,c=void 0===p;if(c){var d=ri(h),f=!d&&dr(h),v=!d&&!f&&Pr(h);p=h,d||f||v?ri(a)?p=a:ti(u=a)&&tr(u)?p=Ri(a):f?(c=!1,p=vn(h,!0)):v?(c=!1,p=Wn(h,!0)):p=[]:function(t){if(!ti(t)||"[object Object]"!=$e(t))return!1;var e=nn(t);if(null===e)return!0;var i=hn.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&an.call(i)==ln}(h)||lr(h)?(p=a,lr(a)?p=function(t){return Ji(t,Mr(t))}(a):ui(a)&&!gi(a)||(p=qn(h))):c=!1}c&&(s.set(h,p),n(p,h,r,o,s),s.delete(h)),Fo(t,i,p)}}function zo(t,e,i,r,n){t!==e&&Ao(e,(function(o,s){if(n||(n=new un),ui(o))Uo(t,e,s,i,zo,r,n);else{var a=r?r(Bo(t,s),o,s+"",t,e,n):void 0;void 0===a&&(a=o),Fo(t,s,a)}}),Mr)}var Xo,jo=(Xo=function(t,e,i){zo(t,e,i)},Qi((function(t,e){var i=-1,r=e.length,n=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(n=Xo.length>3&&"function"==typeof n?(r--,n):void 0,o&&er(e[0],e[1],o)&&(n=r<3?void 0:n,r=1),t=Object(t);++i<r;){var s=e[i];s&&Xo(t,s,i,n)}return t}))),Yo=jo;function Ho(t,e){if(t!==e){var i=void 0!==t,r=null===t,n=t==t,o=ei(t),s=void 0!==e,a=null===e,h=e==e,l=ei(e);if(!a&&!l&&!o&&t>e||o&&s&&h&&!a&&!l||r&&s&&h||!i&&h||!n)return 1;if(!r&&!o&&!l&&t<e||l&&i&&n&&!r&&!o||a&&i&&n||!s&&n||!h)return-1}return 0}function Go(t,e,i){e=e.length?ii(e,(function(t){return ri(t)?function(e){return Qr(e,1===t.length?t[0]:t)}:t})):[yi];var r=-1;e=ii(e,vr(Io));var n=function(t,e){var i=-1,r=tr(t)?Array(t.length):[];return Lo(t,(function(t,n,o){r[++i]=e(t,n,o)})),r}(t,(function(t,i,n){return{criteria:ii(e,(function(e){return e(t)})),index:++r,value:t}}));return function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].value;return t}(n,(function(t,e){return function(t,e,i){for(var r=-1,n=t.criteria,o=e.criteria,s=n.length,a=i.length;++r<s;){var h=Ho(n[r],o[r]);if(h)return r>=a?h:h*("desc"==i[r]?-1:1)}return t.index-e.index}(t,e,i)}))}var Wo,Vo=Qi((function(t,e){if(null==t)return[];var i=e.length;return i>1&&er(t,e[0],e[1])?e=[]:i>2&&er(e[0],e[1],e[2])&&(e=[e[0]]),Go(t,rn(e,1),[])})),qo=Vo;function Zo(t={}){this.maxResolvedCache=t.maxResolvedCache||1e3,this._pendingPromises={},this._resolvedPromises={}}Zo.prototype={add:function(t,e){var i=this;if(this._pendingPromises[t])return this._pendingPromises[t];if(this._resolvedPromises[t])return this._resolvedPromises[t];var r={key:t,timestamp:Date.now(),promise:e};return this._pendingPromises[t]=r,e.then((function(e){var r=i._pendingPromises[t];delete i._pendingPromises[t],r.data=e,i._resolvedPromises[t]=r}),(function(){delete i._pendingPromises[t]})),this._collectGarbage(),r},get:function(t){var e=this._pendingPromises[t]||this._resolvedPromises[t];return!!e&&(e.timestamp=Date.now(),e.promise)},purge:function(){for(var t in this._resolvedPromises)delete this._resolvedPromises[t]},_collectGarbage:function(){var t=qo(this._resolvedPromises,(function(t){return t.timestamp})),e=t.length-this.maxResolvedCache;if(!(e<=0))for(var i=0;i<e;i++)delete this._resolvedPromises[t[i].key]}};class Jo{constructor(t="keyval-store",e="keyval"){this.storeName=e,this._dbp=new Promise(((i,r)=>{var n=indexedDB.open(t,1);n.onerror=()=>r(n.error),n.onsuccess=()=>i(n.result),n.onupgradeneeded=()=>{n.result.createObjectStore(e)}}))}_withIDBStore(t,e){return this._dbp.then((i=>new Promise(((r,n)=>{var o=i.transaction(this.storeName,t);o.oncomplete=()=>r(),o.onabort=o.onerror=()=>n(o.error),e(o.objectStore(this.storeName))}))))}}function Ko(){return Wo||(Wo=new Jo),Wo}function Qo(t,e=Ko()){var i;return e._withIDBStore("readonly",(e=>{i=e.get(t)})).then((()=>i.result))}function $o(t,e,i=Ko()){return i._withIDBStore("readwrite",(i=>{i.put(e,t)}))}var ts=new Jo("al-kvs","al-keyval"),es=!0;function is(t,e,i){return rs.apply(this,arguments)}function rs(){return(rs=r((function*(t,e,i){i=i||2592e6;try{var r={timeStamp:(new Date).getTime(),content:e,maxAge:i};if(es)yield $o(t,JSON.stringify(r),ts);else{var n=window&&window.localStorage;if(!n||!t||"string"!=typeof t)return;n.setItem(t,JSON.stringify(r))}return t}catch(t){return}}))).apply(this,arguments)}function ns(t,e){return os.apply(this,arguments)}function os(){return(os=r((function*(t,e){var i,r=e||2592e6,n=(new Date).getTime();try{if(es)i=yield Qo(t,ts);else{var o=window&&window.localStorage;if(!o||!t||"string"!=typeof t)return;i=o.getItem(t)}if(n-(i=JSON.parse(i)).timeStamp>Math.min(i.maxAge,r))return;if(i.content)return i.content}catch(t){return}}))).apply(this,arguments)}function ss(t){return t&&"string"==typeof t?t.toLowerCase().replace(/[()+&!?;,:_)]/g,"").replace(/\s+/g,"-"):""}function as(t,e){var i,r,n=null===(i=t.src)||void 0===i?void 0:i.substring(1),o=function(t={},e){var i=e&&e.length&&e[0].split(":")[0],r=Object.keys(t);return i&&"default"!==i&&(r=r.filter((t=>t===i))),1===r.length?r[0]:r.filter((t=>!t.toLowerCase().includes("base")))[0]}(t.materials,null===(r=e.products[n])||void 0===r?void 0:r.colours);return o&&ss(t.materials[o])}function hs(t,e){var i,r=null===(i=t.src)||void 0===i?void 0:i.substring(1),n=as(t,e);return r+(n=n?"_"+n:"")}ts._dbp.then((()=>{es=!0})).catch((t=>{es=!1,console.log("indexedDb initialisation failed",t)}));var ls={kitchen:function(t){var e=[],i=/90$/g.test(t.cooktopType),r=function(t){var e=t.elementLength,i=t.highCabinetLeft*e,r=t.highCabinetRight*e;return Math.max(0,t.l-i-r)}(t),n=function(t,e,i){var r,n=t.elementLength,o=.9,s=t.highCabinetLeft*n,a=[],h=0,l=0;for(r=0;r<t.highCabinetLeft;r++){var u=t.l-h;h+=u>n?n:u,a[r]=h,l++}for(;h+n<s+e;){h+=l===t.cooktopPos-1&&"none"!==t.cooktopType&&i?o:n,l++,a.push(h)}for(r=t.highCabinetRight;r>0;r--)h=t.l-n*r+n,a.push(h);return a=a.map((t=>Math.round(10*t)/10))}(t,r,i),o=function(t,e){var i,r=[];for(i=0;i<t.highCabinetLeft;i++)r.push(i);for(i=0;i<t.highCabinetRight;i++)r.push(e.length-1-i);return r}(t,n),s=function(t,e){return"number"==typeof t.sinkPos&&t.sinkPos>t.highCabinetLeft&&t.sinkPos<=e.length-t.highCabinetRight&&"none"!==t.sinkType?t.sinkPos:null}(t,n),a=function(t,e){return"number"==typeof t.cooktopPos&&t.cooktopPos>t.highCabinetLeft&&t.cooktopPos<=e.length-t.highCabinetRight&&"none"!==t.cooktopType?t.cooktopPos:null}(t,n);for(var h of(e.push(we([0,t.barCounter?-.25:0],t.l,t.barCounter?t.w+.25:t.w,!0)),n.forEach((i=>{e.push(Pe([i,t.w],[i,t.w-.075]))})),r&&t.barCounter&&e.push(Pe([t.highCabinetLeft*t.elementLength,0],[t.l-t.highCabinetRight*t.elementLength,0])),o)){var l=n[h],u=l-.6;e.push(Pe([u||0,t.w],[u||0,0]),Pe([u||0,0],[l,t.w]),Pe([u||0,t.w],[l,0]),Pe([l,t.w],[l,0]))}if(s&&n[s-2]){var p={type:"group",position:[n[s-2],0],children:[we([.05,t.w-.5],"double"!==t.sinkType?.5:1.1,.45),we([.1,t.w-.4],"double"!==t.sinkType?.4:.35,.3),we(["double"!==t.sinkType?t.elementLength/2-.02:.48,t.w-.45],.04,.18)]};"double"===t.sinkType&&p.children.push(we([.55,t.w-.4],.35,.3),Pe([.95,t.w-.4],[.95,t.w-.1]),Pe([1,t.w-.4],[1,t.w-.1]),Pe([1.05,t.w-.4],[1.05,t.w-.1]),Pe([1.1,t.w-.4],[1.1,t.w-.1])),e.push(p)}if(a&&n[a-2]){var c={type:"group",position:[n[a-2],0],children:[we([.05,t.w-.55],i?.8:.5,.5)]};i?c.children.push(Ee([.225,t.w-.4],.08),Ee([.675,t.w-.4],.08),Ee([.45,t.w-.3],.08),Ee([.225,t.w-.2],.08),Ee([.675,t.w-.2],.08)):c.children.push(Ee([.2,t.w-.4],.08),Ee([.4,t.w-.4],.08),Ee([.2,t.w-.2],.08),Ee([.4,t.w-.2],.08)),e.push(c)}return r&&t.wallCabinet&&e.push(Pe([t.highCabinetLeft*t.elementLength,t.wallCabinetWidth],[t.l-t.highCabinetRight*t.elementLength,t.wallCabinetWidth])),e},column:function(t){var e=[];return"square"===t.shape?e.push({type:"rect",position:[-t.l/2,-t.l/2],width:t.l,height:t.l,isContour:!0}):"circle"===t.shape?e.push({type:"circle",position:[0,0],r:t.l/2,isContour:!0}):"polygon"===t.shape&&e.push({type:"polygon",points:t.polygon,isContour:!0}),e},stairs:function(t,i={}){var r,n=e({w:1.2,l:4},t),o="labelled"!==i.style,s="left"===t.circulation,a=.3,h=t.stairType||"straight",l=t.l,u=t.stepWidth;"straightLanding"===t.stairType?l=t.l-1:"lShaped"===t.stairType?l=t.l+t.w-2*u:"winder"===t.stairType?l=t.l+t.w-u:"halfLanding"===t.stairType?l=2*(t.l-u):"2QuarterLanding"===t.stairType?l=2*(t.l-u)+t.w-2*u:"doubleWinder"===t.stairType&&(l=2*t.l+t.w-2*u);var p,c,d,f=(l/t.h+1.2321)/.10357/100,v=Math.round(l/f),y=l/v,g={shape:[],runs:[]};switch(h){case"straight":case"straightLanding":g.shape=[[0,0],[t.l,0],[t.l,t.w],[0,t.w]];break;case"lShaped":case"winder":g.shape=[[0,0],[t.l,0],[t.l,t.w],[t.l-u,t.w],[t.l-u,u],[0,u]];break;case"halfLanding":case"2QuarterLanding":case"doubleWinder":g.shape=[[0,0],[t.l,0],[t.l,t.w],[0,t.w],[0,t.w-u],[t.l-u,t.w-u],[t.l-u,u],[0,u]]}if(o)switch(h){case"straight":g.runs=[{type:"straight",data:[0,0,v,y,0]}];break;case"straightLanding":c=v-(p=Math.ceil(v/2)),g.runs=[{type:"straight",data:[0,0,p,y,0]},{type:"straight",data:[p*y+1,0,c,y,0]}];break;case"lShaped":c=v-(p=Math.floor((t.l-u)/y)),g.runs=[{type:"straight",data:[0,0,p,(t.l-u)/p,0]},{type:"straight",data:[t.l,u,c,(t.w-u)/c,-90]}];break;case"winder":c=2*Math.round((u/2+a)/y),d=v-(p=Math.round((t.l-u-a)/y))-c,g.runs=[{type:"straight",data:[0,0,p,(t.l-u-a)/p,0]},{type:"winder",data:[t.l-u-a,0,c,0]}],d>0&&g.runs.push({type:"straight",data:[t.l,u+a,d,(t.w-u-a)/d,-90]});break;case"halfLanding":p=v/2,c=v/2,g.runs=[{type:"straight",data:[0,0,p,y,0]},{type:"straight",data:[p*y,t.w,c,y,180]}];break;case"2QuarterLanding":d=p=Math.round((t.l-u)/y),c=v-2*p,y=(t.l-u)/p,g.runs=[{type:"straight",data:[0,0,p,(t.l-u)/p,0]},{type:"straight",data:[t.l,u,c,(t.w-2*u)/c,-90]},{type:"straight",data:[p*y,t.w,d,(t.l-u)/p,180]}];break;case"doubleWinder":c=4*Math.round((u/2+a)/y),d=Math.round((t.w-2*(u+a))/y),p=Math.round((v-c-d)/2),g.runs=[],p>0&&g.runs.push({type:"straight",data:[0,0,p,(t.l-u-a)/p,0]}),g.runs.push({type:"winder",data:[t.l-u-a,0,c/2,0]}),d>0&&g.runs.push({type:"straight",data:[t.l,u+a,d,(t.w-2*(u+a))/d,-90]}),g.runs.push({type:"winder",data:[t.l,t.w-u-a,c/2,-90]}),p>0&&g.runs.push({type:"straight",data:[t.l-u-a,t.w,p,(t.l-u-a)/p,180]})}var m,_=[];if("labelled"!==i.style){var x=[["M",y/2-.06,u/2+.12],["L",y/2+.06,u/2],["L",y/2-.06,u/2-.12]];_.push({type:"path",segments:x})}if("spiral"!==h)m={type:"polygon",points:g.shape,isContour:!0},g.runs.forEach((t=>{"straight"===t.type?_=_.concat(function(t,e,i,r,n=0){for(var o={type:"group",position:[t,e],rotation:n=n||0,children:[]},s=0;s<i;s++)o.children.push({type:"path",segments:[["M",s*r,0],["L",s*r,u]]});return o}(...t.data)):"winder"===t.type&&(_=_.concat(function(t,e,i,r){for(var n,o,s=i/2,a=(u+.3)/s,h=.3/s,l=0,p=0,c={type:"group",rotation:r=r||0,rotationOrigin:[t,e],children:[]},d=0;d<s;d++)n=["M",t+l,e+u],o=["L",t+p,e],c.children.push({type:"path",segments:[n,o]}),l+=h,p+=a;for(t+=l,l=0,p=0,d=0;d<s;d++)n=["M",t,e+u+l],o=["L",t+u,e+p],c.children.push({type:"path",segments:[n,o]}),l+=h,p+=a;return c}(...t.data)))}));else if("spiral"===h){var b,P,w,E,T,C,I;w=(P=(b=t.w)-u)+u/2,I=(E=t.l/w)/v,E>2*Math.PI&&(E=2*Math.PI-.01),T=[Math.sin(E)*b,Math.cos(E)*b-b],C=[Math.sin(E)*P,Math.cos(E)*P-b];var S=E>Math.PI?1:0;if(m={type:"path",segments:[["M",0,0],["A",b,b,0,S,1,T[0],-T[1]],["L",C[0],-C[1]],["A",P,P,0,S,0,0,u],["Z"]],isContour:!0},o)for(var O=0,A=0;A<v&&!(O>=E);A++)T=[Math.sin(O)*b,Math.cos(O)*b-b],C=[Math.sin(O)*P,Math.cos(O)*P-b],_.push({type:"path",segments:[["M",T[0],-T[1]],["L",C[0],-C[1]]]}),O+=I}s&&(m={type:"group",position:[0,-t.w],children:[m,..._]});var M=["stairs"];(null==(r=t.class)?void 0:r.length)&&(M=M.concat(t.class));var L=[{type:"group",position:[n.x,n.z],rotation:n.ry,scale:[1,s?-1:1],children:[m]}];return s||L[0].children.push(..._),L},wall:function(t){return[{type:"rect",position:[0,"center"===t.controlLine?-t.w/2:"front"===t.controlLine?-t.w:0],width:t.l,height:t.w,isContour:!0}]}};function us(t={},e={},i={},r){return ls[t.type]?ls[t.type](t,e):ps[t.type]&&ps[t.type](t,e,i,r)}var ps={box:t=>ds(t),curtain:t=>{for(var e,i,r,n=Math.min(Math.max(t.folds||10,Math.round(5*t.l)),Math.round(15*t.l)),o=.05,s=t.w,a=t.l/n,h=[],l=[],u=0,p=s/2,c=.025,d=t.id.replace(/-/gi,""),f=d.length,v=0;v<n;v++){i=c,r=p;var y=parseInt(d[v%f],16)/20;c=.025+y*o/2*(v%2==0?-1:1),p=s/2+y*s/2*(v%2==0?-1:1),e=u,u=a*(v+1),l.push([e,r]),h.push([e,i]),v===n-1&&(l.push([u,p]),h.push([u,c]))}var g=cs(l),m=cs(h.reverse());return m[0][0]="L",m.push(["Z"]),[{type:"path",isContour:!0,segments:[...g,...m]}]},railing:t=>ds(t),floor:t=>ds(t),door:(t,e)=>{var i=function(t,e){var i=[],r=t.doorType||"singleSwing",n=t.l,o=e.w,s=t.doorAngle;if(s<20&&(s=20),"singleSwing"===r){var a=s*Math.PI/180,h=Math.round(100*(n/2-n*Math.cos(a)))/100,l=Math.round(100*(n*Math.sin(a)+o/2))/100;i.push({type:"path",segments:[["M",-n/2,o/2],["A",n,n,0,0,0,h,l],["L",n/2,o/2]]})}else if("doubleSwing"===r){var u=s*Math.PI/180,p=n/2+n/2*-Math.cos(u),c=n/2*Math.sin(u);i.push({type:"path",segments:[["M",-n/2,o/2],["L",-p,c],["A",n/2,n/2,0,0,0,0,o/2]]}),i.push({type:"path",segments:[["M",0,o/2],["A",n/2,n/2,0,0,0,p,c],["L",n/2,o/2]]})}return i}(t,e);return[...i,...[{type:"rect",isContour:!0,position:[-t.l/2,-e.w/2],width:t.l,height:e.w}]]},window:(t,e)=>ds(t,e),closet:t=>ds(t),interior:(t,e,i,r)=>((r=r||t.src&&i.productContours[t.src.substring(1)])||(r=t.src&&i.productBoundingBoxes[t.src.substring(1)]),r?(r=r.sort(((t,e)=>gt(t)>gt(e)?-1:1)))&&r.length?[{type:"polygon",isContour:!0,points:r[0],holes:r.slice(1)}]:void 0:[{type:"circle",position:[0,0],r:.01}]),polyfloor:t=>[{type:"polygon",isContour:!0,points:t.polygon,holes:t.polygonHoles||[]}],polybox:t=>[{type:"polygon",isContour:!0,points:t.polygon}],"a:helper:spaceDivider":t=>[{type:"rect",isContour:!0,position:[0,-.02],height:.04,width:t.l}],floorplan:t=>[{type:"rect",position:[-t.l/2,-t.w/2],width:t.l,height:t.w}]},cs=(t=[],e=1)=>{var i=e,r=[];return t.forEach(((e,n)=>{var o=n<t.length-1?t[n+1]:[e[0],t[0][1]],s=[e[0]+(o[0]-e[0])/2,e[1]+(o[1]-e[1])/2];if(0===n)r.push(["M",ht(e[0]*i,3),ht(e[1]*i,3)]);else{var a=[ht(e[0]*i,3),ht(e[1]*i,3)],h=[ht(s[0]*i,3),ht(s[1]*i,3)];r.push(["Q",...a,...h])}})),r};function ds(t={},e={}){var i=0,r=t.w;return"wall"===t.type&&(i="front"===t.controlLine?t.w:"center"===t.controlLine?t.w/2:0),"window"===t.type&&(r=e.w,i="front"===e.controlLine?e.w:"center"===e.controlLine?e.w/2:0),[{type:"polygon",isContour:!0,points:[[0,0-i],[t.l,0-i],[t.l,r-i],[0,r-i]]}]}function fs(t,e){return vs.apply(this,arguments)}function vs(){return(vs=r((function*(t,e){if(e._promiseCache||(e._promiseCache=new Zo),e._debugLoading||(e._debugLoading={}),t&&t.src){var i=t.src.substring(1);return e._productQueue[i]||(e._productQueue[i]={loadStage:0,nodes:[]}),e._productQueue[i].nodes.push(t),e.products[i]||(yield bs(i,e)),e.settings.hideElements.includes("interior")||ys(t,e),Promise.resolve()}}))).apply(this,arguments)}function ys(t,e){return gs.apply(this,arguments)}function gs(){return(gs=r((function*(t,e){var i=t.src.substring(1),r=e.products[i];if(r){var n=hs(t,e);if(xs(e,t),!e._textureQueue[n]){var s=o.api.staticProductThumb+"/"+n+".png";e._textureQueue[n]={productId:i,loadStage:0,nodes:[],textureUrl:s,applyFilter:!0},e.settings.theme.showAssetTextures&&e.emit("product-load-texture",{textureId:n,productData:r})}e._textureQueue[n].nodes.push(t),2!==e._textureQueue[n].loadStage?(e.productBoundingBoxes[i]||(e.productBoundingBoxes[i]=ms(r),e._productQueue[i].loadStage=2),2===e._productQueue[i].loadStage&&e.emit("product-load-stage",{node:t,args:{_loadStage:2}}),e.productContours[i]||_s(r,e).then((()=>{var i,r;1===(null===(i=e._textureQueue[n])||void 0===i?void 0:i.loadStage)||null!==(r=e._textureQueue[n])&&void 0!==r&&r.error?e.emit("product-contour",n,e):e.settings.theme.showAssetTextures&&!e.settings.svgMode||e.emit("product-load-stage",{node:t,args:{_loadStage:3}})})),e._promiseCache._collectGarbage()):e.emit("product-load-stage",{node:t,args:{_loadStage:3,_textureId:n}})}}))).apply(this,arguments)}var ms=t=>{var e,i=t.boundingPoints;if(i)return e=[[i.min[0],i.min[2]],[i.min[0],i.max[2]],[i.max[0],i.max[2]],[i.max[0],i.min[2]]],t._loadStage=1,[e]},_s=function(){var t=r((function*(t,e){var{productId:i}=t,r="fpe-pc1-"+i,n=e._promiseCache.get(r);if(n)return n;e._debugLoading[i]||(e._debugLoading[i]=0),e._debugLoading[i]++;var o=t.fileKey,s=function(t,e,i){var r,n,o=null==i||null===(r=i.settings)||void 0===r||null===(n=r.api)||void 0===n?void 0:n.productContourCacheAge,s=o||864e6;if(!t)return Promise.reject("product id missing");var a="fpe-dc1-"+t,h=i._promiseCache.get(a);if(h)return h;if("string"!=typeof e)return Promise.reject("fileKey not string");if(!e.includes("data3d.buffer")){var l=e.split("/")[e.split("/").length-1];return Promise.reject("unsupported geometry "+l)}var u=ns(a,o).then((t=>t||c.data3d.getOutline(e).then((t=>(is(a,t,s),t))))).catch((t=>{console.warn(t)}));return i._promiseCache.add(a,u),u}(i,o,e).then((r=>{var n=r.content;e.productContours[i]=n,t._shapes=us({type:"interior"},null,e,n),e._productQueue[i].loadStage=3})).catch((()=>{}));return e._promiseCache.add(r,s),s}));return function(e,i){return t.apply(this,arguments)}}();function xs(t,e){if(e&&"interior"===e.type){var i=e.src&&e.src.substring(1);if(i){var r=as(e,t);r&&!t.products[i].materials.includes(r)&&t.products[i].materials.splice(0,0,r)}}}function bs(t,e){var i,r,n=null==e||null===(i=e.settings)||void 0===i||null===(r=i.api)||void 0===r?void 0:r.productDataCacheAge,s=n||864e5;if(!t)return Promise.reject("product id missing");var a="fpe-pr1-"+t,h=e._promiseCache.get(a);if(h)return h;var l=ns(a,n).then((e=>e&&e.matColors?e:c.product.read(t).then((t=>(t.matColors={},t.colours&&t.colours.length&&t.colours.forEach((e=>{if(e.includes(":")){var i=e.split(":"),r=ss(i[1]);t.matColors[r]=i[2]}})),is(a,t,s),t))))).then((i=>(e.products[t]=function(t){if(t){var e,i,r,n=t.subCategories.includes("ceilingLight"),s=t.subCategories.includes("rug"),a=t.productResourceId,h=o.api.staticProductThumb+"/"+a+".png";return{preview:t.preview,manufacturer:t.manufacturer,productId:a,name:t.productDisplayName,fileKey:t.fileKey,tags:t.tags,categories:t.categories,subCategories:t.subCategories,boundingPoints:t.boundingPoints,boundingBox:t.boundingBox,texture:h,materials:[],matColors:t.matColors,colours:t.colours,order:(e=t,i={10:["ceilingLight","wallLight"],9:["modularMeetingRoom","phoneBooth"],8:["floorLamp","tableLamp","deskDivider","cushion","plant","officeSupply","tableware","decoration","laundry","electronics","kitchen","car"],7:["shelf","cabinet","wardrobe","storageCombination","outdoor","bicycle","people","sink"],6:["highTable","diningTable","conferenceTable","desk"],5:["sofa","armchair","loungeChair","ottoman","sideboard","pedestal"],4:["taskChair","diningChair","conferenceChair","stool","barStool","bench"],3:["shower"],2:["singleBed","doubleBed","daybed","toilet","bathtub"],1:["sideTable","coffeeTable","radiator","nightstand"],0:["rug"]},r=0,e.subCategories.forEach((t=>{Object.keys(i).forEach((e=>{i[e].includes(t)&&e>r&&(r=parseInt(e))}))})),1===r&&e.categories.includes("tables")&&e.boundingBox.height>.6&&(r=6),parseInt(r)),isCeilingLamp:n,isCarpet:s,createdAt:t.createdAt,updatedAt:t.updatedAt,link:t.link}}}(i),e._productQueue[t].loadStage=1,e.products[t]))).catch((t=>{console.warn(t.message)}));return e._promiseCache.add(a,l),l}var Ps=function(){var t=r((function*({node:t,event:e,args:i,state:r,options:n}){var o=null==n?void 0:n.interiorUpdate,s="add-child"===e||"remove-child"===e,a="set-materials"===e,h=r.active.reduce(((t,e)=>t.concat(e.findAll({type:"interior"}))),[]),l=[];if(o?l=r.scene.nodesByType.interior:s?l="add-child"===e?[i]:[]:a?l=[t]:r.active.length&&(l=h),l=l.filter((t=>"interior"===t.type)),(o||s||a)&&(yield Promise.all(l.map((t=>fs(t,r).catch((t=>console.error(t))))))),l.forEach((t=>{var e=Es(t,r);if(e){ws(e,r);var i=r.resources.assets.findIndex((e=>e.id===t.id));i>-1?r.resources.assets[i]=e:r.resources.assets.push(e)}})),"remove-child"===e){var u=r.resources.assets.findIndex((t=>t.id===i.id));u>-1&&r.resources.assets.splice(u,1),ws({id:i.id},r)}return r.active.length&&xs(r,r.active[0]),r.emit("scene-loaded",!0),Promise.resolve(!0)}));return function(e){return t.apply(this,arguments)}}();function ws(t,e){if(null!=t&&t.id){var i=t.position&&function(t,e){for(var i,r=0;r<e.resources.spaces.length;r++){var n=e.resources.spaces[r];if(ft([t.x,t.z],n.polygons[0],n.polygons.slice(1))){i=n;break}}return i}(t.position,e);i&&!i.assets.includes(t.id)&&i.assets.push(t.id),e.resources.spaces.forEach((e=>{if(!i||e.id!==i.id){var r=e.assets.findIndex((e=>e===t.id));r>-1&&e.assets.splice(r,1)}}))}}function Es(t,e){if(t){var i=t.getWorldPosition(),r=t.src&&t.src.substring(1),n=e.products[r];if(n){var o=n.boundingPoints,s=o&&[[o.min[0],o.min[2]],[o.min[0],o.max[2]],[o.max[0],o.max[2]],[o.max[0],o.min[2]]];s=o&&Ft(i,s);var a=o&<([s]);return{id:t.id,node:t,polygon:s,boundingBox:a,name:n.name,manufacturer:n.manufacturer,productId:r,tags:n.tags,categories:n.categories,subCategories:n.subCategories,dimensions:n.boundingBox,position:{x:i.x,y:i.y,z:i.z},rotation:i.ry}}console.error("no productData",r,t)}}var Ts={actions:{},active:[],activeGroup:null,activeBb:{},products:{},productContours:{},productBoundingBoxes:{},resources:{spaces:[],assets:[]},computed:{connectedSpaces:[],facade:{},mergedSpace:{},relations:{walls:[],spaces:[]},snapPoints:[],wallContours:[]},listeners:{},schemaLoaded:new class{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}reset(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}},isSceneStructureLoaded:!1,sceneBBox:{},guide:null,schema:{},materials:[],isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),cursor:[0,0],snapCursor:null,windowPos:[0,0],lastSceneClick:[0,0],clickStart:[],history:[],viewportInFocus:!0,keyString:null,_productQueue:{},_textureQueue:{},_gfxNodes:{},_gfxLayers:{},viewbox:{},client:[],zoom:1,scale:100,key:"",shiftKey:!1,altKey:!1,ctrlKey:!1,isDragging:!1,isPanning:!1,isMeasuring:!1,isDrawingRectangle:!1,isDrawingPolygon:!1,editingRectangle:null,editingPolygon:null,dragElement:null,isCreatingElement:!1,editPolygon:!1,infoWindows:[],htmlMarkers:[],markerPins:[]};function Cs(t,{format:e,fileName:i,quality:r}={}){if("svg"!==e){var n=new Image;n.src=t,n.onload=function(){var t=document.createElement("canvas");t.width=n.naturalWidth,t.height=n.naturalHeight;var o=t.getContext("2d");o.imageSmoothingEnabled=!1,o.drawImage(n,0,0),function(t,{format:e="png",fileName:i="floorplan",quality:r=.95}){var n=document.createElement("a");n.download=i+"."+e;var o="png"===e?[]:["image/jpeg",r];t.toBlob((function(t){n.href=URL.createObjectURL(t),n.click()}),...o)}(t,{format:e,fileName:i,quality:r})}}}function Is(t,i,r,n){if((i.length||null!=n&&n.forceUpdate)&&(null==n||!n.skipHistory)){var o=r.resources.spaces,s={};o.forEach((t=>{r._debugSpaceMatching&&t.node.setHighlight(),s[t.id]=t}));var a=0,h=0,l=0,u=0,p=r.getActiveLevel(),c=null==n?void 0:n.actionId;return t.forEach((t=>{var i,n,l,d;t.holes=t.holes.filter((t=>gt(t)>.05)),t.center=Lt(t.boundary.shape,t.holes),t.polygons=[t.boundary.shape,...t.holes];for(var f=0;f<o.length;f++){var v=o[f];if(s[v.id]){if(wt(v.polygons,t.polygons)){n=v,delete s[v.id];break}var y=t.polygons.slice(1).filter((t=>gt(t)>1));if(0!==ft(v.center,t.polygons[0],y)){l=v,delete s[v.id];break}}if(0!==ft(t.center,v.polygons[0],v.polygons.slice(1))){d=v;break}}if(n)u++;else{var g=function(t,e){var i=e.getParents().reverse();i.push(e);var r=Object.assign({},t);return i.forEach((t=>Rt(r,t,!0))),r}({x:0,y:0,z:0,ry:0},p),m=Ft(g,t.boundary.shape),{polygon:_,center:x}=St(m),b={polygon:_,polygonHoles:t.holes?t.holes.map((t=>St(Ft(g,t),x).polygon)):[],x:x[0],z:x[1],ry:0};if(null!==(i=l)&&void 0!==i&&i.node)a++,l.node.set(b,{updateState:!1,actionId:c}),r._debugSpaceMatching&&l.node.setHighlight({fill:[255,240,180]});else{var P;h++,null!==(P=d)&&void 0!==P&&P.node?b=e(e({},d.node.toJson({regenerateIds:!0})),b):b.type="polyfloor";var w=p.addChild(b,{updateState:!1,actionId:c});r._debugSpaceMatching&&w.setHighlight({fill:[200,255,180]})}}})),Object.values(s).forEach((t=>{l++,p.removeChild(t.node,{updateState:!1,actionId:c})})),r._debugSpaceMatching&&console.log("matched",u,"transformed",a,"created",h,"deleted",l),a+h+l}}class Ss{constructor({options:t}={}){var e=no(Ts);Object.keys(e).forEach((t=>this[t]=e[t])),this.settings={},this.updateSettings(t),this.changeOptions=t=>this.emit("change-options",t),this.scene=null,this._emitter=new H}initScene(t){var e,i;this._gfxNodes={},this.isSceneStructureLoaded=!1,this.scene||(this.scene=t),Os(this),this.isSceneStructureLoaded=!0,this.emit("state-loaded",!0),this.settings.theme.wallContours&&this.updateWallContours(),this.getSpaces(),this.computed.relations.walls=ze(this),(e=this,i=e.scene.nodesByType.interior,Promise.all(i.map((t=>fs(t,e).catch((t=>console.error(t)))))).then((()=>{e.resources.assets=i.map((t=>Es(t,e))).filter((t=>t))}))).then((()=>{this.emit("scene-loaded",!0)})),this.settings.computeConnectedSpaces&&this.getConnectedSpaces()}on(t,e,i){t&&e?this._emitter.on(t,e,i):console.log("invalid event listener")}off(t,e,i){t&&e?this._emitter.off(t,e,i):console.log("invalid request")}once(t,e,i){t&&e?this._emitter.once(t,e,i):console.log("invalid event listener")}emit(t,e,i,r,n){this._emitter&&this._emitter.emit(t,e,i,r,n)}getActiveLevel(){return this.scene.nodesByType.level&&this.scene.nodesByType.level[0]}getScene(){return this.scene.node}getSceneBoundingBox(t=0){if(this.settings.svgMode){var i=this.scene.nodesByType.wall.map((t=>t.getWorldPosition())).map(kt),r=this.scene.nodesByType.floor.map((t=>t.getWorldPosition())).map(kt),n=this.scene.nodesByType.stairs.map((t=>t.getWorldPosition())).map(kt),o=[...i,...this.resources.spaces.map((t=>t.polygons[0])),...this.resources.assets.map((t=>t.polygon)).filter((t=>t)),...r,...n].reduce(((t,e)=>t.concat(e)),[]),s={x:1/0,z:1/0,x2:-1/0,z2:-1/0};return o.forEach((t=>{t[0]<s.x&&(s.x=t[0]),t[0]>s.x2&&(s.x2=t[0]),t[1]<s.z&&(s.z=t[1]),t[1]>s.z2&&(s.z2=t[1])})),s.x-=t,s.z-=t,s.x2+=t,s.z2+=t,e(e({},s),{},{length:s.x2-s.x,width:s.z2-s.z})}var a=this._getViewport&&this._getViewport();if(a){var h=a.children.find((t=>t._sceneLayer));if(!h)return new Promise.resolve(!1);var{x:l,y:u,width:p,height:c}=h.getLocalBounds(),d={x:l/this.scale-t,z:u/this.scale-t,length:p/this.scale+2*t,width:c/this.scale+2*t};return d.x2=d.x+d.length,d.z2=d.z+d.width,d}}getElementBoundingBox(t,e=0){var i,r;if(t&&(t instanceof le?r=t.getWorldPosition():"string"==typeof t&&(r=(i=this.scene.nodesById[t].find({id:t}))&&i.getWorldPosition()),r)){var n;if("interior"===r.type&&r.src){var o=r.src.substring(1),s=this.productBoundingBoxes[o]||this.productContours[o];n=s&&Ft(r,s[0])}else n="polyfloor"===r.type?Ft(r,r.polygon):"group"!==r.type?kt(r):[[r.x-2,r.z-2],[r.x+2,r.z-2],[r.x+2,r.z+2],[r.x-2,r.z+2]];var a=lt([n]);return{x:a.x-e,z:a.z-e,x2:a.x2+e,z2:a.z2+e,length:a.length+2*e,width:a.width+2*e}}}setBb(t,e=!1){var i=this.getElementBoundingBox(t,1,e);i&&(e?this.activeGroupBb={w:i.width,h:i.height,x:i.x,y:i.y}:this.activeBb={w:i.width,h:i.height,cx:i.cx,cy:i.cy})}setActive(t={}){Ne(e(e({},t),{},{state:this}))}updateSpaceRelations(){var t=this.resources.spaces.map((t=>{var i=e({},t),r=i.assets;return delete i.assets,e(e({},i),{},{interiors:r.map((t=>this.scene.nodesById[t]))})}));this.computed.relations.spaces=Jt({scene:this.scene,spaces:t}),this.emit("space-relations")}getConnectedSpaces(t){if(!this.settings.svgMode){var{connectedSpaces:e,facade:i}=function(t){var{spaces:e,holes:i,outline:r}=xe(t),n=e.map(((t,e)=>({boundary:{shape:t},holes:i[e]||[]})));return{connectedSpaces:n,facade:{boundary:{shape:r}}}}(this.scene);if(this.settings.updateFloors&&e.length&&this.resources.spaces)Is(e,this.computed.connectedSpaces,this,t)&&this.getSpaces();this.updateSpaceRelations(),this.computed.connectedSpaces=e,this.computed.facade=i;var r=this.computed.facade.boundary.shape,{openings:n}=Vt({polygons:[r],scene:this.scene});this.computed.facade.boundary.openings=n,e.length&&(As({state:this}),this.settings.computeMergedSpace&&this.computeMergedSpace(this.scene))}}getSpaces(t=!1){var i=_e({scene:this.scene});this.resources.spaces=i.map((t=>{var i=t.interiors;return delete t.interiors,e(e({},t),{},{assets:i.map((t=>t.id))})})),As({state:this},t);var r=this._getViewport&&this._getViewport();r&&r._updateRoomStamps&&r._updateRoomStamps()}computeMergedSpace(t){var e=function(t){var{spaces:e,holes:i,outline:r}=xe(t),n=t.nodesByType.door.map((t=>{var e=t.getWorldPosition();return e.w=t.parent.w,e})),o=t.nodesByType.window.map((t=>{var e=t.getWorldPosition();return e.w=t.parent.w,e})).filter((t=>{var e;return null==(e=t.class)?void 0:e.includes("slidingDoor")})),s=(n=[...n,...o]).map((t=>{var e=kt(t);return Gt(e=pt([e],.05)[0])})),a=i.reduce(((t,e)=>t.concat(e)),[]),h=jt(a,e).reduce(((t,e)=>t.concat(e)),[]),l=a.length?ct(a,[...s,...h]):[],u=ut([...e,...s]),{counterClockwise:p,clockwise:c}=Yt(u);return{boundary:{shape:(p=p.sort(((t,e)=>{var i=gt(t),r=gt(e);return i>r?-1:i<r?1:0})))[0]},holes:[...l,...c],outline:r}}(t),i=[e.boundary.shape],{openings:r}=Vt({polygons:i,scene:t});e.boundary.openings=r,e.x=0,e.z=0,this.computed.mergedSpace=e}exportImage({format:t,fileName:e,quality:i,output:n,maxWidth:o,download:s=!1}={}){var a=this;return r((function*(){var r={format:t,quality:i,output:n,maxWidth:o};s&&"svg"!==t&&(r.format="png"),s&&"svg"===t&&(r.output="text");var h=yield function(t,{format:e="png",quality:i=.95}){return new Promise((r=>{var n=document.querySelector("#"+t.settings.editorId+" canvas");r("jpg"===e?n.toDataURL("image/jpeg",i):n.toDataURL())}))}(a,r).catch((t=>t));if(!s)return h;Cs(h,{format:t,fileName:e,quality:i})}))()}getResourcesFromPosition(t){var e=this.resources.spaces.filter((e=>ft(t,e.polygons[0],e.polygons.slice(1)))),i=[];return e.forEach((e=>{var r=this.resources.assets.filter((t=>e.assets.includes(t.id))).filter((e=>{var i;if((null===(i=this.products[e.productId])||void 0===i||!i.isCeilingLamp||this.settings.showCeilingLamps)&&e.polygon&&e.polygon.length)return ft(t,e.polygon)}));i.push(...r)})),{spaces:e,assets:i}}rotatePlan({rotDelta:t,newRotation:i}){var r=this.scene.node.ry;void 0===i&&(i=(this.settings.planRotation+t)%360),this.updateSettings(e(e({},this.settings),{},{planRotation:i})),this.lastSceneClick=Te({points:[this.lastSceneClick],oldRotation:r,newRotation:i,rootNode:this.scene})[0],this.infoWindows=this.infoWindows.map((t=>{var n=Te({points:[t.pos],oldRotation:r,newRotation:i,rootNode:this.scene})[0];return e(e({},t),{},{pos:n})})),this.once("scene-rendered",(()=>this.zoomExtents(1,500)))}updateWallContours(){this.computed.wallContours=((t,e=!0,i=!1)=>{var r=t.nodesByType.column.map((t=>t.getWorldPosition())),n=[...t.nodesByType.wall.map((t=>t.getWorldPosition())),...r].map((t=>{var r=kt(t);if(e&&(r=pt([r],.001)[0]),i)return[r];var n=Qt(t,"window"),o=Qt(t,"door"),s=n.concat(o);return(null==(s=s.map((e=>(e.w=t.w,e))))?void 0:s.length)?ct([r],s.map(kt),.002):[r]})),o=n.reduce(((t,e)=>t.concat(e)),[]),s=o.length?ut(o):[],{counterClockwise:a,clockwise:h}=Yt(s),l=jt(a,h),u=a.map(((t,e)=>[t,...l[e]||[]]));return u})(this.scene),this.emit("wall-contours-computed",this.computed.wallContours)}updateSettings(t){var e,i,r,n,s,a=Yo(no(o),t);if(null!=t&&t.selectAllowList&&(a.selectAllowList=[...t.selectAllowList]),this.settings=a,null!==(e=this.settings)&&void 0!==e&&null!==(i=e.theme)&&void 0!==i&&null!==(r=i.elements)&&void 0!==r&&null!==(n=r.space)&&void 0!==n&&n.program){var h=this.settings.theme.elements.space.program,l={wash:"care",operate:"support",common:"socialize"};Object.keys(h).forEach((t=>{Object.keys(l).includes(t)&&(h[l[t]]=h[t],delete h[t])}))}this.scene&&this.scene.node&&(!a.theme.wallContours||null!==(s=this.computed.wallContours)&&void 0!==s&&s.length||this.updateWallContours(),this.scene.node.ry!==a.planRotation&&Number.isFinite(a.planRotation)&&(this.scene.node.set({ry:parseFloat(a.planRotation)}),this.updateState(),this.computed.wallContours&&this.updateWallContours()),a.computeConnectedSpaces&&!this.computed.connectedSpaces.length&&this.getConnectedSpaces(),this.getSpaces());return this._redrawScene&&this._redrawScene(),this.emit("update-settings",this.settings),this.settings}updateState({node:t,args:e={},options:i={},event:n}={}){var o=this;return r((function*(){var r=!t&&!n,s="add-child"===n||"remove-child"===n,a="set-materials"===n||e.materials,h=null==t?void 0:t.type,l="plan"===h||"level"===h,u=!(!1===i.updateState)&&(r||!0===i.updateState||s||a||l),p=null==e?void 0:e.type,c=["wall","column","a:helper:spaceDivider"],d=c.includes(h)||c.includes(p);if(u&&(r||o.isSceneStructureLoaded)){var f=0,v=0;for(var y in e)if(f++,"_isSelected"===y)v++;if(!f||f!==v){var g="interior"===p||"interior"===h||"group"===h||i.interiorUpdate;Os(o),g?yield Ps({node:t,event:n,args:e,options:i,state:o}):["floor","polyfloor"].includes(h)?o.getSpaces():d?(o.settings.computeConnectedSpaces&&o.getConnectedSpaces(i),o.computed.relations.walls=ze(o)):h&&"level"!==h&&"plan"!==h||("plan"===h&&o.scene.setSceneType(o.scene),s||!o.settings.computeConnectedSpaces||o.computed.connectedSpaces.length||o.getConnectedSpaces(i),o.getSpaces(),o.computed.relations.walls=ze(o)),o.emit("state-updated",{})}}}))()}destroy(){var t;this._emitter.off(),null===(t=this.scene)||void 0===t||t._emitter.off(),this.scene=null,this._emitter=null,this.computed=null}}var Os=function(t,e,i){var r=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return ui(i)&&(r="leading"in i?!!i.leading:r,n="trailing"in i?!!i.trailing:n),ko(t,e,{leading:r,maxWait:e,trailing:n})}((function(t){var e=t.getSceneBoundingBox();e&&e.x&&(t.sceneBBox=e)}),200),As=({state:t},e)=>{var i=[],r=[];if(t.settings.snapWallContours){var n=t.computed.connectedSpaces.reduce(((t,e)=>t.concat([e.boundary.shape,...e.holes])),[]);t.computed.facade.boundary&&n.push(t.computed.facade.boundary.shape),i=n.reduce(((t,e)=>t.concat(e)),[])}if(t.settings.snapSpaces){var o=!!t.active.length&&t.active[0].id;r=(e?t.resources.spaces:t.resources.spaces.filter((t=>t.id!==o))).reduce(((t,e)=>t.concat(e.polygons)),[]).reduce(((t,e)=>t.concat(e)),[])}t.computed.snapPoints=[...i,...r]},Ms=t=>{var e=3.28084,i=t*e,r=Math.sign(t),n=t>0?Math.floor(t*e):Math.ceil(t*e),o=Math.round(39.3701*t%12);return 12===o&&(n+=1,o=0),{feet:i,feetInt:n,inchInt:o,inchDisplay:o*r}},Ls=t=>({sqft:10.7639111056*t}),Ns=t=>t/180*Math.PI;class Rs{constructor(t,e){t&&e&&(this.data={cursor:[0,0]},this._state=e,this._state.on("mousemove",this.update,this),this.mount(t),this.update())}update(){if(this.rootEl){var t=[0,0];if("imperial"===this._state.settings.units.system){var{feetInt:e,inchDisplay:i}=Ms(this._state.cursor[0]),{feetInt:r,inchDisplay:n}=Ms(this._state.cursor[1]);t=["".concat(e,"′ ").concat(i,"″"),"".concat(r,"′ ").concat(n,"″")]}else t=[this._state.cursor[0].toFixed(2),this._state.cursor[1].toFixed(2)];this.setData({cursor:t})}}setData(t={}){for(var e in t)this.data[e]=t[e];this.rootEl.innerHTML=this.template(this.data)}template(t={}){return'<span class="fpe-coordinates__unit">x:'.concat(t.cursor[0],'</span>\n <span class="fpe-coordinates__unit">z:').concat(t.cursor[1],"</span>")}mount(t){this.rootEl||(this.rootEl=document.createElement("div"),this.rootEl.classList.add("fpe-coordinates"),t.appendChild(this.rootEl))}destroy(){this._state.off("mousemove",this.update),delete this._state._cursorCoordinates,this.rootEl.remove(),delete this._state,delete this.data}}var Ds=100,ks=80;class Fs{constructor({width:t,height:e,pos:i=[0,0],html:r="",closeButton:n=!0,floorPlan:o}={}){this._floorPlan=o,this.pos=i,this.html=r,this.closeButton=n,this._anchorPos=null;var s=t||Ds;this.width=Math.max(100,s);var a=e||ks;this.height=Math.max(50,a),this._getPosition=()=>{this._anchorPos=this._floorPlan.state.getScreenPosition(this.pos),this._updateInfoWindow()},this._getPosition(),this._createInfoWindow(),this._floorPlan.on("viewbox",this._getPosition,this),this._floorPlan.on("resize-canvas",this._getPosition,this)}_createInfoWindow(){var t=document.querySelector("#".concat(this._floorPlan.state.settings.editorId,".fpe")),e=t.querySelector("canvas");this.el||(this.el=document.createElement("div"),this.el.classList.add("fpe-info-window"),t.appendChild(this.el),this.el.addEventListener("wheel",(t=>{var i=new WheelEvent(t.type,t);e.dispatchEvent(i)}))),this._setContent(),this._updateInfoWindow()}_setContent(){var t='<div class="fpe-info-window__content">'.concat(this.html,"</div>");this.closeButton&&(t+='<div class="fpe-info-window__close" @click="infoWindow.remove">'.concat('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">\n <g fill="none" stroke="#000" stroke-width="1.2" stroke-miterlimit="10">\n <path d="M11.8 11.8l16.4 16.4M11.8 28.2l16.3-16.4" />\n </g>\n</svg>',"</div>")),this.el.innerHTML=t;var e=this.el.querySelector(".fpe-info-window__close");e&&e.addEventListener("click",this.remove.bind(this))}_updateInfoWindow(){if(this.el){var t=this._floorPlan.state.isPanning?"pointer-events: none;":"",e=this._anchorPos[0]-47,i=this._anchorPos[1]-this.height-15,r=1e3+2*this.pos[1],n=this.height,o=this.width;this.el.setAttribute("style","transform: translate(".concat(e,"px, ").concat(i,"px);").concat(t," height:").concat(n,"px; width:").concat(o,"px; z-index:").concat(r))}}set({width:t,height:e,pos:i,html:r,closeButton:n}){void 0!==i&&(this.pos=i),void 0!==t&&(this.width=Math.max(100,t)),void 0!==e&&(this.height=Math.max(50,e)),void 0!==r&&(this.html=r),void 0!==n&&(this.closeButton=n),void 0===r&&void 0===n||this._setContent(),this._getPosition()}remove(){this._floorPlan.off("viewbox",this._getPosition),this._floorPlan.off("resize-canvas",this._getPosition),this.el.remove(),this._floorPlan=null}}class Bs{constructor({pos:t=[0,0],offset:e=[0,0],el:i,floorPlan:r}){if(n(this,"_updateHtmlMarker",(()=>{this.el&&(this.isHidden=!(([t,e],i,r=0)=>i.x-r<t&&i.x+i.length+r>t&&i.z-r<e&&i.z+i.width+r>e)(this.pos,this._floorPlan.state.viewbox,5),this.el.classList.toggle("fpe-marker--hidden",this.isHidden),this.isHidden||(this._anchorPos=this._floorPlan.getScreenPosition(this.pos),this._updateHtmlMarkerStyle()))})),r)if(i instanceof Element!=!1){this.el=i;var o=document.querySelector("#".concat(r.state.settings.editorId,".fpe")),s=o.querySelector("canvas");o.appendChild(this.el),this.el.classList.add("fpe-marker");var{width:a,height:h}=i.getBoundingClientRect();this.el.addEventListener("wheel",(t=>{var e=new WheelEvent(t.type,t);s.dispatchEvent(e)})),this.id=j(),this._floorPlan=r,this.pos=t,this.size=[a,h],this.offset=e,this._updateHtmlMarker(),this._floorPlan.on("viewbox",this._updateHtmlMarker),this._floorPlan.on("drag-end",this._updateHtmlMarker),this._floorPlan.on("resize-canvas",this._updateHtmlMarker)}else console.warn("no Element provided")}_updateHtmlMarkerStyle(){var t=this._floorPlan.state.isPanning?"pointer-events: none":"",e=this.offset?this.offset:[0,0],i=this._anchorPos[0]-this.size[0]/2+e[0],r=this._anchorPos[1]-this.size[1]/2+e[1];this.el.setAttribute("style","transform: translate(".concat(i,"px, ").concat(r,"px);").concat(t))}set({pos:t,offset:e}){void 0!==t&&(this.pos=t),void 0!==e&&(this.offset=e),this._updateHtmlMarker()}remove(){this._floorPlan.off("viewbox",this._updateHtmlMarker),this._floorPlan.off("resize-canvas",this._updateHtmlMarker),this._floorPlan.off("drag-end",this._updateHtmlMarker),this.el.remove(),this._floorPlan=null}}var Us,zs,Xs,js,Ys,Hs,Gs,Ws,Vs,qs,Zs,Js,Ks,Qs,$s,ta,ea,ia,ra,na=(t,e,i=[0,0],r=.15)=>{for(var n,o,s,a,h=0;h<e.length;h++)if(n=e[h],!((o=Math.abs(t[0]-i[0]-n[0]))>r)&&(s=Math.abs(t[1]-i[1]-n[1]),o<r&&s<r)){a=n;break}return a},oa=(t,e,i=.15)=>{for(var r,n=0;n<e.length;n++){var o=e[n][0],s=e[n][1],a=[Math.min(o[0],s[0]),Math.min(o[1],s[1])],h=[Math.max(o[0],s[0]),Math.max(o[1],s[1])],l=t[0]>a[0]-i&&t[0]<h[0]+i,u=t[1]>a[1]-i&&t[1]<h[1]+i;if(l&&u){var p={x:o[0]-s[0],z:o[1]-s[1]},c={x:p.z,z:-p.x},d={x:t[0],z:t[1]},f=tt({x:o[0],z:o[1]},{x:s[0],z:s[1]},d,it(d,c));if(Z(d,f)<=i){r=[f.x,f.z];break}}}return r},sa=({point:t,walls:e,offset:i=[0,0],margin:r=.15,node:n,isWallChild:o})=>{var s,a,h,l=o,u=o;o&&n&&n.parent&&(e=e.filter((t=>t.node.id===n.parent.id)),r=20);for(var p=0;p<e.length;p++){var c=e[p].points;if(s=!l&&na(t,c,i,r)){h={point:s,node:e[p].node};break}var d=[[c[0],c[1]],[c[2],c[3]]];if(a=oa(t,d,r)){h={point:a,node:e[p].node,isEdge:!0};break}}if(!h&&!u){var f=((t,e,i,r=.15)=>{for(var n,o,s,a=[],h=0;h<e.length;h++)n=e[h],o=Math.abs(t[0]-i[0]-n[0]),s=Math.abs(t[1]-i[1]-n[1]),o<r&&s<10?a.push({distance:s,point:[n[0],t[1]],refPoint:n}):o<10&&s<r&&a.push({distance:o,point:[t[0],n[1]],refPoint:n});return a.sort(((t,e)=>t.distance-e.distance))})(t,e.reduce(((t,e)=>t.concat(e.points)),[]),i,r);f.length&&(h=f[0])}return h};!function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(Us||(Us={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(zs||(zs={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(Xs||(Xs={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"}(js||(js={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(Ys||(Ys={})),function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(Hs||(Hs={})),function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(Gs||(Gs={})),function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT"}(Ws||(Ws={})),function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"}(Vs||(Vs={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}(qs||(qs={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(Zs||(Zs={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"}(Js||(Js={})),function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA"}(Ks||(Ks={})),function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"}(Qs||(Qs={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}($s||($s={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(ta||(ta={})),function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE"}(ea||(ea={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(ia||(ia={})),function(t){t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(ra||(ra={}));
|
|
9
|
+
/*!
|
|
10
|
+
* @pixi/math - v6.1.3
|
|
11
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
12
|
+
*
|
|
13
|
+
* @pixi/math is licensed under the MIT License.
|
|
14
|
+
* http://www.opensource.org/licenses/mit-license
|
|
15
|
+
*/
|
|
16
|
+
var aa,ha=2*Math.PI,la=180/Math.PI,ua=Math.PI/180;!function(t){t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC"}(aa||(aa={}));var pa=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=aa.RECT}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t,"EMPTY",{get:function(){return new t(0,0,0,0)},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},t.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},t.prototype.contains=function(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)},t.prototype.pad=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this},t.prototype.fit=function(t){var e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this},t.prototype.ceil=function(t,e){void 0===t&&(t=1),void 0===e&&(e=.001);var i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this},t.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this},t.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},t}(),ca=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.radius=i,this.type=aa.CIRC}return t.prototype.clone=function(){return new t(this.x,this.y,this.radius)},t.prototype.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return(r*=r)+(n*=n)<=i},t.prototype.getBounds=function(){return new pa(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},t.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},t}(),da=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.width=i,this.height=r,this.type=aa.ELIP}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=(t-this.x)/this.width,r=(e-this.y)/this.height;return(i*=i)+(r*=r)<=1},t.prototype.getBounds=function(){return new pa(this.x-this.width,this.y-this.height,this.width,this.height)},t.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},t}(),fa=function(){function t(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];var r=Array.isArray(e[0])?e[0]:e;if("number"!=typeof r[0]){for(var n=[],o=0,s=r.length;o<s;o++)n.push(r[o].x,r[o].y);r=n}this.points=r,this.type=aa.POLY,this.closeStroke=!0}return t.prototype.clone=function(){var e=new t(this.points.slice());return e.closeStroke=this.closeStroke,e},t.prototype.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,o=r-1;n<r;o=n++){var s=this.points[2*n],a=this.points[2*n+1],h=this.points[2*o],l=this.points[2*o+1];a>e!=l>e&&t<(e-a)/(l-a)*(h-s)+s&&(i=!i)}return i},t.prototype.toString=function(){return"[@pixi/math:PolygoncloseStroke="+this.closeStroke+"points="+this.points.reduce((function(t,e){return t+", "+e}),"")+"]"},t}(),va=function(){function t(t,e,i,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=20),this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n,this.type=aa.RREC}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height,this.radius)},t.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){if(e>=this.y+this.radius&&e<=this.y+this.height-this.radius||t>=this.x+this.radius&&t<=this.x+this.width-this.radius)return!0;var i=t-(this.x+this.radius),r=e-(this.y+this.radius),n=this.radius*this.radius;if(i*i+r*r<=n)return!0;if((i=t-(this.x+this.width-this.radius))*i+r*r<=n)return!0;if(i*i+(r=e-(this.y+this.height-this.radius))*r<=n)return!0;if((i=t-(this.x+this.radius))*i+r*r<=n)return!0}return!1},t.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+"width="+this.width+" height="+this.height+" radius="+this.radius+"]"},t}(),ya=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},t.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},t}(),ga=function(){function t(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0),this._x=i,this._y=r,this.cb=t,this.scope=e}return t.prototype.clone=function(e,i){return void 0===e&&(e=this.cb),void 0===i&&(i=this.scope),new t(e,i,this._x,this._y)},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._x===t&&this._y===e||(this._x=t,this._y=e,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},t.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),ma=function(){function t(t,e,i,r,n,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),void 0===n&&(n=0),void 0===o&&(o=0),this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,e,i,r,n,o){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o,this},t.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},t.prototype.apply=function(t,e){e=e||new ya;var i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e},t.prototype.applyInverse=function(t,e){e=e||new ya;var i=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*i*r+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,e},t.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},t.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this},t.prototype.append=function(t){var e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},t.prototype.setTransform=function(t,e,i,r,n,o,s,a,h){return this.a=Math.cos(s+h)*n,this.b=Math.sin(s+h)*n,this.c=-Math.sin(s-a)*o,this.d=Math.cos(s-a)*o,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this},t.prototype.prepend=function(t){var e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var e=this.a,i=this.b,r=this.c,n=this.d,o=t.pivot,s=-Math.atan2(-r,n),a=Math.atan2(i,e),h=Math.abs(s+a);return h<1e-5||Math.abs(ha-h)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=s,t.skew.y=a),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*i+o.y*n),t},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,o=t*r-e*i;return this.a=r/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-r*n)/o,this.ty=-(t*this.ty-e*n)/o,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},t.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),_a=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],xa=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ba=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Pa=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],wa=[],Ea=[],Ta=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];wa.push(e);for(var i=0;i<16;i++)for(var r=Ta(_a[t]*_a[i]+ba[t]*xa[i]),n=Ta(xa[t]*_a[i]+Pa[t]*xa[i]),o=Ta(_a[t]*ba[i]+ba[t]*Pa[i]),s=Ta(xa[t]*ba[i]+Pa[t]*Pa[i]),a=0;a<16;a++)if(_a[a]===r&&xa[a]===n&&ba[a]===o&&Pa[a]===s){e.push(a);break}}for(t=0;t<16;t++){var h=new ma;h.set(_a[t],xa[t],ba[t],Pa[t],0,0),Ea.push(h)}}();var Ca={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return _a[t]},uY:function(t){return xa[t]},vX:function(t){return ba[t]},vY:function(t){return Pa[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return wa[t][e]},sub:function(t,e){return wa[t][Ca.inv(e)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,e){return 2*Math.abs(t)<=Math.abs(e)?e>=0?Ca.S:Ca.N:2*Math.abs(e)<=Math.abs(t)?t>0?Ca.E:Ca.W:e>0?t>0?Ca.SE:Ca.SW:t>0?Ca.NE:Ca.NW},matrixAppendRotationInv:function(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=Ea[Ca.inv(e)];n.tx=i,n.ty=r,t.append(n)}},Ia=function(){function t(){this.worldTransform=new ma,this.localTransform=new ma,this.position=new ga(this.onChange,this,0,0),this.scale=new ga(this.onChange,this,1,1),this.pivot=new ga(this.onChange,this,0,0),this.skew=new ga(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.toString=function(){return"[@pixi/math:Transform position=("+this.position.x+", "+this.position.y+") rotation="+this.rotation+" scale=("+this.scale.x+", "+this.scale.y+") skew=("+this.skew.x+", "+this.skew.y+") ]"},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var i=t.worldTransform,r=this.worldTransform;r.a=e.a*i.a+e.b*i.c,r.b=e.a*i.b+e.b*i.d,r.c=e.c*i.a+e.d*i.c,r.d=e.c*i.b+e.d*i.d,r.tx=e.tx*i.a+e.ty*i.c+i.tx,r.ty=e.tx*i.b+e.ty*i.d+i.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}(),Sa=/iPhone/i,Oa=/iPod/i,Aa=/iPad/i,Ma=/\biOS-universal(?:.+)Mac\b/i,La=/\bAndroid(?:.+)Mobile\b/i,Na=/Android/i,Ra=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Da=/Silk/i,ka=/Windows Phone/i,Fa=/\bWindows(?:.+)ARM\b/i,Ba=/BlackBerry/i,Ua=/BB10/i,za=/Opera Mini/i,Xa=/\b(CriOS|Chrome)(?:.+)Mobile/i,ja=/Mobile(?:.+)Firefox\b/i,Ya=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};
|
|
17
|
+
/*!
|
|
18
|
+
* @pixi/settings - v6.1.3
|
|
19
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
20
|
+
*
|
|
21
|
+
* @pixi/settings is licensed under the MIT License.
|
|
22
|
+
* http://www.opensource.org/licenses/mit-license
|
|
23
|
+
*/
|
|
24
|
+
var Ha,Ga,Wa,Va,qa,Za,Ja,Ka,Qa,$a,th,eh,ih,rh,nh,oh,sh,ah,hh,lh=function(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var i=e.userAgent,r=i.split("[FBAN");void 0!==r[1]&&(i=r[0]),void 0!==(r=i.split("Twitter"))[1]&&(i=r[0]);var n=function(t){return function(e){return e.test(t)}}(i),o={apple:{phone:n(Sa)&&!n(ka),ipod:n(Oa),tablet:!n(Sa)&&(n(Aa)||Ya(e))&&!n(ka),universal:n(Ma),device:(n(Sa)||n(Oa)||n(Aa)||n(Ma)||Ya(e))&&!n(ka)},amazon:{phone:n(Ra),tablet:!n(Ra)&&n(Da),device:n(Ra)||n(Da)},android:{phone:!n(ka)&&n(Ra)||!n(ka)&&n(La),tablet:!n(ka)&&!n(Ra)&&!n(La)&&(n(Da)||n(Na)),device:!n(ka)&&(n(Ra)||n(Da)||n(La)||n(Na))||n(/\bokhttp\b/i)},windows:{phone:n(ka),tablet:n(Fa),device:n(ka)||n(Fa)},other:{blackberry:n(Ba),blackberry10:n(Ua),opera:n(za),firefox:n(ja),chrome:n(Xa),device:n(Ba)||n(Ua)||n(za)||n(ja)||n(Xa)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}(self.navigator);!function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(Ha||(Ha={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(Ga||(Ga={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(Wa||(Wa={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"}(Va||(Va={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(qa||(qa={})),function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(Za||(Za={})),function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(Ja||(Ja={})),function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT"}(Ka||(Ka={})),function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"}(Qa||(Qa={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}($a||($a={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(th||(th={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"}(eh||(eh={})),function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA"}(ih||(ih={})),function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"}(rh||(rh={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(nh||(nh={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(oh||(oh={})),function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE"}(sh||(sh={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(ah||(ah={})),function(t){t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(hh||(hh={}));var uh,ph={MIPMAP_TEXTURES:eh.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:ah.NONE,SPRITE_MAX_TEXTURES:function(t){var e=!0;if(lh.tablet||lh.phone){var i;if(lh.apple.device)if(i=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(i[1],10)<11&&(e=!1);if(lh.android.device)if(i=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(i[1],10)<7&&(e=!1)}return e?t:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:nh.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:th.CLAMP,SCALE_MODE:$a.LINEAR,PRECISION_VERTEX:oh.HIGH,PRECISION_FRAGMENT:lh.apple.device?oh.HIGH:oh.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!lh.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};
|
|
25
|
+
/*!
|
|
26
|
+
* @pixi/ticker - v6.1.3
|
|
27
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
28
|
+
*
|
|
29
|
+
* @pixi/ticker is licensed under the MIT License.
|
|
30
|
+
* http://www.opensource.org/licenses/mit-license
|
|
31
|
+
*/ph.TARGET_FPMS=.06,function(t){t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY"}(uh||(uh={}));var ch=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=0),void 0===r&&(r=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=r}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),dh=function(){function t(){var t=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new ch(null,null,1/0),this.deltaMS=1/ph.TARGET_FPMS,this.elapsedMS=1/ph.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return t.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},t.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},t.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},t.prototype.add=function(t,e,i){return void 0===i&&(i=uh.NORMAL),this._addListener(new ch(t,e,i))},t.prototype.addOnce=function(t,e,i){return void 0===i&&(i=uh.NORMAL),this._addListener(new ch(t,e,i,!0))},t.prototype._addListener=function(t){var e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this},t.prototype.remove=function(t,e){for(var i=this._head.next;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(t.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},t.prototype.update=function(t){var e;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((e=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var i=t-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=t-i%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ph.TARGET_FPMS;for(var r=this._head,n=r.next;n;)n=n.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t},Object.defineProperty(t.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(t){var e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,ph.TARGET_FPMS);this._maxElapsedMS=1/i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(t){if(0===t)this._minElapsedMS=0;else{var e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"shared",{get:function(){if(!t._shared){var e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared},enumerable:!1,configurable:!0}),Object.defineProperty(t,"system",{get:function(){if(!t._system){var e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system},enumerable:!1,configurable:!0}),t}(),fh=function(){function t(){}return t.init=function(t){var e=this;t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set:function(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,uh.LOW)},get:function(){return this._ticker}}),this.stop=function(){e._ticker.stop()},this.start=function(){e._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?dh.shared:new dh,t.autoStart&&this.start()},t.destroy=function(){if(this._ticker){var t=this._ticker;this.ticker=null,t.destroy()}},t}(),vh=x((function(t){var e=Object.prototype.hasOwnProperty,i="~";function r(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new n(r,o||t,s),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,r,n=[];if(0===this._eventsCount)return n;for(r in t=this._events)e.call(t,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,s=new Array(o);n<o;n++)s[n]=r[n].fn;return s},a.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,n,o,s){var a=i?i+t:t;if(!this._events[a])return!1;var h,l,u=this._events[a],p=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),p){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,n),!0;case 5:return u.fn.call(u.context,e,r,n,o),!0;case 6:return u.fn.call(u.context,e,r,n,o,s),!0}for(l=1,h=new Array(p-1);l<p;l++)h[l-1]=arguments[l];u.fn.apply(u.context,h)}else{var c,d=u.length;for(l=0;l<d;l++)switch(u[l].once&&this.removeListener(t,u[l].fn,void 0,!0),p){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,e);break;case 3:u[l].fn.call(u[l].context,e,r);break;case 4:u[l].fn.call(u[l].context,e,r,n);break;default:if(!h)for(c=1,h=new Array(p-1);c<p;c++)h[c-1]=arguments[c];u[l].fn.apply(u[l].context,h)}}return!0},a.prototype.on=function(t,e,i){return o(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return o(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,r,n){var o=i?i+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||n&&!a.once||r&&a.context!==r||s(this,o);else{for(var h=0,l=[],u=a.length;h<u;h++)(a[h].fn!==e||n&&!a[h].once||r&&a[h].context!==r)&&l.push(a[h]);l.length?this._events[o]=1===l.length?l[0]:l:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a})),yh=mh,gh=mh;function mh(t,e,i){i=i||2;var r,n,o,s,a,h,l,u=e&&e.length,p=u?e[0]*i:t.length,c=_h(t,0,p,i,!0),d=[];if(!c||c.next===c.prev)return d;if(u&&(c=function(t,e,i,r){var n,o,s,a=[];for(n=0,o=e.length;n<o;n++)(s=_h(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(Ah(s));for(a.sort(Ch),n=0;n<a.length;n++)i=xh(i=Ih(a[n],i),i.next);return i}(t,e,c,i)),t.length>80*i){r=o=t[0],n=s=t[1];for(var f=i;f<p;f+=i)(a=t[f])<r&&(r=a),(h=t[f+1])<n&&(n=h),a>o&&(o=a),h>s&&(s=h);l=0!==(l=Math.max(o-r,s-n))?1/l:0}return bh(c,d,i,r,n,l),d}function _h(t,e,i,r,n){var o,s;if(n===Yh(t,e,i,r)>0)for(o=e;o<i;o+=r)s=zh(o,t[o],t[o+1],s);else for(o=i-r;o>=e;o-=r)s=zh(o,t[o],t[o+1],s);return s&&Rh(s,s.next)&&(Xh(s),s=s.next),s}function xh(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Rh(r,r.next)&&0!==Nh(r.prev,r,r.next))r=r.next;else{if(Xh(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function bh(t,e,i,r,n,o,s){if(t){!s&&o&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=Oh(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,o,s,a,h,l=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,r=i,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(h=l;a>0||h>0&&r;)0!==a&&(0===h||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,h--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,l*=2}while(s>1)}(n)}(t,r,n,o);for(var a,h,l=t;t.prev!==t.next;)if(a=t.prev,h=t.next,o?wh(t,r,n,o):Ph(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),Xh(t),t=h.next,l=h.next;else if((t=h)===l){s?1===s?bh(t=Eh(xh(t),e,i),e,i,r,n,o,2):2===s&&Th(t,e,i,r,n,o):bh(xh(t),e,i,r,n,o,1);break}}}function Ph(t){var e=t.prev,i=t,r=t.next;if(Nh(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Mh(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&Nh(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function wh(t,e,i,r){var n=t.prev,o=t,s=t.next;if(Nh(n,o,s)>=0)return!1;for(var a=n.x<o.x?n.x<s.x?n.x:s.x:o.x<s.x?o.x:s.x,h=n.y<o.y?n.y<s.y?n.y:s.y:o.y<s.y?o.y:s.y,l=n.x>o.x?n.x>s.x?n.x:s.x:o.x>s.x?o.x:s.x,u=n.y>o.y?n.y>s.y?n.y:s.y:o.y>s.y?o.y:s.y,p=Oh(a,h,e,i,r),c=Oh(l,u,e,i,r),d=t.prevZ,f=t.nextZ;d&&d.z>=p&&f&&f.z<=c;){if(d!==t.prev&&d!==t.next&&Mh(n.x,n.y,o.x,o.y,s.x,s.y,d.x,d.y)&&Nh(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==t.prev&&f!==t.next&&Mh(n.x,n.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Nh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=p;){if(d!==t.prev&&d!==t.next&&Mh(n.x,n.y,o.x,o.y,s.x,s.y,d.x,d.y)&&Nh(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=c;){if(f!==t.prev&&f!==t.next&&Mh(n.x,n.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Nh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Eh(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!Rh(n,o)&&Dh(n,r,r.next,o)&&Bh(n,o)&&Bh(o,n)&&(e.push(n.i/i),e.push(r.i/i),e.push(o.i/i),Xh(r),Xh(r.next),r=t=o),r=r.next}while(r!==t);return xh(r)}function Th(t,e,i,r,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Lh(s,a)){var h=Uh(s,a);return s=xh(s,s.next),h=xh(h,h.next),bh(s,e,i,r,n,o),void bh(h,e,i,r,n,o)}a=a.next}s=s.next}while(s!==t)}function Ch(t,e){return t.x-e.x}function Ih(t,e){var i=function(t,e){var i,r=e,n=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>s){if(s=a,a===n){if(o===r.y)return r;if(o===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===s)return i;var h,l=i,u=i.x,p=i.y,c=1/0;r=i;do{n>=r.x&&r.x>=u&&n!==r.x&&Mh(o<p?n:s,o,u,p,o<p?s:n,o,r.x,r.y)&&(h=Math.abs(o-r.y)/(n-r.x),Bh(r,t)&&(h<c||h===c&&(r.x>i.x||r.x===i.x&&Sh(i,r)))&&(i=r,c=h)),r=r.next}while(r!==l);return i}(t,e);if(!i)return e;var r=Uh(i,t),n=xh(i,i.next);return xh(r,r.next),e===i?n:e}function Sh(t,e){return Nh(t.prev,t,e.prev)<0&&Nh(e.next,t,t.next)<0}function Oh(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ah(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Mh(t,e,i,r,n,o,s,a){return(n-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(r-a)-(i-s)*(e-a)>=0&&(i-s)*(o-a)-(n-s)*(r-a)>=0}function Lh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Dh(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Bh(t,e)&&Bh(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(Nh(t.prev,t,e.prev)||Nh(t,e.prev,e))||Rh(t,e)&&Nh(t.prev,t,t.next)>0&&Nh(e.prev,e,e.next)>0)}function Nh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Rh(t,e){return t.x===e.x&&t.y===e.y}function Dh(t,e,i,r){var n=Fh(Nh(t,e,i)),o=Fh(Nh(t,e,r)),s=Fh(Nh(i,r,t)),a=Fh(Nh(i,r,e));return n!==o&&s!==a||(!(0!==n||!kh(t,i,e))||(!(0!==o||!kh(t,r,e))||(!(0!==s||!kh(i,t,r))||!(0!==a||!kh(i,e,r)))))}function kh(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Fh(t){return t>0?1:t<0?-1:0}function Bh(t,e){return Nh(t.prev,t,t.next)<0?Nh(t,e,t.next)>=0&&Nh(t,t.prev,e)>=0:Nh(t,e,t.prev)<0||Nh(t,t.next,e)<0}function Uh(t,e){var i=new jh(t.i,t.x,t.y),r=new jh(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function zh(t,e,i,r){var n=new jh(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Xh(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function jh(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Yh(t,e,i,r){for(var n=0,o=e,s=i-r;o<i;o+=r)n+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return n}mh.deviation=function(t,e,i,r){var n=e&&e.length,o=n?e[0]*i:t.length,s=Math.abs(Yh(t,0,o,i));if(n)for(var a=0,h=e.length;a<h;a++){var l=e[a]*i,u=a<h-1?e[a+1]*i:t.length;s-=Math.abs(Yh(t,l,u,i))}var p=0;for(a=0;a<r.length;a+=3){var c=r[a]*i,d=r[a+1]*i,f=r[a+2]*i;p+=Math.abs((t[c]-t[f])*(t[d+1]-t[c+1])-(t[c]-t[d])*(t[f+1]-t[c+1]))}return 0===s&&0===p?0:Math.abs((p-s)/s)},mh.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,n=0;n<t.length;n++){for(var o=0;o<t[n].length;o++)for(var s=0;s<e;s++)i.vertices.push(t[n][o][s]);n>0&&(r+=t[n-1].length,i.holes.push(r))}return i},yh.default=gh;
|
|
32
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
33
|
+
var Hh=2147483647,Gh=/[^\x20-\x7E]/,Wh=/[\x2E\u3002\uFF0E\uFF61]/g,Vh={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},qh=Math.floor,Zh=String.fromCharCode;function Jh(t){throw new RangeError(Vh[t])}function Kh(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function Qh(t,e,i){var r=0;for(t=i?qh(t/700):t>>1,t+=qh(t/e);t>455;r+=36)t=qh(t/35);return qh(r+36*t/(t+38))}function $h(t){return function(t,e){var i=t.split("@"),r="";i.length>1&&(r=i[0]+"@",t=i[1]);var n=function(t,e){for(var i=t.length,r=[];i--;)r[i]=e(t[i]);return r}((t=t.replace(Wh,".")).split("."),e).join(".");return r+n}(t,(function(t){return Gh.test(t)?"xn--"+function(t){var e,i,r,n,o,s,a,h,l,u,p,c,d,f,v,y=[];for(t=function(t){for(var e,i,r=[],n=0,o=t.length;n<o;)(e=t.charCodeAt(n++))>=55296&&e<=56319&&n<o?56320==(64512&(i=t.charCodeAt(n++)))?r.push(((1023&e)<<10)+(1023&i)+65536):(r.push(e),n--):r.push(e);return r}(t),c=t.length,e=128,i=0,o=72,s=0;s<c;++s)(p=t[s])<128&&y.push(Zh(p));for(r=n=y.length,n&&y.push("-");r<c;){for(a=Hh,s=0;s<c;++s)(p=t[s])>=e&&p<a&&(a=p);for(a-e>qh((Hh-i)/(d=r+1))&&Jh("overflow"),i+=(a-e)*d,e=a,s=0;s<c;++s)if((p=t[s])<e&&++i>Hh&&Jh("overflow"),p==e){for(h=i,l=36;!(h<(u=l<=o?1:l>=o+26?26:l-o));l+=36)v=h-u,f=36-u,y.push(Zh(Kh(u+v%f,0))),h=qh(v/f);y.push(Zh(Kh(h,0))),o=Qh(i,d,r==n),i=0,++r}++i,++e}return y.join("")}(t):t}))}function tl(t){return null===t}function el(t){return"string"==typeof t}function il(t){return"object"==typeof t&&null!==t}function rl(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var nl=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function ol(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}}function sl(t,e){if(t.map)return t.map(e);for(var i=[],r=0;r<t.length;r++)i.push(e(t[r],r));return i}var al=Object.keys||function(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.push(i);return e};function hl(t,e,i,r){e=e||"&",i=i||"=";var n={};if("string"!=typeof t||0===t.length)return n;var o=/\+/g;t=t.split(e);var s=1e3;r&&"number"==typeof r.maxKeys&&(s=r.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var h=0;h<a;++h){var l,u,p,c,d=t[h].replace(o,"%20"),f=d.indexOf(i);f>=0?(l=d.substr(0,f),u=d.substr(f+1)):(l=d,u=""),p=decodeURIComponent(l),c=decodeURIComponent(u),rl(n,p)?nl(n[p])?n[p].push(c):n[p]=[n[p],c]:n[p]=c}return n}function ll(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var ul=/^([a-z0-9.+-]+:)/i,pl=/:[0-9]*$/,cl=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,dl=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),fl=["'"].concat(dl),vl=["%","/","?",";","#"].concat(fl),yl=["/","?","#"],gl=/^[+a-z0-9A-Z_-]{0,63}$/,ml=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_l={javascript:!0,"javascript:":!0},xl={javascript:!0,"javascript:":!0},bl={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Pl(t,e,i){if(t&&il(t)&&t instanceof ll)return t;var r=new ll;return r.parse(t,e,i),r}function wl(t,e,i,r){if(!el(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),o=-1!==n&&n<e.indexOf("#")?"?":"#",s=e.split(o);s[0]=s[0].replace(/\\/g,"/");var a=e=s.join(o);if(a=a.trim(),!r&&1===e.split("#").length){var h=cl.exec(a);if(h)return t.path=a,t.href=a,t.pathname=h[1],h[2]?(t.search=h[2],t.query=i?hl(t.search.substr(1)):t.search.substr(1)):i&&(t.search="",t.query={}),t}var l,u,p,c,d=ul.exec(a);if(d){var f=(d=d[0]).toLowerCase();t.protocol=f,a=a.substr(d.length)}if(r||d||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var v="//"===a.substr(0,2);!v||d&&xl[d]||(a=a.substr(2),t.slashes=!0)}if(!xl[d]&&(v||d&&!bl[d])){var y,g,m=-1;for(l=0;l<yl.length;l++)-1!==(u=a.indexOf(yl[l]))&&(-1===m||u<m)&&(m=u);for(-1!==(g=-1===m?a.lastIndexOf("@"):a.lastIndexOf("@",m))&&(y=a.slice(0,g),a=a.slice(g+1),t.auth=decodeURIComponent(y)),m=-1,l=0;l<vl.length;l++)-1!==(u=a.indexOf(vl[l]))&&(-1===m||u<m)&&(m=u);-1===m&&(m=a.length),t.host=a.slice(0,m),a=a.slice(m),Tl(t),t.hostname=t.hostname||"";var _="["===t.hostname[0]&&"]"===t.hostname[t.hostname.length-1];if(!_){var x=t.hostname.split(/\./);for(l=0,p=x.length;l<p;l++){var b=x[l];if(b&&!b.match(gl)){for(var P="",w=0,E=b.length;w<E;w++)b.charCodeAt(w)>127?P+="x":P+=b[w];if(!P.match(gl)){var T=x.slice(0,l),C=x.slice(l+1),I=b.match(ml);I&&(T.push(I[1]),C.unshift(I[2])),C.length&&(a="/"+C.join(".")+a),t.hostname=T.join(".");break}}}}t.hostname.length>255?t.hostname="":t.hostname=t.hostname.toLowerCase(),_||(t.hostname=$h(t.hostname)),c=t.port?":"+t.port:"";var S=t.hostname||"";t.host=S+c,t.href+=t.host,_&&(t.hostname=t.hostname.substr(1,t.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!_l[f])for(l=0,p=fl.length;l<p;l++){var O=fl[l];if(-1!==a.indexOf(O)){var A=encodeURIComponent(O);A===O&&(A=escape(O)),a=a.split(O).join(A)}}var M=a.indexOf("#");-1!==M&&(t.hash=a.substr(M),a=a.slice(0,M));var L=a.indexOf("?");if(-1!==L?(t.search=a.substr(L),t.query=a.substr(L+1),i&&(t.query=hl(t.query)),a=a.slice(0,L)):i&&(t.search="",t.query={}),a&&(t.pathname=a),bl[f]&&t.hostname&&!t.pathname&&(t.pathname="/"),t.pathname||t.search){c=t.pathname||"";var N=t.search||"";t.path=c+N}return t.href=El(t),t}function El(t){var e=t.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var i=t.protocol||"",r=t.pathname||"",n=t.hash||"",o=!1,s="";t.host?o=e+t.host:t.hostname&&(o=e+(-1===t.hostname.indexOf(":")?t.hostname:"["+this.hostname+"]"),t.port&&(o+=":"+t.port)),t.query&&il(t.query)&&Object.keys(t.query).length&&(s=function(t,e,i,r){return e=e||"&",i=i||"=",null===t&&(t=void 0),"object"==typeof t?sl(al(t),(function(r){var n=encodeURIComponent(ol(r))+i;return nl(t[r])?sl(t[r],(function(t){return n+encodeURIComponent(ol(t))})).join(e):n+encodeURIComponent(ol(t[r]))})).join(e):r?encodeURIComponent(ol(r))+i+encodeURIComponent(ol(t)):""}(t.query));var a=t.search||s&&"?"+s||"";return i&&":"!==i.substr(-1)&&(i+=":"),t.slashes||(!i||bl[i])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),i+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+n}function Tl(t){var e=t.host,i=pl.exec(e);i&&(":"!==(i=i[0])&&(t.port=i.substr(1)),e=e.substr(0,e.length-i.length)),e&&(t.hostname=e)}
|
|
34
|
+
/*!
|
|
35
|
+
* @pixi/utils - v6.1.3
|
|
36
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
37
|
+
*
|
|
38
|
+
* @pixi/utils is licensed under the MIT License.
|
|
39
|
+
* http://www.opensource.org/licenses/mit-license
|
|
40
|
+
*/ll.prototype.parse=function(t,e,i){return wl(this,t,e,i)},ll.prototype.format=function(){return El(this)},ll.prototype.resolve=function(t){return this.resolveObject(Pl(t,!1,!0)).format()},ll.prototype.resolveObject=function(t){if(el(t)){var e=new ll;e.parse(t,!1,!0),t=e}for(var i,r=new ll,n=Object.keys(this),o=0;o<n.length;o++){var s=n[o];r[s]=this[s]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),h=0;h<a.length;h++){var l=a[h];"protocol"!==l&&(r[l]=t[l])}return bl[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!bl[t.protocol]){for(var u=Object.keys(t),p=0;p<u.length;p++){var c=u[p];r[c]=t[c]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||xl[t.protocol])r.pathname=t.pathname;else{for(i=(t.pathname||"").split("/");i.length&&!(t.host=i.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==i[0]&&i.unshift(""),i.length<2&&i.unshift(""),r.pathname=i.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var d=r.pathname||"",f=r.search||"";r.path=d+f}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v,y=r.pathname&&"/"===r.pathname.charAt(0),g=t.host||t.pathname&&"/"===t.pathname.charAt(0),m=g||y||r.host&&t.pathname,_=m,x=r.pathname&&r.pathname.split("/")||[],b=r.protocol&&!bl[r.protocol];if(i=t.pathname&&t.pathname.split("/")||[],b&&(r.hostname="",r.port=null,r.host&&(""===x[0]?x[0]=r.host:x.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===i[0]?i[0]=t.host:i.unshift(t.host)),t.host=null),m=m&&(""===i[0]||""===x[0])),g)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,x=i;else if(i.length)x||(x=[]),x.pop(),x=x.concat(i),r.search=t.search,r.query=t.query;else if(null!=t.search)return b&&(r.hostname=r.host=x.shift(),(v=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=v.shift(),r.host=r.hostname=v.shift())),r.search=t.search,r.query=t.query,tl(r.pathname)&&tl(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var P=x.slice(-1)[0],w=(r.host||t.host||x.length>1)&&("."===P||".."===P)||""===P,E=0,T=x.length;T>=0;T--)"."===(P=x[T])?x.splice(T,1):".."===P?(x.splice(T,1),E++):E&&(x.splice(T,1),E--);if(!m&&!_)for(;E--;E)x.unshift("..");!m||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),w&&"/"!==x.join("/").substr(-1)&&x.push("");var C=""===x[0]||x[0]&&"/"===x[0].charAt(0);return b&&(r.hostname=r.host=C?"":x.length?x.shift():"",(v=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=v.shift(),r.host=r.hostname=v.shift())),(m=m||r.host&&x.length)&&!C&&x.unshift(""),x.length?r.pathname=x.join("/"):(r.pathname=null,r.path=null),tl(r.pathname)&&tl(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},ll.prototype.parseHost=function(){return Tl(this)};var Cl={parse:Pl,format:function(t){return el(t)&&(t=wl({},t)),El(t)},resolve:function(t,e){return Pl(t,!1,!0).resolve(e)}};ph.RETINA_PREFIX=/@([0-9\.]+)x/,ph.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Il,Sl=!1;function Ol(){Sl=!0}function Al(t){var e;if(!Sl){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var i=["\n %c %c %c PixiJS 6.1.3 - ✰ "+t+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=self.console).log.apply(e,i)}else self.console&&self.console.log("PixiJS 6.1.3 - "+t+" - http://www.pixijs.com/");Sl=!0}}function Ml(){return void 0===Il&&(Il=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:ph.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!self.WebGLRenderingContext)return!1;var e=document.createElement("canvas"),i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),r=!(!i||!i.getContextAttributes().stencil);if(i){var n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch(t){return!1}}()),Il}var Ll={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",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:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",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:"#ff0000",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:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Nl(t,e){return void 0===e&&(e=[]),e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function Rl(t){var e=t.toString(16);return"#"+(e="000000".substr(0,6-e.length)+e)}function Dl(t){return"string"==typeof t&&"#"===(t=Ll[t.toLowerCase()]||t)[0]&&(t=t.substr(1)),parseInt(t,16)}function kl(t){return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)}var Fl=function(){for(var t=[],e=[],i=0;i<32;i++)t[i]=i,e[i]=i;t[js.NORMAL_NPM]=js.NORMAL,t[js.ADD_NPM]=js.ADD,t[js.SCREEN_NPM]=js.SCREEN,e[js.NORMAL]=js.NORMAL_NPM,e[js.ADD]=js.ADD_NPM,e[js.SCREEN]=js.SCREEN_NPM;var r=[];return r.push(e),r.push(t),r}();function Bl(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var i=t>>16&255,r=t>>8&255,n=255&t;return(255*e<<24)+((i=i*e+.5|0)<<16)+((r=r*e+.5|0)<<8)+(n=n*e+.5|0)}function Ul(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}var zl={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};function Xl(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function jl(t){return!(t&t-1||!t)}function Yl(t){var e=(t>65535?1:0)<<4,i=((t>>>=e)>255?1:0)<<3;return e|=i,e|=i=((t>>>=i)>15?1:0)<<2,(e|=i=((t>>>=i)>3?1:0)<<1)|(t>>>=i)>>1}function Hl(t,e,i){var r,n=t.length;if(!(e>=n||0===i)){var o=n-(i=e+i>n?n-e:i);for(r=e;r<o;++r)t[r]=t[r+i];t.length=o}}function Gl(t){return 0===t?0:t<0?-1:1}var Wl=0;function Vl(){return++Wl}var ql={};function Zl(t,e,i){if(void 0===i&&(i=3),!ql[e]){var r=(new Error).stack;void 0===r?console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t):(r=r.split("\n").splice(i).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+"\nDeprecated since v"+t),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t),console.warn(r))),ql[e]=!0}}var Jl={},Kl=Object.create(null),Ql=Object.create(null);function $l(){var t;for(t in Kl)delete Kl[t];for(t in Ql)delete Ql[t]}var tu=function(){function t(t,e,i){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.resolution=i||ph.RESOLUTION,this.resize(t,e)}return t.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},t.prototype.resize=function(t,e){this.canvas.width=Math.round(t*this.resolution),this.canvas.height=Math.round(e*this.resolution)},t.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(t.prototype,"width",{get:function(){return this.canvas.width},set:function(t){this.canvas.width=Math.round(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=Math.round(t)},enumerable:!1,configurable:!0}),t}();function eu(t){var e,i,r,n=t.width,o=t.height,s=t.getContext("2d"),a=s.getImageData(0,0,n,o).data,h=a.length,l={top:null,left:null,right:null,bottom:null},u=null;for(e=0;e<h;e+=4)0!==a[e+3]&&(i=e/4%n,r=~~(e/4/n),null===l.top&&(l.top=r),(null===l.left||i<l.left)&&(l.left=i),(null===l.right||l.right<i)&&(l.right=i+1),(null===l.bottom||l.bottom<r)&&(l.bottom=r));return null!==l.top&&(n=l.right-l.left,o=l.bottom-l.top+1,u=s.getImageData(l.left,l.top,n,o)),{height:o,width:n,data:u}}var iu,ru=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function nu(t,e){if(void 0===e&&(e=self.location),0===t.indexOf("data:"))return"";e=e||self.location,iu||(iu=document.createElement("a")),iu.href=t;var i=Cl.parse(iu.href),r=!i.port&&""===e.port||i.port===e.port;return i.hostname===e.hostname&&r&&i.protocol===e.protocol?"":"anonymous"}function ou(t,e){var i=ph.RETINA_PREFIX.exec(t);return i?parseFloat(i[1]):void 0!==e?e:1}var su=Object.freeze({__proto__:null,BaseTextureCache:Ql,CanvasRenderTarget:tu,DATA_URI:ru,ProgramCache:Jl,TextureCache:Kl,clearTextureCache:$l,correctBlendMode:function(t,e){return Fl[e?1:0][t]},createIndicesForQuads:function(t,e){void 0===e&&(e=null);var i=6*t;if((e=e||new Uint16Array(i)).length!==i)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+i);for(var r=0,n=0;r<i;r+=6,n+=4)e[r+0]=n+0,e[r+1]=n+1,e[r+2]=n+2,e[r+3]=n+0,e[r+4]=n+2,e[r+5]=n+3;return e},decomposeDataUri:function(t){var e=ru.exec(t);if(e)return{mediaType:e[1]?e[1].toLowerCase():void 0,subType:e[2]?e[2].toLowerCase():void 0,charset:e[3]?e[3].toLowerCase():void 0,encoding:e[4]?e[4].toLowerCase():void 0,data:e[5]}},deprecation:Zl,destroyTextureCache:function(){var t;for(t in Kl)Kl[t].destroy();for(t in Ql)Ql[t].destroy()},determineCrossOrigin:nu,getBufferType:Ul,getResolutionOfUrl:ou,hex2rgb:Nl,hex2string:Rl,interleaveTypedArrays:function(t,e){for(var i=0,r=0,n={},o=0;o<t.length;o++)r+=e[o],i+=t[o].length;var s=new ArrayBuffer(4*i),a=null,h=0;for(o=0;o<t.length;o++){var l=e[o],u=t[o],p=Ul(u);n[p]||(n[p]=new zl[p](s)),a=n[p];for(var c=0;c<u.length;c++){a[(c/l|0)*r+h+c%l]=u[c]}h+=l}return new Float32Array(s)},isPow2:jl,isWebGLSupported:Ml,log2:Yl,nextPow2:Xl,premultiplyBlendMode:Fl,premultiplyRgba:function(t,e,i,r){return i=i||new Float32Array(4),r||void 0===r?(i[0]=t[0]*e,i[1]=t[1]*e,i[2]=t[2]*e):(i[0]=t[0],i[1]=t[1],i[2]=t[2]),i[3]=e,i},premultiplyTint:Bl,premultiplyTintToRgba:function(t,e,i,r){return(i=i||new Float32Array(4))[0]=(t>>16&255)/255,i[1]=(t>>8&255)/255,i[2]=(255&t)/255,(r||void 0===r)&&(i[0]*=e,i[1]*=e,i[2]*=e),i[3]=e,i},removeItems:Hl,rgb2hex:kl,sayHello:Al,sign:Gl,skipHello:Ol,string2hex:Dl,trimCanvas:eu,uid:Vl,url:Cl,isMobile:lh,EventEmitter:vh,earcut:yh});
|
|
41
|
+
/*!
|
|
42
|
+
* @pixi/display - v6.1.3
|
|
43
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
44
|
+
*
|
|
45
|
+
* @pixi/display is licensed under the MIT License.
|
|
46
|
+
* http://www.opensource.org/licenses/mit-license
|
|
47
|
+
*/ph.SORTABLE_CHILDREN=!1;var au=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?pa.EMPTY:((t=t||new pa(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addPointMatrix=function(t,e){var i=t.a,r=t.b,n=t.c,o=t.d,s=t.tx,a=t.ty,h=i*e.x+n*e.y+s,l=r*e.x+o*e.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},t.prototype.addQuad=function(t){var e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,o=t[0],s=t[1];e=o<e?o:e,i=s<i?s:i,r=o>r?o:r,n=s>n?s:n,e=(o=t[2])<e?o:e,i=(s=t[3])<i?s:i,r=o>r?o:r,n=s>n?s:n,e=(o=t[4])<e?o:e,i=(s=t[5])<i?s:i,r=o>r?o:r,n=s>n?s:n,e=(o=t[6])<e?o:e,i=(s=t[7])<i?s:i,r=o>r?o:r,n=s>n?s:n,this.minX=e,this.minY=i,this.maxX=r,this.maxY=n},t.prototype.addFrame=function(t,e,i,r,n){this.addFrameMatrix(t.worldTransform,e,i,r,n)},t.prototype.addFrameMatrix=function(t,e,i,r,n){var o=t.a,s=t.b,a=t.c,h=t.d,l=t.tx,u=t.ty,p=this.minX,c=this.minY,d=this.maxX,f=this.maxY,v=o*e+a*i+l,y=s*e+h*i+u;p=v<p?v:p,c=y<c?y:c,d=v>d?v:d,f=y>f?y:f,p=(v=o*r+a*i+l)<p?v:p,c=(y=s*r+h*i+u)<c?y:c,d=v>d?v:d,f=y>f?y:f,p=(v=o*e+a*n+l)<p?v:p,c=(y=s*e+h*n+u)<c?y:c,d=v>d?v:d,f=y>f?y:f,p=(v=o*r+a*n+l)<p?v:p,c=(y=s*r+h*n+u)<c?y:c,d=v>d?v:d,f=y>f?y:f,this.minX=p,this.minY=c,this.maxX=d,this.maxY=f},t.prototype.addVertexData=function(t,e,i){for(var r=this.minX,n=this.minY,o=this.maxX,s=this.maxY,a=e;a<i;a+=2){var h=t[a],l=t[a+1];r=h<r?h:r,n=l<n?l:n,o=h>o?h:o,s=l>s?l:s}this.minX=r,this.minY=n,this.maxX=o,this.maxY=s},t.prototype.addVertices=function(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)},t.prototype.addVerticesMatrix=function(t,e,i,r,n,o){void 0===n&&(n=0),void 0===o&&(o=n);for(var s=t.a,a=t.b,h=t.c,l=t.d,u=t.tx,p=t.ty,c=this.minX,d=this.minY,f=this.maxX,v=this.maxY,y=i;y<r;y+=2){var g=e[y],m=e[y+1],_=s*g+h*m+u,x=l*m+a*g+p;c=Math.min(c,_-n),f=Math.max(f,_+n),d=Math.min(d,x-o),v=Math.max(v,x+o)}this.minX=c,this.minY=d,this.maxX=f,this.maxY=v},t.prototype.addBounds=function(t){var e=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n},t.prototype.addBoundsMask=function(t,e){var i=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&r<=o){var s=this.minX,a=this.minY,h=this.maxX,l=this.maxY;this.minX=i<s?i:s,this.minY=r<a?r:a,this.maxX=n>h?n:h,this.maxY=o>l?o:l}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var i=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&r<=o){var s=this.minX,a=this.minY,h=this.maxX,l=this.maxY;this.minX=i<s?i:s,this.minY=r<a?r:a,this.maxX=n>h?n:h,this.maxY=o>l?o:l}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,i,r,n,o){t-=n,e-=o,i+=n,r+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r},t}(),hu=function(t,e){return hu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},hu(t,e)};
|
|
48
|
+
/*! *****************************************************************************
|
|
49
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
50
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
51
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
52
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
53
|
+
|
|
54
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
55
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
56
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
57
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
58
|
+
|
|
59
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
60
|
+
and limitations under the License.
|
|
61
|
+
***************************************************************************** */function lu(t,e){function i(){this.constructor=t}hu(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var uu=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new Ia,e.alpha=1,e.visible=!0,e.renderable=!0,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new au,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return lu(e,t),e.mixin=function(t){for(var i=Object.keys(t),r=0;r<i.length;++r){var n=i[r];Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t,n))}},Object.defineProperty(e.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),e.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},e.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},e.prototype.getBounds=function(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new pa),e=this._boundsRect),this._bounds.getRectangle(e)},e.prototype.getLocalBounds=function(t){t||(this._localBoundsRect||(this._localBoundsRect=new pa),t=this._localBoundsRect),this._localBounds||(this._localBounds=new au);var e=this.transform,i=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;var o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,o},e.prototype.toGlobal=function(t,e,i){return void 0===i&&(i=!1),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)},e.prototype.toLocal=function(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)},e.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},e.prototype.setTransform=function(t,e,i,r,n,o,s,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=1),void 0===n&&(n=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===h&&(h=0),this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=o,this.skew.y=s,this.pivot.x=a,this.pivot.y=h,this},e.prototype.destroy=function(t){this.parent&&this.parent.removeChild(this),this.emit("destroyed"),this.removeAllListeners(),this.transform=null,this.parent=null,this._bounds=null,this._mask=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this._destroyed=!0},Object.defineProperty(e.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new pu),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),e.prototype.enableTempParent=function(){var t=this.parent;return this.parent=this._tempDisplayObjectParent,t},e.prototype.disableTempParent=function(t){this.parent=t},Object.defineProperty(e.prototype,"x",{get:function(){return this.position.x},set:function(t){this.transform.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.position.y},set:function(t){this.transform.position.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(t){this.transform.pivot.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.rotation=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.transform.rotation*la},set:function(t){this.transform.rotation=t*ua},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._mask},set:function(t){var e;this._mask&&((e=this._mask.maskObject||this._mask).renderable=!0,e.isMask=!1);(this._mask=t,this._mask)&&((e=this._mask.maskObject||this._mask).renderable=!1,e.isMask=!0)},enumerable:!1,configurable:!0}),e}(vh),pu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.sortDirty=null,e}return lu(e,t),e}(uu);function cu(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}uu.prototype.displayObjectUpdateTransform=uu.prototype.updateTransform;var du=function(t){function e(){var e=t.call(this)||this;return e.children=[],e.sortableChildren=ph.SORTABLE_CHILDREN,e.sortDirty=!1,e}return lu(e,t),e.prototype.onChildrenChange=function(t){},e.prototype.addChild=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];if(e.length>1)for(var r=0;r<e.length;r++)this.addChild(e[r]);else{var n=e[0];n.parent&&n.parent.removeChild(n),n.parent=this,this.sortDirty=!0,n.transform._parentID=-1,this.children.push(n),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",n,this,this.children.length-1),n.emit("added",this)}return e[0]},e.prototype.addChildAt=function(t,e){if(e<0||e>this.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},e.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t,this.onChildrenChange(i<r?i:r)}},e.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},e.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(t);Hl(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];if(e.length>1)for(var r=0;r<e.length;r++)this.removeChild(e[r]);else{var n=e[0],o=this.children.indexOf(n);if(-1===o)return null;n.parent=null,n.transform._parentID=-1,Hl(this.children,o,1),this._boundsID++,this.onChildrenChange(o),n.emit("removed",this),this.emit("childRemoved",n,this,o)}return e[0]},e.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,Hl(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e},e.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i,r=t,n=e-r;if(n>0&&n<=e){i=this.children.splice(r,n);for(var o=0;o<i.length;++o)i[o].parent=null,i[o].transform&&(i[o].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(o=0;o<i.length;++o)i[o].emit("removed",this),this.emit("childRemoved",i[o],this,o);return i}if(0===n&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},e.prototype.sortChildren=function(){for(var t=!1,e=0,i=this.children.length;e<i;++e){var r=this.children[e];r._lastSortedIndex=e,t||0===r.zIndex||(t=!0)}t&&this.children.length>1&&this.children.sort(cu),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t<e;++t){var i=this.children[t];i.visible&&i.updateTransform()}},e.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var e=this.children[t];if(e.visible&&e.renderable)if(e.calculateBounds(),e._mask){var i=e._mask.maskObject||e._mask;i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID},e.prototype.getLocalBounds=function(e,i){void 0===i&&(i=!1);var r=t.prototype.getLocalBounds.call(this,e);if(!i)for(var n=0,o=this.children.length;n<o;++n){var s=this.children[n];s.visible&&s.updateTransform()}return r},e.prototype._calculateBounds=function(){},e.prototype.render=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(t);else{this._render(t);for(var e=0,i=this.children.length;e<i;++e)this.children[e].render(t)}},e.prototype.renderAdvanced=function(t){t.batch.flush();var e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var r=0;r<e.length;r++)e[r].enabled&&this._enabledFilters.push(e[r]);this._enabledFilters.length&&t.filter.push(this,this._enabledFilters)}i&&t.mask.push(this,this._mask),this._render(t);r=0;for(var n=this.children.length;r<n;r++)this.children[r].render(t);t.batch.flush(),i&&t.mask.pop(this),e&&this._enabledFilters&&this._enabledFilters.length&&t.filter.pop()},e.prototype._render=function(t){},e.prototype.destroy=function(e){t.prototype.destroy.call(this),this.sortDirty=!1;var i="boolean"==typeof e?e:e&&e.children,r=this.removeChildren(0,this.children.length);if(i)for(var n=0;n<r.length;++n)r[n].destroy(e)},Object.defineProperty(e.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(t){var e=this.getLocalBounds().width;this.scale.x=0!==e?t/e:1,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(t){var e=this.getLocalBounds().height;this.scale.y=0!==e?t/e:1,this._height=t},enumerable:!1,configurable:!0}),e}(uu);du.prototype.containerUpdateTransform=du.prototype.updateTransform;
|
|
62
|
+
/*!
|
|
63
|
+
* @pixi/runner - v6.1.3
|
|
64
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
65
|
+
*
|
|
66
|
+
* @pixi/runner is licensed under the MIT License.
|
|
67
|
+
* http://www.opensource.org/licenses/mit-license
|
|
68
|
+
*/
|
|
69
|
+
var fu=function(){function t(t){this.items=[],this._name=t,this._aliasCount=0}return t.prototype.emit=function(t,e,i,r,n,o,s,a){if(arguments.length>8)throw new Error("max arguments reached");var h=this,l=h.name,u=h.items;this._aliasCount++;for(var p=0,c=u.length;p<c;p++)u[p][l](t,e,i,r,n,o,s,a);return u===this.items&&this._aliasCount--,this},t.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(fu.prototype,{dispatch:{value:fu.prototype.emit},run:{value:fu.prototype.emit}}),
|
|
70
|
+
/*!
|
|
71
|
+
* @pixi/core - v6.1.3
|
|
72
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
73
|
+
*
|
|
74
|
+
* @pixi/core is licensed under the MIT License.
|
|
75
|
+
* http://www.opensource.org/licenses/mit-license
|
|
76
|
+
*/
|
|
77
|
+
ph.PREFER_ENV=lh.any?Us.WEBGL:Us.WEBGL2,ph.STRICT_TEXTURE_CACHE=!1;var vu=[];function yu(t,e){if(!t)return null;var i="";if("string"==typeof t){var r=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);r&&(i=r[1].toLowerCase())}for(var n=vu.length-1;n>=0;--n){var o=vu[n];if(o.test&&o.test(t,i))return new o(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}
|
|
78
|
+
/*! *****************************************************************************
|
|
79
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
80
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
81
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
82
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
83
|
+
|
|
84
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
85
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
86
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
87
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
88
|
+
|
|
89
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
90
|
+
and limitations under the License.
|
|
91
|
+
***************************************************************************** */var gu=function(t,e){return gu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},gu(t,e)};function mu(t,e){function i(){this.constructor=t}gu(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var _u=function(){return _u=Object.assign||function(t){for(var e,i=arguments,r=1,n=arguments.length;r<n;r++)for(var o in e=i[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},_u.apply(this,arguments)};var xu=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new fu("setRealSize"),this.onUpdate=new fu("update"),this.onError=new fu("onError")}return t.prototype.bind=function(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},t.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},t.prototype.resize=function(t,e){t===this._width&&e===this._height||(this._width=t,this._height=e,this.onResize.emit(t,e))},Object.defineProperty(t.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),t.prototype.update=function(){this.destroyed||this.onUpdate.emit()},t.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),t.prototype.style=function(t,e,i){return!1},t.prototype.dispose=function(){},t.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},t.test=function(t,e){return!1},t}(),bu=function(t){function e(e,i){var r=this,n=i||{},o=n.width,s=n.height;if(!o||!s)throw new Error("BufferResource width or height invalid");return(r=t.call(this,o,s)||this).data=e,r}return mu(e,t),e.prototype.upload=function(t,e,i){var r=t.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Ks.UNPACK);var n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?r.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,r.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0},e.prototype.dispose=function(){this.data=null},e.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},e}(xu),Pu={scaleMode:qs.NEAREST,format:Hs.RGBA,alphaMode:Ks.NPM},wu=function(t){function e(e,i){void 0===e&&(e=null),void 0===i&&(i=null);var r=t.call(this)||this,n=(i=i||{}).alphaMode,o=i.mipmap,s=i.anisotropicLevel,a=i.scaleMode,h=i.width,l=i.height,u=i.wrapMode,p=i.format,c=i.type,d=i.target,f=i.resolution,v=i.resourceOptions;return!e||e instanceof xu||((e=yu(e,v)).internal=!0),r.resolution=f||ph.RESOLUTION,r.width=Math.round((h||0)*r.resolution)/r.resolution,r.height=Math.round((l||0)*r.resolution)/r.resolution,r._mipmap=void 0!==o?o:ph.MIPMAP_TEXTURES,r.anisotropicLevel=void 0!==s?s:ph.ANISOTROPIC_LEVEL,r._wrapMode=u||ph.WRAP_MODE,r._scaleMode=void 0!==a?a:ph.SCALE_MODE,r.format=p||Hs.RGBA,r.type=c||Ws.UNSIGNED_BYTE,r.target=d||Gs.TEXTURE_2D,r.alphaMode=void 0!==n?n:Ks.UNPACK,r.uid=Vl(),r.touched=0,r.isPowerOfTwo=!1,r._refreshPOT(),r._glTextures={},r.dirtyId=0,r.dirtyStyleId=0,r.cacheId=null,r.valid=h>0&&l>0,r.textureCacheIds=[],r.destroyed=!1,r.resource=null,r._batchEnabled=0,r._batchLocation=0,r.parentTextureArray=null,r.setResource(e),r}return mu(e,t),Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(t,e){var i;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this},e.prototype.setSize=function(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)},e.prototype.setRealSize=function(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=jl(this.realWidth)&&jl(this.realHeight)},e.prototype.setResolution=function(t){var e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this},e.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},e.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},e.prototype.onError=function(t){this.emit("error",this,t)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Ql[this.cacheId],delete Kl[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(t,i,r){void 0===r&&(r=ph.STRICT_TEXTURE_CACHE);var n="string"==typeof t,o=null;if(n)o=t;else{if(!t._pixiId){var s=i&&i.pixiIdPrefix||"pixiid";t._pixiId=s+"_"+Vl()}o=t._pixiId}var a=Ql[o];if(n&&r&&!a)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return a||((a=new e(t,i)).cacheId=o,e.addToCache(a,o)),a},e.fromBuffer=function(t,i,r,n){t=t||new Float32Array(i*r*4);var o=new bu(t,{width:i,height:r}),s=t instanceof Float32Array?Ws.FLOAT:Ws.UNSIGNED_BYTE;return new e(o,Object.assign(Pu,n||{width:i,height:r,type:s}))},e.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),Ql[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),Ql[e]=t)},e.removeFromCache=function(t){if("string"==typeof t){var e=Ql[t];if(e){var i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Ql[t],e}}else if(t&&t.textureCacheIds){for(var r=0;r<t.textureCacheIds.length;++r)delete Ql[t.textureCacheIds[r]];return t.textureCacheIds.length=0,t}return null},e._globalBatch=0,e}(vh),Eu=function(t){function e(e,i){var r=this,n=i||{},o=n.width,s=n.height;(r=t.call(this,o,s)||this).items=[],r.itemDirtyIds=[];for(var a=0;a<e;a++){var h=new wu;r.items.push(h),r.itemDirtyIds.push(-2)}return r.length=e,r._load=null,r.baseTexture=null,r}return mu(e,t),e.prototype.initFromArray=function(t,e){for(var i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof xu?this.addResourceAt(t[i],i):this.addResourceAt(yu(t[i],e),i))},e.prototype.dispose=function(){for(var t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},e.prototype.addResourceAt=function(t,e){if(!this.items[e])throw new Error("Index "+e+" is out of bounds");return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this},e.prototype.bind=function(e){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");t.prototype.bind.call(this,e);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=e,this.items[i].on("update",e.update,e)},e.prototype.unbind=function(e){t.prototype.unbind.call(this,e);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",e.update,e)},e.prototype.load=function(){var t=this;if(this._load)return this._load;var e=this.items.map((function(t){return t.resource})).filter((function(t){return t})).map((function(t){return t.load()}));return this._load=Promise.all(e).then((function(){var e=t.items[0],i=e.realWidth,r=e.realHeight;return t.resize(i,r),Promise.resolve(t)})),this._load},e}(xu),Tu=function(t){function e(e,i){var r,n,o=this,s=i||{},a=s.width,h=s.height;return Array.isArray(e)?(r=e,n=e.length):n=e,o=t.call(this,n,{width:a,height:h})||this,r&&o.initFromArray(r,i),o}return mu(e,t),e.prototype.addBaseTextureAt=function(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this},e.prototype.bind=function(e){t.prototype.bind.call(this,e),e.target=Gs.TEXTURE_2D_ARRAY},e.prototype.upload=function(t,e,i){var r=this,n=r.length,o=r.itemDirtyIds,s=r.items,a=t.gl;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,n,0,e.format,i.type,null);for(var h=0;h<n;h++){var l=s[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0},e}(Eu),Cu=function(t){function e(e){var i=this,r=e,n=r.naturalWidth||r.videoWidth||r.width,o=r.naturalHeight||r.videoHeight||r.height;return(i=t.call(this,n,o)||this).source=e,i.noSubImage=!1,i}return mu(e,t),e.crossOrigin=function(t,e,i){void 0===i&&0!==e.indexOf("data:")?t.crossOrigin=nu(e):!1!==i&&(t.crossOrigin="string"==typeof i?i:"anonymous")},e.prototype.upload=function(t,e,i,r){var n=t.gl,o=e.realWidth,s=e.realHeight;return r=r||this.source,n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Ks.UNPACK),this.noSubImage||e.target!==n.TEXTURE_2D||i.width!==o||i.height!==s?(i.width=o,i.height=s,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,r)):n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,r),!0},e.prototype.update=function(){if(!this.destroyed){var e=this.source,i=e.naturalWidth||e.videoWidth||e.width,r=e.naturalHeight||e.videoHeight||e.height;this.resize(i,r),t.prototype.update.call(this)}},e.prototype.dispose=function(){this.source=null},e}(xu),Iu=function(t){function e(e){return t.call(this,e)||this}return mu(e,t),e.test=function(t){var e=self.OffscreenCanvas;return!!(e&&t instanceof e)||self.HTMLCanvasElement&&t instanceof HTMLCanvasElement},e}(Cu),Su=function(t){function e(i,r){var n=this,o=r||{},s=o.width,a=o.height,h=o.autoLoad,l=o.linkBaseTexture;if(i&&i.length!==e.SIDES)throw new Error("Invalid length. Got "+i.length+", expected 6");n=t.call(this,6,{width:s,height:a})||this;for(var u=0;u<e.SIDES;u++)n.items[u].target=Gs.TEXTURE_CUBE_MAP_POSITIVE_X+u;return n.linkBaseTexture=!1!==l,i&&n.initFromArray(i,r),!1!==h&&n.load(),n}return mu(e,t),e.prototype.bind=function(e){t.prototype.bind.call(this,e),e.target=Gs.TEXTURE_CUBE_MAP},e.prototype.addBaseTextureAt=function(t,e,i){if(!this.items[e])throw new Error("Index "+e+" is out of bounds");if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=Gs.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this},e.prototype.upload=function(t,i,r){for(var n=this.itemDirtyIds,o=0;o<e.SIDES;o++){var s=this.items[o];n[o]<s.dirtyId&&(s.valid&&s.resource?(s.resource.upload(t,s,r),n[o]=s.dirtyId):n[o]<-1&&(t.gl.texImage2D(s.target,0,r.internalFormat,i.realWidth,i.realHeight,0,i.format,r.type,null),n[o]=-1))}return!0},e.test=function(t){return Array.isArray(t)&&t.length===e.SIDES},e.SIDES=6,e}(Eu),Ou=function(t){function e(e,i){var r=this;if(i=i||{},!(e instanceof HTMLImageElement)){var n=new Image;Cu.crossOrigin(n,e,i.crossorigin),n.src=e,e=n}return r=t.call(this,e)||this,!e.complete&&r._width&&r._height&&(r._width=0,r._height=0),r.url=e.src,r._process=null,r.preserveBitmap=!1,r.createBitmap=(void 0!==i.createBitmap?i.createBitmap:ph.CREATE_IMAGE_BITMAP)&&!!self.createImageBitmap,r.alphaMode="number"==typeof i.alphaMode?i.alphaMode:null,r.bitmap=null,r._load=null,!1!==i.autoLoad&&r.load(),r}return mu(e,t),e.prototype.load=function(t){var e=this;return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise((function(t,i){var r=e.source;e.url=r.src;var n=function(){e.destroyed||(r.onload=null,r.onerror=null,e.resize(r.width,r.height),e._load=null,e.createBitmap?t(e.process()):t(e))};r.complete&&r.src?n():(r.onload=n,r.onerror=function(t){i(t),e.onError.emit(t)})}))),this._load},e.prototype.process=function(){var t=this,e=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!self.createImageBitmap)return Promise.resolve(this);var i=self.createImageBitmap,r=!e.crossOrigin||"anonymous"===e.crossOrigin;return this._process=fetch(e.src,{mode:r?"cors":"no-cors"}).then((function(t){return t.blob()})).then((function(r){return i(r,0,0,e.width,e.height,{premultiplyAlpha:t.alphaMode===Ks.UNPACK?"premultiply":"none"})})).then((function(e){return t.destroyed?Promise.reject():(t.bitmap=e,t.update(),t._process=null,Promise.resolve(t))})),this._process},e.prototype.upload=function(e,i,r){if("number"==typeof this.alphaMode&&(i.alphaMode=this.alphaMode),!this.createBitmap)return t.prototype.upload.call(this,e,i,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(t.prototype.upload.call(this,e,i,r,this.bitmap),!this.preserveBitmap){var n=!0,o=i._glTextures;for(var s in o){var a=o[s];if(a!==r&&a.dirtyId!==i.dirtyId){n=!1;break}}n&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},e.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,t.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},e.test=function(t){return"string"==typeof t||t instanceof HTMLImageElement},e}(Cu),Au=function(t){function e(e,i){var r=this;return i=i||{},(r=t.call(this,document.createElement("canvas"))||this)._width=0,r._height=0,r.svg=e,r.scale=i.scale||1,r._overrideWidth=i.width,r._overrideHeight=i.height,r._resolve=null,r._crossorigin=i.crossorigin,r._load=null,!1!==i.autoLoad&&r.load(),r}return mu(e,t),e.prototype.load=function(){var t=this;return this._load||(this._load=new Promise((function(e){if(t._resolve=function(){t.resize(t.source.width,t.source.height),e(t)},/^\<svg/.test(t.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");t.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t.svg)))}t._loadSvg()}))),this._load},e.prototype._loadSvg=function(){var t=this,e=new Image;Cu.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=function(i){t._resolve&&(e.onerror=null,t.onError.emit(i))},e.onload=function(){if(t._resolve){var i=e.width,r=e.height;if(!i||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var n=i*t.scale,o=r*t.scale;(t._overrideWidth||t._overrideHeight)&&(n=t._overrideWidth||t._overrideHeight/r*i,o=t._overrideHeight||t._overrideWidth/i*r),n=Math.round(n),o=Math.round(o);var s=t.source;s.width=n,s.height=o,s._pixiId="canvas_"+Vl(),s.getContext("2d").drawImage(e,0,0,i,r,0,0,n,o),t._resolve(),t._resolve=null}}},e.getSize=function(t){var i=e.SVG_SIZE.exec(t),r={};return i&&(r[i[1]]=Math.round(parseFloat(i[3])),r[i[5]]=Math.round(parseFloat(i[7]))),r},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},e.test=function(t,i){return"svg"===i||"string"==typeof t&&/^data:image\/svg\+xml(;(charset=utf8|utf8))?;base64/.test(t)||"string"==typeof t&&e.SVG_XML.test(t)},e.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,e.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(Cu),Mu=function(t){function e(i,r){var n=this;if(r=r||{},!(i instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),"string"==typeof i&&(i=[i]);var s=i[0].src||i[0];Cu.crossOrigin(o,s,r.crossorigin);for(var a=0;a<i.length;++a){var h=document.createElement("source"),l=i[a],u=l.src,p=l.mime,c=(u=u||i[a]).split("?").shift().toLowerCase(),d=c.substr(c.lastIndexOf(".")+1);p=p||e.MIME_TYPES[d]||"video/"+d,h.src=u,h.type=p,o.appendChild(h)}i=o}return(n=t.call(this,i)||this).noSubImage=!0,n._autoUpdate=!0,n._isConnectedToTicker=!1,n._updateFPS=r.updateFPS||0,n._msToNextUpdate=0,n.autoPlay=!1!==r.autoPlay,n._load=null,n._resolve=null,n._onCanPlay=n._onCanPlay.bind(n),n._onError=n._onError.bind(n),!1!==r.autoLoad&&n.load(),n}return mu(e,t),e.prototype.update=function(e){if(!this.destroyed){var i=dh.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-i),(!this._updateFPS||this._msToNextUpdate<=0)&&(t.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},e.prototype.load=function(){var t=this;if(this._load)return this._load;var e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart.bind(this)),e.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((function(i){t.valid?i(t):(t._resolve=i,e.load())})),this._load},e.prototype._onError=function(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t)},e.prototype._isSourcePlaying=function(){var t=this.source;return t.currentTime>0&&!1===t.paused&&!1===t.ended&&t.readyState>2},e.prototype._isSourceReady=function(){var t=this.source;return 3===t.readyState||4===t.readyState},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(dh.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(dh.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(dh.shared.remove(this.update,this),this._isConnectedToTicker=!1);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(dh.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(dh.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,i){return self.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(i)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(Cu),Lu=function(t){function e(e){return t.call(this,e)||this}return mu(e,t),e.test=function(t){return!!self.createImageBitmap&&t instanceof ImageBitmap},e}(Cu);vu.push(Ou,Lu,Iu,Mu,Au,bu,Su,Tu);var Nu={__proto__:null,Resource:xu,BaseImageResource:Cu,INSTALLED:vu,autoDetectResource:yu,AbstractMultiResource:Eu,ArrayResource:Tu,BufferResource:bu,CanvasResource:Iu,CubeResource:Su,ImageResource:Ou,SVGResource:Au,VideoResource:Mu,ImageBitmapResource:Lu},Ru=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return mu(e,t),e.prototype.upload=function(t,e,i){var r=t.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Ks.UNPACK);var n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?r.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,r.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0},e}(bu),Du=function(){function t(t,e){this.width=Math.round(t||100),this.height=Math.round(e||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new fu("disposeFramebuffer"),this.multisample=ia.NONE}return Object.defineProperty(t.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),t.prototype.addColorTexture=function(t,e){return void 0===t&&(t=0),this.colorTextures[t]=e||new wu(null,{scaleMode:qs.NEAREST,resolution:1,mipmap:Js.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},t.prototype.addDepthTexture=function(t){return this.depthTexture=t||new wu(new Ru(null,{width:this.width,height:this.height}),{scaleMode:qs.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Js.OFF,format:Hs.DEPTH_COMPONENT,type:Ws.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},t.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},t.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},t.prototype.resize=function(t,e){if(t=Math.round(t),e=Math.round(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var r=this.colorTextures[i],n=r.resolution;r.setSize(t/n,e/n)}if(this.depthTexture){n=this.depthTexture.resolution;this.depthTexture.setSize(t/n,e/n)}}},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},t}(),ku=function(t){function e(e){var i=this;if("number"==typeof e){var r=arguments[0],n=arguments[1],o=arguments[2],s=arguments[3];e={width:r,height:n,scaleMode:o,resolution:s}}return e.width=e.width||100,e.height=e.height||100,e.multisample=void 0!==e.multisample?e.multisample:ia.NONE,(i=t.call(this,null,e)||this).mipmap=Js.OFF,i.valid=!0,i.clearColor=[0,0,0,0],i.framebuffer=new Du(i.realWidth,i.realHeight).addColorTexture(0,i),i.framebuffer.multisample=e.multisample,i.maskStack=[],i.filterStack=[{}],i}return mu(e,t),e.prototype.resize=function(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},e.prototype.dispose=function(){this.framebuffer.dispose(),t.prototype.dispose.call(this)},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},e}(wu),Fu=function(){function t(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}return t.prototype.set=function(t,e,i){var r=e.width,n=e.height;if(i){var o=t.width/2/r,s=t.height/2/n,a=t.x/r+o,h=t.y/n+s;i=Ca.add(i,Ca.NW),this.x0=a+o*Ca.uX(i),this.y0=h+s*Ca.uY(i),i=Ca.add(i,2),this.x1=a+o*Ca.uX(i),this.y1=h+s*Ca.uY(i),i=Ca.add(i,2),this.x2=a+o*Ca.uX(i),this.y2=h+s*Ca.uY(i),i=Ca.add(i,2),this.x3=a+o*Ca.uX(i),this.y3=h+s*Ca.uY(i)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3},t.prototype.toString=function(){return"[@pixi/core:TextureUvs x0="+this.x0+" y0="+this.y0+" x1="+this.x1+" y1="+this.y1+" x2="+this.x2+" y2="+this.y2+" x3="+this.x3+" y3="+this.y3+"]"},t}(),Bu=new Fu,Uu=function(t){function e(i,r,n,o,s,a){var h=t.call(this)||this;if(h.noFrame=!1,r||(h.noFrame=!0,r=new pa(0,0,1,1)),i instanceof e&&(i=i.baseTexture),h.baseTexture=i,h._frame=r,h.trim=o,h.valid=!1,h._uvs=Bu,h.uvMatrix=null,h.orig=n||r,h._rotate=Number(s||0),!0===s)h._rotate=2;else if(h._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return h.defaultAnchor=a?new ya(a.x,a.y):new ya(0,0),h._updateID=0,h.textureCacheIds=[],i.valid?h.noFrame?i.valid&&h.onBaseTextureUpdated(i):h.frame=r:i.once("loaded",h.onBaseTextureUpdated,h),h.noFrame&&i.on("update",h.onBaseTextureUpdated,h),h}return mu(e,t),e.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},e.prototype.onBaseTextureUpdated=function(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},e.prototype.destroy=function(t){if(this.baseTexture){if(t){var i=this.baseTexture.resource;i&&i.url&&Kl[i.url]&&e.removeFromCache(i.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,e.removeFromCache(this),this.textureCacheIds=null},e.prototype.clone=function(){var t=this._frame.clone(),i=this._frame===this.orig?t:this.orig.clone(),r=new e(this.baseTexture,!this.noFrame&&t,i,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(r._frame=t),r},e.prototype.updateUvs=function(){this._uvs===Bu&&(this._uvs=new Fu),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},e.from=function(t,i,r){void 0===i&&(i={}),void 0===r&&(r=ph.STRICT_TEXTURE_CACHE);var n="string"==typeof t,o=null;if(n)o=t;else{if(!t._pixiId){var s=i&&i.pixiIdPrefix||"pixiid";t._pixiId=s+"_"+Vl()}o=t._pixiId}var a=Kl[o];if(n&&r&&!a)throw new Error('The cacheId "'+o+'" does not exist in TextureCache.');return a||(i.resolution||(i.resolution=ou(t)),(a=new e(new wu(t,i))).baseTexture.cacheId=o,wu.addToCache(a.baseTexture,o),e.addToCache(a,o)),a},e.fromURL=function(t,i){var r=Object.assign({autoLoad:!1},null==i?void 0:i.resourceOptions),n=e.from(t,Object.assign({resourceOptions:r},i),!1),o=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):o.load().then((function(){return Promise.resolve(n)}))},e.fromBuffer=function(t,i,r,n){return new e(wu.fromBuffer(t,i,r,n))},e.fromLoader=function(t,i,r,n){var o=new wu(t,Object.assign({scaleMode:ph.SCALE_MODE,resolution:ou(i)},n)),s=o.resource;s instanceof Ou&&(s.url=i);var a=new e(o);return r||(r=i),wu.addToCache(a.baseTexture,r),e.addToCache(a,r),r!==i&&(wu.addToCache(a.baseTexture,i),e.addToCache(a,i)),a.baseTexture.valid?Promise.resolve(a):new Promise((function(t){a.baseTexture.once("loaded",(function(){return t(a)}))}))},e.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),Kl[e]&&console.warn("Texture added to the cache with an id ["+e+"] that already had an entry"),Kl[e]=t)},e.removeFromCache=function(t){if("string"==typeof t){var e=Kl[t];if(e){var i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Kl[t],e}}else if(t&&t.textureCacheIds){for(var r=0;r<t.textureCacheIds.length;++r)Kl[t.textureCacheIds[r]]===t&&delete Kl[t.textureCacheIds[r]];return t.textureCacheIds.length=0,t}return null},Object.defineProperty(e.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},set:function(t){this._frame=t,this.noFrame=!1;var e=t.x,i=t.y,r=t.width,n=t.height,o=e+r>this.baseTexture.width,s=i+n>this.baseTexture.height;if(o||s){var a=o&&s?"and":"or",h="X: "+e+" + "+r+" = "+(e+r)+" > "+this.baseTexture.width,l="Y: "+i+" + "+n+" = "+(i+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+a+" "+l)}this.valid=r&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},e}(vh);function zu(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}Uu.EMPTY=new Uu(new wu),zu(Uu.EMPTY),zu(Uu.EMPTY.baseTexture),Uu.WHITE=function(){var t=document.createElement("canvas");t.width=16,t.height=16;var e=t.getContext("2d");return e.fillStyle="white",e.fillRect(0,0,16,16),new Uu(new wu(new Iu(t)))}(),zu(Uu.WHITE),zu(Uu.WHITE.baseTexture);var Xu=function(t){function e(e,i){var r=t.call(this,e,i)||this;return r.valid=!0,r.filterFrame=null,r.filterPoolKey=null,r.updateUvs(),r}return mu(e,t),Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e,i){void 0===i&&(i=!0);var r=this.baseTexture.resolution,n=Math.round(t*r)/r,o=Math.round(e*r)/r;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()},e.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},e.create=function(t){for(var i=arguments,r=[],n=1;n<arguments.length;n++)r[n-1]=i[n];return"number"==typeof t&&(Zl("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),t={width:t,height:r[0],scaleMode:r[1],resolution:r[2]}),new e(new ku(t))},e}(Uu),ju=function(){function t(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return t.prototype.createTexture=function(t,e,i){void 0===i&&(i=ia.NONE);var r=new ku(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Xu(r)},t.prototype.getOptimalTexture=function(t,e,i,r){var n;void 0===i&&(i=1),void 0===r&&(r=ia.NONE),t=Math.ceil(t*i),e=Math.ceil(e*i),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?n=r>1?-r:-1:(n=((65535&(t=Xl(t)))<<16|65535&(e=Xl(e)))>>>0,r>1&&(n+=4294967296*r)),this.texturePool[n]||(this.texturePool[n]=[]);var o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,r)),o.filterPoolKey=n,o.setResolution(i),o},t.prototype.getFilterTexture=function(t,e,i){var r=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||ia.NONE);return r.filterFrame=t.filterFrame,r},t.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},t.prototype.returnFilterTexture=function(t){this.returnTexture(t)},t.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var i=this.texturePool[e];if(i)for(var r=0;r<i.length;r++)i[r].destroy(!0)}this.texturePool={}},t.prototype.setScreenSize=function(t){if(t.width!==this._pixelsWidth||t.height!==this._pixelsHeight){for(var e in this.enableFullScreen=t.width>0&&t.height>0,this.texturePool)if(Number(e)<0){var i=this.texturePool[e];if(i)for(var r=0;r<i.length;r++)i[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}},t.SCREEN_KEY=-1,t}(),Yu=function(){function t(t,e,i,r,n,o,s){void 0===e&&(e=0),void 0===i&&(i=!1),void 0===r&&(r=Ws.FLOAT),this.buffer=t,this.size=e,this.normalized=i,this.type=r,this.stride=n,this.start=o,this.instance=s}return t.prototype.destroy=function(){this.buffer=null},t.from=function(e,i,r,n,o){return new t(e,i,r,n,o)},t}(),Hu=0,Gu=function(){function t(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1),this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=Hu++,this.disposeRunner=new fu("disposeBuffer")}return t.prototype.update=function(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(t.prototype,"index",{get:function(){return this.type===ra.ELEMENT_ARRAY_BUFFER},set:function(t){this.type=t?ra.ELEMENT_ARRAY_BUFFER:ra.ARRAY_BUFFER},enumerable:!1,configurable:!0}),t.from=function(e){return e instanceof Array&&(e=new Float32Array(e)),new t(e)},t}(),Wu={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};var Vu={5126:4,5123:2,5121:1},qu=0,Zu={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},Ju=function(){function t(t,e){void 0===t&&(t=[]),void 0===e&&(e={}),this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=qu++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new fu("disposeGeometry"),this.refCount=0}return t.prototype.addAttribute=function(t,e,i,r,n,o,s,a){if(void 0===i&&(i=0),void 0===r&&(r=!1),void 0===a&&(a=!1),!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Gu||(e instanceof Array&&(e=new Float32Array(e)),e=new Gu(e));var h=t.split("|");if(h.length>1){for(var l=0;l<h.length;l++)this.addAttribute(h[l],e,i,r,n);return this}var u=this.buffers.indexOf(e);return-1===u&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new Yu(u,i,r,n,o,s,a),this.instanced=this.instanced||a,this},t.prototype.getAttribute=function(t){return this.attributes[t]},t.prototype.getBuffer=function(t){return this.buffers[this.getAttribute(t).buffer]},t.prototype.addIndex=function(t){return t instanceof Gu||(t instanceof Array&&(t=new Uint16Array(t)),t=new Gu(t)),t.type=ra.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,-1===this.buffers.indexOf(t)&&this.buffers.push(t),this},t.prototype.getIndex=function(){return this.indexBuffer},t.prototype.interleave=function(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;var t,e=[],i=[],r=new Gu;for(t in this.attributes){var n=this.attributes[t],o=this.buffers[n.buffer];e.push(o.data),i.push(n.size*Vu[n.type]/4),n.buffer=0}for(r.data=function(t,e){for(var i=0,r=0,n={},o=0;o<t.length;o++)r+=e[o],i+=t[o].length;var s=new ArrayBuffer(4*i),a=null,h=0;for(o=0;o<t.length;o++){var l=e[o],u=t[o],p=Ul(u);n[p]||(n[p]=new Wu[p](s)),a=n[p];for(var c=0;c<u.length;c++)a[(c/l|0)*r+h+c%l]=u[c];h+=l}return new Float32Array(s)}(e,i),t=0;t<this.buffers.length;t++)this.buffers[t]!==this.indexBuffer&&this.buffers[t].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},t.prototype.getSize=function(){for(var t in this.attributes){var e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},t.prototype.clone=function(){for(var e=new t,i=0;i<this.buffers.length;i++)e.buffers[i]=new Gu(this.buffers[i].data.slice(0));for(var i in this.attributes){var r=this.attributes[i];e.attributes[i]=new Yu(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=ra.ELEMENT_ARRAY_BUFFER),e},t.merge=function(e){for(var i,r=new t,n=[],o=[],s=[],a=0;a<e.length;a++){i=e[a];for(var h=0;h<i.buffers.length;h++)o[h]=o[h]||0,o[h]+=i.buffers[h].data.length,s[h]=0}for(a=0;a<i.buffers.length;a++)n[a]=new(Zu[Ul(i.buffers[a].data)])(o[a]),r.buffers[a]=new Gu(n[a]);for(a=0;a<e.length;a++){i=e[a];for(h=0;h<i.buffers.length;h++)n[h].set(i.buffers[h].data,s[h]),s[h]+=i.buffers[h].data.length}if(r.attributes=i.attributes,i.indexBuffer){r.indexBuffer=r.buffers[i.buffers.indexOf(i.indexBuffer)],r.indexBuffer.type=ra.ELEMENT_ARRAY_BUFFER;var l=0,u=0,p=0,c=0;for(a=0;a<i.buffers.length;a++)if(i.buffers[a]!==i.indexBuffer){c=a;break}for(var a in i.attributes){var d=i.attributes[a];(0|d.buffer)===c&&(u+=d.size*Vu[d.type]/4)}for(a=0;a<e.length;a++){var f=e[a].indexBuffer.data;for(h=0;h<f.length;h++)r.indexBuffer.data[h+p]+=l;l+=e[a].buffers[c].data.length/u,p+=f.length}}return r},t}(),Ku=function(t){function e(){var e=t.call(this)||this;return e.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),e}return mu(e,t),e}(Ju),Qu=function(t){function e(){var e=t.call(this)||this;return e.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),e.uvs=new Float32Array([0,0,1,0,1,1,0,1]),e.vertexBuffer=new Gu(e.vertices),e.uvBuffer=new Gu(e.uvs),e.addAttribute("aVertexPosition",e.vertexBuffer).addAttribute("aTextureCoord",e.uvBuffer).addIndex([0,1,2,0,2,3]),e}return mu(e,t),e.prototype.map=function(t,e){var i=0,r=0;return this.uvs[0]=i,this.uvs[1]=r,this.uvs[2]=i+e.width/t.width,this.uvs[3]=r,this.uvs[4]=i+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=i,this.uvs[7]=r+e.height/t.height,i=e.x,r=e.y,this.vertices[0]=i,this.vertices[1]=r,this.vertices[2]=i+e.width,this.vertices[3]=r,this.vertices[4]=i+e.width,this.vertices[5]=r+e.height,this.vertices[6]=i,this.vertices[7]=r+e.height,this.invalidate(),this},e.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},e}(Ju),$u=0,tp=function(){function t(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=$u++,this.static=!!e,this.ubo=!!i,t instanceof Gu?(this.buffer=t,this.buffer.type=ra.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Gu(new Float32Array(1)),this.buffer.type=ra.UNIFORM_BUFFER,this.autoManage=!0))}return t.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},t.prototype.add=function(e,i,r){if(this.ubo)throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[e]=new t(i,r)},t.from=function(e,i,r){return new t(e,i,r)},t.uboFrom=function(e,i){return new t(e,null==i||i,!0)},t}(),ep=function(){function t(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ia.NONE,this.sourceFrame=new pa,this.destinationFrame=new pa,this.bindingSourceFrame=new pa,this.bindingDestinationFrame=new pa,this.filters=[],this.transform=null}return t.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},t}(),ip=[new ya,new ya,new ya,new ya],rp=new ma,np=function(){function t(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new ju,this.texturePool.setScreenSize(t.view),this.statePool=[],this.quad=new Ku,this.quadUv=new Qu,this.tempRect=new pa,this.activeState={},this.globalUniforms=new tp({outputFrame:new pa,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}return t.prototype.push=function(t,e){for(var i=this.renderer,r=this.defaultFilterStack,n=this.statePool.pop()||new ep,o=this.renderer.renderTexture,s=e[0].resolution,a=e[0].multisample,h=e[0].padding,l=e[0].autoFit,u=e[0].legacy,p=1;p<e.length;p++){var c=e[p];s=Math.min(s,c.resolution),a=Math.min(a,c.multisample),h=this.useMaxPadding?Math.max(h,c.padding):h+c.padding,l=l&&c.autoFit,u=u||c.legacy}if(1===r.length&&(this.defaultFilterStack[0].renderTexture=o.current),r.push(n),n.resolution=s,n.multisample=a,n.legacy=u,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(h),l){var d=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(rp.copyFrom(i.projection.transform).invert(),d),n.sourceFrame.fit(d)}this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,s,a),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;var f=this.tempRect;f.x=0,f.y=0,f.width=n.sourceFrame.width,f.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,f),i.framebuffer.clear(0,0,0,0)},t.prototype.pop=function(){var t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;var r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;var n=r.inputSize,o=r.inputPixel,s=r.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],s[0]=.5*o[2],s[1]=.5*o[3],s[2]=e.sourceFrame.width*n[2]-.5*o[2],s[3]=e.sourceFrame.height*n[3]-.5*o[3],e.legacy){var a=r.filterArea;a[0]=e.destinationFrame.width,a[1]=e.destinationFrame.height,a[2]=e.sourceFrame.x,a[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();var h=t[t.length-1];if(this.renderer.framebuffer.blit(),1===i.length)i[0].apply(this,e.renderTexture,h.renderTexture,Qs.BLEND,e),this.returnFilterTexture(e.renderTexture);else{var l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;var p=0;for(p=0;p<i.length-1;++p){1===p&&e.multisample>1&&((u=this.getOptimalFilterTexture(l.width,l.height,e.resolution)).filterFrame=l.filterFrame),i[p].apply(this,l,u,Qs.CLEAR,e);var c=l;l=u,u=c}i[p].apply(this,l,h.renderTexture,Qs.BLEND,e),p>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)},t.prototype.bindAndClear=function(t,e){void 0===e&&(e=Qs.CLEAR);var i=this.renderer,r=i.renderTexture,n=i.state;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t&&t.filterFrame){var o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,r.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var s=1&n.stateId||this.forceClear;(e===Qs.CLEAR||e===Qs.BLIT&&s)&&this.renderer.framebuffer.clear(0,0,0,0)},t.prototype.applyFilter=function(t,e,i,r){var n=this.renderer;n.state.set(t.state),this.bindAndClear(i,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Ys.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Ys.TRIANGLE_STRIP))},t.prototype.calculateSpriteMatrix=function(t,e){var i=this.activeState,r=i.sourceFrame,n=i.destinationFrame,o=e._texture.orig,s=t.set(n.width,0,0,n.height,r.x,r.y),a=e.worldTransform.copyTo(ma.TEMP_MATRIX);return a.invert(),s.prepend(a),s.scale(1/o.width,1/o.height),s.translate(e.anchor.x,e.anchor.y),s},t.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},t.prototype.getOptimalFilterTexture=function(t,e,i,r){return void 0===i&&(i=1),void 0===r&&(r=ia.NONE),this.texturePool.getOptimalTexture(t,e,i,r)},t.prototype.getFilterTexture=function(t,e,i){if("number"==typeof t){var r=t;t=e,e=r}t=t||this.activeState.renderTexture;var n=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||ia.NONE);return n.filterFrame=t.filterFrame,n},t.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},t.prototype.emptyPool=function(){this.texturePool.clear(!0)},t.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},t.prototype.transformAABB=function(t,e){var i=ip[0],r=ip[1],n=ip[2],o=ip[3];i.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(r,r),t.apply(n,n),t.apply(o,o);var s=Math.min(i.x,r.x,n.x,o.x),a=Math.min(i.y,r.y,n.y,o.y),h=Math.max(i.x,r.x,n.x,o.x),l=Math.max(i.y,r.y,n.y,o.y);e.x=s,e.y=a,e.width=h-s,e.height=l-a},t.prototype.roundFrame=function(t,e,i,r,n){if(n){var o=n.a,s=n.b,a=n.c,h=n.d;if((Math.abs(s)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(h)>1e-4))return}(n=n?rp.copyFrom(n):rp.identity()).translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)},t}(),op=function(){function t(t){this.renderer=t}return t.prototype.flush=function(){},t.prototype.destroy=function(){this.renderer=null},t.prototype.start=function(){},t.prototype.stop=function(){this.flush()},t.prototype.render=function(t){},t}(),sp=function(){function t(t){this.renderer=t,this.emptyRenderer=new op(t),this.currentRenderer=this.emptyRenderer}return t.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},t.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.copyBoundTextures=function(t,e){for(var i=this.renderer.texture.boundTextures,r=e-1;r>=0;--r)t[r]=i[r]||null,t[r]&&(t[r]._batchLocation=r)},t.prototype.boundArray=function(t,e,i,r){for(var n=t.elements,o=t.ids,s=t.count,a=0,h=0;h<s;h++){var l=n[h],u=l._batchLocation;if(u>=0&&u<r&&e[u]===l)o[h]=u;else for(;a<r;){var p=e[a];if(!p||p._batchEnabled!==i||p._batchLocation!==a){o[h]=a,l._batchLocation=a,e[a]=l;break}a++}}},t.prototype.destroy=function(){this.renderer=null},t}(),ap=0,hp=function(){function t(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),t.view.addEventListener("webglcontextlost",this.handleContextLost,!1),t.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}return Object.defineProperty(t.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),t.prototype.contextChange=function(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=ap++,t.isContextLost()&&t.getExtension("WEBGL_lose_context")&&t.getExtension("WEBGL_lose_context").restoreContext()},t.prototype.initFromContext=function(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=ap++,this.renderer.runners.contextChange.emit(t)},t.prototype.initFromOptions=function(t){var e=this.createContext(this.renderer.view,t);this.initFromContext(e)},t.prototype.createContext=function(t,e){var i;if(ph.PREFER_ENV>=Us.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},t.prototype.getExtensions=function(){var t=this.gl,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},t.prototype.handleContextLost=function(t){t.preventDefault()},t.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},t.prototype.destroy=function(){var t=this.renderer.view;this.renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},t.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},t.prototype.validateContext=function(t){var e=t.getContextAttributes(),i="WebGL2RenderingContext"in self&&t instanceof self.WebGL2RenderingContext;i&&(this.webGLVersion=2),e.stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var r=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},t}(),lp=function(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ia.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},up=new pa,pp=function(){function t(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Du(10,10),this.msaaSamples=null}return t.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new pa,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;ph.PREFER_ENV===Us.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=function(t){return e.drawBuffersWEBGL(t)}:(this.hasMRT=!1,t.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)},t.prototype.bind=function(t,e,i){void 0===i&&(i=0);var r=this.gl;if(t){var n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var o=0;o<t.colorTextures.length;o++){var s=t.colorTextures[o];this.renderer.texture.unbind(s.parentTextureArray||s)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){var a=e.width>>i,h=e.height>>i,l=a/e.width;this.setViewport(e.x*l,e.y*l,a,h)}else{a=t.width>>i,h=t.height>>i;this.setViewport(0,0,a,h)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},t.prototype.setViewport=function(t,e,i,r){var n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),n.width===i&&n.height===r&&n.x===t&&n.y===e||(n.x=t,n.y=e,n.width=i,n.height=r,this.gl.viewport(t,e,i,r))},Object.defineProperty(t.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),t.prototype.clear=function(t,e,i,r,n){void 0===n&&(n=Xs.COLOR|Xs.DEPTH);var o=this.gl;o.clearColor(t,e,i,r),o.clear(n)},t.prototype.initFramebuffer=function(t){var e=this.gl,i=new lp(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i},t.prototype.resizeFramebuffer=function(t){var e=this.gl,i=t.glFramebuffers[this.CONTEXT_UID];i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,e.RGBA8,t.width,t.height)),i.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,i.stencil),i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var r=t.colorTextures,n=r.length;e.drawBuffers||(n=Math.min(n,1));for(var o=0;o<n;o++){var s=r[o],a=s.parentTextureArray||s;this.renderer.texture.bind(a,0)}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)},t.prototype.updateFramebuffer=function(t,e){var i=this.gl,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures,o=n.length;i.drawBuffers||(o=Math.min(o,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?(r.msaaBuffer=r.msaaBuffer||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,r.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,i.RGBA8,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r.msaaBuffer)):r.msaaBuffer&&(i.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));for(var s=[],a=0;a<o;a++){var h=n[a],l=h.parentTextureArray||h;this.renderer.texture.bind(l,0),0===a&&r.msaaBuffer||(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,h.target,l._glTextures[this.CONTEXT_UID].texture,e),s.push(i.COLOR_ATTACHMENT0+a))}if((s.length>1&&i.drawBuffers(s),t.depthTexture)&&this.writeDepthTexture){var u=t.depthTexture;this.renderer.texture.bind(u,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,u._glTextures[this.CONTEXT_UID].texture,e)}!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture?r.stencil&&(i.deleteRenderbuffer(r.stencil),r.stencil=null):(r.stencil=r.stencil||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,r.stencil),r.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,i.DEPTH24_STENCIL8,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,r.stencil))},t.prototype.canMultisampleFramebuffer=function(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture},t.prototype.detectSamples=function(t){var e=this.msaaSamples,i=ia.NONE;if(t<=1||null===e)return i;for(var r=0;r<e.length;r++)if(e[r]<=t){i=e[r];break}return 1===i&&(i=ia.NONE),i},t.prototype.blit=function(t,e,i){var r=this,n=r.current,o=r.renderer,s=r.gl,a=r.CONTEXT_UID;if(2===o.context.webGLVersion&&n){var h=n.glFramebuffers[a];if(h){if(!t){if(!h.msaaBuffer)return;var l=n.colorTextures[0];if(!l)return;h.blitFramebuffer||(h.blitFramebuffer=new Du(n.width,n.height),h.blitFramebuffer.addColorTexture(0,l)),(t=h.blitFramebuffer).colorTextures[0]!==l&&(t.colorTextures[0]=l,t.dirtyId++,t.dirtyFormat++),t.width===n.width&&t.height===n.height||(t.width=n.width,t.height=n.height,t.dirtyId++,t.dirtySize++)}e||((e=up).width=n.width,e.height=n.height),i||(i=e);var u=e.width===i.width&&e.height===i.height;this.bind(t),s.bindFramebuffer(s.READ_FRAMEBUFFER,h.framebuffer),s.blitFramebuffer(e.x,e.y,e.width,e.height,i.x,i.y,i.width,i.height,s.COLOR_BUFFER_BIT,u?s.NEAREST:s.LINEAR)}}},t.prototype.disposeFramebuffer=function(t,e){var i=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(i){delete t.glFramebuffers[this.CONTEXT_UID];var n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&r.deleteRenderbuffer(i.msaaBuffer),i.stencil&&r.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&i.blitFramebuffer.dispose()}},t.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)},t.prototype.forceStencil=function(){var t=this.current;if(t){var e=t.glFramebuffers[this.CONTEXT_UID];if(e&&!e.stencil){t.stencil=!0;var i=t.width,r=t.height,n=this.gl,o=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,n.DEPTH24_STENCIL8,i,r):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,i,r),e.stencil=o,n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,o)}}},t.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new pa},t.prototype.destroy=function(){this.renderer=null},t}(),cp={5126:4,5123:2,5121:1},dp=function(){function t(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return t.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==e.webGLVersion){var i=this.renderer.context.extensions.vertexArrayObject;ph.PREFER_ENV===Us.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=function(){return i.createVertexArrayOES()},t.bindVertexArray=function(t){return i.bindVertexArrayOES(t)},t.deleteVertexArray=function(t){return i.deleteVertexArrayOES(t)}):(this.hasVao=!1,t.createVertexArray=function(){return null},t.bindVertexArray=function(){return null},t.deleteVertexArray=function(){return null})}if(2!==e.webGLVersion){var r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=function(t,e){return r.vertexAttribDivisorANGLE(t,e)},t.drawElementsInstanced=function(t,e,i,n,o){return r.drawElementsInstancedANGLE(t,e,i,n,o)},t.drawArraysInstanced=function(t,e,i,n){return r.drawArraysInstancedANGLE(t,e,i,n)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex},t.prototype.bind=function(t,e){e=e||this.renderer.shader.shader;var i=this.gl,r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);var o=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(t,e.program)),this.updateBuffers()},t.prototype.reset=function(){this.unbind()},t.prototype.updateBuffers=function(){for(var t=this._activeGeometry,e=this.renderer.buffer,i=0;i<t.buffers.length;i++){var r=t.buffers[i];e.update(r)}},t.prototype.checkCompatibility=function(t,e){var i=t.attributes,r=e.attributeData;for(var n in r)if(!i[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},t.prototype.getSignature=function(t,e){var i=t.attributes,r=e.attributeData,n=["g",t.id];for(var o in i)r[o]&&n.push(o);return n.join("-")},t.prototype.initGeometryVao=function(t,e,i){void 0===i&&(i=!0);var r=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,s=e.program;s.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,s);var a=this.getSignature(t,s),h=t.glVertexArrayObjects[this.CONTEXT_UID],l=h[a];if(l)return h[s.id]=l,l;var u=t.buffers,p=t.attributes,c={},d={};for(var f in u)c[f]=0,d[f]=0;for(var f in p)!p[f].size&&s.attributeData[f]?p[f].size=s.attributeData[f].size:p[f].size||console.warn("PIXI Geometry attribute '"+f+"' size cannot be determined (likely the bound shader does not have the attribute)"),c[p[f].buffer]+=p[f].size*cp[p[f].type];for(var f in p){var v=p[f],y=v.size;void 0===v.stride&&(c[v.buffer]===y*cp[v.type]?v.stride=0:v.stride=c[v.buffer]),void 0===v.start&&(v.start=d[v.buffer],d[v.buffer]+=y*cp[v.type])}l=r.createVertexArray(),r.bindVertexArray(l);for(var g=0;g<u.length;g++){var m=u[g];o.bind(m),i&&m._glBuffers[n].refCount++}return this.activateVao(t,s),this._activeVao=l,h[s.id]=l,h[a]=l,l},t.prototype.disposeGeometry=function(t,e){var i;if(this.managedGeometries[t.id]){delete this.managedGeometries[t.id];var r=t.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,o=t.buffers,s=null===(i=this.renderer)||void 0===i?void 0:i.buffer;if(t.disposeRunner.remove(this),r){if(s)for(var a=0;a<o.length;a++){var h=o[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,0!==h.refCount||e||s.dispose(o[a],e))}if(!e)for(var l in r)if("g"===l[0]){var u=r[l];this._activeVao===u&&this.unbind(),n.deleteVertexArray(u)}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}},t.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedGeometries),i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)},t.prototype.activateVao=function(t,e){var i=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,o=t.buffers,s=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);var a=null;for(var h in s){var l=s[h],u=o[l.buffer],p=u._glBuffers[r];if(e.attributeData[h]){a!==p&&(n.bind(u),a=p);var c=e.attributeData[h].location;if(i.enableVertexAttribArray(c),i.vertexAttribPointer(c,l.size,l.type||i.FLOAT,l.normalized,l.stride,l.start),l.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");i.vertexAttribDivisor(c,1)}}}},t.prototype.draw=function(t,e,i,r){var n=this.gl,o=this._activeGeometry;if(o.indexBuffer){var s=o.indexBuffer.data.BYTES_PER_ELEMENT,a=2===s?n.UNSIGNED_SHORT:n.UNSIGNED_INT;2===s||4===s&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,a,(i||0)*s,r||1):n.drawElements(t,e||o.indexBuffer.data.length,a,(i||0)*s):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),r||1):n.drawArrays(t,i,e||o.getSize());return this},t.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},t.prototype.destroy=function(){this.renderer=null},t}(),fp=function(){function t(t){void 0===t&&(t=null),this.type=ea.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ph.FILTER_MULTISAMPLE,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._target=null}return t.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=ea.NONE,this.autoDetect=!0),this._target=null},t.prototype.copyCountersOrReset=function(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},t}();function vp(t,e,i){var r=t.createShader(e);return t.shaderSource(r,i),t.compileShader(r),r}function yp(t,e){var i=t.getShaderSource(e).split("\n").map((function(t,e){return e+": "+t})),r=t.getShaderInfoLog(e),n=r.split("\n"),o={},s=n.map((function(t){return parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))})).filter((function(t){return!(!t||o[t])&&(o[t]=!0,!0)})),a=[""];s.forEach((function(t){i[t-1]="%c"+i[t-1]+"%c",a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));var h=i.join("\n");a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,a),console.groupEnd()}function gp(t){for(var e=new Array(t),i=0;i<e.length;i++)e[i]=!1;return e}function mp(t,e){switch(t){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return gp(2*e);case"bvec3":return gp(3*e);case"bvec4":return gp(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var _p,xp={},bp=xp;function Pp(){if(bp===xp||bp&&bp.isContextLost()){var t=document.createElement("canvas"),e=void 0;ph.PREFER_ENV>=Us.WEBGL2&&(e=t.getContext("webgl2",{})),e||((e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),bp=e}return bp}function wp(t,e,i){if("precision"!==t.substring(0,9)){var r=e;return e===ta.HIGH&&i!==ta.HIGH&&(r=ta.MEDIUM),"precision "+r+" float;\n"+t}return i!==ta.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}var Ep={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Tp(t){return Ep[t]}var Cp=null,Ip={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Sp(t,e){if(!Cp){var i=Object.keys(Ip);Cp={};for(var r=0;r<i.length;++r){var n=i[r];Cp[t[n]]=Ip[n]}}return Cp[e]}var Op=[{test:function(t){return"float"===t.type&&1===t.size},code:function(t){return'\n if(uv["'+t+'"] !== ud["'+t+'"].value)\n {\n ud["'+t+'"].value = uv["'+t+'"]\n gl.uniform1f(ud["'+t+'"].location, uv["'+t+'"])\n }\n '}},{test:function(t){return("sampler2D"===t.type||"samplerCube"===t.type||"sampler2DArray"===t.type)&&1===t.size&&!t.isArray},code:function(t){return't = syncData.textureCount++;\n\n renderer.texture.bind(uv["'+t+'"], t);\n\n if(ud["'+t+'"].value !== t)\n {\n ud["'+t+'"].value = t;\n gl.uniform1i(ud["'+t+'"].location, t);\n; // eslint-disable-line max-len\n }'}},{test:function(t,e){return"mat3"===t.type&&1===t.size&&void 0!==e.a},code:function(t){return'\n gl.uniformMatrix3fv(ud["'+t+'"].location, false, uv["'+t+'"].toArray(true));\n '},codeUbo:function(t){return"\n var "+t+"_matrix = uv."+t+".toArray(true);\n\n data[offset] = "+t+"_matrix[0];\n data[offset+1] = "+t+"_matrix[1];\n data[offset+2] = "+t+"_matrix[2];\n \n data[offset + 4] = "+t+"_matrix[3];\n data[offset + 5] = "+t+"_matrix[4];\n data[offset + 6] = "+t+"_matrix[5];\n \n data[offset + 8] = "+t+"_matrix[6];\n data[offset + 9] = "+t+"_matrix[7];\n data[offset + 10] = "+t+"_matrix[8];\n "}},{test:function(t,e){return"vec2"===t.type&&1===t.size&&void 0!==e.x},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["'+t+'"].location, v.x, v.y);\n }'},codeUbo:function(t){return"\n v = uv."+t+";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n "}},{test:function(t){return"vec2"===t.type&&1===t.size},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["'+t+'"].location, v[0], v[1]);\n }\n '}},{test:function(t,e){return"vec4"===t.type&&1===t.size&&void 0!==e.width},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["'+t+'"].location, v.x, v.y, v.width, v.height)\n }'},codeUbo:function(t){return"\n v = uv."+t+";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n "}},{test:function(t){return"vec4"===t.type&&1===t.size},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["'+t+'"].location, v[0], v[1], v[2], v[3])\n }'}}],Ap={float:"\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }",vec2:"\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"gl.uniform4f(location, v[0], v[1], v[2], v[3])",int:"gl.uniform1i(location, v)",ivec2:"gl.uniform2i(location, v[0], v[1])",ivec3:"gl.uniform3i(location, v[0], v[1], v[2])",ivec4:"gl.uniform4i(location, v[0], v[1], v[2], v[3])",uint:"gl.uniform1ui(location, v)",uvec2:"gl.uniform2ui(location, v[0], v[1])",uvec3:"gl.uniform3ui(location, v[0], v[1], v[2])",uvec4:"gl.uniform4ui(location, v[0], v[1], v[2], v[3])",bool:"\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1i(location, v)\n }",bvec2:"gl.uniform2i(location, v[0], v[1])",bvec3:"gl.uniform3i(location, v[0], v[1], v[2])",bvec4:"gl.uniform4i(location, v[0], v[1], v[2], v[3])",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"gl.uniform1i(location, v)",samplerCube:"gl.uniform1i(location, v)",sampler2DArray:"gl.uniform1i(location, v)"},Mp={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};var Lp,Np=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Rp(t){for(var e="",i=0;i<t;++i)i>0&&(e+="\nelse "),i<t-1&&(e+="if(test == "+i+".0){}");return e}function Dp(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var i=e.createShader(e.FRAGMENT_SHADER);;){var r=Np.replace(/%forloop%/gi,Rp(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))break;t=t/2|0}return t}var kp=0,Fp={},Bp=function(){function t(e,i,r){void 0===r&&(r="pixi-shader"),this.id=kp++,this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=i||t.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),"#version"!==this.vertexSrc.substring(0,8)&&(r=r.replace(/\s+/g,"-"),Fp[r]?(Fp[r]++,r+="-"+Fp[r]):Fp[r]=1,this.vertexSrc="#define SHADER_NAME "+r+"\n"+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+r+"\n"+this.fragmentSrc,this.vertexSrc=wp(this.vertexSrc,ph.PRECISION_VERTEX,ta.HIGH),this.fragmentSrc=wp(this.fragmentSrc,ph.PRECISION_FRAGMENT,function(){if(!_p){_p=ta.MEDIUM;var t=Pp();if(t&&t.getShaderPrecisionFormat){var e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);_p=e.precision?ta.HIGH:ta.MEDIUM}}return _p}())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(t,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"},enumerable:!1,configurable:!0}),t.from=function(e,i,r){var n=e+i,o=Jl[n];return o||(Jl[n]=o=new t(e,i,r)),o},t}(),Up=function(){function t(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof tp?e:new tp(e):new tp({})}return t.prototype.checkUniformExists=function(t,e){if(e.uniforms[t])return!0;for(var i in e.uniforms){var r=e.uniforms[i];if(r.group&&this.checkUniformExists(t,r))return!0}return!1},t.prototype.destroy=function(){this.uniformGroup=null},Object.defineProperty(t.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),t.from=function(e,i,r){return new t(Bp.from(e,i),r)},t}(),zp=function(){function t(){this.data=0,this.blendMode=js.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(t.prototype,"blend",{get:function(){return!!(1&this.data)},set:function(t){!!(1&this.data)!==t&&(this.data^=1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsets",{get:function(){return!!(2&this.data)},set:function(t){!!(2&this.data)!==t&&(this.data^=2)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"culling",{get:function(){return!!(4&this.data)},set:function(t){!!(4&this.data)!==t&&(this.data^=4)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthTest",{get:function(){return!!(8&this.data)},set:function(t){!!(8&this.data)!==t&&(this.data^=8)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthMask",{get:function(){return!!(32&this.data)},set:function(t){!!(32&this.data)!==t&&(this.data^=32)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwiseFrontFace",{get:function(){return!!(16&this.data)},set:function(t){!!(16&this.data)!==t&&(this.data^=16)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this.blend=t!==js.NONE,this._blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(t){this.offsets=!!t,this._polygonOffset=t},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[@pixi/core:State blendMode="+this.blendMode+" clockwiseFrontFace="+this.clockwiseFrontFace+" culling="+this.culling+" depthMask="+this.depthMask+" polygonOffset="+this.polygonOffset+"]"},t.for2d=function(){var e=new t;return e.depthTest=!1,e.blend=!0,e},t}(),Xp=function(t){function e(i,r,n){var o=this,s=Bp.from(i||e.defaultVertexSrc,r||e.defaultFragmentSrc);return(o=t.call(this,s,n)||this).padding=0,o.resolution=ph.FILTER_RESOLUTION,o.multisample=ph.FILTER_MULTISAMPLE,o.enabled=!0,o.autoFit=!0,o.state=new zp,o}return mu(e,t),e.prototype.apply=function(t,e,i,r,n){t.applyFilter(this,e,i,r)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"},enumerable:!1,configurable:!0}),e}(Up),jp=new ma,Yp=function(){function t(t,e){this._texture=t,this.mapCoord=new ma,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?.5:e,this.isSimple=!1}return Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture=t,this._textureID=-1},enumerable:!1,configurable:!0}),t.prototype.multiplyUvs=function(t,e){void 0===e&&(e=t);for(var i=this.mapCoord,r=0;r<t.length;r+=2){var n=t[r],o=t[r+1];e[r]=n*i.a+o*i.c+i.tx,e[r+1]=n*i.b+o*i.d+i.ty}return e},t.prototype.update=function(t){var e=this._texture;if(!e||!e.valid)return!1;if(!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;var i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);var r=e.orig,n=e.trim;n&&(jp.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(jp));var o=e.baseTexture,s=this.uClampFrame,a=this.clampMargin/o.resolution,h=this.clampOffset;return s[0]=(e._frame.x+a+h)/o.width,s[1]=(e._frame.y+a+h)/o.height,s[2]=(e._frame.x+e._frame.width-a+h)/o.width,s[3]=(e._frame.y+e._frame.height-a+h)/o.height,this.uClampOffset[0]=h/o.realWidth,this.uClampOffset[1]=h/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&0===e.rotate,!0},t}(),Hp=function(t){function e(e){var i=this,r=new ma;return i=t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n")||this,e.renderable=!1,i.maskSprite=e,i.maskMatrix=r,i}return mu(e,t),e.prototype.apply=function(t,e,i,r){var n=this.maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Yp(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,r))},e}(Xp),Gp=function(){function t(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return t.prototype.setMaskStack=function(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)},t.prototype.push=function(t,e){var i=e;if(!i.isMaskData){var r=this.maskDataPool.pop()||new fp;r.pooled=!0,r.maskObject=e,i=r}switch(i.autoDetect&&this.detect(i),i.copyCountersOrReset(this.maskStack[this.maskStack.length-1]),i._target=t,i.type){case ea.SCISSOR:this.maskStack.push(i),this.renderer.scissor.push(i);break;case ea.STENCIL:this.maskStack.push(i),this.renderer.stencil.push(i);break;case ea.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i),this.maskStack.push(i)}},t.prototype.pop=function(t){var e=this.maskStack.pop();if(e&&e._target===t){switch(e.type){case ea.SCISSOR:this.renderer.scissor.pop();break;case ea.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ea.SPRITE:this.popSpriteMask()}e.reset(),e.pooled&&this.maskDataPool.push(e)}},t.prototype.detect=function(t){var e=t.maskObject;if(e.isSprite)t.type=ea.SPRITE;else if(t.type=ea.STENCIL,this.enableScissor&&e.isFastRect&&e.isFastRect()){var i=e.worldTransform,r=Math.atan2(i.b,i.a),n=Math.atan2(i.d,i.c);r=Math.round(r*(180/Math.PI)*100),n=((n=Math.round(n*(180/Math.PI)*100)-r)%18e3+18e3)%18e3,0===(r=(r%9e3+9e3)%9e3)&&9e3===n&&(t.type=ea.SCISSOR)}},t.prototype.pushSpriteMask=function(t){var e,i,r=t.maskObject,n=t._target,o=this.alphaMaskPool[this.alphaMaskIndex];o||(o=this.alphaMaskPool[this.alphaMaskIndex]=[new Hp(r)]);var s,a,h=this.renderer,l=h.renderTexture;if(l.current){var u=l.current;s=t.resolution||u.resolution,a=null!==(e=t.multisample)&&void 0!==e?e:u.multisample}else s=t.resolution||h.resolution,a=null!==(i=t.multisample)&&void 0!==i?i:h.multisample;o[0].resolution=s,o[0].multisample=a,o[0].maskSprite=r;var p=n.filterArea;n.filterArea=r.getBounds(!0),h.filter.push(n,o),n.filterArea=p,this.alphaMaskIndex++},t.prototype.popSpriteMask=function(){this.renderer.filter.pop(),this.alphaMaskIndex--},t.prototype.destroy=function(){this.renderer=null},t}(),Wp=function(){function t(t){this.renderer=t,this.maskStack=[],this.glConst=0}return t.prototype.getStackLength=function(){return this.maskStack.length},t.prototype.setMaskStack=function(t){var e=this.renderer.gl,i=this.getStackLength();this.maskStack=t;var r=this.getStackLength();r!==i&&(0===r?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))},t.prototype._useCurrent=function(){},t.prototype.destroy=function(){this.renderer=null,this.maskStack=null},t}(),Vp=function(t){function e(e){var i=t.call(this,e)||this;return i.glConst=WebGLRenderingContext.SCISSOR_TEST,i}return mu(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.push=function(t){var e=t.maskObject;e.renderable=!0;var i=t._scissorRect,r=e.getBounds(!0),n=this.renderer.gl;e.renderable=!1,i?r.fit(i):n.enable(n.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=r,this._useCurrent()},e.prototype.pop=function(){var t=this.renderer.gl;this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,e=this.renderer.renderTexture.current,i=this.renderer.projection,r=i.transform,n=i.sourceFrame,o=i.destinationFrame,s=e?e.resolution:this.renderer.resolution,a=o.width/n.width,h=o.height/n.height,l=((t.x-n.x)*a+o.x)*s,u=((t.y-n.y)*h+o.y)*s,p=t.width*a*s,c=t.height*h*s;r&&(l+=r.tx*s,u+=r.ty*s),e||(u=this.renderer.height-c-u),l=Math.round(l),u=Math.round(u),p=Math.round(p),c=Math.round(c),this.renderer.gl.scissor(l,u,p,c)},e}(Wp),qp=function(t){function e(e){var i=t.call(this,e)||this;return i.glConst=WebGLRenderingContext.STENCIL_TEST,i}return mu(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var e=t.maskObject,i=this.renderer.gl,r=t._stencilCounter;0===r&&(this.renderer.framebuffer.forceStencil(),i.enable(i.STENCIL_TEST)),t._stencilCounter++,i.colorMask(!1,!1,!1,!1),i.stencilFunc(i.EQUAL,r,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;0===this.getStackLength()?(e.disable(e.STENCIL_TEST),e.clearStencil(0),e.clear(e.STENCIL_BUFFER_BIT)):(e.colorMask(!1,!1,!1,!1),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,this._useCurrent())},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.colorMask(!0,!0,!0,!0),t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(Wp),Zp=function(){function t(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new ma,this.transform=null}return t.prototype.update=function(t,e,i,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,r),this.transform&&this.projectionMatrix.append(this.transform);var n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)},t.prototype.calculateProjection=function(t,e,i,r){var n=this.projectionMatrix,o=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d},t.prototype.setTransform=function(t){},t.prototype.destroy=function(){this.renderer=null},t}(),Jp=new pa,Kp=new pa,Qp=function(){function t(t){this.renderer=t,this.clearColor=t._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pa,this.destinationFrame=new pa,this.viewportFrame=new pa}return t.prototype.bind=function(t,e,i){void 0===t&&(t=null);var r,n,o,s=this.renderer;this.current=t,t?(o=(r=t.baseTexture).resolution,e||(Jp.width=t.frame.width,Jp.height=t.frame.height,e=Jp),i||(Kp.x=t.frame.x,Kp.y=t.frame.y,Kp.width=e.width,Kp.height=e.height,i=Kp),n=r.framebuffer):(o=s.resolution,e||(Jp.width=s.screen.width,Jp.height=s.screen.height,e=Jp),i||((i=Jp).width=e.width,i.height=e.height));var a=this.viewportFrame;a.x=i.x*o,a.y=i.y*o,a.width=i.width*o,a.height=i.height*o,t||(a.y=s.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(i,e,o,!n),t?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)},t.prototype.clear=function(t,e){t=this.current?t||this.current.baseTexture.clearColor:t||this.clearColor;var i=this.destinationFrame,r=this.current?this.current.baseTexture:this.renderer.screen,n=i.width!==r.width||i.height!==r.height;if(n){var o=this.viewportFrame,s=o.x,a=o.y,h=o.width,l=o.height;s=Math.round(s),a=Math.round(a),h=Math.round(h),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(s,a,h,l)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),n&&this.renderer.scissor.pop()},t.prototype.resize=function(){this.bind(null)},t.prototype.reset=function(){this.bind(null)},t.prototype.destroy=function(){this.renderer=null},t}();function $p(t,e,i,r,n){i.buffer.update(n)}var tc={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},ec={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function ic(t){for(var e=t.map((function(t){return{data:t,offset:0,dataLen:0,dirty:0}})),i=0,r=0,n=0,o=0;o<e.length;o++){var s=e[o];if(i=ec[s.data.type],s.data.size>1&&(i=Math.max(i,16)*s.data.size),s.dataLen=i,r%i!=0&&r<16){var a=r%i%16;r+=a,n+=a}r+i>16?(n=16*Math.ceil(n/16),s.offset=n,n+=i,r=i):(s.offset=n,r+=i,n+=i)}return{uboElements:e,size:n=16*Math.ceil(n/16)}}function rc(t,e){var i=[];for(var r in t)e[r]&&i.push(e[r]);return i.sort((function(t,e){return t.index-e.index})),i}function nc(t,e){if(!t.autoManage)return{size:0,syncFunc:$p};for(var i=ic(rc(t.uniforms,e)),r=i.uboElements,n=i.size,o=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],s=0;s<r.length;s++){for(var a=r[s],h=t.uniforms[a.data.name],l=a.data.name,u=!1,p=0;p<Op.length;p++){var c=Op[p];if(c.codeUbo&&c.test(a.data,h)){o.push("offset = "+a.offset/4+";",Op[p].codeUbo(a.data.name,h)),u=!0;break}}if(!u)if(a.data.size>1){var d=Tp(a.data.type),f=Math.max(ec[a.data.type]/16,1),v=d/f,y=(4-v%4)%4;o.push("\n cv = ud."+l+".value;\n v = uv."+l+";\n offset = "+a.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+a.data.size*f+"; i++)\n {\n for(var j = 0; j < "+v+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+y+";\n }\n\n ")}else{var g=tc[a.data.type];o.push("\n cv = ud."+l+".value;\n v = uv."+l+";\n offset = "+a.offset/4+";\n "+g+";\n ")}}return o.push("\n renderer.buffer.update(buffer);\n "),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join("\n"))}}var oc=function(){},sc=function(){function t(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return t.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},t}();function ac(t,e){var i=vp(t,t.VERTEX_SHADER,e.vertexSrc),r=vp(t,t.FRAGMENT_SHADER,e.fragmentSrc),n=t.createProgram();t.attachShader(n,i),t.attachShader(n,r),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||function(t,e,i,r){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(i,t.COMPILE_STATUS)||yp(t,i),t.getShaderParameter(r,t.COMPILE_STATUS)||yp(t,r),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,n,i,r),e.attributeData=function(t,e){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var o=e.getActiveAttrib(t,n);if(0!==o.name.indexOf("gl_")){var s=Sp(e,o.type),a={type:s,name:o.name,size:Tp(s),location:n};i[o.name]=a}}return i}(n,t),e.uniformData=function(t,e){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;n<r;n++){var o=e.getActiveUniform(t,n),s=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=Sp(e,o.type);i[s]={name:s,index:n,type:h,size:o.size,isArray:a,value:mp(h,o.size)}}return i}(n,t);var o=Object.keys(e.attributeData);o.sort((function(t,e){return t>e?1:-1}));for(var s=0;s<o.length;s++)e.attributeData[o[s]].location=s,t.bindAttribLocation(n,s,o[s]);t.linkProgram(n),t.deleteShader(i),t.deleteShader(r);var a={};for(var s in e.uniformData){var h=e.uniformData[s];a[s]={location:t.getUniformLocation(n,s),value:mp(h.type,h.size)}}return new sc(n,a)}var hc=0,lc={textureCount:0,uboCount:0},uc=function(){function t(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=hc++}return t.prototype.systemCheck=function(){if(!function(){if("boolean"==typeof Lp)return Lp;try{var t=new Function("param1","param2","param3","return param1[param2] === param3;");Lp=!0===t({a:"b"},"a","b")}catch(t){Lp=!1}return Lp}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},t.prototype.contextChange=function(t){this.gl=t,this.reset()},t.prototype.bind=function(t,e){t.uniforms.globals=this.renderer.globalUniforms;var i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),e||(lc.textureCount=0,lc.uboCount=0,this.syncUniformGroup(t.uniformGroup,lc)),r},t.prototype.setUniforms=function(t){var e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)},t.prototype.syncUniformGroup=function(t,e){var i=this.getGlProgram();t.static&&t.dirtyId===i.uniformDirtyGroups[t.id]||(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))},t.prototype.syncUniforms=function(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)},t.prototype.createSyncGroups=function(t){var e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function(t,e){var i=["\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "];for(var r in t.uniforms){var n=e[r];if(n){for(var o=t.uniforms[r],s=!1,a=0;a<Op.length;a++)if(Op[a].test(n,o)){i.push(Op[a].code(r,o)),s=!0;break}if(!s){var h=(1===n.size?Ap:Mp)[n.type].replace("location",'ud["'+r+'"].location');i.push('\n cv = ud["'+r+'"].value;\n v = uv["'+r+'"];\n '+h+";")}}else t.uniforms[r].group&&(t.uniforms[r].ubo?i.push("\n renderer.shader.syncUniformBufferGroup(uv."+r+", '"+r+"');\n "):i.push("\n renderer.shader.syncUniformGroup(uv."+r+", syncData);\n "))}return new Function("ud","uv","renderer","syncData",i.join("\n"))}(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]},t.prototype.syncUniformBufferGroup=function(t,e){var i=this.getGlProgram();if(!t.static||0!==t.dirtyId||!i.uniformGroups[t.id]){t.dirtyId=0;var r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,lc,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])},t.prototype.createSyncBufferGroup=function(t,e,i){var r=this.renderer.gl;this.renderer.buffer.bind(t.buffer);var n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;var o=this.getSignature(t,this.shader.program.uniformData,"ubo"),s=this._uboCache[o];if(s||(s=this._uboCache[o]=nc(t,this.shader.program.uniformData)),t.autoManage){var a=new Float32Array(s.size/4);t.buffer.update(a)}return e.uniformGroups[t.id]=s.syncFunc,e.uniformGroups[t.id]},t.prototype.getSignature=function(t,e,i){var r=t.uniforms,n=[i+"-"];for(var o in r)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")},t.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},t.prototype.generateProgram=function(t){var e=this.gl,i=t.program,r=ac(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r},t.prototype.reset=function(){this.program=null,this.shader=null},t.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},t}();var pc=function(){function t(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=js.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new zp,this.defaultState.blend=!0}return t.prototype.contextChange=function(t){this.gl=t,this.blendModes=function(t,e){return void 0===e&&(e=[]),e[js.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.ADD]=[t.ONE,t.ONE],e[js.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.NONE]=[0,0],e[js.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[js.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[js.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[js.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[js.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[js.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[js.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[js.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[js.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[js.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[js.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.set(this.defaultState),this.reset()},t.prototype.set=function(t){if(t=t||this.defaultState,this.stateId!==t.data){for(var e=this.stateId^t.data,i=0;e;)1&e&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(i=0;i<this.checks.length;i++)this.checks[i](this,t)},t.prototype.forceState=function(t){t=t||this.defaultState;for(var e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data},t.prototype.setBlend=function(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)},t.prototype.setOffset=function(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},t.prototype.setDepthTest=function(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)},t.prototype.setDepthMask=function(t){this.gl.depthMask(t)},t.prototype.setCullFace=function(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)},t.prototype.setFrontFace=function(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])},t.prototype.setBlendMode=function(t){if(t!==this.blendMode){this.blendMode=t;var e=this.blendModes[t],i=this.gl;2===e.length?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}},t.prototype.setPolygonOffset=function(t,e){this.gl.polygonOffset(t,e)},t.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},t.prototype.updateCheck=function(t,e){var i=this.checks.indexOf(t);e&&-1===i?this.checks.push(t):e||-1===i||this.checks.splice(i,1)},t.checkBlendMode=function(t,e){t.setBlendMode(e.blendMode)},t.checkPolygonOffset=function(t,e){t.setPolygonOffset(1,e.polygonOffset)},t.prototype.destroy=function(){this.gl=null},t}(),cc=function(){function t(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ph.GC_MAX_IDLE,this.checkCountMax=ph.GC_MAX_CHECK_COUNT,this.mode=ph.GC_MODE}return t.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==$s.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},t.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,i=!1,r=0;r<e.length;r++){var n=e[r];!n.framebuffer&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,i=!0)}if(i){var o=0;for(r=0;r<e.length;r++)null!==e[r]&&(e[o++]=e[r]);e.length=o}},t.prototype.unload=function(t){var e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(var r=t.children.length-1;r>=0;r--)this.unload(t.children[r])},t.prototype.destroy=function(){this.renderer=null},t}();var dc=function(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=Ws.UNSIGNED_BYTE,this.internalFormat=Hs.RGBA,this.samplerType=0},fc=function(){function t(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new wu,this.hasIntegerTextures=!1}return t.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(t){var e,i,r,n,o,s,a,h,l,u,p,c,d,f,v,y,g,m,_,x,b,P,w;return"WebGL2RenderingContext"in self&&t instanceof self.WebGL2RenderingContext?((e={})[Ws.UNSIGNED_BYTE]=((i={})[Hs.RGBA]=t.RGBA8,i[Hs.RGB]=t.RGB8,i[Hs.RG]=t.RG8,i[Hs.RED]=t.R8,i[Hs.RGBA_INTEGER]=t.RGBA8UI,i[Hs.RGB_INTEGER]=t.RGB8UI,i[Hs.RG_INTEGER]=t.RG8UI,i[Hs.RED_INTEGER]=t.R8UI,i[Hs.ALPHA]=t.ALPHA,i[Hs.LUMINANCE]=t.LUMINANCE,i[Hs.LUMINANCE_ALPHA]=t.LUMINANCE_ALPHA,i),e[Ws.BYTE]=((r={})[Hs.RGBA]=t.RGBA8_SNORM,r[Hs.RGB]=t.RGB8_SNORM,r[Hs.RG]=t.RG8_SNORM,r[Hs.RED]=t.R8_SNORM,r[Hs.RGBA_INTEGER]=t.RGBA8I,r[Hs.RGB_INTEGER]=t.RGB8I,r[Hs.RG_INTEGER]=t.RG8I,r[Hs.RED_INTEGER]=t.R8I,r),e[Ws.UNSIGNED_SHORT]=((n={})[Hs.RGBA_INTEGER]=t.RGBA16UI,n[Hs.RGB_INTEGER]=t.RGB16UI,n[Hs.RG_INTEGER]=t.RG16UI,n[Hs.RED_INTEGER]=t.R16UI,n[Hs.DEPTH_COMPONENT]=t.DEPTH_COMPONENT16,n),e[Ws.SHORT]=((o={})[Hs.RGBA_INTEGER]=t.RGBA16I,o[Hs.RGB_INTEGER]=t.RGB16I,o[Hs.RG_INTEGER]=t.RG16I,o[Hs.RED_INTEGER]=t.R16I,o),e[Ws.UNSIGNED_INT]=((s={})[Hs.RGBA_INTEGER]=t.RGBA32UI,s[Hs.RGB_INTEGER]=t.RGB32UI,s[Hs.RG_INTEGER]=t.RG32UI,s[Hs.RED_INTEGER]=t.R32UI,s[Hs.DEPTH_COMPONENT]=t.DEPTH_COMPONENT24,s),e[Ws.INT]=((a={})[Hs.RGBA_INTEGER]=t.RGBA32I,a[Hs.RGB_INTEGER]=t.RGB32I,a[Hs.RG_INTEGER]=t.RG32I,a[Hs.RED_INTEGER]=t.R32I,a),e[Ws.FLOAT]=((h={})[Hs.RGBA]=t.RGBA32F,h[Hs.RGB]=t.RGB32F,h[Hs.RG]=t.RG32F,h[Hs.RED]=t.R32F,h[Hs.DEPTH_COMPONENT]=t.DEPTH_COMPONENT32F,h),e[Ws.HALF_FLOAT]=((l={})[Hs.RGBA]=t.RGBA16F,l[Hs.RGB]=t.RGB16F,l[Hs.RG]=t.RG16F,l[Hs.RED]=t.R16F,l),e[Ws.UNSIGNED_SHORT_5_6_5]=((u={})[Hs.RGB]=t.RGB565,u),e[Ws.UNSIGNED_SHORT_4_4_4_4]=((p={})[Hs.RGBA]=t.RGBA4,p),e[Ws.UNSIGNED_SHORT_5_5_5_1]=((c={})[Hs.RGBA]=t.RGB5_A1,c),e[Ws.UNSIGNED_INT_2_10_10_10_REV]=((d={})[Hs.RGBA]=t.RGB10_A2,d[Hs.RGBA_INTEGER]=t.RGB10_A2UI,d),e[Ws.UNSIGNED_INT_10F_11F_11F_REV]=((f={})[Hs.RGB]=t.R11F_G11F_B10F,f),e[Ws.UNSIGNED_INT_5_9_9_9_REV]=((v={})[Hs.RGB]=t.RGB9_E5,v),e[Ws.UNSIGNED_INT_24_8]=((y={})[Hs.DEPTH_STENCIL]=t.DEPTH24_STENCIL8,y),e[Ws.FLOAT_32_UNSIGNED_INT_24_8_REV]=((g={})[Hs.DEPTH_STENCIL]=t.DEPTH32F_STENCIL8,g),w=e):((m={})[Ws.UNSIGNED_BYTE]=((_={})[Hs.RGBA]=t.RGBA,_[Hs.RGB]=t.RGB,_[Hs.ALPHA]=t.ALPHA,_[Hs.LUMINANCE]=t.LUMINANCE,_[Hs.LUMINANCE_ALPHA]=t.LUMINANCE_ALPHA,_),m[Ws.UNSIGNED_SHORT_5_6_5]=((x={})[Hs.RGB]=t.RGB,x),m[Ws.UNSIGNED_SHORT_4_4_4_4]=((b={})[Hs.RGBA]=t.RGBA,b),m[Ws.UNSIGNED_SHORT_5_5_5_1]=((P={})[Hs.RGBA]=t.RGBA,P),w=m),w}(t);var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var i=0;i<e;i++)this.boundTextures[i]=null;this.emptyTextures={};var r=new dc(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new dc(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(i=0;i<this.boundTextures.length;i++)this.bind(null,i)},t.prototype.bind=function(t,e){void 0===e&&(e=0);var i=this.gl;if((t=null==t?void 0:t.castToBaseTexture())&&t.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;var r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null},t.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture},t.prototype.unbind=function(t){var e=this.gl,i=this.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)},t.prototype.ensureSamplerType=function(t){var e=this,i=e.boundTextures,r=e.hasIntegerTextures,n=e.CONTEXT_UID;if(r)for(var o=t-1;o>=0;--o){var s=i[o];if(s)s._glTextures[n].samplerType!==Vs.FLOAT&&this.renderer.texture.unbind(s)}},t.prototype.initTexture=function(t){var e=new dc(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e},t.prototype.initTextureType=function(t,e){var i,r;e.internalFormat=null!==(r=null===(i=this.internalFormats[t.type])||void 0===i?void 0:i[t.format])&&void 0!==r?r:t.format,2===this.webGLVersion&&t.type===Ws.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type},t.prototype.updateTexture=function(t){var e=t._glTextures[this.CONTEXT_UID];if(e){var i=this.renderer;if(this.initTextureType(t,e),t.resource&&t.resource.upload(i,t,e))e.samplerType!==Vs.FLOAT&&(this.hasIntegerTextures=!0);else{var r=t.realWidth,n=t.realHeight,o=i.gl;(e.width!==r||e.height!==n||e.dirtyId<0)&&(e.width=r,e.height=n,o.texImage2D(t.target,0,e.internalFormat,r,n,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}},t.prototype.destroyTexture=function(t,e){var i=this.gl;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){var r=this.managedTextures.indexOf(t);-1!==r&&Hl(this.managedTextures,r,1)}},t.prototype.updateTextureStyle=function(t){var e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==Js.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=Zs.CLAMP,t.resource&&t.resource.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)},t.prototype.setStyle=function(t,e){var i=this.gl;if(e.mipmap&&t.mipmap!==Js.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===qs.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===qs.LINEAR){var n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===qs.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===qs.LINEAR?i.LINEAR:i.NEAREST)},t.prototype.destroy=function(){this.renderer=null},t}(),vc={__proto__:null,FilterSystem:np,BatchSystem:sp,ContextSystem:hp,FramebufferSystem:pp,GeometrySystem:dp,MaskSystem:Gp,ScissorSystem:Vp,StencilSystem:qp,ProjectionSystem:Zp,RenderTextureSystem:Qp,ShaderSystem:uc,StateSystem:pc,TextureGCSystem:cc,TextureSystem:fc},yc=new ma,gc=function(t){function e(e,i){void 0===e&&(e=zs.UNKNOWN);var r=t.call(this)||this;return i=Object.assign({},ph.RENDER_OPTIONS,i),r.options=i,r.type=e,r.screen=new pa(0,0,i.width,i.height),r.view=i.view||document.createElement("canvas"),r.resolution=i.resolution||ph.RESOLUTION,r.useContextAlpha=i.useContextAlpha,r.autoDensity=!!i.autoDensity,r.preserveDrawingBuffer=i.preserveDrawingBuffer,r.clearBeforeRender=i.clearBeforeRender,r._backgroundColor=0,r._backgroundColorRgba=[0,0,0,1],r._backgroundColorString="#000000",r.backgroundColor=i.backgroundColor||r._backgroundColor,r.backgroundAlpha=i.backgroundAlpha,void 0!==i.transparent&&(Zl("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),r.useContextAlpha=i.transparent,r.backgroundAlpha=i.transparent?0:1),r._lastObjectRendered=null,r.plugins={},r}return mu(e,t),e.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(e*this.resolution);var i=this.view.width/this.resolution,r=this.view.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.view.style.width=i+"px",this.view.style.height=r+"px"),this.emit("resize",i,r)},e.prototype.generateTexture=function(t,e,i,r){void 0===e&&(e={}),"number"==typeof e&&(Zl("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),e={scaleMode:e,resolution:i,region:r});var n=e.region,o=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&(i[r[n]]=t[r[n]])}return i}(e,["region"]);0===(r=n||t.getLocalBounds(null,!0)).width&&(r.width=1),0===r.height&&(r.height=1);var s=Xu.create(_u({width:r.width,height:r.height},o));return yc.tx=-r.x,yc.ty=-r.y,this.render(t,{renderTexture:s,clear:!1,transform:yc,skipUpdateTransform:!!t.parent}),s},e.prototype.destroy=function(t){for(var e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var i=this;i.plugins=null,i.type=zs.UNKNOWN,i.view=null,i.screen=null,i._tempDisplayObjectParent=null,i.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=Rl(t),Nl(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(t){this._backgroundColorRgba[3]=t},enumerable:!1,configurable:!0}),e}(vh),mc=function(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0},_c=function(){function t(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}return t.prototype.destroy=function(){this.renderer=null},t.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},t.prototype.bind=function(t){var e=this.gl,i=this.CONTEXT_UID,r=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)},t.prototype.bindBufferBase=function(t,e){var i=this.gl,r=this.CONTEXT_UID;if(this.boundBufferBases[e]!==t){var n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}},t.prototype.bindBufferRange=function(t,e,i){var r=this.gl,n=this.CONTEXT_UID;i=i||0;var o=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,o.buffer,256*i,256)},t.prototype.update=function(t){var e=this.gl,i=this.CONTEXT_UID,r=t._glBuffers[i];if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{var n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}},t.prototype.dispose=function(t,e){if(this.managedBuffers[t.id]){delete this.managedBuffers[t.id];var i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(e||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}},t.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedBuffers),i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)},t.prototype.createGLBuffer=function(t){var e=this.CONTEXT_UID,i=this.gl;return t._glBuffers[e]=new mc(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]},t}(),xc=function(t){function e(i){var r=t.call(this,zs.WEBGL,i)||this;return i=r.options,r.gl=null,r.CONTEXT_UID=0,r.runners={destroy:new fu("destroy"),contextChange:new fu("contextChange"),reset:new fu("reset"),update:new fu("update"),postrender:new fu("postrender"),prerender:new fu("prerender"),resize:new fu("resize")},r.runners.contextChange.add(r),r.globalUniforms=new tp({projectionMatrix:new ma},!0),r.addSystem(Gp,"mask").addSystem(hp,"context").addSystem(pc,"state").addSystem(uc,"shader").addSystem(fc,"texture").addSystem(_c,"buffer").addSystem(dp,"geometry").addSystem(pp,"framebuffer").addSystem(Vp,"scissor").addSystem(qp,"stencil").addSystem(Zp,"projection").addSystem(cc,"textureGC").addSystem(np,"filter").addSystem(Qp,"renderTexture").addSystem(sp,"batch"),r.initPlugins(e.__plugins),r.multisample=void 0,i.context?r.context.initFromContext(i.context):r.context.initFromOptions({alpha:!!r.useContextAlpha,antialias:i.antialias,premultipliedAlpha:r.useContextAlpha&&"notMultiplied"!==r.useContextAlpha,stencil:!0,preserveDrawingBuffer:i.preserveDrawingBuffer,powerPreference:r.options.powerPreference}),r.renderingToScreen=!0,Al(2===r.context.webGLVersion?"WebGL 2":"WebGL 1"),r.resize(r.options.width,r.options.height),r}return mu(e,t),e.create=function(t){if(Ml())return new e(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},e.prototype.contextChange=function(){var t,e=this.gl;if(1===this.context.webGLVersion){var i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=ia.HIGH?this.multisample=ia.HIGH:t>=ia.MEDIUM?this.multisample=ia.MEDIUM:t>=ia.LOW?this.multisample=ia.LOW:this.multisample=ia.NONE},e.prototype.addSystem=function(t,e){var i=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var r in this[e]=i,this.runners)this.runners[r].add(i);return this},e.prototype.render=function(t,e){var i,r,n,o;if(e&&(e instanceof Xu?(Zl("6.0.0","Renderer#render arguments changed, use options instead."),i=e,r=arguments[2],n=arguments[3],o=arguments[4]):(i=e.renderTexture,r=e.clear,n=e.transform,o=e.skipUpdateTransform)),this.renderingToScreen=!i,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,!this.context.isLost){if(i||(this._lastObjectRendered=t),!o){var s=t.enableTempParent();t.updateTransform(),t.disableTempParent(s)}this.renderTexture.bind(i),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),i&&i.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(e,i,r,n){void 0===i&&(i={});var o=t.prototype.generateTexture.call(this,e,i,r,n);return this.framebuffer.blit(),o},e.prototype.resize=function(e,i){t.prototype.resize.call(this,e,i),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(e){for(var i in this.runners.destroy.emit(),this.runners)this.runners[i].destroy();t.prototype.destroy.call(this,e),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return Zl("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(t,i){e.__plugins=e.__plugins||{},e.__plugins[t]=i},e}(gc);function bc(t){return xc.create(t)}var Pc="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",wc=function(){function t(t){Zl("6.1.0","System class is deprecated, implemement ISystem interface instead."),this.renderer=t}return t.prototype.destroy=function(){this.renderer=null},t}(),Ec=function(){this.texArray=null,this.blend=0,this.type=Ys.TRIANGLES,this.start=0,this.size=0,this.data=null},Tc=function(){function t(){this.elements=[],this.ids=[],this.count=0}return t.prototype.clear=function(){for(var t=0;t<this.count;t++)this.elements[t]=null;this.count=0},t}(),Cc=function(){function t(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}return Object.defineProperty(t.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),t.prototype.view=function(t){return this[t+"View"]},t.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},t.sizeOf=function(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(t+" isn't a valid view type")}},t}(),Ic=function(t){function e(e){var i=t.call(this,e)||this;return i.shaderGenerator=null,i.geometryClass=null,i.vertexSize=null,i.state=zp.for2d(),i.size=4*ph.SPRITE_BATCH_SIZE,i._vertexCount=0,i._indexCount=0,i._bufferedElements=[],i._bufferedTextures=[],i._bufferSize=0,i._shader=null,i._packedGeometries=[],i._packedGeometryPoolSize=2,i._flushId=0,i._aBuffers={},i._iBuffers={},i.MAX_TEXTURES=1,i.renderer.on("prerender",i.onPrerender,i),e.runners.contextChange.add(i),i._dcIndex=0,i._aIndex=0,i._iIndex=0,i._attributeBuffer=null,i._indexBuffer=null,i._tempBoundTextures=[],i}return mu(e,t),e.prototype.contextChange=function(){var t=this.renderer.gl;ph.PREFER_ENV===Us.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ph.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=Dp(this.MAX_TEXTURES,t)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()},e.prototype.initFlushBuffers=function(){for(var t=e._drawCallPool,i=e._textureArrayPool,r=this.size/4,n=Math.floor(r/this.MAX_TEXTURES)+1;t.length<r;)t.push(new Ec);for(;i.length<n;)i.push(new Tc);for(var o=0;o<this.MAX_TEXTURES;o++)this._tempBoundTextures[o]=null},e.prototype.onPrerender=function(){this._flushId=0},e.prototype.render=function(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},e.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,i=this.MAX_TEXTURES,r=e._textureArrayPool,n=this.renderer.batch,o=this._tempBoundTextures,s=this.renderer.textureGC.count,a=++wu._globalBatch,h=0,l=r[0],u=0;n.copyBoundTextures(o,i);for(var p=0;p<this._bufferSize;++p){var c=t[p];t[p]=null,c._batchEnabled!==a&&(l.count>=i&&(n.boundArray(l,o,a,i),this.buildDrawCalls(l,u,p),u=p,l=r[++h],++a),c._batchEnabled=a,c.touched=s,l.elements[l.count++]=c)}l.count>0&&(n.boundArray(l,o,a,i),this.buildDrawCalls(l,u,this._bufferSize),++h,++a);for(p=0;p<o.length;p++)o[p]=null;wu._globalBatch=a},e.prototype.buildDrawCalls=function(t,i,r){var n=this,o=n._bufferedElements,s=n._attributeBuffer,a=n._indexBuffer,h=n.vertexSize,l=e._drawCallPool,u=this._dcIndex,p=this._aIndex,c=this._iIndex,d=l[u];d.start=this._iIndex,d.texArray=t;for(var f=i;f<r;++f){var v=o[f],y=v._texture.baseTexture,g=Fl[y.alphaMode?1:0][v.blendMode];o[f]=null,i<f&&d.blend!==g&&(d.size=c-d.start,i=f,(d=l[++u]).texArray=t,d.start=c),this.packInterleavedGeometry(v,s,a,p,c),p+=v.vertexData.length/2*h,c+=v.indices.length,d.blend=g}i<r&&(d.size=c-d.start,++u),this._dcIndex=u,this._aIndex=p,this._iIndex=c},e.prototype.bindAndClearTexArray=function(t){for(var e=this.renderer.texture,i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0},e.prototype.updateGeometry=function(){var t=this,e=t._packedGeometries,i=t._attributeBuffer,r=t._indexBuffer;ph.CAN_UPLOAD_SAME_BUFFER?(e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},e.prototype.drawBatches=function(){for(var t=this._dcIndex,i=this.renderer,r=i.gl,n=i.state,o=e._drawCallPool,s=null,a=0;a<t;a++){var h=o[a],l=h.texArray,u=h.type,p=h.size,c=h.start,d=h.blend;s!==l&&(s=l,this.bindAndClearTexArray(l)),this.state.blendMode=d,n.set(this.state),r.drawElements(u,p,r.UNSIGNED_SHORT,2*c)}},e.prototype.flush=function(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},e.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),ph.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},e.prototype.stop=function(){this.flush()},e.prototype.destroy=function(){for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),t.prototype.destroy.call(this)},e.prototype.getAttributeBuffer=function(t){var e=Xl(Math.ceil(t/8)),i=Yl(e),r=8*e;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);var n=this._aBuffers[r];return n||(this._aBuffers[r]=n=new Cc(r*this.vertexSize*4)),n},e.prototype.getIndexBuffer=function(t){var e=Xl(Math.ceil(t/12)),i=Yl(e),r=12*e;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);var n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(r)),n},e.prototype.packInterleavedGeometry=function(t,e,i,r,n){for(var o=e.uint32View,s=e.float32View,a=r/this.vertexSize,h=t.uvs,l=t.indices,u=t.vertexData,p=t._texture.baseTexture._batchLocation,c=Math.min(t.worldAlpha,1),d=c<1&&t._texture.baseTexture.alphaMode?Bl(t._tintRGB,c):t._tintRGB+(255*c<<24),f=0;f<u.length;f+=2)s[r++]=u[f],s[r++]=u[f+1],s[r++]=h[f],s[r++]=h[f+1],o[r++]=d,s[r++]=p;for(f=0;f<l.length;f++)i[n++]=a+l[f]},e._drawCallPool=[],e._textureArrayPool=[],e}(op),Sc=function(){function t(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},e.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(e.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return t.prototype.generateShader=function(t){if(!this.programCache[t]){for(var e=new Int32Array(t),i=0;i<t;i++)e[i]=i;this.defaultGroupCache[t]=tp.from({uSamplers:e},!0);var r=this.fragTemplate;r=(r=r.replace(/%count%/gi,""+t)).replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new Bp(this.vertexSrc,r)}var n={tint:new Float32Array([1,1,1,1]),translationMatrix:new ma,default:this.defaultGroupCache[t]};return new Up(this.programCache[t],n)},t.prototype.generateSampleSrc=function(t){var e="";e+="\n",e+="\n";for(var i=0;i<t;i++)i>0&&(e+="\nelse "),i<t-1&&(e+="if(vTextureId < "+i+".5)"),e+="\n{",e+="\n\tcolor = texture2D(uSamplers["+i+"], vTextureCoord);",e+="\n}";return e+="\n",e+="\n"},t}(),Oc=function(t){function e(e){void 0===e&&(e=!1);var i=t.call(this)||this;return i._buffer=new Gu(null,e,!1),i._indexBuffer=new Gu(null,e,!0),i.addAttribute("aVertexPosition",i._buffer,2,!1,Ws.FLOAT).addAttribute("aTextureCoord",i._buffer,2,!1,Ws.FLOAT).addAttribute("aColor",i._buffer,4,!0,Ws.UNSIGNED_BYTE).addAttribute("aTextureId",i._buffer,1,!0,Ws.FLOAT).addIndex(i._indexBuffer),i}return mu(e,t),e}(Ju),Ac="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n",Mc="varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n",Lc=function(){function t(){}return t.create=function(t){var e=Object.assign({vertex:Ac,fragment:Mc,geometryClass:Oc,vertexSize:6},t),i=e.vertex,r=e.fragment,n=e.vertexSize,o=e.geometryClass;return function(t){function e(e){var s=t.call(this,e)||this;return s.shaderGenerator=new Sc(i,r),s.geometryClass=o,s.vertexSize=n,s}return mu(e,t),e}(Ic)},Object.defineProperty(t,"defaultVertexSrc",{get:function(){return Ac},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentTemplate",{get:function(){return Mc},enumerable:!1,configurable:!0}),t}(),Nc=Lc.create(),Rc={},Dc=function(t){Object.defineProperty(Rc,t,{get:function(){return Zl("6.0.0","PIXI.systems."+t+" has moved to PIXI."+t),Nu[t]}})};for(var kc in Nu)Dc(kc);var Fc={},Bc=function(t){Object.defineProperty(Fc,t,{get:function(){return Zl("6.0.0","PIXI.resources."+t+" has moved to PIXI."+t),vc[t]}})};for(var kc in vc)Bc(kc);
|
|
92
|
+
/*!
|
|
93
|
+
* @pixi/canvas-display - v6.1.3
|
|
94
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
95
|
+
*
|
|
96
|
+
* @pixi/canvas-display is licensed under the MIT License.
|
|
97
|
+
* http://www.opensource.org/licenses/mit-license
|
|
98
|
+
*/du.prototype._renderCanvas=function(t){},du.prototype.renderCanvas=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable){this._mask&&t.maskManager.pushMask(this._mask),this._renderCanvas(t);for(var e=0,i=this.children.length;e<i;++e)this.children[e].renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},uu.prototype.renderCanvas=function(t){};
|
|
99
|
+
/*!
|
|
100
|
+
* @pixi/loaders - v6.1.3
|
|
101
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
102
|
+
*
|
|
103
|
+
* @pixi/loaders is licensed under the MIT License.
|
|
104
|
+
* http://www.opensource.org/licenses/mit-license
|
|
105
|
+
*/
|
|
106
|
+
var Uc=function(){function t(t,e,i){void 0===e&&(e=!1),this._fn=t,this._once=e,this._thisArg=i,this._next=this._prev=this._owner=null}return t.prototype.detach=function(){return null!==this._owner&&(this._owner.detach(this),!0)},t}();function zc(t,e){return t._head?(t._tail._next=e,e._prev=t._tail,t._tail=e):(t._head=e,t._tail=e),e._owner=t,e}var Xc=function(){function t(){this._head=this._tail=void 0}return t.prototype.handlers=function(t){void 0===t&&(t=!1);var e=this._head;if(t)return!!e;for(var i=[];e;)i.push(e),e=e._next;return i},t.prototype.has=function(t){if(!(t instanceof Uc))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return t._owner===this},t.prototype.dispatch=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];var r=this._head;if(!r)return!1;for(;r;)r._once&&this.detach(r),r._fn.apply(r._thisArg,e),r=r._next;return!0},t.prototype.add=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("MiniSignal#add(): First arg must be a Function.");return zc(this,new Uc(t,!1,e))},t.prototype.once=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("MiniSignal#once(): First arg must be a Function.");return zc(this,new Uc(t,!0,e))},t.prototype.detach=function(t){if(!(t instanceof Uc))throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");return t._owner!==this||(t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t===this._head?(this._head=t._next,null===t._next&&(this._tail=null)):t===this._tail&&(this._tail=t._prev,this._tail._next=null),t._owner=null),this},t.prototype.detachAll=function(){var t=this._head;if(!t)return this;for(this._head=this._tail=null;t;)t._owner=null,t=t._next;return this},t}();function jc(t,e){e=e||{};for(var i={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},r=i.parser[e.strictMode?"strict":"loose"].exec(t),n={},o=14;o--;)n[i.key[o]]=r[o]||"";return n[i.q.name]={},n[i.key[12]].replace(i.q.parser,(function(t,e,r){e&&(n[i.q.name][e]=r)})),n}var Yc=!(!self.XDomainRequest||"withCredentials"in new XMLHttpRequest),Hc=null;function Gc(){}function Wc(t,e,i){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t[e]=i)}function Vc(t){return t.toString().replace("object ","")}var qc=function(){function t(e,i,r){if(this._dequeue=Gc,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=null,this._boundOnError=null,this._boundOnProgress=null,this._boundOnTimeout=null,this._boundXhrOnError=null,this._boundXhrOnTimeout=null,this._boundXhrOnAbort=null,this._boundXhrOnLoad=null,"string"!=typeof e||"string"!=typeof i)throw new Error("Both name and url are required for constructing a resource.");r=r||{},this._flags=0,this._setFlag(t.STATUS_FLAGS.DATA_URL,0===i.indexOf("data:")),this.name=e,this.url=i,this.extension=this._getExtension(),this.data=null,this.crossOrigin=!0===r.crossOrigin?"anonymous":r.crossOrigin,this.timeout=r.timeout||0,this.loadType=r.loadType||this._determineLoadType(),this.xhrType=r.xhrType,this.metadata=r.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=t.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=Gc,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new Xc,this.onProgress=new Xc,this.onComplete=new Xc,this.onAfterMiddleware=new Xc}return t.setExtensionLoadType=function(e,i){Wc(t._loadTypeMap,e,i)},t.setExtensionXhrType=function(e,i){Wc(t._xhrTypeMap,e,i)},Object.defineProperty(t.prototype,"isDataUrl",{get:function(){return this._hasFlag(t.STATUS_FLAGS.DATA_URL)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isComplete",{get:function(){return this._hasFlag(t.STATUS_FLAGS.COMPLETE)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return this._hasFlag(t.STATUS_FLAGS.LOADING)},enumerable:!1,configurable:!0}),t.prototype.complete=function(){this._clearEvents(),this._finish()},t.prototype.abort=function(e){if(!this.error){if(this.error=new Error(e),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=t.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},t.prototype.load=function(e){var i=this;if(!this.isLoading)if(this.isComplete)e&&setTimeout((function(){return e(i)}),1);else switch(e&&this.onComplete.once(e),this._setFlag(t.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),!1!==this.crossOrigin&&"string"==typeof this.crossOrigin||(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case t.LOAD_TYPE.IMAGE:this.type=t.TYPE.IMAGE,this._loadElement("image");break;case t.LOAD_TYPE.AUDIO:this.type=t.TYPE.AUDIO,this._loadSourceElement("audio");break;case t.LOAD_TYPE.VIDEO:this.type=t.TYPE.VIDEO,this._loadSourceElement("video");break;case t.LOAD_TYPE.XHR:default:Yc&&this.crossOrigin?this._loadXdr():this._loadXhr()}},t.prototype._hasFlag=function(t){return 0!=(this._flags&t)},t.prototype._setFlag=function(t,e){this._flags=e?this._flags|t:this._flags&~t},t.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},t.prototype._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(t.STATUS_FLAGS.COMPLETE,!0),this._setFlag(t.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},t.prototype._loadElement=function(t){this.metadata.loadElement?this.data=this.metadata.loadElement:"image"===t&&void 0!==self.Image?this.data=new Image:this.data=document.createElement(t),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},t.prototype._loadSourceElement=function(t){if(this.metadata.loadElement?this.data=this.metadata.loadElement:"audio"===t&&void 0!==self.Audio?this.data=new Audio:this.data=document.createElement(t),null!==this.data){if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var e=this.metadata.mimeType,i=0;i<this.url.length;++i)this.data.appendChild(this._createSource(t,this.url[i],Array.isArray(e)?e[i]:e));else{e=this.metadata.mimeType;this.data.appendChild(this._createSource(t,this.url,Array.isArray(e)?e[0]:e))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))}else this.abort("Unsupported element: "+t)},t.prototype._loadXhr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var e=this.xhr=new XMLHttpRequest;e.open("GET",this.url,!0),e.timeout=this.timeout,this.xhrType===t.XHR_RESPONSE_TYPE.JSON||this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT?e.responseType=t.XHR_RESPONSE_TYPE.TEXT:e.responseType=this.xhrType,e.addEventListener("error",this._boundXhrOnError,!1),e.addEventListener("timeout",this._boundXhrOnTimeout,!1),e.addEventListener("abort",this._boundXhrOnAbort,!1),e.addEventListener("progress",this._boundOnProgress,!1),e.addEventListener("load",this._boundXhrOnLoad,!1),e.send()},t.prototype._loadXdr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var t=this.xhr=new self.XDomainRequest;t.timeout=this.timeout||5e3,t.onerror=this._boundXhrOnError,t.ontimeout=this._boundXhrOnTimeout,t.onprogress=this._boundOnProgress,t.onload=this._boundXhrOnLoad,t.open("GET",this.url,!0),setTimeout((function(){return t.send()}),1)},t.prototype._createSource=function(t,e,i){i||(i=t+"/"+this._getExtension(e));var r=document.createElement("source");return r.src=e,r.type=i,r},t.prototype._onError=function(t){this.abort("Failed to load element using: "+t.target.nodeName)},t.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(this,t.loaded/t.total)},t.prototype._onTimeout=function(){this.abort("Load timed out.")},t.prototype._xhrOnError=function(){var t=this.xhr;this.abort(Vc(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},t.prototype._xhrOnTimeout=function(){var t=this.xhr;this.abort(Vc(t)+" Request timed out.")},t.prototype._xhrOnAbort=function(){var t=this.xhr;this.abort(Vc(t)+" Request was aborted by the user.")},t.prototype._xhrOnLoad=function(){var e=this.xhr,i="",r=void 0===e.status?200:e.status;if(""!==e.responseType&&"text"!==e.responseType&&void 0!==e.responseType||(i=e.responseText),0===r&&(i.length>0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?r=200:1223===r&&(r=204),2===(r/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=i,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(i),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(self.DOMParser){var n=new DOMParser;this.data=n.parseFromString(i,"text/xml")}else{var o=document.createElement("div");o.innerHTML=i,this.data=o}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||i;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},t.prototype._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(self.origin!==self.location.origin)return"anonymous";e=e||self.location,Hc||(Hc=document.createElement("a")),Hc.href=t;var i=jc(Hc.href,{strictMode:!0}),r=!i.port&&""===e.port||i.port===e.port,n=i.protocol?i.protocol+":":"";return i.host===e.hostname&&r&&n===e.protocol?"":"anonymous"},t.prototype._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},t.prototype._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},t.prototype._getExtension=function(t){void 0===t&&(t=this.url);var e="";if(this.isDataUrl){var i=t.indexOf("/");e=t.substring(i+1,t.indexOf(";",i))}else{var r=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(r>-1?r:t.length,n>-1?n:t.length);e=(t=t.substring(0,o)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},t.prototype._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},t}();function Zc(){}function Jc(t){return function(){for(var e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];if(null===t)throw new Error("Callback was already called.");var n=t;t=null,n.apply(this,i)}}!function(t){var e,i,r,n;(e=t.STATUS_FLAGS||(t.STATUS_FLAGS={}))[e.NONE=0]="NONE",e[e.DATA_URL=1]="DATA_URL",e[e.COMPLETE=2]="COMPLETE",e[e.LOADING=4]="LOADING",(i=t.TYPE||(t.TYPE={}))[i.UNKNOWN=0]="UNKNOWN",i[i.JSON=1]="JSON",i[i.XML=2]="XML",i[i.IMAGE=3]="IMAGE",i[i.AUDIO=4]="AUDIO",i[i.VIDEO=5]="VIDEO",i[i.TEXT=6]="TEXT",(r=t.LOAD_TYPE||(t.LOAD_TYPE={}))[r.XHR=1]="XHR",r[r.IMAGE=2]="IMAGE",r[r.AUDIO=3]="AUDIO",r[r.VIDEO=4]="VIDEO",(n=t.XHR_RESPONSE_TYPE||(t.XHR_RESPONSE_TYPE={})).DEFAULT="text",n.BUFFER="arraybuffer",n.BLOB="blob",n.DOCUMENT="document",n.JSON="json",n.TEXT="text",t._loadTypeMap={gif:t.LOAD_TYPE.IMAGE,png:t.LOAD_TYPE.IMAGE,bmp:t.LOAD_TYPE.IMAGE,jpg:t.LOAD_TYPE.IMAGE,jpeg:t.LOAD_TYPE.IMAGE,tif:t.LOAD_TYPE.IMAGE,tiff:t.LOAD_TYPE.IMAGE,webp:t.LOAD_TYPE.IMAGE,tga:t.LOAD_TYPE.IMAGE,svg:t.LOAD_TYPE.IMAGE,"svg+xml":t.LOAD_TYPE.IMAGE,mp3:t.LOAD_TYPE.AUDIO,ogg:t.LOAD_TYPE.AUDIO,wav:t.LOAD_TYPE.AUDIO,mp4:t.LOAD_TYPE.VIDEO,webm:t.LOAD_TYPE.VIDEO},t._xhrTypeMap={xhtml:t.XHR_RESPONSE_TYPE.DOCUMENT,html:t.XHR_RESPONSE_TYPE.DOCUMENT,htm:t.XHR_RESPONSE_TYPE.DOCUMENT,xml:t.XHR_RESPONSE_TYPE.DOCUMENT,tmx:t.XHR_RESPONSE_TYPE.DOCUMENT,svg:t.XHR_RESPONSE_TYPE.DOCUMENT,tsx:t.XHR_RESPONSE_TYPE.DOCUMENT,gif:t.XHR_RESPONSE_TYPE.BLOB,png:t.XHR_RESPONSE_TYPE.BLOB,bmp:t.XHR_RESPONSE_TYPE.BLOB,jpg:t.XHR_RESPONSE_TYPE.BLOB,jpeg:t.XHR_RESPONSE_TYPE.BLOB,tif:t.XHR_RESPONSE_TYPE.BLOB,tiff:t.XHR_RESPONSE_TYPE.BLOB,webp:t.XHR_RESPONSE_TYPE.BLOB,tga:t.XHR_RESPONSE_TYPE.BLOB,json:t.XHR_RESPONSE_TYPE.JSON,text:t.XHR_RESPONSE_TYPE.TEXT,txt:t.XHR_RESPONSE_TYPE.TEXT,ttf:t.XHR_RESPONSE_TYPE.BUFFER,otf:t.XHR_RESPONSE_TYPE.BUFFER},t.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="}(qc||(qc={}));var Kc=function(t,e){this.data=t,this.callback=e},Qc=function(){function t(t,e){var i=this;if(void 0===e&&(e=1),this.workers=0,this.saturated=Zc,this.unsaturated=Zc,this.empty=Zc,this.drain=Zc,this.error=Zc,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(t,e,r){if(r&&"function"!=typeof r)throw new Error("task callback must be a function");if(i.started=!0,null==t&&i.idle())setTimeout((function(){return i.drain()}),1);else{var n=new Kc(t,"function"==typeof r?r:Zc);e?i._tasks.unshift(n):i._tasks.push(n),setTimeout(i.process,1)}},this.process=function(){for(;!i.paused&&i.workers<i.concurrency&&i._tasks.length;){var t=i._tasks.shift();0===i._tasks.length&&i.empty(),i.workers+=1,i.workers===i.concurrency&&i.saturated(),i._worker(t.data,Jc(i._next(t)))}},this._worker=t,0===e)throw new Error("Concurrency must not be zero");this.concurrency=e,this.buffer=e/4}return t.prototype._next=function(t){var e=this;return function(){for(var i=arguments,r=[],n=0;n<arguments.length;n++)r[n]=i[n];e.workers-=1,t.callback.apply(t,r),null!=r[0]&&e.error(r[0],t.data),e.workers<=e.concurrency-e.buffer&&e.unsaturated(),e.idle()&&e.drain(),e.process()}},t.prototype.push=function(t,e){this._insert(t,!1,e)},t.prototype.kill=function(){this.workers=0,this.drain=Zc,this.started=!1,this._tasks=[]},t.prototype.unshift=function(t,e){this._insert(t,!0,e)},t.prototype.length=function(){return this._tasks.length},t.prototype.running=function(){return this.workers},t.prototype.idle=function(){return this._tasks.length+this.workers===0},t.prototype.pause=function(){!0!==this.paused&&(this.paused=!0)},t.prototype.resume=function(){if(!1!==this.paused){this.paused=!1;for(var t=1;t<=this.concurrency;t++)this.process()}},t.eachSeries=function(t,e,i,r){var n=0,o=t.length;!function s(a){a||n===o?i&&i(a):r?setTimeout((function(){e(t[n++],s)}),1):e(t[n++],s)}()},t.queue=function(e,i){return new t(e,i)},t}(),$c=/(#[\w-]+)?$/,td=function(){function t(e,i){var r=this;void 0===e&&(e=""),void 0===i&&(i=10),this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(t,e){return r._loadResource(t,e)},this.resources={},this.baseUrl=e,this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(t,e){return r._loadResource(t,e)},this._queue=Qc.queue(this._boundLoadResource,i),this._queue.pause(),this.resources={},this.onProgress=new Xc,this.onError=new Xc,this.onLoad=new Xc,this.onStart=new Xc,this.onComplete=new Xc;for(var n=0;n<t._plugins.length;++n){var o=t._plugins[n],s=o.pre,a=o.use;s&&this.pre(s),a&&this.use(a)}this._protected=!1}return t.prototype._add=function(t,e,i,r){if(this.loading&&(!i||!i.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[t])throw new Error('Resource named "'+t+'" already exists.');if(e=this._prepareUrl(e),this.resources[t]=new qc(t,e,i),"function"==typeof r&&this.resources[t].onAfterMiddleware.once(r),this.loading){for(var n=i.parentResource,o=[],s=0;s<n.children.length;++s)n.children[s].isComplete||o.push(n.children[s]);var a=n.progressChunk*(o.length+1)/(o.length+2);n.children.push(this.resources[t]),n.progressChunk=a;for(s=0;s<o.length;++s)o[s].progressChunk=a;this.resources[t].progressChunk=a}return this._queue.push(this.resources[t]),this},t.prototype.pre=function(t){return this._beforeMiddleware.push(t),this},t.prototype.use=function(t){return this._afterMiddleware.push(t),this},t.prototype.reset=function(){for(var t in this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause(),this.resources){var e=this.resources[t];e._onLoadBinding&&e._onLoadBinding.detach(),e.isLoading&&e.abort("loader reset")}return this.resources={},this},t.prototype.load=function(t){if("function"==typeof t&&this.onComplete.once(t),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var e=100/this._queue._tasks.length,i=0;i<this._queue._tasks.length;++i)this._queue._tasks[i].data.progressChunk=e;this._onStart(),this._queue.resume()}return this},Object.defineProperty(t.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(t){this._queue.concurrency=t},enumerable:!1,configurable:!0}),t.prototype._prepareUrl=function(t){var e,i=jc(t,{strictMode:!0});if(e=i.protocol||!i.path||0===t.indexOf("//")?t:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&"/"!==t.charAt(0)?this.baseUrl+"/"+t:this.baseUrl+t,this.defaultQueryString){var r=$c.exec(e)[0];-1!==(e=e.substr(0,e.length-r.length)).indexOf("?")?e+="&"+this.defaultQueryString:e+="?"+this.defaultQueryString,e+=r}return e},t.prototype._loadResource=function(t,e){var i=this;t._dequeue=e,Qc.eachSeries(this._beforeMiddleware,(function(e,r){e.call(i,t,(function(){r(t.isComplete?{}:null)}))}),(function(){t.isComplete?i._onLoad(t):(t._onLoadBinding=t.onComplete.once(i._onLoad,i),t.load())}),!0)},t.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},t.prototype._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},t.prototype._onLoad=function(t){var e=this;t._onLoadBinding=null,this._resourcesParsing.push(t),t._dequeue(),Qc.eachSeries(this._afterMiddleware,(function(i,r){i.call(e,t,r)}),(function(){t.onAfterMiddleware.dispatch(t),e.progress=Math.min(100,e.progress+t.progressChunk),e.onProgress.dispatch(e,t),t.error?e.onError.dispatch(t.error,e,t):e.onLoad.dispatch(e,t),e._resourcesParsing.splice(e._resourcesParsing.indexOf(t),1),e._queue.idle()&&0===e._resourcesParsing.length&&e._onComplete()}),!0)},t.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(t,"shared",{get:function(){var e=t._shared;return e||((e=new t)._protected=!0,t._shared=e),e},enumerable:!1,configurable:!0}),t.registerPlugin=function(e){return t._plugins.push(e),e.add&&e.add(),t},t._plugins=[],t}();td.prototype.add=function(t,e,i,r){if(Array.isArray(t)){for(var n=0;n<t.length;++n)this.add(t[n]);return this}if("object"==typeof t&&(i=t,r=e||i.callback||i.onComplete,e=i.url,t=i.name||i.key||i.url),"string"!=typeof e&&(r=i,i=e,e=t),"string"!=typeof e)throw new Error("No url passed to add resource to loader.");return"function"==typeof i&&(r=i,i=null),this._add(t,e,i,r)};var ed=function(){function t(){}return t.init=function(t){t=Object.assign({sharedLoader:!1},t),this.loader=t.sharedLoader?td.shared:new td},t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t}(),id=function(){function t(){}return t.add=function(){qc.setExtensionLoadType("svg",qc.LOAD_TYPE.XHR),qc.setExtensionXhrType("svg",qc.XHR_RESPONSE_TYPE.TEXT)},t.use=function(t,e){if(!t.data||t.type!==qc.TYPE.IMAGE&&"svg"!==t.extension)e();else{var i=t.data,r=t.url,n=t.name,o=t.metadata;Uu.fromLoader(i,r,n,o).then((function(i){t.texture=i,e()})).catch(e)}},t}();var rd=self.URL||self.webkitURL;td.registerPlugin({use:function(t,e){if(t.data){if(t.xhr&&t.xhrType===qc.XHR_RESPONSE_TYPE.BLOB)if(self.Blob&&"string"!=typeof t.data){if(0===t.data.type.indexOf("image")){var i=rd.createObjectURL(t.data);return t.blob=t.data,t.data=new Image,t.data.src=i,t.type=qc.TYPE.IMAGE,void(t.data.onload=function(){rd.revokeObjectURL(i),t.data.onload=null,e()})}}else{var r=t.xhr.getResponseHeader("content-type");if(r&&0===r.indexOf("image"))return t.data=new Image,t.data.src="data:"+r+";base64,"+function(t){for(var e="",i=0;i<t.length;){for(var r=[0,0,0],n=[0,0,0,0],o=0;o<r.length;++o)i<t.length?r[o]=255&t.charCodeAt(i++):r[o]=0;switch(n[0]=r[0]>>2,n[1]=(3&r[0])<<4|r[1]>>4,n[2]=(15&r[1])<<2|r[2]>>6,n[3]=63&r[2],i-(t.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(o=0;o<n.length;++o)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n[o])}return e}(t.xhr.responseText),t.type=qc.TYPE.IMAGE,void(t.data.onload=function(){t.data.onload=null,e()})}e()}else e()}}),td.registerPlugin(id);
|
|
107
|
+
/*!
|
|
108
|
+
* @pixi/sprite - v6.1.3
|
|
109
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
110
|
+
*
|
|
111
|
+
* @pixi/sprite is licensed under the MIT License.
|
|
112
|
+
* http://www.opensource.org/licenses/mit-license
|
|
113
|
+
*/
|
|
114
|
+
/*! *****************************************************************************
|
|
115
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
116
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
117
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
118
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
119
|
+
|
|
120
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
121
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
122
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
123
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
124
|
+
|
|
125
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
126
|
+
and limitations under the License.
|
|
127
|
+
***************************************************************************** */
|
|
128
|
+
var nd=function(t,e){return nd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},nd(t,e)};var od=new ya,sd=new Uint16Array([0,1,2,0,2,3]),ad=function(t){function e(e){var i=t.call(this)||this;return i._anchor=new ga(i._onAnchorUpdate,i,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),i._texture=null,i._width=0,i._height=0,i._tint=null,i._tintRGB=null,i.tint=16777215,i.blendMode=js.NORMAL,i._cachedTint=16777215,i.uvs=null,i.texture=e||Uu.EMPTY,i.vertexData=new Float32Array(8),i.vertexTrimmedData=null,i._transformID=-1,i._textureID=-1,i._transformTrimmedID=-1,i._textureTrimmedID=-1,i.indices=sd,i.pluginName="batch",i.isSprite=!0,i._roundPixels=ph.ROUND_PIXELS,i}return function(t,e){function i(){this.constructor=t}nd(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Gl(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Gl(this.scale.y)*this._height/this._texture.orig.height)},e.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},e.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,o=e.d,s=e.tx,a=e.ty,h=this.vertexData,l=t.trim,u=t.orig,p=this._anchor,c=0,d=0,f=0,v=0;if(l?(c=(d=l.x-p._x*u.width)+l.width,f=(v=l.y-p._y*u.height)+l.height):(c=(d=-p._x*u.width)+u.width,f=(v=-p._y*u.height)+u.height),h[0]=i*d+n*v+s,h[1]=o*v+r*d+a,h[2]=i*c+n*v+s,h[3]=o*v+r*c+a,h[4]=i*c+n*f+s,h[5]=o*f+r*c+a,h[6]=i*d+n*f+s,h[7]=o*f+r*d+a,this._roundPixels)for(var y=ph.RESOLUTION,g=0;g<h.length;++g)h[g]=Math.round((h[g]*y|0)/y)}},e.prototype.calculateTrimmedVertices=function(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,n=this.transform.worldTransform,o=n.a,s=n.b,a=n.c,h=n.d,l=n.tx,u=n.ty,p=-r._x*i.width,c=p+i.width,d=-r._y*i.height,f=d+i.height;e[0]=o*p+a*d+l,e[1]=h*d+s*p+u,e[2]=o*c+a*d+l,e[3]=h*d+s*c+u,e[4]=o*c+a*f+l,e[5]=h*f+s*c+u,e[6]=o*p+a*f+l,e[7]=h*f+s*p+u},e.prototype._render=function(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)},e.prototype._calculateBounds=function(){var t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},e.prototype.getLocalBounds=function(e){return 0===this.children.length?(this._bounds.minX=this._texture.orig.width*-this._anchor._x,this._bounds.minY=this._texture.orig.height*-this._anchor._y,this._bounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._bounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new pa),e=this._localBoundsRect),this._bounds.getRectangle(e)):t.prototype.getLocalBounds.call(this,e)},e.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,od);var e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x,n=0;return od.x>=r&&od.x<r+e&&(n=-i*this.anchor.y,od.y>=n&&od.y<n+i)},e.prototype.destroy=function(e){if(t.prototype.destroy.call(this,e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof e?e:e&&e.texture){var i="boolean"==typeof e?e:e&&e.baseTexture;this._texture.destroy(!!i)}this._texture=null},e.from=function(t,i){return new e(t instanceof Uu?t:Uu.from(t,i))},Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){var e=Gl(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){var e=Gl(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(t){this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||Uu.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),e}(du),hd=function(t,e){return hd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},hd(t,e)};var ld=function(){function t(t){this._foundShapes=[],this.renderer=t}return t.prototype.pushMask=function(t){var e=this.renderer,i=t.maskObject||t;e.context.save();var r=this._foundShapes;if(this.recursiveFindShapes(i,r),r.length>0){var n=e.context;n.beginPath();for(var o=0;o<r.length;o++){var s=r[o],a=s.transform.worldTransform;this.renderer.setContextTransform(a),this.renderGraphicsShape(s)}r.length=0,n.clip()}},t.prototype.recursiveFindShapes=function(t,e){t.geometry&&t.geometry.graphicsData&&e.push(t);var i=t.children;if(i)for(var r=0;r<i.length;r++)this.recursiveFindShapes(i[r],e)},t.prototype.renderGraphicsShape=function(t){t.finishPoly();var e=this.renderer.context,i=t.geometry.graphicsData,r=i.length;if(0!==r)for(var n=0;n<r;n++){var o=i[n],s=o.shape;if(s.type===aa.POLY){var a=s.points,h=o.holes,l=void 0,u=void 0,p=void 0,c=void 0;e.moveTo(a[0],a[1]);for(var d=1;d<a.length/2;d++)e.lineTo(a[2*d],a[2*d+1]);if(h.length>0){l=0,p=a[0],c=a[1];for(d=2;d+2<a.length;d+=2)l+=(a[d]-p)*(a[d+3]-c)-(a[d+2]-p)*(a[d+1]-c);for(var f=0;f<h.length;f++)if(a=h[f].shape.points){u=0,p=a[0],c=a[1];for(d=2;d+2<a.length;d+=2)u+=(a[d]-p)*(a[d+3]-c)-(a[d+2]-p)*(a[d+1]-c);if(u*l<0){e.moveTo(a[0],a[1]);for(d=2;d<a.length;d+=2)e.lineTo(a[d],a[d+1])}else{e.moveTo(a[a.length-2],a[a.length-1]);for(d=a.length-4;d>=0;d-=2)e.lineTo(a[d],a[d+1])}h[f].shape.closeStroke&&e.closePath()}}a[0]===a[a.length-2]&&a[1]===a[a.length-1]&&e.closePath()}else if(s.type===aa.RECT)e.rect(s.x,s.y,s.width,s.height),e.closePath();else if(s.type===aa.CIRC)e.arc(s.x,s.y,s.radius,0,2*Math.PI),e.closePath();else if(s.type===aa.ELIP){var v=2*s.width,y=2*s.height,g=s.x-v/2,m=s.y-y/2,_=.5522848,x=v/2*_,b=y/2*_,P=g+v,w=m+y,E=g+v/2,T=m+y/2;e.moveTo(g,T),e.bezierCurveTo(g,T-b,E-x,m,E,m),e.bezierCurveTo(E+x,m,P,T-b,P,T),e.bezierCurveTo(P,T+b,E+x,w,E,w),e.bezierCurveTo(E-x,w,g,T+b,g,T),e.closePath()}else if(s.type===aa.RREC){var C=s.x,I=s.y,S=s.width,O=s.height,A=s.radius,M=Math.min(S,O)/2;A=A>M?M:A,e.moveTo(C,I+A),e.lineTo(C,I+O-A),e.quadraticCurveTo(C,I+O,C+A,I+O),e.lineTo(C+S-A,I+O),e.quadraticCurveTo(C+S,I+O,C+S,I+O-A),e.lineTo(C+S,I+A),e.quadraticCurveTo(C+S,I,C+S-A,I),e.lineTo(C+A,I),e.quadraticCurveTo(C,I,C,I+A),e.closePath()}}},t.prototype.popMask=function(t){t.context.restore(),t.invalidateBlendMode()},t.prototype.destroy=function(){},t}();function ud(t){var e=document.createElement("canvas");e.width=6,e.height=1;var i=e.getContext("2d");return i.fillStyle=t,i.fillRect(0,0,6,1),e}function pd(){if("undefined"==typeof document)return!1;var t=ud("#ff00ff"),e=ud("#ffff00"),i=document.createElement("canvas");i.width=6,i.height=1;var r=i.getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(t,0,0),r.drawImage(e,2,0);var n=r.getImageData(2,0,1,1);if(!n)return!1;var o=n.data;return 255===o[0]&&0===o[1]&&0===o[2]}var cd=new ma,dd=function(t){function e(i){var r,n=t.call(this,zs.CANVAS,i)||this;if(n.refresh=!0,n.maskManager=new ld(n),n.smoothProperty="imageSmoothingEnabled",n.blendModes=(void 0===r&&(r=[]),pd()?(r[js.NORMAL]="source-over",r[js.ADD]="lighter",r[js.MULTIPLY]="multiply",r[js.SCREEN]="screen",r[js.OVERLAY]="overlay",r[js.DARKEN]="darken",r[js.LIGHTEN]="lighten",r[js.COLOR_DODGE]="color-dodge",r[js.COLOR_BURN]="color-burn",r[js.HARD_LIGHT]="hard-light",r[js.SOFT_LIGHT]="soft-light",r[js.DIFFERENCE]="difference",r[js.EXCLUSION]="exclusion",r[js.HUE]="hue",r[js.SATURATION]="saturate",r[js.COLOR]="color",r[js.LUMINOSITY]="luminosity"):(r[js.NORMAL]="source-over",r[js.ADD]="lighter",r[js.MULTIPLY]="source-over",r[js.SCREEN]="source-over",r[js.OVERLAY]="source-over",r[js.DARKEN]="source-over",r[js.LIGHTEN]="source-over",r[js.COLOR_DODGE]="source-over",r[js.COLOR_BURN]="source-over",r[js.HARD_LIGHT]="source-over",r[js.SOFT_LIGHT]="source-over",r[js.DIFFERENCE]="source-over",r[js.EXCLUSION]="source-over",r[js.HUE]="source-over",r[js.SATURATION]="source-over",r[js.COLOR]="source-over",r[js.LUMINOSITY]="source-over"),r[js.NORMAL_NPM]=r[js.NORMAL],r[js.ADD_NPM]=r[js.ADD],r[js.SCREEN_NPM]=r[js.SCREEN],r[js.SRC_IN]="source-in",r[js.SRC_OUT]="source-out",r[js.SRC_ATOP]="source-atop",r[js.DST_OVER]="destination-over",r[js.DST_IN]="destination-in",r[js.DST_OUT]="destination-out",r[js.DST_ATOP]="destination-atop",r[js.XOR]="xor",r[js.SUBTRACT]="source-over",r),n.renderingToScreen=!1,n._activeBlendMode=null,n._projTransform=null,n._outerBlend=!1,n.rootContext=n.view.getContext("2d",{alpha:n.useContextAlpha}),n.context=n.rootContext,!n.rootContext.imageSmoothingEnabled){var o=n.rootContext;o.webkitImageSmoothingEnabled?n.smoothProperty="webkitImageSmoothingEnabled":o.mozImageSmoothingEnabled?n.smoothProperty="mozImageSmoothingEnabled":o.oImageSmoothingEnabled?n.smoothProperty="oImageSmoothingEnabled":o.msImageSmoothingEnabled&&(n.smoothProperty="msImageSmoothingEnabled")}return n.initPlugins(e.__plugins),Al("Canvas"),n.resize(n.options.width,n.options.height),n}return function(t,e){function i(){this.constructor=t}hd(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype.render=function(t,e){if(this.view){var i,r,n,o;e&&(e instanceof Xu||e instanceof ku?(Zl("6.0.0","CanvasRenderer#render arguments changed, use options instead."),i=e,r=arguments[2],n=arguments[3],o=arguments[4]):(i=e.renderTexture,r=e.clear,n=e.transform,o=e.skipUpdateTransform)),this.renderingToScreen=!i,this.emit("prerender");var s=this.resolution;i?((i=i.castToBaseTexture())._canvasRenderTarget||(i._canvasRenderTarget=new tu(i.width,i.height,i.resolution),i.resource=new Iu(i._canvasRenderTarget.canvas),i.valid=!0),this.context=i._canvasRenderTarget.context,this.resolution=i._canvasRenderTarget.resolution):this.context=this.rootContext;var a=this.context;if(this._projTransform=n||null,i||(this._lastObjectRendered=t),!o){var h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}if(a.save(),a.setTransform(1,0,0,1,0,0),a.globalAlpha=1,this._activeBlendMode=js.NORMAL,this._outerBlend=!1,a.globalCompositeOperation=this.blendModes[js.NORMAL],void 0!==r?r:this.clearBeforeRender)if(this.renderingToScreen)a.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(a.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,a.fillStyle=this._backgroundColorString,a.fillRect(0,0,this.width,this.height),a.globalAlpha=1);else{(i=i)._canvasRenderTarget.clear();var l=i.clearColor;l[3]>0&&(a.globalAlpha=this.useContextAlpha?l[3]:1,a.fillStyle=Rl(kl(l)),a.fillRect(0,0,i.realWidth,i.realHeight),a.globalAlpha=1)}var u=this.context;this.context=a,t.renderCanvas(this),this.context=u,a.restore(),this.resolution=s,this._projTransform=null,this.emit("postrender")}},e.prototype.setContextTransform=function(t,e,i){var r=t,n=this._projTransform,o=this.resolution;i=i||o,n&&((r=cd).copyFrom(t),r.prepend(n)),e?this.context.setTransform(r.a*i,r.b*i,r.c*i,r.d*i,r.tx*o|0,r.ty*o|0):this.context.setTransform(r.a*i,r.b*i,r.c*i,r.d*i,r.tx*o,r.ty*o)},e.prototype.clear=function(t,e){void 0===t&&(t=this._backgroundColorString),void 0===e&&(e=this.backgroundAlpha);var i=this.context;i.clearRect(0,0,this.width,this.height),t&&(i.globalAlpha=this.useContextAlpha?e:1,i.fillStyle=t,i.fillRect(0,0,this.width,this.height),i.globalAlpha=1)},e.prototype.setBlendMode=function(t,e){var i=t===js.SRC_IN||t===js.SRC_OUT||t===js.DST_IN||t===js.DST_ATOP;!e&&i&&(t=js.NORMAL),this._activeBlendMode!==t&&(this._activeBlendMode=t,this._outerBlend=i,this.context.globalCompositeOperation=this.blendModes[t])},e.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},e.prototype.resize=function(e,i){t.prototype.resize.call(this,e,i),this.smoothProperty&&(this.rootContext[this.smoothProperty]=ph.SCALE_MODE===qs.LINEAR)},e.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},e.registerPlugin=function(t,i){e.__plugins=e.__plugins||{},e.__plugins[t]=i},e}(gc),fd={canvas:null,getTintedCanvas:function(t,e){var i=t.texture,r="#"+("00000"+(0|(e=fd.roundColor(e))).toString(16)).substr(-6);i.tintCache=i.tintCache||{};var n,o=i.tintCache[r];if(o){if(o.tintId===i._updateID)return i.tintCache[r];n=i.tintCache[r]}else n=document.createElement("canvas");if(fd.tintMethod(i,e,n),n.tintId=i._updateID,fd.convertTintToImage){var s=new Image;s.src=n.toDataURL(),i.tintCache[r]=s}else i.tintCache[r]=n;return n},getTintedPattern:function(t,e){var i="#"+("00000"+(0|(e=fd.roundColor(e))).toString(16)).substr(-6);t.patternCache=t.patternCache||{};var r=t.patternCache[i];return r&&r.tintId===t._updateID||(fd.canvas||(fd.canvas=document.createElement("canvas")),fd.tintMethod(t,e,fd.canvas),(r=fd.canvas.getContext("2d").createPattern(fd.canvas,"repeat")).tintId=t._updateID,t.patternCache[i]=r),r},tintWithMultiply:function(t,e,i){var r=i.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,i.width=Math.ceil(n.width),i.height=Math.ceil(n.height),r.save(),r.fillStyle="#"+("00000"+(0|e).toString(16)).substr(-6),r.fillRect(0,0,n.width,n.height),r.globalCompositeOperation="multiply";var s=t.baseTexture.getDrawableSource();r.drawImage(s,n.x,n.y,n.width,n.height,0,0,n.width,n.height),r.globalCompositeOperation="destination-atop",r.drawImage(s,n.x,n.y,n.width,n.height,0,0,n.width,n.height),r.restore()},tintWithOverlay:function(t,e,i){var r=i.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,i.width=Math.ceil(n.width),i.height=Math.ceil(n.height),r.save(),r.globalCompositeOperation="copy",r.fillStyle="#"+("00000"+(0|e).toString(16)).substr(-6),r.fillRect(0,0,n.width,n.height),r.globalCompositeOperation="destination-atop",r.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),r.restore()},tintWithPerPixel:function(t,e,i){var r=i.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,i.width=Math.ceil(n.width),i.height=Math.ceil(n.height),r.save(),r.globalCompositeOperation="copy",r.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),r.restore();for(var s=Nl(e),a=s[0],h=s[1],l=s[2],u=r.getImageData(0,0,n.width,n.height),p=u.data,c=0;c<p.length;c+=4)p[c+0]*=a,p[c+1]*=h,p[c+2]*=l;r.putImageData(u,0,0)},roundColor:function(t){var e=fd.cacheStepsPerColorChannel,i=Nl(t);return i[0]=Math.min(255,i[0]/e*e),i[1]=Math.min(255,i[1]/e*e),i[2]=Math.min(255,i[2]/e*e),kl(i)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:pd(),tintMethod:null};fd.tintMethod=fd.canUseMultiply?fd.tintWithMultiply:fd.tintWithPerPixel;var vd=xc.create;xc.create=function(t){if(!(t&&t.forceCanvas))try{return vd(t)}catch(t){}return new dd(t)},wu.prototype.getDrawableSource=function(){var t=this.resource;return t?t.bitmap||t.source:null},ku.prototype._canvasRenderTarget=null,Uu.prototype.patternCache=null,Uu.prototype.tintCache=null;
|
|
129
|
+
/*!
|
|
130
|
+
* @pixi/canvas-extract - v6.1.3
|
|
131
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
132
|
+
*
|
|
133
|
+
* @pixi/canvas-extract is licensed under the MIT License.
|
|
134
|
+
* http://www.opensource.org/licenses/mit-license
|
|
135
|
+
*/
|
|
136
|
+
var yd,gd,md=new pa,_d=function(){function t(t){this.renderer=t}return t.prototype.image=function(t,e,i){var r=new Image;return r.src=this.base64(t,e,i),r},t.prototype.base64=function(t,e,i){return this.canvas(t).toDataURL(e,i)},t.prototype.canvas=function(t){var e,i,r,n,o=this.renderer;t&&(n=t instanceof Xu?t:o.generateTexture(t)),n?(e=n.baseTexture._canvasRenderTarget.context,i=n.baseTexture._canvasRenderTarget.resolution,r=n.frame):(e=o.rootContext,i=o.resolution,(r=md).width=this.renderer.width,r.height=this.renderer.height);var s=Math.floor(r.width*i+1e-4),a=Math.floor(r.height*i+1e-4),h=new tu(s,a,1),l=e.getImageData(r.x*i,r.y*i,s,a);return h.context.putImageData(l,0,0),h.canvas},t.prototype.pixels=function(t){var e,i,r,n,o=this.renderer;t&&(n=t instanceof Xu?t:o.generateTexture(t)),n?(e=n.baseTexture._canvasRenderTarget.context,i=n.baseTexture._canvasRenderTarget.resolution,r=n.frame):(e=o.rootContext,i=o.resolution,(r=md).width=o.width,r.height=o.height);var s=r.x*i,a=r.y*i,h=r.width*i,l=r.height*i;return e.getImageData(s,a,h,l).data},t.prototype.destroy=function(){this.renderer=null},t}();!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(yd||(yd={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(gd||(gd={}));var xd={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},bd=function(){function t(){this.color=16777215,this.alpha=1,this.texture=Uu.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=Uu.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),Pd=function(t,e){return Pd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Pd(t,e)};function wd(t,e){function i(){this.constructor=t}Pd(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var Ed={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,o=e.indices;if(i.length>=6){for(var s=[],a=0;a<r.length;a++){var h=r[a];s.push(i.length/2),i=i.concat(h.points)}var l=yh(i,s,2);if(!l)return;var u=n.length/2;for(a=0;a<l.length;a+=3)o.push(l[a]+u),o.push(l[a+1]+u),o.push(l[a+2]+u);for(a=0;a<i.length;a++)n.push(i[a])}}},Td={build:function(t){var e,i,r=t.shape,n=t.points,o=r.x,s=r.y;if(n.length=0,t.type===aa.CIRC)e=r.radius,i=r.radius;else{var a=t.shape;e=a.width,i=a.height}if(0!==e&&0!==i){var h=Math.floor(30*Math.sqrt(r.radius))||Math.floor(15*Math.sqrt(e+i));h/=2.3;for(var l=2*Math.PI/h,u=0;u<h-.5;u++)n.push(o+Math.sin(-l*u)*e,s+Math.cos(-l*u)*i);n.push(n[0],n[1])}},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices,o=r.length/2,s=o,a=t.shape,h=t.matrix,l=a.x,u=a.y;r.push(t.matrix?h.a*l+h.c*u+h.tx:l,t.matrix?h.b*l+h.d*u+h.ty:u);for(var p=0;p<i.length;p+=2)r.push(i[p],i[p+1]),n.push(o++,s,o)}},Cd={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,o=e.height,s=t.points;s.length=0,s.push(i,r,i+n,r,i+n,r+o,i,r+o)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function Id(t,e,i){return t+(e-t)*i}function Sd(t,e,i,r,n,o,s){void 0===s&&(s=[]);for(var a=s,h=0,l=0,u=0,p=0,c=0,d=0,f=0,v=0;f<=20;++f)h=Id(t,i,v=f/20),l=Id(e,r,v),u=Id(i,n,v),p=Id(r,o,v),c=Id(h,u,v),d=Id(l,p,v),0===f&&a[a.length-2]===c&&a[a.length-1]===d||a.push(c,d);return a}var Od={build:function(t){var e=t.shape,i=t.points,r=e.x,n=e.y,o=e.width,s=e.height,a=Math.max(0,Math.min(e.radius,Math.min(o,s)/2));i.length=0,a?(Sd(r,n+a,r,n,r+a,n,i),Sd(r+o-a,n,r+o,n,r+o,n+a,i),Sd(r+o,n+s-a,r+o,n+s,r+o-a,n+s,i),Sd(r+a,n+s,r,n+s,r,n+s-a,i)):i.push(r,n,r+o,n,r+o,n+s,r,n+s)},triangulate:function(t,e){for(var i=t.points,r=e.points,n=e.indices,o=r.length/2,s=yh(i,null,2),a=0,h=s.length;a<h;a+=3)n.push(s[a]+o),n.push(s[a+1]+o),n.push(s[a+2]+o);for(a=0,h=i.length;a<h;a++)r.push(i[a],i[++a])}};function Ad(t,e,i,r,n,o,s,a){var h,l;s?(h=r,l=-i):(h=-r,l=i);var u=t-i*n+h,p=e-r*n+l,c=t+i*o+h,d=e+r*o+l;return a.push(u,p),a.push(c,d),2}function Md(t,e,i,r,n,o,s,a){var h=i-t,l=r-e,u=Math.atan2(h,l),p=Math.atan2(n-t,o-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(p+=2*Math.PI);var c=u,d=p-u,f=Math.abs(d),v=Math.sqrt(h*h+l*l),y=1+(15*f*Math.sqrt(v)/Math.PI>>0),g=d/y;if(c+=g,a){s.push(t,e),s.push(i,r);for(var m=1,_=c;m<y;m++,_+=g)s.push(t,e),s.push(t+Math.sin(_)*v,e+Math.cos(_)*v);s.push(t,e),s.push(n,o)}else{s.push(i,r),s.push(t,e);for(m=1,_=c;m<y;m++,_+=g)s.push(t+Math.sin(_)*v,e+Math.cos(_)*v),s.push(t,e);s.push(n,o),s.push(t,e)}return 2*y}function Ld(t,e){t.lineStyle.native?function(t,e){var i=0,r=t.shape,n=t.points||r.points,o=r.type!==aa.POLY||r.closeStroke;if(0!==n.length){var s=e.points,a=e.indices,h=n.length/2,l=s.length/2,u=l;for(s.push(n[0],n[1]),i=1;i<h;i++)s.push(n[2*i],n[2*i+1]),a.push(u,u+1),u++;o&&a.push(u,l)}}(t,e):function(t,e){var i=t.shape,r=t.points||i.points.slice(),n=e.closePointEps;if(0!==r.length){var o=t.lineStyle,s=new ya(r[0],r[1]),a=new ya(r[r.length-2],r[r.length-1]),h=i.type!==aa.POLY||i.closeStroke,l=Math.abs(s.x-a.x)<n&&Math.abs(s.y-a.y)<n;if(h){r=r.slice(),l&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));var u=.5*(s.x+a.x),p=.5*(a.y+s.y);r.unshift(u,p),r.push(u,p)}var c=e.points,d=r.length/2,f=r.length,v=c.length/2,y=o.width/2,g=y*y,m=o.miterLimit*o.miterLimit,_=r[0],x=r[1],b=r[2],P=r[3],w=0,E=0,T=-(x-P),C=_-b,I=0,S=0,O=Math.sqrt(T*T+C*C);T/=O,C/=O,T*=y,C*=y;var A=o.alignment,M=2*(1-A),L=2*A;h||(o.cap===gd.ROUND?f+=Md(_-T*(M-L)*.5,x-C*(M-L)*.5,_-T*M,x-C*M,_+T*L,x+C*L,c,!0)+2:o.cap===gd.SQUARE&&(f+=Ad(_,x,T,C,M,L,!0,c))),c.push(_-T*M,x-C*M),c.push(_+T*L,x+C*L);for(var N=1;N<d-1;++N){_=r[2*(N-1)],x=r[2*(N-1)+1],b=r[2*N],P=r[2*N+1],w=r[2*(N+1)],E=r[2*(N+1)+1],T=-(x-P),C=_-b,T/=O=Math.sqrt(T*T+C*C),C/=O,T*=y,C*=y,I=-(P-E),S=b-w,I/=O=Math.sqrt(I*I+S*S),S/=O,I*=y,S*=y;var R=b-_,D=x-P,k=b-w,F=E-P,B=D*k-F*R,U=B<0;if(Math.abs(B)<.1)c.push(b-T*M,P-C*M),c.push(b+T*L,P+C*L);else{var z=(-T+_)*(-C+P)-(-T+b)*(-C+x),X=(-I+w)*(-S+P)-(-I+b)*(-S+E),j=(R*X-k*z)/B,Y=(F*z-D*X)/B,H=(j-b)*(j-b)+(Y-P)*(Y-P),G=b+(j-b)*M,W=P+(Y-P)*M,V=b-(j-b)*L,q=P-(Y-P)*L,Z=U?M:L;H<=Math.min(R*R+D*D,k*k+F*F)+Z*Z*g?o.join===yd.BEVEL||H/g>m?(U?(c.push(G,W),c.push(b+T*L,P+C*L),c.push(G,W),c.push(b+I*L,P+S*L)):(c.push(b-T*M,P-C*M),c.push(V,q),c.push(b-I*M,P-S*M),c.push(V,q)),f+=2):o.join===yd.ROUND?U?(c.push(G,W),c.push(b+T*L,P+C*L),f+=Md(b,P,b+T*L,P+C*L,b+I*L,P+S*L,c,!0)+4,c.push(G,W),c.push(b+I*L,P+S*L)):(c.push(b-T*M,P-C*M),c.push(V,q),f+=Md(b,P,b-T*M,P-C*M,b-I*M,P-S*M,c,!1)+4,c.push(b-I*M,P-S*M),c.push(V,q)):(c.push(G,W),c.push(V,q)):(c.push(b-T*M,P-C*M),c.push(b+T*L,P+C*L),o.join===yd.BEVEL||H/g>m||(o.join===yd.ROUND?f+=U?Md(b,P,b+T*L,P+C*L,b+I*L,P+S*L,c,!0)+2:Md(b,P,b-T*M,P-C*M,b-I*M,P-S*M,c,!1)+2:(U?(c.push(V,q),c.push(V,q)):(c.push(G,W),c.push(G,W)),f+=2)),c.push(b-I*M,P-S*M),c.push(b+I*L,P+S*L),f+=2)}}_=r[2*(d-2)],x=r[2*(d-2)+1],b=r[2*(d-1)],T=-(x-(P=r[2*(d-1)+1])),C=_-b,T/=O=Math.sqrt(T*T+C*C),C/=O,T*=y,C*=y,c.push(b-T*M,P-C*M),c.push(b+T*L,P+C*L),h||(o.cap===gd.ROUND?f+=Md(b-T*(M-L)*.5,P-C*(M-L)*.5,b-T*M,P-C*M,b+T*L,P+C*L,c,!1)+2:o.cap===gd.SQUARE&&(f+=Ad(b,P,T,C,M,L,!1,c)));var J=e.indices,K=xd.epsilon*xd.epsilon;for(N=v;N<f+v-2;++N)_=c[2*N],x=c[2*N+1],b=c[2*(N+1)],P=c[2*(N+1)+1],w=c[2*(N+2)],E=c[2*(N+2)+1],Math.abs(_*(P-E)+b*(E-x)+w*(x-P))<K||J.push(N,N+1,N+2)}}(t,e)}var Nd,Rd=function(){function t(){}return t.curveTo=function(t,e,i,r,n,o){var s=o[o.length-2],a=o[o.length-1]-e,h=s-t,l=r-e,u=i-t,p=Math.abs(a*u-h*l);if(p<1e-8||0===n)return o[o.length-2]===t&&o[o.length-1]===e||o.push(t,e),null;var c=a*a+h*h,d=l*l+u*u,f=a*l+h*u,v=n*Math.sqrt(c)/p,y=n*Math.sqrt(d)/p,g=v*f/c,m=y*f/d,_=v*u+y*h,x=v*l+y*a,b=h*(y+g),P=a*(y+g),w=u*(v+m),E=l*(v+m);return{cx:_+t,cy:x+e,radius:n,startAngle:Math.atan2(P-x,b-_),endAngle:Math.atan2(E-x,w-_),anticlockwise:h*l>u*a}},t.arc=function(t,e,i,r,n,o,s,a,h){for(var l=s-o,u=xd._segmentsCount(Math.abs(l)*n,40*Math.ceil(Math.abs(l)/ha)),p=l/(2*u),c=2*p,d=Math.cos(p),f=Math.sin(p),v=u-1,y=v%1/v,g=0;g<=v;++g){var m=p+o+c*(g+y*g),_=Math.cos(m),x=-Math.sin(m);h.push((d*_+f*x)*n+i,(d*-x+f*_)*n+r)}},t}(),Dd=function(){function t(){}return t.curveLength=function(t,e,i,r,n,o,s,a){for(var h=0,l=0,u=0,p=0,c=0,d=0,f=0,v=0,y=0,g=0,m=0,_=t,x=e,b=1;b<=10;++b)g=_-(v=(f=(d=(c=1-(l=b/10))*c)*c)*t+3*d*l*i+3*c*(u=l*l)*n+(p=u*l)*s),m=x-(y=f*e+3*d*l*r+3*c*u*o+p*a),_=v,x=y,h+=Math.sqrt(g*g+m*m);return h},t.curveTo=function(e,i,r,n,o,s,a){var h=a[a.length-2],l=a[a.length-1];a.length-=2;var u=xd._segmentsCount(t.curveLength(h,l,e,i,r,n,o,s)),p=0,c=0,d=0,f=0,v=0;a.push(h,l);for(var y=1,g=0;y<=u;++y)d=(c=(p=1-(g=y/u))*p)*p,v=(f=g*g)*g,a.push(d*h+3*c*g*e+3*p*f*r+v*o,d*l+3*c*g*i+3*p*f*n+v*s)},t}(),kd=function(){function t(){}return t.curveLength=function(t,e,i,r,n,o){var s=t-2*i+n,a=e-2*r+o,h=2*i-2*t,l=2*r-2*e,u=4*(s*s+a*a),p=4*(s*h+a*l),c=h*h+l*l,d=2*Math.sqrt(u+p+c),f=Math.sqrt(u),v=2*u*f,y=2*Math.sqrt(c),g=p/f;return(v*d+f*p*(d-y)+(4*c*u-p*p)*Math.log((2*f+g+d)/(g+y)))/(4*v)},t.curveTo=function(e,i,r,n,o){for(var s=o[o.length-2],a=o[o.length-1],h=xd._segmentsCount(t.curveLength(s,a,e,i,r,n)),l=0,u=0,p=1;p<=h;++p){var c=p/h;l=s+(e-s)*c,u=a+(i-a)*c,o.push(l+(e+(r-e)*c-l)*c,u+(i+(n-i)*c-u)*c)}},t}(),Fd=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),Bd=((Nd={})[aa.POLY]=Ed,Nd[aa.CIRC]=Td,Nd[aa.ELIP]=Td,Nd[aa.RECT]=Cd,Nd[aa.RREC]=Od,Nd),Ud=[],zd=[];function Xd(t){for(var e=t.points,i=0,r=0;r<e.length-2;r+=2)i+=(e[r+2]-e[r])*(e[r+3]+e[r+1]);return i>0}var jd=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),Yd=new ya,Hd=new au,Gd=function(t){function e(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new au,e.boundsDirty=-1,e}return wd(e,t),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),zd.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),Ud.push(e)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new jd(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},e.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new jd(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,Yd):Yd.copyFrom(t),r.shape.contains(Yd.x,Yd.y)))){var n=!1;if(r.holes)for(var o=0;o<r.holes.length;o++){if(r.holes[o].shape.contains(Yd.x,Yd.y)){n=!0;break}}if(!n)return!0}}return!1},e.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,n=null;this.batches.length>0&&(n=(r=this.batches[this.batches.length-1]).style);for(var o=this.shapeIndex;o<i.length;o++){this.shapeIndex++;var s=i[o],a=s.fillStyle,h=s.lineStyle;Bd[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix);for(var l=0;l<2;l++){var u=0===l?a:h;if(u.visible){var p=u.texture.baseTexture,c=this.indices.length,d=this.points.length/2;p.wrapMode=Zs.REPEAT,0===l?this.processFill(s):this.processLine(s);var f=this.points.length/2-d;0!==f&&(r&&!this._compareStyles(n,u)&&(r.end(c,d),r=null),r||((r=Ud.pop()||new Fd).begin(u,c,d),this.batches.push(r),n=u),this.addUvs(this.points,e,u.texture,d,f,u.matrix))}}}var v=this.indices.length,y=this.points.length/2;if(r&&r.end(v,y),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var g=y>65535&&t;this.indicesUint16=g?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},e.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var o=r.start+n;this.indicesUint16[o]=this.indicesUint16[o]-r.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*e.BATCHABLE_SIZE},e.prototype.buildDrawCalls=function(){for(var t=++wu._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),zd.push(this.drawCalls[e]);this.drawCalls.length=0;var i=this.colors,r=this.textureIds,n=zd.pop();n||((n=new Ec).texArray=new Tc),n.texArray.count=0,n.start=0,n.size=0,n.type=Ys.TRIANGLES;var o=0,s=null,a=0,h=!1,l=Ys.TRIANGLES,u=0;this.drawCalls.push(n);for(e=0;e<this.batches.length;e++){var p=this.batches[e],c=p.style,d=c.texture.baseTexture;h!==!!c.native&&(l=(h=!!c.native)?Ys.LINES:Ys.TRIANGLES,s=null,o=8,t++),s!==d&&(s=d,d._batchEnabled!==t&&(8===o&&(t++,o=0,n.size>0&&((n=zd.pop())||((n=new Ec).texArray=new Tc),this.drawCalls.push(n)),n.start=u,n.size=0,n.texArray.count=0,n.type=l),d.touched=1,d._batchEnabled=t,d._batchLocation=o,d.wrapMode=Zs.REPEAT,n.texArray.elements[n.texArray.count++]=d,o++)),n.size+=p.size,u+=p.size,a=d._batchLocation,this.addColors(i,c.color,c.alpha,p.attribSize,p.attribStart),this.addTextureIds(r,a,p.attribSize,p.attribStart)}wu._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),o=new Float32Array(n),s=new Uint32Array(n),a=0,h=0;h<t.length/2;h++)o[a++]=t[2*h],o[a++]=t[2*h+1],o[a++]=e[2*h],o[a++]=e[2*h+1],s[a++]=i[h],o[a++]=r[h];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),Ed.triangulate(t,this)):Bd[t.type].triangulate(t,this)},e.prototype.processLine=function(t){Ld(t,this);for(var e=0;e<t.holes.length;e++)Ld(t.holes[e],this)},e.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];Bd[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds,e=Hd,i=ma.IDENTITY;this._bounds.clear(),e.clear();for(var r=0;r<this.graphicsData.length;r++){var n=this.graphicsData[r],o=n.shape,s=n.type,a=n.lineStyle,h=n.matrix||ma.IDENTITY,l=0;if(a&&a.visible){var u=a.alignment;l=a.width,s===aa.POLY?Xd(o)?l*=1-u:l*=u:l*=Math.max(0,u)}if(i!==h&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=h),s===aa.RECT||s===aa.RREC){var p=o;e.addFramePad(p.x,p.y,p.x+p.width,p.y+p.height,l,l)}else if(s===aa.CIRC){var c=o;e.addFramePad(c.x,c.y,c.x,c.y,c.radius+l,c.radius+l)}else if(s===aa.ELIP){var d=o;e.addFramePad(d.x,d.y,d.x,d.y,d.width+l,d.height+l)}else{var f=o;t.addVerticesMatrix(i,f.points,0,f.points.length,l,l)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},e.prototype.addColors=function(t,e,i,r,n){void 0===n&&(n=0);var o=Bl((e>>16)+(65280&e)+((255&e)<<16),i);t.length=Math.max(t.length,n+r);for(var s=0;s<r;s++)t[n+s]=o},e.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var n=0;n<i;n++)t[r+n]=e},e.prototype.addUvs=function(t,e,i,r,n,o){void 0===o&&(o=null);for(var s=0,a=e.length,h=i.frame;s<n;){var l=t[2*(r+s)],u=t[2*(r+s)+1];if(o){var p=o.a*l+o.c*u+o.tx;u=o.b*l+o.d*u+o.ty,l=p}s++,e.push(l/h.width,u/h.height)}var c=i.baseTexture;(h.width<c.width||h.height<c.height)&&this.adjustUvs(e,i,a,n)},e.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,o=1e-6,s=i+2*r,a=e.frame,h=a.width/n.width,l=a.height/n.height,u=a.x/a.width,p=a.y/a.height,c=Math.floor(t[i]+o),d=Math.floor(t[i+1]+o),f=i+2;f<s;f+=2)c=Math.min(c,Math.floor(t[f]+o)),d=Math.min(d,Math.floor(t[f+1]+o));u-=c,p-=d;for(f=i;f<s;f+=2)t[f]=(t[f]+u)*h,t[f+1]=(t[f+1]+p)*l},e.BATCHABLE_SIZE=100,e}(Oc),Wd=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=gd.BUTT,e.join=yd.MITER,e.miterLimit=10,e}return wd(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(bd),Vd=new Float32Array(3),qd={},Zd=function(t){function e(e){void 0===e&&(e=null);var i=t.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new bd,i._lineStyle=new Wd,i._matrix=null,i._holeMode=!1,i.state=zp.for2d(),i._geometry=e||new Gd,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=js.NORMAL,i}return wd(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t,e,i,r,n){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===n&&(n=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:Uu.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:gd.BUTT,join:yd.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var e=t.width>0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},t)):this._lineStyle.reset(),this},e.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new fa,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new fa,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},e.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},e.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},e.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),kd.curveTo(t,e,i,r,n),this},e.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this._initCurve(),Dd.curveTo(t,e,i,r,n,o,this.currentPath.points),this},e.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var o=this.currentPath.points,s=Rd.curveTo(t,e,i,r,n,o);if(s){var a=s.cx,h=s.cy,l=s.radius,u=s.startAngle,p=s.endAngle,c=s.anticlockwise;this.arc(a,h,l,u,p,c)}return this},e.prototype.arc=function(t,e,i,r,n,o){if(void 0===o&&(o=!1),r===n)return this;if(!o&&n<=r?n+=ha:o&&r<=n&&(r+=ha),0===n-r)return this;var s=t+Math.cos(r)*i,a=e+Math.sin(r)*i,h=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){var u=Math.abs(l[l.length-2]-s),p=Math.abs(l[l.length-1]-a);u<h&&p<h||l.push(s,a)}else this.moveTo(s,a),l=this.currentPath.points;return Rd.arc(s,a,t,e,i,r,n,o,l),this},e.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill({texture:Uu.WHITE,color:t,alpha:e})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:Uu.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var e=t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,e,i,r){return this.drawShape(new pa(t,e,i,r))},e.prototype.drawRoundedRect=function(t,e,i,r,n){return this.drawShape(new va(t,e,i,r,n))},e.prototype.drawCircle=function(t,e,i){return this.drawShape(new ca(t,e,i))},e.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new da(t,e,i,r))},e.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var n=!0,o=i[0];o.points?(n=o.closeStroke,t=o.points):t=Array.isArray(i[0])?i[0]:i;var s=new fa(t);return s.closeStroke=n,this.drawShape(s),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==aa.RECT||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],o=n.style.color,s=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),a=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),h={vertexData:s,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:a,_batchRGB:Nl(o),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=h}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},e.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,o=e.uniforms,s=i.drawCalls;o.translationMatrix=this.transform.worldTransform,o.tint[0]=(r>>16&255)/255*n,o.tint[1]=(r>>8&255)/255*n,o.tint[2]=(255&r)/255*n,o.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,h=s.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},e.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,o=e.start,s=i.count,a=0;a<s;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,o)},e.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!qd[i]){for(var r=t.plugins.batch.MAX_TEXTURES,n=new Int32Array(r),o=0;o<r;o++)n[o]=o;var s={tint:new Float32Array([1,1,1,1]),translationMatrix:new ma,default:tp.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;qd[i]=new Up(a,s)}e=qd[i]}return e},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,o=e.maxY;this._bounds.addFrame(this.transform,i,r,n,o)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=Nl(this.tint,Vd),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},e.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,o=e.d,s=e.tx,a=e.ty,h=this._geometry.points,l=this.vertexData,u=0,p=0;p<h.length;p+=2){var c=h[p],d=h[p+1];l[u++]=i*c+n*d+s,l[u++]=o*d+r*c+a}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},e.prototype.setMatrix=function(t){return this._matrix=t,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(e){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,e)},e._TEMP_POINT=new ya,e}(du),Jd={buildPoly:Ed,buildCircle:Td,buildRectangle:Cd,buildRoundedRectangle:Od,buildLine:Ld,ArcUtils:Rd,BezierUtils:Dd,QuadraticUtils:kd,BatchPart:Fd,FILL_COMMANDS:Bd,BATCH_POOL:Ud,DRAW_CALL_POOL:zd},Kd=new ma,Qd=function(){function t(t){this.renderer=t}return t.prototype.render=function(t){var e=t._texture,i=this.renderer,r=i.context;if(e.valid){var n=e._frame.width,o=e._frame.height,s=t.transform.worldTransform,a=0,h=0,l=e.baseTexture.getDrawableSource();if(!(e.orig.width<=0||e.orig.height<=0)&&e.valid&&l){i.setBlendMode(t.blendMode,!0),i.context.globalAlpha=t.worldAlpha;var u=e.baseTexture.scaleMode===qs.LINEAR;i.smoothProperty&&i.context[i.smoothProperty]!==u&&(r[i.smoothProperty]=u),e.trim?(a=e.trim.width/2+e.trim.x-t.anchor.x*e.orig.width,h=e.trim.height/2+e.trim.y-t.anchor.y*e.orig.height):(a=(.5-t.anchor.x)*e.orig.width,h=(.5-t.anchor.y)*e.orig.height),e.rotate&&(s.copyTo(Kd),s=Kd,Ca.matrixAppendRotationInv(s,e.rotate,a,h),a=0,h=0),a-=n/2,h-=o/2,i.setContextTransform(s,t.roundPixels,1),t.roundPixels&&(a|=0,h|=0);var p=e.baseTexture.resolution,c=i._outerBlend;c&&(r.save(),r.beginPath(),r.rect(a*i.resolution,h*i.resolution,n*i.resolution,o*i.resolution),r.clip()),16777215!==t.tint?(t._cachedTint===t.tint&&t._tintedCanvas.tintId===t._texture._updateID||(t._cachedTint=t.tint,t._tintedCanvas=fd.getTintedCanvas(t,t.tint)),r.drawImage(t._tintedCanvas,0,0,Math.floor(n*p),Math.floor(o*p),Math.floor(a*i.resolution),Math.floor(h*i.resolution),Math.floor(n*i.resolution),Math.floor(o*i.resolution))):r.drawImage(l,e._frame.x*p,e._frame.y*p,Math.floor(n*p),Math.floor(o*p),Math.floor(a*i.resolution),Math.floor(h*i.resolution),Math.floor(n*i.resolution),Math.floor(o*i.resolution)),c&&r.restore(),i.setBlendMode(js.NORMAL)}}},t.prototype.destroy=function(){this.renderer=null},t}();ad.prototype._tintedCanvas=null,ad.prototype._renderCanvas=function(t){t.plugins.sprite.render(this)};
|
|
137
|
+
/*!
|
|
138
|
+
* @pixi/text - v6.1.3
|
|
139
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
140
|
+
*
|
|
141
|
+
* @pixi/text is licensed under the MIT License.
|
|
142
|
+
* http://www.opensource.org/licenses/mit-license
|
|
143
|
+
*/
|
|
144
|
+
/*! *****************************************************************************
|
|
145
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
146
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
147
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
148
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
149
|
+
|
|
150
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
151
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
152
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
153
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
154
|
+
|
|
155
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
156
|
+
and limitations under the License.
|
|
157
|
+
***************************************************************************** */
|
|
158
|
+
var $d,tf=function(t,e){return tf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},tf(t,e)};!function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}($d||($d={}));var ef={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:$d.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},rf=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],nf=function(){function t(t){this.styleID=0,this.reset(),af(this,t,t)}return t.prototype.clone=function(){var e={};return af(e,this,ef),new t(e)},t.prototype.reset=function(){af(this,ef,ef)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=sf(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=sf(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=sf(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&rf.indexOf(r)<0&&(r='"'+r+'"'),e[i]=r}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function of(t){return"number"==typeof t?Rl(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function sf(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=of(t[e]);return t}return of(t)}function af(t,e,i){for(var r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}var hf=function(){function t(t,e,i,r,n,o,s,a,h){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,r,n){void 0===n&&(n=t._canvas),r=null==r?i.wordWrap:r;var o=i.toFontString(),s=t.measureFont(o);0===s.fontSize&&(s.fontSize=i.fontSize,s.ascent=i.fontSize);var a=n.getContext("2d");a.font=o;for(var h=(r?t.wordWrap(e,i,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length),u=0,p=0;p<h.length;p++){var c=a.measureText(h[p]).width+(h[p].length-1)*i.letterSpacing;l[p]=c,u=Math.max(u,c)}var d=u+i.strokeThickness;i.dropShadow&&(d+=i.dropShadowDistance);var f=i.lineHeight||s.fontSize+i.strokeThickness,v=Math.max(f,s.fontSize+i.strokeThickness)+(h.length-1)*(f+i.leading);return i.dropShadow&&(v+=i.dropShadowDistance),new t(e,i,d,v,h,l,f+i.leading,u,s)},t.wordWrap=function(e,i,r){void 0===r&&(r=t._canvas);for(var n=r.getContext("2d"),o=0,s="",a="",h=Object.create(null),l=i.letterSpacing,u=i.whiteSpace,p=t.collapseSpaces(u),c=t.collapseNewlines(u),d=!p,f=i.wordWrapWidth+l,v=t.tokenize(e),y=0;y<v.length;y++){var g=v[y];if(t.isNewline(g)){if(!c){a+=t.addLine(s),d=!p,s="",o=0;continue}g=" "}if(p){var m=t.isBreakingSpace(g),_=t.isBreakingSpace(s[s.length-1]);if(m&&_)continue}var x=t.getFromCache(g,l,h,n);if(x>f)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(g,i.breakWords))for(var b=t.wordWrapSplit(g),P=0;P<b.length;P++){for(var w=b[P],E=1;b[P+E];){var T=b[P+E],C=w[w.length-1];if(t.canBreakChars(C,T,g,P,i.breakWords))break;w+=T,E++}P+=w.length-1;var I=t.getFromCache(w,l,h,n);I+o>f&&(a+=t.addLine(s),d=!1,s="",o=0),s+=w,o+=I}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var S=y===v.length-1;a+=t.addLine(g,!S),d=!1,s="",o=0}else x+o>f&&(d=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(g)||d)&&(s+=g,o+=x)}return a+=t.addLine(s,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,r){var n=i[t];if("number"!=typeof n){var o=t.length*e;n=r.measureText(t).width+o,i[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],r="";if("string"!=typeof e)return i;for(var n=0;n<e.length;n++){var o=e[n],s=e[n+1];t.isBreakingSpace(o,s)||t.isNewline(o)?(""!==r&&(i.push(r),r=""),i.push(o)):r+=o}return""!==r&&i.push(r),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,r,n){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},r=t._canvas,n=t._context;n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,s=Math.ceil(n.measureText(o).width),a=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,r.width=s,r.height=h,n.fillStyle="#f00",n.fillRect(0,0,s,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,a);var l=n.getImageData(0,0,s,h).data,u=l.length,p=4*s,c=0,d=0,f=!1;for(c=0;c<a;++c){for(var v=0;v<p;v+=4)if(255!==l[d+v]){f=!0;break}if(f)break;d+=p}for(i.ascent=a-c,d=u-p,f=!1,c=h;c>a;--c){for(v=0;v<p;v+=4)if(255!==l[d+v]){f=!0;break}if(f)break;d-=p}return i.descent=c-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},t}(),lf=function(){try{var t=new OffscreenCanvas(0,0),e=t.getContext("2d");return e&&e.measureText?t:document.createElement("canvas")}catch(t){return document.createElement("canvas")}}();lf.width=lf.height=10,hf._canvas=lf,hf._context=lf.getContext("2d"),hf._fonts={},hf.METRICS_STRING="|ÉqÅ",hf.BASELINE_SYMBOL="M",hf.BASELINE_MULTIPLIER=1.4,hf.HEIGHT_MULTIPLIER=2,hf._newlines=[10,13],hf._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var uf,pf={texture:!0,children:!1,baseTexture:!0},cf=function(t){function e(e,i,r){var n=this,o=!1;r||(r=document.createElement("canvas"),o=!0),r.width=3,r.height=3;var s=Uu.from(r);return s.orig=new pa,s.trim=new pa,(n=t.call(this,s)||this)._ownCanvas=o,n.canvas=r,n.context=n.canvas.getContext("2d"),n._resolution=ph.RESOLUTION,n._autoResolution=!0,n._text=null,n._style=null,n._styleListener=null,n._font="",n.text=e,n.style=i,n.localStyleID=-1,n}return function(t,e){function i(){this.constructor=t}tf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype.updateText=function(t){var i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),this.dirty||!t){this._font=this._style.toFontString();var r,n,o=this.context,s=hf.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=s.width,h=s.height,l=s.lines,u=s.lineHeight,p=s.lineWidths,c=s.maxLineWidth,d=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+2*i.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,h)+2*i.padding)*this._resolution),o.scale(this._resolution,this._resolution),o.clearRect(0,0,this.canvas.width,this.canvas.height),o.font=this._font,o.lineWidth=i.strokeThickness,o.textBaseline=i.textBaseline,o.lineJoin=i.lineJoin,o.miterLimit=i.miterLimit;for(var f=i.dropShadow?2:1,v=0;v<f;++v){var y=i.dropShadow&&0===v,g=y?Math.ceil(Math.max(1,h)+2*i.padding):0,m=g*this._resolution;if(y){o.fillStyle="black",o.strokeStyle="black";var _=i.dropShadowColor,x=Nl("number"==typeof _?_:Dl(_));o.shadowColor="rgba("+255*x[0]+","+255*x[1]+","+255*x[2]+","+i.dropShadowAlpha+")",o.shadowBlur=i.dropShadowBlur,o.shadowOffsetX=Math.cos(i.dropShadowAngle)*i.dropShadowDistance,o.shadowOffsetY=Math.sin(i.dropShadowAngle)*i.dropShadowDistance+m}else o.fillStyle=this._generateFillStyle(i,l,s),o.strokeStyle=i.stroke,o.shadowColor="black",o.shadowBlur=0,o.shadowOffsetX=0,o.shadowOffsetY=0;var b=(u-d.fontSize)/2;(!e.nextLineHeightBehavior||u-d.fontSize<0)&&(b=0);for(var P=0;P<l.length;P++)r=i.strokeThickness/2,n=i.strokeThickness/2+P*u+d.ascent+b,"right"===i.align?r+=c-p[P]:"center"===i.align&&(r+=(c-p[P])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(l[P],r+i.padding,n+i.padding-g,!0),i.fill&&this.drawLetterSpacing(l[P],r+i.padding,n+i.padding-g)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(t,e,i,r){void 0===r&&(r=!1);var n=this._style.letterSpacing;if(0!==n)for(var o=e,s=Array.from?Array.from(t):t.split(""),a=this.context.measureText(t).width,h=0,l=0;l<s.length;++l){var u=s[l];r?this.context.strokeText(u,o,i):this.context.fillText(u,o,i),o+=a-(h=this.context.measureText(t.substring(l+1)).width)+n,a=h}else r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i)},e.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=eu(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,r=this._style,n=r.trim?0:r.padding,o=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-n,i.trim.y=-n,i.orig.width=i._frame.width-2*n,i.orig.height=i._frame.height-2*n,this._onTextureUpdate(),o.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this._recursivePostUpdateTransform(),this.dirty=!1},e.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),t.prototype._render.call(this,e)},e.prototype.getLocalBounds=function(e){return this.updateText(!0),t.prototype.getLocalBounds.call(this,e)},e.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},e.prototype._generateFillStyle=function(t,e,i){var r,n=t.fill;if(!Array.isArray(n))return n;if(1===n.length)return n[0];var o=t.dropShadow?t.dropShadowDistance:0,s=t.padding||0,a=this.canvas.width/this._resolution-o-2*s,h=this.canvas.height/this._resolution-o-2*s,l=n.slice(),u=t.fillGradientStops.slice();if(!u.length)for(var p=l.length+1,c=1;c<p;++c)u.push(c/p);if(l.unshift(n[0]),u.unshift(0),l.push(n[n.length-1]),u.push(1),t.fillGradientType===$d.LINEAR_VERTICAL){r=this.context.createLinearGradient(a/2,s,a/2,h+s);var d=i.fontProperties.fontSize+t.strokeThickness;for(c=0;c<e.length;c++){var f=i.lineHeight*(c-1)+d,v=i.lineHeight*c,y=v;c>0&&f>v&&(y=(v+f)/2);var g=v+d,m=i.lineHeight*(c+1),_=g;c+1<e.length&&m<g&&(_=(g+m)/2);for(var x=(_-y)/h,b=0;b<l.length;b++){var P=0;P="number"==typeof u[b]?u[b]:b/l.length;var w=Math.min(1,Math.max(0,y/h+P*x));w=Number(w.toFixed(5)),r.addColorStop(w,l[b])}}}else{r=this.context.createLinearGradient(s,h/2,a+s,h/2);var E=l.length+1,T=1;for(c=0;c<l.length;c++){var C=void 0;C="number"==typeof u[c]?u[c]:T/E,r.addColorStop(C,l[c]),T++}}return r},e.prototype.destroy=function(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},pf,e),t.prototype.destroy.call(this,e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=Gl(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=Gl(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof nf?t:new nf(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.nextLineHeightBehavior=!1,e}(ad),df=function(){function t(){}return t.offsetPolygon=function(e,i){var r=[],n=e.length;i=t.isPolygonClockwise(e)?i:-1*i;for(var o=0;o<n;o+=2){var s=o-2;s<0&&(s+=n);var a=(o+2)%n,h=e[o]-e[s],l=e[o+1]-e[s+1],u=Math.sqrt(h*h+l*l);h/=u,l/=u;var p=-(l*=i),c=h*=i,d=[e[s]+p,e[s+1]+c],f=[e[o]+p,e[o+1]+c],v=e[a]-e[o],y=e[a+1]-e[o+1];v/=u=Math.sqrt(v*v+y*y),y/=u;var g=-(y*=i),m=v*=i,_=[e[o]+g,e[o+1]+m],x=[e[a]+g,e[a+1]+m],b=t.findIntersection(d[0],d[1],f[0],f[1],_[0],_[1],x[0],x[1]);b&&r.push.apply(r,b)}return r},t.findIntersection=function(t,e,i,r,n,o,s,a){var h=(a-o)*(i-t)-(s-n)*(r-e),l=(s-n)*(e-o)-(a-o)*(t-n);if(0===h)return 0===l&&0===(i-t)*(e-o)-(r-e)*(t-n)?[(t+i)/2,(e+r)/2]:null;var u=l/h;return[t+u*(i-t),e+u*(r-e)]},t.isPolygonClockwise=function(t){for(var e=0,i=0;i<t.length-2;i+=2)e+=(t[i+2]-t[i])*(t[i+3]+t[i+1]);return e>0},t}(),ff=function(){function t(t){this._svgMatrix=null,this._tempMatrix=new ma,this.renderer=t}return t.prototype._calcCanvasStyle=function(t,e){var i;return t.texture&&t.texture.baseTexture!==Uu.WHITE.baseTexture?t.texture.valid?(i=fd.getTintedPattern(t.texture,e),this.setPatternTransform(i,t.matrix||ma.IDENTITY)):i="#808080":i="#"+("00000"+(0|e).toString(16)).substr(-6),i},t.prototype.render=function(t){var e=this.renderer,i=e.context,r=t.worldAlpha,n=t.transform.worldTransform;e.setContextTransform(n),e.setBlendMode(t.blendMode);for(var o,s,a=t.geometry.graphicsData,h=(t.tint>>16&255)/255,l=(t.tint>>8&255)/255,u=(255&t.tint)/255,p=0;p<a.length;p++){var c=a[p],d=c.shape,f=c.fillStyle,v=c.lineStyle,y=0|c.fillStyle.color,g=0|c.lineStyle.color;if(c.matrix&&e.setContextTransform(n.copyTo(this._tempMatrix).append(c.matrix)),f.visible){var m=((y>>16&255)/255*h*255<<16)+((y>>8&255)/255*l*255<<8)+(255&y)/255*u*255;o=this._calcCanvasStyle(f,m)}if(v.visible){var _=((g>>16&255)/255*h*255<<16)+((g>>8&255)/255*l*255<<8)+(255&g)/255*u*255;s=this._calcCanvasStyle(v,_)}if(i.lineWidth=v.width,i.lineCap=v.cap,i.lineJoin=v.join,i.miterLimit=v.miterLimit,c.type===aa.POLY){i.beginPath();var x=(O=d).points,b=c.holes,P=void 0,w=void 0,E=void 0,T=void 0,C=void 0;i.moveTo(x[0],x[1]);for(var I=2;I<x.length;I+=2)i.lineTo(x[I],x[I+1]);if(O.closeStroke&&i.closePath(),b.length>0){C=[],P=0,E=x[0],T=x[1];for(I=2;I+2<x.length;I+=2)P+=(x[I]-E)*(x[I+3]-T)-(x[I+2]-E)*(x[I+1]-T);for(var S=0;S<b.length;S++)if(x=b[S].shape.points){w=0,E=x[0],T=x[1];for(I=2;I+2<x.length;I+=2)w+=(x[I]-E)*(x[I+3]-T)-(x[I+2]-E)*(x[I+1]-T);if(w*P<0){i.moveTo(x[0],x[1]);for(I=2;I<x.length;I+=2)i.lineTo(x[I],x[I+1])}else{i.moveTo(x[x.length-2],x[x.length-1]);for(I=x.length-4;I>=0;I-=2)i.lineTo(x[I],x[I+1])}b[S].shape.closeStroke&&i.closePath(),C[S]=w*P<0}}f.visible&&(i.globalAlpha=f.alpha*r,i.fillStyle=o,i.fill()),v.visible&&this.paintPolygonStroke(O,v,s,b,C,r,i)}else if(c.type===aa.RECT){var O=d;if(f.visible&&(i.globalAlpha=f.alpha*r,i.fillStyle=o,i.fillRect(O.x,O.y,O.width,O.height)),v.visible){var A=v.width*(.5-(1-v.alignment)),M=O.width+2*A,L=O.height+2*A;i.globalAlpha=v.alpha*r,i.strokeStyle=s,i.strokeRect(O.x-A,O.y-A,M,L)}}else if(c.type===aa.CIRC){O=d;if(i.beginPath(),i.arc(O.x,O.y,O.radius,0,2*Math.PI),i.closePath(),f.visible&&(i.globalAlpha=f.alpha*r,i.fillStyle=o,i.fill()),v.visible){if(.5!==v.alignment){A=v.width*(.5-(1-v.alignment));i.beginPath(),i.arc(O.x,O.y,O.radius+A,0,2*Math.PI),i.closePath()}i.globalAlpha=v.alpha*r,i.strokeStyle=s,i.stroke()}}else if(c.type===aa.ELIP){O=d;if((H=1===v.alignment)||this.paintEllipse(O,f,v,o,r,i),v.visible){if(.5!==v.alignment){var N=.5522848,R=(A=v.width*(.5-(1-v.alignment)),2*(O.width+A)),D=2*(O.height+A),k=O.x-R/2,F=O.y-D/2,B=R/2*N,U=D/2*N,z=k+R,X=F+D,j=k+R/2,Y=F+D/2;i.beginPath(),i.moveTo(k,Y),i.bezierCurveTo(k,Y-U,j-B,F,j,F),i.bezierCurveTo(j+B,F,z,Y-U,z,Y),i.bezierCurveTo(z,Y+U,j+B,X,j,X),i.bezierCurveTo(j-B,X,k,Y+U,k,Y),i.closePath()}i.globalAlpha=v.alpha*r,i.strokeStyle=s,i.stroke()}H&&this.paintEllipse(O,f,v,o,r,i)}else if(c.type===aa.RREC){var H;O=d;if((H=1===v.alignment)||this.paintRoundedRectangle(O,f,v,o,r,i),v.visible){if(.5!==v.alignment){M=O.width,L=O.height,A=v.width*(.5-(1-v.alignment));var G=O.x-A,W=O.y-A,V=O.width+2*A,q=O.height+2*A,Z=A*(v.alignment>=1?Math.min(V/M,q/L):Math.min(M/V,L/q)),J=O.radius+Z,K=Math.min(V,q)/2;J=J>K?K:J,i.beginPath(),i.moveTo(G,W+J),i.lineTo(G,W+q-J),i.quadraticCurveTo(G,W+q,G+J,W+q),i.lineTo(G+V-J,W+q),i.quadraticCurveTo(G+V,W+q,G+V,W+q-J),i.lineTo(G+V,W+J),i.quadraticCurveTo(G+V,W,G+V-J,W),i.lineTo(G+J,W),i.quadraticCurveTo(G,W,G,W+J),i.closePath()}i.globalAlpha=v.alpha*r,i.strokeStyle=s,i.stroke()}H&&this.paintRoundedRectangle(O,f,v,o,r,i)}}},t.prototype.paintPolygonStroke=function(t,e,i,r,n,o,s){if(.5!==e.alignment){var a=e.width*(.5-(1-e.alignment)),h=df.offsetPolygon(t.points,a),l=void 0;s.beginPath(),s.moveTo(h[0],h[1]);for(var u=2;u<h.length;u+=2)s.lineTo(h[u],h[u+1]);t.closeStroke&&s.closePath();for(var p=0;p<r.length;p++){if(l=r[p].shape.points,h=df.offsetPolygon(l,a),n[p]){s.moveTo(h[0],h[1]);for(u=2;u<h.length;u+=2)s.lineTo(h[u],h[u+1])}else{s.moveTo(h[h.length-2],h[h.length-1]);for(u=h.length-4;u>=0;u-=2)s.lineTo(h[u],h[u+1])}r[p].shape.closeStroke&&s.closePath()}}s.globalAlpha=e.alpha*o,s.strokeStyle=i,s.stroke()},t.prototype.paintEllipse=function(t,e,i,r,n,o){var s=2*t.width,a=2*t.height,h=t.x-s/2,l=t.y-a/2,u=.5522848,p=s/2*u,c=a/2*u,d=h+s,f=l+a,v=h+s/2,y=l+a/2;o.beginPath(),o.moveTo(h,y),o.bezierCurveTo(h,y-c,v-p,l,v,l),o.bezierCurveTo(v+p,l,d,y-c,d,y),o.bezierCurveTo(d,y+c,v+p,f,v,f),o.bezierCurveTo(v-p,f,h,y+c,h,y),o.closePath(),0===i.alignment&&o.clip(),e.visible&&(o.globalAlpha=e.alpha*n,o.fillStyle=r,o.fill())},t.prototype.paintRoundedRectangle=function(t,e,i,r,n,o){var s=t.x,a=t.y,h=t.width,l=t.height,u=t.radius,p=Math.min(h,l)/2;u=u>p?p:u,o.beginPath(),o.moveTo(s,a+u),o.lineTo(s,a+l-u),o.quadraticCurveTo(s,a+l,s+u,a+l),o.lineTo(s+h-u,a+l),o.quadraticCurveTo(s+h,a+l,s+h,a+l-u),o.lineTo(s+h,a+u),o.quadraticCurveTo(s+h,a,s+h-u,a),o.lineTo(s+u,a),o.quadraticCurveTo(s,a,s,a+u),o.closePath(),0===i.alignment&&o.clip(),e.visible&&(o.globalAlpha=e.alpha*n,o.fillStyle=r,o.fill())},t.prototype.setPatternTransform=function(t,e){if(!1!==this._svgMatrix){if(!this._svgMatrix){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i&&i.createSVGMatrix&&(this._svgMatrix=i.createSVGMatrix()),!this._svgMatrix||!t.setTransform)return void(this._svgMatrix=!1)}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}},t.prototype.destroy=function(){this.renderer=null,this._svgMatrix=null,this._tempMatrix=null},t}(),vf=new ma;Zd.prototype.generateCanvasTexture=function(t,e){void 0===e&&(e=1);var i=this.getLocalBounds(),r=Xu.create({width:i.width,height:i.height,scaleMode:t,resolution:e});uf||(uf=new dd),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(vf),vf.invert(),vf.tx-=i.x,vf.ty-=i.y,uf.render(this,{renderTexture:r,clear:!0,transform:vf});var n=Uu.from(r.baseTexture._canvasRenderTarget.canvas,{scaleMode:t});return n.baseTexture.setResolution(e),n},Zd.prototype.cachedGraphicsData=[],Zd.prototype._renderCanvas=function(t){!0!==this.isMask&&(this.finishPoly(),t.plugins.graphics.render(this))},
|
|
159
|
+
/*!
|
|
160
|
+
* @pixi/canvas-text - v6.1.3
|
|
161
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
162
|
+
*
|
|
163
|
+
* @pixi/canvas-text is licensed under the MIT License.
|
|
164
|
+
* http://www.opensource.org/licenses/mit-license
|
|
165
|
+
*/
|
|
166
|
+
cf.prototype._renderCanvas=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),ad.prototype._renderCanvas.call(this,t)};
|
|
167
|
+
/*!
|
|
168
|
+
* @pixi/interaction - v6.1.3
|
|
169
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
170
|
+
*
|
|
171
|
+
* @pixi/interaction is licensed under the MIT License.
|
|
172
|
+
* http://www.opensource.org/licenses/mit-license
|
|
173
|
+
*/
|
|
174
|
+
var yf=function(){function t(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new ya,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(t.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),t.prototype.getLocalPosition=function(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)},t.prototype.copyEvent=function(t){"isPrimary"in t&&t.isPrimary&&(this.isPrimary=!0),this.button="button"in t&&t.button;var e="buttons"in t&&t.buttons;this.buttons=Number.isInteger(e)?e:"which"in t&&t.which,this.width="width"in t&&t.width,this.height="height"in t&&t.height,this.tiltX="tiltX"in t&&t.tiltX,this.tiltY="tiltY"in t&&t.tiltY,this.pointerType="pointerType"in t&&t.pointerType,this.pressure="pressure"in t&&t.pressure,this.rotationAngle="rotationAngle"in t&&t.rotationAngle,this.twist="twist"in t&&t.twist||0,this.tangentialPressure="tangentialPressure"in t&&t.tangentialPressure||0},t.prototype.reset=function(){this.isPrimary=!1},t}(),gf=function(t,e){return gf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},gf(t,e)};
|
|
175
|
+
/*! *****************************************************************************
|
|
176
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
177
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
178
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
179
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
180
|
+
|
|
181
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
182
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
183
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
184
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
185
|
+
|
|
186
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
187
|
+
and limitations under the License.
|
|
188
|
+
***************************************************************************** */var mf=function(){function t(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return t.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},t.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},t}(),_f=function(){function t(e){this._pointerId=e,this._flags=t.FLAGS.NONE}return t.prototype._doSet=function(t,e){this._flags=e?this._flags|t:this._flags&~t},Object.defineProperty(t.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"none",{get:function(){return this._flags===t.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return 0!=(this._flags&t.FLAGS.OVER)},set:function(e){this._doSet(t.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightDown",{get:function(){return 0!=(this._flags&t.FLAGS.RIGHT_DOWN)},set:function(e){this._doSet(t.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftDown",{get:function(){return 0!=(this._flags&t.FLAGS.LEFT_DOWN)},set:function(e){this._doSet(t.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),t.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),t}(),xf=function(){function t(){this._tempPoint=new ya}return t.prototype.recursiveFindHit=function(t,e,i,r,n){if(!e||!e.visible)return!1;var o=t.data.global,s=!1,a=n=e.interactive||n,h=!0;if(e.hitArea?(r&&(e.worldTransform.applyInverse(o,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?s=!0:(r=!1,h=!1)),a=!1):e._mask&&r&&(e._mask.containsPoint&&e._mask.containsPoint(o)||(r=!1)),h&&e.interactiveChildren&&e.children)for(var l=e.children,u=l.length-1;u>=0;u--){var p=l[u],c=this.recursiveFindHit(t,p,i,r,a);if(c){if(!p.parent)continue;a=!1,c&&(t.target&&(r=!1),s=!0)}}return n&&(r&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(s=!0),e.interactive&&(s&&!t.target&&(t.target=e),i&&i(t,e,!!s))),s},t.prototype.findHit=function(t,e,i,r){this.recursiveFindHit(t,e,i,r,!1)},t}(),bf={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};uu.mixin(bf);var Pf={target:null,data:{global:null}},wf=function(t){function e(e,i){var r=t.call(this)||this;return i=i||{},r.renderer=e,r.autoPreventDefault=void 0===i.autoPreventDefault||i.autoPreventDefault,r.interactionFrequency=i.interactionFrequency||10,r.mouse=new yf,r.mouse.identifier=1,r.mouse.global.set(-999999),r.activeInteractionData={},r.activeInteractionData[1]=r.mouse,r.interactionDataPool=[],r.eventData=new mf,r.interactionDOMElement=null,r.moveWhenInside=!1,r.eventsAdded=!1,r.tickerAdded=!1,r.mouseOverRenderer=!("PointerEvent"in self),r.supportsTouchEvents="ontouchstart"in self,r.supportsPointerEvents=!!self.PointerEvent,r.onPointerUp=r.onPointerUp.bind(r),r.processPointerUp=r.processPointerUp.bind(r),r.onPointerCancel=r.onPointerCancel.bind(r),r.processPointerCancel=r.processPointerCancel.bind(r),r.onPointerDown=r.onPointerDown.bind(r),r.processPointerDown=r.processPointerDown.bind(r),r.onPointerMove=r.onPointerMove.bind(r),r.processPointerMove=r.processPointerMove.bind(r),r.onPointerOut=r.onPointerOut.bind(r),r.processPointerOverOut=r.processPointerOverOut.bind(r),r.onPointerOver=r.onPointerOver.bind(r),r.cursorStyles={default:"inherit",pointer:"pointer"},r.currentCursorMode=null,r.cursor=null,r.resolution=1,r.delayedEvents=[],r.search=new xf,r._tempDisplayObject=new pu,r._eventListenerOptions={capture:!0,passive:!1},r._useSystemTicker=void 0===i.useSystemTicker||i.useSystemTicker,r.setTargetElement(r.renderer.view,r.renderer.resolution),r}return function(t,e){function i(){this.constructor=t}gf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),Object.defineProperty(e.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),e.prototype.hitTest=function(t,e){return Pf.target=null,Pf.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(Pf,e,null,!0),Pf.target},e.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},e.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(dh.system.add(this.tickerUpdate,this,uh.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(dh.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},e.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;self.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(self.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),self.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),self.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(self.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),self.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},e.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;self.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(self.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),self.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),self.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(self.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),self.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},e.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())},e.prototype.update=function(){if(this.interactionDOMElement)if(this._didMove)this._didMove=!1;else{for(var t in this.cursor=null,this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(t)){var e=this.activeInteractionData[t];if(e.originalEvent&&"touch"!==e.pointerType){var i=this.configureInteractionEventForDOMEvent(this.eventData,e.originalEvent,e);this.processInteractive(i,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},e.prototype.setCursorMode=function(t){t=t||"default";var e=!0;if(self.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(e=!1),this.currentCursorMode!==t){this.currentCursorMode=t;var i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.interactionDOMElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.interactionDOMElement.style,i)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.interactionDOMElement.style.cursor=t)}},e.prototype.dispatchEvent=function(t,e,i){i.stopPropagationHint&&t!==i.stopsPropagatingAt||(i.currentTarget=t,i.type=e,t.emit(e,i),t[e]&&t[e](i))},e.prototype.delayDispatchEvent=function(t,e,i){this.delayedEvents.push({displayObject:t,eventString:e,eventData:i})},e.prototype.mapPositionToPoint=function(t,e,i){var r;r=this.interactionDOMElement.parentElement?this.interactionDOMElement.getBoundingClientRect():{x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var n=1/this.resolution;t.x=(e-r.left)*(this.interactionDOMElement.width/r.width)*n,t.y=(i-r.top)*(this.interactionDOMElement.height/r.height)*n},e.prototype.processInteractive=function(t,e,i,r){var n=this.search.findHit(t,e,i,r),o=this.delayedEvents;if(!o.length)return n;t.stopPropagationHint=!1;var s=o.length;this.delayedEvents=[];for(var a=0;a<s;a++){var h=o[a],l=h.displayObject,u=h.eventString,p=h.eventData;p.stopsPropagatingAt===l&&(p.stopPropagationHint=!0),this.dispatchEvent(l,u,p)}return n},e.prototype.onPointerDown=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var i=e.length,r=0;r<i;r++){var n=e[r],o=this.getInteractionDataForPointerId(n),s=this.configureInteractionEventForDOMEvent(this.eventData,n,o);if(s.data.originalEvent=t,this.processInteractive(s,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",s),"touch"===n.pointerType)this.emit("touchstart",s);else if("mouse"===n.pointerType||"pen"===n.pointerType){var a=2===n.button;this.emit(a?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(t,e,i){var r=t.data,n=t.data.identifier;if(i)if(e.trackedPointers[n]||(e.trackedPointers[n]=new _f(n)),this.dispatchEvent(e,"pointerdown",t),"touch"===r.pointerType)this.dispatchEvent(e,"touchstart",t);else if("mouse"===r.pointerType||"pen"===r.pointerType){var o=2===r.button;o?e.trackedPointers[n].rightDown=!0:e.trackedPointers[n].leftDown=!0,this.dispatchEvent(e,o?"rightdown":"mousedown",t)}},e.prototype.onPointerComplete=function(t,e,i){for(var r=this.normalizeToPointerData(t),n=r.length,o=t.target!==this.interactionDOMElement?"outside":"",s=0;s<n;s++){var a=r[s],h=this.getInteractionDataForPointerId(a),l=this.configureInteractionEventForDOMEvent(this.eventData,a,h);if(l.data.originalEvent=t,this.processInteractive(l,this.lastObjectRendered,i,e||!o),this.emit(e?"pointercancel":"pointerup"+o,l),"mouse"===a.pointerType||"pen"===a.pointerType){var u=2===a.button;this.emit(u?"rightup"+o:"mouseup"+o,l)}else"touch"===a.pointerType&&(this.emit(e?"touchcancel":"touchend"+o,l),this.releaseInteractionDataForPointerId(a.pointerId))}},e.prototype.onPointerCancel=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!0,this.processPointerCancel)},e.prototype.processPointerCancel=function(t,e){var i=t.data,r=t.data.identifier;void 0!==e.trackedPointers[r]&&(delete e.trackedPointers[r],this.dispatchEvent(e,"pointercancel",t),"touch"===i.pointerType&&this.dispatchEvent(e,"touchcancel",t))},e.prototype.onPointerUp=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!1,this.processPointerUp)},e.prototype.processPointerUp=function(t,e,i){var r=t.data,n=t.data.identifier,o=e.trackedPointers[n],s="touch"===r.pointerType,a="mouse"===r.pointerType||"pen"===r.pointerType,h=!1;if(a){var l=2===r.button,u=_f.FLAGS,p=l?u.RIGHT_DOWN:u.LEFT_DOWN,c=void 0!==o&&o.flags&p;i?(this.dispatchEvent(e,l?"rightup":"mouseup",t),c&&(this.dispatchEvent(e,l?"rightclick":"click",t),h=!0)):c&&this.dispatchEvent(e,l?"rightupoutside":"mouseupoutside",t),o&&(l?o.rightDown=!1:o.leftDown=!1)}i?(this.dispatchEvent(e,"pointerup",t),s&&this.dispatchEvent(e,"touchend",t),o&&(a&&!h||this.dispatchEvent(e,"pointertap",t),s&&(this.dispatchEvent(e,"tap",t),o.over=!1))):o&&(this.dispatchEvent(e,"pointerupoutside",t),s&&this.dispatchEvent(e,"touchendoutside",t)),o&&o.none&&delete e.trackedPointers[n]},e.prototype.onPointerMove=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);"mouse"!==e[0].pointerType&&"pen"!==e[0].pointerType||(this._didMove=!0,this.cursor=null);for(var i=e.length,r=0;r<i;r++){var n=e[r],o=this.getInteractionDataForPointerId(n),s=this.configureInteractionEventForDOMEvent(this.eventData,n,o);s.data.originalEvent=t,this.processInteractive(s,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",s),"touch"===n.pointerType&&this.emit("touchmove",s),"mouse"!==n.pointerType&&"pen"!==n.pointerType||this.emit("mousemove",s)}"mouse"===e[0].pointerType&&this.setCursorMode(this.cursor)}},e.prototype.processPointerMove=function(t,e,i){var r=t.data,n="touch"===r.pointerType,o="mouse"===r.pointerType||"pen"===r.pointerType;o&&this.processPointerOverOut(t,e,i),this.moveWhenInside&&!i||(this.dispatchEvent(e,"pointermove",t),n&&this.dispatchEvent(e,"touchmove",t),o&&this.dispatchEvent(e,"mousemove",t))},e.prototype.onPointerOut=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t)[0];"mouse"===e.pointerType&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var i=this.getInteractionDataForPointerId(e),r=this.configureInteractionEventForDOMEvent(this.eventData,e,i);r.data.originalEvent=e,this.processInteractive(r,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",r),"mouse"===e.pointerType||"pen"===e.pointerType?this.emit("mouseout",r):this.releaseInteractionDataForPointerId(i.identifier)}},e.prototype.processPointerOverOut=function(t,e,i){var r=t.data,n=t.data.identifier,o="mouse"===r.pointerType||"pen"===r.pointerType,s=e.trackedPointers[n];i&&!s&&(s=e.trackedPointers[n]=new _f(n)),void 0!==s&&(i&&this.mouseOverRenderer?(s.over||(s.over=!0,this.delayDispatchEvent(e,"pointerover",t),o&&this.delayDispatchEvent(e,"mouseover",t)),o&&null===this.cursor&&(this.cursor=e.cursor)):s.over&&(s.over=!1,this.dispatchEvent(e,"pointerout",this.eventData),o&&this.dispatchEvent(e,"mouseout",t),s.none&&delete e.trackedPointers[n]))},e.prototype.onPointerOver=function(t){var e=this.normalizeToPointerData(t)[0],i=this.getInteractionDataForPointerId(e),r=this.configureInteractionEventForDOMEvent(this.eventData,e,i);r.data.originalEvent=e,"mouse"===e.pointerType&&(this.mouseOverRenderer=!0),this.emit("pointerover",r),"mouse"!==e.pointerType&&"pen"!==e.pointerType||this.emit("mouseover",r)},e.prototype.getInteractionDataForPointerId=function(t){var e,i=t.pointerId;return 1===i||"mouse"===t.pointerType?e=this.mouse:this.activeInteractionData[i]?e=this.activeInteractionData[i]:((e=this.interactionDataPool.pop()||new yf).identifier=i,this.activeInteractionData[i]=e),e.copyEvent(t),e},e.prototype.releaseInteractionDataForPointerId=function(t){var e=this.activeInteractionData[t];e&&(delete this.activeInteractionData[t],e.reset(),this.interactionDataPool.push(e))},e.prototype.configureInteractionEventForDOMEvent=function(t,e,i){return t.data=i,this.mapPositionToPoint(i.global,e.clientX,e.clientY),"touch"===e.pointerType&&(e.globalX=i.global.x,e.globalY=i.global.y),i.originalEvent=e,t.reset(),t},e.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var i=0,r=t.changedTouches.length;i<r;i++){var n=t.changedTouches[i];void 0===n.button&&(n.button=t.touches.length?1:0),void 0===n.buttons&&(n.buttons=t.touches.length?1:0),void 0===n.isPrimary&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===n.width&&(n.width=n.radiusX||1),void 0===n.height&&(n.height=n.radiusY||1),void 0===n.tiltX&&(n.tiltX=0),void 0===n.tiltY&&(n.tiltY=0),void 0===n.pointerType&&(n.pointerType="touch"),void 0===n.pointerId&&(n.pointerId=n.identifier||0),void 0===n.pressure&&(n.pressure=n.force||.5),void 0===n.twist&&(n.twist=0),void 0===n.tangentialPressure&&(n.tangentialPressure=0),void 0===n.layerX&&(n.layerX=n.offsetX=n.clientX),void 0===n.layerY&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,e.push(n)}else if(self.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof self.PointerEvent))e.push(t);else{var o=t;void 0===o.isPrimary&&(o.isPrimary=!0),void 0===o.width&&(o.width=1),void 0===o.height&&(o.height=1),void 0===o.tiltX&&(o.tiltX=0),void 0===o.tiltY&&(o.tiltY=0),void 0===o.pointerType&&(o.pointerType="mouse"),void 0===o.pointerId&&(o.pointerId=1),void 0===o.pressure&&(o.pressure=.5),void 0===o.twist&&(o.twist=0),void 0===o.tangentialPressure&&(o.tangentialPressure=0),o.isNormalized=!0,e.push(o)}return e},e.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},e}(vh);
|
|
189
|
+
/*!
|
|
190
|
+
* @pixi/prepare - v6.1.3
|
|
191
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
192
|
+
*
|
|
193
|
+
* @pixi/prepare is licensed under the MIT License.
|
|
194
|
+
* http://www.opensource.org/licenses/mit-license
|
|
195
|
+
*/
|
|
196
|
+
ph.UPLOADS_PER_FRAME=4;
|
|
197
|
+
/*! *****************************************************************************
|
|
198
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
199
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
200
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
201
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
202
|
+
|
|
203
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
204
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
205
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
206
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
207
|
+
|
|
208
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
209
|
+
and limitations under the License.
|
|
210
|
+
***************************************************************************** */
|
|
211
|
+
var Ef=function(t,e){return Ef=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Ef(t,e)};var Tf=function(){function t(t){this.maxItemsPerFrame=t,this.itemsLeft=0}return t.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},t.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},t}();function Cf(t,e){var i=!1;if(t&&t._textures&&t._textures.length)for(var r=0;r<t._textures.length;r++)if(t._textures[r]instanceof Uu){var n=t._textures[r].baseTexture;-1===e.indexOf(n)&&(e.push(n),i=!0)}return i}function If(t,e){if(t.baseTexture instanceof wu){var i=t.baseTexture;return-1===e.indexOf(i)&&e.push(i),!0}return!1}function Sf(t,e){if(t._texture&&t._texture instanceof Uu){var i=t._texture.baseTexture;return-1===e.indexOf(i)&&e.push(i),!0}return!1}function Of(t,e){return e instanceof cf&&(e.updateText(!0),!0)}function Af(t,e){if(e instanceof nf){var i=e.toFontString();return hf.measureFont(i),!0}return!1}function Mf(t,e){if(t instanceof cf){-1===e.indexOf(t.style)&&e.push(t.style),-1===e.indexOf(t)&&e.push(t);var i=t._texture.baseTexture;return-1===e.indexOf(i)&&e.push(i),!0}return!1}function Lf(t,e){return t instanceof nf&&(-1===e.indexOf(t)&&e.push(t),!0)}var Nf=function(){function t(t){var e=this;this.limiter=new Tf(ph.UPLOADS_PER_FRAME),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){e.queue&&e.prepareItems()},this.registerFindHook(Mf),this.registerFindHook(Lf),this.registerFindHook(Cf),this.registerFindHook(If),this.registerFindHook(Sf),this.registerUploadHook(Of),this.registerUploadHook(Af)}return t.prototype.upload=function(t,e){"function"==typeof t&&(e=t,t=null),t&&this.add(t),this.queue.length?(e&&this.completes.push(e),this.ticking||(this.ticking=!0,dh.system.addOnce(this.tick,this,uh.UTILITY))):e&&e()},t.prototype.tick=function(){setTimeout(this.delayedTick,0)},t.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var t=this.queue[0],e=!1;if(t&&!t._destroyed)for(var i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}e||this.queue.shift()}if(this.queue.length)dh.system.addOnce(this.tick,this,uh.UTILITY);else{this.ticking=!1;var n=this.completes.slice(0);this.completes.length=0;for(i=0,r=n.length;i<r;i++)n[i]()}},t.prototype.registerFindHook=function(t){return t&&this.addHooks.push(t),this},t.prototype.registerUploadHook=function(t){return t&&this.uploadHooks.push(t),this},t.prototype.add=function(t){for(var e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof du)for(e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this},t.prototype.destroy=function(){this.ticking&&dh.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},t}();function Rf(t,e){return e instanceof wu&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function Df(t,e){if(!(e instanceof Zd))return!1;var i=e.geometry;e.finishPoly(),i.updateBatches();for(var r=i.batches,n=0;n<r.length;n++){var o=r[n].style.texture;o&&Rf(t,o.baseTexture)}return i.batchable||t.geometry.bind(i,e._resolveDirectShader(t)),!0}function kf(t,e){return t instanceof Zd&&(e.push(t),!0)}!function(t){function e(e){var i=t.call(this,e)||this;return i.uploadHookHelper=i.renderer,i.registerFindHook(kf),i.registerUploadHook(Rf),i.registerUploadHook(Df),i}(function(t,e){function i(){this.constructor=t}Ef(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(e,t)}(Nf);
|
|
212
|
+
/*!
|
|
213
|
+
* @pixi/canvas-prepare - v6.1.3
|
|
214
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
215
|
+
*
|
|
216
|
+
* @pixi/canvas-prepare is licensed under the MIT License.
|
|
217
|
+
* http://www.opensource.org/licenses/mit-license
|
|
218
|
+
*/
|
|
219
|
+
/*! *****************************************************************************
|
|
220
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
221
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
222
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
223
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
224
|
+
|
|
225
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
226
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
227
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
228
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
229
|
+
|
|
230
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
231
|
+
and limitations under the License.
|
|
232
|
+
***************************************************************************** */
|
|
233
|
+
var Ff=function(t,e){return Ff=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Ff(t,e)};function Bf(t,e){var i=t;if(e instanceof wu){var r=e.source,n=0===r.width?i.canvas.width:Math.min(i.canvas.width,r.width),o=0===r.height?i.canvas.height:Math.min(i.canvas.height,r.height);return i.ctx.drawImage(r,0,0,n,o,0,0,i.canvas.width,i.canvas.height),!0}return!1}var Uf=function(t){function e(e){var i=t.call(this,e)||this;return i.uploadHookHelper=i,i.canvas=document.createElement("canvas"),i.canvas.width=16,i.canvas.height=16,i.ctx=i.canvas.getContext("2d"),i.registerUploadHook(Bf),i}return function(t,e){function i(){this.constructor=t}Ff(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype.destroy=function(){t.prototype.destroy.call(this),this.ctx=null,this.canvas=null},e}(Nf),zf=function(t,e){return zf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},zf(t,e)};
|
|
234
|
+
/*!
|
|
235
|
+
* @pixi/filter-color-matrix - v6.1.3
|
|
236
|
+
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
|
|
237
|
+
*
|
|
238
|
+
* @pixi/filter-color-matrix is licensed under the MIT License.
|
|
239
|
+
* http://www.opensource.org/licenses/mit-license
|
|
240
|
+
*/
|
|
241
|
+
/*! *****************************************************************************
|
|
242
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
243
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
244
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
245
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
246
|
+
|
|
247
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
248
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
249
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
250
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
251
|
+
|
|
252
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
253
|
+
and limitations under the License.
|
|
254
|
+
***************************************************************************** */var Xf=function(t){function e(){var e=this,i={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return(e=t.call(this,Pc,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",i)||this).alpha=1,e}return function(t,e){function i(){this.constructor=t}zf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype._loadMatrix=function(t,e){void 0===e&&(e=!1);var i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i},e.prototype._multiply=function(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t},e.prototype._colorMatrix=function(t){var e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e},e.prototype.brightness=function(t,e){var i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.tint=function(t,e){var i=[(t>>16&255)/255,0,0,0,0,0,(t>>8&255)/255,0,0,0,0,0,(255&t)/255,0,0,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.greyscale=function(t,e){var i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.blackAndWhite=function(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)},e.prototype.hue=function(t,e){t=(t||0)/180*Math.PI;var i=Math.cos(t),r=Math.sin(t),n=1/3,o=(0,Math.sqrt)(n),s=[i+(1-i)*n,n*(1-i)-o*r,n*(1-i)+o*r,0,0,n*(1-i)+o*r,i+n*(1-i),n*(1-i)-o*r,0,0,n*(1-i)-o*r,n*(1-i)+o*r,i+n*(1-i),0,0,0,0,0,1,0];this._loadMatrix(s,e)},e.prototype.contrast=function(t,e){var i=(t||0)+1,r=-.5*(i-1),n=[i,0,0,0,r,0,i,0,0,r,0,0,i,0,r,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.saturate=function(t,e){void 0===t&&(t=0);var i=2*t/3+1,r=-.5*(i-1),n=[i,r,r,0,0,r,i,r,0,0,r,r,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)},e.prototype.sepia=function(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)},e.prototype.technicolor=function(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)},e.prototype.polaroid=function(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)},e.prototype.toBGR=function(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)},e.prototype.kodachrome=function(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)},e.prototype.browni=function(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)},e.prototype.vintage=function(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)},e.prototype.colorTone=function(t,e,i,r,n){var o=((i=i||16770432)>>16&255)/255,s=(i>>8&255)/255,a=(255&i)/255,h=((r=r||3375104)>>16&255)/255,l=(r>>8&255)/255,u=(255&r)/255,p=[.3,.59,.11,0,0,o,s,a,t=t||.2,0,h,l,u,e=e||.15,0,o-h,s-l,a-u,0,0];this._loadMatrix(p,n)},e.prototype.night=function(t,e){var i=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.predator=function(t,e){var i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.lsd=function(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)},e.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(Xp);Xf.prototype.grayscale=Xf.prototype.greyscale;var jf={};xc.registerPlugin("batch",Nc),xc.registerPlugin("interaction",wf),dd.registerPlugin("extract",_d),dd.registerPlugin("graphics",ff),dd.registerPlugin("prepare",Uf),dd.registerPlugin("sprite",Qd),dd.registerPlugin("interaction",wf);var Yf={ColorMatrixFilter:Xf},Hf=Object.freeze({__proto__:null,utils:su,display:jf,VERSION:"5.3.0",filters:Yf,get ALPHA_MODES(){return Ks},get BLEND_MODES(){return js},get BUFFER_BITS(){return Xs},get BUFFER_TYPE(){return ra},get CLEAR_MODES(){return Qs},get DRAW_MODES(){return Ys},get ENV(){return Us},get FORMATS(){return Hs},get GC_MODES(){return $s},get MASK_TYPES(){return ea},get MIPMAP_MODES(){return Js},get MSAA_QUALITY(){return ia},get PRECISION(){return ta},get RENDERER_TYPE(){return zs},get SAMPLER_TYPES(){return Vs},get SCALE_MODES(){return qs},get TARGETS(){return Gs},get TYPES(){return Ws},get WRAP_MODES(){return Zs},Circle:ca,DEG_TO_RAD:ua,Ellipse:da,Matrix:ma,ObservablePoint:ga,PI_2:ha,Point:ya,Polygon:fa,RAD_TO_DEG:la,Rectangle:pa,RoundedRectangle:va,get SHAPES(){return aa},Transform:Ia,groupD8:Ca,isMobile:lh,settings:ph,Ticker:dh,TickerPlugin:fh,get UPDATE_PRIORITY(){return uh},Bounds:au,Container:du,DisplayObject:uu,TemporaryDisplayObject:pu,AbstractBatchRenderer:Ic,AbstractMultiResource:Eu,AbstractRenderer:gc,ArrayResource:Tu,Attribute:Yu,BaseImageResource:Cu,BaseRenderTexture:ku,BaseTexture:wu,BatchDrawCall:Ec,BatchGeometry:Oc,BatchPluginFactory:Lc,BatchRenderer:Nc,BatchShaderGenerator:Sc,BatchSystem:sp,BatchTextureArray:Tc,Buffer:Gu,BufferResource:bu,CanvasResource:Iu,ContextSystem:hp,CubeResource:Su,Filter:Xp,FilterState:ep,FilterSystem:np,Framebuffer:Du,FramebufferSystem:pp,GLFramebuffer:lp,GLProgram:sc,GLTexture:dc,Geometry:Ju,GeometrySystem:dp,IGLUniformData:oc,INSTALLED:vu,ImageBitmapResource:Lu,ImageResource:Ou,MaskData:fp,MaskSystem:Gp,ObjectRenderer:op,Program:Bp,ProjectionSystem:Zp,Quad:Ku,QuadUv:Qu,RenderTexture:Xu,RenderTexturePool:ju,RenderTextureSystem:Qp,Renderer:xc,Resource:xu,SVGResource:Au,ScissorSystem:Vp,Shader:Up,ShaderSystem:uc,SpriteMaskFilter:Hp,State:zp,StateSystem:pc,StencilSystem:qp,System:wc,Texture:Uu,TextureGCSystem:cc,TextureMatrix:Yp,TextureSystem:fc,TextureUvs:Fu,UniformGroup:tp,VideoResource:Mu,ViewableBuffer:Cc,autoDetectRenderer:bc,autoDetectResource:yu,checkMaxIfStatementsInShader:Dp,createUBOElements:ic,defaultFilterVertex:Pc,defaultVertex:"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",generateProgram:ac,generateUniformBufferSync:nc,getTestContext:Pp,getUBOData:rc,resources:Rc,systems:Fc,uniformParsers:Op,AppLoaderPlugin:ed,Loader:td,get LoaderResource(){return qc},TextureLoader:id,Sprite:ad,CanvasRenderer:dd,canUseNewCanvasBlendModes:pd,canvasUtils:fd,CanvasExtract:_d,FillStyle:bd,GRAPHICS_CURVES:xd,Graphics:Zd,GraphicsData:jd,GraphicsGeometry:Gd,get LINE_CAP(){return gd},get LINE_JOIN(){return yd},LineStyle:Wd,graphicsUtils:Jd,CanvasSpriteRenderer:Qd,get TEXT_GRADIENT(){return $d},Text:cf,TextMetrics:hf,TextStyle:nf,CanvasGraphicsRenderer:ff,InteractionData:yf,InteractionEvent:mf,InteractionManager:wf,InteractionTrackingData:_f,interactiveTarget:bf,CanvasPrepare:Uf});function Gf(t={}){if(t.children)for(var e=t.children.length-1;e>=0;e--)t.children[e].destroy({children:!0}),t.removeChild(t.children[e])}function Wf(t,e,i){var r=new ad(t);return r.x=0,r.y=0,r.anchor.x=.5,r.anchor.y=.5,r.rotation=0,e&&(r.width=e),i&&(r.height=i),r}var Vf={fill:16777215,stroke:4605266,strokeWidth:.5,selectFill:15398134,selectStroke:7321278,selectStrokeWidth:1};function qf(t,e,i){var r=parseInt(t)<<16,n=parseInt(e)<<8,o=parseInt(i);return Math.max(r+n+o,1)}var Zf=({isSelected:t,state:i,node:r})=>{var n,o,s,a,h=function({node:t,state:e}){var i=e&&e.settings.theme.showAssetTextures;return{wallContour:{strokeWidth:1.5},wall:{fill:5396576,selectFill:9677484,selectStroke:5671825},curtain:{fill:15659510},column:{fill:5396576,selectFill:9677484,selectStroke:5671825},interior:{fill:i?null:15659510,selectFill:i?null:16116704,selectStrokeWidth:2.5},stairs:{fill:15987440},door:{selectStroke:6594727},window:{selectStroke:6594727},railing:{},polyfloor:(()=>{if("polyfloor"!==t.type)return{};var e="kitchen"!==t.usage&&me(t.usage),i={care:14804201,circulate:15987440,fallback:16777215};return{fill:e&&i[e]||i.fallback,fillOpacity:"void"===e?t._isSelected?.5:.05:void 0}})(),"a:helper:spaceDivider":{fill:14541549,stroke:14541549,strokeOpacity:.8,strokeWidth:1,selectFill:16116704,selectStroke:11494980,selectStrokeWidth:1},floorplan:{}}[t.type]}({node:r,state:i}),l=(({state:t,node:e})=>{var i,r=t.settings.theme.elements,n=e.type;"column"===n&&(n="wall"),"polyfloor"!==n&&"floor"!==n||(n="space"),"interior"===n&&(n="asset"),e.class&&("door"===n&&e.class.includes("entryDoor")?i="entryDoor":"window"===n&&e.class.includes("balconyDoor")?i="balconyDoor":"window"===n&&e.class.includes("slidingDoor")?i="slidingDoor":"box"===n&&e.class.includes("preWall")&&(i="preWall"));var o=r[i]||r[n]||{};if("space"===n){var s=ye[e.usage]||{},a="program"===s.type?e.usage:s.program;o.usage&&o.usage[e.usage]?o=o.usage[e.usage]:o.program&&o.program[a]&&(o=o.program[a])}else if("stairs"===n&&!r[n]){var h,l,u,p;null!=r&&null!==(h=r.space)&&void 0!==h&&null!==(l=h.usage)&&void 0!==l&&l.staircase?o=r.space.usage.staircase:null!=r&&null!==(u=r.space)&&void 0!==u&&null!==(p=u.program)&&void 0!==p&&p.circulate&&(o=r.space.program.circulate)}var{fill:c,fillOpacity:d,stroke:f,strokeWidth:v}=o,y={};return c&&Array.isArray(c)&&(y.fill=qf(...c),y.selectFill=qf(...c.map((t=>.9*t)))),f&&Array.isArray(f)&&(y.stroke=qf(...f)),d&&Number.isFinite(d)&&(y.fillOpacity=Math.max(Math.min(d,1),0)),v&&Number.isFinite(v)&&(y.strokeWidth=v),y})({node:r,state:i}),u={};if(null!==(n=r._highlight)&&void 0!==n&&n.fill&&Array.isArray(null===(o=r._highlight)||void 0===o?void 0:o.fill)){var p,c=r._highlight.fill;Math.max(...c)<=1&&(c=c.map((t=>Math.round(255*t))));var d,f=qf(...c);if(u={fill:f,selectFill:f},Number.isFinite(null===(p=r._highlight)||void 0===p?void 0:p.fillOpacity))u.fillOpacity=Math.max(Math.min(null===(d=r._highlight)||void 0===d?void 0:d.fillOpacity,1),0)}if(null!==(s=r._highlight)&&void 0!==s&&s.outline&&Array.isArray(null===(a=r._highlight)||void 0===a?void 0:a.outline)){var v,y,g,m=qf(...r._highlight.outline);if(u=e(e({},u),{},{stroke:m,selectStroke:m}),Number.isFinite(null===(v=r._highlight)||void 0===v?void 0:v.outlineWidth))u.strokeWidth=null===(y=r._highlight)||void 0===y?void 0:y.outlineWidth,u.selectStrokeWidth=null===(g=r._highlight)||void 0===g?void 0:g.outlineWidth}var _=e(e(e({},h),l),u),x={fill:_&&void 0!==_.fill?_.fill:Vf.fill,fillOpacity:_&&void 0!==_.fillOpacity?_.fillOpacity:Vf.fillOpacity,stroke:_&&_.stroke||Vf.stroke,strokeWidth:_&&_.strokeWidth||Vf.strokeWidth};return t&&(x={fill:_&&void 0!==_.selectFill?_.selectFill:Vf.selectFill,fillOpacity:_&&void 0!==_.fillOpacity?_.fillOpacity:Vf.fillOpacity,stroke:_&&_.selectStroke||Vf.selectStroke,strokeWidth:_&&_.selectStrokeWidth||Vf.selectStrokeWidth}),x};function Jf({shape:t,state:e,node:i={},gfx:r,props:n,isSelected:o,isActiveGroup:s}){if(r&&r.lineStyle){n=n||Zf({state:e,node:i,isActiveGroup:s,isSelected:o});var a=e.scale,h="line"!==t.type&&t.isContour&&n.fill;if("line"!==t.type&&t.isContour&&n.texture?r.beginTextureFill({texture:n.texture,matrix:n.matrix}):h&&r.beginFill(n.fill,n.fillOpacity),r.lineStyle({width:n.strokeWidth,color:n.stroke,alpha:n.strokeOpacity||1,native:n.native||!1}),"rect"===t.type){var{position:l,width:u,height:p}=t;r.drawRect(l[0]*a,l[1]*a,u*a,p*a)}else if("circle"===t.type){var{position:c,r:d}=t;r.drawCircle(c[0]*a,c[1]*a,d*a)}else if("polygon"===t.type){var{points:f,holes:v}=t;!function(t=[],e=[],i={},r=100,n,o){if(!t||!Array.isArray(t)||!t.length)return n;n.lineStyle({width:i.strokeWidth,color:i.stroke,native:i.native||!1});var s=t.reduce(((t,e)=>t.concat(e)),[]).map((t=>t*r));i.dash?(n.drawDashedPolygon(s),o&&(n.lineStyle(0,!1),n.drawPolygon(s))):n.drawPolygon(s);if(e.length){o&&n.beginHole();for(var a=0;a<e.length;a++){var h=e[a].reduce(((t,e)=>t.concat(e)),[]).map((t=>t*r));n.drawPolygon(h)}o&&n.endHole()}}(f,v,n,a,r,h)}else if("path"===t.type){var{segments:y}=t,g=[0,0];y.forEach((t=>{"M"!==t[0]&&"L"!==t[0]||(g=[t[1],t[2]]),"M"===t[0]?r.moveTo(t[1]*a,t[2]*a):"L"===t[0]?r.lineTo(t[1]*a,t[2]*a):"A"===t[0]?function(t,e,i,r,n,o,s,a,h,l,u=100){e*=u,i*=u,r*=u,n*=u,h*=u,l*=u;var p=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))},c=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(p(t)*p(e))},d=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(c(t,e))},f=Math.cos(o)*(e-h)/2+Math.sin(o)*(i-l)/2,v=-Math.sin(o)*(e-h)/2+Math.cos(o)*(i-l)/2,y=Math.pow(f,2)/Math.pow(r,2)+Math.pow(v,2)/Math.pow(n,2);y>1&&(r*=Math.sqrt(y),n*=Math.sqrt(y));var g=(s==a?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(n,2)-Math.pow(r,2)*Math.pow(v,2)-Math.pow(n,2)*Math.pow(f,2))/(Math.pow(r,2)*Math.pow(v,2)+Math.pow(n,2)*Math.pow(f,2)));isNaN(g)&&(g=0);var m=g*r*v/n,_=g*-n*f/r,x=(e+h)/2+Math.cos(o)*m-Math.sin(o)*_,b=(i+l)/2+Math.sin(o)*m+Math.cos(o)*_,P=d([1,0],[(f-m)/r,(v-_)/n]),w=[(f-m)/r,(v-_)/n],E=[(-f-m)/r,(-v-_)/n],T=d(w,E);c(w,E)<=-1&&(T=Math.PI),c(w,E)>=1&&(T=0);var C=r>n?r:n;t.arc(x,b,C,P,P+T,1-a)}(r,g[0],g[1],...t.slice(1)):"Q"===t[0]?r.quadraticCurveTo(t[1]*a,t[2]*a,t[3]*a,t[4]*a):"Z"===t[0]&&r.lineTo(y[0][1]*a,y[0][2]*a)}))}else if("line"===t.type){var{start:m=[],end:_=[]}=t;r.moveTo(m[0]*a,m[1]*a),r.lineTo(_[0]*a,_[1]*a)}else if("polyline"===t.type){var{points:x}=t;n.dash?r.drawDashedPolygon(x.reduce(((t,e)=>t.concat(e)),[]).map((t=>t*a)),!0):x.forEach(((t,e)=>{0===e?r.moveTo(t[0]*a,t[1]*a):r.lineTo(t[0]*a,t[1]*a)}))}else if("group"===t.type){var{position:b=[0,0],rotation:P=0,scale:w=[1,1]}=t,E=new Zd;E.x=b[0]*a,E.y=b[1]*a,E.rotation=-Math.PI/180*P,E.scale.x=w[0],E.scale.y=w[1],t.children.forEach((t=>Jf({shape:t,state:e,node:i,gfx:E}))),r.addChild(E)}else if("text"===t.type){var{position:T=[0,0],rotation:C=0,text:I,align:S="center",fill:O=0,fontSize:A=16}=t,M=new nf({fontFamily:"Avenir",fontSize:A,fill:O,stroke:16777215,strokeThickness:3}),L=new cf(I,M);L.nextLineHeightBehavior=!0,L.x=T[0]*e.scale,L.y=T[1]*e.scale,L.rotation=-Math.PI/180*C,L.anchor.x=.5,L.anchor.y="center"===S?.5:"bottom"===S?1:0,r.addChild(L)}h&&r.endFill()}}Zd.prototype.drawDashedPolygon=function(t,e=!1,i=16,r=8){for(var n=[],o=0;o<t.length-1;o+=2)n.push({x:t[o],y:t[o+1]});var s,a,h,l=0,u=0,p=e?1:0;for(s=0;s<n.length-p;s++){a=n[s];var c=(h=s==n.length-1?n[0]:n[s+1]).x-a.x,d=h.y-a.y,f=Math.sqrt(c*c+d*d),v={x:c/f,y:d/f},y=0;for(this.moveTo(a.x+u*v.x,a.y+u*v.y);y<=f;)y+=u,(y+=l>0?l:i)>f?(l=y-f,y=f):l=0,this.lineTo(a.x+y*v.x,a.y+y*v.y),(y+=r)>f&&0==l?u=y-f:(u=0,this.moveTo(a.x+y*v.x,a.y+y*v.y))}};class Kf{constructor(t,e="_helperLayer"){var i=t._getViewport().children.find((t=>t[e]));this._container=new du,this._state=t,i.addChild(this._container)}draw({shapes:t=[],pos:e=[0,0],alpha:i=1,preserve:r=!1,interactive:n=!1,id:o,isHandler:s=!1,onDrag:a,scaleOnZoom:h=!1}){if(this._container){r||Gf(this._container);var l=new Zd;l.alpha=i;var u=Math.min(1/this._state.zoom);return e&&(l.x=e[0]*this._state.scale,l.y=e[1]*this._state.scale),n&&(l.interactive=!0,l._nodeId=o,s&&(l._isHandler=!0,l._handlerType="polygon",l._onDrag=a)),l.parentLayer=this._state._gfxLayers.measure,u&&h&&(l.scale.x=l.scale.y=u),this._container.addChild(l),t.forEach((t=>Jf({shape:t,state:this._state,gfx:l,props:t.props}))),this._state.viewportNeedsUpdate=!0,this._state.viewportPaused&&this._state.startAnimationLoop(),{set:({pos:t,props:e}={})=>{var i=Math.min(1/this._state.zoom);t&&(l.x=t[0]*this._state.scale,l.y=t[1]*this._state.scale),i&&h&&(l.scale.x=l.scale.y=i),e&&(e.stroke&&(l.geometry.graphicsData[0].lineStyle.color=e.stroke),e.strokeWidth&&(l.geometry.graphicsData[0].lineStyle.width=e.strokeWidth),l.geometry.invalidate()),this._state.viewportNeedsUpdate=!0,this._state.viewportPaused&&this._state.startAnimationLoop()}}}}drawImage({url:t,width:e,height:i,mask:r,options:n={}}){if(n.pixelated?ph.SCALE_MODE=qs.NEAREST:ph.SCALE_MODE=qs.LINEAR,this._container){Gf(this._container);var o=ad.from(t);if(o.width=e*this._state.scale,o.height=i*this._state.scale,o.parentLayer=this._state._gfxLayers.measure,r){var{x:s,z:a,length:h,width:l}=lt([r]);o.x=(s+h/2)*this._state.scale,o.y=(a+l/2)*this._state.scale,o.anchor.set(.5);var u=new Zd;Jf({shape:{isContour:!0,type:"polygon",points:r},state:this._state,gfx:u,props:{fill:16724736}}),this._container.addChild(u),o.mask=u}this._container.addChild(o),this._state.viewportNeedsUpdate=!0,this._state.viewportPaused&&this._state.startAnimationLoop(),setTimeout((()=>{this._state.viewportNeedsUpdate=!0}),100)}}destroy(){this._container&&(this._container.destroy({children:!0,texture:!0,baseTexture:!0}),this._state.viewportNeedsUpdate=!0,this._state.viewportPaused&&this._state.startAnimationLoop(),delete this._container,delete this._state)}}class Qf{constructor(t){this.state=t,this.state.on("mousemove",this.draw,this),this.state.on("viewbox",this.draw,this),this.isSnapping=!1,this.isEdge=!1}draw(){if(this.graphic||(this.graphic=new Kf(this.state,"_measureLayer")),this.cursor){var t=this.isSnapping?6789887:12303291,e=this.isSnapping?2:1.5;this.cursor.set({pos:this.pos,props:{stroke:t,strokeWidth:e}})}else this.cursor=this.graphic.draw({shapes:[{type:"circle",position:[0,0],r:.06,props:{stroke:6789887,strokeWidth:1.5}}],scaleOnZoom:!0})}set({pos:t}){this.pos=t,this.draw()}snapState(){return this.isSnapping?this.isEdge?"edge":"point":""}destroy(){this.state.off("mousemove",this.draw),this.state.off("viewbox",this.draw),this.graphic&&this.graphic.destroy(),this.graphic=void 0,this.state.snapCursor=null,this.state=null,this.cursor=null}}class $f{constructor(t){this.state=t,this.points=[],this.polygon=[],this.drawing=!0,this.isClosed=!1,this.state.isDragging=!0,this.state.on("key",this.handleKey,this),this.state.on("mousemove",this.setSnapCursor,this),this.state.on("click",this.drawPoint,this),this.state.on("dblclick",this.drawPoint,this),this.state.on("viewbox",this.zoomPoints,this)}setSnapCursor(){if(this.drawing){if(this.state.snapCursor||(this.state.snapCursor=new Qf(this.state)),!this.state.computed.snapPoints.length)return this.state.snapCursor.set({pos:this.state.cursor}),void this.draw();var t=this.state.computed.snapPoints,e=Math.max(Math.min(this.state.viewbox.length/50,this.state.viewbox.width/50,.25),.05),i=na(this.state.cursor,t,[0,0],e);this.state.snapCursor.isSnapping=i,this.state.snapCursor.set({pos:i||this.state.cursor}),this.draw()}}polygonDone(){this.drawing=!1,this.state.snapCursor&&this.state.snapCursor.destroy(),this.state.emit("polygon-done",{}),this.state.isDragging=!1,this.draw()}drawPoint(t){if(this.drawing){if(parseInt(t.nodeId)===t.nodeId||t.isDoubleClick){var e=0===t.nodeId;return"distance"===this.state.isDrawingPolygon&&e&&(this.isClosed=!0),void this.polygonDone()}var{pos:i}=this.state.snapCursor;this.points.push([...i]),this.state.editingPolygon=this.points}}updatePolygon(t,e){Number.isFinite(t)?this.lastIndex=t:t=this.lastIndex;var i=[e.x/this.state.scale,e.y/this.state.scale],r=this.state.computed.snapPoints,n=Math.max(Math.min(this.state.viewbox.length/50,this.state.viewbox.width/50,.25),.05),o=r.length&&na(i,r,[0,0],n);this.points[t]=o||i,this.state.editingPolygon=this.points,this.draw()}handleKey({key:t}={key:null}){var e=this.state.settings.shortcuts;t===e.measureConfirm&&this.drawing&&this.points.length>1?this.polygonDone():t===e.measureCancel?(this.drawing=!0,this.isClosed=!1,this.points=[],this.destroy()):t===e.measureUndo&&this.drawing&&this.points.splice(this.points.length-1,1)}draw(){if(this.graphic||(this.graphic=new Kf(this.state,"_measureLayer")),this.isArea="area"===this.state.isDrawingPolygon,this.polygon=this.drawing&&!this.state.isMobile&&this.state.snapCursor?[...this.points,this.state.snapCursor.pos]:this.points,this.polygon.length<2)this.graphic&&(this.graphic.destroy(),this.graphic=null);else{this.length=Math.round(100*Et(this.polygon,this.isClosed))/100,this.lengthDisplay=(()=>{if("imperial"===this.state.settings.units.system){var{feetInt:t,inchDisplay:e}=Ms(this.length);return"".concat(t,"′ ").concat(e,"″")}return this.length+" m"})();var t=this.polygon.length<2?0:$({x:this.polygon[0][0],z:this.polygon[0][1]},{x:this.polygon[1][0],z:this.polygon[1][1]}),e=this.polygon.map((t=>t.map((t=>Number(t.toFixed(10)))))).slice(0,this.isArea?void 0:2),i=this.isArea?Lt(e):[e[0][0]+(e[1][0]-e[0][0])/2,e[0][1]+(e[1][1]-e[0][1])/2];this.area=Math.round(100*Math.abs(yt(this.polygon)))/100,this.areaDisplay=(()=>{if("imperial"===this.state.settings.units.system){var{sqft:t}=Ls(this.area);return Math.round(10*t)/10+"ft²"}return this.area+"m²"})(),this.size=(()=>{var t=1e3/this.state.client[0]*this.state.viewbox.width/70;return Math.min(t,1)})();var r=this.isArea||this.isClosed?"polygon":"polyline",n={stroke:6789887,dash:!0,strokeWidth:2,native:!0},o=this.lengthDisplay,s=t;this.isArea&&(n.fill=22015,n.fillOpacity=.04,n.isContour=!0,o=this.areaDisplay,s=0);var a=[{type:r,points:this.polygon,isContour:!0,props:n}],h={shapes:[{type:"text",text:o,position:[0,0],rotation:s,align:"bottom",fontSize:15,fill:22015}],pos:i,preserve:!0,scaleOnZoom:!0},l=this.points.map(((t,e)=>({shapes:[{type:"circle",isContour:!0,position:[0,0],r:.15,props:{fill:22015,fillOpacity:.1}},{type:"circle",isContour:!0,position:[0,0],r:.05,props:{stroke:22015,fill:16777215,strokeWidth:1.5}}],pos:t,preserve:!0,scaleOnZoom:!0,interactive:!0,id:e,isHandler:!0,onDrag:this.updatePolygon.bind(this)})));this.state.isMeasuring&&(this.isArea?this.area:this.length)&&l.push(h),this.graphic.draw({shapes:a}),this._points=l.map((t=>this.graphic.draw(t)));var u=this.isArea?{area:this.area}:{distance:this.length};this.state.emit("polygon-draw",u)}}zoomPoints(){this._points&&this._points.forEach((t=>t.set()))}destroy(){this.graphic&&this.graphic.destroy(),this.graphic=void 0,this.points=null,this.polygon=null,this.state._polygonHelper=null,this.state.snapCursor&&this.state.snapCursor.destroy(),this.state.off("key",this.handleKey),this.state.off("mousemove",this.setSnapCursor),this.state.off("click",this.drawPoint),this.state.off("dblclick",this.drawPoint),this.state.off("viewbox",this.zoomPoints),this.state=null}}class tv{constructor(t){this.rotation=0,this.oppositePoints=[],this.drawing=!0,this.state=t,this.state.editingRectangle&&(this.oppositePoints=this.state.editingRectangle.oppositePoints||[],this.rotation=this.state.editingRectangle.rotation||0,this.drawing=!1,this.state.lastSceneClick=[this.x+this.w,this.y],this.draw(!1)),this.state.on("key",this.handleKey,this),this.state.on("mousemove",this.setSnapCursor,this),this.state.on("click",this.drawPoint,this),this.state.on("viewbox",this.zoomPoints,this),this.state.on("drag-end",this.handleDragEnd,this)}setSnapCursor(){if(this.drawing){if(this.state.snapCursor||(this.state.snapCursor=new Qf(this.state)),!this.state.computed.snapPoints.length)return this.state.snapCursor.set({pos:this.state.cursor}),void this.draw();var t=this.state.computed.snapPoints,e=Math.max(Math.min(this.state.viewbox.length/50,this.state.viewbox.width/50,.25),.05),i=na(this.state.cursor,t,[0,0],e);this.state.snapCursor.isSnapping=i,this.state.snapCursor.set({pos:i||this.state.cursor}),this.draw()}}updateRect(t,e){Number.isFinite(t)?this.lastIndex=t:t=this.lastIndex;var i=[e.x/this.state.scale,e.y/this.state.scale];this.oppositePoints[this.lastIndex]=i,this.state.editingRectangle={oppositePoints:this.oppositePoints,rotation:this.rotation},this.draw()}handleDragEnd(){this.oppositePoints.length>1&&this.drawPoint()}drawPoint(){if(this.oppositePoints.length<2){this.state.isDragging=!0;var t=this.state.snapCursor.pos;this.oppositePoints.push([...t])}this.oppositePoints.length>1&&(this.drawing=!1,this.state.isDragging=!1,this.state.editingRectangle={oppositePoints:this.oppositePoints,rotation:this.rotation},this.state.emit("rectangle-done"),this.state.lastSceneClick=[Math.max(this.oppositePoints[1][0],this.oppositePoints[0][0]),Math.min(this.oppositePoints[1][1],this.oppositePoints[0][1])],this.state.snapCursor&&this.state.snapCursor.destroy())}handleKey({key:t}={}){var e=this.state.settings.shortcuts;t===e.measureConfirm&&this.oppositePoints.length>1&&(this.state.isDrawingRectangle=!1,this.oppositePoints=[],this.state.editingRectangle=null),t===e.measureCancel&&(this.drawing=!1,this.state.isDragging=!1,this.state.isDrawingRectangle=!1,this.oppositePoints=[],this.state.editingRectangle=null,this.state.actions.customComponent=null,this.destroy(),this.state.setActive())}draw(){var t,e=this.oppositePoints[1]||this.state.snapCursor.pos;if(0===this.oppositePoints.length)t=[];else{var i=this.oppositePoints[0],r=L(e[0]-i[0],e[1]-i[1]),n=-this.rotation*Math.PI/180,o=L(Math.cos(n),Math.sin(n)),s=R(r,o),a=L(Math.cos(n-Math.PI/2),Math.sin(n-Math.PI/2)),h=R(r,a),l=N(M(),o,s),u=N(M(),a,h);t=[i,[i[0]+l[0],i[1]+l[1]],e,[i[0]+u[0],i[1]+u[1]]]}this.oppositePoints.length&&(this.x=Math.min(e[0],this.oppositePoints[0][0]),this.y=Math.min(e[1],this.oppositePoints[0][1]),this.h=Math.abs(e[1]-this.oppositePoints[0][1]),this.w=Math.abs(e[0]-this.oppositePoints[0][0])),this.graphic||(this.graphic=new Kf(this.state,"_measureLayer"));var p=[{type:"polygon",points:t,isContour:!0,props:{stroke:6789887,dash:!0,strokeWidth:2,fill:22015,fillOpacity:.1,native:!0}}],c=t.filter(((t,e)=>e%2==0)).map(((t,e)=>({shapes:[{type:"circle",isContour:!0,position:[0,0],r:.15,props:{fill:22015,fillOpacity:.1}},{type:"circle",isContour:!0,position:[0,0],r:.05,props:{stroke:22015,fill:16777215,strokeWidth:1.5}}],pos:t,preserve:!0,scaleOnZoom:!0,interactive:!0,id:e,isHandler:!0,onDrag:this.updateRect.bind(this)})));this.graphic.draw({shapes:p}),this._points=c.map((t=>this.graphic.draw(t))),this.state.emit("rectangle-draw",{oppositePoints:this.oppositePoints,rotation:this.rotation})}zoomPoints(){this._points&&this._points.forEach((t=>t.set()))}destroy(){this.graphic&&this.graphic.destroy(),this.graphic=void 0,this.state.snapCursor&&this.state.snapCursor.destroy(),this.state.snapCursor=null,this.state._rectangleHelper=null,this.state.off("key",this.handleKey),this.state.off("mousemove",this.setSnapCursor),this.state.off("click",this.drawPoint),this.state.off("drag-end",this.handleDragEnd),this.state.off("viewbox",this.zoomPoints)}}function ev({state:t,resourceId:e}){var i=t._queue;if(!i.inProgress[e]){if(!e){if(!i.data.length)return;e=i.data.splice(0,1)[0]}var r=function(t){t._loaderPool||(t._loaderPool=[]);var e,i=t._loaderPool.filter((t=>!t._isLoading));i.length?e=i[0]:t._loaderPool.length<10&&((e=new td(o.api.storageUrl,1))._isLoading=!1,t._loaderPool.push(e));return e}(t);if(r){var n=function({state:t,resourceId:e,loader:i}){var r;if(null!==(r=t._textureQueue[e])&&void 0!==r&&r.texture)return Promise.resolve();if(!t._textureQueue[e])return Promise.reject("no texture data to load ".concat(e));i._isLoading=!0;var{textureUrl:n,productId:o}=t._textureQueue[e];return $l(),new Promise((r=>{i.add(e,n),i.load(((e,i)=>{Object.keys(i).forEach((r=>{e.reset(),e._isLoading=!1,t._textureQueue[r].loadStage>1?$l():(t._textureQueue[r].imageData=i[r].texture,t._textureQueue[r].loadStage=1,i[r].error&&(console.warn("failed loading resource",r),t._textureQueue[r].error=!0),o&&3!==t._productQueue[o].loadStage||iv(r,t))})),t.emit("update-loading",0),r(i)}))}))}({state:t,resourceId:e,loader:r});n.then((()=>{delete i.inProgress[e],i.done.push(e),ev({state:t})})).catch((()=>{delete i.inProgress[e],i.error.push(e),ev({state:t})})),i.inProgress[e]=n}else i.data.push(e)}}function iv(t,e){var i=e._getViewport(),r=null==i?void 0:i._renderer,n=e._textureQueue[t],o=n.error;if($l(),!n.texture){var s,a=null==n?void 0:n.productId,h=e.products[a],l=new du;if(!o){if(s=new ad(n.imageData),n.applyFilter){var u=new Yf.ColorMatrixFilter;u.matrix=[.7,0,0,0,.25,0,.7,0,0,.25,0,0,.7,0,.25,0,0,0,1,0],s.filters=[u]}l.addChild(s)}var p=new Zd,c=a&&e.products[a]._shapes||[];if(c.length){c.forEach((t=>{var i;o&&(i={strokeWidth:.5,stroke:1,fill:16316664}),Jf({shape:t,state:e,node:{type:"interior"},gfx:p,props:i})}));var d=p.generateCanvasTexture(qs.LINEAR,1.5),f=new ad(d);if(f.anchor=n.anchor,!o){var v=s.width/h.boundingBox.length,y=(null==n?void 0:n.offset)||{x:0,y:0};f.scale.x=s.width/f.width,f.scale.y=s.height/f.height,f.x=s.width/2-y.x*v,f.y=s.height/2-y.y*v}l.addChild(f)}n.texture=r.generateTexture(l,{scaleMode:qs.LINEAR,resolution:1.5}),n.loadStage=2,l.destroy(!0)}n.nodes.forEach((i=>{e.emit("product-load-stage",{node:i,args:{_loadStage:3,_textureId:t}})}))}function rv(t,e=0){return({door:31,window:31,column:30,wall:30,closet:20,railing:20,curtain:20,kitchen:20,group:12,box:11,polybox:11,interior:10,"a:helper:spaceDivider":5,stairs:5,floor:0,polyfloor:0}[t]||0)+e}function nv({node:t,ctx:e,parentNode:i,state:r,update:n=null}){var s;if(t){i=i||t.parent;var a=["plan","level","group"].includes(t.type),h=t.id&&(t._isSelected||t.getParents().some((t=>t._isSelected))),l=t.id&&t._highlight,u=t.id&&t.getParents().some((t=>t.id===r.activeGroup)),p=r.scale,c=n&&n.container||new du,d=r._gfxLayers.scene;if("door"===t.type){var f=i.w,v="front"===t.side?1:-1,y="left"===t.hinge?1:-1,g=i.controlLine,m="center"===g?-f/2:"front"===g?-f:0;c.x=(t.x+t.l/2)*p,c.y=(f/2+m)*p,c.scale.x=y*-v,c.scale.y=v}else"stairs"!==t.type&&(c.x=t.x*p,c.y=t.z*p,c.rotation=-Math.PI/180*t.ry||0);if("interior"!==t.type){var _=rv(t.type);c.parentLayer=d,c.zOrder=_}var x,b,{hideElements:P,showCeilingLamps:w,showFloorPlan:E,theme:T,showSpaceDividers:C,xrayMode:I}=r.settings,S=null===(s=t.src)||void 0===s?void 0:s.substring(1),O=r.products[S],A="interior"===t.type&&(null==O?void 0:O.isCeilingLamp)&&!w||T.wallContours&&["wall","column"].includes(t.type)||P.includes(t.type)||!C&&"a:helper:spaceDivider"===t.type,M=r._gfxNodes[t.id],L="interior"!==t.type||"interior"===t.type&&2===(null==M?void 0:M.loadStage),N=!A&&L&&us(t,i,r)||[];if(A)x=void 0;else if("interior"===t.type){n&&Gf(c);var R=rv(t.type,null==O?void 0:O.order);if(c.parentLayer=d,c.zOrder=R,2===(null==M?void 0:M.loadStage))x=new Zd;else if(T.showAssetTextures||3!==(null==M?void 0:M.loadStage))if((null==M?void 0:M.loadStage)>2&&T.showAssetTextures&&null!=O&&O.boundingPoints&&null!=M&&M.textureId){var{texture:D,anchor:k}=r._textureQueue[M.textureId]||{};if(D){var F=O.boundingBox.length*p,B=O.boundingBox.width*p;(x=Wf(D,F,B)).anchor.x=k.x,x.anchor.y=k.y,x.zIndex=1}(h||l)&&(N=O._shapes||[],(b=new Zd).zIndex=5)}else x=new ad(r._dummyTexture);else x=new Zd,N=O._shapes||[]}else if("floorplan"===t.type){if(!E)return;var U=t.id;if(c._textureId=U,null!=M&&M.loadStage){var{texture:z}=r._textureQueue[M.textureId]||{};z&&(x=Wf(z,t.l*p,t.w*p)),b=new Zd,x.zIndex=1,b.zIndex=5}else{var X=o.api.storageUrl+t.file;r._textureQueue[U]={loadStage:0,nodes:[t],textureUrl:X,applyFilter:!1},ev({state:r,resourceId:U}),x=new Zd}}else a||(n&&Gf(c),x=new Zd);if(N.forEach((e=>Jf({shape:e,state:r,node:t,gfx:b||x,isSelected:h,isActiveGroup:u}))),x&&(x.interactive=!0,c.addChild(x),x._nodeId=t.id),b&&c.addChild(b),!a){var j=h||u||!I?1:.7;c.alpha=j}n&&!n.updateChildren&&"wall"!==t.type&&"interior"!==t.type||t&&t.children&&t.children.forEach((e=>{nv({node:e,ctx:c,parentNode:t,state:r})})),r._gfxNodes[t.id]||(r._gfxNodes[t.id]={}),r._gfxNodes[t.id].nodeContainer=c,n||e.addChild(c)}}function ov({node:t,event:e,args:i,state:r}){if((r=r||this).isSceneStructureLoaded&&t){if("add-child"===e){var{nodeContainer:n}=r._gfxNodes[t.id]||{};nv({node:i,ctx:n,parentNode:t,state:r})}else if("remove-child"===e){var o,s=r.active.findIndex((t=>t.id===i.id));s>=0&&(r.active.splice(s,1),r.emit("select",{}));var a=r._getViewport&&r._getViewport(),h=a&&(null===(o=a._getHandler)||void 0===o?void 0:o.call(a));h&&(h.visible=!1);var{nodeContainer:l}=r._gfxNodes[i.id]||{};l&&(l.parent.removeChild(l),l.destroy({children:!0})),this.viewportNeedsUpdate=!0,r.viewportPaused&&r.startAnimationLoop(),delete r._gfxNodes[i.id]}setTimeout((()=>{this.viewportNeedsUpdate=!0}),100)}}function sv({node:t,args:e,event:i,state:r}){if(r=r||this,"stairs"!==t.type&&"door"!==t.type){var{nodeContainer:n}=r._gfxNodes[t.id]||{};n&&(n.x=t.x*r.scale,n.y=t.z*r.scale,n.rotation=-Math.PI/180*t.ry,r.viewportNeedsUpdate=!0,r.viewportPaused&&r.startAnimationLoop())}else hv({node:t,args:e,event:i,state:r})}function av(t){hv(e(e({},t),{},{state:this}))}function hv({node:t,args:e,state:i,event:r}){"set-materials"===r&&(e={materials:e}),i=i||this;var{nodeContainer:n}=i._gfxNodes[t.id]||{};if(n&&"level"!==t.type&&"plan"!==t.type){if(e._loadStage&&(i._gfxNodes[t.id].loadStage=e._loadStage),e._textureId&&(i._gfxNodes[t.id].textureId=e._textureId),Object.keys(e).includes("locked")){var o=this._getViewport&&this._getViewport(),s=null==o?void 0:o._getHandler();e.locked?Gf(s):s._update({handler:s,state:i})}Gf(n),nv({node:t,ctx:n.parent,state:i,update:{container:n,args:e,updateChildren:void 0!==e._isSelected}}),i.viewportNeedsUpdate=!0,i.viewportPaused&&i.startAnimationLoop()}}function lv({state:t,xrayMode:e}){t=t||this,Object.entries(t._gfxNodes).forEach((([i,r])=>{var n=t.scene.nodesById[i];if(!["plan","level","group"].includes(n.type)){var{nodeContainer:o}=r,s=n.id&&(n._isSelected||n.getParents().some((t=>t._isSelected))),a=n.id&&n.getParents().some((e=>e.id===t.activeGroup)),h=s||a||!e?1:.7;o.alpha=h}})),t.viewportNeedsUpdate=!0,t.viewportPaused&&t.startAnimationLoop()}function uv(t,e){var i=Zf({state:e,node:{type:"wallContour"},isSelected:!1}),r=new Zd,n=e._gfxLayers.scene,o=rv("wall");r.parentLayer=n,r.zOrder=o,e.computed.wallContours.forEach((t=>{Jf({shape:{type:"polygon",isContour:!0,points:t[0],holes:t.slice(1)},state:e,gfx:r,props:i})})),t.addChild(r)}function pv(t,e,i){var r;if(!i.settings.hideElements.includes("roomStamp")){var{text:n,textOutline:o=!0}=(null===(r=i.settings.theme.elements)||void 0===r?void 0:r.roomStamp)||{},s=i.settings.theme.background.color,a="transparent"!==s?s:"#eee",h=n?Rl(kl(n.map((t=>t/255)))):"#333333",l=new nf({fontFamily:"Avenir",fontSize:16,align:"center",fill:h,stroke:a,strokeThickness:o?3:0}),u=Math.min(1/i.zoom,2),p=function(t,e){var i;if("void"===me(t.usage))return[];var r,{showUsage:n,showArea:o,roomStampDisplay:s}=(null===(i=e.settings.theme.elements)||void 0===i?void 0:i.roomStamp)||{},a=Math.pow(10,e.settings.units.digits)||1,h=e.settings.spaceLabelMapping||{};void 0!==h[t.usage]&&(r=h[t.usage]),void 0!==h[t.id]&&(r=h[t.id]);var l,u="area"===e.settings.units.roomDimensions,p=t.area;if(u){if("imperial"===e.settings.units.system){var{sqft:c}=Ls(p);p=c}p=Math.round(p*a)/a;var d="metric"===e.settings.units.system?"m²":"ft²";l="".concat(p," ").concat(d)}else{var{length:f,width:v}=t.boundingBox;if("metric"===e.settings.units.system)v=Math.round(10*v)/10,f=Math.round(10*f)/10,l="".concat(f,"m x ").concat(v,"m");else{var y=Ms(f),g=Ms(v);l="".concat(y.feetInt,"'").concat(y.inchDisplay||""," x ").concat(g.feetInt,"'").concat(g.inchDisplay||"")}}var m=t.usageName;if(m||"undefined"===t.usage||(m=function(t=""){return t.replace(/([A-Z])/g,(t=>" ".concat(t.toLowerCase()))).replace(/^./,(t=>t.toUpperCase())).trim()}(t.usage)),void 0!==r&&("string"!=typeof r?console.warn("space label mapping has to be a string"):r.length>50?console.warn("space label mapping has to be less than 50 characters"):m=r),e._debugSpaceMatching&&(m+=" "+t.id.substring(0,5)),!s){var _,x=!1===(null===(_=e.settings.theme.elements)||void 0===_?void 0:_.roomStamp),b=[["usage",n],["area",o]],P=b.some((t=>void 0!==t[1]));s=x?[]:P?b.map((([t,e])=>!!e&&t)).filter(Boolean):["usage","area"]}return s.map((e=>{switch(e){case"name":return t.node.name;case"customId":return t.node.customId;case"usage":return m;case"area":return l}})).flatMap((t=>null!=t?t:[]))}(t,i),c=p.join("\n"),d=new cf(c,l);d.nextLineHeightBehavior=!0,d.x=t.center[0]*i.scale,d.y=t.center[1]*i.scale,d.anchor.x=.5,d.anchor.y=.5,d.scale.x=u,d.scale.y=u,d.visible=t.area>1.5*u,t._gfx=d,e.addChild(d)}}var cv=x((function(t,e){(function(){var e;(function(e){t.exports=e})(e={linear:function(t,e,i,r){return i*t/r+e},easeInQuad:function(t,e,i,r){return i*(t/=r)*t+e},easeOutQuad:function(t,e,i,r){return-i*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,r){return i*(t/=r)*t*t+e},easeOutCubic:function(t,e,i,r){return i*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,i,r){return i*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,i,r){return-i*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,i,r){return i*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,i,r){return i*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,r){return i*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,i,r){return-i/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,i,r){return 0===t?e:i*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,i,r){return t===r?e+i:i*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,i,r){return(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,i,r){return-i*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,i,r){return i*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,i,r){return(t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(t,e,i,r){var n,o,s;return s=1.70158,0===t||(t/=r),(o=0)||(o=.3*r),(n=i)<Math.abs(i)?(n=i,s=o/4):s=o/(2*Math.PI)*Math.asin(i/n),-n*Math.pow(2,10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)+e},easeOutElastic:function(t,e,i,r){var n,o,s;return s=1.70158,0===t||(t/=r),(o=0)||(o=.3*r),(n=i)<Math.abs(i)?(n=i,s=o/4):s=o/(2*Math.PI)*Math.asin(i/n),n*Math.pow(2,-10*t)*Math.sin((t*r-s)*(2*Math.PI)/o)+i+e},easeInOutElastic:function(t,e,i,r){var n,o,s;return s=1.70158,0===t||(t/=r/2),(o=0)||(o=r*(.3*1.5)),(n=i)<Math.abs(i)?(n=i,s=o/4):s=o/(2*Math.PI)*Math.asin(i/n),t<1?n*Math.pow(2,10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)*-.5+e:n*Math.pow(2,-10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)*.5+i+e},easeInBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),i*(t/=r)*t*((n+1)*t-n)+e},easeOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),i*((t=t/r-1)*t*((n+1)*t+n)+1)+e},easeInOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),(t/=r/2)<1?i/2*(t*t*((1+(n*=1.525))*t-n))+e:i/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},easeInBounce:function(t,i,r,n){return r-e.easeOutBounce(n-t,0,r,n)+i},easeOutBounce:function(t,e,i,r){return(t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},easeInOutBounce:function(t,i,r,n){return t<n/2?.5*e.easeInBounce(2*t,0,r,n)+i:.5*e.easeOutBounce(2*t-n,0,r,n)+.5*r+i}})}).call(m)}));class dv{constructor(t){this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new pa(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.on("pointerout",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.divWheel.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.divWheel.removeEventListener("wheel",this.wheelFunction)}down(t){if(!this.viewport.pause&&this.viewport.worldVisible){if("mouse"===t.data.pointerType?this.isMouseDown=!0:this.get(t.data.pointerId)||this.touches.push({id:t.data.pointerId,last:null}),1===this.count()){this.last=t.data.global.clone();var e=this.viewport.plugins.get("decelerate"),i=this.viewport.plugins.get("bounce");e&&e.isActive()||i&&i.isActive()?this.clickedAvailable=!1:this.clickedAvailable=!0}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(!this.viewport.pause&&this.viewport.worldVisible){var e=this.viewport.plugins.move(t);if(this.clickedAvailable){var i=t.data.global.x-this.last.x,r=t.data.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(r))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}}up(t){if(!this.viewport.pause&&this.viewport.worldVisible){"mouse"===t.data.pointerType&&(this.isMouseDown=!1),"mouse"!==t.data.pointerType&&this.remove(t.data.pointerId);var e=this.viewport.plugins.up(t);this.clickedAvailable&&0===this.count()&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}}getPointerPosition(t){var e=new ya;return this.viewport.options.interaction?this.viewport.options.interaction.mapPositionToPoint(e,t.clientX,t.clientY):(e.x=t.clientX,e.y=t.clientY),e}handleWheel(t){if(!this.viewport.pause&&this.viewport.worldVisible){var e=this.viewport.toLocal(this.getPointerPosition(t));if(this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom)this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(var e of this.touches)if(e.id===t)return e;return null}remove(t){for(var e=0;e<this.touches.length;e++)if(this.touches[e].id===t)return void this.touches.splice(e,1)}count(){return(this.isMouseDown?1:0)+this.touches.length}}var fv=["drag","pinch","wheel","follow","mouse-edges","decelerate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class vv{constructor(t){this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=fv.length){this.plugins[t]=e;var r=fv.indexOf(t);-1!==r&&fv.splice(r,1),fv.splice(i,0,t),this.sort()}get(t){return this.plugins[t]}update(t){for(var e of this.list)e.update(t)}resize(){for(var t of this.list)t.resize()}reset(){for(var t of this.list)t.reset()}remove(t){this.plugins[t]&&(this.plugins[t]=null,this.viewport.emit(t+"-remove"),this.sort())}pause(t){this.plugins[t]&&this.plugins[t].pause()}resume(t){this.plugins[t]&&this.plugins[t].resume()}sort(){for(var t of(this.list=[],fv))this.plugins[t]&&this.list.push(this.plugins[t])}down(t){var e=!1;for(var i of this.list)i.down(t)&&(e=!0);return e}move(t){var e=!1;for(var i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){var e=!1;for(var i of this.list)i.up(t)&&(e=!0);return e}wheel(t){var e=!1;for(var i of this.list)i.wheel(t)&&(e=!0);return e}}class yv{constructor(t){this.parent=t,this.paused=!1}destroy(){}down(){return!1}move(){return!1}up(){return!1}wheel(){return!1}update(){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var gv={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1};class mv extends yv{constructor(t,e={}){super(t),this.options=Object.assign({},gv,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||"all"===this.options.direction||"x"===this.options.direction,this.yDirection=!this.options.direction||"all"===this.options.direction||"y"===this.options.direction,this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){parent.addEventListener("keydown",(e=>{t.includes(e.code)&&(this.keyIsPressed=!0)})),parent.addEventListener("keyup",(e=>{t.includes(e.code)&&(this.keyIsPressed=!1)}))}mouseButtons(t){this.mouse=t&&"all"!==t?[-1!==t.indexOf("left"),-1!==t.indexOf("middle"),-1!==t.indexOf("right")]:[!0,!0,!0]}parseUnderflow(){var t=this.options.underflow.toLowerCase();"center"===t?(this.underflowX=0,this.underflowY=0):(this.underflowX=-1!==t.indexOf("left")?-1:-1!==t.indexOf("right")?1:0,this.underflowY=-1!==t.indexOf("top")?-1:-1!==t.indexOf("bottom")?1:0)}checkButtons(t){var e="mouse"===t.data.pointerType,i=this.parent.input.count();return!(!(1===i||i>1&&!this.parent.plugins.get("pinch"))||e&&!this.mouse[t.data.button])}checkKeyPress(t){return!!(!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&"touch"===t.data.pointerType)}down(t){if(!this.paused&&this.options.pressDrag)return this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.data.global.x,y:t.data.global.y},this.current=t.data.pointerId,!0):void(this.last=null)}get active(){return this.moved}move(t){if(!this.paused&&this.options.pressDrag&&this.last&&this.current===t.data.pointerId){var e=t.data.global.x,i=t.data.global.y,r=this.parent.input.count();if(1===r||r>1&&!this.parent.plugins.get("pinch")){var n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){var s={x:e,y:i};return this.xDirection&&(this.parent.x+=(s.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(s.y-this.last.y)*this.options.factor),this.last=s,this.moved||this.parent.emit("drag-start",{event:t,screen:new ya(this.last.x,this.last.y),world:this.parent.toWorld(new ya(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}}up(t){if(!this.paused){var e=this.parent.input.touches;if(1===e.length){var i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}if(this.last&&this.moved){var r=new ya(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:r,world:this.parent.toWorld(r),viewport:this.parent}),this.last=null,this.moved=!1,!0}}}wheel(t){if(!this.paused&&(this.options.wheel&&!this.parent.plugins.get("wheel")))return this.xDirection&&(this.parent.x+=t.deltaX*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=t.deltaY*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),!0}resume(){this.last=null,this.paused=!1}clamp(){var t=this.parent.plugins.get("decelerate")||{};if("y"!==this.options.clampWheel)if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if("x"!==this.options.clampWheel)if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}var _v={noDrag:!1,percent:1,center:null};class xv extends yv{constructor(t,e={}){super(t),this.options=Object.assign({},_v,e)}down(){if(this.parent.input.count()>=2)return this.active=!0,!0}move(t){if(!this.paused&&this.active){var e=t.data.global.x,i=t.data.global.y,r=this.parent.input.touches;if(r.length>=2){var n=r[0],o=r[1],s=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.data.pointerId?n.last={x:e,y:i,data:t.data}:o.id===t.data.pointerId&&(o.last={x:e,y:i,data:t.data}),s){var a,h={x:n.last.x+(o.last.x-n.last.x)/2,y:n.last.y+(o.last.y-n.last.y)/2};this.options.center||(a=this.parent.toLocal(h));var l=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)),u=(1-s/(l=0===l?l=1e-10:l))*this.options.percent*this.parent.scale.x;this.parent.scale.x+=u,this.parent.scale.y+=u,this.parent.emit("zoomed",{viewport:this.parent,type:"pinch"});var p=this.parent.plugins.get("clamp-zoom");if(p&&p.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{var c=this.parent.toGlobal(a);this.parent.x+=h.x-c.x,this.parent.y+=h.y-c.y,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=h.x-this.lastCenter.x,this.parent.y+=h.y-this.lastCenter.y,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=h,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}}}up(){if(this.pinching&&this.parent.input.touches.length<=1)return this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0}}var bv={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class Pv extends yv{constructor(t,e={}){super(t),this.options=Object.assign({},bv,e),this.options.direction&&(this.options.left="x"===this.options.direction||"all"===this.options.direction||null,this.options.right="x"===this.options.direction||"all"===this.options.direction||null,this.options.top="y"===this.options.direction||"all"===this.options.direction||null,this.options.bottom="y"===this.options.direction||"all"===this.options.direction||null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){var t=this.options.underflow.toLowerCase();"none"===t?this.noUnderflow=!0:"center"===t?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=-1!==t.indexOf("left")?-1:-1!==t.indexOf("right")?1:0,this.underflowY=-1!==t.indexOf("top")?-1:-1!==t.indexOf("bottom")?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(!this.paused&&(this.parent.x!==this.last.x||this.parent.y!==this.last.y||this.parent.scale.x!==this.last.scaleX||this.parent.scale.y!==this.last.scaleY)){var t={x:this.parent.x,y:this.parent.y},e=this.parent.plugins.decelerate||{};if(null!==this.options.left||null!==this.options.right){var i=!1;if(this.parent.screenWorldWidth<this.parent.screenWidth){if(!this.noUnderflow)switch(this.underflowX){case-1:0!==this.parent.x&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}}else null!==this.options.left&&this.parent.left<(!0===this.options.left?0:this.options.left)&&(this.parent.x=-(!0===this.options.left?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),null!==this.options.right&&this.parent.right>(!0===this.options.right?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(!0===this.options.right?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(null!==this.options.top||null!==this.options.bottom){var r=!1;if(this.parent.screenWorldHeight<this.parent.screenHeight){if(!this.noUnderflow)switch(this.underflowY){case-1:0!==this.parent.y&&(this.parent.y=0,r=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,r=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,r=!0)}}else null!==this.options.top&&this.parent.top<(!0===this.options.top?0:this.options.top)&&(this.parent.y=-(!0===this.options.top?0:this.options.top)*this.parent.scale.y,e.y=0,r=!0),null!==this.options.bottom&&this.parent.bottom>(!0===this.options.bottom?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(!0===this.options.bottom?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,r=!0);r&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}}reset(){this.update()}}var wv={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class Ev extends yv{constructor(t,e={}){super(t),this.options=Object.assign({},wv,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused)if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){var t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(null!==this.options.minWidth&&t<this.options.minWidth){var i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(null!==this.options.maxWidth&&t>this.options.maxWidth){var r=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/r,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}null!==this.options.minHeight&&e<this.options.minHeight&&(this.parent.fitHeight(this.options.minHeight,!0,!0,!0),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})),null!==this.options.maxHeight&&e>this.options.maxHeight&&this.parent.fitHeight(this.options.maxHeight,!0,!0,!0)}else{var n=this.parent.scale.x;null!==this.options.minScale&&n<this.options.minScale&&(n=this.options.minScale),null!==this.options.maxScale&&n>this.options.maxScale&&(n=this.options.maxScale),n!==this.parent.scale.x&&(this.parent.scale.set(n),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}reset(){}}var Tv={friction:.95,bounce:.8,minSpeed:.01};class Cv extends yv{constructor(t,e={}){super(t),this.options=Object.assign({},Tv,e),this.saved=[],this.reset(),this.parent.on("moved",(t=>this.moved(t)))}destroy(){this.parent}down(){this.saved=[],this.x=this.y=!1}isActive(){return this.x||this.y}move(){if(!this.paused){var t=this.parent.input.count();(1===t||t>1&&!this.parent.plugins.get("pinch"))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30))}}moved(t){if(this.saved.length){var e=this.saved[this.saved.length-1];"clamp-x"===t.type?e.x===t.original.x&&(e.x=this.parent.x):"clamp-y"===t.type&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(0===this.parent.input.count()&&this.saved.length){var t=performance.now();for(var e of this.saved)if(e.time>=t-100){var i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction;break}}}activate(t){void 0!==(t=t||{}).x&&(this.x=t.x,this.percentChangeX=this.options.friction),void 0!==t.y&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){var e;this.paused||(this.x&&(this.parent.x+=this.x*t,this.x*=this.percentChangeX,Math.abs(this.x)<this.options.minSpeed&&(this.x=0),e=!0),this.y&&(this.parent.y+=this.y*t,this.y*=this.percentChangeY,Math.abs(this.y)<this.options.minSpeed&&(this.y=0),e=!0),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"}))}reset(){this.x=this.y=null}}var Iv={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class Sv extends yv{constructor(t,e={}){super(t),this.options=Object.assign({},Iv,e),this.ease=function(t,e){return t?"function"==typeof t?t:"string"==typeof t?cv[t]:void 0:cv[e]}(this.options.ease,"easeInOutSine"),this.options.sides&&("all"===this.options.sides?this.top=this.bottom=this.left=this.right=!0:"horizontal"===this.options.sides?this.right=this.left=!0:"vertical"===this.options.sides?this.top=this.bottom=!0:(this.top=-1!==this.options.sides.indexOf("top"),this.bottom=-1!==this.options.sides.indexOf("bottom"),this.left=-1!==this.options.sides.indexOf("left"),this.right=-1!==this.options.sides.indexOf("right"))),this.parseUnderflow(),this.last={},this.reset()}parseUnderflow(){var t=this.options.underflow.toLowerCase();"center"===t?(this.underflowX=0,this.underflowY=0):(this.underflowX=-1!==t.indexOf("left")?-1:-1!==t.indexOf("right")?1:0,this.underflowY=-1!==t.indexOf("top")?-1:-1!==t.indexOf("bottom")?1:0)}isActive(){return null!==this.toX||null!==this.toY}down(){this.toX=this.toY=null}up(){this.bounce()}update(t){if(!this.paused){if(this.bounce(),this.toX){var e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){var i=this.toY;i.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),i.time>=this.options.time?(this.parent.y=i.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(i.time,i.start,i.delta,this.options.time)}}}calcUnderflowX(){var t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){var t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){var t=this.options.bounceBox;if(t){var e=void 0===t.x?0:t.x,i=void 0===t.y?0:t.y,r=void 0===t.width?this.parent.worldWidth:t.width,n=void 0===t.height?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>r,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new ya(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new ya(r*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new ya(0,0),bottomRight:new ya(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){if(!this.paused){var t,e=this.parent.plugins.get("decelerate");e&&(e.x||e.y)&&(e.x&&e.percentChangeX===e.options.friction||e.y&&e.percentChangeY===e.options.friction)&&(((t=this.oob()).left&&this.left||t.right&&this.right)&&(e.percentChangeX=this.options.friction),(t.top&&this.top||t.bottom&&this.bottom)&&(e.percentChangeY=this.options.friction));var i=this.parent.plugins.get("drag")||{},r=this.parent.plugins.get("pinch")||{};if(e=e||{},!(i.active||r.active||this.toX&&this.toY||e.x&&e.y)){var n=(t=t||this.oob()).topLeft,o=t.bottomRight;if(!this.toX&&!e.x){var s=null;t.left&&this.left?s=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-n.x:t.right&&this.right&&(s=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-o.x),null!==s&&this.parent.x!==s&&(this.toX={time:0,start:this.parent.x,delta:s-this.parent.x,end:s},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!e.y){var a=null;t.top&&this.top?a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-n.y:t.bottom&&this.bottom&&(a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-o.y),null!==a&&this.parent.y!==a&&(this.toY={time:0,start:this.parent.y,delta:a-this.parent.y,end:a},this.parent.emit("bounce-y-start",this.parent))}}}}reset(){this.toX=this.toY=null,this.bounce()}}var Ov={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20};class Av extends yv{constructor(t,e={}){super(t),this.options=Object.assign({},Ov,e)}down(){this.options.interrupt&&(this.smoothing=null)}update(){if(this.smoothing){var t,e=this.smoothingCenter,i=this.smoothing;this.options.center||(t=this.parent.toLocal(e)),this.parent.scale.x+=i.x,this.parent.scale.y+=i.y,this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});var r=this.parent.plugins.get("clamp-zoom");if(r&&r.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{var n=this.parent.toGlobal(t);this.parent.x+=e.x-n.x,this.parent.y+=e.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}wheel(t){if(!this.paused){var e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,r=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){var n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*r-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*r-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{var o;this.options.center||(o=this.parent.toLocal(e)),this.parent.scale.x*=r,this.parent.scale.y*=r,this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});var s=this.parent.plugins.get("clamp-zoom");if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{var a=this.parent.toGlobal(o);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}return this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:t.deltaX,dy:t.deltaY,dz:t.deltaZ},event:t,viewport:this.parent}),!this.parent.options.passiveWheel||void 0}}}var Mv={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class Lv extends yv{constructor(t,e={}){super(t),this.options=Object.assign({},Mv,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=Math.pow(this.options.radius,2),this.resize()}resize(){var t=this.options.distance;null!==t?(this.left=t,this.top=t,this.right=this.parent.worldScreenWidth-t,this.bottom=this.parent.worldScreenHeight-t):this.radius||(this.left=this.options.left,this.top=this.options.top,this.right=null===this.options.right?null:this.parent.worldScreenWidth-this.options.right,this.bottom=null===this.options.bottom?null:this.parent.worldScreenHeight-this.options.bottom)}down(){this.options.allowButtons||(this.horizontal=this.vertical=null)}move(t){if(!("mouse"!==t.data.pointerType&&1!==t.data.identifier||!this.options.allowButtons&&0!==t.data.buttons)){var e=t.data.global.x,i=t.data.global.y;if(this.radiusSquared){var r=this.parent.toScreen(this.parent.center);if(Math.pow(r.x-e,2)+Math.pow(r.y-i,2)>=this.radiusSquared){var n=Math.atan2(r.y-i,r.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*.06,this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*.06):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*.06,this.vertical=Math.sin(n)*this.options.speed*this.reverse*.06)}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else null!==this.left&&e<this.left?this.horizontal=1*this.reverse*this.options.speed*.06:null!==this.right&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*.06:(this.decelerateHorizontal(),this.horizontal=0),null!==this.top&&i<this.top?this.vertical=1*this.reverse*this.options.speed*.06:null!==this.bottom&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*.06:(this.decelerateVertical(),this.vertical=0)}}decelerateHorizontal(){var t=this.parent.plugins.get("decelerate");this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){var t=this.parent.plugins.get("decelerate");this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null}update(){if(!this.paused&&(this.horizontal||this.vertical)){var t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}var Nv={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,interaction:null,disableOnContextMenu:!1};class Rv extends du{constructor(t={}){super(),this.options=Object.assign({},Nv,t),this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.divWheel=this.options.divWheel||document.body,this.options.disableOnContextMenu&&(this.options.divWheel.oncontextmenu=t=>t.preventDefault()),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new dv(this),this.plugins=new vv(this)}destroy(t){this.options.noTicker||this.options.ticker.remove(this.tickerFunction),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new pa(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,r){this.screenWidth=t,this.screenHeight=e,void 0!==i&&(this._worldWidth=i),void 0!==r&&(this._worldHeight=r),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new pa(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return 2===arguments.length?this.toLocal(new ya(t,e)):this.toLocal(t)}toScreen(t,e){return 2===arguments.length?this.toGlobal(new ya(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new ya(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(){var t,e;return isNaN(arguments[0])?(t=arguments[0].x,e=arguments[0].y):(t=arguments[0],e=arguments[1]),this.position.set((this.worldScreenWidth/2-t)*this.scale.x,(this.worldScreenHeight/2-e)*this.scale.y),this.plugins.reset(),this.dirty=!0,this}get corner(){return new ya(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(t,e){return 1===arguments.length?this.position.set(-t.x*this.scale.x,-t.y*this.scale.y):this.position.set(-t*this.scale.x,-e*this.scale.y),this.plugins.reset(),this}fitWidth(t,e,i=!0,r){var n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);var o=this.plugins.get("clamp-zoom");return!r&&o&&o.clamp(),e&&this.moveCenter(n),this}fitHeight(t,e,i=!0,r){var n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);var o=this.plugins.get("clamp-zoom");return!r&&o&&o.clamp(),e&&this.moveCenter(n),this}fitWorld(t){var e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;var i=this.plugins.get("clamp-zoom");return i&&i.clamp(),t&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){var r;t&&(r=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;var n=this.plugins.get("clamp-zoom");return n&&n.clamp(),t&&this.moveCenter(r),this}setZoom(t,e){var i;e&&(i=this.center),this.scale.set(t);var r=this.plugins.get("clamp-zoom");return r&&r.clamp(),e&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}set scaled(t){this.setZoom(t,!0)}get scaled(){return this.scale.x}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this._worldHeight,cornerPoint:new ya(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new pa(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new mv(this,t)),this}clamp(t){return this.plugins.add("clamp",new Pv(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new Cv(this,t)),this}bounce(t){return this.plugins.add("bounce",new Sv(this,t)),this}pinch(t){return this.plugins.add("pinch",new xv(this,t)),this}wheel(t){return this.plugins.add("wheel",new Av(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new Ev(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new Lv(this,t)),this}get pause(){return this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,r,n){n&&(i>this.worldScreenWidth||r>this.worldScreenHeight)&&(this.fit(!0,i,r),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));var o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+r>this.bottom&&(this.bottom=e+r,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}Object.assign(du.prototype,{render:function(t){this._activeParentLayer&&this._activeParentLayer!=t._activeLayer||(this.visible?(this.displayOrder=t.incDisplayOrder(),this.worldAlpha<=0||!this.renderable||(t._activeLayer=null,this.containerRenderWebGL(t),t._activeLayer=this._activeParentLayer)):this.displayOrder=0)},renderCanvas:function(t){this._activeParentLayer&&this._activeParentLayer!=t._activeLayer||(this.visible?(this.displayOrder=t.incDisplayOrder(),this.worldAlpha<=0||!this.renderable||(t._activeLayer=null,this.containerRenderCanvas(t),t._activeLayer=this._activeParentLayer)):this.displayOrder=0)},containerRenderWebGL:du.prototype.render,containerRenderCanvas:du.prototype.renderCanvas}),Object.assign(uu.prototype,{parentLayer:null,_activeParentLayer:null,parentGroup:null,zOrder:0,zIndex:0,updateOrder:0,displayOrder:0,layerableChildren:!0,isLayer:!1});var Dv,kv,Fv=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Dv=jf,kv=function(t){function e(e,i){var r=t.call(this)||this;return r._activeLayer=null,r._activeStage=null,r._activeChildren=[],r._lastUpdateId=-1,r.useRenderTexture=!1,r.useDoubleBuffer=!1,r.sortPriority=0,r.clearColor=new Float32Array([0,0,0,0]),r.canDrawWithoutLayer=!1,r.canDrawInParentStage=!0,r.zIndex=0,r.enableSort=!1,r._tempResult=[],r._tempZero=[],r.useZeroOptimization=!1,r.zIndex=e,r.enableSort=!!i,"function"==typeof i&&r.on("sort",i),r}return Fv(e,t),e.prototype.doSort=function(t,i){if(this.listeners("sort",!0))for(var r=0;r<i.length;r++)this.emit("sort",i[r]);this.useZeroOptimization?this.doSortWithZeroOptimization(t,i):i.sort(e.compareZIndex)},e.compareZIndex=function(t,e){return t.zOrder<e.zOrder?-1:t.zOrder>e.zOrder?1:t.updateOrder-e.updateOrder},e.prototype.doSortWithZeroOptimization=function(){throw new Error("not implemented yet")},e.prototype.clear=function(){this._activeLayer=null,this._activeStage=null,this._activeChildren.length=0},e.prototype.addDisplayObject=function(t,e){this.check(t),e._activeParentLayer=this._activeLayer,this._activeLayer?this._activeLayer._activeChildren.push(e):this._activeChildren.push(e)},e.prototype.foundLayer=function(t,i){this.check(t),null!=this._activeLayer&&e.conflict(),this._activeLayer=i,this._activeStage=t},e.prototype.foundStage=function(){this._activeLayer||this.canDrawInParentStage||this.clear()},e.prototype.check=function(t){if(this._lastUpdateId<e._layerUpdateId)this._lastUpdateId=e._layerUpdateId,this.clear(),this._activeStage=t;else if(this.canDrawInParentStage){for(var i=this._activeStage;i&&i!=t;)i=i._activeParentStage;if(this._activeStage=i,null==i)return void this.clear()}},e.conflict=function(){e._lastLayerConflict+5e3<Date.now()&&(e._lastLayerConflict=Date.now(),console.log("PIXI-display plugin found two layers with the same group in one stage - that's not healthy. Please place a breakpoint here and debug it"))},e._layerUpdateId=0,e._lastLayerConflict=0,e}(su.EventEmitter),Dv.Group=kv,function(t){function e(e,i,r,n){this.search||(this.search=new t.LayersTreeSearch),this.search.findHit(e,i,r,n);var o=this.delayedEvents;if(o&&o.length){e.stopPropagationHint=!1;var s=o.length;this.delayedEvents=[];for(var a=0;a<s;a++){var h=o[a],l=h.displayObject,u=h.eventString,p=h.eventData;p.stopsPropagatingAt===l&&(p.stopPropagationHint=!0),this.dispatchEvent(l,u,p)}}}t.processInteractive51=e,t.patchInteractionManager=function(i){i&&(i.search?i.search.worksWithDisplay||(i.search=new t.LayersTreeSearch):i.processInteractive=e)}}(jf),function(t){var e=function(){function t(t){this.layer=t,this.renderTexture=null,this.doubleBuffer=null,this.currentBufferIndex=0,this._tempRenderTarget=null,this._tempRenderTargetSource=new pa}return t.prototype.initRenderTexture=function(t){var e=t?t.screen.width:100,i=t?t.screen.height:100,r=t?t.resolution:ph.RESOLUTION;this.renderTexture=Xu.create({width:e,height:i,resolution:r}),this.layer.group.useDoubleBuffer&&(this.doubleBuffer=[Xu.create({width:e,height:i,resolution:r}),Xu.create({width:e,height:i,resolution:r})])},t.prototype.getRenderTexture=function(){return this.renderTexture||this.initRenderTexture(),this.renderTexture},t.prototype.pushTexture=function(t){var e=t.screen;this.renderTexture||this.initRenderTexture(t);var i=this.renderTexture,r=this.layer.group,n=this.doubleBuffer;if(i.width===e.width&&i.height===e.height&&i.baseTexture.resolution===t.resolution||(i.baseTexture.resolution=t.resolution,i.resize(e.width,e.height),n&&(n[0].baseTexture.resolution=t.resolution,n[0].resize(e.width,e.height),n[1].baseTexture.resolution=t.resolution,n[1].resize(e.width,e.height))),this._tempRenderTarget=t.renderTexture.current,this._tempRenderTargetSource.copyFrom(t.renderTexture.sourceFrame),t.batch.flush(),r.useDoubleBuffer){var o=n[this.currentBufferIndex];o.baseTexture._glTextures[t.CONTEXT_UID]||(t.renderTexture.bind(o,void 0,void 0),t.texture.bind(o),r.clearColor&&t.renderTexture.clear(r.clearColor)),t.texture.unbind(i.baseTexture),i.baseTexture._glTextures=o.baseTexture._glTextures,i.baseTexture.framebuffer=o.baseTexture.framebuffer,o=n[1-this.currentBufferIndex],t.renderTexture.bind(o,void 0,void 0)}else t.renderTexture.bind(i,void 0,void 0);r.clearColor&&t.renderTexture.clear(r.clearColor);var s=t.filter.defaultFilterStack;s.length>1&&(s[s.length-1].renderTexture=t.renderTexture.current)},t.prototype.popTexture=function(t){t.batch.flush();var e=t.filter.defaultFilterStack;e.length>1&&(e[e.length-1].renderTexture=this._tempRenderTarget),t.renderTexture.bind(this._tempRenderTarget,this._tempRenderTargetSource,void 0),this._tempRenderTarget=null;var i=this.renderTexture,r=this.layer.group,n=this.doubleBuffer;if(r.useDoubleBuffer){t.texture.unbind(i.baseTexture),this.currentBufferIndex=1-this.currentBufferIndex;var o=n[this.currentBufferIndex];i.baseTexture._glTextures=o.baseTexture._glTextures,i.baseTexture.framebuffer=o.baseTexture.framebuffer}},t.prototype.destroy=function(){this.renderTexture&&(this.renderTexture.destroy(),this.doubleBuffer&&(this.doubleBuffer[0].destroy(!0),this.doubleBuffer[1].destroy(!0)))},t}();t.LayerTextureCache=e;var i=function(i){function r(e){void 0===e&&(e=null);var r=i.call(this)||this;return r.isLayer=!0,r.group=null,r._activeChildren=[],r._tempChildren=null,r._activeStageParent=null,r._sortedChildren=[],r._tempLayerParent=null,r.insertChildrenBeforeActive=!0,r.insertChildrenAfterActive=!0,null!=e?(r.group=e,r.zIndex=e.zIndex):r.group=new t.Group(0,!1),r._tempChildren=r.children,r}return Fv(r,i),r.prototype.beginWork=function(t){var e=this._activeChildren;this._activeStageParent=t,this.group.foundLayer(t,this);var i=this.group._activeChildren;e.length=0;for(var r=0;r<i.length;r++)i[r]._activeParentLayer=this,e.push(i[r]);i.length=0},r.prototype.endWork=function(){for(var t=this.children,e=this._activeChildren,i=this._sortedChildren,r=0;r<e.length;r++)this.emit("display",e[r]);if(i.length=0,this.insertChildrenBeforeActive)for(var n=0;n<t.length;n++)i.push(t[n]);for(var o=0;o<e.length;o++)i.push(e[o]);if(!this.insertChildrenBeforeActive&&this.insertChildrenAfterActive)for(var s=0;s<t.length;s++)i.push(t[s]);this.group.enableSort&&this.doSort()},Object.defineProperty(r.prototype,"useRenderTexture",{get:function(){return this.group.useRenderTexture},set:function(t){this.group.useRenderTexture=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"useDoubleBuffer",{get:function(){return this.group.useDoubleBuffer},set:function(t){this.group.useDoubleBuffer=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"clearColor",{get:function(){return this.group.clearColor},set:function(t){this.group.clearColor=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sortPriority",{get:function(){return this.group.sortPriority},set:function(t){this.group.sortPriority=t},enumerable:!1,configurable:!0}),r.prototype.getRenderTexture=function(){return this.textureCache||(this.textureCache=new e(this)),this.textureCache.getRenderTexture()},r.prototype.updateDisplayLayers=function(){},r.prototype.doSort=function(){this.group.doSort(this,this._sortedChildren)},r.prototype._preRender=function(t){return(!this._activeParentLayer||this._activeParentLayer==t._activeLayer)&&(this.visible?(this.displayOrder=t.incDisplayOrder(),!(this.worldAlpha<=0||!this.renderable)&&(this.children!==this._sortedChildren&&this._tempChildren!=this.children&&(this._tempChildren=this.children),this._boundsID++,this.children=this._sortedChildren,this._tempLayerParent=t._activeLayer,t._activeLayer=this,!0)):(this.displayOrder=0,!1))},r.prototype._postRender=function(t){this.children=this._tempChildren,t._activeLayer=this._tempLayerParent,this._tempLayerParent=null},r.prototype.render=function(t){this._preRender(t)&&(this.group.useRenderTexture&&(this.textureCache||(this.textureCache=new e(this)),this.textureCache.pushTexture(t)),this.containerRenderWebGL(t),this._postRender(t),this.group.useRenderTexture&&this.textureCache.popTexture(t))},r.prototype.destroy=function(t){this.textureCache&&(this.textureCache.destroy(),this.textureCache=null),i.prototype.destroy.call(this,t)},r}(du);t.Layer=i,i.prototype.renderCanvas=function(t){this._preRender(t)&&(this.containerRenderCanvas(t),this._postRender(t))}}(jf),function(t){var e=ya,i=function(){function t(){this._tempPoint=new e,this._queue=[[],[]],this._eventDisplayOrder=0,this.worksWithDisplay=!0}return t.prototype.recursiveFindHit=function(t,e,i,r,n){if(!e||!e.visible)return 0;var o=0,s=r=e.interactive||r;e.hitArea&&(s=!1),e._activeParentLayer&&(n=!1);var a=e._mask;i<1/0&&a&&(a.containsPoint(t)||(n=!0)),i<1/0&&e.filterArea&&(e.filterArea.contains(t.x,t.y)||(n=!0));var h=e.children;if(e.interactiveChildren&&h)for(var l=h.length-1;l>=0;l--){var u=h[l],p=this.recursiveFindHit(t,u,i,s,n);if(p){if(!u.parent)continue;o=p,i=p}}return r&&(n?e.interactive&&this._queueAdd(e,0):(i<e.displayOrder&&(e.hitArea?(e.worldTransform.applyInverse(t,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)&&(o=e.displayOrder)):e.containsPoint&&e.containsPoint(t)&&(o=e.displayOrder)),e.interactive&&this._queueAdd(e,o===1/0?0:o))),o},t.prototype.findHit=function(t,e,i,r){var n=null,o=null;o=t.data&&t.data.global?(n=t).data.global:t,this._startInteractionProcess(),this.recursiveFindHit(o,e,r?0:1/0,!1,!1),this._finishInteractionProcess(n,i)},t.prototype._startInteractionProcess=function(){this._eventDisplayOrder=1,this._queue||(this._queue=[[],[]]),this._queue[0].length=0,this._queue[1].length=0},t.prototype._queueAdd=function(t,e){var i=this._queue;if(e<this._eventDisplayOrder)i[0].push(t);else{if(e>this._eventDisplayOrder){this._eventDisplayOrder=e;for(var r=i[1],n=0,o=r.length;n<o;n++)i[0].push(r[n]);i[1].length=0}i[1].push(t)}},t.prototype._finishInteractionProcess=function(t,e){for(var i=this._queue,r=i[0],n=0,o=r.length;n<o;n++)t?e&&e(t,r[n],!1):e(r[n],!1);for(var s=0,a=(r=i[1]).length;s<a;s++)t?(t.target||(t.target=r[s]),e&&e(t,r[s],!0)):e(r[s],!0)},t}();t.LayersTreeSearch=i}(jf),function(t){var e=function(e){function i(){var t=e.call(this)||this;return t.isStage=!0,t._tempGroups=[],t._activeLayers=[],t._activeParentStage=null,t}return Fv(i,e),i.prototype.clear=function(){this._activeLayers.length=0,this._tempGroups.length=0},i.prototype.destroy=function(t){this.clear(),e.prototype.destroy.call(this,t)},i.prototype._addRecursive=function(t){if(t.visible){if(t.isLayer){var e=t;this._activeLayers.push(e),e.beginWork(this)}if(t!=this&&t.isStage){t.updateAsChildStage(this)}else{var r=t.parentGroup;null!=r&&r.addDisplayObject(this,t);var n=t.parentLayer;if(null!=n&&(r=n.group).addDisplayObject(this,t),t.updateOrder=++i._updateOrderCounter,!(t.alpha<=0||!t.renderable||!t.layerableChildren||r&&r.sortPriority)){var o=t.children;if(o&&o.length)for(var s=0;s<o.length;s++)this._addRecursive(o[s])}}}},i.prototype._addRecursiveChildren=function(t){if(!(t.alpha<=0)&&t.renderable&&t.layerableChildren){var e=t.children;if(e&&e.length)for(var i=0;i<e.length;i++)this._addRecursive(e[i])}},i.prototype._updateStageInner=function(){this.clear(),this._addRecursive(this);for(var t=this._activeLayers,e=0;e<t.length;e++){var i=t[e];if(i.group.sortPriority){i.endWork();var r=i._sortedChildren;console.log(3,i);for(var n=0;n<r.length;n++)this._addRecursiveChildren(r[n])}}for(var o=0;o<t.length;o++){var s=t[o];s.group.sortPriority||s.endWork()}},i.prototype.updateAsChildStage=function(t){this._activeParentStage=t,i._updateOrderCounter=0,this._updateStageInner()},i.prototype.updateStage=function(){this._activeParentStage=null,t.Group._layerUpdateId++,this._updateStageInner()},i._updateOrderCounter=0,i}(t.Layer);t.Stage=e}(jf),function(t){Object.assign(xc.prototype,{_lastDisplayOrder:0,_activeLayer:null,incDisplayOrder:function(){return++this._lastDisplayOrder},_oldRender:xc.prototype.render,render:function(e,i,r,n,o){i||(this._lastDisplayOrder=0),this._activeLayer=null,e.isStage&&e.updateStage(),t.patchInteractionManager(this.plugins.interaction),this._oldRender(e,i,r,n,o)}});var e=dd;e&&Object.assign(e.prototype,{_lastDisplayOrder:0,_activeLayer:null,incDisplayOrder:function(){return++this._lastDisplayOrder},_oldRender:e.prototype.render,render:function(e,i,r,n,o){i||(this._lastDisplayOrder=0),this._activeLayer=null,e.isStage&&e.updateStage(),t.patchInteractionManager(this.plugins.interaction),this._oldRender(e,i,r,n,o)}})}(jf);var Bv=(t,e=!1)=>new jf.Layer(new jf.Group(t,e)),Uv={top:0,left:0,center:.5,right:1,bottom:1};function zv(t){var e;Ol();var i=document.getElementById(t.settings.editorId),n=i.querySelector(".fpe__plan"),o=i.clientWidth,s=i.clientHeight,a=window.devicePixelRatio||1,h=t.settings.theme.background.color,l="transparent"===h,u=bc({width:o,height:s,view:n,antialias:!0,backgroundAlpha:l?0:1,autoDensity:!0,resolution:a,powerPreference:"high-performance",preserveDrawingBuffer:!0});u.gl||console.log("Fallback to Canvas Renderer"),i.appendChild(u.view),4===h.length&&(h=h[0]+h[1]+h[1]+h[2]+h[2]+h[3]+h[3]),l||(u.backgroundColor=Dl(h));var p=new jf.Stage;p.sortableChildren=!0;var c=new Rv({screenWidth:o,screenHeight:s,worldWidth:o,worldHeight:s,interaction:u.plugins.interaction,noTicker:!0,passiveWheel:!1,divWheel:document.querySelector("#".concat(t.settings.editorId," .fpe__plan"))});null!=Hf&&null!==(e=dh)&&void 0!==e&&e.system&&dh.system.stop(),c._renderer=u,c._ticker={methods:{},add:(t,e,i)=>{c._ticker.methods[t]={fn:e,ctx:i}},remove:t=>{delete c._ticker.methods[t]}};var d=Date.now();function f(){var e=Date.now(),i=e-d;d=e,i<0&&(i=0),i>1e3&&(i=1e3);var r,n=Object.keys(c._ticker.methods).length;(t.viewportNeedsUpdate||c.needsUpdate||n)&&(null!==(r=c._ticker)&&void 0!==r&&r.methods&&Object.values(c._ticker.methods).forEach((({fn:t,ctx:e})=>{"function"==typeof t&&(e?t.call(e,i):t(i))})),c.update(),u.render(p));t.viewportPaused||requestAnimationFrame(f),t.viewportNeedsUpdate=!1,c.needsUpdate=!1}t.startAnimationLoop=()=>{d=Date.now(),t.viewportNeedsUpdate=!0,t.viewportPaused=!1,requestAnimationFrame(f)},t.stopAnimationLoop=()=>{t.viewportPaused=!0},t.startAnimationLoop();var v=function(){var e=r((function*(){var e=new ResizeObserver((()=>{(()=>{if(i.clientWidth&&i.clientHeight){var e=c.screenWidth,r=c.screenHeight,n=i.clientWidth,o=i.clientHeight;u.resize(n,o),c.resize(n,o);var s=e-n,a=r-o,h=t.settings.preserveViewbox,[l=.5,d=.5]=h.split("-").map((t=>Uv[t])),f=l*s,v=d*a;c.position.set(c.x-f,c.y-v),c.plugins.get("clamp-zoom")||c.clampZoom({maxHeight:300*t.scale,minHeight:3*t.scale}),u.render(p);var y=c.left,g=c.top,m=c.worldScreenWidth,_=c.worldScreenHeight;t.viewbox={x:y/t.scale,z:g/t.scale,x2:(y+m)/t.scale,z2:(g+_)/t.scale,length:m/t.scale,width:_/t.scale},t.client=[c.screenWidth,c.screenHeight]}})(),t.emit("resize-canvas",t.viewbox)}));e.observe(i)}));return function(){return e.apply(this,arguments)}}();v(),p.addChild(c),t.on("focus",(e=>{e&&t.viewportPaused?t.startAnimationLoop():e||t.stopAnimationLoop(),t.viewportInFocus=e}));var y=new du;y._gridLayer=!0,c.addChild(y);var g=Bv(0);p.addChild(g);var m=new du;m._sceneLayer=!0,c.addChild(m);var _=Bv(1,!0);_.width=_.height=i.clientWidth,p.addChild(_);var x=new du;x._helperLayer=!0,c.addChild(x);var b=Bv(2);p.addChild(b);var P=new du;P._roomStampLayer=!0,c.addChild(P);var w=Bv(3);p.addChild(w);var E=new du;E._measureLayer=!0,c.addChild(E);var T=Bv(10);p.addChild(T);var C=new du;C._markerLayer=!0,c.addChild(C);var I=Bv(8);return p.addChild(I),t._gfxLayers={grid:g,helper:b,marker:I,measure:T,roomStamp:w,scene:_},function(t,e){t._queue={data:[],inProgress:{},done:[],error:[]},t.on("product-load-texture",(({textureId:e,productData:i})=>{!function(t,{textureId:e,productData:i}){if(i&&i.boundingPoints){var r={x:i.boundingPoints.min[0],y:i.boundingPoints.min[2]},n={x:Math.abs(i.boundingPoints.min[0]/i.boundingBox.length),y:Math.abs(i.boundingPoints.min[2]/i.boundingBox.width)},o={x:i.boundingPoints.max[0]-i.boundingBox.length/2,y:i.boundingPoints.max[2]-i.boundingBox.width/2};t._textureQueue[e].offset=o,t._textureQueue[e].anchor=n,t._textureQueue[e].position=r}}(t,{textureId:e,productData:i}),ev({state:t,resourceId:e,options:{applyFilter:!0}})})),t.on("product-contour",iv);var i=new Zd;i.lineStyle({native:!0,color:3355443}),i.drawCircle(0,0,1),t._dummyTexture=e.generateTexture(i)}(t,u),{viewport:c,renderer:u}}function Xv({scene:t,viewport:e,state:i,renderer:r,update:n=!1}){var o=i.settings.theme.background.color;4===o.length&&(o=o[0]+o[1]+o[1]+o[2]+o[2]+o[3]+o[3]),r.backgroundColor=Dl(o),e._getGrid().update(!0);var s=e.children.find((t=>t._sceneLayer));Gf(s),nv({node:t.node,ctx:s,state:i}),n&&i.listeners.wallContours||(i.listeners.wallContours=!0,i.on("wall-contours-computed",(()=>uv(s,i)))),i.settings.theme.wallContours&&uv(s,i),e._updateRoomStamps=()=>{var t=e.children.find((t=>t._roomStampLayer));Gf(t),t.parentLayer=i._gfxLayers.roomStamp,i.resources.spaces.forEach((e=>pv(e,t,i)))},e._updateRoomStamps(),i.emit("scene-rendered",{update:n}),i.viewportNeedsUpdate=!0,n&&(i.settings.panZoom?(e.plugins.plugins.drag.options.pressDrag=!0,e.plugins.resume("drag"),e.plugins.resume("wheel"),e.plugins.resume("pinch")):(e.plugins.pause("drag"),e.plugins.plugins.drag.options.pressDrag=!1,e.plugins.pause("wheel"),e.plugins.pause("pinch"))),i.viewportPaused&&i.startAnimationLoop()}class jv{constructor({pos:t,color:e,size:i,state:r}){var n=r._getViewport&&r._getViewport(),o=n&&n._getMarkers();this._updateFn=o?o.update:()=>{},this.pos=t,this.color=e,this.size=i,this._events={},this._state=r,this.id=j(),r.markerPins.splice(r.markerPins.length,0,this),this._updateFn()}remove(){this.off("click");var t=this._state.markerPins.findIndex((t=>t.id===this.id));Number.isFinite(t)&&this._state.markerPins.splice(t,1),this._updateFn()}on(t="click",e,i){this.set({events:{[t]:{callback:e,context:i}}})}off(t="click"){this.set({events:{[t]:null}})}set(t){var e=["pos","color","size","events"],i=this._state.markerPins.findIndex((t=>t.id===this.id));Number.isFinite(i)&&(Object.keys(t).forEach((r=>{e.includes(r)&&(this._state.markerPins[i][r]=t[r])})),this._updateFn(!0))}}var Yv=15966848,Hv=8231892;function Gv({handler:t,state:e}){var i=e.active[0],r=e.active.length>1;if(i&&e.settings.transformElements){Gf(t);var n=Ae[i.type];if(n){if("wall"===i.type||"a:helper:spaceDivider"===i.type?(delete t._startRelation,delete t._endRelation,t._wallRelations=Be({state:e,wall:i})||[],t._wallRelations.forEach((e=>{var r=e.relatedNodes.find((t=>t.node.id===i.id)),{node:n}=e.relatedNodes.find((t=>t.node.id!==i.id))||{},o={relation:e.isEdge?"edge":"point",relatedWall:n,point:e.point};"start"===r.relation&&(t._startRelation=o),"end"===r.relation&&(t._endRelation=o)}))):(delete t._startRelation,delete t._endRelation,delete t._wallRelations),n.x){var o=function(t,e,i){var r=e.scale,n=new Zd;n.beginFill(16777215,.05),i.z&&n.drawRect(-.1*r,0,.2*r,.5*r);return n.endFill(),n.beginFill(16382714,.9),n.lineStyle(2,3355443,.9),n.drawCircle(0,0,.09*r),n.drawCircle(0,0,.04*r),n.endFill(),n.interactive=!0,n._isHandler=!0,n._nodeId=e.active.length&&e.active[0].id,n._handlerType="move",t.addChild(n),n}(t,e,n),s=function(t,e){var i=e.scale,r=new Zd;return r.beginFill(16777215,.05),r.drawRect(0,-.1*i,.5*i,.2*i),r.endFill(),r.lineStyle(2.5,Yv,1),r.lineTo(.5*i,0*i),r.moveTo(.4*i,.1*i),r.lineTo(.5*i,0*i),r.lineTo(.4*i,-.1*i),r.endFill(),r.interactive=!0,r._isHandler=!0,r._nodeId=e.active.length&&e.active[0].id,r._handlerType="moveAxisX",t.addChild(r),r}(t,e);t.addChild(s),t.addChild(o)}if(n.z){var a=function(t,e){var i=e.scale,r=new Zd;return r.beginFill(16777215,.05),r.drawRect(-.1*i,.1*i,.2*i,.4*i),r.endFill(),r.lineStyle(2.5,Hv,1),r.moveTo(0*i,.12*i),r.lineTo(0*i,.5*i),r.moveTo(.1*i,.4*i),r.lineTo(0*i,.5*i),r.lineTo(-.1*i,.4*i),r.endFill(),r.interactive=!0,r._isHandler=!0,r._nodeId=e.active.length&&e.active[0].id,r._handlerType="moveAxisZ",t.addChild(r),r}(t,e);t.addChild(a)}if(n.start){var h=function(t,e){var i,r,n=e.scale,o=new Zd,s=16382714;"point"===(null===(i=t._startRelation)||void 0===i?void 0:i.relation)&&(s=11002308);"edge"===(null===(r=t._startRelation)||void 0===r?void 0:r.relation)&&(s=15723934);return o.beginFill(s,.9),o.lineStyle(2,3355443,.9),o.drawCircle(0,0,.08*n),o.drawCircle(0,0,.035*n),o.endFill(),o.interactive=!0,o._isHandler=!0,o._nodeId=e.active.length&&e.active[0].id,o._handlerType="point-start",t.addChild(o),o}(t,e);t.addChild(h)}if(n.end){var l=function(t,e){var i,r,n=e.scale,o=new Zd,s=e.active[0].l;o.x=s*n;var a=16382714;"point"===(null===(i=t._endRelation)||void 0===i?void 0:i.relation)&&(a=11002308);"edge"===(null===(r=t._endRelation)||void 0===r?void 0:r.relation)&&(a=15723934);return o.beginFill(a,.9),o.lineStyle(2,3355443,.9),o.drawCircle(0,0,.07*n),o.drawCircle(0,0,.01*n),o.endFill(),o.interactive=!0,o._isHandler=!0,o._nodeId=e.active.length&&e.active[0].id,o._handlerType="point-end",t.addChild(o),o}(t,e);t.addChild(l)}if(n.polygon){var u=function(t,e){var i,r=e.scale;return((null===(i=e.active[0])||void 0===i?void 0:i.polygon)||[]).map(((i,n)=>{var o="polygon-point_".concat(n),s=new Zd,a=16382714;return s.x=i[0]*r,s.y=i[1]*r,s.beginFill(a,.9),s.lineStyle(2,3355443,.9),s.drawCircle(0,0,.04*r),s.endFill(),s.interactive=!0,s._isHandler=!0,s._nodeId=e.active.length&&e.active[0].id,s._handlerType=o,t.addChild(s),s}))}(t,e);u.forEach((e=>t.addChild(e)))}if(!r)if(n.ry){var p=function(t,e){var i=e.scale,r=new Zd,n=.7;return r.lineStyle(2,3355443,.8),r.drawCircle(0,0,n*i),r.beginFill(16382714,.9),r.lineStyle(2,3355443,.9),r.drawCircle(n*i,0,.07*i),r.endFill(),r.moveTo(n*i,.02*i),r.lineTo(n*i,-.02*i),r.interactive=!0,r._isHandler=!0,r._nodeId=e.active.length&&e.active[0].id,r._handlerType="rotate",t.addChild(r),r}(t,e);t.addChild(p)}else if(n.l){var c=function(t,e,i){var r=e.scale,n=new Zd,o=e.active[0].l;n.x=o*r,i&&(n.beginFill(16777215,.05),n.drawRect(0,-.1*r,.3*r,.2*r),n.endFill(),n.lineStyle(2.5,Yv,.8),n.lineTo(.3*r,0*r),n.moveTo(.225*r,.075*r),n.lineTo(.3*r,0*r),n.lineTo(.225*r,-.075*r));return n.beginFill(16382714,.9),n.lineStyle(2,3355443,.9),n.drawCircle(0,0,.07*r),n.drawCircle(0,0,.01*r),n.endFill(),n.interactive=!0,n._isHandler=!0,n._nodeId=e.active.length&&e.active[0].id,n._handlerType="length",t.addChild(n),n}(t,e,!!n.z);t.addChild(c)}t._setScale(e)}}}function Wv(t){var e=t.ry/180*Math.PI,i={x:1*Math.cos(e),z:-1*Math.sin(e)};return{l:i,p:it(t,i),w:{x:-1*Math.cos(e+Math.PI/2),z:1*Math.sin(e+Math.PI/2)}}}function Vv({state:t,handler:e,screenPos:i,dragOffset:r,snapMove:n}){var o,s,a,h=t.active.length>1,l=t.active[0];if(l){var u=h&&l.getWorldPosition(),p=null==l?void 0:l.type,c=!(null!==(o=Ae[p])&&void 0!==o&&o.z)||(null==n?void 0:n.x),d=!(null!==(s=Ae[p])&&void 0!==s&&s.x)||(null==n?void 0:n.z),f="door"===p||"window"===p,v=e._actionId,y={x:(i[0]+r[0])/t.scale,z:(i[1]+r[1])/t.scale},g=l.getLocalPositionFromWorld(y),m=null===(a=e.children)||void 0===a?void 0:a.find((t=>"guide"===t._handlerType));if(d||c){var _,x=Wv(l);if(c?_=tt(l,x.p,g,it(g,x.w)):d&&(_=tt(l,it(l,x.w),g,it(g,x.l))),!m){var b=function({scale:t,snapX:e,snapZ:i}){var r=new Zd;return r.lineStyle(2.5,e?Yv:Hv,.3),r.endFill(),r.moveTo(0,0),e?(r.lineTo(100*t,0),r.lineTo(-100*t,0)):i&&(r.lineTo(0,100*t),r.lineTo(0,-100*t)),r.endFill(),r._handlerType="guide",r}({scale:t.scale,snapX:c,snapZ:d});e.addChild(b)}g=_}f&&(g.x=Math.max(0,g.x),g.x=Math.min(l.parent.l-l.l,g.x),g.z=0),l.setTransform({x:g.x,z:g.z},{actionId:v});var P=l.getWorldPosition();e.x=P.x*t.scale,e.y=P.z*t.scale,e._update({handler:e,state:t}),h&&t.active.forEach(((t,e)=>{if(0!==e){var i=t.getWorldPosition(),r={x:P.x+i.x-u.x,z:P.z+i.z-u.z},n=t.getLocalPositionFromWorld(r);Ae[t.type].z||(n.z=t.z),t.setTransform({x:n.x,z:n.z},{actionId:v})}}))}}function qv({state:t,handler:i,screenPos:r,dragOffset:n,dragPoint:o}){var s=t.active[0];if(s){var a=i._wallRelations||[],h=i._startRelation,l=i._endRelation,u=i._actionId,p="wall"===s.parent.type,c={},d=a.filter((t=>!0===t.isEdge));if("edge"!==(null==h?void 0:h.relation)&&d.length)for(var f of d)if(f.relatedNodes.find((t=>t.node.locked)))return;if("start"===o){if("point"===(null==h?void 0:h.relation)&&h.relatedWall.locked)return;var v,y={x:(r[0]+n[0])/t.scale,z:(r[1]+n[1])/t.scale},g=s.getLocalPositionFromWorld(y),m=0;if(p){g.z=0,v=Z(g,Dt(e(e({},s),{},{w:s.parent.w})).l2)}else{var{x:_,z:x,ry:b,l:P}=Zv(o,y,g,t);g.x=_||g.x,g.z=x||g.z,m=b,v=P}var w=s.l-v;c={x:g.x,z:g.z,l:v,ry:m},s.children.forEach((t=>{t.set({x:t.x-=w},{actionId:u})}))}else if("end"===o){if("point"===(null==l?void 0:l.relation)&&l.relatedWall.locked)return;var E,T={x:r[0]/t.scale,z:r[1]/t.scale},C=s.getLocalPositionFromWorld(T),I=0;if(p)C.z=0,E=Z(s,C);else{var{ry:S,l:O}=Zv(o,T,C,t);I=S,E=O}c={l:E,ry:I}}else if("drag"===o){var A={x:(r[0]+n[0])/t.scale,z:(r[1]+n[1])/t.scale},M=s.getLocalPositionFromWorld(A);if(p&&(M.z=0),h&&l){if("point"===h.relation&&h.relatedWall.locked||"point"===l.relation&&l.relatedWall.locked)return;var L=Wv(s);M=tt(s,it(s,L.w),M,it(M,L.l))}else if(h||l){var N=h||l;if("point"===N.relation&&N.relatedWall.locked)return;var R=Wv(N.relatedWall);M=tt(s,it(s,R.l),M,it(M,R.w))}c={x:M.x,z:M.z}}s.set(c,{actionId:u}),a.length&&Xe(t,a,u);var D=s.getWorldPosition();i.rotation=Math.PI/180*-D.ry,i.x=D.x*t.scale,i.y=D.z*t.scale,i._update({handler:i,state:t}),t._elementLengthHelper&&t._elementLengthHelper.update()}}var Zv=(t,e,i,r)=>{var n="start"===t,o=r.active[0],s=Dt(o),a=o.getWorldPosition(),{l2:h}=Dt(a),l=n?h:a,u=$(l,at([e.x,e.z])),p=90*Math.round(u/90),c=0===Math.abs(p)||180===Math.abs(p),d=!r.altKey&&Math.abs(u-p)<=5,f=r.shiftKey;if(d||f){var v=r.getActiveLevel(),y=c?[e.x,l.z]:[l.x,e.z],g=v.getLocalPositionFromWorld({x:y[0],z:y[1]});return g=Rt(g,v),{l:n?Z(g,s.l2):Z(o,g),ry:n?$(g,s.l2):$(o,g),x:g.x,z:g.z}}if(n){var m=$(i,s.l2);return{l:Z(i,s.l2),ry:m}}if("end"===t){var _=$(o,i);return{l:Z(o,i),ry:_}}};function Jv(t="linear"){return cv[t]}function Kv({bb:t={},animate:e=!1,viewport:i,isScaled:r=!1,state:n}){if(!i&&!n._getViewport)throw new Error("no viewport");return i=i||n&&n._getViewport(),n.viewportPaused&&n.startAnimationLoop(),new Promise((n=>{if(Number.isFinite(t.x)||n(!1),t.y&&!t.z&&(t.z=t.y,t.z2=t.y2,t.length=t.width,t.width=t.height),!r){var o=i._getState();Object.keys(t).forEach((e=>{t[e]=t[e]*o.scale}))}var s=0;Number.isFinite(e)?s=e:!0===e&&(s=500);var a={x:t.x+t.length/2,y:t.z+t.width/2,width:t.length,height:t.width};if(s){var h={x:i.center.x,y:i.center.y,width:i.worldScreenWidth,height:i.worldScreenHeight},l={x:h.x-a.x,y:h.y-a.y,width:h.width-a.width,height:h.height-a.height};i._zoomTarget={delta:l,start:h,target:a,time:0,duration:s,destroy:()=>{i._ticker.remove("animateView",Qv,i),delete i._zoomTarget,n(!0)},ease:Jv("easeInOutQuad"),updateViewport:$v.bind(i)},i._ticker.add("animateView",Qv,i)}else i.fit(!1,a.width,a.height).moveCenter(a.x,a.y),$v.bind(i)({viewport:i,type:"animation"}),i.needsUpdate=!0,n(!0)}))}function Qv(t){var e=this._zoomTarget,i=!1;e.time+=t;var r=e.ease(e.time,0,1,e.duration),n={x:e.start.x-e.delta.x*r,y:e.start.y-e.delta.y*r,width:e.start.width-e.delta.width*r,height:e.start.height-e.delta.height*r};e.time>e.duration&&(n=e.target,i=!0),this.fit(!1,n.width,n.height).moveCenter(n.x,n.y),this.needsUpdate=!0,e.updateViewport({viewport:this,type:"animation"});var o=0!==this.input.count();(i||o)&&e.destroy()}function $v(t){"animation"!==t.type&&t.viewport._zoomTarget&&t.viewport._zoomTarget.destroy();var e=this._getState(),i=this._getGrid(),r=this._getMarkers(),n=this._getHandler&&this._getHandler(),o=this.scale._x,s=this.left,a=this.top,h=this.worldScreenWidth,l=this.worldScreenHeight;e.viewbox={x:s/e.scale,z:a/e.scale,x2:(s+h)/e.scale,z2:(a+l)/e.scale,length:h/e.scale,width:l/e.scale},e.client=[this.screenWidth,this.screenHeight],e.zoom=o,e.emit("viewbox",{sourceEvent:{type:t.type},viewbox:e.viewbox,pos:e.cursor,zoom:e.zoom}),i.update(),r.update(),e.resources.spaces.forEach((t=>{if(t._gfx){var i=Math.min(1/e.zoom,2);t._gfx.scale.x=i,t._gfx.scale.y=i,t._gfx.visible=t.area>1.5*i}})),n&&n._setScale(e)}var ty=(t,e,i)=>{var r=e.x-t.x,n=e.z-t.z,o=((i.x-t.x)*r+(i.z-t.z)*n)/(r*r+n*n);return{x:t.x+o*r,z:t.z+o*n}};class ey{constructor({state:t,lines:i=[],settings:r={}}){this.state=t,this.lines=i,this.graphic=null,this.settings=e({pointDistance:.15,lineExtension:.03,pointGap:.01,lineColor:16733440,lineWidth:.5},r)}lineLength(t){return Ct(t[0],t[1])}draw(){this.graphic||(this.graphic=new Kf(this.state,"_measureLayer"));var t=[];this.lines.forEach((e=>{e.length<2||e.forEach(((i,r)=>{if(r!==e.length-1){var n,o=0===r,s=r===e.length-2,a=[i,e[r+1]],h=this.settings.pointDistance>=0?1:-1,l={x:a[0][0],y:0,z:a[0][1]},u={x:a[1][0],y:0,z:a[1][1]},p=[u.x-l.x,u.z-l.z],c=st(Q({x:p[0],z:p[1]})),d={x:c.z,y:0,z:-c.x},f=it(l,st(ot(d,this.settings.pointGap*h))),v=it(u,st(ot(d,this.settings.pointGap*h))),y=it(l,st(ot(d,this.settings.pointDistance))),g=st(tt(y,it(y,c),u,it(u,d))),m=it(y,st(ot(c,-this.settings.lineExtension))),_=it(g,st(ot(c,this.settings.lineExtension))),x=it(y,st(ot(d,this.settings.lineExtension*h))),b=it(g,st(ot(d,this.settings.lineExtension*h))),P=[];o&&s?(n=[[m.x,m.z],[_.x,_.z]],P.push([[f.x,f.z],[x.x,x.z]]),P.push([[v.x,v.z],[b.x,b.z]])):o?(n=[[m.x,m.z],[g.x,g.z]],P.push([[f.x,f.z],[x.x,x.z]])):s?(n=[[y.x,y.z],[_.x,_.z]],P.push([[f.x,f.z],[x.x,x.z]]),P.push([[v.x,v.z],[b.x,b.z]])):(n=[[y.x,y.z],[g.x,g.z]],P.push([[f.x,f.z],[x.x,x.z]])),t.push({line:n,connectors:P.filter((t=>this.lineLength(t)>1e-5)),text:this.getLengthText(Z(y,g))})}}))}));var{lineShapes:e,textShapes:i}=t.reduce(((t,{line:e,connectors:i,text:r})=>{t.lineShapes.push(...[e,...i].map((t=>({type:"polyline",points:t,props:{stroke:this.settings.lineColor,strokeWidth:this.settings.lineWidth,native:!0}}))));var n=[e[0][0]+(e[1][0]-e[0][0])/2,e[0][1]+(e[1][1]-e[0][1])/2],o=$({x:e[0][0],z:e[0][1]},{x:e[1][0],z:e[1][1]});return(o>90||o<-90)&&(o+=180),t.textShapes.push({shapes:[{type:"text",text:r,position:[0,0],rotation:o,align:"center",fontSize:12,fill:this.settings.lineColor}],pos:n,preserve:!0,scaleOnZoom:!0,interactive:!0,isHandler:!0}),t}),{lineShapes:[],textShapes:[]});this.graphic.draw({shapes:e}),i.forEach((t=>this.graphic.draw(t)))}getLengthText(t){if("imperial"===this.state.settings.units.system){var{feetInt:e,inchDisplay:i}=Ms(t);return"".concat(e,"′ ").concat(i,"″")}return Math.round(100*t)/100+" m"}destroy(){this.graphic&&this.graphic.destroy(),this.graphic=null,this.lines=[]}}class iy extends ey{constructor({node:t=null,state:e,polygonPoints:i=[]}){super({state:e}),this.node=t,this.polygonPoints=i,this.splitLine=null,e.on("viewbox",this.update,this),this.polygonPoints.length||this.update()}update(){if(this.node||this.polygonPoints.length){if(this.node&&"door"===this.node.type)this.lines=[];else if(this.polygonPoints.length){var{pos:t}=this.state.snapCursor,i=[...this.polygonPoints,t];this.lines=[[i[i.length-2],i[i.length-1]]]}else{var r,n=this.node.getWorldPosition(),o=n.w||(null===(r=this.node.parent)||void 0===r?void 0:r.w)||.1;if("column"===this.node.type){var s=n.l/2;n=e(e({},n),{},{x:n.x-s,z:n.z-s})}var{p1:a,p2:h,p3:l,p4:u}=Dt(e(e({},n),{},{w:o}));if(!!this.state._splitWallHelper){var p=this.state.cursor,c={x:p[0],z:p[1]},d=ty(a,h,c);this.lines=[[[a.x,a.z],[d.x,d.z],[h.x,h.z]]];var f=ty(l,u,c);this.splitLine=[[d.x,d.z],[f.x,f.z]]}else this.lines=[[[a.x,a.z],[h.x,h.z]]],this.splitLine=null}this.draw()}}draw(){super.draw(),this.splitLine&&this.graphic.draw({shapes:[{type:"polyline",points:this.splitLine,props:{stroke:this.settings.lineColor,strokeWidth:this.settings.lineWidth,native:!0}}],preserve:!0,interactive:!0,isHandler:!0})}destroy(){super.destroy(),this.state.off("viewbox",this.update),this.polygonPoints=[],this.splitLine=null}}class ry{constructor({node:t,state:e}){this._state=e,this._node=t,e.on("key",this.keyHandler,this)}getChildrenInBound(t){var e,i=(null===(e=t.children)||void 0===e?void 0:e.slice())||[];return i.forEach(((e,r)=>{var n=e.x+e.l;e.x>t.l||n<0?i[r]._outOfBound=!0:n>t.l?t.l-e.x>.6?i[r].l=t.l-e.x:i[r]._outOfBound=!0:e.x<0&&(n>.6?(i[r].l+=e.x,i[r].x=0):i[r]._outOfBound=!0)})),i.filter((t=>!t._outOfBound))}split(){var t=this._node,i=this._state.cursor,r=t.getLocalPositionFromWorld({x:i[0],z:i[1]}),n=Be({state:this._state,wall:t})||[],o=j(),{x:s,z:a}=t.getWorldPosition(),h=n.filter((t=>t.point[0]!==s||t.point[1]!==a)),l=Z({x:t.x,z:t.z},{x:r.x,z:r.z}),u=Math.sin(Ns(t.ry)),p=Math.cos(Ns(t.ry)),c=e(e({},t.toJson({regenerateIds:!0})),{},{x:t.x+p*l,z:t.z-u*l,l:t.l-l,children:t.children.map((t=>e(e({},t),{},{x:t.x-l})))});c.children=this.getChildrenInBound(c);var d=t.parent.addChild(c,{regenerateIds:!0,actionId:o});t.set({l:l},{actionId:o});var f=this.getChildrenInBound(t).map((t=>t.id));t.children.slice().forEach((e=>!f.includes(e.id)&&t.removeChild(e,{actionId:o}))),h.forEach((({node:e,relatedNodes:i})=>{var r=i.findIndex((e=>e.node.id!==t.id)),n=i[r],s=i[Math.abs(r-1)].relation;e.remove({actionId:o}),Fe({actionId:o,state:this._state,wall1:d,wall2:n.node,rel1:s,rel2:n.relation})})),this.destroy()}keyHandler(t){var{key:e}=t||{};"Escape"===e&&(this.destroy(),this._state._elementLengthHelper.update())}destroy(){delete this._state._splitWallHelper,this._state.off("key",this.keyHandler)}}class ny extends ey{constructor({node:t,state:e}){super({state:e,settings:{pointDistance:0,lineExtension:0,pointGap:0}}),this.node=t,this.initialContour=null,e.on("drag-start",this.setInitialContour,this),e.on("viewbox",this.update,this),e.on("mousemove",this.update,this),this.update()}setInitialContour(){var t,i=this.node.getWorldPosition(),r=i.w||(null===(t=this.node.parent)||void 0===t?void 0:t.w)||.1,n=kt(e(e({},i),{},{w:r}));this.initialContour=n}update(){var t;if(this.node){var i=this.state.cursor,r=this.node.getWorldPosition(),n=r.w||(null===(t=this.node.parent)||void 0===t?void 0:t.w)||.1,o=kt(e(e({},r),{},{w:n}));this.initialContour||(this.initialContour=o);var s=!!this.state._splitWallHelper;if(!ft(i,o)||"wall"!==this.node.type||s)return this.lines=[],void this.draw();var a={x:i[0],y:0,z:i[1]},{p1:h,p2:l,p3:u,p4:p,nW:c}=Dt(e(e({},r),{},{w:n})),d=it(a,st(ot(c,20))),f=it(a,st(ot(c,-20))),v=tt(h,l,a,d),y=tt(u,p,a,f),g=[],m=[],_=(t,e,i,r)=>{var n=function(t,e){var i=[];return e.forEach((e=>{e.forEach(((r,n)=>{var o=function([[t,e],[i,r]],[[n,o],[s,a]]){if(t===i&&e===r||n===s&&o===a)return!1;var h=(a-o)*(i-t)-(s-n)*(r-e);if(0===h)return!1;var l=((s-n)*(e-o)-(a-o)*(t-n))/h,u=((i-t)*(e-o)-(r-e)*(t-n))/h;return!(l<0||l>1||u<0||u>1)&&[t+l*(i-t),e+l*(r-e)]}([r,n<e.length-1?e[n+1]:e[0]],t);o&&i.push(o)}))})),i=i.sort(((e,i)=>{var r=Ct(e,t[0]),n=Ct(i,t[0]);return r>n?1:r<n?-1:0}))}(t,e).filter((e=>{var r,n,o=[i,e];return!(et(at(e),at(this.initialContour[0]),at(this.initialContour[1]),.001)||et(at(e),at(this.initialContour[2]),at(this.initialContour[3]),.001))&&Math.round(1e3*this.lineLength(o))>0&&(n=t,Mt([(r=o)[1][0]-r[0][0],r[1][1]-r[0][1]],[n[1][0]-n[0][0],n[1][1]-n[0][1]]))}));n[0]&&r.push([i,n[0]])};this.state.computed.relations.spaces.filter((t=>Object.keys(t.relationsById).includes(this.node.id))).forEach((t=>{var e=this.state.resources.spaces.find((e=>e.id===t.node.id));t.relationsById[this.node.id].edgeRelations.forEach((t=>{switch(t.nodeContourIndex){case 0:_([[d.x,d.z],[f.x,f.z]],e.polygons,[v.x,v.z],g);break;case 2:_([[f.x,f.z],[d.x,d.z]],e.polygons,[y.x,y.z],m)}}))}));var x=[],b=(t,e)=>{var i=this.lineLength(t),r=this.lineLength(e);return i<r?-1:i>r?1:0};g=g.sort(b),m=m.sort(b),x=[],g.length>0&&x.push(g[0]),m.length>0&&x.push(m[0]),this.lines=x,this.draw()}}destroy(){super.destroy(),this.state.off("viewbox",this.update),this.state.off("mousemove",this.update),this.state.off("drag-start",this.setInitialContour),this.initialContour=null}}class oy extends ey{constructor({node:t,state:e}){super({state:e}),this.node=t,e.on("viewbox",this.update,this),e.on("mousemove",this.update,this),this.update()}update(){var t;if(this.node){if("door"!==this.node.type)return this.lines=[],void this.draw();var i=this.node.getWorldPosition(),r=i.w||(null===(t=this.node.parent)||void 0===t?void 0:t.w)||.1,{p1:n,p2:o,p3:s,p4:a}=Dt(e(e({},i),{},{w:r})),h=[];if(this.state.computed.relations.spaces.filter((t=>Object.keys(t.relationsById).includes(this.node.id))).forEach((t=>{var e=t.node;if(e){var i=[(e=e.getWorldPosition()).polygon,...e.polygonHoles].map((t=>Ft(e,t)));for(var r of t.relationsById[this.node.id].edgeRelations)if("front"===this.node.side&&2===r.nodeContourIndex||"back"===this.node.side&&0===r.nodeContourIndex){var[n,o]=r.edgeIndex,s=i[n],a=o+1>s.length-1?0:o+1;h=[s[o],s[a]];break}}})),0===h.length&&this.node.parent){var l=Dt(this.node.parent.getWorldPosition());h="back"===this.node.side?[[l.p1.x,l.p1.z],[l.p2.x,l.p2.z]]:[[l.p3.x,l.p3.z],[l.p4.x,l.p4.z]]}var u,p,c,d,f,v,y,g,m,_,x=[];if(x="back"===this.node.side?[[n.x,n.z],[o.x,o.z]]:[[s.x,s.z],[a.x,a.z]],this.lines=[x],h.length>0){var b=Math.round((p=x,180*(c=[(u=h)[1][0]-u[0][0],u[1][1]-u[0][1]],d=[p[1][0]-p[0][0],p[1][1]-p[0][1]],f=c[0],v=c[1],y=d[0],g=d[1],m=Math.sqrt(f*f+v*v)*Math.sqrt(y*y+g*g),_=m&&(f*y+v*g)/m,Math.acos(Math.min(Math.max(_,-1),1))/Math.PI)));0===b?this.lines=[[h[0],x[0],x[1],h[1]]]:180===b&&(this.lines=[[h[1],x[0],x[1],h[0]]])}this.draw()}}destroy(){super.destroy(),this.state.off("viewbox",this.update),this.state.off("mousemove",this.update)}}function sy({viewport:t,state:e,grid:i,markers:r}){t._getState=()=>e,t._getGrid=()=>i,t._getMarkers=()=>r,e._getViewport=()=>t,t.drag().pinch({percent:4}).wheel(),t.on("pointerdown",ay).on("pointerup",hy).on("pointerup",Me).on("rightup",Le).on("pointerupoutside",hy).on("pointermove",ly).on("mousemove",uy).on("moved",$v).on("zoomed",$v),e.settings.panZoom||(t.plugins.pause("drag"),t.plugins.plugins.drag.options.pressDrag=!1,t.plugins.pause("wheel"),t.plugins.pause("pinch")),py(e),(t=>{document.addEventListener("keydown",(e=>{if(t.viewportInFocus){var i=(new Date).getTime();e.key&&!Object.values({shift:16,ctrl:17,alt:18,meta:91}).includes(e.keyCode)&&(t.key=e.key),i-t.lastKey<500?t.keyString+=e.key:t.keyString=e.key,t.emit("key",{key:e.key,lowerCaseKey:e.key&&e.key.toLowerCase(),state:t,sourceEvent:e}),t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.altKey=e.altKey,t.metaKey=e.metaKey,t.lastKey=i}})),document.addEventListener("keyup",(e=>{t.viewportInFocus&&(t.key="",t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.altKey=e.altKey,t.metaKey=e.metaKey)}))})(e),e.on("click",Ne),e.on("dblclick",Ne),e.on("handler",Gv),e.on("select",(({node:t})=>{var i;e._elementLengthHelper&&(e._elementLengthHelper.destroy(),delete e._elementLengthHelper),e._spaceDistanceHelper&&(e._spaceDistanceHelper.destroy(),delete e._spaceDistanceHelper),e._spaceRelationsHelper&&(e._spaceRelationsHelper.destroy(),delete e._spaceRelationsHelper),e._splitWallHelper&&(null===(i=e._splitWallHelper)||void 0===i?void 0:i._node.id)!==(null==t?void 0:t.id)&&(e._splitWallHelper.destroy(),delete e._splitWallHelper),null!=t&&t.l&&"box"!==t.type&&(e._elementLengthHelper=new iy({state:e,node:t}),e._spaceDistanceHelper=new ny({state:e,node:t}),e._spaceRelationsHelper=new oy({state:e,node:t}))})),e.on("splitwall",(({node:t})=>{e._splitWallHelper&&(e._splitWallHelper.destroy(),delete e._splitWallHelper),e._splitWallHelper=new ry({state:e,node:t})}))}function ay(t){var e,i,r=this._getState(),n=r.altKey,o=null===(e=t.target)||void 0===e?void 0:e._nodeId;if(n){var s=r.active.length>1&&r.active.some((t=>t.find({id:o})));!s&&Ne({sourceEvent:t,nodeId:o,state:r})}this._dragStart={x:t.data.global.x,y:t.data.global.y};var a=t.target._isHandler,h=t.target._handlerType,l=r.active[0],u=o&&r.scene.nodesById[o],p=l&&(null==u?void 0:u.id)===(null==l?void 0:l.id)&&(null===(i=Ae[null==l?void 0:l.type])||void 0===i?void 0:i.drag),c=l&&(null==u?void 0:u.parent)===l,d=!a&&(p||c),f=r.active.find((t=>"polyfloor"===t.type)),v=n&&!f;if(a||v||d){r.isDragging=!d||"element",this.isDragging=!0,this.handlerType=v?"move":d?"element-drag":h,this.onDrag=t.target._onDrag,this.plugins.pause("drag");var y=this._getHandler();y._actionId=j();var g=t.data.getLocalPosition(this);this.dragOffset=[y.x-g.x,y.y-g.y],v&&r.active.forEach((t=>{var e=t.toJson({regenerateIds:!0});t.parent.addChild(e),1===r.active.length&&Ne({nodeId:e.id})}))}else r.isPanning=!0;r.emit("drag-start",{pos:r.cursor,sourceEvent:{}})}function hy(){this.isDragging=!1;var t=this._getState();if(t.isPanning=!1,this.handlerType){var e,i=this._getHandler(),r=null===(e=i.children)||void 0===e?void 0:e.find((t=>"guide"===t._handlerType));if(t.isDragging=!1,r&&i.removeChild(r),t.active[0]&&t.active[0].id){var n=this._actionId;t.updateState({node:t.active[0],options:{updateState:!0,actionId:n},event:"drag-end"})}t.lastSceneClick=[...t.cursor]}this._wallRelations=null,this._hasStartRelation=null,this.handlerType=null,this.dragOffset=null,this.plugins.resume("drag"),t.emit("drag-end",{pos:t.cursor,sourceEvent:{}})}function ly(t){if(this.isDragging){var e=this._getState(),i=this._getHandler(),r=t.data.getLocalPosition(this),n=[r.x,r.y],o=this.dragOffset,[s,a]=this.handlerType.split("_");switch(s){case"element-drag":qv({state:e,handler:i,screenPos:n,dragOffset:o,dragPoint:"drag"});break;case"point-start":qv({state:e,handler:i,screenPos:n,dragOffset:o,dragPoint:"start"});break;case"point-end":qv({state:e,handler:i,screenPos:n,dragOffset:o,dragPoint:"end"});break;case"move":Vv({state:e,handler:i,screenPos:n,dragOffset:o});break;case"moveAxisX":Vv({state:e,handler:i,screenPos:n,dragOffset:o,snapMove:{x:!0}});break;case"moveAxisZ":Vv({state:e,handler:i,screenPos:n,dragOffset:o,snapMove:{z:!0}});break;case"rotate":!function({state:t,handler:e,screenPos:i}){var r=t.active[0],n={x:i[0]/t.scale,z:i[1]/t.scale},o=r.getLocalPositionFromWorld(n),s=e._actionId,a=$(r,o);t.shiftKey&&(a=90*Math.round(a/90)),r.setTransform({ry:a},{actionId:s});var h=r.getWorldPosition();e.rotation=Math.PI/180*-h.ry}({state:e,handler:i,screenPos:n});break;case"length":!function({state:t,handler:e,screenPos:i}){var r=t.active[0],n=!Ae[r.type].z,o={x:i[0]/t.scale,z:i[1]/t.scale},s=r.getLocalPositionFromWorld(o),a=$(r,s),h=Z(r,s),l=n?{l:h}:{ry:a,l:h},{type:u}=r,p="door"===u||"window"===u,c=e._actionId;p&&(l.l=Math.min(r.parent.l-r.x,h)),r.set(l,{actionId:c});var d=r.getWorldPosition();e.rotation=Math.PI/180*-d.ry,e._update({handler:e,state:t})}({state:e,handler:i,screenPos:n});break;case"polygon":this.onDrag&&this.onDrag(t.target._nodeId,{x:n[0],y:n[1]});break;case"polygon-point":(({state:t,handler:e,screenPos:i,index:r})=>{if(r){var n=t.active[0].getLocalPositionFromWorld({x:i[0]/t.scale,z:i[1]/t.scale}),{x:o,z:s}=Rt(n,t.active[0]),a=t.active[0].polygon.slice();a[r]=[o,s],t.active[0].set({polygon:a});var h=t.active[0].getWorldPosition();e.x=h.x*t.scale,e.y=h.z*t.scale,e._update({handler:e,state:t})}})({state:e,handler:i,screenPos:n,dragOffset:o,index:a})}}}function uy(t){var e,i,r,{srcElement:n}=(null==t||null===(e=t.data)||void 0===e?void 0:e.originalEvent)||{};if(n){var o=this._getState();if(n===this.options.divWheel){var s=t.data.getLocalPosition(this),a=[s.x/100,s.y/100];o.cursor=a;var h=t.target&&t.target._nodeId,l=t.target&&t.target._isHandler;o.emit("mousemove",{sourceEvent:t,nodeId:h,pos:a});var u,p=o.active[0],c=h&&(null==p?void 0:p.id)===h&&Ae[null==p?void 0:p.type].drag;h&&(u=o.scene.nodesById[h]);var d="wall"===(null===(i=u)||void 0===i?void 0:i.parent.type)&&(null===(r=u)||void 0===r?void 0:r.parent.id)===(null==p?void 0:p.id);c||d||o.isDragging||l?o._splitWallHelper?(o._elementLengthHelper.update(),document.body.style.cursor="url(".concat("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAyNiAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNTczNzMgMTQuMDM0OEwxMS45Mzc5IDEyLjEzNzdDMTMuMTMyNSAxMy4wNDE3IDE0LjMxNDYgMTMuOTAwMSAxNS4yODU2IDE0LjUzNjJDMTYuNzEwOSAxNS40NzAxIDE4LjM0MDYgMTUuNjkzOSAxOS43Njc5IDE1LjYxMjFDMjEuMTkzNyAxNS41MzAzIDIyLjQ2MDggMTUuMTQxNSAyMy4yMDg5IDE0Ljc5NzhMMjQuMDk4NyAxNC4zODlMMjMuMjQ1NyAxMy45MDc5TDE2LjAyMjIgOS44MzQ1MkwyMy4yNDggNS43NTk4M0wyNC4xMDEgNS4yNzg4MkwyMy4yMTExIDQuODY5OTdDMjIuNDYzMSA0LjUyNjI3IDIxLjE5NiA0LjEzNzUgMTkuNzcwMSA0LjA1NTcxQzE4LjM0MjkgMy45NzM4NCAxNi43MTMyIDQuMTk3NzIgMTUuMjg3OCA1LjEzMTU1QzE0LjMxNjQgNS43NjgwMiAxMy4xMzM1IDYuNjI2OTcgMTEuOTM4MiA3LjUzMTUzTDguNTcxNDggNS42MzMwMUM4LjY1ODA2IDQuNTQ5MDkgOC4yODY4NiAzLjQzMzg3IDcuNDU2NzMgMi42MDM3NEM1Ljk1Mzk3IDEuMTAwOTggMy41MTc1MiAxLjEwMDk4IDIuMDE0NzYgMi42MDM3NEMwLjUxMjAwNiA0LjEwNjUgMC41MTIwMDYgNi41NDI5NSAyLjAxNDc2IDguMDQ1NzFDMy40MTIxNyA5LjQ0MzExIDUuNjE2OTUgOS41NDEwOCA3LjEyNzU2IDguMzM5NkM3LjYzOTEyIDguNzU5NDggOC4yNzQ2MiA5LjI3NDUyIDguOTc3ODMgOS44MzQ3OEM4LjI3NTUgMTAuMzk0NCA3LjY0MDggMTAuOTA4OCA3LjEyOTc3IDExLjMyODJDNS42MTkxNyAxMC4xMjY4IDMuNDE0NDIgMTAuMjI0NyAyLjAxNzAyIDExLjYyMjFDMC41MTQyNjMgMTMuMTI0OSAwLjUxNDI2NCAxNS41NjEzIDIuMDE3MDIgMTcuMDY0MUMzLjUxOTc4IDE4LjU2NjkgNS45NTYyMyAxOC41NjY5IDcuNDU4OTkgMTcuMDY0MUM4LjI4OTE0IDE2LjIzNCA4LjY2MDMzIDE1LjExODcgOC41NzM3MyAxNC4wMzQ4Wk0zLjg1MTQ4IDEzLjQ1NjZDNC4zNDEwOSAxMi45NjcgNS4xMzQ5MiAxMi45NjcgNS42MjQ1MyAxMy40NTY2QzYuMTE0MTUgMTMuOTQ2MiA2LjExNDE1IDE0Ljc0IDUuNjI0NTMgMTUuMjI5NkM1LjEzNDkyIDE1LjcxOTMgNC4zNDEwOSAxNS43MTkzIDMuODUxNDggMTUuMjI5NkMzLjM2MTg2IDE0Ljc0IDMuMzYxODYgMTMuOTQ2MiAzLjg1MTQ4IDEzLjQ1NjZaTTUuNjIyMjggNi4yMTEyNUM1LjEzMjY2IDYuNzAwODcgNC4zMzg4NCA2LjcwMDg3IDMuODQ5MjIgNi4yMTEyNUMzLjM1OTYgNS43MjE2MyAzLjM1OTYgNC45Mjc4MSAzLjg0OTIyIDQuNDM4MTlDNC4zMzg4MyAzLjk0ODU4IDUuMTMyNjYgMy45NDg1OCA1LjYyMjI4IDQuNDM4MTlDNi4xMTE4OSA0LjkyNzgxIDYuMTExODkgNS43MjE2MyA1LjYyMjI4IDYuMjExMjVaIiBmaWxsPSJibGFjayIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",") 16 16, pointer")):document.body.style.cursor="move":document.body.style.cursor="initial"}}}var py=t=>{var e=document.querySelector("#".concat(t.settings.editorId," .fpe__plan"));e&&(e.addEventListener("mouseleave",(()=>t.emit("focus",!1))),e.addEventListener("mouseenter",(()=>t.emit("focus",!0))),document.addEventListener("visibilitychange",(()=>t.emit("focus","visible"===document.visibilityState))),e.addEventListener("contextmenu",(function(t){return t.preventDefault(),!1}),!1))};!function(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}}('.fpe{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Avenir,Helvetica,Arial,sans-serif;max-height:100vh;max-width:100%;overflow:hidden}.fpe,.fpe-err{height:100%;position:relative;width:100%}.fpe-err__box{color:#888;font-family:sans-serif;height:100px;left:calc(50% - 175px);position:absolute;text-align:center;top:calc(50% - 50px);width:350px}.fpe-err__title{font-size:22px;font-weight:500;margin-bottom:22px}.fpe-err__msg{font-size:14px;font-weight:500}.fpe *{box-sizing:border-box}.fpe__plan{display:block;height:100%;max-height:100%;max-width:100%;width:100%}.fpe-marker{contain:layout;left:0;position:absolute;top:0;will-change:transform;z-index:1000}.fpe-marker--hidden{display:none}.fpe-info-window{background:#fff;border:1px solid #bbb;border-radius:3px;contain:layout;filter:drop-shadow(2px 2px 0 rgba(0,0,0,.2));font-size:14px;left:0;padding:10px;position:absolute;top:0;will-change:transform}.fpe-info-window h1,.fpe-info-window h2,.fpe-info-window h3,.fpe-info-window p{margin:0 0 5px}.fpe-info-window h1{font-size:20px}.fpe-info-window h2{font-size:18px}.fpe-info-window h3{font-size:16px}.fpe-info-window:after{border-left:15px solid transparent;border-right:15px solid transparent;border-top:15px solid #fff;bottom:-14px;content:"";filter:drop-shadow(0 1px 0 #bbb);left:30px;pointer-events:none;position:absolute}.fpe-info-window__content{height:100%;overflow:hidden}.fpe-info-window__close{background:#fff;border-radius:50%;cursor:pointer;height:20px;position:absolute;right:5px;top:5px;width:20px}.fpe-info-window__close:hover{background:#f3f5f7}.fpe-coordinates{bottom:50px;display:flex;justify-content:space-between;pointer-events:none;position:absolute;right:20px;-webkit-user-select:none;user-select:none;white-space:nowrap;width:120px}@media screen and (max-width:700px){.fpe-coordinates{display:none}}.fpe-coordinates__unit{display:inline-block;width:50px}.fpe-coordinates__debug{bottom:20px;color:#666;position:absolute;width:120px}.fpe-coordinates__debug span{display:inline-block;margin-right:10px}.fpe-scale-bar{bottom:15px;height:40px;pointer-events:none;position:absolute;right:20px;width:208px}@media screen and (max-width:700px){.fpe-scale-bar{left:auto;right:20px}}@media screen and (max-width:450px){.fpe-scale-bar{display:none}}.fpe-scale-bar text{fill:#3b3f45;font-size:.8px;-webkit-user-select:none;user-select:none}.fpe-scale-bar rect{fill:#444;stroke:#3b3f45;fill-opacity:.6;stroke-width:.06}.fpe-scale-bar rect.white{fill:#fff}.fpe-scale-bar path{fill:none;stroke:#3b3f45;stroke-width:.05}.fpe-scale-bar__background{stroke:none!important}.fpe-menu-bar{bottom:15px;left:15px;position:absolute;-webkit-user-select:none;user-select:none;z-index:2000}.fpe-menu-bar__btn{background:#fff;border:1px solid #ccc;border-right:none;display:inline-block;height:40px;position:relative;vertical-align:top;width:40px}.fpe-menu-bar__btn:first-of-type{border-bottom-left-radius:3px;border-right:none;border-top-left-radius:3px}.fpe-menu-bar__btn:last-of-type{border-bottom-right-radius:3px;border-right:1px solid #ccc;border-top-right-radius:3px}.fpe-menu-bar__sub-menu{bottom:50px;height:30px;left:0;position:absolute;width:-webkit-max-content;width:max-content}.fpe-menu-bar__sub-menu:after{border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #fff;bottom:-15px;content:"";filter:drop-shadow(0 1px 0 #bbb);left:10px;position:absolute}.fpe-menu-bar__sub-option{background:#fff;border:1px solid #ccc;border-right:none;cursor:pointer;display:inline-block;height:35px;line-height:35px;padding:0 10px;position:relative;vertical-align:top}.fpe-menu-bar__sub-option:first-of-type{border-bottom-left-radius:3px;border-right:none;border-top-left-radius:3px}.fpe-menu-bar__sub-option:last-of-type{border-bottom-right-radius:3px;border-right:1px solid #ccc;border-top-right-radius:3px}.fpe-menu-bar__sub-option--active,.fpe-menu-bar__sub-option:hover{color:#1a6aff}.fpe-menu-bar__icon{stroke:#333;cursor:pointer}.fpe-menu-bar__icon--active,.fpe-menu-bar__icon:hover{stroke:#1a6aff;fill:#1a6aff}.fpe-notifications{position:absolute;right:15px;top:15px;-webkit-user-select:none;user-select:none}.fpe-notifications__note{animation:fadeIn 1s;background:rgba(0,0,0,.4);border-radius:3px;color:#fff;font-weight:500;margin-bottom:5px;padding:7px 10px;text-align:center;width:170px}.fpe-notifications__note--fadeout{animation:fadeOut 1s ease}.fpe-notifications__note--success{background:rgba(0,180,60,.5)}.fpe-notifications__note--error{background:rgba(192,67,9,.664)}.fpe-notifications .msg-item{display:inline-block;margin-right:10px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}');class cy{constructor(t,e){t&&e&&(this.data={width:10,height:.4,margin:.2,style:"lines",box:{},scaleStep:null,scaleDisplay:null,steps:[],leftHanded:!1,isImperial:"imperial"===e.settings.units.system},this._state=e,this._state.on("viewbox",this.update,this),this.mount(t),this.update())}update(){this.data.isImperial="imperial"===this._state.settings.units.system;var t=this.data.isImperial?3.28084:1;if(this._state.viewbox&&this._state.viewbox.length){this.data.box=this._state.viewbox;var e=Math.min(this._state.client[0],this._state.client[1]),i=Math.min(this.data.box.length,this.data.box.width),r=e/i;if(r){var n=200/r;this.data.scaleStep=i<=2.5/t?.1/t:i<=5.4/t?.2/t:i<=12/t?.5/t:i<=25/t?1/t:i<=50/t?2/t:i<=100/t?5/t:i<=200/t?10/t:i<=550/t?20/t:50/t,this.data.scaleDisplay=this.data.scaleStep*t;var o=this.data.width,s=o*this.data.scaleStep/n,a=this.leftHanded?0:o,h=0,l=[];if(this.data.leftHanded)for(;h<o-s;){var u=s<o-h?s:o-h;l.push([h+a,u]),h+=s}else for(;h>-o+s;){var p=s;l.push([h+a,-p]),h-=s}this.data.steps=l,this.setData()}}}setData(t={}){for(var e in t)this.data[e]=t[e];this.rootEl.setAttribute("viewBox","-".concat(this.data.margin," -").concat(3*this.data.margin," ").concat(this.data.width+2*this.data.margin," ").concat(this.data.height+2*this.data.margin)),this.rootEl.innerHTML=this.template(this.data)}template(t={}){var e="";return t.steps[0]&&(e+='<rect\n class="fpe-scale-bar__background"\n style="fill:'.concat(this.backgroundClr(),'"\n y="').concat(2.5*-t.height,'"\n x="').concat(t.width+t.steps[0][1]-t.margin,'"\n width="').concat(-t.steps[0][1]+2*t.margin,'"\n height="').concat(4*t.height,'"\n />')),e+='<text x="'.concat(t.leftHanded?0:t.width,'" text-anchor="').concat(t.leftHanded?"start":"end",'" y="-0.3">\n ').concat(t.scaleDisplay," ").concat(t.isImperial?"ft":"m","\n </text>"),"lines"===t.style&&(e+='<path d="'.concat(this.stepStr(t.steps),'" />')),"solid"===t.style&&(e+="<g>",t.steps.forEach(((t,i)=>{e+='<rect\n class="'.concat(i%2!=0?"white":"",'"\n x="').concat(t[0],'"\n y="0"\n width="').concat(t[1],'"\n height="0.5"\n />')})),e+="</g>"),e}backgroundClr(){var t=this._state.settings&&function(t,e=1){var i;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return 3==(i=t.substring(1).split("")).length&&(i=[i[0],i[0],i[1],i[1],i[2],i[2]]),"rgba("+[(i="0x"+i.join(""))>>16&255,i>>8&255,255&i].join(",")+","+e+")"}(this._state.settings.theme.background.color);return t||(t="rgba(255, 255, 255, 0.8)"),t+"!important"}stepStr(t){if(!t)return"";var e="",i=this.data.height;return t.forEach(((t,r)=>{if(!(r>=1)||this.data.leftHanded){t=t.map((t=>Math.round(1e3*t)/1e3));var n=r%2==0?0:i,o=r%2==0?i:0;0===r&&(e+="M ".concat(t[0]," ").concat(i," L ").concat(t[0]," 0")),e+="L ".concat(t[0]+t[1]," ").concat(n," "),e+="L ".concat(t[0]+t[1]," ").concat(o," ")}})),e}mount(t){this.rootEl||(this.rootEl=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.rootEl.classList.add("fpe-scale-bar"),t.appendChild(this.rootEl))}destroy(){this._state.off("viewbox",this.update),this.rootEl.remove(),delete this._state._scaleBar,delete this._state,delete this.data}}function dy({type:t,state:e}){e._elementCreation&&e._elementCreation.destroy(),e.setActive(),e._elementCreation=new fy({type:t,state:e})}class fy{constructor({type:t,state:e}){this.type=t,this.state=e,this.currentEl=null,this.currentElWorld=null,this.lastEl=null,this.lastPos=null,this.snapWalls=null,this.wallChildStart=null,this.connectionStart=null,this.polygonPoints=[],this.polygonGfx=null,this.actionId=null,this.isSpaceDivider="a:helper:spaceDivider"===t,this.isCreatingWall="wall"===t||this.isSpaceDivider,this.isStructureEl="column"===t||this.isCreatingWall,this.isWallChild="door"===t||"window"===t,this.isPolygon="polybox"===t,e.isCreatingElement=t,e.on("click",this.createElement,this),e.on("key",this.keyHandler,this),e.on("mousemove",this.drawHandler,this),e.on("dblclick",this.finishPolygon,this)}getWallSnapPoints(){var t=[...this.state.scene.nodesByType.wall,...this.state.scene.nodesByType["a:helper:spaceDivider"]].filter((t=>{var e,i;return t.id!==(null===(e=this.currentEl)||void 0===e?void 0:e.id)&&t.id!==(null===(i=this.lastEl)||void 0===i?void 0:i.id)})).map((t=>{var e=Dt(t.getWorldPosition());return{node:t,points:[e.p1,e.p2,e.p3,e.p4].map((t=>[t.x,t.z]))}}));return t}createElement(){var t;if(this.type){if(this.currentEl){if(!this.isCreatingWall)return this.isStructureEl&&this.calculateSpaces(),void this.destroy();if(this.state.snapCursor.node){var e="wall"===this.state.snapCursor.node.type,i=this.state.snapCursor.isEdge||e&&this.isSpaceDivider,{connections:r}=De({walls:[this.currentEl,this.state.snapCursor.node],options:{updateState:!1,singleConnect:i,actionId:this.actionId}});return console.log("snap",r,this.currentEl.type,this.state.snapCursor.node.type),r&&Fe({state:this.state,wall1:this.currentEl,wall2:this.state.snapCursor.node,rel1:r[0],rel2:i?"edge":r[1],actionId:this.actionId}),this.calculateSpaces(),this.state.computed.relations.walls=ze(this.state),void this.destroy()}this.lastEl=this.currentEl,this.currentEl=null,this.connectionStart=null}if(this.actionId=j(),null===(t=this.elementLengthHelper)||void 0===t||t.destroy(),this.elementLengthHelper=null,this.isPolygon)this.addPointToPolygon(),this.elementLengthHelper=new iy({polygonPoints:this.polygonPoints,state:this.state});else{var n,o,s=this.state.snapCursor.pos;this.lastPos&&(s=this.lastPos);var a,h,l=0;if(this.isWallChild?h=this.state.snapCursor.node:(h=this.state.getActiveLevel(),l=this.state.snapCursor.node?this.state.snapCursor.node.ry+90:0),!h)return;if(a=Rt(a=h.getLocalPositionFromWorld({type:this.type,x:s[0],z:s[1],y:0,ry:l}),h),this.isWallChild&&(a.ry=0,a.z=0),(null!==(n=Ae[this.type])&&void 0!==n&&n.l||null!==(o=Ae[this.type])&&void 0!==o&&o.start)&&(a.l=.1),delete a.y,a=h.addChild(a,{updateState:!1,actionId:this.actionId}),this.currentEl=a,this.currentElWorld=this.currentEl&&this.currentEl.getWorldPosition(),a.l&&(this.elementLengthHelper=new iy({node:this.currentEl,state:this.state})),this.isCreatingWall&&this.state.snapCursor.node){var u="wall"===this.state.snapCursor.node.type,p=this.state.snapCursor.isEdge||u&&this.isSpaceDivider,{connections:c}=De({walls:[this.currentEl,this.state.snapCursor.node],options:{updateState:!1,singleConnect:p,actionId:this.actionId}});return console.log("snap",c,this.currentEl.type,this.state.snapCursor.node.type),void(c&&Fe({state:this.state,wall1:this.currentEl,wall2:this.state.snapCursor.node,rel1:c[0],rel2:p?"edge":c[1],actionId:this.actionId}))}this.snapWalls=this.getWallSnapPoints()}}}addPointToPolygon(){var{pos:t}=this.state.snapCursor;this.polygonPoints.push(t),this.drawPolygon()}drawPolygon(){this.polygonGfx||(this.polygonGfx=new Kf(this.state,"_measureLayer")),Ce({gfx:this.polygonGfx,points:this.polygonPoints,state:this.state})}finishPolygon(){(({gfx:t,points:e,state:i})=>{if(i.snapCursor&&i.snapCursor.destroy(),Ce({gfx:t,points:e,state:i,doneDrawing:!0}),e.length>2){var r=Lt(e.map((t=>t.map((t=>Number(t.toFixed(10)))))).slice(0,void 0)),n=i.getActiveLevel(),o=n.getLocalPositionFromWorld({x:r[0],z:r[1]}),s=Ht(e.map((([t,e])=>n.getLocalPositionFromWorld({x:t,z:e}))).map((({x:t,z:e})=>[t-o.x,e-o.z]))),a=Rt(o,n);n.addChild({type:"polybox",polygon:s,x:a.x,z:a.z,ry:a.ry})}})({gfx:this.polygonGfx,points:this.polygonPoints,state:this.state}),this.destroy()}calculateSpaces(){this.state.settings.computeConnectedSpaces&&this.state.getConnectedSpaces({forceUpdate:!0,actionId:this.actionId})}keyHandler(t){var e,{key:i}=t||{};if(this.state._refGfx&&this.state._refGfx.draw({shapes:[]}),"u"===i&&this.currentEl&&this.isCreatingWall){var r=this.currentEl.controlLine;"front"===r?this.currentEl.set({controlLine:"back"}):"back"===r?this.currentEl.set({controlLine:"center"}):"center"===r&&this.currentEl.set({controlLine:"front"})}else"o"===i&&this.currentEl&&this.isCreatingWall?this.currentEl.set({w:this.currentEl.w+=.05}):"i"===i&&this.currentEl&&this.isCreatingWall&&this.currentEl.w>.05?this.currentEl.set({w:this.currentEl.w-=.05}):"Escape"===i&&this.currentEl?(this.currentEl.remove(),console.log("cancel")):"Enter"===i&&this.isPolygon&&this.finishPolygon();this.isStructureEl&&this.calculateSpaces(),i&&"Enter"!==i&&"Escape"!==i||this.destroy(),null===(e=this.elementLengthHelper)||void 0===e||e.update()}drawHandler({pos:t}){var e,i,r;this.state.snapCursor||(this.state.snapCursor=new Qf(this.state)),this.snapWalls||(this.snapWalls=this.getWallSnapPoints());var n=!this.isWallChild&&!this.state.altKey,o=!this.isWallChild&&this.state.shiftKey,s=[...t],a=!1,h=Math.max(Math.min(this.state.viewbox.length/50,this.state.viewbox.width/50,.25),.05);if(this.lastPos&&o){var l=at(s),u=Math.abs(l.x-this.currentElWorld.x)>Math.abs(l.z-this.currentElWorld.z),p=tt(this.currentElWorld,it(this.currentElWorld,{x:u?1:0,z:u?0:1}),l,it(l,{x:u?0:1,z:u?1:0}));s=[p.x,p.z],a=!0}else if(this.lastPos&&n){var c=$(this.currentElWorld,at(s)),d=90*Math.round(c/90);if(Math.abs(c-d)<=5){var f=0===Math.abs(d)||180===Math.abs(d),v=90===Math.abs(d)||270===Math.abs(d);f?s=[s[0],this.currentElWorld.z]:v&&(s=[this.currentElWorld.x,s[1]]),a=f||v}}var y=this.snapWalls.length&&sa({point:s,walls:this.snapWalls,offset:[0,0],margin:h,node:this.currentEl,isWallChild:this.isWallChild});if(this.currentEl&&a&&null!==(e=y)&&void 0!==e&&e.refPoint){var g=$(this.currentElWorld,at(y.point));0!==Math.abs(g%90)&&(y=null)}if(s=y?y.point:s,this.state.snapCursor.set({pos:s}),this.state.snapCursor.isSnapping=y,this.state.snapCursor.node=y&&y.node,this.state.snapCursor.isEdge=!(!y||!y.isEdge),this.drawPolygon(),null!==(i=y)&&void 0!==i&&i.refPoint){this.state._refGfx||(this.state._refGfx=new Kf(this.state,"_measureLayer"));var m=.1;this.state._refGfx.draw({shapes:[{type:"line",start:s,end:y.refPoint,props:{stroke:16733440,strokeWidth:1,native:!0}},{type:"rect",position:[y.refPoint[0]-m/2,y.refPoint[1]-m/2],width:m,height:m,props:{stroke:16733440,strokeWidth:1,native:!0}}]})}else this.state._refGfx&&this.state._refGfx.draw({shapes:[]});if(this.isPolygon){var _;if(this.polygonPoints.length){var x=this.polygonPoints[this.polygonPoints.length-1];this.lastPos=s,this.currentElWorld={x:x[0],z:x[1]}}null===(_=this.elementLengthHelper)||void 0===_||_.update()}else{var b;if(this.currentEl)if(this.lastPos=s,b=this.isWallChild?this.currentEl.parent:this.state.getActiveLevel()){var P=b.getLocalPositionFromWorld({x:s[0],z:s[1],y:0,ry:0});if(P=Rt(P,b),this.isWallChild){this.wallChildStart||(this.wallChildStart={x:this.currentEl.x,z:this.currentEl.z});var w=Z(this.wallChildStart,P);if(b.l<this.currentEl.x+w&&(w=b.l-this.currentEl.x),P.x<this.wallChildStart.x){var E=Math.max(0,P.x);w=P.x<0?this.wallChildStart.x:w,this.currentEl.set({x:E,l:w,ry:0},{updateState:!1,actionId:this.actionId})}else this.currentEl.set({x:this.wallChildStart.x,l:w,ry:0},{actionId:this.actionId})}else{var T=Z(this.currentEl,P),C=$(this.currentEl,P);T>.01&&this.currentEl.set({l:T,ry:C},{updateState:!1,actionId:this.actionId})}if(this.currentEl&&this.lastEl){var I;if(null!==(I=this.connectionStart)&&void 0!==I&&I.curr){var{curr:S,prev:O}=this.connectionStart;this.currentEl.set({x:S.x,z:S.z,l:Z(S,P)},{actionId:this.actionId}),this.lastEl.set({l:O.l,ry:O.ry},{actionId:this.actionId})}else this.connectionStart={curr:this.currentEl.toJson(),prev:this.lastEl.toJson()};var A,{connections:M}=De({walls:[this.lastEl,this.currentEl],options:{updateState:!1,preservePos:!0,actionId:this.actionId}});if(M)Fe({state:this.state,wall1:this.lastEl,wall2:this.currentEl,rel1:M[0],rel2:M[1],actionId:this.actionId});else null!==(A=this.connectionStart)&&void 0!==A&&A.prev&&this.lastEl.set({l:this.connectionStart.prev.l,ry:this.connectionStart.prev.ry},{actionId:this.actionId})}null===(r=this.elementLengthHelper)||void 0===r||r.update()}else{var L;null===(L=this.elementLengthHelper)||void 0===L||L.update()}}}destroy(){var t;this.state._refGfx&&(this.state._refGfx.destroy(),delete this.state._refGfx),this.polygonGfx&&(this.polygonGfx.destroy(),this.polygonGfx=void 0,this.polygonPoints=null),this.elementLengthHelper&&(this.elementLengthHelper.destroy(),this.elementLengthHelper=null),null===(t=this.state.snapCursor)||void 0===t||t.destroy(),this.state.isCreatingElement=null,this.state.off("click",this.createElement),this.state.off("key",this.keyHandler),this.state.off("mousemove",this.drawHandler),this.state.off("dblclick",this.finishPolygon,this),this.state.updateState(),console.log("stop")}}class vy{constructor(t,e){t&&e&&(this.state=e.state,this.parentEl=t,this.data={menu:[{name:"Select",icon:'<div style="padding: 8px;">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="22"\n stroke-width="2"\n viewBox="0 0 40 40"\n fill="none"\n >\n <path\n d="M9.94383 1.00906L10.6519 35.7905L18.6133 26.7043L24.1042 39.0372L28.7291 36.9781L23.2381 24.6452L35.3177 24.8087L9.94383 1.00906Z"\n />\n </svg>\n</div>',action:()=>{this.state.isMeasuring=!1,this.state.setDrawingPolygon(),this.state.isCreatingElement=null,this.state.isDragging=!1},isActive:()=>!this.state.isMeasuring&&!this.state.isCreatingElement},{name:"Create",icon:'<svg\n version="1.1"\n id="Layer_1"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n x="0px"\n y="0px"\n viewBox="0 0 40 40"\n>\n <path\n stroke="none"\n d="M11,22.7 M8.2,31c-0.1,0.2,0,0.5,0.2,0.6c0.2,0.2,0.3,0.2,0.5,0.2c0.1,0,0.2,0,0.2,0l8.3-2.7c0,0,0,0,0.1-0.1l0,0l0,0\n l13.4-13.4c1.3-1.3,1.3-3.3,0-4.6l-1.7-1.8c-1.3-1.3-3.3-1.3-4.6,0l-1.2,1.2L11.1,22.6l0,0l0,0c0,0,0,0-0.1,0.1l0,0 M17.1,27.9l-5-5\n l11.7-11.7l5,5L17.1,27.9z M11.7,24l4.4,4.4l-6.6,2.2L11.7,24z M30.3,14.9l-0.8,0.7l-5-5l0.8-0.8c0.9-0.9,2.2-0.9,3.1,0l1.9,1.9\n C31.1,12.6,31.1,14,30.3,14.9z"\n />\n</svg>',hide:"dev",action:()=>{this.state.isMeasuring=!1,this.state.setDrawingPolygon(),this.state.active=[],this.state.isCreatingElement=!0},isHidden:()=>{var t,e;return!(null!==(t=this.state.settings)&&void 0!==t&&null!==(e=t.ui)&&void 0!==e&&e.createElements)},isActive:()=>this.state.isCreatingElement,subMenu:[...["wall","column","door","window","polybox"].map(this.createStructureMenu.bind(this)),{name:"SpaceDivider",action:()=>{this.state.changeOptions({updateFloors:!0}),dy({state:this.state,type:"a:helper:spaceDivider"})},isActive:()=>"a:helper:spaceDivider"===this.state.isCreatingElement}]},{name:"Measure",icon:'<div style="padding: 7px;">\n <svg xmlns="http://www.w3.org/2000/svg" stroke-width="2" viewBox="0 0 41 42" fill="none">\n <rect\n x="8.59521"\n y="40.3881"\n width="11.1555"\n height="43.57"\n rx="0.5"\n transform="rotate(-135 8.59521 40.3881)"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n <circle\n cx="32.3866"\n cy="8.55341"\n r="1.52591"\n transform="rotate(-45 32.3866 8.55341)"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n <line x1="5.52201" y1="27.7778" x2="6.95455" y2="29.2103" stroke-linejoin="round" />\n <line x1="9.34208" y1="23.9577" x2="10.7746" y2="25.3903" stroke-linejoin="round" />\n <line\n y1="-0.5"\n x2="2.02591"\n y2="-0.5"\n transform="matrix(0.707107 0.707106 -0.707107 0.707106 12.8087 20.4913)"\n stroke-linejoin="round"\n />\n <line x1="16.9823" y1="16.3176" x2="18.4148" y2="17.7501" stroke-linejoin="round" />\n <line x1="20.8024" y1="12.4975" x2="22.2349" y2="13.9301" stroke-linejoin="round" />\n <line x1="24.6225" y1="8.67733" x2="26.055" y2="10.1099" stroke-linejoin="round" />\n <line x1="3.61204" y1="29.6878" x2="5.99959" y2="32.0754" stroke-linejoin="round" />\n <line x1="7.43204" y1="25.8678" x2="9.8196" y2="28.2553" stroke-linejoin="round" />\n <line x1="11.2521" y1="22.0476" x2="13.6397" y2="24.4352" stroke-linejoin="round" />\n <line x1="15.0722" y1="18.2276" x2="17.4597" y2="20.6151" stroke-linejoin="round" />\n <line x1="18.8922" y1="14.4075" x2="21.2798" y2="16.7951" stroke-linejoin="round" />\n <line x1="22.7124" y1="10.5874" x2="25.0999" y2="12.9749" stroke-linejoin="round" />\n </svg>\n</div>',action:()=>{this.state.isMeasuring=!0,this.state.active=[],this.state.isCreatingElement=null,this.state.setDrawingPolygon("distance")},isHidden:()=>{var t,e;return!(null!==(t=this.state.settings)&&void 0!==t&&null!==(e=t.ui)&&void 0!==e&&e.measure)},isActive:()=>this.state.isMeasuring,subMenu:[{name:"Distance",action:()=>{this.state.setDrawingPolygon("distance")},isActive:()=>"distance"===this.state.isDrawingPolygon},{name:"Area",action:()=>{this.state.setDrawingPolygon("area")},isActive:()=>"area"===this.state.isDrawingPolygon}]},{name:"Plan extends",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" stroke="none">\n <path d="M8.5 19.8h15.8V19H8.5m7.1 10.3v-3.2h-.8v3.2m5.6-15v-4h-.8v4" />\n <path\n d="M27.5 30.1h3.4c.1 0 .3-.1.3-.1.1-.1.1-.2.2-.3.1-.2.1-.5.1-.6V10.9c0-.1 0-.2-.1-.4l-.2-.2H9.1c-.1 0-.3 0-.4.2-.1.1-.2.3-.2.4v18.2c0 .1 0 .3.1.4 0 .1 0 .2.1.3l.1.2c.1 0 .2.1.3.1h15.2v-.8H9.1v.3l.2-.2s-.1-.1-.2-.1v.3l.2-.2-.1.2.2-.1-.1.2.2-.1v-.2-18.5h-.4l.2.1.1-.1h-.3l.2.1-.1-.1v.2l.1-.1-.1-.1v.2H31v-.2l-.1.2h.1v-.2l-.1.2.1-.2-.2.1.1.1.1-.2-.2.1.2-.1h-.2l.2-.1h-.2v18.6l.2.1-.1-.1.2.1-.1-.1.2.2v-.3c-.1 0-.2.1-.2.1l.2.2v-.3h-3.4l-.3.8z"\n />\n <path\n d="M20.4 19.8v-3.2h-.8v3.2m7.9 0h4V19h-4m-11.9 4.7v-4h-.8v4m9.7 6.4c0-.8.3-1.5 1-2 .6-.5 1.5-.9 2.4-.9v-.9c-1.1 0-2.1.4-2.9 1.1-.8.7-1.3 1.6-1.3 2.7h.8z"\n />\n <path d="M28.3 29.3v-3h-.8v3M5.4 12.3v-6h-.8v6" />\n <path d="M10.6 6.3h-6v.8h6M4.6 28.5v5.9h.8v-5.9" />\n <path d="M10.6 33.6h-6v.8h6M35.4 12.3v-6h-.8v6" />\n <path d="M29.5 7.1h5.9v-.8h-5.9M34.6 28.5v5.9h.8v-5.9" />\n <path d="M29.5 34.4h5.9v-.8h-5.9" />\n</svg>',isHidden:()=>{var t,e;return!(null!==(t=this.state.settings)&&void 0!==t&&null!==(e=t.ui)&&void 0!==e&&e.zoomExtents)},action:()=>e.zoomExtents(1,500),isActive:()=>!1},{name:"Plan rotate",icon:'<div style="padding: 7px;">\n <svg xmlns="http://www.w3.org/2000/svg" stroke-width="2" viewBox="0 0 40 40" fill="none">\n <g clip-path="url(#clip0)">\n <rect\n x="6.84863"\n y="11.4904"\n width="26.2948"\n height="16.8466"\n rx="0.5"\n fill="white"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n <path\n d="M15.2849 33.9867C15.4706 34.191 15.4555 34.5072 15.2512 34.693L11.9213 37.7198C11.7169 37.9056 11.4007 37.8905 11.215 37.6861C11.0292 37.4818 11.0443 37.1656 11.2487 36.9798L14.2086 34.2893L11.518 31.3294C11.3323 31.1251 11.3474 30.8088 11.5517 30.6231C11.756 30.4373 12.0723 30.4524 12.258 30.6568L15.2849 33.9867ZM1.4148 25.869C1.62636 28.5169 2.47617 30.2941 3.61447 31.4939C4.75739 32.6986 6.23206 33.3641 7.76411 33.7113C9.29814 34.059 10.8659 34.082 12.1621 34.0189C12.8091 33.9874 13.3831 33.9348 13.8513 33.8917C14.2972 33.8505 14.6971 33.812 14.9387 33.8235L14.8911 34.8224C14.7389 34.8152 14.4335 34.8422 13.9431 34.8874C13.4749 34.9306 12.8816 34.985 12.2108 35.0177C10.8716 35.0829 9.20233 35.0627 7.54307 34.6866C5.88183 34.3101 4.20688 33.5713 2.88902 32.1822C1.56653 30.7883 0.644387 28.7824 0.41798 25.9486L1.4148 25.869Z"\n fill="#333333"\n />\n <path\n d="M24.875 6.00268C24.6892 5.79834 24.7043 5.48212 24.9086 5.29637L28.2384 2.26944C28.4428 2.08369 28.759 2.09876 28.9447 2.30309C29.1305 2.50742 29.1154 2.82365 28.9111 3.00939L25.9512 5.7L28.6418 8.65984C28.8276 8.86417 28.8125 9.1804 28.6082 9.36614C28.4039 9.55189 28.0876 9.53682 27.9019 9.33249L24.875 6.00268ZM38.7452 14.12C38.5336 11.4721 37.6837 9.69484 36.5454 8.49507C35.4025 7.29043 33.9278 6.625 32.3957 6.2778C30.8617 5.93016 29.2939 5.90721 27.9977 5.97036C27.3507 6.00187 26.7767 6.05447 26.3085 6.09765C25.8626 6.13876 25.4627 6.17729 25.2211 6.16578L25.2687 5.16692C25.4209 5.17416 25.7263 5.14709 26.2167 5.10187C26.6848 5.0587 27.2782 5.00422 27.949 4.97154C29.2882 4.90631 30.9575 4.92651 32.6167 5.30253C34.278 5.679 35.9529 6.41775 37.2708 7.80678C38.5934 9.20067 39.5156 11.2066 39.742 14.0403L38.7452 14.12Z"\n fill="#333333"\n />\n </g>\n <defs>\n <clipPath id="clip0">\n <path d="M0 0H40V40H0V0Z" fill="white" />\n </clipPath>\n </defs>\n </svg>\n</div>',isHidden:()=>{var t,e;return!(null!==(t=this.state.settings)&&void 0!==t&&null!==(e=t.ui)&&void 0!==e&&e.rotatePlan)},action:()=>this.state.rotatePlan({rotDelta:45}),isActive:()=>!1}],showCreateMenu:!1},this.mount(this.parentEl),this.update())}update(){this.rootEl&&this.template()}createStructureMenu(t){return{name:t.charAt(0).toUpperCase()+t.slice(1),action:()=>{dy({state:this.state,type:t})},isActive:()=>this.state.isCreatingElement===t}}activeMenu(){return this.data.menu.filter((t=>!t.isHidden||!t.isHidden()))}template(){var t="",e=this.activeMenu()||[];for(var i of e){if(t+='<div class="fpe-menu-bar__btn fpe-menu-bar__icon--'.concat(i.name.toLowerCase().replace(" ","-"),'">\n <div class="fpe-menu-bar__icon ').concat(i.isActive()?"fpe-menu-bar__icon--active":"",'">\n ').concat(i.icon,"\n </div>"),i.isActive()&&i.subMenu&&i.subMenu.length){for(var r of(t+='<div class="fpe-menu-bar__sub-menu">',i.subMenu))t+='<div\n class="fpe-menu-bar__sub-option '.concat(r.isActive()?"fpe-menu-bar__sub-option--active":"",'">\n ').concat(r.name,"\n </div>");t+="</div>"}t+="</div>"}this.rootEl.innerHTML=t,this.parentEl.querySelectorAll(".fpe-menu-bar__btn").forEach(((t,i)=>{t.addEventListener("click",(()=>{e[i].action(),this.update()})),t.querySelectorAll(".fpe-menu-bar__sub-option").forEach(((t,r)=>{t.addEventListener("click",(t=>{t.stopPropagation(),e[i].subMenu[r].action(),this.update()}))}))}))}mount(t){this.rootEl||(this.rootEl=document.createElement("div"),this.rootEl.classList.add("fpe-menu-bar"),t.appendChild(this.rootEl))}destroy(){this.rootEl.remove(),delete this.state._menuBar,delete this.state,delete this.data}}function yy(...t){var i={};for(var r of t)if(r instanceof Array)i instanceof Array||(i=[]),i=[...i,...r];else if(r instanceof Object)for(var n of Object.entries(r)){var o=n[0],s=n[1];s instanceof Object&&o in i&&(s=yy(i[o],s)),i=e(e({},i),{},{[o]:s})}return i}class gy{constructor(t,e){this.state=e,this.maxListLength=5,this.notifications=[],this.state.setMessage=this.setMessage.bind(this),this.mount(t)}setMessage(t,e={}){if("string"==typeof t&&!this.notifications.map((t=>t.msg)).includes(t)){var i=j(),r=1e3,n=Math.max(e.duration||3e3,1500)-r,o=e.type||"info",s={msg:t,id:i,type:o};return s.delete=()=>{var t=this.notifications.findIndex((t=>t.id===i));t<0||(s.$el.remove(),this.notifications.splice(t,1))},this.notifications.length>this.maxListLength&&this.notifications[0].delete(),s.$el=this.addMessage(this.rootEl,s),this.notifications.push(s),setTimeout((()=>{s.$el.classList.add("fpe-notifications__note--fadeout"),setTimeout((()=>{s.delete()}),r)}),n),s}}addMessage(t,e={}){var i=document.createElement("div");return i.id=e.id,i.classList.add("fpe-notifications__note","fpe-notifications__note--".concat(e.type)),i.innerHTML=e.msg,t.appendChild(i),i}mount(t){this.rootEl||(this.rootEl=document.createElement("div"),this.rootEl.classList.add("fpe-notifications"),t.appendChild(this.rootEl))}destroy(){this.rootEl.remove(),this.notifications=null,delete this._state,delete this.data}}var my=t=>{var e={polyfloor:{changeUsage:{name:"Change space type",prop:"usage",type:"list",getOptions:()=>{var e={},i=function(t){"commercial"===t&&(t=ue.office);var e={};return Object.keys(ye).forEach((i=>{ye[i].category.includes(t)&&(e[i]=ye[i],"string"==typeof e[i].isHidden&&(e[i].isHidden=e[i].isHidden===t))})),e}(t.scene.type||"residential");return Object.entries(i).forEach((([t,i])=>{i.isHidden||(e[t]=i.name)})),e},updateEl:!0,emit:"polyfloor-usage-changed"},changeMaterial:{name:"Change floor material",type:"method",hide:"dev",keepSelected:!0,method:()=>{}},editPolygon:{name:"Edit floor geometry",type:"method",hide:"dev",keepSelected:!0,method:()=>{}}},group:{viewGroup:{name:"View group",type:"method",keepSelected:!0,method:e=>{t.activeGroup=e.id,t.changeOptions({xrayMode:!0})}},explodeGroup:{name:"Ungroup",type:"method",method:t=>Xt(t)},flatten:{name:"Flatten",type:"method",hide:"dev",method:t=>zt(t)},delete:{name:"Delete",type:"method",method:()=>Py(t)}},door:{doorType:_y(t,"door","doorType"),flipDoor:{name:"Flip Door",type:"method",keepSelected:!0,method:t=>{"front"===t.side?"right"===t.hinge?t.set({hinge:"left"}):(t.set({side:"back"}),t.set({hinge:"right"})):"back"===t.side&&("right"===t.hinge?t.set({hinge:"left"}):(t.set({side:"front"}),t.set({hinge:"right"})))}}},wall:{lConnect:{name:"L connect",type:"method",keepSelected:!0,method:e=>by({state:t,node:e})},tConnect:{name:"T connect",type:"method",keepSelected:!0,method:e=>by({state:t,node:e,onEdge:!0})},snapAllWalls:{name:"Snapp all walls",type:"method",keepSelected:!0,method:()=>{var e=function(t,e={updateState:!1}){for(var i,r,n=[],o=0;o<t.length;o++)n.push({wall:t[o],data:Dt(t[o])});for(var s=.2,a=!1,h=[],l=0;l<n.length;l++)if(s=n[l].wall.w<=.5?n[l].wall.w:.2,!(n[l].wall.l/n[l].wall.w<1.2||n[l].wall.w>=.55)){i=n[l].data.p1,r=n[l].data.p2;for(var u=l+1;u<n.length;u++)if(!(n[u].wall.w>=.55)&&l!==u){if((Z(i,n[u].data.p1)<=s||Z(i,n[u].data.p2)<=s||Z(r,n[u].data.p1)<=s||Z(r,n[u].data.p2)<=s)&&(a=!0),a){var{walls:p,connections:c}=De({walls:[n[l].wall,n[u].wall],data:[n[l].data,n[u].data],options:e});n[l].wall=p?p[0]:n[l].wall,n[u].wall=p?p[1]:n[u].wall,n[l].data=Dt(n[l].wall),n[u].data=Dt(n[u].wall),h.push({walls:p,connections:c})}a=!1}}return h}(t.scene.nodesByType.wall);t.updateState("wall"),e.filter((t=>t.connections)).forEach((({walls:e,connections:i})=>{Fe({state:t,wall1:e[0],wall2:e[1],rel1:i[0],rel2:i[1]})}))}}},"a:helper:spaceDivider":{lConnect:{name:"L connect",type:"method",keepSelected:!0,method:e=>by({state:t,node:e,onEdge:!1})},tConnect:{name:"T connect",type:"method",keepSelected:!0,method:e=>by({state:t,node:e,onEdge:!0})}},window:{windowTiling:{name:"Show window",type:"method",keepSelected:!0,method:()=>{}}},interior:{delete:{name:"Delete",type:"method",method:()=>Py(t)}},stairs:{stairType:_y(t,"stairs","stairType")},column:{shape:_y(t,"column","shape")},kitchen:{cooktopType:_y(t,"kitchen","cooktopType"),sinkType:_y(t,"kitchen","sinkType"),extractorType:_y(t,"kitchen","extractorType")},multiSelect:{group:{name:"Create new group",type:"method",method:()=>function(t){if(!(t.length<=1)){var e=[...t],i=e[0].parent;if("level"===i.type){var r=i.addChild({type:"group",x:e[0].x,z:e[0].z,ry:e[0].ry});return e.forEach((t=>{var e=t.parent;"level"===e.type?"group"===t.type?(zt(t),Xt(t).forEach((t=>{Ut(t,r)}))):Ut(t,r):console.log("parent is:",e.type)})),r}}}(t.active)},delete:{name:"Delete selected",type:"method",method:()=>Py(t)}},customComponent:null};t.actions=e};function _y(t,e,i){var r;if(null!==(r=t.scene)&&void 0!==r&&r.schema){var n=t.scene.schema[e];if(!n)return{};var o=n.properties[i],s={};return Object.values(o.enum).forEach((t=>{s[t]=xy(t)})),{name:xy(i),prop:i,type:"list",options:s,updateEl:!0}}}function xy(t){return t.replace(/([A-Z])/g,(t=>" ".concat(t))).replace(/^./,(t=>t.toUpperCase())).trim()}function by({state:t,node:e,onEdge:i=!1}){function r({node:n}){if(n){if("window"!==n.type&&"door"!==n.type||(n=n.parent),"wall"!==n.type&&"a:helper:spaceDivider"!==n.type)return t.setMessage("select a wall"),void t.setActive({nodeId:e.id});if(n.id!==e.id)if(i){var{connections:o}=De({walls:[e,n],options:{updateState:!0,singleConnect:!0}});if(t.off("select",r),!o)return;Fe({state:t,wall1:e,wall2:n,rel1:o[0],rel2:"edge"})}else{var{connections:s}=De({walls:[e,n]});if(t.off("select",r),!s)return;Fe({state:t,wall1:e,wall2:n,rel1:s[0],rel2:s[1]})}}}t.on("select",r),t.on("key",(function e({key:i}){"Escape"===i&&(t.off("select",r),t.off("key",e))}))}function Py(t){t.active.forEach((t=>{var e=t.parent;(Ae[t.type].x||Ae[t.type].start)&&e&&e.removeChild(t)}))}return class{constructor(t,e={},i){var r;if(this.options=no(e),this.options.editorId||(this.options.editorId="fpe-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,3)),this.resources={spaces:[],assets:[]},this.scene=i,this.version=o.api.sdkVersion,this.utils={polygonOffset:pt,polygonIntersection:dt,pointInPolygon:ft,polygonUnion:ut},"string"==typeof t?r=document.getElementById(t):t instanceof Element&&(r=t),!r)throw new Error("node not found");this.mountFloorPlan(r)}initState(){this.state=new Ss({options:this.options}),this.scene||(this.scene=new be),this.scene.on("scene-structure-loaded",this.state.initScene,this.state)}resetState(){var t,e,i;if(this.state.isSceneStructureLoaded=!1,this.scene.node){var r=JSON.parse(JSON.stringify(Ts));this.state.computed=r.computed,this.state.products=r.products,this.state.productContours=r.productContours,this.state.productBoundingBoxes=r.productBoundingBoxes,this.state._productQueue=r._productQueue,this.state._textureQueue=r._textureQueue,this.state._gfxNodes=r._gfxNodes,delete this.state._promiseCache,this.state.resources=r.resources,this.resources=this.state.resources}var n=null===(t=(e=this.state)._getViewport)||void 0===t?void 0:t.call(e),o=n&&(null===(i=n._getHandler)||void 0===i?void 0:i.call(n));o&&o.destroy()}prevent(t){t.preventDefault()}handleDrop(t){var e;t.preventDefault(),t.stopPropagation();var i=[t.offsetX,t.offsetY],r=this.getPlanPosition(i);this.state.cursor=[...r];var{spaces:n}=this.getResourcesFromPosition(r),o=(null===(e=n[0])||void 0===e?void 0:e.node.y)||0;this.emit("drop",{pos:r,sourceEvent:t,verticalPos:o})}loadScene(t,e){if(!t||"string"!=typeof t)throw new Error('Expected non-empty string sceneId parameter instead got: "'.concat(t,'"'));return new Promise(((i,r)=>{this.once("scene-loaded",i),c.scene.read(t,e).then((t=>this.scene.loadSceneStructure(t.structure,{planRotation:this.state.settings.planRotation}))).catch((t=>{var e="string"==typeof t?t:t&&t.message;console.error(e),function(t,e){e=e||"Floor plan engine couldn't load properly on this page. For technical details check the browser console.",document.getElementById(t).innerHTML='<div class="fpe-err">\n <div class="fpe-err__box">\n <div class="fpe-err__title">Something went wrong</div>\n <div class="fpe-err__msg">\n '.concat(e,"\n </div>\n </div>\n</div>")}(this.state.settings.editorId,e),r(e)}))}))}set(t){this.changeOptions(t)}changeOptions(t={}){t.theme&&delete this.options.theme,t.hideElements&&delete this.options.hideElements,t.selectAllowList&&delete this.options.selectAllowList,this.options=yy(this.options,t),this.state.updateSettings(this.options),(t.ui||t.units)&&this.generateUi()}mountFloorPlan(t){var i=t.querySelector(".fpe");i&&i.remove();var r=document.createElement("div");r.id=this.options.editorId,r.classList.add("fpe"),t.appendChild(r);var n,s=document.createElement("canvas");s.classList.add("fpe__plan"),r.appendChild(s),this.fpeNode=r,this.initState(),this.resources=this.state.resources,(n=this.state.settings.api)&&"object"==typeof n&&(o.api=e(e({},o.api),n));var{viewport:a,renderer:h}=zv(this.state);this.scene.on("scene-structure-loading",this.resetState,this),this.scene.on("set",hv,this.state),this.scene.on("set-transform",sv,this.state),this.scene.on("set-transient",hv,this.state),this.scene.on("set-materials",hv,this.state),this.scene.on("add-child",ov,this.state),this.scene.on("remove-child",ov,this.state),this.scene.on("add-child",this.state.updateState,this.state),this.scene.on("set",this.state.updateState,this.state),this.scene.on("set-transform",this.state.updateState,this.state),this.scene.on("set-materials",this.state.updateState,this.state),this.scene.on("remove-child",this.state.updateState,this.state),this.state.on("draw-xray",lv,this.state),this.state.on("product-load-stage",av,this.state),this.on("change-options",((t={})=>this.changeOptions(t))),this.on("create-element",dy),s.addEventListener("drop",this.handleDrop.bind(this)),s.addEventListener("gesturestart",this.prevent),s.addEventListener("gesturechange",this.prevent),s.addEventListener("gestureend",this.prevent),s.addEventListener("dragover",this.prevent),this.state.settings.destroyOnDomRemove&&function(t,e,i){var r=new MutationObserver((()=>{(function t(i){return i.parentNode!==e&&(null===i.parentNode||t(i.parentNode))})(t)&&(r.disconnect(),i())}));r.observe(e,{childList:!0,subtree:!0})}(r,t,(()=>this.destroy()));var l=function(t,e){var i,r=t.children.find((t=>t._gridLayer));function n(t,e,r=!1){var n;if(t&&(n=e.zoom>2?.1:e.zoom>.25?1:(e.zoom,10),(r||n!==i)&&(Gf(t),e.settings.theme.background.showGrid))){var o=new Zd;o.lineStyle({width:1,color:14540253,native:!0});for(var s=-100;s<100;s+=n)Math.round(100*s)/100==0?o.lineStyle({width:2,color:14342874,native:!0}):Math.round(100*s)/100%10==0||Math.round(100*s)/100%1==0?o.lineStyle({width:1,color:14342874,native:!0}):o.lineStyle({width:1,color:14540253,native:!0}),o.moveTo(-100*e.scale,s*e.scale),o.lineTo(100*e.scale,s*e.scale),o.moveTo(s*e.scale,-100*e.scale),o.lineTo(s*e.scale,100*e.scale);t.addChild(o),i=n}}return n(r,e),{update:t=>n(r,e,t)}}(a,this.state),u=function(t,e){var i=t.children.find((t=>t._markerLayer));function r(t,e,i=!1){if(t){var r=.01/e.zoom;i&&Gf(t);var n=e.markerPins.map((t=>t.id)),o=t.children.filter((t=>t._markerId&&n.includes(t._markerId))).map((t=>t._markerId)),s=e.markerPins.filter((t=>!o.includes(t.id))),a=e.markerPins.filter((t=>o.includes(t.id)));t.children.filter((t=>t._markerId&&!n.includes(t._markerId))).forEach((t=>{t.destroy()})),a.forEach((e=>{var i=e.size/40,n=t.children.find((t=>t._markerId===e.id));n.scale.x=r*i,n.scale.y=r*i})),s.forEach((i=>{var n=i.size/40,o=new Zd;o.scale.x=r*n,o.scale.y=r*n,o._markerId=i.id,o.x=i.pos[0]*e.scale,o.y=i.pos[1]*e.scale,o.interactive=!0,o._nodeId="marker_"+i.id,o.parentLayer=e._gfxLayers.marker,[{type:"path",isContour:!0,segments:[["M",-11.4,-22.8],["A",12.4,12.4,0,1,1,11.4,-22.8],["L",0,0],["Z"]],props:{fill:Dl(i.color),stroke:6710886,strokeWidth:50/n}},{type:"circle",isContour:!0,position:[0,-28],r:5,props:{fill:1,fillOpacity:.2}}].forEach((t=>{Jf({shape:t,state:e,gfx:o,props:t.props})})),t.addChild(o)})),e.viewportNeedsUpdate=!0,e.viewportPaused&&e.startAnimationLoop()}}return r(i,e),{update:t=>r(i,e,t)}}(a,this.state);if(this.state.getPlanPosition=(t=[])=>{var e=a.toWorld(...t);return[e.x/this.state.scale,e.y/this.state.scale]},this.state.getScreenPosition=(t=[])=>{t=t.map((t=>t*this.state.scale));var e=a.toScreen(...t);return[e.x,e.y]},this.state.setDrawingPolygon=t=>{this.state.isDrawingPolygon=t,this.state._polygonHelper?t?t&&this.state._polygonHelper.draw():this.state._polygonHelper.destroy():t&&(this.state._polygonHelper=new $f(this.state))},this.state.setDrawingRectangle=t=>{t&&"object"==typeof t&&(this.state.editingRectangle=t),this.state._rectangleHelper?t?t&&this.state._rectangleHelper.draw():this.state._rectangleHelper.destroy():t&&(this.state._rectangleHelper=new tv(this.state))},this.state.addPlanGraphic=()=>new Kf(this.state),sy({viewport:a,state:this.state,grid:l,markers:u}),this.on("state-loaded",(()=>{Xv({scene:this.scene,viewport:a,renderer:h,state:this.state});var t=function(t,e){var i=new du;return i.visible=!1,i._update=Gv,i._setScale=t=>{var e=Math.min(1/t.zoom);i.children.forEach((t=>{t._isHandler&&(t.scale.x=t.scale.y=e)}))},i.parentLayer=e._gfxLayers.helper,t.addChild(i),i}(a,this.state);a._getHandler=()=>t,this.state._redrawScene=()=>Xv({scene:this.scene,viewport:a,renderer:h,state:this.state,update:!0})})),this.on("scene-loaded",(()=>{this.state.settings&&this.state.settings.exposeInstance&&(window.fpe=this)})),this.on("scene-rendered",(({update:t})=>{t||this.zoomExtents(1,0)})),this.sceneStructure)try{var p=JSON.parse(this.sceneStructure);this.scene.loadSceneStructure(p)}catch(t){console.log(t)}this.generateUi(),my(this.state)}generateUi(){this.state.settings.ui.coordinates?this.state._cursorCoordinates?this.state._cursorCoordinates.update():this.state._cursorCoordinates=new Rs(this.fpeNode,this.state):this.state._cursorCoordinates&&this.state._cursorCoordinates.destroy(),this.state.settings.ui.scale?this.state._scaleBar?this.state._scaleBar.update():this.state._scaleBar=new cy(this.fpeNode,this.state):this.state._scaleBar&&this.state._scaleBar.destroy(),this.state.settings.ui.menu?this.state._menuBar?this.state._menuBar.update():this.state._menuBar=new vy(this.fpeNode,this):this.state._menuBar&&this.state._menuBar.destroy(),this.state._notifications||(this.state._notifications=new gy(this.fpeNode,this.state))}zoomExtents(t,e){return function({margin:t=1,animate:e=!1,viewport:i,state:r}){i=i||r&&r._getViewport(),r=r||i&&i._getState();var n=i.children.find((t=>t._sceneLayer));if(!n)return new Promise.resolve(!1);var{x:o,y:s,width:a,height:h}=n.getLocalBounds();return Kv({bb:{x:o-=t*r.scale,z:s-=t*r.scale,x2:o+(a+=t*r.scale*2),z2:s+(h+=t*r.scale*2),length:a,width:h},animate:e,viewport:i,isScaled:!0,state:r})}({margin:t,animate:e,state:this.state})}zoomToElement(t,e,i){return Kv({bb:this.state.getElementBoundingBox(t,e),animate:i,state:this.state})}setZoom(t,e){return Kv({bb:t,animate:e,state:this.state})}zoomByFactor(t,e=!0){if(!Number.isFinite(t)||t<=0)return Promise.reject("factor is not a positive number");var{x:i,z:r,length:n,width:o}=this.state.viewbox,s=n/t,a=o/t;return i-=(s-n)/2,r-=(a-o)/2,this.setZoom({x:i,z:r,length:s,width:a},e)}addInfoWindow(t={}){return new Fs(e(e({},t),{},{floorPlan:this}))}addHtmlMarker(t={}){return new Bs(e(e({},t),{},{floorPlan:this}))}addMarker({pos:t=[0,0],color:e="#669cff",size:i=40}={}){return new jv({pos:t,color:e,size:i,state:this.state})}exportImage(t){return this.state.exportImage(t)}getPlanPosition(t){return this.state.getPlanPosition(t)}getScreenPosition(t){return this.state.getScreenPosition(t)}getResourcesFromPosition(t){return this.state.getResourcesFromPosition(t)}on(t,e,i){return this.state.on(t,e,i)}once(t,e,i){return this.state.once(t,e,i)}off(t,e,i){return this.state.off(t,e,i)}emit(t,e,i,r,n){return this.state.emit(t,e,i,r,n)}addPlanGraphic(){return this.state.addPlanGraphic()}setDrawingPolygon(t){return this.state.setDrawingPolygon(t)}setDrawingRectangle(t){return this.state.setDrawingRectangle(t)}setMessage(t,e){return this.state.setMessage(t,e)}destroy(){if(this.state){var t=this.state._getViewport();t&&t.destroy({children:!0,texture:!0,baseTexture:!0});var e=this.state._loader;e&&e.destroy(!0),this.state.destroy()}delete this.state,delete this.scene,delete this.resources,delete this.options,delete this.utils,this.fpeNode&&this.fpeNode.remove(),delete this.fpeNode}}}));
|