@mlightcad/data-model 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +224 -224
- package/dist/data-model.cjs +7 -6
- package/dist/dxf-parser-worker.js +1 -1
- package/lib/converter/AcDbDxfConverter.d.ts.map +1 -1
- package/lib/converter/AcDbDxfConverter.js +5 -0
- package/lib/converter/AcDbDxfConverter.js.map +1 -1
- package/lib/database/AcDbAbstractViewTableRecord.d.ts +7 -0
- package/lib/database/AcDbAbstractViewTableRecord.d.ts.map +1 -1
- package/lib/database/AcDbAbstractViewTableRecord.js +17 -1
- package/lib/database/AcDbAbstractViewTableRecord.js.map +1 -1
- package/lib/database/AcDbDatabase.d.ts +29 -0
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +45 -11
- package/lib/database/AcDbDatabase.js.map +1 -1
- package/lib/database/AcDbViewportTable.d.ts +12 -1
- package/lib/database/AcDbViewportTable.d.ts.map +1 -1
- package/lib/database/AcDbViewportTable.js +19 -1
- package/lib/database/AcDbViewportTable.js.map +1 -1
- package/lib/database/AcDbViewportTableRecord.d.ts +9 -1
- package/lib/database/AcDbViewportTableRecord.d.ts.map +1 -1
- package/lib/database/AcDbViewportTableRecord.js +17 -1
- package/lib/database/AcDbViewportTableRecord.js.map +1 -1
- package/lib/entity/AcDbEntity.d.ts +2 -0
- package/lib/entity/AcDbEntity.d.ts.map +1 -1
- package/lib/entity/AcDbEntity.js +5 -0
- package/lib/entity/AcDbEntity.js.map +1 -1
- package/lib/entity/AcDbHatch.d.ts +8 -0
- package/lib/entity/AcDbHatch.d.ts.map +1 -1
- package/lib/entity/AcDbHatch.js +15 -1
- package/lib/entity/AcDbHatch.js.map +1 -1
- package/lib/entity/AcDbMText.d.ts.map +1 -1
- package/lib/entity/AcDbMText.js +8 -2
- package/lib/entity/AcDbMText.js.map +1 -1
- package/lib/entity/AcDbTable.d.ts.map +1 -1
- package/lib/entity/AcDbTable.js +75 -21
- package/lib/entity/AcDbTable.js.map +1 -1
- package/lib/entity/AcDbText.d.ts +8 -0
- package/lib/entity/AcDbText.d.ts.map +1 -1
- package/lib/entity/AcDbText.js +31 -27
- package/lib/entity/AcDbText.js.map +1 -1
- package/lib/entity/AcDbTextExtentsHelpers.d.ts +37 -0
- package/lib/entity/AcDbTextExtentsHelpers.d.ts.map +1 -0
- package/lib/entity/AcDbTextExtentsHelpers.js +189 -0
- package/lib/entity/AcDbTextExtentsHelpers.js.map +1 -0
- package/lib/entity/AcDbViewport.d.ts.map +1 -1
- package/lib/entity/AcDbViewport.js +6 -2
- package/lib/entity/AcDbViewport.js.map +1 -1
- package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts +2 -2
- package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDb3PointAngularDimension.js +7 -3
- package/lib/entity/dimension/AcDb3PointAngularDimension.js.map +1 -1
- package/lib/entity/dimension/AcDbAlignedDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbAlignedDimension.js +5 -1
- package/lib/entity/dimension/AcDbAlignedDimension.js.map +1 -1
- package/lib/entity/dimension/AcDbArcDimension.d.ts +2 -2
- package/lib/entity/dimension/AcDbArcDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbArcDimension.js +7 -3
- package/lib/entity/dimension/AcDbArcDimension.js.map +1 -1
- package/lib/entity/dimension/AcDbDiametricDimension.d.ts +2 -2
- package/lib/entity/dimension/AcDbDiametricDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbDiametricDimension.js +10 -3
- package/lib/entity/dimension/AcDbDiametricDimension.js.map +1 -1
- package/lib/entity/dimension/AcDbDimension.d.ts +9 -0
- package/lib/entity/dimension/AcDbDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbDimension.js +36 -0
- package/lib/entity/dimension/AcDbDimension.js.map +1 -1
- package/lib/entity/dimension/AcDbOrdinateDimension.d.ts +2 -2
- package/lib/entity/dimension/AcDbOrdinateDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbOrdinateDimension.js +5 -3
- package/lib/entity/dimension/AcDbOrdinateDimension.js.map +1 -1
- package/lib/entity/dimension/AcDbRadialDimension.d.ts +2 -2
- package/lib/entity/dimension/AcDbRadialDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbRadialDimension.js +10 -3
- package/lib/entity/dimension/AcDbRadialDimension.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/misc/AcDbConstants.d.ts +7 -0
- package/lib/misc/AcDbConstants.d.ts.map +1 -1
- package/lib/misc/AcDbConstants.js +7 -0
- package/lib/misc/AcDbConstants.js.map +1 -1
- package/lib/misc/index.d.ts +1 -1
- package/lib/misc/index.d.ts.map +1 -1
- package/lib/misc/index.js +1 -1
- package/lib/misc/index.js.map +1 -1
- package/package.json +5 -5
package/dist/data-model.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Cs=(n=>(n[n.Invalid=-9999]="Invalid",n[n.Start=0]="Start",n[n.Text=1]="Text",n[n.AttributeTag=2]="AttributeTag",n[n.BlockName=2]="BlockName",n[n.ShapeName=2]="ShapeName",n[n.SymbolTableName=2]="SymbolTableName",n[n.SymbolTableRecordName=2]="SymbolTableRecordName",n[n.MlineStyleName=2]="MlineStyleName",n[n.AttributePrompt=3]="AttributePrompt",n[n.Description=3]="Description",n[n.DimPostString=3]="DimPostString",n[n.DimStyleName=3]="DimStyleName",n[n.LinetypeProse=3]="LinetypeProse",n[n.TextFontFile=3]="TextFontFile",n[n.CLShapeName=4]="CLShapeName",n[n.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",n[n.SymbolTableRecordComments=4]="SymbolTableRecordComments",n[n.TextBigFontFile=4]="TextBigFontFile",n[n.Handle=5]="Handle",n[n.DimensionBlock=5]="DimensionBlock",n[n.LinetypeName=6]="LinetypeName",n[n.DimBlk1=6]="DimBlk1",n[n.TextStyleName=7]="TextStyleName",n[n.DimBlk2=7]="DimBlk2",n[n.LayerName=8]="LayerName",n[n.CLShapeText=9]="CLShapeText",n[n.XCoordinate=10]="XCoordinate",n[n.YCoordinate=20]="YCoordinate",n[n.ZCoordinate=30]="ZCoordinate",n[n.Real=40]="Real",n[n.TxtSize=40]="TxtSize",n[n.ViewportHeight=40]="ViewportHeight",n[n.Angle=50]="Angle",n[n.ViewportSnapAngle=50]="ViewportSnapAngle",n[n.Visibility=60]="Visibility",n[n.Int16=70]="Int16",n[n.Int32=90]="Int32",n[n.Int64=160]="Int64",n[n.Int8=280]="Int8",n[n.Thickness=39]="Thickness",n[n.Elevation=38]="Elevation",n[n.LinetypeScale=48]="LinetypeScale",n[n.DashLength=49]="DashLength",n[n.MlineOffset=49]="MlineOffset",n[n.LinetypeElement=49]="LinetypeElement",n[n.NormalX=210]="NormalX",n[n.NormalY=220]="NormalY",n[n.NormalZ=230]="NormalZ",n[n.UcsOrg=110]="UcsOrg",n[n.UcsOrientationX=111]="UcsOrientationX",n[n.UcsOrientationY=112]="UcsOrientationY",n[n.ViewHeight=45]="ViewHeight",n[n.ViewWidth=41]="ViewWidth",n[n.ViewLensLength=42]="ViewLensLength",n[n.ViewFrontClip=43]="ViewFrontClip",n[n.ViewBackClip=44]="ViewBackClip",n[n.ViewBrightness=141]="ViewBrightness",n[n.ViewContrast=142]="ViewContrast",n[n.ViewMode=71]="ViewMode",n[n.ViewportActive=68]="ViewportActive",n[n.ViewportAspect=41]="ViewportAspect",n[n.ViewportGrid=76]="ViewportGrid",n[n.ViewportIcon=74]="ViewportIcon",n[n.ViewportNumber=69]="ViewportNumber",n[n.ViewportSnap=75]="ViewportSnap",n[n.ViewportSnapPair=78]="ViewportSnapPair",n[n.ViewportSnapStyle=77]="ViewportSnapStyle",n[n.ViewportTwist=51]="ViewportTwist",n[n.ViewportVisibility=67]="ViewportVisibility",n[n.ViewportZoom=73]="ViewportZoom",n[n.Color=62]="Color",n[n.ColorRgb=420]="ColorRgb",n[n.ColorName=430]="ColorName",n[n.LineWeight=370]="LineWeight",n[n.PlotStyleNameType=380]="PlotStyleNameType",n[n.PlotStyleNameId=390]="PlotStyleNameId",n[n.GradientObjType=450]="GradientObjType",n[n.GradientAngle=460]="GradientAngle",n[n.GradientName=470]="GradientName",n[n.GradientColCount=453]="GradientColCount",n[n.GradientPatType=451]="GradientPatType",n[n.GradientTintType=452]="GradientTintType",n[n.GradientShift=461]="GradientShift",n[n.GradientColVal=463]="GradientColVal",n[n.GradientTintVal=462]="GradientTintVal",n[n.SoftPointerId=330]="SoftPointerId",n[n.HardPointerId=340]="HardPointerId",n[n.SoftOwnershipId=350]="SoftOwnershipId",n[n.HardOwnershipId=360]="HardOwnershipId",n[n.ArbitraryHandle=320]="ArbitraryHandle",n[n.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",n[n.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",n[n.ExtendedDataControlString=1002]="ExtendedDataControlString",n[n.ExtendedDataLayerName=1003]="ExtendedDataLayerName",n[n.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",n[n.ExtendedDataHandle=1005]="ExtendedDataHandle",n[n.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",n[n.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",n[n.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",n[n.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",n[n.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",n[n.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",n[n.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",n[n.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",n[n.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",n[n.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",n[n.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",n[n.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",n[n.ExtendedDataReal=1040]="ExtendedDataReal",n[n.ExtendedDataDist=1041]="ExtendedDataDist",n[n.ExtendedDataScale=1042]="ExtendedDataScale",n[n.ExtendedDataInteger16=1070]="ExtendedDataInteger16",n[n.ExtendedDataInteger32=1071]="ExtendedDataInteger32",n[n.XTextString=300]="XTextString",n[n.XReal=140]="XReal",n[n.XInt16=170]="XInt16",n[n.XXInt16=270]="XXInt16",n[n.Subclass=100]="Subclass",n[n.ControlString=102]="ControlString",n[n.EmbeddedObjectStart=101]="EmbeddedObjectStart",n[n.End=-1]="End",n[n.FirstEntityId=-2]="FirstEntityId",n[n.HeaderId=-2]="HeaderId",n[n.XDataStart=-3]="XDataStart",n[n.Operator=-4]="Operator",n[n.PReactors=-5]="PReactors",n[n.XDictionary=-6]="XDictionary",n))(Cs||{});exports.AcCmColorMethod=void 0;(function(n){n[n.ByColor=1]="ByColor",n[n.ByACI=2]="ByACI",n[n.ByLayer=3]="ByLayer",n[n.ByBlock=4]="ByBlock",n[n.None=0]="None"})(exports.AcCmColorMethod||(exports.AcCmColorMethod={}));var Gh=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Hh=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},Fa={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Di=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0],It=function(){function n(){}return n.getColorByIndex=function(e){return Di[e]},n.getIndexByColor=function(e){for(var t=Di.length-1,r=1;r<t;++r)if(Di[r]===e)return r},n.getColorByName=function(e){return Fa[e.toLowerCase()]},n.getNameByColor=function(e){var t,r;try{for(var i=Gh(Object.entries(Fa)),s=i.next();!s.done;s=i.next()){var a=Hh(s.value,2),o=a[0],l=a[1];if(l===e)return o}}catch(c){t={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},n.getNameByIndex=function(e){var t=this.getColorByIndex(e);return this.getNameByColor(t)},n}(),Wh=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},B=function(){function n(e,t){e===void 0&&(e=exports.AcCmColorMethod.ByLayer),this._colorMethod=e,this._colorMethod==exports.AcCmColorMethod.ByColor&&t==null?this._value=16777215:this._colorMethod==exports.AcCmColorMethod.ByACI?t==null?this._value=8:t===0?this._colorMethod=exports.AcCmColorMethod.ByBlock:t===256?this._colorMethod=exports.AcCmColorMethod.ByLayer:this._value=Math.max(0,Math.min(t,256)):this._value=t}return Object.defineProperty(n.prototype,"colorMethod",{get:function(){return this._colorMethod},set:function(e){this._colorMethod=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){var e=this.RGB;return e!=null?e>>16&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){var e=this.RGB;return e!=null?e>>8&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){var e=this.RGB;return e!=null?e&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGB",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByColor:case exports.AcCmColorMethod.ByBlock:case exports.AcCmColorMethod.ByLayer:return this._value;case exports.AcCmColorMethod.ByACI:return this._value?It.getColorByIndex(this._value):this._value;default:return}},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(e,t,r){var i=Math.max(0,Math.min(255,Math.round(e))),s=Math.max(0,Math.min(255,Math.round(t))),a=Math.max(0,Math.min(255,Math.round(r)));return this._value=i<<16|s<<8|a,this._colorMethod=exports.AcCmColorMethod.ByColor,this},n.prototype.setRGBValue=function(e){return e==null||!Number.isFinite(e)?this:(this._value=e&16777215,this._colorMethod=exports.AcCmColorMethod.ByColor,this)},n.prototype.setRGBFromCss=function(e){if(!e)return this;var t=e.trim().toLowerCase();if(t.startsWith("#")){var r=0,i=0,s=0;if(t.length===7)r=parseInt(t.substr(1,2),16),i=parseInt(t.substr(3,2),16),s=parseInt(t.substr(5,2),16);else if(t.length===4)r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),s=parseInt(t[3]+t[3],16);else return this;return this.setRGB(r,i,s)}var a=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(a){var r=parseInt(a[1],10),i=parseInt(a[2],10),s=parseInt(a[3],10);return this.setRGB(r,i,s)}var o=It.getColorByName(e);return o!==void 0?this.setRGBValue(o):this},n.prototype.setScalar=function(e){return this.setRGB(e,e,e)},Object.defineProperty(n.prototype,"hexColor",{get:function(){var e=this.RGB;if(e!=null){var t=e.toString(16).padStart(6,"0").toUpperCase();return"0x"+t}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cssColor",{get:function(){var e=this.RGB;if(e!=null)return"rgb(".concat(e>>16&255,",").concat(e>>8&255,",").concat(e&255,")")},enumerable:!1,configurable:!0}),n.prototype.cssColorAlpha=function(e){var t=this.RGB;if(t!=null)return"rgba(".concat(t>>16&255,",").concat(t>>8&255,",").concat(t&255,",").concat(e,")")},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI?this._value:this._colorMethod===exports.AcCmColorMethod.ByLayer?256:this._colorMethod===exports.AcCmColorMethod.ByBlock?0:void 0},set:function(e){if(e!=null){var t=Math.max(0,Math.min(256,Math.round(e)));t===0?(this._colorMethod=exports.AcCmColorMethod.ByBlock,this._value=void 0):t===256?(this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=void 0):(this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=t)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByColor",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByACI",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isForeground",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI&&this._value===7},enumerable:!1,configurable:!0}),n.prototype.setForeground=function(){return this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=7,this},Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},enumerable:!1,configurable:!0}),n.prototype.setByLayer=function(e){return this._colorMethod=exports.AcCmColorMethod.ByLayer,e==null?this._value=256:this._value=e,this},Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},enumerable:!1,configurable:!0}),n.prototype.setByBlock=function(e){return this._colorMethod=exports.AcCmColorMethod.ByBlock,e==null?this._value=0:this._value=e,this},Object.defineProperty(n.prototype,"colorName",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByColor:return this._value?It.getNameByColor(this._value):"";case exports.AcCmColorMethod.ByACI:return this._value?It.getNameByIndex(this._value):"";default:return}},set:function(e){if(e){var t=It.getColorByName(e);t!==void 0&&(this._value=t,this._colorMethod=exports.AcCmColorMethod.ByColor)}},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var e=new n;return e._colorMethod=this._colorMethod,e._value=this._value,e},n.prototype.copy=function(e){return this._colorMethod=e._colorMethod,this._value=e._value,this},n.prototype.equals=function(e){return this._colorMethod===e._colorMethod&&this._value===e._value},n.prototype.toString=function(){switch(this._colorMethod){case exports.AcCmColorMethod.None:return"None";case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByACI:return this._value!==void 0?String(this._value):"";case exports.AcCmColorMethod.ByColor:return this._value?"RGB:".concat(this.red,",").concat(this.green,",").concat(this.blue):"";default:return""}},n.fromString=function(e){if(e){var t=e.trim();if(/^none$/i.test(t))return new n(exports.AcCmColorMethod.None);if(/^bylayer$/i.test(t))return new n(exports.AcCmColorMethod.ByLayer);if(/^byblock$/i.test(t))return new n(exports.AcCmColorMethod.ByBlock);var r=t.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(r){var i=Number(r[1]),s=Number(r[2]),a=Number(r[3]),o=new n(exports.AcCmColorMethod.ByColor);return o.setRGB(i,s,a),o}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(t)){var l=Wh(t.split(",").map(Number),3),i=l[0],s=l[1],a=l[2],o=new n(exports.AcCmColorMethod.ByColor);return o.setRGB(i,s,a),o}if(/^\d+$/.test(t)){var c=parseInt(t,10);return new n(exports.AcCmColorMethod.ByACI,c)}if(/^book\$/i.test(t)){var h=t.substring(t.indexOf("$")+1),d=It.getColorByName(h);return d!=null?new n(exports.AcCmColorMethod.ByColor,d):void 0}var p=It.getColorByName(t);if(p!=null)return new n(exports.AcCmColorMethod.ByColor,p)}},n}(),Uh=function(){function n(e,t){e===void 0&&(e=exports.AcCmColorMethod.ByColor),t===void 0&&(t=0),this._colorMethod=e,this._value=t}return Object.defineProperty(n.prototype,"colorMethd",{get:function(){return this._colorMethod},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){return this._value>>16&255},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&65535|(e&255)<<16},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){return this._value>>8&255},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16711935|(e&255)<<8},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){return this._value&255},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16776960|e&255},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(e,t,r){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=(e&255)<<16|(t&255)<<8|r&255},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._value},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"layerIndex",{get:function(){return this._value},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=e},enumerable:!1,configurable:!0}),n.prototype.isByColor=function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},n.prototype.isByLayer=function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},n.prototype.isByBlock=function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},n.prototype.isByACI=function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},n.prototype.isNone=function(){return this._colorMethod===exports.AcCmColorMethod.None},Object.defineProperty(n.prototype,"rawValue",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!1,configurable:!0}),n}(),Pe={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}},$h=function(){function n(){this._listeners={}}return n.prototype.addEventListener=function(e,t){this._listeners===void 0&&(this._listeners={});var r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)},n.prototype.hasEventListener=function(e,t){if(this._listeners===void 0)return!1;var r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1},n.prototype.removeEventListener=function(e,t){if(this._listeners!==void 0){var r=this._listeners,i=r[e];if(i!==void 0){var s=i.indexOf(t);s!==-1&&i.splice(s,1)}}},n.prototype.dispatchEvent=function(e){if(this._listeners!==void 0){var t=this._listeners,r=t[e.type];if(r!==void 0){e.target=this;for(var i=r.slice(0),s=0,a=i.length;s<a;s++)i[s].call(this,e)}}},n}(),qh=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Kh=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},Zh=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},ie=function(){function n(){this.listeners=[]}return n.prototype.addEventListener=function(e){this.listeners.push(e)},n.prototype.removeEventListener=function(e){this.listeners=this.listeners.filter(function(t){return t!==e})},n.prototype.replaceEventListener=function(e){this.removeEventListener(e),this.addEventListener(e)},n.prototype.dispatch=function(e){for(var t,r,i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];try{for(var a=qh(this.listeners),o=a.next();!o.done;o=a.next()){var l=o.value,c=l;c.call.apply(c,Zh([null,e],Kh(i),!1))}}catch(h){t={error:h}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}},n}(),os=function(){return os=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},os.apply(this,arguments)},Qh=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},Jh=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},bo=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function Un(n){return n===null||typeof n!="object"?n:Array.isArray(n)?Jh([],Qh(n),!1):os({},n)}function ls(n){if(n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(Array.isArray(n))return n.map(ls);var e={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=ls(n[t]));return e}function ur(n){for(var e,t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];try{for(var s=bo(r),a=s.next();!a.done;a=s.next()){var o=a.value;if(o)for(var l in o)Object.prototype.hasOwnProperty.call(o,l)&&n[l]===void 0&&(n[l]=o[l])}}catch(c){e={error:c}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return n}function xo(n,e){return n!=null&&Object.prototype.hasOwnProperty.call(n,e)}function wo(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function xn(n,e){var t,r;if(n===e)return!0;if(n==null||e==null)return n===e;if(typeof n!=typeof e)return!1;if(typeof n!="object")return n===e;if(Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(var i=0;i<n.length;i++)if(!xn(n[i],e[i]))return!1;return!0}var s=Object.keys(n),a=Object.keys(e);if(s.length!==a.length)return!1;try{for(var o=bo(s),l=o.next();!l.done;l=o.next()){var c=l.value;if(!Object.prototype.hasOwnProperty.call(e,c)||!xn(n[c],e[c]))return!1}}catch(h){t={error:h}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return!0}var ed=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function td(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var vo={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():e.log=t()})(ed,function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],s={},a=null;function o(m,y){var _=m[y];if(typeof _.bind=="function")return _.bind(m);try{return Function.prototype.bind.call(_,m)}catch{return function(){return Function.prototype.apply.apply(_,[m,arguments])}}}function l(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function c(m){return m==="debug"&&(m="log"),typeof console===t?!1:m==="trace"&&r?l:console[m]!==void 0?o(console,m):console.log!==void 0?o(console,"log"):e}function h(){for(var m=this.getLevel(),y=0;y<i.length;y++){var _=i[y];this[_]=y<m?e:this.methodFactory(_,m,this.name)}if(this.log=this.debug,typeof console===t&&m<this.levels.SILENT)return"No console available for logging"}function d(m){return function(){typeof console!==t&&(h.call(this),this[m].apply(this,arguments))}}function p(m,y,_){return c(m)||d.apply(this,arguments)}function g(m,y){var _=this,P,L,S,A="loglevel";typeof m=="string"?A+=":"+m:typeof m=="symbol"&&(A=void 0);function N(F){var H=(i[F]||"silent").toUpperCase();if(!(typeof window===t||!A)){try{window.localStorage[A]=H;return}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+H+";"}catch{}}}function C(){var F;if(!(typeof window===t||!A)){try{F=window.localStorage[A]}catch{}if(typeof F===t)try{var H=window.document.cookie,ne=encodeURIComponent(A),me=H.indexOf(ne+"=");me!==-1&&(F=/^([^;]+)/.exec(H.slice(me+ne.length+1))[1])}catch{}return _.levels[F]===void 0&&(F=void 0),F}}function V(){if(!(typeof window===t||!A)){try{window.localStorage.removeItem(A)}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function M(F){var H=F;if(typeof H=="string"&&_.levels[H.toUpperCase()]!==void 0&&(H=_.levels[H.toUpperCase()]),typeof H=="number"&&H>=0&&H<=_.levels.SILENT)return H;throw new TypeError("log.setLevel() called with invalid level: "+F)}_.name=m,_.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},_.methodFactory=y||p,_.getLevel=function(){return S??L??P},_.setLevel=function(F,H){return S=M(F),H!==!1&&N(S),h.call(_)},_.setDefaultLevel=function(F){L=M(F),C()||_.setLevel(F,!1)},_.resetLevel=function(){S=null,V(),h.call(_)},_.enableAll=function(F){_.setLevel(_.levels.TRACE,F)},_.disableAll=function(F){_.setLevel(_.levels.SILENT,F)},_.rebuild=function(){if(a!==_&&(P=M(a.getLevel())),h.call(_),a===_)for(var F in s)s[F].rebuild()},P=M(a?a.getLevel():"WARN");var U=C();U!=null&&(S=M(U)),h.call(_)}a=new g,a.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var _=s[y];return _||(_=s[y]=new g(y,a.methodFactory)),_};var f=typeof window!==t?window.log:void 0;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=f),a},a.getLoggers=function(){return s},a.default=a,a})})(vo);var nd=vo.exports;const rd=td(nd);var id=!0,$n=rd;$n.setLevel("debug");var sd=function(n){try{$n.setLevel(n)}catch(e){$n.setLevel("error"),$n.error(e)}},Po=function(){function n(e,t){this.events={attrChanged:new ie,modelChanged:new ie},this._changing=!1,this._previousAttributes={},this._pending=!1;var r=e||{};t&&ur(r,t),this.attributes=r,this.changed={}}return n.prototype.get=function(e){return this.attributes[e]},n.prototype.set=function(e,t,r){if(e==null)return this;var i;typeof e=="object"?(i=e,r=t):(i={},i[e]=t),r||(r={});var s=r.unset,a=r.silent,o=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=Un(this.attributes),this.changed={});var c=this.attributes,h=this.changed,d=this._previousAttributes;for(var p in i)t=i[p],xn(c[p],t)||o.push(p),xn(d[p],t)?delete h[p]:h[p]=t,s?delete c[p]:c[p]=t;if(!a){o.length&&(this._pending=r);for(var g=0;g<o.length;g++)this.events.attrChanged.dispatch({object:this,attrName:o[g],attrValue:c[o[g]],options:r})}if(l)return this;if(!a)for(;this._pending;)r=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:r});return this._pending=!1,this._changing=!1,this},n.prototype.has=function(e){return this.get(e)!=null},n.prototype.hasChanged=function(e){return e==null?!wo(this.changed):xo(this.changed,e)},n.prototype.changedAttributes=function(e){if(!e)return this.hasChanged()?Un(this.changed):{};var t=this._changing?this._previousAttributes:this.attributes,r={};for(var i in e){var s=e[i];xn(t[i],s)||(r[i]=s)}return r},n.prototype.previous=function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},n.prototype.previousAttributes=function(){return Un(this._previousAttributes)},n.prototype.clone=function(){var e=Un(this.attributes);return new n(e)},n}(),ad=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},od=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},Ms=function(){function n(){this.entries=new Map}return n.getInstance=function(){return n.instance||(n.instance=new n),n.instance},n.prototype.collect=function(e){this.entries.set(e.name,e)},n.prototype.printAll=function(){var e,t;try{for(var r=ad(this.entries),i=r.next();!i.done;i=r.next())var s=od(i.value,2),a=s[0],o=s[1]}catch(l){e={error:l}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},n.prototype.clear=function(){this.entries.clear()},n.prototype.getAll=function(){return Array.from(this.entries.values())},n.prototype.getEntry=function(e){return this.entries.get(e)},n.prototype.remove=function(e){return this.entries.delete(e)},n}(),ld=function(){function n(){}return n.formatBytes=function(e,t){if(t===void 0&&(t=2),e===0)return"0 B";var r=1024,i=Math.max(0,t),s=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(e)/Math.log(r)),o=e/Math.pow(r,a);return"".concat(parseFloat(o.toFixed(i))," ").concat(s[a])},n}();exports.AcCmTransparencyMethod=void 0;(function(n){n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue"})(exports.AcCmTransparencyMethod||(exports.AcCmTransparencyMethod={}));var te=function(){function n(e){e!==void 0?(this._method=exports.AcCmTransparencyMethod.ByAlpha,this._alpha=n.clampAlpha(e)):(this._method=exports.AcCmTransparencyMethod.ByLayer,this._alpha=255)}return Object.defineProperty(n.prototype,"method",{get:function(){return this._method},set:function(e){this._method=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"alpha",{get:function(){return this._alpha},set:function(e){this._alpha=n.clampAlpha(e),this._method=exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"percentage",{get:function(){if(this._method===exports.AcCmTransparencyMethod.ByAlpha)return Math.round((1-this._alpha/255)*100)},set:function(e){var t=Math.max(0,Math.min(100,e)),r=Math.round(255*(1-t/100));this.alpha=r},enumerable:!1,configurable:!0}),n.clampAlpha=function(e){return Math.max(0,Math.min(255,Math.floor(e)))},Object.defineProperty(n.prototype,"isByAlpha",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByBlock},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByLayer},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isClear",{get:function(){return this.isByAlpha&&this._alpha===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSolid",{get:function(){return this.isByAlpha&&this._alpha===255},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInvalid",{get:function(){return this._method===exports.AcCmTransparencyMethod.ErrorValue},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){var e=this._method;return e<<24|this._alpha},n.prototype.clone=function(){var e=new n;return e._method=this._method,e._alpha=this._alpha,e},n.prototype.equals=function(e){return this._method===e._method&&this._alpha===e._alpha},n.prototype.toString=function(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()},n.fromString=function(e){var t=e.trim(),r=t.toLowerCase();if(r===""||r==="."||r==="use current"||r==="bylayer"){var i=new n;return i._method=exports.AcCmTransparencyMethod.ByLayer,i}if(r==="byblock"){var s=new n;return s._method=exports.AcCmTransparencyMethod.ByBlock,s}var a=Number(t);if(Number.isInteger(a)&&a>=0&&a<=255){var o=new n;return a<=90?o.percentage=a:o.alpha=a,o}var l=new n;return l._method=exports.AcCmTransparencyMethod.ErrorValue,l},n.deserialize=function(e){var t=e>>>24&255,r=e&255,i=t>=exports.AcCmTransparencyMethod.ByLayer&&t<=exports.AcCmTransparencyMethod.ErrorValue?t:exports.AcCmTransparencyMethod.ErrorValue,s=new n;return s._method=i,s._alpha=n.clampAlpha(r),s},n}(),Da=function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(h){try{c(r.next(h))}catch(d){a(d)}}function l(h){try{c(r.throw(h))}catch(d){a(d)}}function c(h){h.done?s(h.value):i(h.value).then(o,l)}c((r=r.apply(n,e||[])).next())})},Vi=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Ao=function(){function n(e){this.name=e}return n.prototype.run=function(e){throw new Error("run() must be implemented by subclass")},n}(),So=function(){function n(){this.tasks=[],this.onProgress=function(){},this.onComplete=function(){},this.onError=function(){return!1}}return n.prototype.scheduleTask=function(e){return new Promise(function(t,r){var i=function(){Promise.resolve(e()).then(t).catch(r)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(i):setTimeout(i,0)})},n.prototype.addTask=function(e){this.tasks.push(e)},n.prototype.setProgressCallback=function(e){this.onProgress=e},n.prototype.setCompleteCallback=function(e){this.onComplete=e},n.prototype.setErrorCallback=function(e){this.onError=e},n.prototype.run=function(e){return Da(this,void 0,void 0,function(){var t,r,i,s,a,o,l=this;return Vi(this,function(c){switch(c.label){case 0:t=this.tasks.length,r=e,i=function(h){var d,p,g;return Vi(this,function(f){switch(f.label){case 0:d=s.tasks[h],f.label=1;case 1:return f.trys.push([1,3,,4]),[4,s.scheduleTask(function(){return Da(l,void 0,void 0,function(){var m;return Vi(this,function(y){switch(y.label){case 0:return[4,d.run(r)];case 1:return m=y.sent(),this.onProgress((h+1)/t,d),[2,m]}})})})];case 2:return r=f.sent(),[3,4];case 3:return p=f.sent(),g=s.onError({error:p,taskIndex:h,task:d}),g?[2,{value:Promise.reject(p)}]:[3,4];case 4:return[2]}})},s=this,a=0,c.label=1;case 1:return a<t?[5,i(a)]:[3,4];case 2:if(o=c.sent(),typeof o=="object")return[2,o.value];c.label=3;case 3:return a++,[3,1];case 4:return this.onComplete(r),[2]}})})},n}(),Lo=function(){function n(e,t,r){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r}return n.prototype.itemStart=function(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0},n.prototype.itemEnd=function(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())},n.prototype.itemError=function(e){this.onError!==void 0&&this.onError(e)},n.prototype.resolveURL=function(e){return this.urlModifier?this.urlModifier(e):e},n.prototype.setURLModifier=function(e){return this.urlModifier=e,this},n.prototype.addHandler=function(e,t){return this.handlers.push(e,t),this},n.prototype.removeHandler=function(e){var t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this},n.prototype.getHandler=function(e){for(var t=0,r=this.handlers.length;t<r;t+=2){var i=this.handlers[t],s=this.handlers[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return s}return null},n}(),Io=new Lo,cd=function(){function n(e){this.manager=e!==void 0?e:Io,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return n.prototype.loadAsync=function(e,t){var r=this;return new Promise(function(i,s){r.load(e,i,t,s)})},n.prototype.parse=function(e){},n.prototype.setCrossOrigin=function(e){return this.crossOrigin=e,this},n.prototype.setWithCredentials=function(e){return this.withCredentials=e,this},n.prototype.setPath=function(e){return this.path=e,this},n.prototype.setResourcePath=function(e){return this.resourcePath=e,this},n.prototype.setRequestHeader=function(e){return this.requestHeader=e,this},n}();const Va=[{name:"AC1.2",value:1},{name:"AC1.40",value:2},{name:"AC1.50",value:3},{name:"AC2.20",value:4},{name:"AC2.10",value:5},{name:"AC2.21",value:6},{name:"AC2.22",value:7},{name:"AC1001",value:8},{name:"AC1002",value:9},{name:"AC1003",value:10},{name:"AC1004",value:11},{name:"AC1005",value:12},{name:"AC1006",value:13},{name:"AC1007",value:14},{name:"AC1008",value:15},{name:"AC1009",value:16},{name:"AC1010",value:17},{name:"AC1011",value:18},{name:"AC1012",value:19},{name:"AC1013",value:20},{name:"AC1014",value:21},{name:"AC1500",value:22},{name:"AC1015",value:23},{name:"AC1800a",value:24},{name:"AC1018",value:25},{name:"AC2100a",value:26},{name:"AC1021",value:27},{name:"AC2400a",value:28},{name:"AC1024",value:29},{name:"AC1027",value:31},{name:"AC3200a",value:32},{name:"AC1032",value:33}];class Ye{constructor(e){if(typeof e=="string"){const t=Va.find(r=>r.name===e);if(!t)throw new Error(`Unknown DWG version name: ${e}`);this.name=t.name,this.value=t.value;return}if(typeof e=="number"){const t=Va.find(r=>r.value===e);if(!t)throw new Error(`Unknown DWG version value: ${e}`);this.name=t.name,this.value=t.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class Eo{constructor(e={}){this._database=e.database,this._precision=Math.max(0,Math.min(16,e.precision??16)),this._version=e.version instanceof Ye?e.version:e.version!=null?new Ye(e.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(e){this._database=e}get precision(){return this._precision}setPrecision(e){return this._precision=Math.max(0,Math.min(16,e)),this}get version(){return this._version}get nextHandle(){return this._nextHandle}setVersion(e){return this._version=e instanceof Ye?e:new Ye(e),this}toString(){return this._lines.join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Os=(n=>(n[n.Invalid=-9999]="Invalid",n[n.Start=0]="Start",n[n.Text=1]="Text",n[n.AttributeTag=2]="AttributeTag",n[n.BlockName=2]="BlockName",n[n.ShapeName=2]="ShapeName",n[n.SymbolTableName=2]="SymbolTableName",n[n.SymbolTableRecordName=2]="SymbolTableRecordName",n[n.MlineStyleName=2]="MlineStyleName",n[n.AttributePrompt=3]="AttributePrompt",n[n.Description=3]="Description",n[n.DimPostString=3]="DimPostString",n[n.DimStyleName=3]="DimStyleName",n[n.LinetypeProse=3]="LinetypeProse",n[n.TextFontFile=3]="TextFontFile",n[n.CLShapeName=4]="CLShapeName",n[n.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",n[n.SymbolTableRecordComments=4]="SymbolTableRecordComments",n[n.TextBigFontFile=4]="TextBigFontFile",n[n.Handle=5]="Handle",n[n.DimensionBlock=5]="DimensionBlock",n[n.LinetypeName=6]="LinetypeName",n[n.DimBlk1=6]="DimBlk1",n[n.TextStyleName=7]="TextStyleName",n[n.DimBlk2=7]="DimBlk2",n[n.LayerName=8]="LayerName",n[n.CLShapeText=9]="CLShapeText",n[n.XCoordinate=10]="XCoordinate",n[n.YCoordinate=20]="YCoordinate",n[n.ZCoordinate=30]="ZCoordinate",n[n.Real=40]="Real",n[n.TxtSize=40]="TxtSize",n[n.ViewportHeight=40]="ViewportHeight",n[n.Angle=50]="Angle",n[n.ViewportSnapAngle=50]="ViewportSnapAngle",n[n.Visibility=60]="Visibility",n[n.Int16=70]="Int16",n[n.Int32=90]="Int32",n[n.Int64=160]="Int64",n[n.Int8=280]="Int8",n[n.Thickness=39]="Thickness",n[n.Elevation=38]="Elevation",n[n.LinetypeScale=48]="LinetypeScale",n[n.DashLength=49]="DashLength",n[n.MlineOffset=49]="MlineOffset",n[n.LinetypeElement=49]="LinetypeElement",n[n.NormalX=210]="NormalX",n[n.NormalY=220]="NormalY",n[n.NormalZ=230]="NormalZ",n[n.UcsOrg=110]="UcsOrg",n[n.UcsOrientationX=111]="UcsOrientationX",n[n.UcsOrientationY=112]="UcsOrientationY",n[n.ViewHeight=45]="ViewHeight",n[n.ViewWidth=41]="ViewWidth",n[n.ViewLensLength=42]="ViewLensLength",n[n.ViewFrontClip=43]="ViewFrontClip",n[n.ViewBackClip=44]="ViewBackClip",n[n.ViewBrightness=141]="ViewBrightness",n[n.ViewContrast=142]="ViewContrast",n[n.ViewMode=71]="ViewMode",n[n.ViewportActive=68]="ViewportActive",n[n.ViewportAspect=41]="ViewportAspect",n[n.ViewportGrid=76]="ViewportGrid",n[n.ViewportIcon=74]="ViewportIcon",n[n.ViewportNumber=69]="ViewportNumber",n[n.ViewportSnap=75]="ViewportSnap",n[n.ViewportSnapPair=78]="ViewportSnapPair",n[n.ViewportSnapStyle=77]="ViewportSnapStyle",n[n.ViewportTwist=51]="ViewportTwist",n[n.ViewportVisibility=67]="ViewportVisibility",n[n.ViewportZoom=73]="ViewportZoom",n[n.Color=62]="Color",n[n.ColorRgb=420]="ColorRgb",n[n.ColorName=430]="ColorName",n[n.LineWeight=370]="LineWeight",n[n.PlotStyleNameType=380]="PlotStyleNameType",n[n.PlotStyleNameId=390]="PlotStyleNameId",n[n.GradientObjType=450]="GradientObjType",n[n.GradientAngle=460]="GradientAngle",n[n.GradientName=470]="GradientName",n[n.GradientColCount=453]="GradientColCount",n[n.GradientPatType=451]="GradientPatType",n[n.GradientTintType=452]="GradientTintType",n[n.GradientShift=461]="GradientShift",n[n.GradientColVal=463]="GradientColVal",n[n.GradientTintVal=462]="GradientTintVal",n[n.SoftPointerId=330]="SoftPointerId",n[n.HardPointerId=340]="HardPointerId",n[n.SoftOwnershipId=350]="SoftOwnershipId",n[n.HardOwnershipId=360]="HardOwnershipId",n[n.ArbitraryHandle=320]="ArbitraryHandle",n[n.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",n[n.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",n[n.ExtendedDataControlString=1002]="ExtendedDataControlString",n[n.ExtendedDataLayerName=1003]="ExtendedDataLayerName",n[n.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",n[n.ExtendedDataHandle=1005]="ExtendedDataHandle",n[n.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",n[n.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",n[n.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",n[n.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",n[n.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",n[n.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",n[n.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",n[n.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",n[n.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",n[n.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",n[n.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",n[n.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",n[n.ExtendedDataReal=1040]="ExtendedDataReal",n[n.ExtendedDataDist=1041]="ExtendedDataDist",n[n.ExtendedDataScale=1042]="ExtendedDataScale",n[n.ExtendedDataInteger16=1070]="ExtendedDataInteger16",n[n.ExtendedDataInteger32=1071]="ExtendedDataInteger32",n[n.XTextString=300]="XTextString",n[n.XReal=140]="XReal",n[n.XInt16=170]="XInt16",n[n.XXInt16=270]="XXInt16",n[n.Subclass=100]="Subclass",n[n.ControlString=102]="ControlString",n[n.EmbeddedObjectStart=101]="EmbeddedObjectStart",n[n.End=-1]="End",n[n.FirstEntityId=-2]="FirstEntityId",n[n.HeaderId=-2]="HeaderId",n[n.XDataStart=-3]="XDataStart",n[n.Operator=-4]="Operator",n[n.PReactors=-5]="PReactors",n[n.XDictionary=-6]="XDictionary",n))(Os||{});exports.AcCmColorMethod=void 0;(function(n){n[n.ByColor=1]="ByColor",n[n.ByACI=2]="ByACI",n[n.ByLayer=3]="ByLayer",n[n.ByBlock=4]="ByBlock",n[n.None=0]="None"})(exports.AcCmColorMethod||(exports.AcCmColorMethod={}));var $h=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},qh=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},zo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Vi=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0],It=function(){function n(){}return n.getColorByIndex=function(e){return Vi[e]},n.getIndexByColor=function(e){for(var t=Vi.length-1,r=1;r<t;++r)if(Vi[r]===e)return r},n.getColorByName=function(e){return zo[e.toLowerCase()]},n.getNameByColor=function(e){var t,r;try{for(var i=$h(Object.entries(zo)),s=i.next();!s.done;s=i.next()){var o=qh(s.value,2),a=o[0],l=o[1];if(l===e)return a}}catch(c){t={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},n.getNameByIndex=function(e){var t=this.getColorByIndex(e);return this.getNameByColor(t)},n}(),Kh=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},R=function(){function n(e,t){e===void 0&&(e=exports.AcCmColorMethod.ByLayer),this._colorMethod=e,this._colorMethod==exports.AcCmColorMethod.ByColor&&t==null?this._value=16777215:this._colorMethod==exports.AcCmColorMethod.ByACI?t==null?this._value=8:t===0?this._colorMethod=exports.AcCmColorMethod.ByBlock:t===256?this._colorMethod=exports.AcCmColorMethod.ByLayer:this._value=Math.max(0,Math.min(t,256)):this._value=t}return Object.defineProperty(n.prototype,"colorMethod",{get:function(){return this._colorMethod},set:function(e){this._colorMethod=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){var e=this.RGB;return e!=null?e>>16&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){var e=this.RGB;return e!=null?e>>8&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){var e=this.RGB;return e!=null?e&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGB",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByColor:case exports.AcCmColorMethod.ByBlock:case exports.AcCmColorMethod.ByLayer:return this._value;case exports.AcCmColorMethod.ByACI:return this._value?It.getColorByIndex(this._value):this._value;default:return}},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(e,t,r){var i=Math.max(0,Math.min(255,Math.round(e))),s=Math.max(0,Math.min(255,Math.round(t))),o=Math.max(0,Math.min(255,Math.round(r)));return this._value=i<<16|s<<8|o,this._colorMethod=exports.AcCmColorMethod.ByColor,this},n.prototype.setRGBValue=function(e){return e==null||!Number.isFinite(e)?this:(this._value=e&16777215,this._colorMethod=exports.AcCmColorMethod.ByColor,this)},n.prototype.setRGBFromCss=function(e){if(!e)return this;var t=e.trim().toLowerCase();if(t.startsWith("#")){var r=0,i=0,s=0;if(t.length===7)r=parseInt(t.substr(1,2),16),i=parseInt(t.substr(3,2),16),s=parseInt(t.substr(5,2),16);else if(t.length===4)r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),s=parseInt(t[3]+t[3],16);else return this;return this.setRGB(r,i,s)}var o=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(o){var r=parseInt(o[1],10),i=parseInt(o[2],10),s=parseInt(o[3],10);return this.setRGB(r,i,s)}var a=It.getColorByName(e);return a!==void 0?this.setRGBValue(a):this},n.prototype.setScalar=function(e){return this.setRGB(e,e,e)},Object.defineProperty(n.prototype,"hexColor",{get:function(){var e=this.RGB;if(e!=null){var t=e.toString(16).padStart(6,"0").toUpperCase();return"0x"+t}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cssColor",{get:function(){var e=this.RGB;if(e!=null)return"rgb(".concat(e>>16&255,",").concat(e>>8&255,",").concat(e&255,")")},enumerable:!1,configurable:!0}),n.prototype.cssColorAlpha=function(e){var t=this.RGB;if(t!=null)return"rgba(".concat(t>>16&255,",").concat(t>>8&255,",").concat(t&255,",").concat(e,")")},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI?this._value:this._colorMethod===exports.AcCmColorMethod.ByLayer?256:this._colorMethod===exports.AcCmColorMethod.ByBlock?0:void 0},set:function(e){if(e!=null){var t=Math.max(0,Math.min(256,Math.round(e)));t===0?(this._colorMethod=exports.AcCmColorMethod.ByBlock,this._value=void 0):t===256?(this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=void 0):(this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=t)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByColor",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByACI",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isForeground",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI&&this._value===7},enumerable:!1,configurable:!0}),n.prototype.setForeground=function(){return this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=7,this},Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},enumerable:!1,configurable:!0}),n.prototype.setByLayer=function(e){return this._colorMethod=exports.AcCmColorMethod.ByLayer,e==null?this._value=256:this._value=e,this},Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},enumerable:!1,configurable:!0}),n.prototype.setByBlock=function(e){return this._colorMethod=exports.AcCmColorMethod.ByBlock,e==null?this._value=0:this._value=e,this},Object.defineProperty(n.prototype,"colorName",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByColor:return this._value?It.getNameByColor(this._value):"";case exports.AcCmColorMethod.ByACI:return this._value?It.getNameByIndex(this._value):"";default:return}},set:function(e){if(e){var t=It.getColorByName(e);t!==void 0&&(this._value=t,this._colorMethod=exports.AcCmColorMethod.ByColor)}},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var e=new n;return e._colorMethod=this._colorMethod,e._value=this._value,e},n.prototype.copy=function(e){return this._colorMethod=e._colorMethod,this._value=e._value,this},n.prototype.equals=function(e){return this._colorMethod===e._colorMethod&&this._value===e._value},n.prototype.toString=function(){switch(this._colorMethod){case exports.AcCmColorMethod.None:return"None";case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByACI:return this._value!==void 0?String(this._value):"";case exports.AcCmColorMethod.ByColor:return this._value?"RGB:".concat(this.red,",").concat(this.green,",").concat(this.blue):"";default:return""}},n.fromString=function(e){if(e){var t=e.trim();if(/^none$/i.test(t))return new n(exports.AcCmColorMethod.None);if(/^bylayer$/i.test(t))return new n(exports.AcCmColorMethod.ByLayer);if(/^byblock$/i.test(t))return new n(exports.AcCmColorMethod.ByBlock);var r=t.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(r){var i=Number(r[1]),s=Number(r[2]),o=Number(r[3]),a=new n(exports.AcCmColorMethod.ByColor);return a.setRGB(i,s,o),a}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(t)){var l=Kh(t.split(",").map(Number),3),i=l[0],s=l[1],o=l[2],a=new n(exports.AcCmColorMethod.ByColor);return a.setRGB(i,s,o),a}if(/^\d+$/.test(t)){var c=parseInt(t,10);return new n(exports.AcCmColorMethod.ByACI,c)}if(/^book\$/i.test(t)){var h=t.substring(t.indexOf("$")+1),d=It.getColorByName(h);return d!=null?new n(exports.AcCmColorMethod.ByColor,d):void 0}var p=It.getColorByName(t);if(p!=null)return new n(exports.AcCmColorMethod.ByColor,p)}},n}(),Zh=function(){function n(e,t){e===void 0&&(e=exports.AcCmColorMethod.ByColor),t===void 0&&(t=0),this._colorMethod=e,this._value=t}return Object.defineProperty(n.prototype,"colorMethd",{get:function(){return this._colorMethod},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){return this._value>>16&255},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&65535|(e&255)<<16},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){return this._value>>8&255},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16711935|(e&255)<<8},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){return this._value&255},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16776960|e&255},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(e,t,r){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=(e&255)<<16|(t&255)<<8|r&255},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._value},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"layerIndex",{get:function(){return this._value},set:function(e){this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=e},enumerable:!1,configurable:!0}),n.prototype.isByColor=function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},n.prototype.isByLayer=function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},n.prototype.isByBlock=function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},n.prototype.isByACI=function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},n.prototype.isNone=function(){return this._colorMethod===exports.AcCmColorMethod.None},Object.defineProperty(n.prototype,"rawValue",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!1,configurable:!0}),n}(),Pe={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}},Qh=function(){function n(){this._listeners={}}return n.prototype.addEventListener=function(e,t){this._listeners===void 0&&(this._listeners={});var r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)},n.prototype.hasEventListener=function(e,t){if(this._listeners===void 0)return!1;var r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1},n.prototype.removeEventListener=function(e,t){if(this._listeners!==void 0){var r=this._listeners,i=r[e];if(i!==void 0){var s=i.indexOf(t);s!==-1&&i.splice(s,1)}}},n.prototype.dispatchEvent=function(e){if(this._listeners!==void 0){var t=this._listeners,r=t[e.type];if(r!==void 0){e.target=this;for(var i=r.slice(0),s=0,o=i.length;s<o;s++)i[s].call(this,e)}}},n}(),Jh=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ed=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},td=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},ie=function(){function n(){this.listeners=[]}return n.prototype.addEventListener=function(e){this.listeners.push(e)},n.prototype.removeEventListener=function(e){this.listeners=this.listeners.filter(function(t){return t!==e})},n.prototype.replaceEventListener=function(e){this.removeEventListener(e),this.addEventListener(e)},n.prototype.dispatch=function(e){for(var t,r,i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];try{for(var o=Jh(this.listeners),a=o.next();!a.done;a=o.next()){var l=a.value,c=l;c.call.apply(c,td([null,e],ed(i),!1))}}catch(h){t={error:h}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},n}(),cs=function(){return cs=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},cs.apply(this,arguments)},nd=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},rd=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},xa=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function qn(n){return n===null||typeof n!="object"?n:Array.isArray(n)?rd([],nd(n),!1):cs({},n)}function hs(n){if(n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(Array.isArray(n))return n.map(hs);var e={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=hs(n[t]));return e}function fr(n){for(var e,t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];try{for(var s=xa(r),o=s.next();!o.done;o=s.next()){var a=o.value;if(a)for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&n[l]===void 0&&(n[l]=a[l])}}catch(c){e={error:c}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return n}function wa(n,e){return n!=null&&Object.prototype.hasOwnProperty.call(n,e)}function va(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function wn(n,e){var t,r;if(n===e)return!0;if(n==null||e==null)return n===e;if(typeof n!=typeof e)return!1;if(typeof n!="object")return n===e;if(Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(var i=0;i<n.length;i++)if(!wn(n[i],e[i]))return!1;return!0}var s=Object.keys(n),o=Object.keys(e);if(s.length!==o.length)return!1;try{for(var a=xa(s),l=a.next();!l.done;l=a.next()){var c=l.value;if(!Object.prototype.hasOwnProperty.call(e,c)||!wn(n[c],e[c]))return!1}}catch(h){t={error:h}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!0}var id=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Pa={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():e.log=t()})(id,function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],s={},o=null;function a(m,y){var _=m[y];if(typeof _.bind=="function")return _.bind(m);try{return Function.prototype.bind.call(_,m)}catch{return function(){return Function.prototype.apply.apply(_,[m,arguments])}}}function l(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function c(m){return m==="debug"&&(m="log"),typeof console===t?!1:m==="trace"&&r?l:console[m]!==void 0?a(console,m):console.log!==void 0?a(console,"log"):e}function h(){for(var m=this.getLevel(),y=0;y<i.length;y++){var _=i[y];this[_]=y<m?e:this.methodFactory(_,m,this.name)}if(this.log=this.debug,typeof console===t&&m<this.levels.SILENT)return"No console available for logging"}function d(m){return function(){typeof console!==t&&(h.call(this),this[m].apply(this,arguments))}}function p(m,y,_){return c(m)||d.apply(this,arguments)}function g(m,y){var _=this,P,L,S,A="loglevel";typeof m=="string"?A+=":"+m:typeof m=="symbol"&&(A=void 0);function N(F){var H=(i[F]||"silent").toUpperCase();if(!(typeof window===t||!A)){try{window.localStorage[A]=H;return}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+H+";"}catch{}}}function C(){var F;if(!(typeof window===t||!A)){try{F=window.localStorage[A]}catch{}if(typeof F===t)try{var H=window.document.cookie,ne=encodeURIComponent(A),me=H.indexOf(ne+"=");me!==-1&&(F=/^([^;]+)/.exec(H.slice(me+ne.length+1))[1])}catch{}return _.levels[F]===void 0&&(F=void 0),F}}function z(){if(!(typeof window===t||!A)){try{window.localStorage.removeItem(A)}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function M(F){var H=F;if(typeof H=="string"&&_.levels[H.toUpperCase()]!==void 0&&(H=_.levels[H.toUpperCase()]),typeof H=="number"&&H>=0&&H<=_.levels.SILENT)return H;throw new TypeError("log.setLevel() called with invalid level: "+F)}_.name=m,_.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},_.methodFactory=y||p,_.getLevel=function(){return S??L??P},_.setLevel=function(F,H){return S=M(F),H!==!1&&N(S),h.call(_)},_.setDefaultLevel=function(F){L=M(F),C()||_.setLevel(F,!1)},_.resetLevel=function(){S=null,z(),h.call(_)},_.enableAll=function(F){_.setLevel(_.levels.TRACE,F)},_.disableAll=function(F){_.setLevel(_.levels.SILENT,F)},_.rebuild=function(){if(o!==_&&(P=M(o.getLevel())),h.call(_),o===_)for(var F in s)s[F].rebuild()},P=M(o?o.getLevel():"WARN");var U=C();U!=null&&(S=M(U)),h.call(_)}o=new g,o.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var _=s[y];return _||(_=s[y]=new g(y,o.methodFactory)),_};var f=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=f),o},o.getLoggers=function(){return s},o.default=o,o})})(Pa);var od=Pa.exports;const ad=sd(od);var ld=!0,Kn=ad;Kn.setLevel("debug");var cd=function(n){try{Kn.setLevel(n)}catch(e){Kn.setLevel("error"),Kn.error(e)}},Aa=function(){function n(e,t){this.events={attrChanged:new ie,modelChanged:new ie},this._changing=!1,this._previousAttributes={},this._pending=!1;var r=e||{};t&&fr(r,t),this.attributes=r,this.changed={}}return n.prototype.get=function(e){return this.attributes[e]},n.prototype.set=function(e,t,r){if(e==null)return this;var i;typeof e=="object"?(i=e,r=t):(i={},i[e]=t),r||(r={});var s=r.unset,o=r.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=qn(this.attributes),this.changed={});var c=this.attributes,h=this.changed,d=this._previousAttributes;for(var p in i)t=i[p],wn(c[p],t)||a.push(p),wn(d[p],t)?delete h[p]:h[p]=t,s?delete c[p]:c[p]=t;if(!o){a.length&&(this._pending=r);for(var g=0;g<a.length;g++)this.events.attrChanged.dispatch({object:this,attrName:a[g],attrValue:c[a[g]],options:r})}if(l)return this;if(!o)for(;this._pending;)r=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:r});return this._pending=!1,this._changing=!1,this},n.prototype.has=function(e){return this.get(e)!=null},n.prototype.hasChanged=function(e){return e==null?!va(this.changed):wa(this.changed,e)},n.prototype.changedAttributes=function(e){if(!e)return this.hasChanged()?qn(this.changed):{};var t=this._changing?this._previousAttributes:this.attributes,r={};for(var i in e){var s=e[i];wn(t[i],s)||(r[i]=s)}return r},n.prototype.previous=function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},n.prototype.previousAttributes=function(){return qn(this._previousAttributes)},n.prototype.clone=function(){var e=qn(this.attributes);return new n(e)},n}(),hd=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},dd=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},ks=function(){function n(){this.entries=new Map}return n.getInstance=function(){return n.instance||(n.instance=new n),n.instance},n.prototype.collect=function(e){this.entries.set(e.name,e)},n.prototype.printAll=function(){var e,t;try{for(var r=hd(this.entries),i=r.next();!i.done;i=r.next())var s=dd(i.value,2),o=s[0],a=s[1]}catch(l){e={error:l}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},n.prototype.clear=function(){this.entries.clear()},n.prototype.getAll=function(){return Array.from(this.entries.values())},n.prototype.getEntry=function(e){return this.entries.get(e)},n.prototype.remove=function(e){return this.entries.delete(e)},n}(),ud=function(){function n(){}return n.formatBytes=function(e,t){if(t===void 0&&(t=2),e===0)return"0 B";var r=1024,i=Math.max(0,t),s=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(e)/Math.log(r)),a=e/Math.pow(r,o);return"".concat(parseFloat(a.toFixed(i))," ").concat(s[o])},n}();exports.AcCmTransparencyMethod=void 0;(function(n){n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue"})(exports.AcCmTransparencyMethod||(exports.AcCmTransparencyMethod={}));var te=function(){function n(e){e!==void 0?(this._method=exports.AcCmTransparencyMethod.ByAlpha,this._alpha=n.clampAlpha(e)):(this._method=exports.AcCmTransparencyMethod.ByLayer,this._alpha=255)}return Object.defineProperty(n.prototype,"method",{get:function(){return this._method},set:function(e){this._method=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"alpha",{get:function(){return this._alpha},set:function(e){this._alpha=n.clampAlpha(e),this._method=exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"percentage",{get:function(){if(this._method===exports.AcCmTransparencyMethod.ByAlpha)return Math.round((1-this._alpha/255)*100)},set:function(e){var t=Math.max(0,Math.min(100,e)),r=Math.round(255*(1-t/100));this.alpha=r},enumerable:!1,configurable:!0}),n.clampAlpha=function(e){return Math.max(0,Math.min(255,Math.floor(e)))},Object.defineProperty(n.prototype,"isByAlpha",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByBlock},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByLayer},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isClear",{get:function(){return this.isByAlpha&&this._alpha===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSolid",{get:function(){return this.isByAlpha&&this._alpha===255},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInvalid",{get:function(){return this._method===exports.AcCmTransparencyMethod.ErrorValue},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){var e=this._method;return e<<24|this._alpha},n.prototype.clone=function(){var e=new n;return e._method=this._method,e._alpha=this._alpha,e},n.prototype.equals=function(e){return this._method===e._method&&this._alpha===e._alpha},n.prototype.toString=function(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()},n.fromString=function(e){var t=e.trim(),r=t.toLowerCase();if(r===""||r==="."||r==="use current"||r==="bylayer"){var i=new n;return i._method=exports.AcCmTransparencyMethod.ByLayer,i}if(r==="byblock"){var s=new n;return s._method=exports.AcCmTransparencyMethod.ByBlock,s}var o=Number(t);if(Number.isInteger(o)&&o>=0&&o<=255){var a=new n;return o<=90?a.percentage=o:a.alpha=o,a}var l=new n;return l._method=exports.AcCmTransparencyMethod.ErrorValue,l},n.deserialize=function(e){var t=e>>>24&255,r=e&255,i=t>=exports.AcCmTransparencyMethod.ByLayer&&t<=exports.AcCmTransparencyMethod.ErrorValue?t:exports.AcCmTransparencyMethod.ErrorValue,s=new n;return s._method=i,s._alpha=n.clampAlpha(r),s},n}(),Vo=function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(h){try{c(r.next(h))}catch(d){o(d)}}function l(h){try{c(r.throw(h))}catch(d){o(d)}}function c(h){h.done?s(h.value):i(h.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},ji=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Sa=function(){function n(e){this.name=e}return n.prototype.run=function(e){throw new Error("run() must be implemented by subclass")},n}(),La=function(){function n(){this.tasks=[],this.onProgress=function(){},this.onComplete=function(){},this.onError=function(){return!1}}return n.prototype.scheduleTask=function(e){return new Promise(function(t,r){var i=function(){Promise.resolve(e()).then(t).catch(r)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(i):setTimeout(i,0)})},n.prototype.addTask=function(e){this.tasks.push(e)},n.prototype.setProgressCallback=function(e){this.onProgress=e},n.prototype.setCompleteCallback=function(e){this.onComplete=e},n.prototype.setErrorCallback=function(e){this.onError=e},n.prototype.run=function(e){return Vo(this,void 0,void 0,function(){var t,r,i,s,o,a,l=this;return ji(this,function(c){switch(c.label){case 0:t=this.tasks.length,r=e,i=function(h){var d,p,g;return ji(this,function(f){switch(f.label){case 0:d=s.tasks[h],f.label=1;case 1:return f.trys.push([1,3,,4]),[4,s.scheduleTask(function(){return Vo(l,void 0,void 0,function(){var m;return ji(this,function(y){switch(y.label){case 0:return[4,d.run(r)];case 1:return m=y.sent(),this.onProgress((h+1)/t,d),[2,m]}})})})];case 2:return r=f.sent(),[3,4];case 3:return p=f.sent(),g=s.onError({error:p,taskIndex:h,task:d}),g?[2,{value:Promise.reject(p)}]:[3,4];case 4:return[2]}})},s=this,o=0,c.label=1;case 1:return o<t?[5,i(o)]:[3,4];case 2:if(a=c.sent(),typeof a=="object")return[2,a.value];c.label=3;case 3:return o++,[3,1];case 4:return this.onComplete(r),[2]}})})},n}(),Ia=function(){function n(e,t,r){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r}return n.prototype.itemStart=function(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0},n.prototype.itemEnd=function(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())},n.prototype.itemError=function(e){this.onError!==void 0&&this.onError(e)},n.prototype.resolveURL=function(e){return this.urlModifier?this.urlModifier(e):e},n.prototype.setURLModifier=function(e){return this.urlModifier=e,this},n.prototype.addHandler=function(e,t){return this.handlers.push(e,t),this},n.prototype.removeHandler=function(e){var t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this},n.prototype.getHandler=function(e){for(var t=0,r=this.handlers.length;t<r;t+=2){var i=this.handlers[t],s=this.handlers[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return s}return null},n}(),Ea=new Ia,gd=function(){function n(e){this.manager=e!==void 0?e:Ea,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return n.prototype.loadAsync=function(e,t){var r=this;return new Promise(function(i,s){r.load(e,i,t,s)})},n.prototype.parse=function(e){},n.prototype.setCrossOrigin=function(e){return this.crossOrigin=e,this},n.prototype.setWithCredentials=function(e){return this.withCredentials=e,this},n.prototype.setPath=function(e){return this.path=e,this},n.prototype.setResourcePath=function(e){return this.resourcePath=e,this},n.prototype.setRequestHeader=function(e){return this.requestHeader=e,this},n}();const jo=[{name:"AC1.2",value:1},{name:"AC1.40",value:2},{name:"AC1.50",value:3},{name:"AC2.20",value:4},{name:"AC2.10",value:5},{name:"AC2.21",value:6},{name:"AC2.22",value:7},{name:"AC1001",value:8},{name:"AC1002",value:9},{name:"AC1003",value:10},{name:"AC1004",value:11},{name:"AC1005",value:12},{name:"AC1006",value:13},{name:"AC1007",value:14},{name:"AC1008",value:15},{name:"AC1009",value:16},{name:"AC1010",value:17},{name:"AC1011",value:18},{name:"AC1012",value:19},{name:"AC1013",value:20},{name:"AC1014",value:21},{name:"AC1500",value:22},{name:"AC1015",value:23},{name:"AC1800a",value:24},{name:"AC1018",value:25},{name:"AC2100a",value:26},{name:"AC1021",value:27},{name:"AC2400a",value:28},{name:"AC1024",value:29},{name:"AC1027",value:31},{name:"AC3200a",value:32},{name:"AC1032",value:33}];class Ye{constructor(e){if(typeof e=="string"){const t=jo.find(r=>r.name===e);if(!t)throw new Error(`Unknown DWG version name: ${e}`);this.name=t.name,this.value=t.value;return}if(typeof e=="number"){const t=jo.find(r=>r.value===e);if(!t)throw new Error(`Unknown DWG version value: ${e}`);this.name=t.name,this.value=t.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class Ta{constructor(e={}){this._database=e.database,this._precision=Math.max(0,Math.min(16,e.precision??16)),this._version=e.version instanceof Ye?e.version:e.version!=null?new Ye(e.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(e){this._database=e}get precision(){return this._precision}setPrecision(e){return this._precision=Math.max(0,Math.min(16,e)),this}get version(){return this._version}get nextHandle(){return this._nextHandle}setVersion(e){return this._version=e instanceof Ye?e:new Ye(e),this}toString(){return this._lines.join(`
|
|
2
2
|
`)+`
|
|
3
|
-
`}registerHandle(e){return this._handleMap.has(e)||(/^[0-9A-F]+$/i.test(e)?this._handleMap.set(e,e.toUpperCase()):(this._handleMap.set(e,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1)),this._handleMap.get(e)}resolveHandle(e){if(e)return this.registerHandle(e)}writeGroup(e,t){if(t==null)return this;this._lines.push(String(Math.trunc(e)));const r=this.formatValue(t);return this._lines.push(r===""?"0":r),this}writeStart(e){return this.writeString(0,e)}writeSubclassMarker(e){return this.writeString(100,e)}writeString(e,t){return!t&&t!==""?this:this.writeGroup(e,t)}writeInt8(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt16(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt32(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt64(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeUInt16(e,t){return t==null?this:this.writeGroup(e,Math.max(0,t))}writeUInt32(e,t){return t==null?this:this.writeGroup(e,Math.max(0,t))}writeBoolean(e,t){return t==null?this:this.writeGroup(e,t?1:0)}writeBool(e,t){return this.writeBoolean(e,t)}writeDouble(e,t){return t==null||!Number.isFinite(t)?this:this.writeGroup(e,t)}writeAngle(e,t){return t==null||!Number.isFinite(t)?this:this.writeDouble(e,t*180/Math.PI)}writeHandle(e,t){const r=this.resolveHandle(t);return r?this.writeString(e,r):this}writeObjectId(e,t){return this.writeHandle(e,t)}writePoint2d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this):this}writePoint3d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this.writeDouble(e+20,t.z??0),this):this}writeVector3d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this.writeDouble(e+20,t.z??0),this):this}writeCmColor(e,t=62,r=420){if(!e)return this;const i=e.colorIndex;i!=null&&this.writeInt16(t,i);const s=e.RGB;return s!=null&&e.colorIndex==null&&this.writeInt32(r,s),this}writeTransparency(e,t=440){return!e||e.method===exports.AcCmTransparencyMethod.ErrorValue?this:this.writeInt32(t,e.serialize())}writeResultBuffer(e){if(!e)return this;for(const t of e)this.writeGroup(t.code,t.value);return this}startSection(e){return this.writeStart("SECTION"),this.writeString(2,e),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(e){return this.writeStart("TABLE"),this.writeString(2,e),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(e){if(typeof e=="string")return this.sanitizeStringForDxfLine(e);if(typeof e=="boolean")return e?"1":"0";if(typeof e=="number"){if(!Number.isFinite(e))return"0";if(Number.isInteger(e))return String(e);const r=e.toFixed(this._precision).replace(/\.?0+$/,"");return r===""||r==="-"?"0":r}return String(e)}sanitizeStringForDxfLine(e){return e.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}var pe=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],za=1234567,Os=Math.PI/180,ks=180/Math.PI;function To(){var n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0,i=pe[n&255]+pe[n>>8&255]+pe[n>>16&255]+pe[n>>24&255]+"-"+pe[e&255]+pe[e>>8&255]+"-"+pe[e>>16&15|64]+pe[e>>24&255]+"-"+pe[t&63|128]+pe[t>>8&255]+"-"+pe[t>>16&255]+pe[t>>24&255]+pe[r&255]+pe[r>>8&255]+pe[r>>16&255]+pe[r>>24&255];return i.toLowerCase()}function pt(n,e,t){return Math.max(e,Math.min(t,n))}function Ns(n,e){return(n%e+e)%e}function Co(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function Mo(n,e,t){return n!==e?(t-n)/(e-n):0}function Ys(n,e,t){return(1-t)*n+t*e}function Oo(n,e,t,r){return Ys(n,e,1-Math.exp(-t*r))}function ko(n,e){return e===void 0&&(e=1),e-Math.abs(Ns(n,e*2)-e)}function No(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Yo(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Xo(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Ro(n,e){return n+Math.random()*(e-n)}function Bo(n){return n*(.5-Math.random())}function Fo(n){n!==void 0&&(za=n);var e=za+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Do(n){return n*Os}function Vo(n){return n*ks}function zo(n){return(n&n-1)===0&&n!==0}function jo(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Go(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function qn(n){var e=Math.PI*2;return(n%e+e)%e}function Ho(n,e,t){return n>e&&n<t||n>t&&n<e}function Wo(n,e,t,r){return r===void 0&&(r=!1),n=qn(n),e=qn(e),t=qn(t),r?e>t?n<=e&&n>=t:n<=e||n>=t:e<t?n>=e&&n<=t:n>=e||n<=t}function Xs(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function Uo(n,e){e===void 0&&(e=1e-7);var t=Xs(n);return Math.max(Math.pow(10,t)*e,e)}var T={DEG2RAD:Os,RAD2DEG:ks,generateUUID:To,clamp:pt,euclideanModulo:Ns,mapLinear:Co,inverseLerp:Mo,lerp:Ys,damp:Oo,pingpong:ko,smoothstep:No,smootherstep:Yo,randInt:Xo,randFloat:Ro,randFloatSpread:Bo,seededRandom:Fo,degToRad:Do,radToDeg:Vo,isPowerOfTwo:zo,ceilPowerOfTwo:jo,floorPowerOfTwo:Go,normalizeAngle:qn,isBetween:Ho,isBetweenAngle:Wo,intPartLength:Xs,relativeEps:Uo},hd=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Z=function(){function n(e,t){this.x=0,this.y=0;var r=+(e!==void 0)+ +(t!==void 0);if(r!==0){if(r===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(r===1){var i=e,s=i.x,a=i.y;this.x=s,this.y=a;return}if(r===2){this.x=e,this.y=t;return}throw Pe.ILLEGAL_PARAMETERS}}return Object.defineProperty(n.prototype,"width",{get:function(){return this.x},set:function(e){this.x=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.y},set:function(e){this.y=e},enumerable:!1,configurable:!0}),n.prototype.set=function(e,t){return this.x=e,this.y=t,this},n.prototype.setScalar=function(e){return this.x=e,this.y=e,this},n.prototype.setX=function(e){return this.x=e,this},n.prototype.setY=function(e){return this.y=e,this},n.prototype.setComponent=function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},n.prototype.getComponent=function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},n.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},n.prototype.addScalar=function(e){return this.x+=e,this.y+=e,this},n.prototype.addVectors=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},n.prototype.addScaledVector=function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},n.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},n.prototype.subScalar=function(e){return this.x-=e,this.y-=e,this},n.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},n.prototype.multiply=function(e){return this.x*=e.x,this.y*=e.y,this},n.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this},n.prototype.divide=function(e){return this.x/=e.x,this.y/=e.y,this},n.prototype.divideScalar=function(e){return this.multiplyScalar(1/e)},n.prototype.applyMatrix2d=function(e){var t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this},n.prototype.min=function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},n.prototype.max=function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},n.prototype.clamp=function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},n.prototype.clampScalar=function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},n.prototype.clampLength=function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},n.prototype.dot=function(e){return this.x*e.x+this.y*e.y},n.prototype.cross=function(e){return this.x*e.y-this.y*e.x},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.angle=function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e},n.prototype.angleTo=function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var r=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,r)))},n.prototype.distanceTo=function(e){return Math.sqrt(this.distanceToSquared(e))},n.prototype.distanceToSquared=function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},n.prototype.manhattanDistanceTo=function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},n.prototype.setLength=function(e){return this.normalize().multiplyScalar(e)},n.prototype.lerp=function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},n.prototype.lerpVectors=function(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this},n.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},n.prototype.fromArray=function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},n.prototype.toArray=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},n.prototype.rotateAround=function(e,t){var r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},n.prototype.relativeEps=function(e){return e===void 0&&(e=1e-7),Math.min(T.relativeEps(this.x,e),T.relativeEps(this.y,e))},n.prototype[Symbol.iterator]=function(){return hd(this,function(e){switch(e.label){case 0:return[4,this.x];case 1:return e.sent(),[4,this.y];case 2:return e.sent(),[2]}})},n.EMPTY=Object.freeze(new n(0,0)),n}(),gr=function(){function n(e,t,r,i,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&r!=null&&i!=null&&s!=null&&a!=null&&o!=null&&l!=null&&c!=null&&this.set(e,t,r,i,s,a,o,l,c)}return n.prototype.set=function(e,t,r,i,s,a,o,l,c){var h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=r,h[7]=a,h[8]=c,this},n.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},n.prototype.copy=function(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this},n.prototype.extractBasis=function(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this},n.prototype.setFromMatrix4=function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},n.prototype.multiply=function(e){return this.multiplyMatrices(this,e)},n.prototype.premultiply=function(e){return this.multiplyMatrices(e,this)},n.prototype.multiplyMatrices=function(e,t){var r=e.elements,i=t.elements,s=this.elements,a=r[0],o=r[3],l=r[6],c=r[1],h=r[4],d=r[7],p=r[2],g=r[5],f=r[8],m=i[0],y=i[3],_=i[6],P=i[1],L=i[4],S=i[7],A=i[2],N=i[5],C=i[8];return s[0]=a*m+o*P+l*A,s[3]=a*y+o*L+l*N,s[6]=a*_+o*S+l*C,s[1]=c*m+h*P+d*A,s[4]=c*y+h*L+d*N,s[7]=c*_+h*S+d*C,s[2]=p*m+g*P+f*A,s[5]=p*y+g*L+f*N,s[8]=p*_+g*S+f*C,this},n.prototype.multiplyScalar=function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},n.prototype.determinant=function(){var e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-r*s*h+r*o*l+i*s*c-i*a*l},n.prototype.invert=function(){var e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=h*a-o*c,p=o*l-h*s,g=c*s-a*l,f=t*d+r*p+i*g;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);var m=1/f;return e[0]=d*m,e[1]=(i*c-h*r)*m,e[2]=(o*r-i*a)*m,e[3]=p*m,e[4]=(h*t-i*l)*m,e[5]=(i*s-o*t)*m,e[6]=g*m,e[7]=(r*l-c*t)*m,e[8]=(a*t-r*s)*m,this},n.prototype.transpose=function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},n.prototype.getNormalMatrix=function(e){return this.setFromMatrix4(e).invert().transpose()},n.prototype.transposeIntoArray=function(e){var t=this.elements;return e.elements[0]=t[0],e.elements[1]=t[3],e.elements[2]=t[6],e.elements[3]=t[1],e.elements[4]=t[4],e.elements[5]=t[7],e.elements[6]=t[2],e.elements[7]=t[5],e.elements[8]=t[8],this},n.prototype.setUvTransform=function(e,t,r,i,s,a,o){var l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this},n.prototype.scale=function(e,t){return this.premultiply(zi.makeScale(e,t)),this},n.prototype.rotate=function(e){return this.premultiply(zi.makeRotation(-e)),this},n.prototype.translate=function(e,t){return this.premultiply(zi.makeTranslation(e,t)),this},n.prototype.makeTranslation=function(e,t){return e instanceof Z?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this},n.prototype.makeRotation=function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this},n.prototype.makeScale=function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this},n.prototype.equals=function(e){for(var t=this.elements,r=e.elements,i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0},n.prototype.fromArray=function(e,t){t===void 0&&(t=0);for(var r=0;r<9;r++)this.elements[r]=e[r+t];return this},n.prototype.toArray=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.IDENTITY=Object.freeze(new n),n}(),zi=new gr,gt=1e-6,G=2*Math.PI,dd={x:0,y:0},Rs={x:0,y:0,z:0},q=function(){function n(){this.equalPointTol=gt,this.equalVectorTol=gt}return n.prototype.clone=function(){var e=new n;return e.equalPointTol=this.equalPointTol,e.equalVectorTol=this.equalVectorTol,e},n.prototype.equalPoint2d=function(e,t){return new Z(e).sub(t).length()<this.equalPointTol},n.prototype.equalPoint3d=function(e,t){return new x(e).sub(t).length()<this.equalPointTol},n.equalToZero=function(e,t){return t===void 0&&(t=gt),e<t&&e>-t},n.equal=function(e,t,r){return r===void 0&&(r=gt),Math.abs(e-t)<r},n.great=function(e,t,r){return r===void 0&&(r=gt),e-t>r},n.less=function(e,t,r){return r===void 0&&(r=gt),e-t<r},n.isPositive=function(e,t){return t===void 0&&(t=gt),e>t},n.isNonPositive=function(e,t){return t===void 0&&(t=gt),e<=t},n}(),Ni=new q,ud=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},pr=function(){function n(e,t,r,i){e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0),i===void 0&&(i=1),this._x=e,this._y=t,this._z=r,this._w=i}return n.slerpFlat=function(e,t,r,i,s,a,o){var l=r[i+0],c=r[i+1],h=r[i+2],d=r[i+3],p=s[a+0],g=s[a+1],f=s[a+2],m=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d;return}if(o===1){e[t+0]=p,e[t+1]=g,e[t+2]=f,e[t+3]=m;return}if(d!==m||l!==p||c!==g||h!==f){var y=1-o,_=l*p+c*g+h*f+d*m,P=_>=0?1:-1,L=1-_*_;if(L>Number.EPSILON){var S=Math.sqrt(L),A=Math.atan2(S,_*P);y=Math.sin(y*A)/S,o=Math.sin(o*A)/S}var N=o*P;if(l=l*y+p*N,c=c*y+g*N,h=h*y+f*N,d=d*y+m*N,y===1-o){var C=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=C,c*=C,h*=C,d*=C}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d},n.multiplyQuaternionsFlat=function(e,t,r,i,s,a){var o=r[i],l=r[i+1],c=r[i+2],h=r[i+3],d=s[a],p=s[a+1],g=s[a+2],f=s[a+3];return e[t]=o*f+h*d+l*g-c*p,e[t+1]=l*f+h*p+c*d-o*g,e[t+2]=c*f+h*g+o*p-l*d,e[t+3]=h*f-o*d-l*p-c*g,e},Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._w)},n.prototype.copy=function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},n.prototype.setFromEuler=function(e,t){t===void 0&&(t=!0);var r=e.x,i=e.y,s=e.z,a=e.order,o=Math.cos,l=Math.sin,c=o(r/2),h=o(i/2),d=o(s/2),p=l(r/2),g=l(i/2),f=l(s/2);switch(a){case"XYZ":this._x=p*h*d+c*g*f,this._y=c*g*d-p*h*f,this._z=c*h*f+p*g*d,this._w=c*h*d-p*g*f;break;case"YXZ":this._x=p*h*d+c*g*f,this._y=c*g*d-p*h*f,this._z=c*h*f-p*g*d,this._w=c*h*d+p*g*f;break;case"ZXY":this._x=p*h*d-c*g*f,this._y=c*g*d+p*h*f,this._z=c*h*f+p*g*d,this._w=c*h*d-p*g*f;break;case"ZYX":this._x=p*h*d-c*g*f,this._y=c*g*d+p*h*f,this._z=c*h*f-p*g*d,this._w=c*h*d+p*g*f;break;case"YZX":this._x=p*h*d+c*g*f,this._y=c*g*d+p*h*f,this._z=c*h*f-p*g*d,this._w=c*h*d-p*g*f;break;case"XZY":this._x=p*h*d-c*g*f,this._y=c*g*d-p*h*f,this._z=c*h*f+p*g*d,this._w=c*h*d+p*g*f;break;default:}return t===!0&&this._onChangeCallback(),this},n.prototype.setFromAxisAngle=function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(e){var t=e.elements,r=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],d=t[10],p=r+o+d;if(p>0){var g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(h-l)*g,this._y=(s-c)*g,this._z=(a-i)*g}else if(r>o&&r>d){var g=2*Math.sqrt(1+r-o-d);this._w=(h-l)/g,this._x=.25*g,this._y=(i+a)/g,this._z=(s+c)/g}else if(o>d){var g=2*Math.sqrt(1+o-r-d);this._w=(s-c)/g,this._x=(i+a)/g,this._y=.25*g,this._z=(l+h)/g}else{var g=2*Math.sqrt(1+d-r-o);this._w=(a-i)/g,this._x=(s+c)/g,this._y=(l+h)/g,this._z=.25*g}return this._onChangeCallback(),this},n.prototype.setFromUnitVectors=function(e,t){var r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()},n.prototype.angleTo=function(e){return 2*Math.acos(Math.abs(pt(this.dot(e),-1,1)))},n.prototype.rotateTowards=function(e,t){var r=this.angleTo(e);if(r===0)return this;var i=Math.min(1,t/r);return this.slerp(e,i),this},n.prototype.identity=function(){return this.set(0,0,0,1)},n.prototype.invert=function(){return this.conjugate()},n.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},n.prototype.dot=function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},n.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.prototype.normalize=function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},n.prototype.multiply=function(e){return this.multiplyQuaternions(this,e)},n.prototype.premultiply=function(e){return this.multiplyQuaternions(e,this)},n.prototype.multiplyQuaternions=function(e,t){var r=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=r*h+a*o+i*c-s*l,this._y=i*h+a*l+s*o-r*c,this._z=s*h+a*c+r*l-i*o,this._w=a*h-r*o-i*l-s*c,this._onChangeCallback(),this},n.prototype.slerp=function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var r=this._x,i=this._y,s=this._z,a=this._w,o=a*e._w+r*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=r,this._y=i,this._z=s,this;var l=1-o*o;if(l<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*r+t*this._x,this._y=c*i+t*this._y,this._z=c*s+t*this._z,this.normalize(),this}var h=Math.sqrt(l),d=Math.atan2(h,o),p=Math.sin((1-t)*d)/h,g=Math.sin(t*d)/h;return this._w=a*p+this._w*g,this._x=r*p+this._x*g,this._y=i*p+this._y*g,this._z=s*p+this._z*g,this._onChangeCallback(),this},n.prototype.slerpQuaternions=function(e,t,r){return this.copy(e).slerp(t,r)},n.prototype.random=function(){var e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))},n.prototype.equals=function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},n.prototype.fromArray=function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},n.prototype.toArray=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},n.prototype.toJSON=function(){return this.toArray()},n.prototype._onChange=function(e){return this._onChangeCallback=e,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return ud(this,function(e){switch(e.label){case 0:return[4,this._x];case 1:return e.sent(),[4,this._y];case 2:return e.sent(),[4,this._z];case 3:return e.sent(),[4,this._w];case 4:return e.sent(),[2]}})},n}(),gd=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},x=function(){function n(e,t,r){this.x=0,this.y=0,this.z=0;var i=+(e!==void 0)+ +(t!==void 0)+ +(r!==void 0);if(i!==0){if(i===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(i===1){var s=e,a=s.x,o=s.y,l=s.z;this.x=a,this.y=o,this.z=l||0;return}if(i===3){this.x=e,this.y=t,this.z=r;return}throw Pe.ILLEGAL_PARAMETERS}}return n.prototype.set=function(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this},n.prototype.setScalar=function(e){return this.x=e,this.y=e,this.z=e,this},n.prototype.setX=function(e){return this.x=e,this},n.prototype.setY=function(e){return this.y=e,this},n.prototype.setZ=function(e){return this.z=e,this},n.prototype.setComponent=function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},n.prototype.getComponent=function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this},n.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this},n.prototype.addScalar=function(e){return this.x+=e,this.y+=e,this.z+=e,this},n.prototype.addVectors=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},n.prototype.addScaledVector=function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},n.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},n.prototype.subScalar=function(e){return this.x-=e,this.y-=e,this.z-=e,this},n.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},n.prototype.multiply=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},n.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},n.prototype.multiplyVectors=function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},n.prototype.applyEuler=function(e){return this.applyQuaternion(ja.setFromEuler(e))},n.prototype.applyAxisAngle=function(e,t){return this.applyQuaternion(ja.setFromAxisAngle(e,t))},n.prototype.applyMatrix3=function(e){var t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this},n.prototype.applyNormalMatrix=function(e){return this.applyMatrix3(e).normalize()},n.prototype.applyMatrix4=function(e){var t=this.x,r=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*a,this},n.prototype.applyQuaternion=function(e){var t=this.x,r=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*r),h=2*(o*t-s*i),d=2*(s*r-a*t);return this.x=t+l*c+a*d-o*h,this.y=r+l*h+o*c-s*d,this.z=i+l*d+s*h-a*c,this},n.prototype.transformDirection=function(e){var t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()},n.prototype.divide=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},n.prototype.divideScalar=function(e){return this.multiplyScalar(1/e)},n.prototype.min=function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},n.prototype.max=function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},n.prototype.clamp=function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},n.prototype.clampScalar=function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},n.prototype.clampLength=function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},n.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},n.prototype.isParallelTo=function(e){var t=this.dot(e),r=this.length(),i=e.length();return Math.abs(t)===r*i},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.setLength=function(e){return this.normalize().multiplyScalar(e)},n.prototype.lerp=function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},n.prototype.lerpVectors=function(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this},n.prototype.cross=function(e){return this.crossVectors(this,e)},n.prototype.crossVectors=function(e,t){var r=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-r*l,this.z=r*o-i*a,this},n.prototype.projectOnVector=function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)},n.prototype.projectOnPlane=function(e){return ji.copy(this).projectOnVector(e),this.sub(ji)},n.prototype.reflect=function(e){return this.sub(ji.copy(e).multiplyScalar(2*this.dot(e)))},n.prototype.angleTo=function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var r=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,r)))},n.prototype.distanceTo=function(e){return Math.sqrt(this.distanceToSquared(e))},n.prototype.distanceToSquared=function(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i},n.prototype.manhattanDistanceTo=function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},n.prototype.setFromMatrixPosition=function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},n.prototype.setFromMatrixScale=function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this},n.prototype.setFromMatrixColumn=function(e,t){return this.fromArray(e.elements,t*4)},n.prototype.setFromMatrix3Column=function(e,t){return this.fromArray(e.elements,t*3)},n.prototype.equals=function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},n.prototype.fromArray=function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},n.prototype.toArray=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},n.prototype.randomDirection=function(){var e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this},n.prototype[Symbol.iterator]=function(){return gd(this,function(e){switch(e.label){case 0:return[4,this.x];case 1:return e.sent(),[4,this.y];case 2:return e.sent(),[4,this.z];case 3:return e.sent(),[2]}})},n.ORIGIN=Object.freeze(new n(0,0,0)),n.X_AXIS=Object.freeze(new n(1,0,0)),n.NEGATIVE_X_AXIS=Object.freeze(new n(-1,0,0)),n.Y_AXIS=Object.freeze(new n(0,1,0)),n.NEGATIVE_Y_AXIS=Object.freeze(new n(0,-1,0)),n.Z_AXIS=Object.freeze(new n(0,0,1)),n.NEGATIVE_Z_AXIS=Object.freeze(new n(0,0,-1)),n}(),ji=new x,ja=new pr,D=function(){function n(e,t,r,i,s,a,o,l,c,h,d,p,g,f,m,y){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&r!=null&&i!=null&&s!=null&&a!=null&&o!=null&&l!=null&&c!=null&&h!=null&&d!=null&&p!=null&&g!=null&&f!=null&&m!=null&&y!=null&&this.set(e,t,r,i,s,a,o,l,c,h,d,p,g,f,m,y)}return n.prototype.set=function(e,t,r,i,s,a,o,l,c,h,d,p,g,f,m,y){var _=this.elements;return _[0]=e,_[4]=t,_[8]=r,_[12]=i,_[1]=s,_[5]=a,_[9]=o,_[13]=l,_[2]=c,_[6]=h,_[10]=d,_[14]=p,_[3]=g,_[7]=f,_[11]=m,_[15]=y,this},n.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.prototype.copy=function(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this},n.prototype.copyPosition=function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},n.prototype.setFromMatrix3=function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this},n.prototype.setFromExtrusionDirection=function(e){if(Ni.equalPoint3d(e,x.Z_AXIS))this.identity();else{var t=new x(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(x.Y_AXIS,e).normalize():t.crossVectors(x.Z_AXIS,e).normalize();var r=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,r.x,r.y,r.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this},n.prototype.extractBasis=function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},n.prototype.makeBasis=function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},n.prototype.extractRotation=function(e){var t=this.elements,r=e.elements,i=1/dn.setFromMatrixColumn(e,0).length(),s=1/dn.setFromMatrixColumn(e,1).length(),a=1/dn.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*a,t[9]=r[9]*a,t[10]=r[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},n.prototype.makeRotationFromQuaternion=function(e){return this.compose(pd,e,fd)},n.prototype.lookAt=function(e,t,r){var i=this.elements;return Se.subVectors(e,t),Se.lengthSq()===0&&(Se.z=1),Se.normalize(),Lt.crossVectors(r,Se),Lt.lengthSq()===0&&(Math.abs(r.z)===1?Se.x+=1e-4:Se.z+=1e-4,Se.normalize(),Lt.crossVectors(r,Se)),Lt.normalize(),br.crossVectors(Se,Lt),i[0]=Lt.x,i[4]=br.x,i[8]=Se.x,i[1]=Lt.y,i[5]=br.y,i[9]=Se.y,i[2]=Lt.z,i[6]=br.z,i[10]=Se.z,this},n.prototype.multiply=function(e){return this.multiplyMatrices(this,e)},n.prototype.premultiply=function(e){return this.multiplyMatrices(e,this)},n.prototype.multiplyMatrices=function(e,t){var r=e.elements,i=t.elements,s=this.elements,a=r[0],o=r[4],l=r[8],c=r[12],h=r[1],d=r[5],p=r[9],g=r[13],f=r[2],m=r[6],y=r[10],_=r[14],P=r[3],L=r[7],S=r[11],A=r[15],N=i[0],C=i[4],V=i[8],M=i[12],U=i[1],F=i[5],H=i[9],ne=i[13],me=i[2],He=i[6],ln=i[10],cn=i[14],Rt=i[3],hn=i[7],At=i[11],St=i[15];return s[0]=a*N+o*U+l*me+c*Rt,s[4]=a*C+o*F+l*He+c*hn,s[8]=a*V+o*H+l*ln+c*At,s[12]=a*M+o*ne+l*cn+c*St,s[1]=h*N+d*U+p*me+g*Rt,s[5]=h*C+d*F+p*He+g*hn,s[9]=h*V+d*H+p*ln+g*At,s[13]=h*M+d*ne+p*cn+g*St,s[2]=f*N+m*U+y*me+_*Rt,s[6]=f*C+m*F+y*He+_*hn,s[10]=f*V+m*H+y*ln+_*At,s[14]=f*M+m*ne+y*cn+_*St,s[3]=P*N+L*U+S*me+A*Rt,s[7]=P*C+L*F+S*He+A*hn,s[11]=P*V+L*H+S*ln+A*At,s[15]=P*M+L*ne+S*cn+A*St,this},n.prototype.multiplyScalar=function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},n.prototype.determinant=function(){var e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],d=e[6],p=e[10],g=e[14],f=e[3],m=e[7],y=e[11],_=e[15];return f*(+s*l*d-i*c*d-s*o*p+r*c*p+i*o*g-r*l*g)+m*(+t*l*g-t*c*p+s*a*p-i*a*g+i*c*h-s*l*h)+y*(+t*c*d-t*o*g-s*a*d+r*a*g+s*o*h-r*c*h)+_*(-i*o*h-t*l*d+t*o*p+i*a*d-r*a*p+r*l*h)},n.prototype.transpose=function(){var e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},n.prototype.setPosition=function(e,t,r){var i=this.elements;return e instanceof x?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this},n.prototype.invert=function(){var e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15],P=d*y*c-m*p*c+m*l*g-o*y*g-d*l*_+o*p*_,L=f*p*c-h*y*c-f*l*g+a*y*g+h*l*_-a*p*_,S=h*m*c-f*d*c+f*o*g-a*m*g-h*o*_+a*d*_,A=f*d*l-h*m*l-f*o*p+a*m*p+h*o*y-a*d*y,N=t*P+r*L+i*S+s*A;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var C=1/N;return e[0]=P*C,e[1]=(m*p*s-d*y*s-m*i*g+r*y*g+d*i*_-r*p*_)*C,e[2]=(o*y*s-m*l*s+m*i*c-r*y*c-o*i*_+r*l*_)*C,e[3]=(d*l*s-o*p*s-d*i*c+r*p*c+o*i*g-r*l*g)*C,e[4]=L*C,e[5]=(h*y*s-f*p*s+f*i*g-t*y*g-h*i*_+t*p*_)*C,e[6]=(f*l*s-a*y*s-f*i*c+t*y*c+a*i*_-t*l*_)*C,e[7]=(a*p*s-h*l*s+h*i*c-t*p*c-a*i*g+t*l*g)*C,e[8]=S*C,e[9]=(f*d*s-h*m*s-f*r*g+t*m*g+h*r*_-t*d*_)*C,e[10]=(a*m*s-f*o*s+f*r*c-t*m*c-a*r*_+t*o*_)*C,e[11]=(h*o*s-a*d*s-h*r*c+t*d*c+a*r*g-t*o*g)*C,e[12]=A*C,e[13]=(h*m*i-f*d*i+f*r*p-t*m*p-h*r*y+t*d*y)*C,e[14]=(f*o*i-a*m*i-f*r*l+t*m*l+a*r*y-t*o*y)*C,e[15]=(a*d*i-h*o*i+h*r*l-t*d*l-a*r*p+t*o*p)*C,this},n.prototype.scale=function(e){var t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this},n.prototype.getMaxScaleOnAxis=function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))},n.prototype.makeTranslation=function(e,t,r){return e instanceof x?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},n.prototype.makeRotationX=function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},n.prototype.makeRotationY=function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},n.prototype.makeRotationZ=function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},n.prototype.makeRotationAxis=function(e,t){var r=Math.cos(t),i=Math.sin(t),s=1-r,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+r,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+r,h*l-i*a,0,c*l-i*o,h*l+i*a,s*l*l+r,0,0,0,0,1),this},n.prototype.makeScale=function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},n.prototype.makeShear=function(e,t,r,i,s,a){return this.set(1,r,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this},n.prototype.compose=function(e,t,r){var i=this.elements,s=t.x,a=t.y,o=t.z,l=t.w,c=s+s,h=a+a,d=o+o,p=s*c,g=s*h,f=s*d,m=a*h,y=a*d,_=o*d,P=l*c,L=l*h,S=l*d,A=r.x,N=r.y,C=r.z;return i[0]=(1-(m+_))*A,i[1]=(g+S)*A,i[2]=(f-L)*A,i[3]=0,i[4]=(g-S)*N,i[5]=(1-(p+_))*N,i[6]=(y+P)*N,i[7]=0,i[8]=(f+L)*C,i[9]=(y-P)*C,i[10]=(1-(p+m))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},n.prototype.decompose=function(e,t,r){var i=this.elements,s=dn.set(i[0],i[1],i[2]).length(),a=dn.set(i[4],i[5],i[6]).length(),o=dn.set(i[8],i[9],i[10]).length(),l=this.determinant();l<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Fe.copy(this);var c=1/s,h=1/a,d=1/o;return Fe.elements[0]*=c,Fe.elements[1]*=c,Fe.elements[2]*=c,Fe.elements[4]*=h,Fe.elements[5]*=h,Fe.elements[6]*=h,Fe.elements[8]*=d,Fe.elements[9]*=d,Fe.elements[10]*=d,t.setFromRotationMatrix(Fe),r.x=s,r.y=a,r.z=o,this},n.prototype.equals=function(e){for(var t=this.elements,r=e.elements,i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0},n.prototype.fromArray=function(e,t){t===void 0&&(t=0);for(var r=0;r<16;r++)this.elements[r]=e[r+t];return this},n.prototype.toArray=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},n.IDENTITY=Object.freeze(new n),n}(),dn=new x,Fe=new D,pd=new x(0,0,0),fd=new x(1,1,1),Lt=new x,br=new x,Se=new x,R=function(){function n(e,t){e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.min=e==null?new x(1/0,1/0,1/0):new x(e.x,e.y,e.z),this.max=t==null?new x(-1/0,-1/0,-1/0):new x(t.x,t.y,t.z)}return n.prototype.set=function(e,t){return this.min.copy(e),this.max.copy(t),this},n.prototype.setFromArray=function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t+=3)this.expandByPoint(Gi.fromArray(e,t));return this},n.prototype.setFromPoints=function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},n.prototype.setFromCenterAndSize=function(e,t){var r=Gi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(e){return this.min.copy(e.min),this.max.copy(e.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},n.prototype.getCenter=function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(e){return this.min.min(e),this.max.max(e),this},n.prototype.expandByVector=function(e){return this.min.sub(e),this.max.add(e),this},n.prototype.expandByScalar=function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},n.prototype.containsPoint=function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},n.prototype.containsBox=function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},n.prototype.getParameter=function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},n.prototype.intersectsBox=function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},n.prototype.intersectsPlane=function(e){var t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant},n.prototype.clampPoint=function(e,t){return t.copy(e).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(e){return this.clampPoint(e,Gi).distanceTo(e)},n.prototype.intersect=function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(e){return this.min.min(e.min),this.max.max(e.max),this},n.prototype.applyMatrix4=function(e){return this.isEmpty()?this:(Ke[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ke[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ke[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ke[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ke[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ke[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ke[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ke[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ke),this)},n.prototype.translate=function(e){return this.min.add(e),this.max.add(e),this},n.prototype.equals=function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},n}(),Ke=[new x,new x,new x,new x,new x,new x,new x,new x],Gi=new x,Ga=new Z,xe=function(){function n(e,t){e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.min=e==null?new Z(1/0,1/0):new Z(e.x,e.y),this.max=t==null?new Z(-1/0,-1/0):new Z(t.x,t.y)}return n.prototype.set=function(e,t){return this.min.copy(e),this.max.copy(t),this},n.prototype.setFromPoints=function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},n.prototype.setFromCenterAndSize=function(e,t){var r=Ga.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(e){return this.min.copy(e.min),this.max.copy(e.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},n.prototype.getCenter=function(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new Z(0,0):new Z(0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new Z(0,0):new Z(0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(e){return this.min.min(e),this.max.max(e),this},n.prototype.expandByVector=function(e){return this.min.sub(e),this.max.add(e),this},n.prototype.expandByScalar=function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},n.prototype.containsPoint=function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},n.prototype.containsBox=function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},n.prototype.getParameter=function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},n.prototype.intersectsBox=function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},n.prototype.clampPoint=function(e,t){return t.copy(e).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(e){return this.clampPoint(e,Ga).distanceTo(e)},n.prototype.intersect=function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(e){return this.min.min(e.min),this.max.max(e.max),this},n.prototype.translate=function(e){return this.min.add(e),this.max.add(e),this},n.prototype.equals=function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},n}(),Ha=new x,md=new x,yd=new gr,Bs=function(){function n(e,t){e===void 0&&(e=new x(1,0,0)),t===void 0&&(t=0),this.normal=e,this.constant=t}return n.prototype.set=function(e,t){return this.normal.copy(e),this.constant=t,this},n.prototype.setComponents=function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},n.prototype.setFromNormalAndCoplanarPoint=function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},n.prototype.setFromCoplanarPoints=function(e,t,r){var i=Ha.subVectors(r,t).cross(md.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},n.prototype.copy=function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},n.prototype.normalize=function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},n.prototype.negate=function(){return this.constant*=-1,this.normal.negate(),this},n.prototype.distanceToPoint=function(e){return this.normal.dot(e)+this.constant},n.prototype.projectPoint=function(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))},n.prototype.intersectsBox=function(e){return e.intersectsPlane(this)},n.prototype.coplanarPoint=function(e){return e.copy(this.normal).multiplyScalar(-this.constant)},n.prototype.applyMatrix4=function(e,t){var r=t||yd.getNormalMatrix(e),i=this.coplanarPoint(Ha).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this},n.prototype.translate=function(e){return this.constant-=e.dot(this.normal),this},n.prototype.equals=function(e){return e.normal.equals(this.normal)&&e.constant===this.constant},n.prototype.clone=function(){return new n().copy(this)},n}(),_d=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),E=function(n){_d(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.clone=function(){return new e(this.x,this.y)},e.pointArrayToNumberArray=function(t){var r=new Array(t.length*2);return t.forEach(function(i,s){i.toArray(r,s*2)}),r},e}(Z),bd=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),b=function(n){bd(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e.pointArrayToNumberArray=function(t,r){r===void 0&&(r=!0);var i=r?3:2,s=new Array(t.length*i);return t.forEach(function(a,o){a.toArray(s,o*i)}),s},e}(x),xd=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Wa=new D,Ua=new pr,wd=function(){function n(e,t,r,i){e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0),i===void 0&&(i=n.DEFAULT_ORDER),this._x=e,this._y=t,this._z=r,this._order=i}return Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"order",{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(e,t,r,i){return i===void 0&&(i=this._order),this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._order)},n.prototype.copy=function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(e,t,r){t===void 0&&(t=this._order),r===void 0&&(r=!0);var i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],d=i[2],p=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(pt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,g),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-pt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(pt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,g),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-pt(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(pt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-pt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,g),this._y=0);break;default:}return this._order=t,r===!0&&this._onChangeCallback(),this},n.prototype.setFromQuaternion=function(e,t,r){return r===void 0&&(r=!0),Wa.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Wa,t,r)},n.prototype.setFromVector3=function(e,t){return t===void 0&&(t=this._order),this.set(e.x,e.y,e.z,t)},n.prototype.reorder=function(e){return Ua.setFromEuler(this),this.setFromQuaternion(Ua,e)},n.prototype.equals=function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},n.prototype.fromArray=function(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this},n.prototype.toArray=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},n.prototype._onChange=function(e){return this._onChangeCallback=e,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return xd(this,function(e){switch(e.label){case 0:return[4,this._x];case 1:return e.sent(),[4,this._y];case 2:return e.sent(),[4,this._z];case 3:return e.sent(),[4,this._order];case 4:return e.sent(),[2]}})},n.DEFAULT_ORDER="XYZ",n}();function Fs(n,e,t){t===void 0&&(t=!1);for(var r=n.x,i=n.y,s=!1,a=e.length,o=0,l=a-1;o<a;l=o++){var c=e[o].x,h=e[o].y,d=e[l].x,p=e[l].y,g=h>i!=p>i;t&&(g=h>=i!=p>=i);var f=g&&r<(d-c)*(i-h)/(p-h)+c;f&&(s=!s)}return s}function $o(n,e){if(n.length===0||e.length===0)return!1;var t=new xe().setFromPoints(n),r=new xe().setFromPoints(e);if(!t.intersectsBox(r))return!1;for(var i=0;i<n.length;){if(Fs(n[i],e,!0))return!0;i<n.length-1&&Ni.equalPoint2d(n[i+1],n[i])&&++i,++i}return!1}var qo={isPointInPolygon:Fs,isPolygonIntersect:$o},xr=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},wr=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))};function vd(n,e){for(var t=[],r=e-1,i=n,s=0;s<=i;s++)t.push(0);for(var s=1;s<=r-i;s++)t.push(s);for(var s=0;s<=i;s++)t.push(r-i+1);return t}function Pd(n,e){for(var t=e.length-1,r=n,i=[0],s=0,a=1;a<=t;a++){var o=e[a][0]-e[a-1][0],l=e[a][1]-e[a-1][1],c=e[a][2]-e[a-1][2],h=Math.sqrt(o*o+l*l+c*c);s+=h,i.push(s)}for(var d=[],a=0;a<=r;a++)d.push(0);for(var a=1;a<=t-r;a++){var p=i[a]/s;d.push(p*(t-r+1))}for(var a=0;a<=r;a++)d.push(t-r+1);return d}function Ko(n,e){e===void 0&&(e="Uniform");var t=n.length;if(t===0)return[];if(t===1)return[0];var r=t-1;if(e==="Uniform")return new Array(t).fill(0).map(function(p,g){return g/r});for(var i=[0],s=0,a=1;a<=r;a++){var o=n[a][0]-n[a-1][0],l=n[a][1]-n[a-1][1],c=n[a][2]-n[a-1][2],h=Math.sqrt(o*o+l*l+c*c),d=e==="SqrtChord"?Math.sqrt(h):h;s+=d,i.push(s)}return s<1e-12?new Array(t).fill(0).map(function(p,g){return g/r}):i.map(function(p){return p/s})}function Zo(n,e){for(var t=e.length-1,r=n,i=t+r+1,s=new Array(i+1).fill(0),a=e[e.length-1],o=i-r;o<=i;o++)s[o]=a;for(var l=1;l<=t-r;l++){for(var c=0,o=l;o<l+r;o++)c+=e[o];s[l+r]=c/r}return s}function Ad(n,e){for(var t=e.length-1,r=n,i=[0],s=0,a=1;a<=t;a++){var o=e[a][0]-e[a-1][0],l=e[a][1]-e[a-1][1],c=e[a][2]-e[a-1][2],h=Math.sqrt(o*o+l*l+c*c),d=Math.sqrt(h);s+=d,i.push(s)}for(var p=[],a=0;a<=r;a++)p.push(0);for(var a=1;a<=t-r;a++){var g=i[a]/s;p.push(g*(t-r+1))}for(var a=0;a<=r;a++)p.push(t-r+1);return p}function Hi(n,e){for(var t=n.length,r=n.map(function(y){return y.slice()}),i=e.slice(),s=0;s<t;s++){for(var a=s,o=Math.abs(r[s][s]),l=s+1;l<t;l++){var c=Math.abs(r[l][s]);c>o&&(o=c,a=l)}if(o<1e-12)throw new Error("Interpolation matrix is singular.");if(a!==s){var h=r[s];r[s]=r[a],r[a]=h;var d=i[s];i[s]=i[a],i[a]=d}for(var l=s+1;l<t;l++){var p=r[l][s]/r[s][s];if(!(Math.abs(p)<1e-14)){for(var g=s;g<t;g++)r[l][g]-=p*r[s][g];i[l]-=p*i[s]}}}for(var f=new Array(t).fill(0),l=t-1;l>=0;l--){for(var m=i[l],g=l+1;g<t;g++)m-=r[l][g]*f[g];f[l]=m/r[l][l]}return f}function Ds(n,e,t,r,i){var s,a,o,l,c,h;if(t===void 0&&(t="Uniform"),n.length===0)return{controlPoints:[],knots:[],weights:[]};var d=n.map(function(At){var St;return[At[0],At[1],(St=At[2])!==null&&St!==void 0?St:0]}),p=!!r,g=!!i,f=(p?1:0)+(g?1:0),m=d.length-1,y=m+f;if(y<e)throw new Error("Not enough points to interpolate a curve of this degree.");var _=Ko(d,t),P=_.slice();p&&P.unshift(_[0]),g&&P.push(_[_.length-1]);var L=Zo(e,P),S=y+1,A=new Array(S),N=new Array(S),C=new Array(S),V=new Array(S),M=0;A[M]=new Array(S).fill(0),A[M][0]=1,N[M]=d[0][0],C[M]=d[0][1],V[M]=d[0][2],M++;for(var U=1;U<=m-1;U++){var F=_[U];A[M]=new Array(S).fill(0);for(var H=0;H<=y;H++)A[M][H]=kt(H,e,F,L);N[M]=d[U][0],C[M]=d[U][1],V[M]=d[U][2],M++}if(A[M]=new Array(S).fill(0),A[M][y]=1,N[M]=d[m][0],C[M]=d[m][1],V[M]=d[m][2],M++,p){var ne=L[e+1]-L[0],me=ne!==0?e/ne:0;A[M]=new Array(S).fill(0),A[M][0]=-me,A[M][1]=me,N[M]=(s=r==null?void 0:r[0])!==null&&s!==void 0?s:0,C[M]=(a=r==null?void 0:r[1])!==null&&a!==void 0?a:0,V[M]=(o=r==null?void 0:r[2])!==null&&o!==void 0?o:0,M++}if(g){var ne=L[y+e+1]-L[y],me=ne!==0?e/ne:0;A[M]=new Array(S).fill(0),A[M][y-1]=-me,A[M][y]=me,N[M]=(l=i==null?void 0:i[0])!==null&&l!==void 0?l:0,C[M]=(c=i==null?void 0:i[1])!==null&&c!==void 0?c:0,V[M]=(h=i==null?void 0:i[2])!==null&&h!==void 0?h:0,M++}for(var He=Hi(A,N),ln=Hi(A,C),cn=Hi(A,V),Rt=new Array(S),U=0;U<S;U++)Rt[U]=[He[U],ln[U],cn[U]];var hn=new Array(S).fill(1);return{controlPoints:Rt,knots:L,weights:hn}}function kt(n,e,t,r){if(e===0)return t>=r[n]&&t<r[n+1]?1:0;var i=r[n+e]-r[n],s=r[n+e+1]-r[n+1],a=i>1e-10?(t-r[n])/i:0,o=s>1e-10?(r[n+e+1]-t)/s:0;return a*kt(n,e-1,t,r)+o*kt(n+1,e-1,t,r)}function Kn(n,e,t,r,i){var s=r.length-1,a=e;if(n=Math.max(t[a],Math.min(t[s+1],n)),Math.abs(n-t[s+1])<1e-8)return wr([],xr(r[s]),!1);if(Math.abs(n-t[a])<1e-8)return wr([],xr(r[0]),!1);for(var o=[0,0,0],l=0,c=0;c<=s;c++){var h=kt(c,a,n,t),d=i[c]*h;o[0]+=r[c][0]*d,o[1]+=r[c][1]*d,o[2]+=r[c][2]*d,l+=d}if(Math.abs(l)<1e-10){var p=t[t.length-a-1];if(Math.abs(n-p)<1e-8)return wr([],xr(r[s]),!1);if(Math.abs(n-t[a])<1e-8)return wr([],xr(r[0]),!1)}return Math.abs(l)>=1e-10&&(o[0]/=l,o[1]/=l,o[2]/=l),o}function cs(n,e,t,r){if(e===0)return 0;var i=r[n+e]-r[n],s=r[n+e+1]-r[n+1],a=0;return i>1e-10&&(a+=e/i*kt(n,e-1,t,r)),s>1e-10&&(a-=e/s*kt(n+1,e-1,t,r)),a}function Sd(n,e,t,r){if(e<=1)return 0;var i=r[n+e]-r[n],s=r[n+e+1]-r[n+1],a=0;return i>1e-10&&(a+=e/i*cs(n,e-1,t,r)),s>1e-10&&(a-=e/s*cs(n+1,e-1,t,r)),a}function Ld(n,e,t,r,i){var s=r.length-1,a=e,o=t[a],l=t[s+1];n=Math.max(o,Math.min(l,n));for(var c=[0,0,0],h=[0,0,0],d=[0,0,0],p=0,g=0,f=0,m=0;m<=s;m++){var y=kt(m,a,n,t),_=cs(m,a,n,t),P=Sd(m,a,n,t),L=i[m],S=L*y,A=L*_,N=L*P,C=r[m];c[0]+=S*C[0],c[1]+=S*C[1],c[2]+=S*C[2],h[0]+=A*C[0],h[1]+=A*C[1],h[2]+=A*C[2],d[0]+=N*C[0],d[1]+=N*C[1],d[2]+=N*C[2],p+=S,g+=A,f+=N}if(Math.abs(p)<1e-10){var V=Kn(n,e,t,r,i);return{point:V,deriv1:[0,0,0],deriv2:[0,0,0]}}var M=p*p,U=[c[0]/p,c[1]/p,c[2]/p],F=[(h[0]*p-c[0]*g)/M,(h[1]*p-c[1]*g)/M,(h[2]*p-c[2]*g)/M],H=d[0]*p-c[0]*f,ne=d[1]*p-c[1]*f,me=d[2]*p-c[2]*f,He=[H/M-2*g*F[0]/p,ne/M-2*g*F[1]/p,me/M-2*g*F[2]/p];return{point:U,deriv1:F,deriv2:He}}function Id(n,e){var t=n[0],r=n[1],i=e[0],s=e[1],a=t*t+r*r;return a<1e-20?0:(t*s-r*i)/Math.pow(a,1.5)}function Qo(n,e,t,r){for(var i=n,s=e[i],a=e[e.length-i-1],o=0,l=1e3,c=(a-s)/l,h=Kn(s,n,e,t,r),d=1;d<=l;d++){var p=s+d*c,g=Kn(p,n,e,t,r),f=g[0]-h[0],m=g[1]-h[1],y=g[2]-h[2];o+=Math.sqrt(f*f+m*m+y*y),h=g}var _=Kn(a,n,e,t,r),P=_[0]-h[0],L=_[1]-h[1],S=_[2]-h[2];return o+=Math.sqrt(P*P+L*L+S*S),o}function Ed(n,e,t,r,i){return e===void 0&&(e=3),t===void 0&&(t="Uniform"),n.length===0?[]:Ds(n,e,t,r,i).controlPoints}var $a=new D,qa=new x,Td=new x,Cd=new x,Wi=new b;function Jo(n){return new D().setFromExtrusionDirection(new x(n.x,n.y,n.z))}function Vs(n){return $a.setFromExtrusionDirection(new x(n.x,n.y,n.z)),$a.extractBasis(qa,Td,Cd),qa.clone()}function hs(n,e){var t;return new b(n.x,n.y,(t=n.z)!==null&&t!==void 0?t:0).applyMatrix4(Jo(e))}function rr(n,e){var t;return new b(n.x,n.y,(t=n.z)!==null&&t!==void 0?t:0).applyMatrix4(Jo(e).invert())}function ds(n,e,t){var r,i,s=rr(n,t),a=rr(e,t);return Wi.set(a.x-s.x,a.y-s.y,((r=a.z)!==null&&r!==void 0?r:0)-((i=s.z)!==null&&i!==void 0?i:0)),T.normalizeAngle(Math.atan2(Wi.y,Wi.x))}var el=function(){function n(){this._boundingBoxNeedsUpdate=!1}return Object.defineProperty(n.prototype,"boundingBoxNeedUpdate",{get:function(){return this._boundingBoxNeedsUpdate},enumerable:!1,configurable:!0}),n}(),Md=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),zs=function(n){Md(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.translate=function(t){return this.transform(new gr().makeTranslation(t.x,t.y))},Object.defineProperty(e.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),e}(el),Od=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ln=function(n){Od(e,n);function e(){var t=n.call(this)||this;return t.arcLengthDivisions=100,t}return Object.defineProperty(e.prototype,"startPoint",{get:function(){return this.getPoint(0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.getPoint(1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.getLength()},enumerable:!1,configurable:!0}),e.prototype.getPoint=function(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")},e.prototype.getPointAt=function(t){var r=this.getUtoTmapping(t);return this.getPoint(r)},e.prototype.getPoints=function(t){t===void 0&&(t=5);for(var r=[],i=0;i<=t;i++)r.push(this.getPoint(i/t));return r},e.prototype.getSpacedPoints=function(t){t===void 0&&(t=5);for(var r=[],i=0;i<=t;i++)r.push(this.getPointAt(i/t));return r},e.prototype.getLength=function(){var t=this.getLengths();return t[t.length-1]},e.prototype.getLengths=function(t){t===void 0&&(t=this.arcLengthDivisions);var r=[],i,s=this.getPoint(0),a=0;r.push(0);for(var o=1;o<=t;o++)i=this.getPoint(o/t),a+=i.distanceTo(s),r.push(a),s=i;return r},e.prototype.getUtoTmapping=function(t,r){var i=this.getLengths(),s=0,a=i.length,o;r?o=r:o=t*i[a-1];for(var l=0,c=a-1,h;l<=c;)if(s=Math.floor(l+(c-l)/2),h=i[s]-o,h<0)l=s+1;else if(h>0)c=s-1;else{c=s;break}if(s=c,i[s]===o)return s/(a-1);var d=i[s],p=i[s+1],g=p-d,f=(o-d)/g,m=(s+f)/(a-1);return m},e.prototype.getTangent=function(t){var r=1e-4,i=t-r,s=t+r;i<0&&(i=0),s>1&&(s=1);var a=this.getPoint(i),o=this.getPoint(s),l=new E;return l.copy(o).sub(a).normalize(),l},e.prototype.getTangentAt=function(t){var r=this.getUtoTmapping(t);return this.getTangent(r)},e}(zs),kd=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),vr=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Pr=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},Ar=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},Re=function(n){kd(e,n);function e(t,r,i,s,a){var o=n.call(this)||this,l=+(t!==void 0)+ +(r!==void 0)+ +(i!==void 0)+ +(s!==void 0)+ +(a!==void 0);if(l==3)typeof t=="object"&&typeof r=="object"&&typeof i=="object"?o.createByThreePoints(t,r,i):o.createByStartEndPointsAndBulge(t,r,i);else if(l==5){var c=t;o.center=new E(c.x,c.y),o.radius=r,o._clockwise=a,o._startAngle=o._clockwise?o._mirrorAngle(T.normalizeAngle(i)):T.normalizeAngle(i),o._endAngle=o._clockwise?o._mirrorAngle(T.normalizeAngle(s)):T.normalizeAngle(s)}else throw Pe.ILLEGAL_PARAMETERS;return o}return e.prototype.createByThreePoints=function(t,r,i){var s=function(V,M){return{x:(V.x+M.x)/2,y:(V.y+M.y)/2}},a=function(V,M){return(M.y-V.y)/(M.x-V.x)},o=function(V){return-1/V},l=s(t,r),c=s(r,i),h=a(t,r),d=a(r,i),p=o(h),g=o(d),f=function(V,M,U,F){var H=(F-M)/(V-U),ne=V*H+M;return{x:H,y:ne}},m=l.y-p*l.x,y=c.y-g*c.x,_=f(p,m,g,y),P=Math.sqrt(Math.pow(t.x-_.x,2)+Math.pow(t.y-_.y,2)),L=function(V,M){return Math.atan2(V.y-M.y,V.x-M.x)},S=L(t,_),A=L(r,_),N=L(i,_),C=N>S&&N<A||S>N&&S<A||A>N&&A<S;this.center=_,this.radius=P,this._clockwise=!C,this._startAngle=S,this._endAngle=N},e.prototype.createByStartEndPointsAndBulge=function(t,r,i){var s,a,o;i<0?(s=Math.atan(-i)*4,a=new Z(t),o=new Z(r)):(s=Math.atan(i)*4,a=new Z(r),o=new Z(t));var l=new Z().subVectors(o,a),c=l.length(),h=new Z().addVectors(a,l.multiplyScalar(.5)),d=Math.abs(c/2/Math.tan(s/2)),p=l.normalize(),g=i<0?-Math.PI/2:Math.PI/2,f=new Z(p.x*Math.cos(g)-p.y*Math.sin(g),p.y*Math.cos(g)+p.x*Math.sin(g)),m;s<Math.PI?i<0?m=h.add(f.multiplyScalar(d)):m=h.add(f.multiplyScalar(-d)):i<0?m=h.add(f.multiplyScalar(-d)):m=h.add(f.multiplyScalar(d)),i<0?(this._startAngle=Math.atan2(a.y-m.y,a.x-m.x),this._endAngle=Math.atan2(o.y-m.y,o.x-m.x)):(this._startAngle=Math.atan2(o.y-m.y,o.x-m.x),this._endAngle=Math.atan2(a.y-m.y,a.x-m.x)),this._clockwise=i<0,this.center=m,this.radius=o.sub(m).length()},Object.defineProperty(e.prototype,"center",{get:function(){return this._center},set:function(t){this._center=new E(t.x,t.y),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle},set:function(t){this._startAngle=this._clockwise?this._mirrorAngle(T.normalizeAngle(t)):T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle},set:function(t){var r=this.startAngle==0&&t==G?t:T.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(r):r,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),e.prototype._mirrorAngle=function(t){var r=t*180/Math.PI,i=(360-r)%360;return i*Math.PI/180},e.prototype._getInternalAngle=function(t){return this._clockwise?this._mirrorAngle(t):t},Object.defineProperty(e.prototype,"deltaAngle",{get:function(){var t=this._getInternalAngle(this.startAngle),r=this._getInternalAngle(this.endAngle);return this.clockwise?T.normalizeAngle(t-r):T.normalizeAngle(r-t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwise",{get:function(){return this._clockwise},set:function(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this.endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midPoint",{get:function(){var t=this._getInternalAngle(this.startAngle),r=this._clockwise?T.normalizeAngle(t-this.deltaAngle/2):T.normalizeAngle(t+this.deltaAngle/2),i=this._clockwise?this._mirrorAngle(r):r;return this.getPointAtAngle(i)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){var t=this._getInternalAngle(this.startAngle),r=this._getInternalAngle(this.endAngle);return Math.abs(r-t)/Math.PI%2==0},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t,r,i=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var a=vr(s),o=a.next();!o.done;o=a.next()){var l=o.value,c=this._getInternalAngle(l);T.isBetweenAngle(c,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&i.push(this.getPointAtAngle(l))}}catch(p){t={error:p}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}var h=i.map(function(p){return p.x}),d=i.map(function(p){return p.y});return new xe(new E(Math.min.apply(Math,Ar([],Pr(h),!1)),Math.min.apply(Math,Ar([],Pr(d),!1))),new E(Math.max.apply(Math,Ar([],Pr(h),!1)),Math.max.apply(Math,Ar([],Pr(d),!1))))},Object.defineProperty(e.prototype,"length",{get:function(){return Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),e.prototype.transform=function(t){var r=this,i=t,s=this.center.clone().applyMatrix2d(i),a=this.startPoint.clone().applyMatrix2d(i);if(this.closed)return this.center=s,this.radius=s.distanceTo(a),this._startAngle=Math.atan2(a.y-s.y,a.x-s.x),this._endAngle=this._startAngle,this._clockwise=i.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;var o=this.midPoint.clone().applyMatrix2d(i),l=this.endPoint.clone().applyMatrix2d(i),c=new e(a,o,l),h=i.determinant()<0?!this.clockwise:this.clockwise,d=function(p){var g=T.normalizeAngle(p);return h?r._mirrorAngle(g):g};return this.center=c.center,this.radius=c.radius,this.clockwise=h,this.startAngle=d(Math.atan2(a.y-c.center.y,a.x-c.center.x)),this.endAngle=d(Math.atan2(l.y-c.center.y,l.x-c.center.x)),this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)},e.prototype.getPointAtAngle=function(t){var r=this._getInternalAngle(t),i=this.center.x+this.radius*Math.cos(r),s=this.center.y+this.radius*Math.sin(r);return new E(i,s)},e.prototype.getQuadrantPoints=function(){var t,r,i=[],s=this._getInternalAngle(this.startAngle),a=this._getInternalAngle(this.endAngle),o=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var l=vr(o),c=l.next();!c.done;c=l.next()){var h=c.value,d=this._getInternalAngle(h);T.isBetweenAngle(d,s,a,this.clockwise)&&i.push(this.getPointAtAngle(h))}}catch(p){t={error:p}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return i},e.prototype.nearestPoint=function(t){var r=new E(t.x,t.y),i=r.x-this.center.x,s=r.y-this.center.y,a=Math.hypot(i,s);if(a<1e-12)return this.startPoint.clone();var o=Math.atan2(s,i),l=this.clockwise?this._mirrorAngle(T.normalizeAngle(o)):T.normalizeAngle(o),c=this._getInternalAngle(l),h=this._getInternalAngle(this.startAngle),d=this._getInternalAngle(this.endAngle);if(T.isBetweenAngle(c,h,d,this.clockwise))return this.getPointAtAngle(l);var p=r.distanceToSquared(this.startPoint),g=r.distanceToSquared(this.endPoint);return p<=g?this.startPoint.clone():this.endPoint.clone()},e.prototype.perpendicularPoints=function(t){var r,i,s=new E(t.x,t.y),a=s.x-this.center.x,o=s.y-this.center.y,l=Math.hypot(a,o);if(l<1e-12)return[];var c=a/l,h=o/l,d=[new E(this.center.x+c*this.radius,this.center.y+h*this.radius),new E(this.center.x-c*this.radius,this.center.y-h*this.radius)],p=[],g=this._getInternalAngle(this.startAngle),f=this._getInternalAngle(this.endAngle);try{for(var m=vr(d),y=m.next();!y.done;y=m.next()){var _=y.value,P=Math.atan2(_.y-this.center.y,_.x-this.center.x),L=this.clockwise?this._mirrorAngle(T.normalizeAngle(P)):T.normalizeAngle(P),S=this._getInternalAngle(L);(this.closed||T.isBetweenAngle(S,g,f,this.clockwise))&&p.push(_)}}catch(A){r={error:A}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}return p},e.prototype.tangentPoints=function(t){var r,i,s=[],a=t.x-this.center.x,o=t.y-this.center.y,l=Math.hypot(a,o),c=this.radius;if(l<c)return s;var h=Math.acos(c/l),d=Math.atan2(o,a),p=[d+h,d-h],g=this._getInternalAngle(this.startAngle),f=this._getInternalAngle(this.endAngle);try{for(var m=vr(p),y=m.next();!y.done;y=m.next()){var _=y.value,P=this.clockwise?this._mirrorAngle(T.normalizeAngle(_)):T.normalizeAngle(_),L=this._getInternalAngle(P);(this.closed||T.isBetweenAngle(L,g,f,this.clockwise))&&s.push(this.getPointAtAngle(P))}}catch(S){r={error:S}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}return s},e.prototype.getPoints=function(t){t===void 0&&(t=100);var r=[],i=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(i=G,s=0),this.clockwise)for(var a=0;a<=t;a++){var o=s-i*(a/t),l=this._clockwise?this._mirrorAngle(o):o,c=this.getPointAtAngle(l);r.push(new E(c.x,c.y))}else for(var a=0;a<=t;a++){var o=s+i*(a/t),l=this._clockwise?this._mirrorAngle(o):o,c=this.getPointAtAngle(l);r.push(new E(c.x,c.y))}return r},e}(Ln),us=function(){return us=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},us.apply(this,arguments)},Nd=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Sr=1e-6;function tl(n,e){if(nu(n)){var t=Xd(n,e);return t?[t]:[]}var r=sl(n),i=r.numberOfVertices;if(i<2)return[];var s=iu(r,e);return s?[s]:[]}function Yd(n){return sl(n)}function Xd(n,e){var t,r,i=Rd(n);if(i.length===0)return null;var s=[];try{for(var a=Nd(i),o=a.next();!o.done;o=a.next()){var l=o.value,c=Fd(l,e);if(!c)return null;s.push(c)}}catch(g){t={error:g}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}var h=Bd(n),d=jd(s,h,n.closed,e);if(d.length<2)return null;var p=new ee;return d.forEach(function(g,f){p.addVertexAt(f,{x:g.x,y:g.y})}),p.closed=n.closed,p}function Rd(n){for(var e,t=[],r=n.numberOfVertices,i=n.closed?r:r-1,s=0;s<i;s++){var a=n.vertices[s],o=n.vertices[(s+1)%r];q.isPositive(Math.abs((e=a.bulge)!==null&&e!==void 0?e:0))?t.push({kind:"arc",arc:new Re(a,o,a.bulge)}):t.push({kind:"line",start:new E(a.x,a.y),end:new E(o.x,o.y)})}return t}function Bd(n){for(var e=[],t=0;t<n.numberOfVertices;t++)e.push(n.getPointAt(t));return e}function Fd(n,e){if(n.kind==="line"){var t=zd(n.start,n.end,e);return t?us({kind:"line"},t):null}var r=Dd(n.arc,n.arc.startPoint,n.arc.endPoint,e);return r?{kind:"arc",arc:r}:null}function Dd(n,e,t,r){var i=Vd(n,e,t,r),s=n.radius+i;return q.isNonPositive(s)?null:new Re(n.center,s,n.startAngle,n.endAngle,n.clockwise)}function Vd(n,e,t,r){var i=t.x-e.x,s=t.y-e.y,a=Math.hypot(i,s);if(q.isNonPositive(a))return n.clockwise?-r:r;var o=-s/a,l=i/a,c=n.center.x-(e.x+t.x)/2,h=n.center.y-(e.y+t.y)/2,d=c*o+h*l>0;return d?-r:r}function zd(n,e,t){var r=e.x-n.x,i=e.y-n.y,s=Math.hypot(r,i);if(q.isNonPositive(s))return null;var a=-i/s*t,o=r/s*t;return{start:new E(n.x+a,n.y+o),end:new E(e.x+a,e.y+o),dx:r,dy:i}}function jd(n,e,t,r){var i,s,a,o=n.length;if(o===0)return[];for(var l=Gd(n,e,t,r),c=[(s=(i=l[0].nextSegmentStart)===null||i===void 0?void 0:i.clone())!==null&&s!==void 0?s:l[0].point.clone()],h=0;h<o;h++){var d=n[h],p=h===o-1&&!t?{point:qd(d)}:l[(h+1)%o];if(h>0&&l[h].filletPoints&&l[h].filletPoints.forEach(function(_){return c.push(_.clone())}),d.kind==="arc")for(var g=(a=l[h].nextSegmentStart)!==null&&a!==void 0?a:l[h].point,f=p.point,m=Hd(d.arc,g,f,Math.max(16,32)),y=1;y<m.length;y++)c.push(m[y]);else c.push(p.point.clone())}return al(c)}function Gd(n,e,t,r){for(var i=n.length,s=[],a=0;a<i;a++)a===0?s.push(t?Ka(n[i-1],n[0],e[0],r):{point:$d(n[0])}):s.push(Ka(n[a-1],n[a],e[a],r));return s}function Hd(n,e,t,r){for(var i=n.nearestPoint(e),s=n.nearestPoint(t),a=gs(n,i),o=gs(n,s),l=Ud(n,a,o),c=[],h=0;h<=r;h++){var d=h/r,p=n.clockwise?a-l*d:a+l*d;c.push(n.getPointAtAngle(Wd(n,p)))}return c}function gs(n,e){return Math.atan2(e.y-n.center.y,e.x-n.center.x)}function Wd(n,e){var t=T.normalizeAngle(e);return n.clockwise?ps(t):t}function ps(n){var e=n*180/Math.PI;return(360-e)%360*(Math.PI/180)}function Ud(n,e,t){if(n.clockwise){var r=e-t;return q.isNonPositive(r)&&(r+=G),r}var i=t-e;return q.isNonPositive(i)&&(i+=G),i}function $d(n){return n.kind==="line"?n.start.clone():n.arc.startPoint.clone()}function qd(n){return n.kind==="line"?n.end.clone():n.arc.endPoint.clone()}function Ka(n,e,t,r){return n.kind==="line"&&e.kind==="line"?{point:fs({start:n.start,end:n.end,dx:n.dx,dy:n.dy},{start:e.start,end:e.end,dx:e.dx,dy:e.dy})}:n.kind==="line"&&e.kind==="arc"?Za(n,e.arc,t,r,!0):n.kind==="arc"&&e.kind==="line"?Za(e,n.arc,t,r,!1):n.kind==="arc"&&e.kind==="arc"?Kd(n.arc,e.arc,t,r):{point:t.clone()}}function Kd(n,e,t,r){var i=il(n.endPoint,e.startPoint),s=tu(n,e),a=s.filter(function(h){return Gr(n,h)&&Gr(e,h)});if(a.length>0)return{point:rl(a,i)};var o=n.endPoint.clone(),l=e.startPoint.clone(),c=nl(t,Math.abs(r),o,l);return{point:o,filletPoints:c,nextSegmentStart:l}}function Za(n,e,t,r,i){var s=il(i?n.end:n.start,i?e.startPoint:e.endPoint),a=eu(n,e,s);if(Qd(n,a)&&Gr(e,a))return{point:a};var o=Zd(n,t,r),l=i?e.startPoint.clone():e.endPoint.clone(),c=nl(t,Math.abs(r),i?o:l,i?l:o);return i?{point:o,filletPoints:c,nextSegmentStart:l}:{point:l,filletPoints:c,nextSegmentStart:o}}function Zd(n,e,t){var r=Math.hypot(n.dx,n.dy),i=-n.dy/r*t,s=n.dx/r*t;return new E(e.x+i,e.y+s)}function Qd(n,e){var t=Math.hypot(n.dx,n.dy);if(q.isNonPositive(t))return!1;var r=n.dx/t,i=n.dy/t,s=e.x-n.start.x,a=e.y-n.start.y,o=Math.abs(s*i-a*r);return q.equalToZero(o)}function nl(n,e,t,r){var i=Math.atan2(t.y-n.y,t.x-n.x),s=Math.atan2(r.y-n.y,r.x-n.x),a=Jd(i,s);if(q.equalToZero(Math.abs(a)))return[];for(var o=[],l=Math.max(2,Math.ceil(Math.abs(a)/Math.PI*16)),c=1;c<l;c++){var h=c/l,d=i+a*h;o.push(new E(n.x+e*Math.cos(d),n.y+e*Math.sin(d)))}return o}function Jd(n,e){for(var t=e-n;t>Math.PI;)t-=G;for(;t<=-Math.PI;)t+=G;return t}function eu(n,e,t){var r=Math.hypot(n.dx,n.dy);if(q.isNonPositive(r))return t.clone();var i=n.dx/r,s=n.dy/r,a=n.start.x-e.center.x,o=n.start.y-e.center.y,l=2*(a*i+o*s),c=a*a+o*o-e.radius*e.radius,h=l*l-4*c;if(h<0)return t.clone();var d=Math.sqrt(h),p=[(-l-d)/2,(-l+d)/2].map(function(f){return new E(n.start.x+i*f,n.start.y+s*f)}),g=p.filter(function(f){return Gr(e,f)});return rl(g.length>0?g:p,t)}function Gr(n,e){var t=Math.abs(Math.hypot(e.x-n.center.x,e.y-n.center.y)-n.radius);if(q.isPositive(t))return!1;var r=gs(n,e),i=n.clockwise?ps(T.normalizeAngle(n.startAngle)):T.normalizeAngle(n.startAngle),s=n.clockwise?ps(T.normalizeAngle(n.endAngle)):T.normalizeAngle(n.endAngle);return T.isBetweenAngle(r,i,s,n.clockwise)}function tu(n,e){var t=e.center.x-n.center.x,r=e.center.y-n.center.y,i=Math.hypot(t,r);if(q.isNonPositive(i))return[];var s=n.radius+e.radius,a=Math.abs(n.radius-e.radius);if(i>s+Sr)return[];if(i<a-Sr)return[];var o=(n.radius*n.radius-e.radius*e.radius+i*i)/(2*i),l=n.radius*n.radius-o*o;if(l<-Sr)return[];var c=n.center.x+o*t/i,h=n.center.y+o*r/i;if(l<=Sr)return[new E(c,h)];var d=Math.sqrt(l),p=-r*d/i,g=t*d/i;return[new E(c+p,h+g),new E(c-p,h-g)]}function rl(n,e){for(var t=n[0],r=t.distanceToSquared(e),i=1;i<n.length;i++){var s=n[i].distanceToSquared(e);s<r&&(t=n[i],r=s)}return t.clone()}function il(n,e){return new E((n.x+e.x)/2,(n.y+e.y)/2)}function nu(n){for(var e,t=n.numberOfVertices,r=n.closed?t:t-1,i=0;i<r;i++){var s=n.vertices[i];if(q.isPositive(Math.abs((e=s.bulge)!==null&&e!==void 0?e:0)))return!0}return!1}function sl(n){var e=ru(n.vertices.map(function(t){return new E(t.x,t.y)}),n.closed);return e.length===n.numberOfVertices?n:new ee(e.map(function(t){return{x:t.x,y:t.y}}),n.closed)}function ru(n,e){var t=al(n);if(!e||t.length<2)return t;var r=t[0],i=t[t.length-1];return q.isNonPositive(Math.hypot(r.x-i.x,r.y-i.y))&&t.pop(),t}function al(n){var e=[];return n.forEach(function(t){var r=e[e.length-1];(!r||q.isPositive(Math.hypot(r.x-t.x,r.y-t.y)))&&e.push(new E(t.x,t.y))}),e}function iu(n,e){for(var t=[],r=0;r<n.numberOfVertices;r++)t.push(n.getPointAt(r));var i=su(t,n.closed,e);if(i.length===0)return null;var s=[];if(n.closed){if(i.length<2)return null;for(var a=i.length,r=0;r<a;r++){var o=i[(r-1+a)%a],l=i[r];s.push(fs(o,l))}}else{s.push(i[0].start);for(var r=1;r<i.length;r++)s.push(fs(i[r-1],i[r]));s.push(i[i.length-1].end)}var c=new ee;return s.forEach(function(h,d){c.addVertexAt(d,{x:h.x,y:h.y})}),c.closed=n.closed,c}function su(n,e,t){for(var r=[],i=e?n.length:n.length-1,s=0;s<i;s++){var a=n[s],o=n[e?(s+1)%n.length:s+1],l=o.x-a.x,c=o.y-a.y,h=Math.hypot(l,c);if(!q.isNonPositive(h)){var d=-c/h*t,p=l/h*t;r.push({start:new E(a.x+d,a.y+p),end:new E(o.x+d,o.y+p),dx:l,dy:c})}}return r}function fs(n,e){var t=n.dx*e.dy-n.dy*e.dx;if(q.equalToZero(t))return new E((n.end.x+e.start.x)/2,(n.end.y+e.start.y)/2);var r=e.start.x-n.start.x,i=e.start.y-n.start.y,s=(r*e.dy-i*e.dx)/t;return new E(n.start.x+s*n.dx,n.start.y+s*n.dy)}var au=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),ms=function(){return ms=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},ms.apply(this,arguments)},ee=function(n){au(e,n);function e(t,r){t===void 0&&(t=null),r===void 0&&(r=!1);var i=n.call(this)||this;return i._vertices=t||new Array,i._closed=r,i}return Object.defineProperty(e.prototype,"vertices",{get:function(){return this._vertices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numberOfVertices",{get:function(){return this._vertices.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},set:function(t){this._closed=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){if(this.numberOfVertices>0){var t=this._vertices[0];return new E(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){var t=this.numberOfVertices;if(t>0)if(this.closed){var r=this._vertices[0];return new E(r.x,r.y)}else{var r=this._vertices[t-1];return new E(r.x,r.y)}throw new Error("End point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){for(var t=0,r=this._vertices.length,i=0;i<r;++i){var s=this._vertices[i],a=null;if(i<r-1?a=this._vertices[i+1]:i==r-1&&this.closed&&(a=this._vertices[0]),a)if(s.bulge){var o=new Re(s,a,s.bulge);t+=o.length}else t+=new E(s.x,s.y).distanceTo(a)}return t},enumerable:!1,configurable:!0}),e.prototype.addVertexAt=function(t,r){t<=0?this._vertices.unshift(r):this._vertices.splice(t,0,r),this._boundingBoxNeedsUpdate=!0},e.prototype.removeVertexAt=function(t){if(t<0||t>=this._vertices.length)throw new Error("Index ".concat(t," is out of bounds. Valid range is 0 to ").concat(this._vertices.length-1,"."));this._vertices.splice(t,1),this._boundingBoxNeedsUpdate=!0},e.prototype.reset=function(t,r){t?r!==void 0&&r>=0&&r<this._vertices.length&&(this._vertices=this._vertices.slice(0,r),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)},e.prototype.getPointAt=function(t){var r=this._vertices[t];return new E(r.x,r.y)},e.prototype.calculateBoundingBox=function(){var t=this.getPoints(100);return new xe().setFromPoints(t)},e.prototype.transform=function(t){var r=t.determinant()<0;return this._vertices.forEach(function(i){var s=new E(i).applyMatrix2d(t);i.x=s.x,i.y=s.y,r&&i.bulge!=null&&(i.bulge=-i.bulge)}),this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this._vertices.map(function(t){return ms({},t)}),this._closed)},e.prototype.getPoints3d=function(t,r){var i=[],s=this.getPoints(t);return s.forEach(function(a){return i.push(new b().set(a.x,a.y,r))}),i},e.prototype.getPoints=function(t){for(var r=[],i=this._vertices.length,s=0;s<i;++s){var a=this._vertices[s];if(a.bulge){var o=null;if(s<i-1?o=this._vertices[s+1]:s==i-1&&this.closed&&(o=this._vertices[0]),o)for(var l=new Re(a,o,a.bulge),c=l.getPoints(t),h=c.length,d=0;d<h;++d){var p=c[d];r.push(new E(p.x,p.y))}}else r.push(new E(a.x,a.y)),s==i-1&&this.closed&&r.push(r[0])}return r},e.prototype.offset=function(t){return tl(this,t)},e}(Ln);function ol(n,e,t){var r=Math.hypot(e.x,e.y);if(q.isNonPositive(r))return null;var i=-e.y/r*t,s=e.x/r*t;return new b(n.x+i,n.y+s,n.z)}function ou(n,e,t){var r;if(n.length<2)return null;var i=Yd(new ee(n.map(function(a){return{x:a.x,y:a.y}}),e)),s=tl(i,t);return(r=s[0])!==null&&r!==void 0?r:null}var Hr=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},wn=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))};function lu(n,e,t,r){if(n.length<2||q.equalToZero(t))return null;var i=cl(n,r),s=i.points,a=i.tangents;if(s.length<2)return null;var o=a??cu(s,e),l=hu(s,o,t),c=e?uu(l):du(l);if(c.length<2)return null;var h=new ee;return c.forEach(function(d,p){h.addVertexAt(p,{x:d.x,y:d.y})}),h.closed=e,h}function cu(n,e){for(var t=n.length,r=new Array(t),i=0;i<t;i++){var s=0,a=0;if(e){var o=n[(i-1+t)%t],l=n[(i+1)%t];s=l.x-o.x,a=l.y-o.y}else i===0?(s=n[1].x-n[0].x,a=n[1].y-n[0].y):i===t-1?(s=n[t-1].x-n[t-2].x,a=n[t-1].y-n[t-2].y):(s=n[i+1].x-n[i-1].x,a=n[i+1].y-n[i-1].y);var c=Math.hypot(s,a);q.isNonPositive(c)?r[i]=new E(1,0):r[i]=new E(s/c,a/c)}return r}function hu(n,e,t){return n.map(function(r,i){var s=e[i],a=-s.y*t,o=s.x*t;return new E(r.x+a,r.y+o)})}function du(n){var e=Wr(n);if(e.length<3)return e;for(;;){var t=ll(e,!1);if(!t||(e=Wr(wn(wn(wn([],Hr(e.slice(0,t.segmentA+1)),!1),[t.point],!1),Hr(e.slice(t.segmentB+1)),!1)),e.length<2))break}return e}function uu(n){var e=Wr(n);if(e.length<4)return e;for(;;){var t=ll(e,!0);if(!t||(e=Wr(wn(wn(wn([],Hr(e.slice(0,t.segmentA+1)),!1),[t.point],!1),Hr(e.slice(t.segmentB+1)),!1)),e.length<3))break}return e}function ll(n,e){var t=e?n.length:n.length-1;if(t<2)return null;for(var r=0;r<t;r++)for(var i=n[r],s=n[(r+1)%n.length],a=r+1;a<t;a++)if(!gu(r,a,t,e)){var o=n[a],l=n[(a+1)%n.length],c=pu(i,s,o,l);if(c)return{point:c,segmentA:r,segmentB:a}}return null}function gu(n,e,t,r){return!!(e===n||e===n+1||r&&n===0&&e===t-1)}function pu(n,e,t,r){var i=e.x-n.x,s=e.y-n.y,a=r.x-t.x,o=r.y-t.y,l=i*o-s*a;if(q.equalToZero(l))return null;var c=t.x-n.x,h=t.y-n.y,d=(c*o-h*a)/l,p=(c*s-h*i)/l,g=Ni.equalPointTol;return d<-g||d>1+g||p<-g||p>1+g?null:new E(n.x+d*i,n.y+d*s)}function cl(n,e){var t=[],r=[],i=e!=null&&e.length===n.length;return n.forEach(function(s,a){var o=t[t.length-1];if((!o||q.isPositive(Math.hypot(o.x-s.x,o.y-s.y)))&&(t.push(new E(s.x,s.y)),i)){var l=e[a];r.push(new E(l.x,l.y))}}),{points:t,tangents:i?r:void 0}}function Wr(n){return cl(n).points}var fu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Nt=function(n){fu(e,n);function e(){var t=n.call(this)||this;return t._loops=[],t}return e.prototype.add=function(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(e.prototype,"loops",{get:function(){return this._loops},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outter",{get:function(){if(this._loops.length>0)return this._loops[0]},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t=this.outter;return t?t.box:new xe},e.prototype.transform=function(t){return this._loops.forEach(function(r){r.transform(t)}),this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){var t=new e;return this._loops.forEach(function(r){t.add(r.clone())}),t},e.prototype.getPoints=function(t){for(var r=[],i=0;i<this.loops.length;++i){var s=this.loops[i],a=s.getPoints(t);r.push(a)}return r},e.prototype.buildHierarchy=function(){for(var t,r=this.getPoints(100),i=this.calculateBoundaryBoxes(r),s=this.sortBoundaryBoxesByAreas(i),a=new Map,o=s.length,l=0;l<o;l++)a.set(s[l],{index:s[l],children:[]});for(var c={index:-1,children:[]},l=0;l<o;l++){for(var h=s[l],d=r[h],p=i[h],g=l+1;g<o;g++){var f=s[g],m=r[f],y=i[f];if(y.containsBox(p)&&qo.isPointInPolygon(d[T.randInt(0,d.length-1)],m)){(t=a.get(f))===null||t===void 0||t.children.push(a.get(h));break}}g===o&&c.children.push(a.get(h))}return c},Object.defineProperty(e.prototype,"area",{get:function(){if(this._loops.length===0)return 0;for(var t=0,r=0;r<this._loops.length;r++){var i=this._loops[r],s=i.getPoints(128),a=this.polygonArea(s);r===0?t+=Math.abs(a):t-=Math.abs(a)}return t},enumerable:!1,configurable:!0}),e.prototype.polygonArea=function(t){var r=t.length;if(r<3)return 0;for(var i=0,s=0,a=r-1;s<r;a=s++){var o=t[a],l=t[s];i+=o.x*l.y-l.x*o.y}return i*.5},e.prototype.calculateBoundaryBoxes=function(t){var r=[];return t.forEach(function(i){r.push(new xe().setFromPoints(i))}),r},e.prototype.sortBoundaryBoxesByAreas=function(t){var r=[];t.forEach(function(s,a){var o=s.size,l=o.width*o.height;r.push({area:l,index:a})}),r.sort(function(s,a){return s.area-a.area});var i=[];return r.forEach(function(s){i.push(s.index)}),i},e}(zs),mu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),yu=function(n){mu(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.translate=function(t){return this.transform(new D().makeTranslation(t.x,t.y,t.z))},Object.defineProperty(e.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),e}(el),_u=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),fr=function(n){_u(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(yu),bu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),bt=function(n){bu(e,n);function e(t,r){var i=n.call(this)||this;return i._start=new b(t),i._end=new b(r),i}return Object.defineProperty(e.prototype,"startPoint",{get:function(){return this._start},set:function(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this._end},set:function(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"direction",{get:function(){return new x().subVectors(this.endPoint,this.startPoint).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midPoint",{get:function(){return new b((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)},enumerable:!1,configurable:!0}),e.prototype.nearestPoint=function(t){return this.project(t)},Object.defineProperty(e.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),e.prototype.isPointOnLine=function(t){var r=this.project(t),i=1e-6;return r.distanceTo(t)<i},e.prototype.at=function(t,r){return this.delta(r).multiplyScalar(t).add(this._start)},e.prototype.atLength=function(t,r){if(r===void 0&&(r=!1),r){var i=this.delta(Bt).normalize();return new b(this._start).addScaledVector(i,t)}else{var i=this.delta(Bt).normalize();return new b(this._end).addScaledVector(i,t)}},e.prototype.extend=function(t,r){if(r===void 0&&(r=!1),r){var i=Bt.subVectors(this._start,this._end).normalize();this._start=new b(this._start).addScaledVector(i,t)}else{var i=this.delta(Bt).normalize();this._end=new b(this._end).addScaledVector(i,t)}return this._boundingBoxNeedsUpdate=!0,this},e.prototype.closestPointToPointParameter=function(t,r){Qa.subVectors(t,this._start),Lr.subVectors(this.endPoint,this.startPoint);var i=Lr.dot(Lr),s=Lr.dot(Qa),a=s/i;return r&&(a=T.clamp(a,0,1)),a},e.prototype.closestPointToPoint=function(t,r,i){var s=this.closestPointToPointParameter(t,r);return this.delta(i).multiplyScalar(s).add(this._start)},e.prototype.delta=function(t){return t.subVectors(this._end,this._start)},e.prototype.distanceSq=function(){return this._start.distanceToSquared(this._end)},e.prototype.distance=function(){return this._start.distanceTo(this._end)},e.prototype.project=function(t){var r=this.direction,i=Bt.subVectors(t,this.startPoint),s=i.dot(r);return new b().copy(r).multiplyScalar(s).add(this.startPoint)},e.prototype.perpPoint=function(t){var r=this.direction,i=this.startPoint,s=Bt.subVectors(t,i),a=s.dot(r),o=Bt.copy(r).multiplyScalar(a);return new b().addVectors(i,o)},e.prototype.calculateBoundingBox=function(){var t=new b(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),r=new b(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new R(t,r)},e.prototype.transform=function(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(e.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.copy=function(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this._start.clone(),this._end.clone())},e.prototype.offset=function(t){var r=this.startPoint,i=this.endPoint,s=Math.hypot(i.x-r.x,i.y-r.y);if(s===0)return this.clone();var a=new x(i.x-r.x,i.y-r.y,0).normalize(),o=new x(-a.y,a.x,0);return new e(new b(r.x+o.x*t,r.y+o.y*t,r.z),new b(i.x+o.x*t,i.y+o.y*t,i.z))},e}(fr),Bt=new x,Qa=new x,Lr=new x,xu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ui=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Yi=function(n){xu(e,n);function e(t,r,i,s,a,o){o===void 0&&(o=x.X_AXIS);var l=n.call(this)||this;return l.center=t,l.radius=r,l.startAngle=i,l.endAngle=s,l.normal=a,l.refVec=o,(s-i)%G==0?(l.startAngle=0,l.endAngle=G):(l.startAngle=i,l.endAngle=s),l}return e.computeCenterPoint=function(t,r,i){var s=new x().addVectors(t,r).multiplyScalar(.5),a=new x().addVectors(t,i).multiplyScalar(.5),o=new x().subVectors(r,t),l=new x().subVectors(i,t),c=new x().crossVectors(o,l).normalize();if(c.lengthSq()===0)return null;var h=new x().crossVectors(o,c).normalize(),d=new x().crossVectors(l,c).normalize(),p=h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),g=d.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),f=new bt(s,s.clone().add(p)),m=new bt(a,a.clone().add(g)),y=new x,_=f.closestPointToPoint(m.startPoint,!0,y);return _?y:null},e.createByThreePoints=function(t,r,i){var s=e.computeCenterPoint(t,r,i);if(s){var a=s.distanceTo(t),o=new x().subVectors(t,s),l=new x().subVectors(r,s),c=Math.atan2(o.y,o.x),h=Math.atan2(l.y,l.x);return new e(s,a,c,h,x.Z_AXIS)}},Object.defineProperty(e.prototype,"center",{get:function(){return this._center},set:function(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._startAngle},set:function(t){this._startAngle=T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endAngle",{get:function(){return this._endAngle},set:function(t){this._endAngle=this.startAngle==0&&t==G?t:T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaAngle",{get:function(){return T.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normal",{get:function(){return this._normal},set:function(t){this._normal=new x(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refVec",{get:function(){return this._refVec},set:function(t){this._refVec=new x(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midPoint",{get:function(){var t=this.startAngle,r=this.deltaAngle;this.closed&&(t=0,r=G);var i=t+r*.5;return this.getPointAtAngle(i)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"area",{get:function(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)},enumerable:!1,configurable:!0}),e.prototype.nearestPoint=function(t){var r=new x(t.x,t.y,t.z||0),i=this.center,s=this.normal,a=r.clone().sub(i),o=a.dot(s),l=r.clone().sub(s.clone().multiplyScalar(o)),c=l.clone().sub(i);if(c.lengthSq()===0)return this.startPoint.clone();c.normalize().multiplyScalar(this.radius);var h=i.clone().add(c),d=this.getAngle(h.clone()),p=this.startAngle,g=this.deltaAngle,f=T.normalizeAngle(d-p);f<0&&(f=0),f>g&&(f=g);var m=this.getPointAtAngle(p+f),y=m.distanceTo(r),_=this.startPoint.distanceTo(r),P=this.endPoint.distanceTo(r);return _<y&&_<=P?this.startPoint.clone():P<y&&P<_?this.endPoint.clone():m},e.prototype.tangentPoints=function(t){var r,i,s=[],a=new x(t.x,t.y,t.z||0),o=this.center,l=this.normal,c=this.radius,h=a.clone().sub(o),d=h.dot(l),p=a.clone().sub(l.clone().multiplyScalar(d)),g=o.clone(),f=p.clone().sub(g),m=f.length();if(m<c)return s;var y=Math.acos(c/m),_=this.getAngle(p.clone()),P=[_+y,_-y];try{for(var L=Ui(P),S=L.next();!S.done;S=L.next()){var A=S.value,N=T.normalizeAngle(A-this.startAngle);N>=0&&N<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+N))}}catch(C){r={error:C}}finally{try{S&&!S.done&&(i=L.return)&&i.call(L)}finally{if(r)throw r.error}}return s},e.prototype.perpendicularPoints=function(t){var r,i,s=[],a=new x(t.x,t.y,t.z||0),o=this.center,l=this.normal,c=this.radius,h=a.clone().sub(o),d=h.dot(l),p=a.clone().sub(l.clone().multiplyScalar(d)),g=p.clone().sub(o);if(g.lengthSq()<1e-24)return s;g.normalize();var f=[o.clone().add(g.clone().multiplyScalar(c)),o.clone().sub(g.clone().multiplyScalar(c))];try{for(var m=Ui(f),y=m.next();!y.done;y=m.next()){var _=y.value,P=this.getAngle(_.clone()),L=T.normalizeAngle(P-this.startAngle);L>=0&&L<=this.deltaAngle&&s.push(new b(_.x,_.y,_.z||0))}}catch(S){r={error:S}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}return s},e.prototype.nearestTangentPoint=function(t){var r=this.tangentPoints(t);if(r.length===0)return null;var i=new b(t.x,t.y,t.z||0);return r.length===1||r[0].distanceTo(i)<r[1].distanceTo(i)?r[0]:r[1]},e.prototype.calculateBoundingBox=function(){for(var t,r,i=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)T.isBetweenAngle(s,this.startAngle,this.endAngle)&&i.push(s);var a=1/0,o=1/0,l=1/0,c=-1/0,h=-1/0,d=-1/0;try{for(var p=Ui(i),g=p.next();!g.done;g=p.next()){var f=g.value,m=this.getPointAtAngle(f);m.x<a&&(a=m.x),m.y<o&&(o=m.y),m.z<l&&(l=m.z),m.x>c&&(c=m.x),m.y>h&&(h=m.y),m.z>d&&(d=m.z)}}catch(y){t={error:y}}finally{try{g&&!g.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}return new R({x:a,y:o,z:l},{x:c,y:h,z:d})},Object.defineProperty(e.prototype,"closed",{get:function(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0},enumerable:!1,configurable:!0}),e.prototype.getPoints=function(t){var r=[],i=this.deltaAngle,s=this.startAngle;this.closed&&(i=G,s=0);for(var a=0;a<=t;a++){var o=s+i*(a/t),l=this.getPointAtAngle(o);r.push(l)}return r},e.prototype.transform=function(t){var r=this.center.clone().applyMatrix4(t),i=this.startPoint.clone().applyMatrix4(t),s=this.endPoint.clone().applyMatrix4(t),a=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(t),o=new x(i).sub(r).normalize(),l=r.distanceTo(i),c=new x().crossVectors(new x(i).sub(r),new x(a).sub(r)).normalize();c.lengthSq()===0&&(c=this.normal.clone().transformDirection(t));var h=function(d){var p=new x(d).sub(r);return Math.atan2(p.dot(Ja.crossVectors(c,o)),p.dot(o))};return this.center=r,this.radius=l,this.normal=c,this.refVec=o,this.startAngle=0,this.endAngle=this.closed?G:h(s),this._boundingBoxNeedsUpdate=!0,this},e.prototype.copy=function(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)},e.prototype.getAngle=function(t){return t.sub(this.center),Math.atan2(t.dot(Ja.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))},e.prototype.getPointAtAngle=function(t){var r=this.normal,i=this.refVec,s={x:r.y*i.z-r.z*i.y,y:r.z*i.x-r.x*i.z,z:r.x*i.y-r.y*i.x},a=this.center,o=this.radius;return new b(a.x+o*(i.x*Math.cos(t)+s.x*Math.sin(t)),a.y+o*(i.y*Math.cos(t)+s.y*Math.sin(t)),a.z+o*(i.z*Math.cos(t)+s.z*Math.sin(t)))},Object.defineProperty(e.prototype,"plane",{get:function(){var t=new x(this.center).distanceTo(Rs);return new Bs(this.normal,t)},enumerable:!1,configurable:!0}),e.prototype.offset=function(t){var r=this.radius+t;return r<=0?null:new e(this.center,r,this.startAngle,this.endAngle,this.normal,this.refVec)},e}(fr),Ja=new x,wu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),An=function(n){wu(e,n);function e(t,r,i,s,a,o,l){s===void 0&&(s=0),a===void 0&&(a=G),o===void 0&&(o=!1),l===void 0&&(l=0);var c=n.call(this)||this;return c.center=t,c.majorAxisRadius=r,c.minorAxisRadius=i,(a-s)%G==0?(c.startAngle=0,c.endAngle=G):(c.startAngle=s,c.endAngle=a),c.clockwise=o,c.rotation=l,c}return Object.defineProperty(e.prototype,"center",{get:function(){return this._center},set:function(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._startAngle},set:function(t){this._startAngle=T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endAngle",{get:function(){return this._endAngle},set:function(t){this._endAngle=this.startAngle==0&&t==G?t:T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwise",{get:function(){return this._clockwise},set:function(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaAngle",{get:function(){return T.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){for(var t=100,r=1/0,i=1/0,s=-1/0,a=-1/0,o=0;o<=t;o++){var l=this.getPoint(o/t);r=Math.min(r,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x),a=Math.max(a,l.y)}return new xe({x:r,y:i},{x:s,y:a})},Object.defineProperty(e.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),e.prototype.getPoint=function(t){for(var r=Math.PI*2,i=this.endAngle-this.startAngle,s=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(s?i=0:i=r),this.clockwise===!0&&!s&&(i===r?i=-r:i=i-r);var a=this.startAngle+t*i,o=this.center.x+this.majorAxisRadius*Math.cos(a),l=this.center.y+this.minorAxisRadius*Math.sin(a);if(this.rotation!==0){var c=Math.cos(this.rotation),h=Math.sin(this.rotation),d=o-this.center.x,p=l-this.center.y;o=d*c-p*h+this.center.x,l=d*h+p*c+this.center.y}return new E(o,l)},e.prototype.transform=function(t){var r=t,i=new E(this.center).applyMatrix2d(r),s=new b(i.x,i.y,this.center.z),a=this.getPointAtAngle(0).clone().applyMatrix2d(r),o=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(r),l=new E(a).sub(i),c=new E(o).sub(i),h=l.length(),d=c.length(),p=Math.atan2(l.y,l.x),g=l.clone().normalize(),f=c.clone().normalize(),m=function(P){var L=new E(P).sub(i),S=L.dot(g),A=L.dot(f);return T.normalizeAngle(Math.atan2(A/d,S/h))},y=r.determinant()<0?!this.clockwise:this.clockwise,_=this.closed?new e(s,h,d,0,G,y,p):new e(s,h,d,m(this.startPoint.clone().applyMatrix2d(r)),m(this.endPoint.clone().applyMatrix2d(r)),y,p);return this.center=_.center,this.majorAxisRadius=_.majorAxisRadius,this.minorAxisRadius=_.minorAxisRadius,this._startAngle=_._startAngle,this._endAngle=_._endAngle,this._clockwise=_._clockwise,this.rotation=_.rotation,this._boundingBoxNeedsUpdate=!0,this},e.prototype.getPointAtAngle=function(t){return this.getPoint(this.closed?t/G:T.normalizeAngle(t-this.startAngle)/this.deltaAngle)},e.prototype.copy=function(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this},e.prototype.clone=function(){return new e(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)},e.prototype.getFocusPoints=function(){var t=Math.max(this.majorAxisRadius,this.minorAxisRadius),r=Math.min(this.majorAxisRadius,this.minorAxisRadius);if(t-r<1e-9)return[];var i=Math.sqrt(t*t-r*r),s=Math.cos(this.rotation),a=Math.sin(this.rotation),o=this.majorAxisRadius>=this.minorAxisRadius,l=o?s:-a,c=o?a:s;return[new E(this.center.x-i*l,this.center.y-i*c),new E(this.center.x+i*l,this.center.y+i*c)]},e.prototype.getQuadrantPoints=function(){return this.closed?[this.getPoint(0),this.getPoint(.25),this.getPoint(.5),this.getPoint(.75)]:[]},e.prototype.nearestPoint=function(t){for(var r=new E(t.x,t.y),i=this.getPoint(0),s=r.distanceToSquared(i),a=72,o=1;o<=a;o++){var l=this.getPoint(o/a),c=r.distanceToSquared(l);c<s&&(s=c,i=l)}return i},e.prototype.tangentPoints=function(t){var r=this,i=this._projectPointToLocal(t),s=this._findSnapAngles(i,function(a,o,l,c){var h=-r.majorAxisRadius*c,d=r.minorAxisRadius*l;return(a-i.x)*d-(o-i.y)*h});return s.map(function(a){return r.getPointAtAngle(a)})},e.prototype.perpendicularPoints=function(t){var r=this,i=this._projectPointToLocal(t),s=this._findSnapAngles(i,function(a,o,l,c){var h=r.minorAxisRadius*l,d=r.majorAxisRadius*c;return(a-i.x)*d-(o-i.y)*h});return s.map(function(a){return r.getPointAtAngle(a)})},e.prototype._projectPointToLocal=function(t){var r=t.x-this.center.x,i=t.y-this.center.y,s=Math.cos(-this.rotation),a=Math.sin(-this.rotation);return{x:r*s-i*a,y:r*a+i*s}},e.prototype._findSnapAngles=function(t,r,i){i===void 0&&(i=144);for(var s=this.majorAxisRadius,a=this.minorAxisRadius,o=this.startAngle,l=this.deltaAngle,c=[],h=function(S){var A=Math.cos(S),N=Math.sin(S);return r(s*A,a*N,A,N)},d=o,p=h(d),g=1;g<=i;g++){var f=o+l*g/i,m=h(f);if(Math.abs(p)<1e-10&&c.push(d),p*m<0){for(var y=d,_=f,P=0;P<32;P++){var L=(y+_)/2;h(y)*h(L)<=0?_=L:y=L}c.push((y+_)/2)}d=f,p=m}return c},e}(Ln),vu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Pu=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},hl=function(n){vu(e,n);function e(t,r,i,s,a,o,l){o===void 0&&(o=0),l===void 0&&(l=G);var c=n.call(this)||this;c.center=t,c.normal=r,c.majorAxis=i,c.majorAxisRadius=s,c.minorAxisRadius=a;var h=Math.abs(l-o);return Math.abs(h-G)<1e-10||Math.abs(h-2*G)<1e-10?(c.startAngle=0,c.endAngle=G):(c.startAngle=o,c.endAngle=l),c}return Object.defineProperty(e.prototype,"center",{get:function(){return this._center},set:function(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._startAngle},set:function(t){this._startAngle=T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endAngle",{get:function(){return this._endAngle},set:function(t){this._endAngle=this.startAngle==0&&t==G?t:T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaAngle",{get:function(){var t=this.endAngle-this.startAngle;return Math.abs(t-G)<1e-10?G:T.normalizeAngle(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normal",{get:function(){return this._normal},set:function(t){this._normal=new x(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorAxis",{get:function(){return this._majorAxis},set:function(t){this._majorAxis=new x(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorAxis",{get:function(){return new x().crossVectors(this.normal,this.majorAxis).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midPoint",{get:function(){var t=this.startAngle,r=this.deltaAngle;(this.closed||Math.abs(r-G)<1e-10)&&(t=0,r=G);var i=t+r/2;return this.getPointAtAngle(i)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCircular",{get:function(){return q.equal(this.majorAxisRadius,this.minorAxisRadius)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);for(var t=1e3,r=this.deltaAngle/t,i=0,s=this.getPointAtAngle(this.startAngle),a=1;a<=t;a++){var o=this.startAngle+a*r,l=this.getPointAtAngle(o),c=l.x-s.x,h=l.y-s.y,d=l.z-s.z;i+=Math.sqrt(c*c+h*h+d*d),s=l}return i},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"area",{get:function(){var t=this.majorAxisRadius,r=this.minorAxisRadius,i=this.startAngle,s=i+this.deltaAngle;if(Math.abs(this.deltaAngle-G)<1e-10)return Math.PI*t*r;var a=t*r/2*(s-i-(Math.sin(s)*Math.cos(s)-Math.sin(i)*Math.cos(i)));return Math.abs(a)},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t,r;if(this.majorAxis.equals(x.X_AXIS)||this.majorAxis.equals(x.Y_AXIS)||this.majorAxis.isParallelTo(x.X_AXIS)||this.majorAxis.isParallelTo(x.Y_AXIS)){for(var i=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)T.isBetweenAngle(s,this.startAngle,this.endAngle)&&i.push(s);var a=1/0,o=1/0,l=1/0,c=-1/0,h=-1/0,d=-1/0;try{for(var p=Pu(i),g=p.next();!g.done;g=p.next()){var f=g.value,m=this.getPointAtAngle(f);m.x<a&&(a=m.x),m.y<o&&(o=m.y),m.z<l&&(l=m.z),m.x>c&&(c=m.x),m.y>h&&(h=m.y),m.z>d&&(d=m.z)}}catch(_){t={error:_}}finally{try{g&&!g.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}return new R({x:a,y:o,z:l},{x:c,y:h,z:d})}else{for(var y=100,a=1/0,o=1/0,l=1/0,c=-1/0,h=-1/0,d=-1/0,s=0;s<=y;s++){var f=this.startAngle+this.deltaAngle*(s/y),m=this.getPointAtAngle(f);a=Math.min(a,m.x),o=Math.min(o,m.y),l=Math.min(l,m.z),c=Math.max(c,m.x),h=Math.max(h,m.y),d=Math.max(d,m.z)}return new R({x:a,y:o,z:l},{x:c,y:h,z:d})}},Object.defineProperty(e.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),e.prototype.getPoints=function(t){t===void 0&&(t=100);var r=[],i=this.deltaAngle,s=this.startAngle;this.closed&&(i=G,s=0);for(var a=0;a<=t;a++){var o=s+i*(a/t),l=this.getPointAtAngle(o);r.push(l)}return r},e.prototype.getPointAtAngle=function(t){var r=Math.cos(t),i=Math.sin(t),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(i),a=this.majorAxis.clone().multiplyScalar(r*this.majorAxisRadius).add(s);return new b(this.center.x+a.x,this.center.y+a.y,this.center.z+a.z)},e.prototype.nearestPoint=function(t,r){r===void 0&&(r=72);for(var i=new b(t.x,t.y,t.z||0),s=this.getPointAtAngle(this.startAngle),a=i.distanceToSquared(s),o=1;o<=r;o++){var l=this.startAngle+this.deltaAngle*o/r,c=this.getPointAtAngle(l),h=i.distanceToSquared(c);h<a&&(a=h,s=c)}var d=i.distanceToSquared(this.startPoint),p=i.distanceToSquared(this.endPoint);return d<a&&d<=p?this.startPoint.clone():p<a&&p<d?this.endPoint.clone():s.clone()},e.prototype.tangentPoints=function(t){var r=this,i=this._projectPointToLocalPlane(t),s=this._findSnapParameterAngles(function(a,o,l,c){var h=-r.majorAxisRadius*c,d=r.minorAxisRadius*l;return(a-i.x)*d-(o-i.y)*h});return s.map(function(a){return r.getPointAtAngle(a)})},e.prototype.perpendicularPoints=function(t){var r=this,i=this._projectPointToLocalPlane(t),s=this._findSnapParameterAngles(function(a,o,l,c){var h=r.minorAxisRadius*l,d=r.majorAxisRadius*c;return(a-i.x)*d-(o-i.y)*h});return s.map(function(a){return r.getPointAtAngle(a)})},e.prototype._projectPointToLocalPlane=function(t){var r=new b(t.x,t.y,t.z||0),i=new x(r).sub(this.center),s=i.dot(this.normal);return i.sub(this.normal.clone().multiplyScalar(s)),{x:i.dot(this.majorAxis),y:i.dot(this.minorAxis)}},e.prototype._findSnapParameterAngles=function(t,r){r===void 0&&(r=144);for(var i=this.majorAxisRadius,s=this.minorAxisRadius,a=this.startAngle,o=this.deltaAngle,l=[],c=function(L){var S=Math.cos(L),A=Math.sin(L);return t(i*S,s*A,S,A)},h=a,d=c(h),p=1;p<=r;p++){var g=a+o*p/r,f=c(g);if(Math.abs(d)<1e-10&&l.push(h),d*f<0){for(var m=h,y=g,_=0;_<32;_++){var P=(m+y)/2;c(m)*c(P)<=0?y=P:m=P}l.push((m+y)/2)}h=g,d=f}return l},e.prototype.contains=function(t){var r=new x(t).sub(this.center),i=r.dot(this.majorAxis),s=r.dot(this.minorAxis),a=i/this.majorAxisRadius,o=s/this.minorAxisRadius;return a*a+o*o<=1},e.prototype.transform=function(t){var r=t,i=this.center.clone().applyMatrix4(r),s=this.getPointAtAngle(0).clone().applyMatrix4(r),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(r),o=new x(s).sub(i),l=new x(a).sub(i),c=o.length(),h=l.length(),d=o.clone().normalize(),p=new x().crossVectors(o,l).normalize(),g=new x().crossVectors(p,d).normalize();g.dot(l)<0&&(p.negate(),g=new x().crossVectors(p,d).normalize());var f=function(y){var _=new x(y).sub(i),P=_.dot(d),L=_.dot(g);return T.normalizeAngle(Math.atan2(L/h,P/c))},m=this.closed?new e(i,p,d,c,h,0,G):new e(i,p,d,c,h,f(this.startPoint.clone().applyMatrix4(r)),f(this.endPoint.clone().applyMatrix4(r)));return this.center=m.center,this.normal=m.normal,this.majorAxis=m.majorAxis,this.majorAxisRadius=m.majorAxisRadius,this.minorAxisRadius=m.minorAxisRadius,this._startAngle=m._startAngle,this._endAngle=m._endAngle,this._boundingBoxNeedsUpdate=!0,this},e.prototype.copy=function(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)},Object.defineProperty(e.prototype,"plane",{get:function(){var t=new x(this.center).distanceTo(Rs);return new Bs(this.normal,t)},enumerable:!1,configurable:!0}),e.prototype.offset=function(t){var r=this.majorAxisRadius+t,i=this.minorAxisRadius+t;return r<=0||i<=0?null:new e(this.center,this.normal,this.majorAxis,r,i,this.startAngle,this.endAngle)},e}(fr),Au=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),_t=function(n){Au(e,n);function e(t,r){var i=n.call(this)||this;return i._start=new E(t),i._end=new E(r),i}return Object.defineProperty(e.prototype,"startPoint",{get:function(){return this._start},set:function(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this._end},set:function(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),e.prototype.getPoints=function(){return[this.startPoint,this.endPoint]},Object.defineProperty(e.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t=new E(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),r=new E(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new xe(t,r)},e.prototype.transform=function(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(e.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.copy=function(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this._start.clone(),this._end.clone())},e.prototype.project=function(t){var r=this._end.x-this._start.x,i=this._end.y-this._start.y,s=r*r+i*i;if(s<1e-18)return this._start.clone();var a=((t.x-this._start.x)*r+(t.y-this._start.y)*i)/s;return a=Math.max(0,Math.min(1,a)),new E(this._start.x+a*r,this._start.y+a*i)},e.prototype.nearestPoint=function(t){return this.project(t)},e}(Ln),Su=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),$i=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},qi=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},ir=function(n){Su(e,n);function e(t){t===void 0&&(t=[]);var r=n.call(this)||this;return r._curves=t,r}return Object.defineProperty(e.prototype,"curves",{get:function(){return this._curves},enumerable:!1,configurable:!0}),e.buildFromEdges=function(t,r){if(r===void 0&&(r=.001),t.length===0)return[];for(var i=qi([],$i(t),!1),s=[],a=r*r,o=function(f,m){var y=f.x-m.x,_=f.y-m.y;return y*y+_*_<=a};i.length>0;){var l=[],c=i.shift();l.push(c);var h=e.getEdgeStartPoint(c),d=e.getEdgeEndPoint(c);if(!o(h,d))for(;i.length>0;){var p=e.findConnectingEdge(i,d,a);if(p.index<0)break;var g=i.splice(p.index,1)[0];if(p.reverse&&(g=e.reverseEdge(g)),l.push(g),d=e.getEdgeEndPoint(g),o(d,h))break}s.push(new e(l))}return s},e.prototype.add=function(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(e.prototype,"numberOfEdges",{get:function(){return this._curves.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){if(this._curves.length>0){var t=this._curves[0].startPoint;return new E(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.startPoint},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){var t=0;return this._curves.forEach(function(r){t+=r.length}),t},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t=this.getPoints(100),r=new xe;return r.setFromPoints(t),r},e.prototype.transform=function(t){var r=new D().set(t.elements[0],t.elements[3],0,t.elements[6],t.elements[1],t.elements[4],0,t.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(function(i){i instanceof $e?i.transform(r):i.transform(t)}),this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this._curves.map(function(t){return t.clone()}))},Object.defineProperty(e.prototype,"closed",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.getPoints=function(t){var r=[];return this.curves.forEach(function(i){i.getPoints(t).forEach(function(s){r.push(new E(s.x,s.y))})}),r},e.findConnectingEdge=function(t,r,i){for(var s=-1,a=!1,o=Number.POSITIVE_INFINITY,l=0;l<t.length;l++){var c=t[l],h=e.getEdgeStartPoint(c),d=e.getEdgeEndPoint(c),p=r.x-h.x,g=r.y-h.y,f=p*p+g*g;f<o&&(o=f,s=l,a=!1);var m=r.x-d.x,y=r.y-d.y,_=m*m+y*y;_<o&&(o=_,s=l,a=!0)}return o>i?{index:-1,reverse:!1}:{index:s,reverse:a}},e.getEdgeStartPoint=function(t){var r=t.startPoint;return new E(r.x,r.y)},e.getEdgeEndPoint=function(t){var r=t.endPoint;return new E(r.x,r.y)},e.reverseEdge=function(t){return t instanceof _t?new _t(t.endPoint,t.startPoint):t instanceof Re?new Re(t.center,t.radius,t.endAngle,t.startAngle,!t.clockwise):t instanceof An?new An(t.center,t.majorAxisRadius,t.minorAxisRadius,t.endAngle,t.startAngle,!t.clockwise,t.rotation):t instanceof $e?e.reverseSplineEdge(t):t},e.reverseSplineEdge=function(t){var r=qi([],$i(t.controlPoints),!1).reverse(),i=t.knots,s=i[0],a=i[i.length-1],o=i.map(function(h){return s+a-h}).reverse(),l=t.weights,c=l.length>0?qi([],$i(l),!1).reverse():void 0;return new $e(r,o,c,t.degree,t.closed)},e}(Ln),Lu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ki=function(){function n(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}return n.prototype.init=function(e,t,r,i){this.c0=e,this.c1=r,this.c2=-3*e+3*t-2*r-i,this.c3=2*e-2*t+r+i},n.prototype.initCatmullRom=function(e,t,r,i,s){this.init(t,r,s*(r-e),s*(i-t))},n.prototype.initNonuniformCatmullRom=function(e,t,r,i,s,a,o){var l=(t-e)/s-(r-e)/(s+a)+(r-t)/a,c=(r-t)/a-(i-t)/(a+o)+(i-r)/o;l*=a,c*=a,this.init(t,r,l,c)},n.prototype.calc=function(e){var t=e*e,r=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*r},n}(),dl=function(n){Lu(e,n);function e(t,r,i,s){t===void 0&&(t=[]),r===void 0&&(r=!1),i===void 0&&(i="centripetal"),s===void 0&&(s=.5);var a=n.call(this)||this;return a.isCatmullRomCurve3d=!0,a.type="CatmullRomCurve3d",a._tmp=new x,a._px=new Ki,a._py=new Ki,a._pz=new Ki,a._points=t.map(function(o){return new b(o)}),a._closed=r,a._curveType=i,a._tension=s,a}return Object.defineProperty(e.prototype,"points",{get:function(){return this._points},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"curveType",{get:function(){return this._curveType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tension",{get:function(){return this._tension},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){return this._points.length>0?this._points[0]:new b},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this._points.length>0?this._points[this._points.length-1]:new b},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){if(this._points.length<2)return 0;for(var t=0,r=1;r<this._points.length;r++)t+=this._points[r-1].distanceTo(this._points[r]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t},enumerable:!1,configurable:!0}),e.prototype.getPoint=function(t,r){r===void 0&&(r=new b);var i=r,s=this._points,a=s.length;if(a===0)return i.set(0,0,0);if(a===1)return i.copy(s[0]);var o=(a-(this._closed?0:1))*t,l=Math.floor(o),c=o-l;this._closed?l+=l>0?0:(Math.floor(Math.abs(l)/a)+1)*a:c===0&&l===a-1&&(l=a-2,c=1);var h,d;this._closed||l>0?h=s[(l-1)%a]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),h=new b(this._tmp.x,this._tmp.y,this._tmp.z));var p=s[l%a],g=s[(l+1)%a];if(this._closed||l+2<a?d=s[(l+2)%a]:(this._tmp.subVectors(s[a-1],s[a-2]).add(s[a-1]),d=new b(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){var f=this._curveType==="chordal"?.5:.25,m=Math.pow(h.distanceToSquared(p),f),y=Math.pow(p.distanceToSquared(g),f),_=Math.pow(g.distanceToSquared(d),f);y<1e-4&&(y=1),m<1e-4&&(m=y),_<1e-4&&(_=y),this._px.initNonuniformCatmullRom(h.x,p.x,g.x,d.x,m,y,_),this._py.initNonuniformCatmullRom(h.y,p.y,g.y,d.y,m,y,_),this._pz.initNonuniformCatmullRom(h.z,p.z,g.z,d.z,m,y,_)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(h.x,p.x,g.x,d.x,this._tension),this._py.initCatmullRom(h.y,p.y,g.y,d.y,this._tension),this._pz.initCatmullRom(h.z,p.z,g.z,d.z,this._tension));return i.set(this._px.calc(c),this._py.calc(c),this._pz.calc(c)),i},e.prototype.getPoints=function(t){for(var r=[],i=0;i<=t;i++)r.push(this.getPoint(i/t));return r},e.prototype.setPoints=function(t){this._points=t.map(function(r){return new b(r)}),this._boundingBoxNeedsUpdate=!0},e.prototype.setClosed=function(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)},e.prototype.setCurveType=function(t){this._curveType=t},e.prototype.setTension=function(t){this._tension=t},e.prototype.clone=function(){return new e(this._points.map(function(t){return t.clone()}),this._closed,this._curveType,this._tension)},e.prototype.transform=function(t){return this._points=this._points.map(function(r){var i=new b;return i.copy(r),i.applyMatrix4(t),i}),this._boundingBoxNeedsUpdate=!0,this},e.prototype.calculateBoundingBox=function(){if(this._points.length===0)return new R;var t=new R;return this._points.forEach(function(r){t.expandByPoint(r)}),t},e}(fr),pn=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},fn=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))};function eo(n,e){var t,r,i=n.x-e[0],s=n.y-e[1],a=((t=n.z)!==null&&t!==void 0?t:0)-((r=e[2])!==null&&r!==void 0?r:0);return i*i+s*s+a*a}var je=function(){function n(e,t,r,i){this._degree=e,this._knots=fn([],pn(t),!1),this._controlPoints=r.map(function(s){return{x:s.x,y:s.y,z:s.z}}),this._weights=i?fn([],pn(i),!1):new Array(r.length).fill(1)}return n.prototype.degree=function(){return this._degree},n.prototype.knots=function(){return fn([],pn(this._knots),!1)},n.prototype.controlPoints=function(){return this._controlPoints.map(function(e){return{x:e.x,y:e.y,z:e.z}})},n.prototype.weights=function(){return fn([],pn(this._weights),!1)},n.prototype.clone=function(){return new n(this._degree,this._knots,this._controlPoints,this._weights)},n.prototype.point=function(e){return this.evaluate(e).point},n.prototype.evaluate=function(e){var t=this._controlPoints.map(function(r){return[r.x,r.y,r.z]});return Ld(e,this._degree,this._knots,t,this._weights)},n.prototype.signedPlanarCurvatureAt=function(e){var t=this.evaluate(e);return Id(t.deriv1,t.deriv2)},n.prototype.getOffsetSamplePath2d=function(e,t){var r=this;t===void 0&&(t=512);for(var i=Math.abs(e),s=this.getParameterRange(),a=s.start,o=s.end,l=this.length(),c=Math.max(64,Math.ceil(l/Math.max(i*.2,1e-6))),h=Iu(a,o,Math.min(c,t)),d=0;d<8&&h.length<t;d++){for(var p=[],g=0;g<h.length-1;g++){var f=h[g],m=h[g+1],y=(f+m)/2,_=Math.max(Math.abs(this.signedPlanarCurvatureAt(f)),Math.abs(this.signedPlanarCurvatureAt(m)),Math.abs(this.signedPlanarCurvatureAt(y)));i*_>.85&&p.push(y)}if(p.length===0)break;if(h=Eu(h,p),h.length>t){h=h.slice(0,t);break}}var P=[],L=[];return h.forEach(function(S){var A=r.evaluate(S);P.push(new E(A.point[0],A.point[1]));var N=A.deriv1[0],C=A.deriv1[1],V=Math.hypot(N,C);L.push(V>1e-10?new E(N/V,C/V):new E(1,0))}),{points:P,tangents:L}},n.prototype.length=function(){var e=this._controlPoints.map(function(t){return[t.x,t.y,t.z]});return Qo(this._degree,this._knots,e,this._weights)},n.byKnotsControlPointsWeights=function(e,t,r,i){return new n(e,t,r,i)},n.byPoints=function(e,t,r,i,s){r===void 0&&(r="Uniform");var a=Ds(e,t,r,i,s),o=a.controlPoints.map(function(l){return{x:l[0],y:l[1],z:l[2]}});return new n(t,a.knots,o,a.weights)},n.prototype.getParameterRange=function(){var e=this._knots[this._degree],t=this._knots[this._knots.length-this._degree-1];return{start:e,end:t}},n.prototype.getPoints=function(e){for(var t=[],r=this.getParameterRange(),i=r.start,s=r.end,a=0;a<=e;a++){var o=i+(s-i)*(a/e);t.push(this.point(o))}return t},n.prototype.isClosed=function(e){e===void 0&&(e=1e-6);var t=this.getParameterRange(),r=t.start,i=t.end,s=this.point(r),a=this.point(i),o=s[0]-a[0],l=s[1]-a[1],c=s[2]-a[2];return Math.sqrt(o*o+l*l+c*c)<e},n.createFitPointsForClosedCurve=function(e){if(e.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");var t=new dl(e,!0,"centripetal"),r=Math.max(50,e.length*2);return t.getPoints(r)},n.prototype.nearestPoint=function(e,t){var r;t===void 0&&(t=64);for(var i=this.getParameterRange(),s=i.start,a=i.end,o=this.point(s),l=eo(e,o),c=0;c<=t;c++){var h=s+(a-s)*c/t,d=this.point(h),p=eo(e,d);p<l&&(l=p,o=d)}return{x:o[0],y:o[1],z:(r=o[2])!==null&&r!==void 0?r:0}},n.createClosedCurve=function(e,t,r){r===void 0&&(r="Chord");var i=this.createFitPointsForClosedCurve(e),s=i.map(function(a){return[a.x,a.y,a.z]});return n.byPoints(s,t,r)},n}();function Iu(n,e,t){if(t<2)return[n,e];for(var r=[],i=0;i<t;i++)r.push(i===t-1?e:n+(e-n)*i/(t-1));return r}function Eu(n,e){var t=fn(fn([],pn(n),!1),pn(e),!1).sort(function(i,s){return i-s}),r=[];return t.forEach(function(i){var s=r[r.length-1];(s===void 0||Math.abs(s-i)>1e-10)&&r.push(i)}),r}var Tu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),to=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s},no=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},$e=function(n){Tu(e,n);function e(t,r,i,s,a,o){var l=n.call(this)||this,c=arguments.length;if(l._degree=3,l._closed=!1,Array.isArray(r)){if(c<2||c>5)throw Pe.ILLEGAL_PARAMETERS;l._controlPoints=t;var g=void 0,f=3,m=!1;if(c>=3&&(Array.isArray(i)?(g=i,c>=4&&(f=s||3),c>=5&&(m=a)):i!==void 0&&(f=i||3,c>=4&&(m=s))),i===void 0&&c>=4&&(f=s||3,c>=5&&(m=a)),l._degree=f,l._closed=m,l._controlPoints.length<l._degree+1)throw Pe.ILLEGAL_PARAMETERS;l._nurbsCurve=je.byKnotsControlPointsWeights(l._degree,r,l._controlPoints,g)}else{if(c<2||c>6)throw Pe.ILLEGAL_PARAMETERS;l._fitPoints=t,l._knotParameterization=r,c>=3&&(l._degree=i||3);var h=typeof s=="boolean";c>=4&&h&&(l._closed=s),h?(c>=5&&(l._startTangent=a),c>=6&&(l._endTangent=o)):(c>=4&&(l._startTangent=s),c>=5&&(l._endTangent=a)),l._closed&&(l._startTangent=void 0,l._endTangent=void 0);var d=(l._startTangent?1:0)+(l._endTangent?1:0);if(l._fitPoints.length+d<l._degree+1)throw Pe.ILLEGAL_PARAMETERS;if(l._closed)l._nurbsCurve=je.createClosedCurve(l._fitPoints,l._degree,l._knotParameterization);else{var p=l.toNurbsPoints(l._fitPoints);l._nurbsCurve=je.byPoints(p,l._degree,l._knotParameterization,l._startTangent?l.toNurbsPoint(l._startTangent):void 0,l._endTangent?l.toNurbsPoint(l._endTangent):void 0)}l._controlPoints=l.toGePoints(l._nurbsCurve.controlPoints().map(function(y){return[y.x,y.y,y.z||0]}))}return l}return e.prototype.buildCurve=function(){if(this._fitPoints&&this._knotParameterization){if(this._closed){var t=je.createFitPointsForClosedCurve(this._fitPoints),r=this.toNurbsPoints(t);this._nurbsCurve=je.byPoints(r,this._degree,this._knotParameterization)}else{var r=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=je.byPoints(r,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(a){return[a.x,a.y,a.z||0]}))}else if(this._controlPoints)if(this._closed){var t=je.createFitPointsForClosedCurve(this._controlPoints),r=this.toNurbsPoints(t);this._nurbsCurve=je.byPoints(r,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(l){return[l.x,l.y,l.z||0]}))}else{var i=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=je.byKnotsControlPointsWeights(this._degree,i,this._controlPoints,s)}},e.prototype.setClosed=function(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())},Object.defineProperty(e.prototype,"degree",{get:function(){return this._degree},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"knotParameterization",{get:function(){return this._knotParameterization},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controlPoints",{get:function(){return this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z||0}})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fitPoints",{get:function(){var t;return(t=this._fitPoints)===null||t===void 0?void 0:t.map(function(r){return{x:r.x,y:r.y,z:r.z||0}})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"knots",{get:function(){return no([],to(this._nurbsCurve.knots()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"weights",{get:function(){return no([],to(this._nurbsCurve.weights()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){var t=this._nurbsCurve.knots(),r=this._nurbsCurve.degree(),i=t[r],s=this._nurbsCurve.point(i);return new b(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){var t=this._nurbsCurve.knots(),r=this._nurbsCurve.degree(),i=t[t.length-r-1],s=this._nurbsCurve.point(i);return new b(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._nurbsCurve.length()},enumerable:!1,configurable:!0}),e.prototype.nearestPoint=function(t,r){r===void 0&&(r=64);var i=this._nurbsCurve.nearestPoint(t,r);return new b(i.x,i.y,i.z||0)},e.prototype.evaluateAt=function(t){var r=this._nurbsCurve.point(t);return new b(r[0],r[1],r[2])},e.prototype.getFitPointAt=function(t){if(!this._fitPoints)throw new Error("No fit points in this spline");var r=this._fitPoints.length,i=t<0||t>=r?r-1:t,s=this._fitPoints[i];return{x:s.x,y:s.y,z:s.z||0}},e.prototype.getControlPointAt=function(t){var r=this._controlPoints.length,i=t<0||t>=r?r-1:t;return this._controlPoints[i]},e.prototype.getOffsetSamplePath2d=function(t){return this._nurbsCurve.getOffsetSamplePath2d(t)},e.prototype.getPoints=function(t){t===void 0&&(t=100);for(var r=this._nurbsCurve,i=[],s=r.knots(),a=this._nurbsCurve.degree(),o=s[a],l=s[s.length-a-1],c=(l-o)/(t-1),h=0;h<t;h++){var d=h===t-1?l:o+h*c,p=r.point(d);i.push(new b(p[0],p[1],p[2]))}return i},e.prototype.getCurvePoints=function(t,r){for(var i=[],s=t.knots(),a=t.degree(),o=s[a],l=s[s.length-a-1],c=(l-o)/(r-1),h=0;h<r;h++){var d=o+h*c;i.push(t.point(d))}return i},e.prototype.calculateBoundingBox=function(){var t=this.getPoints(100);return new R().setFromPoints(t)},Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},set:function(t){this.setClosed(t)},enumerable:!1,configurable:!0}),e.prototype.transform=function(t){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(function(s){return new b(s).applyMatrix4(t)}),this._startTangent&&(this._startTangent=new b(this._startTangent).transformDirection(t)),this._endTangent&&(this._endTangent=new b(this._endTangent).transformDirection(t)),this.buildCurve();else{var r=this._nurbsCurve.knots(),i=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(function(s){return new b(s).applyMatrix4(t)}),this._nurbsCurve=je.byKnotsControlPointsWeights(this._degree,r,this._controlPoints,i.length>0?i:void 0)}return this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return this._fitPoints&&this._knotParameterization?new e(this._fitPoints.map(function(t){return{x:t.x,y:t.y,z:t.z||0}}),this._knotParameterization,this._degree,this._closed,this._startTangent?{x:this._startTangent.x,y:this._startTangent.y,z:this._startTangent.z||0}:void 0,this._endTangent?{x:this._endTangent.x,y:this._endTangent.y,z:this._endTangent.z||0}:void 0):new e(this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z||0}}),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)},e.prototype.toNurbsPoints=function(t){var r=new Array(t.length);return t.forEach(function(i,s){r[s]=[i.x,i.y,i.z||0]}),r},e.prototype.toGePoints=function(t){var r=new Array(t.length);return t.forEach(function(i,s){r[s]={x:i[0],y:i[1],z:i[2]}}),r},e.prototype.toNurbsPoint=function(t){return[t.x,t.y,t.z||0]},e.createClosedSpline=function(t,r,i){if(r===void 0&&(r="Uniform"),i===void 0&&(i=3),t.length<i+1)throw new Error("At least ".concat(i+1," points are required for a degree ").concat(i," closed spline"));return new e(t,r,i,!0)},e}(fr);class mr{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}var nn=256,ul=[],ro=256,Ir;for(;nn--;)ul[nn]=(nn+256).toString(16).substring(1);function Cu(n){var e=0,t=11;if(!Ir||nn+t>ro*2)for(Ir="",nn=0;e<ro;e++)Ir+=ul[Math.random()*256|0];return Ir.substring(nn,nn+++t)}const Yr="TEMP_";let ys;function gl(n){ys=n}class Ge{constructor(e,t){if(e=e||{},this._attrs=new Po(e,t),this._xDataMap=new Map,!this._attrs.get("objectId"))try{this._attrs.set("objectId",this.database.generateHandle())}catch{this._attrs.set("objectId",this.generateTemporaryHandle())}}generateTemporaryHandle(){return Yr+Cu()}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e),e&&!e.startsWith(Yr)&&this.database.updateMaxHandle(e)}get isTemp(){const e=this.getAttrWithoutException("objectId");return!!e&&e.startsWith(Yr)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(e){this._attrs.set("extensionDictionary",e)}get database(){if(this._database)return this._database;if(ys)return ys().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(e){this._database=e}getXData(e){return this._xDataMap.get(e)}setXData(e){for(const t of e)t.code===Cs.ExtendedDataRegAppName&&this._xDataMap.set(t.value,e)}removeXData(e){this._xDataMap.delete(e)}createExtensionDictionary(){}close(){}clone(){const e=Object.create(Object.getPrototypeOf(this)),t=this,r=e;for(const i of Object.keys(t))i!=="_database"&&(r[i]=this.cloneValue(t[i]));return e.objectId=this.generateTemporaryHandle(),e}cloneValue(e){if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e))return e.map(i=>this.cloneValue(i));if(e instanceof Map){const i=new Map;for(const[s,a]of e.entries())i.set(this.cloneValue(s),this.cloneValue(a));return i}if(e instanceof Set){const i=new Set;for(const s of e.values())i.add(this.cloneValue(s));return i}if(ArrayBuffer.isView(e)){if(e instanceof DataView)return new DataView(e.buffer.slice(0));const i=e.constructor;return new i(e)}if(e instanceof ArrayBuffer)return e.slice(0);if("clone"in e&&typeof e.clone=="function")return e.clone();const t=Object.create(Object.getPrototypeOf(e)),r=e;for(const i of Object.keys(r))t[i]=this.cloneValue(r[i]);return t}dxfOut(...e){const[t,r=!1]=e;if(t.writeHandle(5,this.objectId),t.writeObjectId(330,this.ownerId),t.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(t),r)for(const i of this._xDataMap.values())t.writeResultBuffer(i);return this}dxfOutFields(e){return this}}class Xt extends Ge{constructor(e,t){e=e||{},ur(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var pl=(n=>(n[n.Any=0]="Any",n[n.Uniform=1]="Uniform",n))(pl||{});const Tt=class Tt extends Xt{static isModelSapceName(e){return e.toLowerCase()==Tt.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(e){return e.toLowerCase().startsWith(Tt.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new b,this._layoutId="",this._entities=new Map,this._blockInsertUnits=0,this._explodability=1,this._blockScaling=1,this._bmpPreview=void 0}get isModelSapce(){return Tt.isModelSapceName(this.name)}get isPaperSapce(){return Tt.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(e){this._origin.copy(e)}get layoutId(){return this._layoutId}set layoutId(e){this._layoutId=e}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(e){this._blockInsertUnits=e}get explodability(){return this._explodability}set explodability(e){this._explodability=e}get blockScaling(){return this._blockScaling}set blockScaling(e){this._blockScaling=e}get bmpPreview(){return this._bmpPreview}set bmpPreview(e){this._bmpPreview=e}appendEntity(e){const t=r=>{r.database=this.database,r.ownerId=this.objectId,this.database.ensureEntityStyleDefaults(r),this.database.commitObjectHandle(r,i=>this._entities.has(i)),r.resolveEffectiveProperties(),this._entities.set(r.objectId,r)};if(Array.isArray(e))for(let r=0;r<e.length;++r)t(e[r]);else t(e);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}removeEntity(e){const t=Array.isArray(e)?e:[e],r=[];return t.forEach(i=>{const s=this._entities.get(i);s&&r.push(s),this._entities.delete(i)}),r.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:r}),r.length>0}newIterator(){return new mr(this._entities)}getIdAt(e){return this._entities.get(e)}dxfOutBlockRecord(e){return e.writeStart("BLOCK_RECORD"),this.dxfOut(e),this}dxfOutBlockBegin(e){return e.writeStart("BLOCK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeString(8,"0"),e.writeSubclassMarker("AcDbBlockBegin"),e.writeString(2,this.name),e.writeInt16(70,0),e.writePoint3d(10,this.origin),e.writeString(3,this.name),this}dxfOutBlockEnd(e){return e.writeStart("ENDBLK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbBlockTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.blockInsertUnits),e.writeInt16(280,this.explodability),e.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&e.writeObjectId(340,this.layoutId),this}};Tt.MODEL_SPACE_NAME="*Model_Space",Tt.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let se=Tt;var fl=(n=>(n[n.kInches=0]="kInches",n[n.kMillimeters=1]="kMillimeters",n[n.kPixels=2]="kPixels",n))(fl||{}),ml=(n=>(n[n.k0degrees=0]="k0degrees",n[n.k90degrees=1]="k90degrees",n[n.k180degrees=2]="k180degrees",n[n.k270degrees=3]="k270degrees",n))(ml||{}),yl=(n=>(n[n.kDisplay=0]="kDisplay",n[n.kExtents=1]="kExtents",n[n.kLimits=2]="kLimits",n[n.kView=3]="kView",n[n.kWindow=4]="kWindow",n[n.kLayout=5]="kLayout",n))(yl||{}),Et=(n=>(n[n.kDraft=0]="kDraft",n[n.kPreview=1]="kPreview",n[n.kNormal=2]="kNormal",n[n.kPresentation=3]="kPresentation",n[n.kMaximum=4]="kMaximum",n[n.kCustom=5]="kCustom",n))(Et||{}),mn=(n=>(n[n.kAsDisplayed=0]="kAsDisplayed",n[n.kWireframe=1]="kWireframe",n[n.kHidden=2]="kHidden",n[n.kRendered=3]="kRendered",n[n.kVisualStyle=4]="kVisualStyle",n[n.kRenderPreset=5]="kRenderPreset",n))(mn||{}),_l=(n=>(n[n.kScaleToFit=0]="kScaleToFit",n[n.k1_128in_1ft=1]="k1_128in_1ft",n[n.k1_64in_1ft=2]="k1_64in_1ft",n[n.k1_32in_1ft=3]="k1_32in_1ft",n[n.k1_16in_1ft=4]="k1_16in_1ft",n[n.k3_32in_1ft=5]="k3_32in_1ft",n[n.k1_8in_1ft=6]="k1_8in_1ft",n[n.k3_16in_1ft=7]="k3_16in_1ft",n[n.k1_4in_1ft=8]="k1_4in_1ft",n[n.k3_8in_1ft=9]="k3_8in_1ft",n[n.k1_2in_1ft=10]="k1_2in_1ft",n[n.k3_4in_1ft=11]="k3_4in_1ft",n[n.k1in_1ft=12]="k1in_1ft",n[n.k3in_1ft=13]="k3in_1ft",n[n.k6in_1ft=14]="k6in_1ft",n[n.k1ft_1ft=15]="k1ft_1ft",n[n.k1_1=16]="k1_1",n[n.k1_2=17]="k1_2",n[n.k1_4=18]="k1_4",n[n.k1_5=19]="k1_5",n[n.k1_8=20]="k1_8",n[n.k1_10=21]="k1_10",n[n.k1_16=22]="k1_16",n[n.k1_20=23]="k1_20",n[n.k1_30=24]="k1_30",n[n.k1_40=25]="k1_40",n[n.k1_50=26]="k1_50",n[n.k1_100=27]="k1_100",n[n.k2_1=28]="k2_1",n[n.k4_1=29]="k4_1",n[n.k8_1=30]="k8_1",n[n.k10_1=31]="k10_1",n[n.k100_1=32]="k100_1",n[n.k1000_1=33]="k1000_1",n[n.k1and1_2in_1ft=34]="k1and1_2in_1ft",n))(_l||{});const Mu={0:0,1:1/1536,2:1/768,3:1/384,4:1/192,5:1/128,6:1/96,7:1/64,8:1/48,9:1/32,10:1/24,11:1/16,12:1/12,13:1/4,14:1/2,15:1,16:1,17:1/2,18:1/4,19:1/5,20:1/8,21:1/10,22:1/16,23:1/20,24:1/30,25:1/40,26:1/50,27:1/100,28:2,29:4,30:8,31:10,32:100,33:1e3,34:1/8};class bl extends Ge{constructor(e=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new E,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new E,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new xe,this._modelType=e,this._plotCentered=!1,this._plotHidden=!1,this._plotPaperUnits=1,this._plotPlotStyles=!0,this._plotRotation=0,this._plotType=5,this._plotViewportBorders=!1,this._printLineweights=!0,this._scaleLineweights=!1,this._drawViewportsFirst=!1,this._showPlotStyles=!0,this._shadePlotType=0,this._shadePlotResLevel=2,this._shadePlotCustomDpi=300,this._shadePlotId=void 0,this._stdScaleType=0,this._useStandardScale=!0}get plotSettingsName(){return this._plotSettingsName}set plotSettingsName(e){this._plotSettingsName=e}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(e){this._plotSettingsName=e}get plotCfgName(){return this._plotCfgName}set plotCfgName(e){this._plotCfgName=e}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(e){this._canonicalMediaName=e}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(e){this._currentStyleSheet=e}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(e){this._plotOrigin=e}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(e){this._customPrintScale=e}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(e){this._plotPaperSize=e}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(e){this._plotPaperMargins=e}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(e){this._plotViewName=e}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(e){this._plotWindowArea=e}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(e){this._modelType=e}getModelType(){return this._modelType}setModelType(e){this._modelType=e}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(e){this._drawViewportsFirst=e}setDrawViewportsFirst(e){this._drawViewportsFirst=e}get plotCentered(){return this._plotCentered}set plotCentered(e){this._plotCentered=e}setPlotCentered(e){this._plotCentered=e}get plotHidden(){return this._plotHidden}set plotHidden(e){this._plotHidden=e}setPlotHidden(e){this._plotHidden=e}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(e){this._plotPaperUnits=e}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(e){this._plotPlotStyles=e}setPlotPlotStyles(e){this._plotPlotStyles=e}get plotRotation(){return this._plotRotation}set plotRotation(e){this._plotRotation=e}get plotType(){return this._plotType}set plotType(e){this._plotType=e}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(e){this._plotViewportBorders=e}setPlotViewportBorders(e){this._plotViewportBorders=e}get printLineweights(){return this._printLineweights}set printLineweights(e){this._printLineweights=e}setPrintLineweights(e){this._printLineweights=e}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(e){this._scaleLineweights=e}setScaleLineweights(e){this._scaleLineweights=e}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(e){this._showPlotStyles=e}setShowPlotStyles(e){this._showPlotStyles=e}get shadePlot(){return this._shadePlotType}set shadePlot(e){this._shadePlotType=e}setShadePlot(e){this._shadePlotType=e}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(e){this._shadePlotResLevel=e}setShadePlotResLevel(e){this._shadePlotResLevel=e}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(e){this._shadePlotCustomDpi=e}setShadePlotCustomDPI(e){this._shadePlotCustomDpi=e}get shadePlotId(){return this._shadePlotId}set shadePlotId(e){this._shadePlotId=e}get plotWireframe(){return this._shadePlotType===1}get plotAsRaster(){return this._shadePlotType===3||this._shadePlotType===4||this._shadePlotType===5}get stdScaleType(){return this._stdScaleType}set stdScaleType(e){this._stdScaleType=e}get stdScale(){return Mu[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(e){this._useStandardScale=e}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPlotSettings"),e.writeString(1,this.plotSettingsName),e.writeString(2,this.plotCfgName),e.writeString(4,this.canonicalMediaName),e.writeString(6,this.plotViewName),e.writeDouble(40,this.plotPaperMargins.left),e.writeDouble(41,this.plotPaperMargins.bottom),e.writeDouble(42,this.plotPaperMargins.right),e.writeDouble(43,this.plotPaperMargins.top),e.writeDouble(44,this.plotPaperSize.x),e.writeDouble(45,this.plotPaperSize.y),e.writeDouble(46,this.plotOrigin.x),e.writeDouble(47,this.plotOrigin.y),e.writeDouble(48,this.plotWindowArea.min.x),e.writeDouble(49,this.plotWindowArea.min.y),e.writeDouble(140,this.plotWindowArea.max.x),e.writeDouble(141,this.plotWindowArea.max.y),e.writeDouble(142,this.customPrintScale.numerator),e.writeDouble(143,this.customPrintScale.denominator);let t=0;return this.plotViewportBorders&&(t|=1),this.showPlotStyles&&(t|=2),this.plotCentered&&(t|=4),this.plotHidden&&(t|=8),this.useStandardScale&&(t|=16),this.plotPlotStyles&&(t|=32),this.scaleLineweights&&(t|=64),this.printLineweights&&(t|=128),this.drawViewportsFirst&&(t|=512),this.modelType&&(t|=1024),e.writeInt16(70,t),e.writeInt16(72,this.plotPaperUnits),e.writeInt16(73,this.plotRotation),e.writeInt16(74,this.plotType),e.writeString(7,this.currentStyleSheet),e.writeInt16(75,this.stdScaleType),e.writeInt16(76,this.shadePlot),e.writeInt16(77,this.shadePlotResLevel),e.writeInt16(78,this.shadePlotCustomDPI),e.writeDouble(147,this.stdScale),e.writeObjectId(333,this.shadePlotId),this}}class yr extends bl{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new xe,this._extents=new R,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}get viewportArray(){return this._viewportArray}set viewportArray(e){this._viewportArray=e.slice()}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLayout"),e.writeString(1,this.layoutName),e.writeInt16(70,this.tabSelected?1:0),e.writeInt16(71,this.tabOrder),e.writeObjectId(330,this.blockTableRecordId),e.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),e.writePoint2d(10,this.limits.min),e.writePoint2d(11,this.limits.max),e.writePoint3d(14,this.extents.min),e.writePoint3d(15,this.extents.max),this}}class xl{constructor(){this.events={layoutCreated:new ie,layoutRemoved:new ie,layoutRenamed:new ie,layoutSwitched:new ie}}countLayouts(e){return this.getWorkingDatabase(e).objects.layout.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).objects.layout.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const r=this.getWorkingDatabase(t),i=r.objects.layout.getIdAt(e);return this.setCurrentLayoutInternal(i,r)}setCurrentLayoutBtrId(e,t){const r=this.getWorkingDatabase(t),i=r.objects.layout.getBtrIdAt(e);return this.setCurrentLayoutInternal(i,r)}setCurrentLayout(e,t){const r=this.getWorkingDatabase(t),i=r.objects.layout.getAt(e);return this.setCurrentLayoutInternal(i,r)}renameLayout(e,t,r){const s=this.getWorkingDatabase(r).objects.layout.getAt(e);return s?(s.layoutName=t,this.events.layoutRenamed.dispatch({layout:s,oldName:e,newName:t}),!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).objects.layout.has(e)}deleteLayout(e,t){const r=this.getWorkingDatabase(t).objects.layout,i=r.getAt(e);let s=!1;return i&&(s=r.remove(e),s&&this.events.layoutRemoved.dispatch({layout:i})),s}createLayout(e,t){const r=this.getWorkingDatabase(t),i=new yr;i.layoutName=e,i.tabOrder=r.objects.layout.maxTabOrder;const s=new se;return s.name=`*Paper_Space${i.tabOrder}`,r.tables.blockTable.add(s),r.objects.layout.setAt(e,i),this.events.layoutCreated.dispatch({layout:i}),{layout:i,btr:s}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.objects.layout.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||js().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({layout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}let Xr;function Ou(n){Xr=n}function js(){return Ur.instance}const Ai=class Ai{constructor(){this._workingDatabase=null}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(e){this._workingDatabase=e}get layoutManager(){return this._layoutManager||(Xr||(Xr=()=>new xl),this._layoutManager=Xr()),this._layoutManager}};Ai.instance=new Ai;let Ur=Ai;gl(js);var wl=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(wl||{});class Gs{constructor(e){if(this._values=[],e)for(const t of e)this._values.push({...t})}get length(){return this._values.length}at(e){return this._values[e]}add(e){this._values.push(e)}addRange(e){for(const t of e)this._values.push(t)}clear(){this._values.length=0}toArray(){return this._values.map(e=>({...e}))}clone(){return new Gs(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class Hs{constructor(e,t,r){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=r,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){return new Promise((t,r)=>{const i=()=>{Promise.resolve(e()).then(t).catch(r)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(i):setTimeout(i,0)})}async processChunk(e,t){if(this._count<=0){await(t==null?void 0:t());return}let r=0;const i=async()=>{const s=r,a=Math.min(r+this._chunkSize,this._count);await e(s,a),r=a,r<this._count&&await this.scheduleTask(i)};await i(),await(t==null?void 0:t())}}var Zn=(n=>(n.DXF="dxf",n.DWG="dwg",n))(Zn||{});class We{constructor(){this.events={registered:new ie,unregistered:new ie},this._converters=new Map,this.register("dxf",new zh)}static createInstance(){return We._instance==null&&(We._instance=new We),this._instance}static get instance(){return We._instance||(We._instance=new We),We._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}var ve=(n=>(n[n.DecimalDegrees=0]="DecimalDegrees",n[n.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",n[n.Gradians=2]="Gradians",n[n.Radians=3]="Radians",n[n.SurveyorsUnits=4]="SurveyorsUnits",n))(ve||{}),J=(n=>(n[n.Scientific=1]="Scientific",n[n.Decimal=2]="Decimal",n[n.Engineering=3]="Engineering",n[n.Architectural=4]="Architectural",n[n.Fractional=5]="Fractional",n[n.WindowsDesktop=6]="WindowsDesktop",n))(J||{}),K=(n=>(n[n.Undefined=0]="Undefined",n[n.Inches=1]="Inches",n[n.Feet=2]="Feet",n[n.Miles=3]="Miles",n[n.Millimeters=4]="Millimeters",n[n.Centimeters=5]="Centimeters",n[n.Meters=6]="Meters",n[n.Kilometers=7]="Kilometers",n[n.Microinches=8]="Microinches",n[n.Mils=9]="Mils",n[n.Yards=10]="Yards",n[n.Angstroms=11]="Angstroms",n[n.Nanometers=12]="Nanometers",n[n.Microns=13]="Microns",n[n.Decimeters=14]="Decimeters",n[n.Dekameters=15]="Dekameters",n[n.Hectometers=16]="Hectometers",n[n.Gigameters=17]="Gigameters",n[n.Astronomical=18]="Astronomical",n[n.LightYears=19]="LightYears",n[n.Parsecs=20]="Parsecs",n[n.USSurveyFeet=21]="USSurveyFeet",n[n.USSurveyInch=22]="USSurveyInch",n[n.USSurveyYard=23]="USSurveyYard",n[n.USSurveyMile=24]="USSurveyMile",n[n.Max=24]="Max",n))(K||{});function vl(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function Pl(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}const _s=Math.PI/200;class Al{constructor(e){this.database=e}formatLength(e,t){const r=this.createContext(t);return un(e,r)}formatPoint2d(e,t){const r=this.createContext(t);return`${un(e.x,r)}, ${un(e.y,r)}`}formatPoint3d(e,t){const r=this.createContext(t);return`${un(e.x,r)}, ${un(e.y,r)}, ${un(e.z,r)}`}formatAngle(e,t){const r=this.createContext(t),s=(t==null?void 0:t.applyAngbaseAngdir)??!0?Nu(e,this.database.angbase,this.database.angdir):T.normalizeAngle(e);return ku(s,r)}createContext(e){return{lunits:this.database.lunits,luprec:sr(this.database.luprec),insunits:this.database.insunits,unitmode:this.database.unitmode,measurement:this.database.measurement,aunits:this.database.aunits,auprec:sr(this.database.auprec),showUnits:(e==null?void 0:e.showUnits)??!1,showApproximate:(e==null?void 0:e.showApproximate)??!1}}}function un(n,e){let t;switch(e.lunits){case J.Scientific:t=Zi(ju(n,e.luprec),e);break;case J.Engineering:t=Gu(n,e);break;case J.Architectural:t=Hu(n,e);break;case J.Fractional:t=Zi(Wu(n,e),e);break;case J.WindowsDesktop:case J.Decimal:default:t=Zi(En(n,e.luprec),e)}return Sl(t,Yu(n,e),e)}function ku(n,e){let t;switch(e.aunits){case ve.DegreesMinutesSeconds:t=El(n,e);break;case ve.Gradians:t=qu(n,e);break;case ve.Radians:t=$u(n,e);break;case ve.SurveyorsUnits:t=Ku(n,e);break;case ve.DecimalDegrees:default:t=Uu(n,e)}return Sl(t,Xu(n,e),e)}function Nu(n,e,t){let r=n-e;return t===1&&(r=-r),T.normalizeAngle(r)}function Ws(n){const e=n.showUnits?'"':"";return n.unitmode===1?{feetInchSeparator:"",fractionSeparator:"-",inchSuffix:e}:{feetInchSeparator:"-",fractionSeparator:" ",inchSuffix:e}}function sr(n,e=0,t=8){return Number.isFinite(n)?Math.max(e,Math.min(t,Math.round(n))):e}function In(n){return Object.is(n,-0)?0:n}function Sl(n,e,t){return!t.showApproximate||!e?n:`~ ${n}`}function Yu(n,e){if(!Number.isFinite(n))return!1;const t=Bu(n,e);return Us(n,t)}function Xu(n,e){if(!Number.isFinite(n))return!1;if(e.aunits===ve.SurveyorsUnits)return Ru(n,e.auprec);const t=Fu(n,e);return Us(n,t)}function Ru(n,e){const r=((90-T.radToDeg(n))%360+360)%360,i=Tl(r),s=Math.min(Math.abs(r-i.base),Math.abs(i.base+90-r)),a=T.degToRad(s),o=Ll(a,e);return Us(a,o)}function Bu(n,e){const t=In(n);switch(e.lunits){case J.Scientific:return Du(t,e.luprec);case J.Engineering:case J.Architectural:case J.Fractional:return Vu(t,e);case J.WindowsDesktop:case J.Decimal:default:return vn(t,e.luprec)}}function Fu(n,e){const t=In(n);switch(e.aunits){case ve.DegreesMinutesSeconds:return Ll(t,e.auprec);case ve.Gradians:return vn(t/_s,e.auprec)*_s;case ve.Radians:return vn(t,e.auprec);case ve.DecimalDegrees:default:return T.degToRad(vn(T.radToDeg(t),e.auprec))}}function vn(n,e){if(!Number.isFinite(n))return 0;const t=10**e;return Math.round(In(n)*t)/t}function Du(n,e){if(!Number.isFinite(n))return 0;const t=In(n);if(t===0)return 0;const r=t.toExponential(e);return Number(r)}function Vu(n,e){if(!Number.isFinite(n))return 0;const t=n<0?-1:1,r=Math.abs(n),i=Math.floor(r/12),s=r-i*12;if(e.lunits===J.Architectural||e.lunits===J.Fractional){const a=1<<sr(e.luprec,0,8),o=zu(s,a);return t*(i*12+o)}return t*(i*12+vn(s,e.luprec))}function zu(n,e){const t=Math.floor(n),r=n-t,i=Math.round(r*e);return i>=e?t+1:t+i/e}function Ll(n,e){const t=T.radToDeg(n),r=t<0?-1:1,i=Math.abs(t),s=Math.floor(i),a=(i-s)*60,o=Math.floor(a),l=vn((a-o)*60,e),c=s+o/60+l/3600;return T.degToRad(r*c)}function Us(n,e){if(n===e)return!1;const t=Math.max(Math.abs(n),Math.abs(e),1);return Math.abs(n-e)>t*Number.EPSILON*8}function En(n,e){if(!Number.isFinite(n))return"0";const t=In(n);if(Number.isInteger(t)&&e===0)return String(t);const i=t.toFixed(e).replace(/\.?0+$/,"");return i===""||i==="-"?"0":i}function ju(n,e){if(!Number.isFinite(n))return"0";const t=In(n);if(t===0)return"0";const r=t.toExponential(e).match(/^(.+)e([+-])(\d+)$/i);if(!r)return"0";const[,i,s,a]=r,o=a.length<2?a.padStart(2,"0"):a;return`${i}E${s}${o}`.toUpperCase()}function Gu(n,e){if(!Number.isFinite(n))return"0";const t=Ws(e),r=n<0?"-":"",i=Math.abs(n),s=Math.floor(i/12),a=i-s*12,o=En(a,e.luprec);return s===0?`${r}${o}${t.inchSuffix}`:`${r}${s}'${t.feetInchSeparator}${o}${t.inchSuffix}`}function Hu(n,e){if(!Number.isFinite(n))return"0";const t=Ws(e),r=n<0?"-":"",i=Math.abs(n),s=Math.floor(i/12),a=i-s*12,o=1<<sr(e.luprec,0,8),l=Il(a,o,t.fractionSeparator);return s===0?`${r}${l}${t.inchSuffix}`:`${r}${s}'${t.feetInchSeparator}${l}${t.inchSuffix}`}function Wu(n,e){if(!Number.isFinite(n))return"0";const t=Ws(e),r=n<0?"-":"",i=Math.abs(n),s=1<<sr(e.luprec,0,8);return`${r}${Il(i,s,t.fractionSeparator)}`}function Il(n,e,t){const r=Math.floor(n),i=n-r;let s=Math.round(i*e);if(s>=e)return String(r+1);if(s===0)return String(r);const a=eg(s,e);s/=a;const o=e/a,l=`${s}/${o}`;return r===0?l:`${r}${t}${l}`}function Uu(n,e){const t=T.radToDeg(n);return`${En(t,e.auprec)}${e.showUnits?"°":""}`}function $u(n,e){return`${En(n,e.auprec)}${e.showUnits?" rad":""}`}function qu(n,e){const t=n/_s;return`${En(t,e.auprec)}${e.showUnits?"g":""}`}function El(n,e){const t=T.radToDeg(n),r=t<0?"-":"",i=Math.abs(t),s=Math.floor(i),a=(i-s)*60,o=Math.floor(a),l=(a-o)*60,c=En(l,e.auprec),h=e.showUnits?'"':"";return`${r}${s}d${o}'${c}${h}`}function Ku(n,e){const r=((90-T.radToDeg(n))%360+360)%360,i=Tl(r),s=Math.min(Math.abs(r-i.base),Math.abs(i.base+90-r)),o=El(T.degToRad(s),e).replace(/^-/,"");return`${i.prefix} ${o} ${i.suffix}`.trim()}function Tl(n){return n<90?{prefix:"N",suffix:"E",base:0}:n<180?{prefix:"S",suffix:"E",base:90}:n<270?{prefix:"S",suffix:"W",base:180}:{prefix:"N",suffix:"W",base:270}}function Zi(n,e){if(!e.showUnits||e.lunits===J.Engineering||e.lunits===J.Architectural)return n;const t=Zu(e.insunits,e.measurement);return t?`${n}${t}`:n}function Zu(n,e){return n===K.Undefined?e===0?'"':" mm":vl(n)?Qu(n):Pl(n)?Ju(n):""}function Qu(n){switch(n){case K.Millimeters:return" mm";case K.Centimeters:return" cm";case K.Meters:return" m";case K.Kilometers:return" km";case K.Decimeters:return" dm";case K.Microns:return" µm";case K.Nanometers:return" nm";default:return""}}function Ju(n){switch(n){case K.Inches:case K.Microinches:case K.Mils:case K.USSurveyInch:return'"';case K.Feet:case K.USSurveyFeet:return"'";case K.Miles:case K.USSurveyMile:return" mi";case K.Yards:case K.USSurveyYard:return" yd";default:return""}}function eg(n,e){let t=Math.abs(n),r=Math.abs(e);for(;r!==0;){const i=r;r=t%r,t=i}return t||1}class on{static get instance(){return this._instance||(this._instance=new on),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,r,i=[],s=!0,a,o){const l=[];if(t!=null){const c=this.createKey(t.name,r);let h;if(this.has(c))h=this.get(c);else{const d=t.newIterator();for(const p of d)p.visibility&&(p.color.isByBlock&&r?(io.copy(p.color),p.color.setRGBValue(r),this.addEntity(p,l,e),p.color.copy(io)):this.addEntity(p,l,e));h=e.group(l),h&&s&&se.name&&!se.name.startsWith("*U")&&this.set(c,h)}return h&&a&&(h.applyMatrix(a),o&&(o.x!=0||o.y!=0||o.z!=1)&&(a.setFromExtrusionDirection(o),h.applyMatrix(a))),h&&i&&i.length>0&&(h.bakeTransformToChildren(),i.forEach(d=>h.addChild(d))),h}else return e.group(l)}addEntity(e,t,r){if(!e.visibility)return;const i=e.worldDraw(r);i&&(this.attachEntityInfo(i,e),t.push(i))}attachEntityInfo(e,t){e.objectId=t.objectId,e.ownerId=t.ownerId,e.layerName=t.layer,e.visible=t.visibility}}const io=new B;var $s=(n=>(n[n.UTF8=0]="UTF8",n[n.US_ASCII=1]="US_ASCII",n[n.ISO_8859_1=2]="ISO_8859_1",n[n.ISO_8859_2=3]="ISO_8859_2",n[n.ISO_8859_3=4]="ISO_8859_3",n[n.ISO_8859_4=5]="ISO_8859_4",n[n.ISO_8859_5=6]="ISO_8859_5",n[n.ISO_8859_6=7]="ISO_8859_6",n[n.ISO_8859_7=8]="ISO_8859_7",n[n.ISO_8859_8=9]="ISO_8859_8",n[n.ISO_8859_9=10]="ISO_8859_9",n[n.CP437=11]="CP437",n[n.CP850=12]="CP850",n[n.CP852=13]="CP852",n[n.CP855=14]="CP855",n[n.CP857=15]="CP857",n[n.CP860=16]="CP860",n[n.CP861=17]="CP861",n[n.CP863=18]="CP863",n[n.CP864=19]="CP864",n[n.CP865=20]="CP865",n[n.CP869=21]="CP869",n[n.CP932=22]="CP932",n[n.MACINTOSH=23]="MACINTOSH",n[n.BIG5=24]="BIG5",n[n.CP949=25]="CP949",n[n.JOHAB=26]="JOHAB",n[n.CP866=27]="CP866",n[n.ANSI_1250=28]="ANSI_1250",n[n.ANSI_1251=29]="ANSI_1251",n[n.ANSI_1252=30]="ANSI_1252",n[n.GB2312=31]="GB2312",n[n.ANSI_1253=32]="ANSI_1253",n[n.ANSI_1254=33]="ANSI_1254",n[n.ANSI_1255=34]="ANSI_1255",n[n.ANSI_1256=35]="ANSI_1256",n[n.ANSI_1257=36]="ANSI_1257",n[n.ANSI_874=37]="ANSI_874",n[n.ANSI_932=38]="ANSI_932",n[n.ANSI_936=39]="ANSI_936",n[n.ANSI_949=40]="ANSI_949",n[n.ANSI_950=41]="ANSI_950",n[n.ANSI_1361=42]="ANSI_1361",n[n.UTF16=43]="UTF16",n[n.ANSI_1258=44]="ANSI_1258",n[n.UNDEFINED=255]="UNDEFINED",n))($s||{});const tg=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],Cl=n=>tg[n],Mt="Continuous",oe="Standard",ft="Standard",mt="Standard",ng="ANSI31",Ml="ANGLE",rn="SOLID",Ol="USER",kl="LINEAR",fe="ByLayer",Ct="ByBlock",bs="mlightcad",xs="ACAD",ws=Object.freeze({x:0,y:0}),Nl=Object.freeze({x:0,y:0}),Yl=Object.freeze({x:1,y:1}),Xl=Object.freeze({x:0,y:0,z:1}),Rl=Object.freeze({x:0,y:0,z:0});exports.AcGiArrowType=void 0;(function(n){n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK"})(exports.AcGiArrowType||(exports.AcGiArrowType={}));exports.AcGiLineWeight=void 0;(function(n){n[n.ByBlock=-2]="ByBlock",n[n.ByDIPs=-4]="ByDIPs",n[n.ByLayer=-1]="ByLayer",n[n.ByLineWeightDefault=-3]="ByLineWeightDefault",n[n.LineWeight000=0]="LineWeight000",n[n.LineWeight005=5]="LineWeight005",n[n.LineWeight009=9]="LineWeight009",n[n.LineWeight013=13]="LineWeight013",n[n.LineWeight015=15]="LineWeight015",n[n.LineWeight018=18]="LineWeight018",n[n.LineWeight020=20]="LineWeight020",n[n.LineWeight025=25]="LineWeight025",n[n.LineWeight030=30]="LineWeight030",n[n.LineWeight035=35]="LineWeight035",n[n.LineWeight040=40]="LineWeight040",n[n.LineWeight050=50]="LineWeight050",n[n.LineWeight053=53]="LineWeight053",n[n.LineWeight060=60]="LineWeight060",n[n.LineWeight070=70]="LineWeight070",n[n.LineWeight080=80]="LineWeight080",n[n.LineWeight090=90]="LineWeight090",n[n.LineWeight100=100]="LineWeight100",n[n.LineWeight106=106]="LineWeight106",n[n.LineWeight120=120]="LineWeight120",n[n.LineWeight140=140]="LineWeight140",n[n.LineWeight158=158]="LineWeight158",n[n.LineWeight200=200]="LineWeight200",n[n.LineWeight211=211]="LineWeight211"})(exports.AcGiLineWeight||(exports.AcGiLineWeight={}));exports.AcGiMTextFlowDirection=void 0;(function(n){n[n.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",n[n.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",n[n.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",n[n.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",n[n.BY_STYLE=5]="BY_STYLE"})(exports.AcGiMTextFlowDirection||(exports.AcGiMTextFlowDirection={}));exports.AcGiMTextAttachmentPoint=void 0;(function(n){n[n.TopLeft=1]="TopLeft",n[n.TopCenter=2]="TopCenter",n[n.TopRight=3]="TopRight",n[n.MiddleLeft=4]="MiddleLeft",n[n.MiddleCenter=5]="MiddleCenter",n[n.MiddleRight=6]="MiddleRight",n[n.BottomLeft=7]="BottomLeft",n[n.BottomCenter=8]="BottomCenter",n[n.BottomRight=9]="BottomRight",n[n.BaselineLeft=10]="BaselineLeft",n[n.BaselineCenter=11]="BaselineCenter",n[n.BaselineRight=12]="BaselineRight"})(exports.AcGiMTextAttachmentPoint||(exports.AcGiMTextAttachmentPoint={}));exports.AcGiRenderMode=void 0;(function(n){n[n.OPTIMIZED_2D=0]="OPTIMIZED_2D",n[n.WIREFRAME=1]="WIREFRAME",n[n.HIDDEN_LINE=2]="HIDDEN_LINE",n[n.FLAT_SHADED=3]="FLAT_SHADED",n[n.GOURAUD_SHADED=4]="GOURAUD_SHADED",n[n.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",n[n.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME"})(exports.AcGiRenderMode||(exports.AcGiRenderMode={}));exports.AcGiOrthographicType=void 0;(function(n){n[n.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",n[n.TOP=1]="TOP",n[n.BOTTOM=2]="BOTTOM",n[n.FRONT=3]="FRONT",n[n.BACK=4]="BACK",n[n.LEFT=5]="LEFT",n[n.RIGHT=6]="RIGHT"})(exports.AcGiOrthographicType||(exports.AcGiOrthographicType={}));exports.AcGiDefaultLightingType=void 0;(function(n){n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS"})(exports.AcGiDefaultLightingType||(exports.AcGiDefaultLightingType={}));var Bl=function(){function n(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new b,this._height=0,this._width=0,this._viewCenter=new b,this._viewHeight=0}return Object.defineProperty(n.prototype,"number",{get:function(){return this._number},set:function(e){this._number=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"id",{get:function(){return this._id},set:function(e){this._id=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"groupId",{get:function(){return this._groupId},set:function(e){this._groupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"centerPoint",{get:function(){return this._centerPoint},set:function(e){this._centerPoint.copy(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"box",{get:function(){var e=new xe;return e.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewCenter",{get:function(){return this._viewCenter},set:function(e){this._viewCenter.copy(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewHeight",{get:function(){return this._viewHeight},set:function(e){this._viewHeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewWidth",{get:function(){return this.viewHeight*(this.width/this.height)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewBox",{get:function(){var e=new xe;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var e=new n;return e.id=this.id,e.groupId=this.groupId,e.number=this.number,e.centerPoint.copy(this.centerPoint),e.height=this.height,e.width=this.width,e.viewCenter.copy(this.viewCenter),e.viewHeight=this.viewHeight,e},n.prototype.copy=function(e){return this.id=e.id,this.groupId=e.groupId,this.number=e.number,this.centerPoint.copy(e.centerPoint),this.height=e.height,this.width=e.width,this.viewCenter.copy(e.viewCenter),this.viewHeight=e.viewHeight,this},n}();const la=class la extends Ge{constructor(){super(...arguments),this._visibility=!0,this._transparency=new te,this._transparencySet=!1}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(e){this._layer=e}get color(){return this.getEntityColor()}set color(e){this.setEntityColor(e)}get resolvedColor(){var t;let e=this.color;if(e.isByLayer){const r=this.getLayerColor();r&&r.RGB!=null&&(e=r)}else if(e.isByBlock){const r=this.database.cecolor;if(r&&(e=r,e.isByLayer)){const i=this.database.clayer||this.layer,s=this.database.tables.layerTable.getAt(i);((t=s==null?void 0:s.color)==null?void 0:t.RGB)!=null&&(e=s.color)}}return e}get rgbColor(){const t=this.resolvedColor.RGB;return t??16777215}get lineType(){var e;return this._lineType==null&&(this._lineType=((e=this.database)==null?void 0:e.celtype)??fe),this._lineType}set lineType(e){e?e.toUpperCase()==="BYLAYER"?this._lineType=fe:e.toUpperCase()==="BYBLOCK"?this._lineType=Ct:this._lineType=e:this._lineType=fe}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer),this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e.clone(),this._transparencySet=!0}hasExplicitLayer(){return this._layer!=null}hasExplicitColor(){return this._color!=null}getEntityColor(){return this._color==null&&(this._color=new B,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}setEntityColor(e){this._color==null&&(this._color=new B),this._color.copy(e)}shouldResolveColorFromCecolor(){return!0}hasExplicitTransparency(){return this._transparencySet}dxfOutFields(e){e.writeSubclassMarker("AcDbEntity"),e.writeString(8,this.layer),e.writeString(6,this.lineType),e.writeDouble(48,this.linetypeScale),e.writeInt16(60,this.visibility?0:1),e.writeCmColor(this.color),e.writeInt16(370,this.lineWeight),e.writeTransparency(this.transparency);const t=this.database.tables.blockTable.getIdAt(this.ownerId);return t!=null&&t.isPaperSapce&&e.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new B,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??fe),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,r,i,s,a){}transformBy(e){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(e,t){const r=e.subEntityTraits;r.color=this.resolvedColor,r.rgbColor=this.rgbColor,r.lineType=this.lineStyle,r.lineTypeScale=this.linetypeScale,r.lineWeight=this.lineWeight,r.transparency=this.transparency,r.layer=this.layer,r.drawOrder=0,"thickness"in this&&(r.thickness=this.thickness);const i=this.subWorldDraw(e,t);return this.attachEntityInfo(i),i}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:e=>{this.color=e}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:e=>{this.layer=e}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:e=>{this.lineType=e}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:e=>{this.linetypeScale=e}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:e=>{this.lineWeight=e}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:e=>{this.transparency=e}}}]}}get lineStyle(){var i;const{type:e,name:t}=this.getLineType(),r=(i=this.database)==null?void 0:i.tables.linetypeTable.getAt(t);return r?{type:e,...r.linetype}:{type:e,name:t,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==fe){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return{type:"ByLayer",name:e.linetype}}else return this.lineType==Ct?{type:"ByBlock",name:Mt}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:Mt}}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);return e!=null?e.color:null}attachEntityInfo(e){e&&(e.objectId=this.objectId,this.attrs.has("ownerId")&&(e.ownerId=this.ownerId),e.layerName=this.layer,e.visible=this.visibility)}};la.typeName="Entity";let le=la;const ca=class ca extends le{getOffsetSideAtPoint(e){return 1}};ca.typeName="Curve";let ge=ca;function so(n,e){const t=n.x-e.x,r=n.y-e.y,i=(n.z||0)-(e.z||0);return t*t+r*r+i*i}function Be(n,e){if(e.length===0)return;let t=new b(e[0].x,e[0].y,e[0].z||0),r=so(n,t);for(let i=1;i<e.length;i++){const s=e[i],a=new b(s.x,s.y,s.z||0),o=so(n,a);o<r&&(t=a,r=o)}return t}function Tn(n,e,t,r,i){const s=new b(n.x,n.y,n.z||0),a=new b(e.x,e.y,e.z||0),o=new bt(s,a);switch(t){case v.EndPoint:i.push(s,a);break;case v.MidPoint:i.push(o.midPoint);break;case v.Nearest:i.push(o.nearestPoint(r));break;case v.Perpendicular:i.push(o.perpPoint(r));break}}function $r(n,e,t,r,i,s,a){if(t){const o=new Re(n,e,t);switch(i){case v.EndPoint:a.push(new b(o.startPoint.x,o.startPoint.y,r),new b(o.endPoint.x,o.endPoint.y,r));break;case v.MidPoint:a.push(new b(o.midPoint.x,o.midPoint.y,r));break;case v.Nearest:{const l=o.nearestPoint({x:s.x,y:s.y});a.push(new b(l.x,l.y,r));break}case v.Perpendicular:{o.perpendicularPoints({x:s.x,y:s.y}).forEach(c=>a.push(new b(c.x,c.y,r)));break}case v.Tangent:{o.tangentPoints({x:s.x,y:s.y}).forEach(c=>a.push(new b(c.x,c.y,r)));break}}return}Tn(new b(n.x,n.y,r),new b(e.x,e.y,r),i,s,a)}function qs(n,e,t,r,i){if(n.length!==0)switch(t){case v.EndPoint:n.forEach(s=>i.push(new b(s.x,s.y,s.z||0)));break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const s=n.length,a=[];for(let o=0;o<s;o++){const l=[];Tn(n[o],n[(o+1)%n.length],t,r,l),a.push(...l)}if(t===v.MidPoint)i.push(...a);else{const o=Be(r,a);o&&i.push(o)}break}}}const _n=class _n extends ge{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new ee}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,r=0,i=-1,s=-1){const a=i<0?void 0:i,o=s<0?void 0:s,l={x:t.x,y:t.y,bulge:r,startWidth:a,endWidth:o};this._geo.addVertexAt(e,l)}removeVertexAt(e){this._geo.removeVertexAt(e)}reset(e,t){this._geo.reset(e,t)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new b(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new R({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}subGetOsnapPoints(e,t,r,i){var l;const s=this._geo,a=this._elevation,o=s.numberOfVertices;if(o!==0)switch(e){case v.EndPoint:for(let c=0;c<o;c++){const h=s.getPointAt(c);i.push(new b(h.x,h.y,a))}break;case v.MidPoint:case v.Nearest:case v.Perpendicular:case v.Tangent:{const c=this.closed?o:o-1,h=[];for(let d=0;d<c;d++){const p=[];$r(s.getPointAt(d),s.getPointAt((d+1)%o),(l=s.vertices[d])==null?void 0:l.bulge,a,e,t,p),h.push(...p)}if(e===v.MidPoint)i.push(...h);else{const d=Be(t,h);d&&i.push(d)}break}}}transformBy(e){const t=e.determinant()<0;let r=this._elevation;return this._geo.vertices.forEach(i=>{const s=new b(i.x,i.y,this._elevation).applyMatrix4(e);i.x=s.x,i.y=s.y,r=s.z,t&&i.bulge!=null&&(i.bulge=-i.bulge)}),this._elevation=r,this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:e=>{this.elevation=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=this._geo.getPoints(100),r=this.createWidthProfile();if(r!=null){const s=rg(r,this.closed);if(s!=null){const a=e.subEntityTraits;return a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.area(s)}}const i=[];return t.forEach(s=>i.push(new b().set(s.x,s.y,this.elevation))),e.lines(i)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolyline"),e.writeInt32(90,this.numberOfVertices),e.writeInt16(70,this.closed?1:0),e.writeDouble(38,this.elevation);for(let t=0;t<this.numberOfVertices;++t)e.writePoint2d(10,this.getPoint2dAt(t));return this}createWidthProfile(){const e=this._geo.vertices,t=e.length;if(t<2)return null;const r=this.closed?t:t-1,i=[];let s=!1;for(let a=0;a<r;a++){const o=e[a],l=e[(a+1)%t],c=Math.max(0,o.startWidth??0),h=Math.max(0,o.endWidth??0);(c>Ne||h>Ne)&&(s=!0);const d=this.sampleSegment(o,l),p=d.length-1;for(let g=0;g<=p;g++){if(g===0&&i.length>0||this.closed&&a===r-1&&g===p)continue;const f=p>0?g/p:0;i.push({x:d[g].x,y:d[g].y,width:og(c,h,f)})}}return s&&i.length>=2?i:null}sampleSegment(e,t){if(e.bulge&&Math.abs(e.bulge)>Ne){const i=new Re(e,t,e.bulge).getPoints(32);if(i.length>1)return i.map(s=>new E(s.x,s.y))}return[new E(e.x,e.y),new E(t.x,t.y)]}static from2dPoints(e,t){const r=new _n;return e.forEach((i,s)=>r.addVertexAt(s,i)),r.closed=t,r}static fromGePolyline(e){const t=new _n;return e.vertices.forEach((r,i)=>{t.addVertexAt(i,new E(r.x,r.y),r.bulge??0)}),t.closed=e.closed,t}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.numberOfVertices;let r=1/0,i=1;const s=this.closed?t:t-1;for(let a=0;a<s;a++){const o=this.getPoint2dAt(a),l=this.getPoint2dAt((a+1)%t),c=l.x-o.x,h=l.y-o.y,d=c*c+h*h;if(d===0)continue;const p=Math.max(0,Math.min(1,((e.x-o.x)*c+(e.y-o.y)*h)/d)),g=(e.x-o.x-p*c)**2+(e.y-o.y-p*h)**2;g<r&&(r=g,i=c*(e.y-o.y)-h*(e.x-o.x)>=0?1:-1)}return i}createOffsetCurve(e){const t=this._geo.offset(e);return t.length===0?null:_n.fromGePolyline(t[0])}};_n.typeName="Polyline";let Ae=_n;function Xi(n,e,t){const r=ou(n,e,t);return r?Ae.fromGePolyline(r):null}const Ne=1e-6,ao=4;function rg(n,e){if(n.length<2)return null;const t=sg(n,e);if(t.length<2)return null;const{left:r,right:i}=ig(t,e);if(r.length<2||i.length<2)return null;const s=new Nt;if(e){if(!Qi(r)||!Qi(i))return null;const o=Math.abs(vs(r)),l=Math.abs(vs(i)),[c,h]=o>=l?[r,i]:[i,r];return s.add(new ee(c,!0)),s.add(new ee(h,!0)),s}const a=[...r,...i.reverse()];return Qi(a)?(s.add(new ee(a,!0)),s):null}function ig(n,e){const t=[],r=[];for(let i=0;i<n.length;i++){const s=n[i],a=Math.max(0,s.width)/2;if(a<=Ne)continue;const o=ag(n,i,e);o!=null&&(t.push({x:s.x+o.x*a,y:s.y+o.y*a}),r.push({x:s.x-o.x*a,y:s.y-o.y*a}))}return{left:t,right:r}}function sg(n,e){const t=[];if(n.forEach(r=>{const i=t[t.length-1];(!i||Math.abs(i.x-r.x)>Ne||Math.abs(i.y-r.y)>Ne||Math.abs(i.width-r.width)>Ne)&&t.push(r)}),e&&t.length>1){const r=t[0],i=t[t.length-1];Math.abs(r.x-i.x)<=Ne&&Math.abs(r.y-i.y)<=Ne&&t.pop()}return t}function ag(n,e,t){const r=n.length,i=n[e],s=n[(e-1+r)%r],a=n[(e+1)%r];let o=oo(i.x-s.x,i.y-s.y),l=oo(a.x-i.x,a.y-i.y);if(t||(e===0&&(o=l),e===r-1&&(l=o)),o==null&&l==null)return null;if(o==null)return Er(l);if(l==null)return Er(o);const c=Er(o),h=Er(l),d=c.x+h.x,p=c.y+h.y,g=Math.hypot(d,p);if(g<=Ne)return h;const f={x:d/g,y:p/g},m=Math.abs(f.x*h.x+f.y*h.y),y=m<=Ne?ao:Math.min(1/m,ao);return{x:f.x*y,y:f.y*y}}function oo(n,e){const t=Math.hypot(n,e);return t<=Ne?null:{x:n/t,y:e/t}}function Er(n){return{x:-n.y,y:n.x}}function vs(n){let e=0;const t=n.length;for(let r=0;r<t;r++){const i=n[r],s=n[(r+1)%t];e+=i.x*s.y-s.x*i.y}return e/2}function Qi(n){return n.length>=3&&Math.abs(vs(n))>Ne}function og(n,e,t){return n+(e-n)*t}var yn=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.FitCurvePoly=1]="FitCurvePoly",n[n.QuadSplinePoly=2]="QuadSplinePoly",n[n.CubicSplinePoly=3]="CubicSplinePoly",n))(yn||{});const ha=class ha extends ge{get dxfTypeName(){return"POLYLINE"}constructor(e,t,r=0,i=!1,s=0,a=0,o=null){super(),this._polyType=e,this._elevation=r;const l=o&&(o==null?void 0:o.length)===t.length,c=t.map((h,d)=>({x:h.x,y:h.y,bulge:l?o[d]:void 0}));this._geo=new ee(c,i)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(e){return this._geo.getPointAt(e)}getBulgeAt(e){const t=this._geo.vertices[e];return(t==null?void 0:t.bulge)||0}get geometricExtents(){const e=this._geo.box;return new R({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this._geo.numberOfVertices;++t){const r=this._geo.getPointAt(t);e.push(new b(r.x,r.y,this._elevation))}return e}subGetOsnapPoints(e,t,r,i){var l;const s=this._geo,a=this._elevation,o=s.numberOfVertices;if(o!==0)switch(e){case v.EndPoint:for(let c=0;c<o;c++){const h=s.getPointAt(c);i.push(new b(h.x,h.y,a))}break;case v.MidPoint:case v.Nearest:case v.Perpendicular:case v.Tangent:{const c=this.closed?o:o-1,h=[];for(let d=0;d<c;d++){const p=[];$r(s.getPointAt(d),s.getPointAt((d+1)%o),(l=s.vertices[d])==null?void 0:l.bulge,a,e,t,p),h.push(...p)}if(e===v.MidPoint)i.push(...h);else{const d=Be(t,h);d&&i.push(d)}break}}}transformBy(e){const t=e.determinant()<0;let r=this._elevation;return this._geo.vertices.forEach(i=>{const s=new b(i.x,i.y,this._elevation).applyMatrix4(e);i.x=s.x,i.y=s.y,r=s.z,t&&i.bulge!=null&&(i.bulge=-i.bulge)}),this._elevation=r,this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:e=>{this.elevation=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=[];return this._geo.getPoints(100).forEach(i=>t.push(new b().set(i.x,i.y,this.elevation))),e.lines(t)}dxfOut(e,t=!1){super.dxfOut(e,t);for(let r=0;r<this.numberOfVertices;++r)e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb2dVertex"),e.writePoint3d(10,{x:this.getPointAt(r).x,y:this.getPointAt(r).y,z:this.elevation}),e.writeDouble(42,this.getBulgeAt(r)),e.writeInt16(70,0);return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDb2dPolyline");let t=this.closed?1:0;return this.polyType===1&&(t|=2),this.polyType===2&&(t|=4),this.polyType===3&&(t|=8),e.writeInt16(66,this.numberOfVertices>0?1:0),e.writeInt16(70,t),e.writeDouble(10,0),e.writeDouble(20,0),e.writeDouble(30,this.elevation),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectPath2d();return t.length<2?1:Ae.from2dPoints(t,this.closed).getOffsetSideAtPoint(e)}createOffsetCurve(e){const t=this._geo.offset(e);return t.length===0?null:Ae.fromGePolyline(t[0])}collectPath2d(){const e=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(e)}};ha.typeName="2dPolyline";let qr=ha;var Fl=(n=>(n[n.Vertex=0]="Vertex",n[n.CurveFitVertex=1]="CurveFitVertex",n[n.SplineFitVertex=8]="SplineFitVertex",n[n.SplineCtlVertex=9]="SplineCtlVertex",n))(Fl||{});const da=class da extends le{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new b,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(e){this._position.copy(e)}get bulge(){return this._bulge}set bulge(e){this._bulge=e}get startWidth(){return this._startWidth}set startWidth(e){this._startWidth=e}get endWidth(){return this._endWidth}set endWidth(e){this._endWidth=e}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new R().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}subGetOsnapPoints(e,t,r,i){(e===v.EndPoint||e===v.Node)&&i.push(this._position)}transformBy(e){return this._position.applyMatrix4(e),this}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb2dVertex"),e.writePoint2d(10,this.position),e.writeDouble(40,this.startWidth),e.writeDouble(41,this.endWidth),e.writeDouble(42,this.bulge),e.writeInt16(70,this.vertexType),this}};da.typeName="2dVertex";let Ps=da;var Qn=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.QuadSplinePoly=1]="QuadSplinePoly",n[n.CubicSplinePoly=2]="CubicSplinePoly",n))(Qn||{});const Si=class Si extends ge{get dxfTypeName(){return"POLYLINE"}constructor(e,t,r=!1){super(),this._polyType=e,this._geo=new ee(t,r)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(e){const t=this._geo.vertices[e];return new b(t.x,t.y,t.z||0)}get geometricExtents(){const e=this._geo.vertices.map(t=>new b(t.x,t.y,t.z||0));return new R().setFromPoints(e)}subGetGripPoints(){const e=new Array;for(let t=0;t<this._geo.numberOfVertices;++t)e.push(this.getPointAt(t));return e}subGetOsnapPoints(e,t,r,i){const s=Array.from({length:this._geo.numberOfVertices},(a,o)=>this.getPointAt(o));if(s.length!==0)switch(e){case v.EndPoint:i.push(...s);break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const a=[];for(let o=0;o<s.length-1;o++){const l=[];Tn(s[o],s[o+1],e,t,l),a.push(...l)}if(e===v.MidPoint)i.push(...a);else{const o=Be(t,a);o&&i.push(o)}break}}}transformBy(e){return this._geo.vertices.forEach(t=>{const r=new b(t.x,t.y,t.z||0).applyMatrix4(e);t.x=r.x,t.y=r.y,t.z=r.z}),this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=this._geo.vertices.map(r=>new b(r.x,r.y,r.z||0));return e.lines(t)}dxfOut(e,t=!1){super.dxfOut(e,t);for(let r=0;r<this.numberOfVertices;++r){const i=this.getPointAt(r);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb3dPolylineVertex"),e.writePoint3d(10,{x:i.x,y:i.y,z:i.z}),e.writeInt16(70,32)}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDb3dPolyline");let t=this.closed?1:0;return t|=8,this.polyType===1&&(t|=16),this.polyType===2&&(t|=32),e.writeInt16(66,this.numberOfVertices>0?1:0),e.writeInt16(70,t),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectPath2d();return t.length<2?1:Ae.from2dPoints(t,this.closed).getOffsetSideAtPoint(e)}createOffsetCurve(e){const t=this._geo.offset(e);if(t.length===0)return null;const r=t[0],i=[];for(let s=0;s<r.numberOfVertices;s++){const a=r.getPointAt(s);i.push(new b(a.x,a.y,this.interpolateZ(a.x,a.y)))}return new Si(this.polyType,i,this.closed)}collectPath2d(){const e=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(e)}interpolateZ(e,t){const r=this.numberOfVertices;if(r<=0)return 0;let i=1/0,s=this.getPointAt(0).z;const a=this.closed?r:r-1;for(let o=0;o<a;o++){const l=this.getPointAt(o),c=this.getPointAt((o+1)%r),h=c.x-l.x,d=c.y-l.y,p=h*h+d*d;if(p===0)continue;const g=Math.max(0,Math.min(1,((e-l.x)*h+(t-l.y)*d)/p)),f=l.x+h*g,m=l.y+d*g,y=(e-f)**2+(t-m)**2;y<i&&(i=y,s=l.z+(c.z-l.z)*g)}return s}};Si.typeName="3dPolyline";let Kr=Si;var Dl=(n=>(n[n.SimpleVertex=0]="SimpleVertex",n[n.ControlVertex=1]="ControlVertex",n[n.FitVertex=2]="FitVertex",n))(Dl||{});const ua=class ua extends le{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new b,this._vertexType=0}get position(){return this._position}set position(e){this._position.copy(e)}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new R().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}subGetOsnapPoints(e,t,r,i){(e===v.EndPoint||e===v.Node)&&i.push(this._position)}transformBy(e){return this._position.applyMatrix4(e),this}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb3dPolylineVertex"),e.writePoint3d(10,this.position),e.writeInt16(70,this.vertexType|32),this}};ua.typeName="3dVertex";let As=ua;const Li=class Li extends ge{get dxfTypeName(){return"ARC"}constructor(e,t,r,i,s=x.Z_AXIS){super();const a=Vs(s);this._geo=new Yi(e,t,r,i,s,a)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>T.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,r,i){const s=this.startPoint,a=this.endPoint;switch(e){case v.EndPoint:i.push(s),i.push(a);break;case v.MidPoint:i.push(this.midPoint);break;case v.Center:case v.Centroid:i.push(this._geo.center);break;case v.Quadrant:{const o=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const l of o)T.isBetweenAngle(l,this.startAngle,this.endAngle)&&i.push(this._geo.getPointAtAngle(l));break}case v.Nearest:{const o=this._geo.nearestPoint(t);i.push(o)}break;case v.Perpendicular:{const o=this._geo.perpendicularPoints(t),l=Be(t,o);l&&i.push(l);break}case v.Tangent:{const o=this._geo.tangentPoints(t);i.push(...o);break}}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){return e.circularArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e);const t=rr(this.center,this.normal);return e.writeSubclassMarker("AcDbArc"),e.writePoint3d(10,t),e.writeDouble(40,this.radius),e.writeAngle(50,ds(this.center,this.startPoint,this.normal)),e.writeAngle(51,ds(this.center,this.endPoint,this.normal)),e.writeVector3d(210,this.normal),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.center,r=this.radius;return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)>=r?1:-1}createOffsetCurve(e){const t=this._geo.offset(e);return t?new Li(t.center,t.radius,t.startAngle,t.endAngle,t.normal):null}};Li.typeName="Arc";let Zr=Li;var Vl=(n=>(n[n.LEFT=0]="LEFT",n[n.CENTER=1]="CENTER",n[n.RIGHT=2]="RIGHT",n[n.ALIGNED=3]="ALIGNED",n[n.MIDDLE=4]="MIDDLE",n[n.FIT=5]="FIT",n))(Vl||{}),zl=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(zl||{});const ga=class ga extends le{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new b,this._alignmentPoint=new b,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get alignmentPoint(){return this._alignmentPoint}set alignmentPoint(e){this._alignmentPoint.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){return new R}subGetGripPoints(){return[this._position]}subGetOsnapPoints(e,t,r,i){v.Insertion===e&&i.push(this._position)}transformBy(e){const t=this._position.clone(),r=this._position.clone().add(new x(Math.cos(this._rotation),Math.sin(this._rotation),0)),i=this._position.clone().add(new x(-Math.sin(this._rotation),Math.cos(this._rotation),0)),s=this._position.clone().add(new x(0,0,1));t.applyMatrix4(e),r.applyMatrix4(e),i.applyMatrix4(e),s.applyMatrix4(e);const a=new x(r).sub(t),o=new x(i).sub(t),l=new x(s).sub(t),c=o.length(),h=a.length(),d=l.length();return this._position.copy(t),h>0&&(this._rotation=Math.atan2(a.y,a.x)),c>0&&(this._height*=c,h>0&&(this._widthFactor*=h/c)),d>0&&(this._thickness*=d),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:e=>{this.textString=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:e=>{this.widthFactor=e}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:e=>{this.oblique=e}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}subWorldDraw(e,t){let r=this.resolveAttachmentPoint(),i;if(r===exports.AcGiMTextAttachmentPoint.BaselineLeft)i=this._position;else{const a=this._alignmentPoint;a.x===0&&a.y===0&&a.z===0||a.x===this._position.x&&a.y===this._position.y&&a.z===this._position.z?(r=exports.AcGiMTextAttachmentPoint.BaselineLeft,i=this._position):i=a}const s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:i,rotation:this.rotation,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:r};return e.mtext(s,this.getTextStyle(),t)}resolveAttachmentPoint(){const e=this._horizontalMode,t=this._verticalModel;if(e===4)return exports.AcGiMTextAttachmentPoint.MiddleCenter;if(e===3||e===5)return exports.AcGiMTextAttachmentPoint.BaselineLeft;switch(t){case 3:return e===1?exports.AcGiMTextAttachmentPoint.TopCenter:e===2?exports.AcGiMTextAttachmentPoint.TopRight:exports.AcGiMTextAttachmentPoint.TopLeft;case 2:return e===1?exports.AcGiMTextAttachmentPoint.MiddleCenter:e===2?exports.AcGiMTextAttachmentPoint.MiddleRight:exports.AcGiMTextAttachmentPoint.MiddleLeft;case 1:return e===1?exports.AcGiMTextAttachmentPoint.BottomCenter:e===2?exports.AcGiMTextAttachmentPoint.BottomRight:exports.AcGiMTextAttachmentPoint.BottomLeft;case 0:default:return e===1?exports.AcGiMTextAttachmentPoint.BaselineCenter:e===2?exports.AcGiMTextAttachmentPoint.BaselineRight:exports.AcGiMTextAttachmentPoint.BaselineLeft}}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbText"),e.writePoint3d(10,this.position),e.writeDouble(39,this.thickness),e.writeDouble(40,this.height),e.writeString(1,this.textString),e.writeAngle(50,this.rotation),e.writeDouble(41,this.widthFactor),e.writeAngle(51,this.oblique),e.writeString(7,this.styleName),e.writeInt16(72,this.horizontalMode),e.writeInt16(73,this.verticalMode),e.writePoint3d(11,this.alignmentPoint),this}};ga.typeName="Text";let Sn=ga;var ae=(n=>(n[n.Invisible=1]="Invisible",n[n.Const=2]="Const",n[n.Verifiable=4]="Verifiable",n[n.Preset=8]="Preset",n))(ae||{}),Ue=(n=>(n[n.MultiLine=2]="MultiLine",n[n.ConstMultiLine=4]="ConstMultiLine",n))(Ue||{});const pa=class pa extends Sn{get dxfTypeName(){return"ATTDEF"}constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(e){e?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(e){this._prompt=e}get isConst(){return(this._flags&2)!==0}set isConst(e){e?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(e){e?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(e){e?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(e){e?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(e){e?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(e){this._tag=e}get fieldLength(){return this._fieldLength}set fieldLength(e){this._fieldLength=e}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(e){this._lockPositionInBlock=e}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(e){this._isReallyLocked=e}get mtext(){return this._mtext}set mtext(e){this._mtext=e,this.isMTextAttribute=e!=null}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbAttributeDefinition"),e.writeString(3,this.prompt),e.writeString(2,this.tag),e.writeInt16(70,this.isInvisible?1:0),e.writeInt16(73,this.fieldLength),e.writeInt16(74,this.isReallyLocked?1:0),this}};pa.typeName="AttDef";let Qr=pa;const fa=class fa extends Sn{get dxfTypeName(){return"ATTRIB"}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&ae.Invisible)!==0}set isInvisible(e){e?this._flags|=ae.Invisible:this._flags&=~ae.Invisible}get isConst(){return(this._flags&ae.Const)!==0}set isConst(e){e?this._flags|=ae.Const:this._flags&=~ae.Const}get isVerifiable(){return(this._flags&ae.Verifiable)!==0}set isVerifiable(e){e?this._flags|=ae.Verifiable:this._flags&=~ae.Verifiable}get isPreset(){return(this._flags&ae.Preset)!==0}set isPreset(e){e?this._flags|=ae.Preset:this._flags&=~ae.Preset}get isMTextAttribute(){return(this._mtextFlag&Ue.MultiLine)!==0}set isMTextAttribute(e){e?this._mtextFlag|=Ue.MultiLine:this._mtextFlag&=~Ue.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&Ue.ConstMultiLine)!==0}set isConstMTextAttribute(e){e?this._mtextFlag|=Ue.ConstMultiLine:this._mtextFlag&=~Ue.ConstMultiLine}get tag(){return this._tag}set tag(e){this._tag=e}get fieldLength(){return this._fieldLength}set fieldLength(e){this._fieldLength=e}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(e){this._lockPositionInBlock=e}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(e){this._isReallyLocked=e}get mtext(){return this._mtext}set mtext(e){this._mtext=e,this.isMTextAttribute=e!=null}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbAttribute"),e.writeInt16(70,this.isInvisible?1:0),e.writeInt16(73,this.fieldLength),e.writeString(2,this.tag),e.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&e.writeInt16(71,this.isMTextAttribute?1:0),this}};fa.typeName="Attrib";let Jr=fa;const bn=class bn extends le{get dxfTypeName(){return"INSERT"}constructor(e){super(),this._blockName=e,this._position=new b,this._rotation=0,this._normal=new x(0,0,1),this._scaleFactors=new b(1,1,1),this._attribs=new Map}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(e){this._attribs.set(e.objectId,e),e.ownerId=this.objectId}attributeIterator(){return new mr(this._attribs)}get blockTransform(){const e=this.blockTableRecord,t=(e==null?void 0:e.origin)??b.ORIGIN,r=new D().makeTranslation(-t.x,-t.y,-t.z),i=new D().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),s=new pr().setFromAxisAngle(x.Z_AXIS,this._rotation),a=new D().makeRotationFromQuaternion(s),o=new D().makeTranslation(this._position.x,this._position.y,this._position.z);return new D().multiplyMatrices(o,a).multiply(i).multiply(r)}subGetGripPoints(){return[this._position]}subGetOsnapPoints(e,t,r,i,s,a){const o=a??new D;v.Insertion===e?i.push(this.getInsertionPoint(o)):s?this.subEntityGetOsnapPoints(e,t,r,i,s,o):this.collectBlockOsnapPoints(e,t,r,i,o)}transformBy(e){const t=new D().setFromExtrusionDirection(this._normal),r=new D().makeRotationZ(this._rotation),i=new D().multiplyMatrices(t,r),s=this._position.clone(),a=new b(this._scaleFactors.x,0,0).applyMatrix4(i).add(s),o=new b(0,this._scaleFactors.y,0).applyMatrix4(i).add(s),l=new b(0,0,this._scaleFactors.z).applyMatrix4(i).add(s);s.applyMatrix4(e),a.applyMatrix4(e),o.applyMatrix4(e),l.applyMatrix4(e);const c=new x(a).sub(s),h=new x(o).sub(s),d=new x(l).sub(s);let p=new x().crossVectors(c,h);p.lengthSq()===0?p=this._normal.clone().transformDirection(e):p.normalize();const f=new D().setFromExtrusionDirection(p).clone().invert(),m=c.clone().applyMatrix4(f);return this._position.copy(s),this._normal.copy(p),this._rotation=Math.atan2(m.y,m.x),this._scaleFactors.set(c.length(),h.length(),d.length()),this._attribs.forEach(y=>y.transformBy(e)),this}get properties(){const e={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:t=>{this.scaleFactors.x=t}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:t=>{this.scaleFactors.y=t}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:t=>{this.scaleFactors.z=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}}]}]};if(this._attribs.size>0){const t={groupName:"attribute",properties:[]};e.groups.push(t),this._attribs.forEach(r=>{t.properties.push({name:r.tag,type:"string",editable:!r.isConst,skipTranslation:!0,accessor:{get:()=>r.textString,set:i=>{r.textString=i}}})})}return e}get geometricExtents(){const e=new R,t=this.blockTableRecord;if(t!=null){const i=t.newIterator();for(const s of i)e.union(s.geometricExtents)}const r=this.blockTransform;return e.applyMatrix4(r),e}subWorldDraw(e){const t=this.blockTableRecord;if(t!=null){const r=this.blockTransform,i=[];return this._attribs.forEach(a=>{if(!a.isInvisible){const o=a.worldDraw(e);o&&i.push(o)}}),on.instance.draw(e,t,this.rgbColor,i,!0,r,this._normal)}else return e.group([])}dxfOut(e,t=!1){super.dxfOut(e,t);let r=!1;for(const i of this.attributeIterator())r=!0,e.writeStart("ATTRIB"),i.dxfOut(e);return r&&(e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity")),this}collectBlockOsnapPoints(e,t,r,i,s){const a=this.blockTableRecord;if(!a)return;const o=new D().multiplyMatrices(s,this.getFullInsertionTransform()),l=o.clone().invert(),c=new b(t).applyMatrix4(l),h=new b(r).applyMatrix4(l),d=[];for(const p of a.newIterator()){const g=[];if(p instanceof bn){p.subGetOsnapPoints(e,t,r,g,void 0,o),d.push(...g);continue}p.subGetOsnapPoints(e,c,h,g,void 0,o),g.forEach(f=>d.push(new b(f).applyMatrix4(o)))}if(d.length!==0)if(e===v.Nearest||e===v.Perpendicular||e===v.Tangent){const p=Be(t,d);p&&i.push(p)}else i.push(...d)}subEntityGetOsnapPoints(e,t,r,i,s,a,o=new Set){if(s===this.objectId||o.has(this.objectId))return!1;o.add(this.objectId);try{const l=this.blockTableRecord;if(l==null)return!1;const c=new D().multiplyMatrices(a,this.getFullInsertionTransform());for(const h of l.newIterator()){if(h.objectId===s){const d=new b(t).applyMatrix4(c.clone().invert()),p=new b(r).applyMatrix4(c.clone().invert()),g=[];return h.subGetOsnapPoints(e,d,p,g,s,c),h instanceof bn?g.forEach(f=>{i.push(f.clone())}):g.forEach(f=>{i.push(new b(f).applyMatrix4(c))}),!0}if(h instanceof bn&&h.subEntityGetOsnapPoints(e,t,r,i,s,c,o))return!0}return!1}finally{o.delete(this.objectId)}}getInsertionPoint(e){var i;const t=((i=this.blockTableRecord)==null?void 0:i.origin)??b.ORIGIN,r=new D().multiplyMatrices(e,this.getFullInsertionTransform());return new b(t).applyMatrix4(r)}getFullInsertionTransform(){const e=new D().setFromExtrusionDirection(this._normal);return new D().multiplyMatrices(e,this.blockTransform)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbBlockReference"),e.writePoint3d(10,this.position),e.writeString(2,this.blockName),e.writeDouble(41,this.scaleFactors.x),e.writeDouble(42,this.scaleFactors.y),e.writeDouble(43,this.scaleFactors.z),e.writeAngle(50,this.rotation),e.writeVector3d(210,this.normal),this}};bn.typeName="BlockReference";let sn=bn;const Ii=class Ii extends ge{get dxfTypeName(){return"CIRCLE"}constructor(e,t,r=x.Z_AXIS){super();const i=Vs(r);this._geo=new Yi(e,t,0,G,r,i)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(e,t,r,i){switch(e){case v.Center:case v.Centroid:i.push(this._geo.center);break;case v.Quadrant:i.push(this._geo.getPointAtAngle(0)),i.push(this._geo.getPointAtAngle(Math.PI/2)),i.push(this._geo.getPointAtAngle(Math.PI)),i.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case v.Nearest:{const s=this._geo.nearestPoint(t);i.push(s)}break;case v.Tangent:{const s=this._geo.tangentPoints(t);i.push(...s);break}case v.Perpendicular:{const s=this._geo.perpendicularPoints(t),a=Be(t,s);a&&i.push(a);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){return e.circularArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e);const t=rr(this.center,this.normal);return e.writeSubclassMarker("AcDbCircle"),e.writePoint3d(10,t),e.writeDouble(40,this.radius),e.writeVector3d(210,this.normal),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.center,r=this.radius;return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)>=r?1:-1}createOffsetCurve(e){const t=this._geo.offset(e);return t?new Ii(t.center,t.radius,t.normal):null}};Ii.typeName="Circle";let ei=Ii;const Ei=class Ei extends ge{get dxfTypeName(){return"ELLIPSE"}constructor(e,t,r,i,s,a,o){super(),this._geo=new hl(e,t,r,i,s,a,o)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxis(){return this._geo.majorAxis}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this._geo.center),e.push(this._geo.startPoint),e.push(this._geo.endPoint),e}subGetOsnapPoints(e,t,r,i){switch(e){case v.EndPoint:this.closed||(i.push(this._geo.startPoint),i.push(this._geo.endPoint));break;case v.MidPoint:this.closed||i.push(this._geo.midPoint);break;case v.Center:case v.Centroid:i.push(this._geo.center);break;case v.Quadrant:this.closed&&(i.push(this._geo.getPointAtAngle(0)),i.push(this._geo.getPointAtAngle(Math.PI/2)),i.push(this._geo.getPointAtAngle(Math.PI)),i.push(this._geo.getPointAtAngle(Math.PI/2*3)));break;case v.Nearest:i.push(this._geo.nearestPoint(t));break;case v.Tangent:i.push(...this._geo.tangentPoints(t));break;case v.Perpendicular:{const s=this._geo.perpendicularPoints(t),a=Be(t,s);a&&i.push(a);break}}}transformBy(e){return this._geo.transform(e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:e=>{this.center.x=e}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:e=>{this.minorAxisRadius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(e){return e.ellipticalArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbEllipse"),e.writePoint3d(10,this.center);const t=this._geo.majorAxis,r=this.majorAxisRadius;return e.writePoint3d(11,{x:t.x*r,y:t.y*r,z:t.z*r}),e.writeVector3d(210,this.normal),e.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),e.writeDouble(41,this.startAngle),e.writeDouble(42,this.endAngle),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.center,r=e.x-t.x,i=e.y-t.y,s=this.majorAxis,a=Math.hypot(s.x,s.y)||1,o=this.minorAxisRadius/this.majorAxisRadius*a||1,l=s.x/a,c=s.y/a,h=-c,d=l,p=r*l+i*c,g=r*h+i*d;return(p/a)**2+(g/o)**2>=1?1:-1}createOffsetCurve(e){const t=this._geo.offset(e);return t?new Ei(t.center,t.normal,t.majorAxis,t.majorAxisRadius,t.minorAxisRadius,t.startAngle,t.endAngle):null}};Ei.typeName="Ellipse";let ti=Ei;const ma=class ma extends le{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new b,new b,new b],this._edgeInvisibilities=0}getVertexAt(e){return e<0?this._vertices[0]:e>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[e]}setVertexAt(e,t){if(e<0&&this._vertices[0].copy(t),e>=3)return this._vertices.length===3&&this._vertices.push(new b),this._vertices[3].copy(t);this._vertices[e].copy(t)}setEdgeInvisibilities(e){this._edgeInvisibilities=e}isEdgeVisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<e)===0}makeEdgeInvisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<e}get geometricExtents(){return new R().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;return e.push(...this._vertices),e}subGetOsnapPoints(e,t,r,i){qs(this._vertices,!0,e,t,i)}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this}subWorldDraw(e){const t=this._vertices.length,r=new Float32Array(t*3),i=new Uint16Array(t*2);for(let s=0;s<t;s++)r[s*3]=this._vertices[s].x,r[s*3+1]=this._vertices[s].y,r[s*3+2]=this._vertices[s].z,this.isEdgeVisibleAt(s)&&(i[s*2]=s,i[s*2+1]=(s+1)%4);return e.lineSegments(r,3,i)}dxfOutFields(e){super.dxfOutFields(e);const t=this.getVertexAt(0),r=this.getVertexAt(1),i=this.getVertexAt(2),s=this.getVertexAt(3);e.writeSubclassMarker("AcDbFace"),e.writePoint3d(10,t),e.writePoint3d(11,r),e.writePoint3d(12,i),e.writePoint3d(13,s);let a=0;for(let o=0;o<4;++o)this.isEdgeVisibleAt(o)||(a|=1<<o);return e.writeInt16(70,a),this}};ma.typeName="Face";let ni=ma;const I={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",AUPREC:"AUPREC",CECOLOR:"CECOLOR",CELTSCALE:"CELTSCALE",CELTYPE:"CELTYPE",CELWEIGHT:"CELWEIGHT",CETRANSPARENCY:"CETRANSPARENCY",CLAYER:"CLAYER",CMLEADERSTYLE:"CMLEADERSTYLE",CMLSCALE:"CMLSCALE",CMLSTYLE:"CMLSTYLE",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",HPANG:"HPANG",HPASSOC:"HPASSOC",HPBACKGROUNDCOLOR:"HPBACKGROUNDCOLOR",HPCOLOR:"HPCOLOR",HPDOUBLE:"HPDOUBLE",HPISLANDDETECTION:"HPISLANDDETECTION",HPLAYER:"HPLAYER",HPNAME:"HPNAME",HPSCALE:"HPSCALE",HPSEPARATE:"HPSEPARATE",HPTRANSPARENCY:"HPTRANSPARENCY",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LUNITS:"LUNITS",LUPREC:"LUPREC",LWDISPLAY:"LWDISPLAY",MEASUREMENT:"MEASUREMENT",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",MODELBKCOLOR:"MODELBKCOLOR",OSMODE:"OSMODE",ORTHOMODE:"ORTHOMODE",PAPERBKCOLOR:"PAPERBKCOLOR",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",POLARADDANG:"POLARADDANG",POLARMODE:"POLARMODE",POLARANG:"POLARANG",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",UNITMODE:"UNITMODE"},lg=Object.freeze(Object.values(I)),Ti=class Ti{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new ie},this.registerVar({name:I.ANGBASE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.ANGDIR,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.AUNITS,type:"number",isDbVar:!0,defaultValue:ve.DecimalDegrees}),this.registerVar({name:I.AUPREC,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.CECOLOR,type:"color",isDbVar:!0,defaultValue:new B(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:I.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:I.CELTYPE,type:"string",isDbVar:!0,defaultValue:fe}),this.registerVar({name:I.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:exports.AcGiLineWeight.ByLayer}),this.registerVar({name:I.CETRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new te}),this.registerVar({name:I.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:I.CMLEADERSTYLE,type:"string",isDbVar:!0,defaultValue:mt}),this.registerVar({name:I.CMLSCALE,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:I.CMLSTYLE,type:"string",isDbVar:!0,defaultValue:ft}),this.registerVar({name:I.COLORTHEME,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:I.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:I.HPANG,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.HPASSOC,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:I.HPBACKGROUNDCOLOR,type:"color",isDbVar:!0,defaultValue:new B(exports.AcCmColorMethod.None)}),this.registerVar({name:I.HPCOLOR,type:"color",isDbVar:!0,defaultValue:new B(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:I.HPDOUBLE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.HPISLANDDETECTION,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:I.HPLAYER,type:"string",isDbVar:!0,defaultValue:"."}),this.registerVar({name:I.HPNAME,type:"string",isDbVar:!1,defaultValue:Ml}),this.registerVar({name:I.HPSCALE,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:I.HPSEPARATE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.HPTRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new te}),this.registerVar({name:I.INSUNITS,type:"number",isDbVar:!0,defaultValue:K.Millimeters}),this.registerVar({name:I.LUNITS,type:"number",isDbVar:!0,defaultValue:J.Decimal}),this.registerVar({name:I.LUPREC,type:"number",isDbVar:!0,defaultValue:4}),this.registerVar({name:I.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:I.MEASUREMENT,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:I.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const e=new B(exports.AcCmColorMethod.ByColor);return e.setRGB(96,165,250),e})()}),this.registerVar({name:I.MODELBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const e=new B(exports.AcCmColorMethod.ByColor);return e.setRGB(0,0,0),e})()}),this.registerVar({name:I.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.ORTHOMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.PAPERBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const e=new B(exports.AcCmColorMethod.ByColor);return e.setRGB(255,255,255),e})()}),this.registerVar({name:I.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:I.POLARADDANG,type:"string",isDbVar:!1,defaultValue:""}),this.registerVar({name:I.POLARMODE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.POLARANG,type:"number",isDbVar:!1,defaultValue:90}),this.registerVar({name:I.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:oe}),this.registerVar({name:I.UNITMODE,type:"number",isDbVar:!0,defaultValue:0})}static instance(){return this._instance||(this._instance=new Ti),this._instance}registerVar(e){const t=this.normalizeName(e.name);this.registry.set(t,{...e,name:t}),e.isDbVar||this.cache.set(t,e.defaultValue)}registerMany(e){e.forEach(t=>this.registerVar(t))}getVar(e,t){e=this.normalizeName(e);const r=this.getDescriptor(e);if(!r)throw new Error(`System variable ${e} not found!`);if(r.isDbVar)return t[e.toLowerCase()];if(this.cache.has(e))return this.cache.get(e)}getDefaultValue(e){e=this.normalizeName(e);const t=this.getDescriptor(e);if(!t)throw new Error(`System variable ${e} not found!`);return t.defaultValue}setVar(e,t,r){e=this.normalizeName(e);const i=this.getDescriptor(e);if(i){const s=this.getVar(e,r);if(i.type==="transparency"){const a=this.parseTransparency(t);if(a==null||a.isInvalid)throw new Error("Invalid transparency value!");t=a}else if(i.type!=="string"&&(typeof t=="string"||t instanceof String)){if(i.type==="number"){const a=Number(t);if(Number.isNaN(a))throw new Error("Invalid number input!");t=a}else if(i.type==="boolean")t=this.parseBoolean(t);else if(i.type==="color"){const a=this.parseColorSysVar(e,t,r);if(a==null)throw new Error("Invalid color value!");t=a}}i.isDbVar?r[e.toLowerCase()]=t:(this.cache.set(e,t),this.hasValueChanged(s,t)&&this.events.sysVarChanged.dispatch({database:r,name:e,newVal:t,oldVal:s}))}else throw new Error(`System variable ${e} not found!`)}getDescriptor(e){return this.registry.get(this.normalizeName(e))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(e){if(e==null)return!1;const t=String(e).trim().toLowerCase(),r=new Set(["true","t","1","yes","y"]),i=new Set(["false","f","0","no","n"]);return r.has(t)?!0:(i.has(t),!1)}parseColorSysVar(e,t,r){const i=t.trim().toLowerCase();return e===I.HPCOLOR.toLowerCase()&&(i==="."||i==="use current")?r.cecolor.clone():e===I.HPBACKGROUNDCOLOR.toLowerCase()&&(i===""||i==="."||i==="none")?new B(exports.AcCmColorMethod.None):B.fromString(t)}parseTransparency(e){if(e instanceof te)return e;if(typeof e=="number")return te.deserialize(e);if(!(typeof e!="string"&&!(e instanceof String)))return te.fromString(String(e))}hasValueChanged(e,t){return e instanceof B&&t instanceof B||e instanceof te&&t instanceof te?!e.equals(t):!Object.is(e,t)}normalizeName(e){return e.toLowerCase()}};Ti._instance=null;let Xe=Ti;const cg={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:23},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:24}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:26}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:28},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:29}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:31},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:32}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:34},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:35},{angle:45,originX:.353553391,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:36},{angle:45,originX:.530330086,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:37}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:39},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.3125,-.0625,0,-.0625],sourceLine:40}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:.21875,deltaY:.125,dashes:[.3125,-.0625,0,-.0625],sourceLine:42}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:45}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:47},{angle:135,originX:0,originY:0,deltaX:.25,deltaY:.125,dashes:[.3125,-.1875],sourceLine:48}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:54},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[8,-8],sourceLine:55}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:57},{angle:0,originX:-8,originY:.375,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:58},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:59},{angle:90,originX:-.375,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:60}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:62},{angle:90,originX:0,originY:0,deltaX:8,deltaY:4,dashes:[8,-8],sourceLine:63}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:65},{angle:0,originX:0,originY:2.25,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:66},{angle:0,originX:2,originY:2.667,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:67},{angle:0,originX:2,originY:4.917,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:68},{angle:90,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:69},{angle:90,originX:-.375,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:70},{angle:90,originX:2,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:71},{angle:90,originX:1.625,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:72}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:2.667,dashes:[],sourceLine:74},{angle:90,originX:0,originY:0,deltaX:2.667,deltaY:4,dashes:[2.667,-2.667],sourceLine:75}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:77},{angle:355,originX:0,originY:0,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:78},{angle:100.45144446,originX:.59771681,originY:-.05229344,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.63740192,-7.01142112],sourceLine:79},{angle:46.1842,originX:0,originY:2,deltaX:6.19462554,deltaY:-8.84684596,dashes:[1.125,-12.375],sourceLine:80},{angle:96.63563549,originX:.88936745,originY:1.86206693,deltaX:8.59588239,deltaY:-10.40964966,dashes:[.95610342,-10.5171376],sourceLine:81},{angle:351.18416399,originX:0,originY:2,deltaX:7.74327494,deltaY:11.05855746,dashes:[.9,-9.90000001],sourceLine:82},{angle:21,originX:1,originY:1.5,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:83},{angle:326,originX:1,originY:1.5,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:84},{angle:71.45144474,originX:1.49742254,originY:1.16448426,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.6374019,-7.01142112],sourceLine:85},{angle:37.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-6.52,0,-6.7,0,-6.625],sourceLine:86},{angle:7.5,originX:0,originY:0,deltaX:3.123,deltaY:3.567,dashes:[0,-3.82,0,-6.37,0,-2.525],sourceLine:87},{angle:-32.5,originX:-2.23,originY:0,deltaX:4.6234,deltaY:2.678,dashes:[0,-2.5,0,-7.8,0,-10.35],sourceLine:88},{angle:-42.5,originX:-3.23,originY:0,deltaX:3.6234,deltaY:4.678,dashes:[0,-3.25,0,-5.18,0,-7.35],sourceLine:89}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:4,deltaY:4,dashes:[12,-4],sourceLine:91},{angle:135,originX:2.828427125,originY:2.828427125,deltaX:4,deltaY:-4,dashes:[12,-4],sourceLine:92}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:94},{angle:90,originX:2,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:95},{angle:90,originX:4,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:96},{angle:90,originX:6,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:97},{angle:90,originX:8,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:98},{angle:90,originX:10,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:99},{angle:90,originX:12,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:100},{angle:0,originX:0,originY:12,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:101},{angle:0,originX:0,originY:14,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:102},{angle:0,originX:0,originY:16,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:103},{angle:0,originX:0,originY:18,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:104},{angle:0,originX:0,originY:20,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:105},{angle:0,originX:0,originY:22,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:106},{angle:0,originX:0,originY:24,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:107}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:2.2,deltaY:1,dashes:[15,-2,5,-1],sourceLine:109},{angle:0,originX:1.33,originY:.5,deltaX:-1,deltaY:1.33,dashes:[3,-.33,6,-.75],sourceLine:110},{angle:0,originX:.5,originY:.85,deltaX:5.2,deltaY:.67,dashes:[8,-1.4,4,-1],sourceLine:111}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:25.5,deltaY:12,dashes:[6,-5,7,-3,9,-4],sourceLine:113},{angle:0,originX:6,originY:.5,deltaX:25.5,deltaY:12,dashes:[5,-19,4,-6],sourceLine:114},{angle:0,originX:18,originY:-.75,deltaX:25.5,deltaY:12,dashes:[3,-31],sourceLine:115},{angle:90,originX:0,originY:0,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:116},{angle:90,originX:6,originY:0,deltaX:12,deltaY:8.5,dashes:[11.25,-36.75],sourceLine:117},{angle:90,originX:11,originY:0,deltaX:12,deltaY:8.5,dashes:[10.5,-37.5],sourceLine:118},{angle:90,originX:18,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:119},{angle:90,originX:21,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:120},{angle:90,originX:30,originY:0,deltaX:12,deltaY:8.5,dashes:[11,-37],sourceLine:121}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:1.123,deltaY:1.567,dashes:[0,-1.52,0,-1.7,0,-1.625],sourceLine:123},{angle:7.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-.82,0,-1.37,0,-.525],sourceLine:124},{angle:-32.5,originX:-1.23,originY:0,deltaX:2.6234,deltaY:1.678,dashes:[0,-.5,0,-1.8,0,-2.35],sourceLine:125},{angle:-42.5,originX:-1.23,originY:0,deltaX:1.6234,deltaY:2.678,dashes:[0,-.25,0,-1.18,0,-1.35],sourceLine:126}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:128},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:129},{angle:0,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:130},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:131},{angle:0,originX:0,originY:.5,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:132},{angle:0,originX:0,originY:.75,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:133},{angle:90,originX:.5,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:134},{angle:90,originX:.75,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:135}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:137},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:138}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:140},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.5,dashes:[.25,-.25],sourceLine:141},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:.5,dashes:[-.25,.25],sourceLine:142}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.33,dashes:[],sourceLine:144},{angle:90,originX:.9,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:145},{angle:90,originX:.8,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:146},{angle:0,originX:.9,originY:.055,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:147},{angle:0,originX:.9,originY:.11,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:148},{angle:0,originX:.9,originY:.165,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:149},{angle:0,originX:.9,originY:.22,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:150},{angle:0,originX:.9,originY:.275,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:151}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.1875,dashes:[],sourceLine:153},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.1875,dashes:[],sourceLine:154},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.1875,dashes:[],sourceLine:155},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.1875,dashes:[.1875,-.125],sourceLine:156}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:158},{angle:135,originX:.0625,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:159},{angle:135,originX:.09375,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:160},{angle:135,originX:.125,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:161}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:163},{angle:90,originX:.0625,originY:-.0625,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:164}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:166}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:168},{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[.3535533905932738,-.7071067811865476],sourceLine:169}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.03125,deltaY:.0625,dashes:[0,-.0625],sourceLine:171}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:173},{angle:0,originX:0,originY:.09375,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:174},{angle:0,originX:0,originY:.1875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:175},{angle:90,originX:.03125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:176},{angle:90,originX:.125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:177},{angle:90,originX:.21875,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:178}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:180},{angle:180,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:181},{angle:300,originX:0,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:182},{angle:60,originX:.1,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:183},{angle:300,originX:.1,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:184},{angle:60,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:185},{angle:180,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:186},{angle:300,originX:-.05,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:187},{angle:180,originX:-.05,originY:-.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:188},{angle:60,originX:-.4,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:189},{angle:300,originX:-.4,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:190},{angle:60,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:191},{angle:180,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:192},{angle:300,originX:.2,originY:.346410161,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:193},{angle:180,originX:.2,originY:.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:194},{angle:0,originX:.2,originY:.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:195},{angle:0,originX:.2,originY:-.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:196},{angle:120,originX:.05,originY:.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:197},{angle:120,originX:-.25,originY:.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:198},{angle:240,originX:-.25,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:199},{angle:240,originX:.05,originY:-.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:200}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[.25,-.25],sourceLine:202},{angle:45,originX:.25,originY:0,deltaX:.176776695296,deltaY:.176776695296,dashes:[.0625,-.2285533906,.0625,-.353553390593],sourceLine:203}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:205},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:206},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:207}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:209},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:210},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:211}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:213},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:214},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:215}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:.707106781,deltaY:.707106781,dashes:[.1875,-1.226713563],sourceLine:217},{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:218},{angle:135,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:219}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.03125,dashes:[],sourceLine:221},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:222}]},{name:"GRAVEL",description:"",lines:[{angle:228.012787504,originX:.72,originY:1,deltaX:12.0413651692039,deltaY:.0743294146632,dashes:[.134536,-13.3190880470737],sourceLine:224},{angle:184.969740728,originX:.63,originY:.9,deltaX:-12.0415166747131,deltaY:.0433148081592,dashes:[.230868,-22.85592476123],sourceLine:225},{angle:132.510447078,originX:.4,originY:.88,deltaX:-14.8659418273816,deltaY:.061429511683,dashes:[.162788,-16.1160325960997],sourceLine:226},{angle:267.273689006,originX:.01,originY:.63,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:227},{angle:292.833654178,originX:0,originY:.42,deltaX:-12.9999095019474,deltaY:.048507125026,dashes:[.206155,-20.4093731280883],sourceLine:228},{angle:357.273689006,originX:.08,originY:.23,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:229},{angle:37.6942404667,originX:.29,originY:.22,deltaX:-16.4011800288558,deltaY:.0359675000664,dashes:[.278029,-27.524848548916],sourceLine:230},{angle:72.2553283749,originX:.51,originY:.39,deltaX:23.0867613281116,deltaY:.0380969659053,dashes:[.262488,-25.9863214968134],sourceLine:231},{angle:121.429565615,originX:.59,originY:.64,deltaX:15.2642639131074,deltaY:.047404546271,dashes:[.21095,-20.884073109729],sourceLine:232},{angle:175.236358309,originX:.48,originY:.82,deltaX:-11.0450488205478,deltaY:.083045479801,dashes:[.240832,-11.8007625787923],sourceLine:233},{angle:222.397437798,originX:.24,originY:.84,deltaX:16.2787889313724,deltaY:.0321080648114,dashes:[.311448,-30.8333750047949],sourceLine:234},{angle:138.814074834,originX:1,originY:.62,deltaX:9.2190645101588,deltaY:.0940720868851,dashes:[.106301,-10.5238448127347],sourceLine:235},{angle:171.46923439,originX:.92,originY:.69,deltaX:-13.1528534931484,deltaY:.0494468176315,dashes:[.202237,-20.021511416157],sourceLine:236},{angle:225,originX:.72,originY:.72,deltaX:.7071067811865,deltaY:.7071067811865,dashes:[.141421,-1.2727925623731],sourceLine:237},{angle:203.198590514,originX:.65,originY:.84,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.076158,-7.5396151058639],sourceLine:238},{angle:291.801409486,originX:.58,originY:.81,deltaX:-3.156820749011,deltaY:.185695338158,dashes:[.107703,-5.2774618071345],sourceLine:239},{angle:30.9637565321,originX:.62,originY:.71,deltaX:3.6014702879928,deltaY:.1714985851408,dashes:[.174929,-5.6560228948453],sourceLine:240},{angle:161.565051177,originX:.77,originY:.8,deltaX:-2.2135943621183,deltaY:.3162277660138,dashes:[.126491,-3.0357866601684],sourceLine:241},{angle:16.389540334,originX:0,originY:.81,deltaX:10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.5428451466694],sourceLine:242},{angle:70.3461759419,originX:.17,originY:.86,deltaX:-11.7045066155395,deltaY:.0672672793901,dashes:[.148661,-14.717407747319],sourceLine:243},{angle:293.198590514,originX:.77,originY:1,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.152315,-7.4634581058639],sourceLine:244},{angle:343.610459666,originX:.83,originY:.86,deltaX:-10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.542845146669],sourceLine:245},{angle:339.44395478,originX:0,originY:.19,deltaX:-5.3838927710229,deltaY:.117041147157,dashes:[.17088,-8.3731237453175],sourceLine:246},{angle:294.775140569,originX:.16,originY:.13,deltaX:-12.0828441168135,deltaY:.0698430296124,dashes:[.143178,-14.174643063276],sourceLine:247},{angle:66.8014094864,originX:.78,originY:0,deltaX:5.3835637472487,deltaY:.1313064328552,dashes:[.152315,-7.4634581058639],sourceLine:248},{angle:17.3540246363,originX:.84,originY:.14,deltaX:-13.6013396869991,deltaY:.0596549986364,dashes:[.167631,-16.59542361424],sourceLine:249},{angle:69.4439547804,originX:.29,originY:0,deltaX:-5.383892771022,deltaY:.1170411471946,dashes:[.08544,-8.4585637453175],sourceLine:250},{angle:101.309932474,originX:.72,originY:0,deltaX:4.1184388379018,deltaY:.1961161351396,dashes:[.05099,-5.0480295135928],sourceLine:251},{angle:165.963756532,originX:.71,originY:.05,deltaX:-3.1529631254726,deltaY:.2425356250323,dashes:[.206155,-3.9169506256177],sourceLine:252},{angle:186.009005957,originX:.51,originY:.1,deltaX:-10.0497393137326,deltaY:.0523423921723,dashes:[.19105,-18.9139231745428],sourceLine:253},{angle:303.690067526,originX:.62,originY:.62,deltaX:-2.2188007849008,deltaY:.2773500981134,dashes:[.144222,-3.461329275464],sourceLine:254},{angle:353.157226587,originX:.7,originY:.5,deltaX:17.1171966955143,deltaY:.0397150736497,dashes:[.251794,-24.9275626240283],sourceLine:255},{angle:60.9453959009,originX:.95,originY:.47,deltaX:-8.0616726575653,deltaY:.0971285862325,dashes:[.102956,-10.192674140987],sourceLine:256},{angle:90,originX:1,originY:.56,deltaX:1,deltaY:1,dashes:[.06,-.94],sourceLine:257},{angle:120.256437164,originX:.49,originY:.13,deltaX:-8.0619364083848,deltaY:.0719815751411,dashes:[.138924,-13.7535199894498],sourceLine:258},{angle:48.0127875042,originX:.42,originY:.25,deltaX:12.0413651692041,deltaY:.0743294146212,dashes:[.269072,-13.1845520470737],sourceLine:259},{angle:0,originX:.6,originY:.45,deltaX:1,deltaY:1,dashes:[.26,-.74],sourceLine:260},{angle:325.304846469,originX:.86,originY:.45,deltaX:12.2063917682497,deltaY:-.063245553253,dashes:[.158114,-15.653274300842],sourceLine:261},{angle:254.054604099,originX:.99,originY:.36,deltaX:4.1208169184605,deltaY:.1373605639542,dashes:[.145602,-7.1345078892805],sourceLine:262},{angle:207.645975364,originX:.95,originY:.22,deltaX:21.4708691170287,deltaY:.0421824539631,dashes:[.237065,-23.4694741822594],sourceLine:263},{angle:175.42607874,originX:.74,originY:.11,deltaX:13.0383438432524,deltaY:.039872611164,dashes:[.250799,-24.8290734079689],sourceLine:264}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:266},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:267},{angle:60,originX:.125,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:268}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:270},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:271},{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[-.25,.125],sourceLine:272}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.0625,dashes:[1,-.5],sourceLine:274},{angle:90,originX:0,originY:0,deltaX:-.25,deltaY:.0625,dashes:[1,-.5],sourceLine:275}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:277},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:278},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:279}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:292}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:294}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:296}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:298}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:300},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:301}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:303}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:305}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:307}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:309}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:311}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:313}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:315},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:316}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:318},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:319}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:321},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:322}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:327}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.25,dashes:[.25,-.25,0,-.25,0,-.25],sourceLine:329}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:331},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:332}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:334},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:335},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:336}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:338},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:339},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:340}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:342},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:343},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:344},{angle:0,originX:0,originY:.15625,deltaX:0,deltaY:.25,dashes:[],sourceLine:345}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.09375,dashes:[],sourceLine:347},{angle:45,originX:.066291261,originY:0,deltaX:0,deltaY:.09375,dashes:[0,-.09375],sourceLine:348}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:350},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:351}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:353},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:354},{angle:120,originX:.0625,originY:.108253176,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:355}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:357},{angle:45,originX:0,originY:.0625,deltaX:0,deltaY:.125,dashes:[],sourceLine:358}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.125,-.875],sourceLine:360},{angle:90,originX:.0625,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.0625,-1.669550806],sourceLine:361},{angle:90,originX:.078125,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:362},{angle:90,originX:.046875,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:363},{angle:60,originX:.09375,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:364},{angle:120,originX:.03125,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:365}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:367},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.125],sourceLine:368}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:370},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:371},{angle:0,originX:-.09375,originY:.162379763,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:372}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:374},{angle:90,originX:.125,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:375}]}],issues:[]},jl={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:20},{angle:90,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:21}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:23}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:25},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:26}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:28},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:29}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:31},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:32},{angle:45,originX:8.98026,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:33},{angle:45,originX:13.4704,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:34}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:36},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:37}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:5.55625,deltaY:3.175,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:39}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:41},{angle:135,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:42}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:6.35,deltaY:3.175,dashes:[7.9375,-4.7625],sourceLine:45}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:47},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[203.2,-203.2],sourceLine:48}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:50},{angle:0,originX:-203.2,originY:9.525,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:51},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:52},{angle:90,originX:-9.525,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:53}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:55},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:101.6,dashes:[203.2,-203.2],sourceLine:56}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:58},{angle:0,originX:0,originY:57.15,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:59},{angle:0,originX:50.8,originY:67.7418,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:60},{angle:0,originX:50.8,originY:124.892,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:61},{angle:90,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:62},{angle:90,originX:-9.525,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:63},{angle:90,originX:50.8,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:64},{angle:90,originX:41.275,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:65}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:67.7418,dashes:[],sourceLine:67},{angle:90,originX:0,originY:0,deltaX:67.7418,deltaY:101.6,dashes:[67.7418,-67.7418],sourceLine:68}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:104.896,deltaY:-149.807,dashes:[19.05,-209.55],sourceLine:70},{angle:355,originX:0,originY:0,deltaX:-51.76101082,deltaY:187.25814969,dashes:[15.24,-167.64058417],sourceLine:71},{angle:100.4514447,originX:15.182007,originY:-1.3282535,deltaX:145.5569059,deltaY:-176.270089,dashes:[16.1900088,-178.0902446],sourceLine:72},{angle:46.1842,originX:0,originY:50.8,deltaX:157.343,deltaY:-224.71,dashes:[28.575,-314.325],sourceLine:73},{angle:96.63555761,originX:22.5899,originY:47.2965,deltaX:218.33577212,deltaY:-264.40480444,dashes:[24.28502314,-267.13560816],sourceLine:74},{angle:351.18415117,originX:0,originY:50.8,deltaX:196.67912063,deltaY:280.88740361,dashes:[22.85996707,-251.45973192],sourceLine:75},{angle:21,originX:25.4,originY:38.1,deltaX:104.89565868,deltaY:-149.80652586,dashes:[19.05,-209.55],sourceLine:76},{angle:326,originX:25.4,originY:38.1,deltaX:-51.7604,deltaY:187.258,dashes:[15.24,-167.64],sourceLine:77},{angle:71.451445,originX:38.0345326,originY:29.5779001,deltaX:145.5567546,deltaY:-176.2700748,dashes:[16.1900088,-178.0899376],sourceLine:78},{angle:37.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-165.608,0,-170.18,0,-168.275],sourceLine:79},{angle:7.5,originX:0,originY:0,deltaX:79.3242,deltaY:90.6018,dashes:[0,-97.028,0,-161.798,0,-64.135],sourceLine:80},{angle:-32.5,originX:-56.642,originY:0,deltaX:117.434,deltaY:68.0212,dashes:[0,-63.5,0,-198.12,0,-262.89],sourceLine:81},{angle:-42.5,originX:-82.042,originY:0,deltaX:92.0344,deltaY:118.821,dashes:[0,-82.55,0,-131.572,0,-186.69],sourceLine:82}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:101.6,deltaY:101.6,dashes:[304.8,-101.6],sourceLine:84},{angle:135,originX:71.842,originY:71.842,deltaX:101.6,deltaY:-101.6,dashes:[304.8,-101.6],sourceLine:85}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:87},{angle:90,originX:50.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:88},{angle:90,originX:101.6,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:89},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:90},{angle:90,originX:203.2,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:91},{angle:90,originX:254,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:92},{angle:90,originX:304.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:93},{angle:0,originX:0,originY:304.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:94},{angle:0,originX:0,originY:355.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:95},{angle:0,originX:0,originY:406.4,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:96},{angle:0,originX:0,originY:457.2,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:97},{angle:0,originX:0,originY:508,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:98},{angle:0,originX:0,originY:558.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:99},{angle:0,originX:0,originY:609.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:100}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:55.88,deltaY:25.4,dashes:[381,-50.8,127,-25.4],sourceLine:102},{angle:0,originX:33.782,originY:12.7,deltaX:-25.4,deltaY:33.782,dashes:[76.2,-8.382,152.4,-19.05],sourceLine:103},{angle:0,originX:12.7,originY:21.59,deltaX:132.08,deltaY:17.018,dashes:[203.2,-35.56,101.6,-25.4],sourceLine:104}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:647.7,deltaY:304.8,dashes:[152.4,-127,177.8,-76.2,228.6,-101.6],sourceLine:106},{angle:0,originX:152.4,originY:12.7,deltaX:647.7,deltaY:304.8,dashes:[127,-482.6,101.6,-152.4],sourceLine:107},{angle:0,originX:457.2,originY:-19.05,deltaX:647.7,deltaY:304.8,dashes:[76.2,-787.4],sourceLine:108},{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:109},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[285.75,-933.45],sourceLine:110},{angle:90,originX:279.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[266.7,-952.5],sourceLine:111},{angle:90,originX:457.2,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:112},{angle:90,originX:533.4,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:113},{angle:90,originX:762,originY:0,deltaX:304.8,deltaY:215.9,dashes:[279.4,-939.8],sourceLine:114}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:28.5242,deltaY:39.8018,dashes:[0,-38.608,0,-43.18,0,-41.275],sourceLine:116},{angle:7.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-20.828,0,-34.798,0,-13.335],sourceLine:117},{angle:-32.5,originX:-31.242,originY:0,deltaX:66.6344,deltaY:42.6212,dashes:[0,-12.7,0,-45.72,0,-59.69],sourceLine:118},{angle:-42.5,originX:-31.242,originY:0,deltaX:41.2344,deltaY:68.0212,dashes:[0,-6.35,0,-29.972,0,-34.29],sourceLine:119}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:121},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:122},{angle:0,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:123},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:124},{angle:0,originX:0,originY:12.7,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:125},{angle:0,originX:0,originY:19.05,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:126},{angle:90,originX:12.7,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:127},{angle:90,originX:19.05,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:128}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:130},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:131}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:133},{angle:90,originX:0,originY:0,deltaX:0,deltaY:12.7,dashes:[6.35,-6.35],sourceLine:134},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:12.7,dashes:[-6.35,6.35],sourceLine:135}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8.382,dashes:[],sourceLine:137},{angle:90,originX:22.86,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:138},{angle:90,originX:20.32,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:139},{angle:0,originX:22.86,originY:1.397,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:140},{angle:0,originX:22.86,originY:2.794,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:141},{angle:0,originX:22.86,originY:4.191,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:142},{angle:0,originX:22.86,originY:5.588,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:143},{angle:0,originX:22.86,originY:6.985,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:144}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:146},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:147},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:148},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:4.7625,dashes:[4.7625,-3.175],sourceLine:149}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:151},{angle:135,originX:1.5875,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:152},{angle:135,originX:2.38125,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:153},{angle:135,originX:3.175,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:154}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:156},{angle:90,originX:1.5875,originY:-1.5875,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:157}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:159}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:161},{angle:45,originX:0,originY:0,deltaX:0,deltaY:17.9605,dashes:[8.980256121069154,-17.960512242138307],sourceLine:162}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.79375,deltaY:1.5875,dashes:[0,-1.5875],sourceLine:164}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:166},{angle:0,originX:0,originY:2.38125,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:167},{angle:0,originX:0,originY:4.7625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:168},{angle:90,originX:.79375,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:169},{angle:90,originX:3.175,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:170},{angle:90,originX:5.55625,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:171}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:173},{angle:180,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:174},{angle:300,originX:0,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:175},{angle:60,originX:2.54,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:176},{angle:300,originX:2.54,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:177},{angle:60,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:178},{angle:180,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:179},{angle:300,originX:-1.27,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:180},{angle:180,originX:-1.27,originY:-2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:181},{angle:60,originX:-10.16,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:182},{angle:300,originX:-10.16,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:183},{angle:60,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:184},{angle:180,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:185},{angle:300,originX:5.08,originY:8.7988180894,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:186},{angle:180,originX:5.08,originY:8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:187},{angle:0,originX:5.08,originY:4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:188},{angle:0,originX:5.08,originY:-4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:189},{angle:120,originX:1.27,originY:6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:190},{angle:120,originX:-6.35,originY:2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:191},{angle:240,originX:-6.35,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:192},{angle:240,originX:1.27,originY:-6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:193}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:195},{angle:45,originX:6.35,originY:0,deltaX:4.490128053,deltaY:4.490128053,dashes:[1.5875,-5.8052561314,1.5875,-8.9802561314],sourceLine:196}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:198},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:199},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:200}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:202},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:203},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:204}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:206},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:207},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:208}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:17.96051224,deltaY:17.96051224,dashes:[4.7625,-31.15852448],sourceLine:210},{angle:45,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:211},{angle:135,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:212}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.79375,dashes:[],sourceLine:214},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:215}]},{name:"GRAVEL",description:"",lines:[{angle:228.0127875,originX:18.288,originY:25.4,deltaX:305.85067529778,deltaY:1.88796713245,dashes:[3.4172144,-338.30483639565],sourceLine:217},{angle:184.969741,originX:16.002,originY:22.86,deltaX:-305.8545235377,deltaY:1.10019612724,dashes:[5.8640472,-580.54048893524],sourceLine:218},{angle:132.5104471,originX:10.16,originY:22.352,deltaX:-377.59492241548,deltaY:1.56030959675,dashes:[4.1348152,-409.347227941],sourceLine:219},{angle:267.273689,originX:.254,originY:16.002,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:220},{angle:292.83365418,originX:0,originY:10.668,deltaX:-330.19770134945,deltaY:1.23208097566,dashes:[5.236337,-518.39807745344],sourceLine:221},{angle:357.273689,originX:2.032,originY:5.842,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:222},{angle:37.69424047,originX:7.366,originY:5.588,deltaX:-416.58997273292,deltaY:.91357450169,dashes:[7.0619366,-699.13115314247],sourceLine:223},{angle:72.25532837,originX:12.954,originY:9.906,deltaX:586.40373773403,deltaY:.96766293399,dashes:[6.6671952,-660.05256601905],sourceLine:224},{angle:121.42956562,originX:14.986,originY:16.256,deltaX:387.71230339293,deltaY:1.2040754753,dashes:[5.35813,-530.45545698712],sourceLine:225},{angle:175.2363583,originX:12.192,originY:20.828,deltaX:-280.5442400419,deltaY:2.10935518695,dashes:[6.1171328,-299.7393695],sourceLine:226},{angle:222.3974378,originX:6.096,originY:21.336,deltaX:413.48123885686,deltaY:.81554484621,dashes:[7.9107792,-783.16772512177],sourceLine:227},{angle:138.81407483,originX:25.4,originY:15.748,deltaX:234.164238558,deltaY:2.38943100688,dashes:[2.7000454,-267.30565824344],sourceLine:228},{angle:171.4692344,originX:23.368,originY:17.526,deltaX:-334.082478726,deltaY:1.25594916784,dashes:[5.1368198,-508.5463899704],sourceLine:229},{angle:225,originX:18.288,originY:18.288,deltaX:17.96051224214,deltaY:17.96051224214,dashes:[3.5920934,-32.32893108428],sourceLine:230},{angle:203.19859051,originX:16.51,originY:21.336,deltaX:-136.74251918,deltaY:3.33518339548,dashes:[1.9344132,-191.50622368894],sourceLine:231},{angle:291.80140949,originX:14.732,originY:20.574,deltaX:-80.18324702488,deltaY:4.71666158921,dashes:[2.7356562,-134.0475299],sourceLine:232},{angle:30.96375653,originX:15.748,originY:18.034,deltaX:91.47734531502,deltaY:4.35606406258,dashes:[4.4431966,-143.6629815291],sourceLine:233},{angle:161.56505118,originX:19.558,originY:20.32,deltaX:-56.2252967978,deltaY:8.03218525675,dashes:[3.2128714,-77.10898116828],sourceLine:234},{angle:16.389540334,originX:0,originY:20.574,deltaX:265.17991128726,deltaY:1.43340492604,dashes:[4.50088,-445.58826672539],sourceLine:235},{angle:70.34617594,originX:4.318,originY:21.844,deltaX:-297.29446803469,deltaY:1.70858889651,dashes:[3.7759894,-373.822156782],sourceLine:236},{angle:293.19859051,originX:19.558,originY:25.4,deltaX:-136.7425191801,deltaY:3.33518339548,dashes:[3.868801,-189.57183588894],sourceLine:237},{angle:343.61045967,originX:21.082,originY:21.844,deltaX:-265.17991128725,deltaY:1.433404926,dashes:[4.50088,-445.5882667254],sourceLine:238},{angle:339.44395478,originX:0,originY:4.826,deltaX:-136.75087638398,deltaY:2.97284513779,dashes:[4.340352,-212.67734313106],sourceLine:239},{angle:294.7751406,originX:4.064,originY:3.302,deltaX:-306.90424056705,deltaY:1.77401295215,dashes:[3.6367212,-360.0359338072],sourceLine:240},{angle:66.80140949,originX:19.812,originY:0,deltaX:136.74251918012,deltaY:3.33518339452,dashes:[3.868801,-189.57183588894],sourceLine:241},{angle:17.35402464,originX:21.336,originY:3.556,deltaX:-345.47402804977,deltaY:1.51523696536,dashes:[4.2578274,-421.523759802],sourceLine:242},{angle:69.44395478,originX:7.366,originY:0,deltaX:-136.75087638396,deltaY:2.97284513874,dashes:[2.170176,-214.84751913106],sourceLine:243},{angle:101.309932474,originX:18.288,originY:0,deltaX:104.60834648271,deltaY:4.98134983255,dashes:[1.295146,-128.21994964526],sourceLine:244},{angle:165.963756532,originX:18.034,originY:1.27,deltaX:-80.085263387,deltaY:6.16040487582,dashes:[5.236337,-99.49054589069],sourceLine:245},{angle:186.00900596,originX:12.954,originY:2.54,deltaX:-255.26337856879,deltaY:1.32949676118,dashes:[4.85267,-480.41364863337],sourceLine:246},{angle:303.69006753,originX:15.748,originY:15.748,deltaX:-56.35753993648,deltaY:7.0446924921,dashes:[3.6632388,-87.9177635968],sourceLine:247},{angle:353.15722659,originX:17.78,originY:12.7,deltaX:434.77679606606,deltaY:1.0087628707,dashes:[6.3955676,-633.16009065031],sourceLine:248},{angle:60.9453959,originX:24.13,originY:11.938,deltaX:-204.76648550216,deltaY:2.46706609031,dashes:[2.6150824,-258.8939231811],sourceLine:249},{angle:90,originX:25.4,originY:14.224,deltaX:25.4,deltaY:25.4,dashes:[1.524,-23.876],sourceLine:250},{angle:120.25643716,originX:12.446,originY:3.302,deltaX:-204.77318477297,deltaY:1.8283320086,dashes:[3.5286696,-349.339407732],sourceLine:251},{angle:48.0127875,originX:10.668,originY:6.35,deltaX:305.85067529778,deltaY:1.88796713138,dashes:[6.8344288,-334.88762199565],sourceLine:252},{angle:0,originX:15.24,originY:11.43,deltaX:25.4,deltaY:25.4,dashes:[6.604,-18.796],sourceLine:253},{angle:325.3048465,originX:21.844,originY:11.43,deltaX:310.04235091354,deltaY:-1.6064370526,dashes:[4.0160956,-397.5931672414],sourceLine:254},{angle:254.0546041,originX:25.146,originY:9.144,deltaX:104.6687497289,deltaY:3.48895832444,dashes:[3.6982908,-181.21650038772],sourceLine:255},{angle:207.64597536,originX:24.13,originY:5.588,deltaX:545.36007557253,deltaY:1.07143433066,dashes:[6.021451,-596.12464422938],sourceLine:256},{angle:175.42607874,originX:18.796,originY:2.794,deltaX:331.1739336186,deltaY:1.01276432357,dashes:[6.3702946,-630.6584645624],sourceLine:257}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:259},{angle:120,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:260},{angle:60,originX:3.175,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:261}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:263},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:264},{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[-6.35,3.175],sourceLine:265}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:267},{angle:90,originX:0,originY:0,deltaX:-6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:268}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:270},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:271},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:272}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:285}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:287}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:289}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:291}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:293},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:294}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:296}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:298}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:300}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:302}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:304}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:306}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:308},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:309}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:311},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:312}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:314},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:315}]},{name:"JIS_LC_20",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:322},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:323}]},{name:"JIS_LC_20A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:325},{angle:45,originX:1,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:326}]},{name:"JIS_LC_8",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:328},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:329}]},{name:"JIS_LC_8A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:331},{angle:45,originX:1,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:332}]},{name:"JIS_RC_10",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:334},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:335},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:336}]},{name:"JIS_RC_15",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:338},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:339},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:340}]},{name:"JIS_RC_18",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:342},{angle:45,originX:1,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:343},{angle:45,originX:2,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:344}]},{name:"JIS_RC_30",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:346},{angle:45,originX:1,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:347},{angle:45,originX:2,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:348}]},{name:"JIS_STN_1E",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:350},{angle:45,originX:.705,originY:0,deltaX:0,deltaY:1,dashes:[1,-.5],sourceLine:351}]},{name:"JIS_STN_2.5",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.5,dashes:[],sourceLine:353},{angle:45,originX:1.765,originY:0,deltaX:0,deltaY:2.5,dashes:[1.2,-.5],sourceLine:354}]},{name:"JIS_WOOD",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[],sourceLine:356}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:359}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:6.35,dashes:[6.35,-6.35,0,-6.35,0,-6.35],sourceLine:361}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:363},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:364}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:366},{angle:60,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:367},{angle:120,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:368}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:370},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:371},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:372}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:374},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:375},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:376},{angle:0,originX:0,originY:3.96875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:377}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.38125,dashes:[],sourceLine:379},{angle:45,originX:1.6838,originY:0,deltaX:0,deltaY:2.38125,dashes:[0,-2.38125],sourceLine:380}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:382},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:383}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:385},{angle:60,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:386},{angle:120,originX:1.5875,originY:2.7496306704,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:387}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:389},{angle:45,originX:0,originY:1.5875,deltaX:0,deltaY:3.175,dashes:[],sourceLine:390}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[3.175,-22.225],sourceLine:392},{angle:90,originX:1.5875,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.5875,-42.4065904724],sourceLine:393},{angle:90,originX:1.984375,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:394},{angle:90,originX:1.190625,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:395},{angle:60,originX:2.38125,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:396},{angle:120,originX:.79375,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:397}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:399},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-3.175],sourceLine:400}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:402},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:403},{angle:0,originX:-2.38125,originY:4.1244459802,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:404}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:406},{angle:90,originX:3.175,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:407}]}],issues:[]};var Jn=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(Jn||{}),Gl=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(Gl||{}),Ks=(n=>(n[n.HatchObject=0]="HatchObject",n[n.GradientObject=1]="GradientObject",n))(Ks||{}),Hl=(n=>(n[n.PreDefinedGradient=0]="PreDefinedGradient",n[n.UserDefinedGradient=1]="UserDefinedGradient",n))(Hl||{});const ya=class ya extends le{constructor(){super(),this._gradientAngle=0,this._elevation=0,this._geo=new Nt,this._isSolidFill=!1,this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1,this._patternName="",this._patternNameSet=!1,this._patternType=1,this._patternAngle=0,this._patternAngleSet=!1,this._patternScale=1,this._patternScaleSet=!1,this._associative=!1,this._associativeSet=!1,this._backgroundColor=void 0,this._backgroundColorSet=!1,this._patternDouble=!1,this._patternDoubleSet=!1,this._hatchStyle=0,this._hatchStyleSet=!1,this._hatchObjectType=0,this._gradientAngle=0,this._gradientShift=0,this._shadeTintValue=0,this._gradientStartColor=void 0,this._gradientEndColor=void 0,this._gradientType=0,this._gradientName="",this._gradientOneColorMode=!1}get dxfTypeName(){return"HATCH"}get isGradient(){return this._hatchObjectType===1}get isHatch(){return this._hatchObjectType===0}get isSolidFill(){return this._isSolidFill||this.getEffectivePatternName().trim().toUpperCase()===rn}set isSolidFill(e){this._isSolidFill=e}get color(){if(this.hasExplicitColor())return this.getEntityColor();const e=this.database,t=Xe.instance().getVar(I.HPCOLOR,e);return t instanceof B&&t.colorMethod!==exports.AcCmColorMethod.None?t.clone():e.cecolor.clone()}set color(e){this.setEntityColor(e)}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e??"",this._isSolidFill=this._patternName.trim().toUpperCase()===rn,this._patternNameSet=!0,this.updatePredefinedPatternDefinitionLines()}get patternType(){return this._patternType}set patternType(e){this._patternType=e,e!==1&&this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1),this.updatePredefinedPatternDefinitionLines()}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e,this._patternAngleSet=!0}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}get associative(){return this._associative}set associative(e){this._associative=!!e,this._associativeSet=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e==null?void 0:e.clone(),this._backgroundColorSet=!0}get patternDouble(){return this._patternDouble}set patternDouble(e){this._patternDouble=!!e,this._patternDoubleSet=!0}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e,this._hatchStyleSet=!0}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get hatchObjectType(){return this._hatchObjectType}set hatchObjectType(e){this._hatchObjectType=e}get gradientAngle(){return this._gradientAngle}set gradientAngle(e){this._gradientAngle=e}get gradientShift(){return this._gradientShift}set gradientShift(e){this._gradientShift=e}get gradientType(){return this._gradientType}set gradientType(e){this._gradientType=e}get gradientName(){return this.isGradient&&this._gradientName.trim()===""?kl:this._gradientName}set gradientName(e){this._gradientName=e??""}get gradientOneColorMode(){return this._gradientOneColorMode}set gradientOneColorMode(e){this._gradientOneColorMode=e}get shadeTintValue(){return this._shadeTintValue}set shadeTintValue(e){this._shadeTintValue=e}get gradientStartColor(){return this._gradientStartColor}set gradientStartColor(e){this._gradientStartColor=e==null||!Number.isFinite(e)?void 0:e&16777215}get gradientEndColor(){return this._gradientEndColor}set gradientEndColor(e){this._gradientEndColor=e==null||!Number.isFinite(e)?void 0:e&16777215}applyPatternDefaultsFromSysVars(e){const t=Xe.instance();if(!this.hasExplicitLayer()){const r=t.getVar(I.HPLAYER,e);this.shouldUseSysVarOverride(r)&&(this.layer=r)}if(!this.hasExplicitTransparency()){const r=this.parseHpTransparency(t.getVar(I.HPTRANSPARENCY,e));r&&(this.transparency=r)}if(this._backgroundColorSet||(this._backgroundColor=this.parseHpBackgroundColor(t.getVar(I.HPBACKGROUNDCOLOR,e)),this._backgroundColorSet=!0),!this._patternNameSet){const r=t.getVar(I.HPNAME,e);this._patternName=typeof r=="string"?r:"",this._patternNameSet=!0}if(!this._patternAngleSet){const r=t.getVar(I.HPANG,e);this._patternAngle=typeof r=="number"&&Number.isFinite(r)?r:0,this._patternAngleSet=!0}if(this._patternScaleSet||(this._patternScale=this.normalizePatternScale(t.getVar(I.HPSCALE,e)),this._patternScaleSet=!0),!this._associativeSet){const r=t.getVar(I.HPASSOC,e);this._associative=typeof r=="number"?r!==0:!1,this._associativeSet=!0}if(this._hatchStyleSet||(this._hatchStyle=this.normalizeHatchStyle(t.getVar(I.HPISLANDDETECTION,e)),this._hatchStyleSet=!0),!this._patternDoubleSet){const r=t.getVar(I.HPDOUBLE,e);this._patternDouble=typeof r=="number"?r!==0:!1,this._patternDoubleSet=!0}this.updatePredefinedPatternDefinitionLines()}getEffectivePatternName(){if(this._patternNameSet)return this._patternName;const e=this.database,t=Xe.instance().getVar(I.HPNAME,e);return typeof t=="string"?t:this._patternName}shouldResolveColorFromCecolor(){return!1}getEffectivePatternAngle(){if(this._patternAngleSet)return this._patternAngle;const e=this.database,t=Xe.instance().getVar(I.HPANG,e);return typeof t=="number"&&Number.isFinite(t)?t:this._patternAngle}getEffectivePatternScale(){if(this._patternScaleSet)return this._patternScale;const e=this.database;return this.normalizePatternScale(Xe.instance().getVar(I.HPSCALE,e))}getEffectiveAssociative(){if(this._associativeSet)return this._associative;const e=this.database,t=Xe.instance().getVar(I.HPASSOC,e);return typeof t=="number"?t!==0:this._associative}normalizePatternScale(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:1}normalizeHatchStyle(e){return typeof e!="number"||!Number.isFinite(e)?1:e===0?0:e===2?2:1}shouldUseSysVarOverride(e){if(typeof e!="string")return!1;const t=e.trim().toLowerCase();return t!==""&&t!=="."&&t!=="use current"}parseHpBackgroundColor(e){if(e instanceof B)return e.colorMethod===exports.AcCmColorMethod.None?void 0:e.clone();if(typeof e!="string")return;const t=e.trim().toLowerCase();if(!(!t||t==="."||t==="none"))return B.fromString(e)}parseHpTransparency(e){if(e instanceof te)return e.clone();if(!this.shouldUseSysVarOverride(e))return;const t=e.trim();if(/^bylayer$/i.test(t)||/^byblock$/i.test(t))return te.fromString(t);const r=Number(t);if(Number.isInteger(r)&&r>=0&&r<=90){const i=new te;return i.percentage=r,i}}updatePredefinedPatternDefinitionLines(e=this.getEffectivePatternName(),t=this.getEffectivePatternScale()){if(this.patternType!==1||!(this._definitionLinesAutoGenerated||this._definitionLines.length===0))return;const i=e.trim().toUpperCase();if(!i||i===rn){this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1;return}const s=this.normalizePatternScale(t);if(this._definitionLinesAutoGenerated&&this._definitionLinesPatternName===i&&this._definitionLinesPatternScale===s)return;const a=jl.patterns.find(o=>o.name.trim().toUpperCase()===i);if(!a){this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1);return}this._definitionLines=a.lines.map(o=>({angle:o.angle*Math.PI/180,base:{x:o.originX*s,y:o.originY*s},offset:{x:o.deltaX*s,y:o.deltaY*s},dashLengths:o.dashes.map(l=>l*s)})),this._definitionLinesAutoGenerated=!0,this._definitionLinesPatternName=i,this._definitionLinesPatternScale=s}add(e){this._geo.add(e)}buildAreasFromLoops(){const e=this._geo.loops;if(e.length===0)return[];if(e.length===1)return[this._geo];const t=this._geo.buildHierarchy(),r=[],i=(s,a)=>{if(s.index>=0&&a%2===0){const o=new Nt;o.add(e[s.index]),s.children.forEach(l=>{l.index>=0&&o.add(e[l.index])}),r.push(o)}s.children.forEach(o=>i(o,a+1))};return t.children.forEach(s=>i(s,0)),r.length>0?r:[this._geo]}getCalculatedAreaValue(){const e=this.buildAreasFromLoops();return e.length===0?0:e.reduce((t,r)=>t+r.area,0)}get geometricExtents(){const e=this.buildAreasFromLoops();if(e.length===0)return new R;const t=new R;return e.forEach(r=>{const i=r.box;t.union(new R({x:i.min.x,y:i.min.y,z:this._elevation},{x:i.max.x,y:i.max.y,z:this._elevation}))}),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Jn[0],value:0},{label:Jn[1],value:1},{label:Jn[2],value:2}],accessor:{get:()=>this.patternType,set:e=>{this.patternType=e}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:e=>{this.patternName=e}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:e=>{this.patternAngle=e}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:e=>{this.patternScale=e}}},{name:"associative",type:"boolean",editable:!0,accessor:{get:()=>this.associative,set:e=>{this.associative=e}}},{name:"backgroundColor",type:"color",editable:!0,accessor:{get:()=>this.backgroundColor,set:e=>{this.backgroundColor=e}}},{name:"patternDouble",type:"boolean",editable:!0,accessor:{get:()=>this.patternDouble,set:e=>{this.patternDouble=e}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:e=>{this.elevation=e}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.getCalculatedAreaValue()}}]}]}}subGetOsnapPoints(e,t,r,i){const s=this._elevation,a=[];if(this._geo.loops.forEach(o=>{var l;if(o instanceof ee){const c=o,h=c.numberOfVertices;if(h===0)return;switch(e){case v.EndPoint:for(let d=0;d<h;d++){const p=c.getPointAt(d);i.push(new b(p.x,p.y,s))}break;case v.MidPoint:case v.Nearest:case v.Perpendicular:case v.Tangent:{const d=o.closed?h:h-1;for(let p=0;p<d;p++){const g=[];$r(c.getPointAt(p),c.getPointAt((p+1)%h),(l=c.vertices[p])==null?void 0:l.bulge,s,e,t,g),e===v.MidPoint?i.push(...g):a.push(...g)}break}}return}o.curves.forEach(c=>{if(c instanceof _t){const h=[];$r(c.startPoint,c.endPoint,void 0,s,e,t,h),e===v.MidPoint?i.push(...h):e===v.Nearest||e===v.Perpendicular||e===v.Tangent?a.push(...h):i.push(...h)}else if(c instanceof Re)switch(e){case v.EndPoint:i.push(new b(c.startPoint.x,c.startPoint.y,s),new b(c.endPoint.x,c.endPoint.y,s));break;case v.MidPoint:i.push(new b(c.midPoint.x,c.midPoint.y,s));break;case v.Nearest:{const h=c.nearestPoint({x:t.x,y:t.y});a.push(new b(h.x,h.y,s));break}case v.Perpendicular:{c.perpendicularPoints({x:t.x,y:t.y}).forEach(d=>a.push(new b(d.x,d.y,s)));break}case v.Tangent:{c.tangentPoints({x:t.x,y:t.y}).forEach(d=>a.push(new b(d.x,d.y,s)));break}}else if(c instanceof An)switch(e){case v.EndPoint:i.push(new b(c.startPoint.x,c.startPoint.y,s),new b(c.endPoint.x,c.endPoint.y,s));break;case v.MidPoint:{const h=c.getPoint(.5);i.push(new b(h.x,h.y,s));break}case v.Nearest:{const h=c.nearestPoint({x:t.x,y:t.y});a.push(new b(h.x,h.y,s));break}case v.Perpendicular:{c.perpendicularPoints({x:t.x,y:t.y}).forEach(d=>a.push(new b(d.x,d.y,s)));break}case v.Tangent:{c.tangentPoints({x:t.x,y:t.y}).forEach(d=>a.push(new b(d.x,d.y,s)));break}}})}),(e===v.Nearest||e===v.Perpendicular||e===v.Tangent)&&a.length>0){const o=Be(t,a);i.length=0,o&&i.push(o)}}subWorldDraw(e){var s;this.updatePredefinedPatternDefinitionLines();const t=e.subEntityTraits;t.fillType={solidFill:this.isSolidFill,patternAngle:this.getEffectivePatternAngle(),definitionLines:this.definitionLines,backgroundColor:(s=this.backgroundColor)==null?void 0:s.clone(),gradient:this.isGradient?{name:this.gradientName,angle:this.gradientAngle,shift:this.gradientShift,oneColorMode:this.gradientOneColorMode,shadeTintValue:this.shadeTintValue,startColor:this.gradientStartColor,endColor:this.gradientEndColor}:void 0},t.drawOrder=-1;const r=this.buildAreasFromLoops();if(r.length===0)return e.area(this._geo);if(r.length===1)return e.area(r[0]);const i=r.map(a=>e.area(a));return e.group(i)}transformBy(e){const t=e.elements,r=new gr(t[0],t[4],t[12],t[1],t[5],t[13],0,0,1);this._geo.transform(r),this._elevation=new b(0,0,this._elevation).applyMatrix4(e).z;const i=new b(1,0,0).applyMatrix4(e),s=new b().applyMatrix4(e),a=new b(i).sub(s);if(a.length()>0){const o=Math.atan2(a.y,a.x);this._patternAngle=this.getEffectivePatternAngle()+o,this._gradientAngle+=o,this._patternScale=this.getEffectivePatternScale()*a.length(),this._patternAngleSet=!0,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}return this}dxfOutFields(e){super.dxfOutFields(e);const t=this._geo.loops,r=this.getEffectivePatternName(),i=this.getEffectivePatternAngle(),s=this.getEffectivePatternScale();return this.updatePredefinedPatternDefinitionLines(r,s),e.writeSubclassMarker("AcDbHatch"),e.writePoint3d(10,{x:0,y:0,z:this.elevation}),e.writeVector3d(210,{x:0,y:0,z:1}),e.writeString(2,r||(this.isSolidFill?rn:Ol)),e.writeInt16(70,this.isSolidFill?1:0),e.writeInt16(71,this.getEffectiveAssociative()?1:0),e.writeInt16(91,t.length),t.forEach((a,o)=>{const l=o===0;if(a instanceof ee){const c=a.vertices,h=c.some(p=>(p.bulge??0)!==0);e.writeInt16(92,2),e.writeInt16(72,h?1:0),e.writeInt16(73,a.closed?1:0),e.writeInt16(93,c.length);for(const p of c)e.writePoint2d(10,p),h&&e.writeDouble(42,p.bulge??0);e.writeInt16(97,0);return}if(a instanceof ir){const c=l?1:0;e.writeInt16(92,c),e.writeInt16(93,a.numberOfEdges);for(const h of a.curves){if(h instanceof _t){e.writeInt16(72,1),e.writePoint2d(10,h.startPoint),e.writePoint2d(11,h.endPoint);continue}if(h instanceof Re){e.writeInt16(72,2),e.writePoint2d(10,h.center),e.writeDouble(40,h.radius),e.writeAngle(50,h.startAngle),e.writeAngle(51,h.endAngle),e.writeInt16(73,h.clockwise?0:1);continue}if(h instanceof An){e.writeInt16(72,3),e.writePoint2d(10,h.center);const d=new E(h.majorAxisRadius*Math.cos(h.rotation),h.majorAxisRadius*Math.sin(h.rotation));e.writePoint2d(11,d);const p=h.majorAxisRadius===0?0:h.minorAxisRadius/h.majorAxisRadius;e.writeDouble(40,p),e.writeAngle(50,h.startAngle),e.writeAngle(51,h.endAngle),e.writeInt16(73,h.clockwise?0:1);continue}if(h instanceof $e){const d=h.knots,p=h.controlPoints,g=h.weights,f=h.fitPoints,m=g.some(y=>y!==1);e.writeInt16(72,4),e.writeInt16(94,h.degree),e.writeInt16(73,m?1:0),e.writeInt16(74,h.closed?1:0),e.writeInt16(95,d.length),e.writeInt16(96,p.length),d.forEach(y=>e.writeDouble(40,y)),p.forEach((y,_)=>{e.writePoint2d(10,y),m&&e.writeDouble(42,g[_]??1)}),e.writeInt16(97,(f==null?void 0:f.length)??0),f==null||f.forEach(y=>e.writePoint2d(11,y))}}e.writeInt16(97,0)}}),e.writeInt16(75,this.hatchStyle),e.writeInt16(76,this.patternType),e.writeAngle(52,i),e.writeDouble(41,s),e.writeInt16(77,0),e.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(a=>{e.writeAngle(53,a.angle),e.writePoint2d(43,a.base),e.writePoint2d(45,a.offset),e.writeInt16(79,a.dashLengths.length),a.dashLengths.forEach(o=>e.writeDouble(49,o))}),this.isGradient&&(e.writeInt16(450,this._hatchObjectType),e.writeInt16(451,0),e.writeInt16(452,this._gradientOneColorMode?1:0),e.writeAngle(460,this._gradientAngle),e.writeDouble(461,this._gradientShift),e.writeString(470,this.gradientName)),e.writeInt16(98,0),this}};ya.typeName="Hatch";let ar=ya;var Wl=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(Wl||{});const _a=class _a extends ge{get dxfTypeName(){return"LEADER"}constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._isHookLineSameDirection=!1,this._annoType=3,this._textHeight=0,this._textWidth=0,this._associatedAnnotation="",this._normal=new x(0,0,1),this._horizontalDirection=new x(1,0,0)}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get isHookLineSameDirection(){return this._isHookLineSameDirection}set isHookLineSameDirection(e){this._isHookLineSameDirection=e}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(e=>e.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth=e}get byBlockColor(){return this._byBlockColor}set byBlockColor(e){this._byBlockColor=e}get associatedAnnotation(){return this._associatedAnnotation}set associatedAnnotation(e){this._associatedAnnotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get horizontalDirection(){return this._horizontalDirection}set horizontalDirection(e){this._horizontalDirection.copy(e)}get offsetFromBlock(){var e;return(e=this._offsetFromBlock)==null?void 0:e.clone()}set offsetFromBlock(e){this._offsetFromBlock=e?new x(e):void 0}get offsetFromAnnotation(){var e;return(e=this._offsetFromAnnotation)==null?void 0:e.clone()}set offsetFromAnnotation(e){this._offsetFromAnnotation=e?new x(e):void 0}appendVertex(e){this._vertices.push(new b().copy(e)),this._updated=!0}setVertexAt(e,t){if(e<0||e>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[e].copy(t),this._updated=!0,this}vertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[e].clone()}subGetGripPoints(){return this._vertices.map(e=>e.clone())}subGetOsnapPoints(e,t,r,i){if(this.numVertices===0)return;if(this.isSplined&&this.splineGeo){switch(e){case v.EndPoint:i.push(this._vertices[0]),i.push(this._vertices[this.numVertices-1]);break;case v.Nearest:i.push(this.splineGeo.nearestPoint(t));break}return}const s=this._vertices;switch(e){case v.EndPoint:i.push(...s);break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const a=[];for(let o=0;o<s.length-1;o++){const l=[];Tn(s[o],s[o+1],e,t,l),a.push(...l)}if(e===v.MidPoint)i.push(...a);else{const o=Be(t,a);o&&i.push(o)}break}}}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new R().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this.transformVector(this._normal,e),this.transformVector(this._horizontalDirection,e),this._offsetFromBlock&&this.transformVector(this._offsetFromBlock,e),this._offsetFromAnnotation&&this.transformVector(this._offsetFromAnnotation,e),this._splineGeo?(this._splineGeo.transform(e),this._updated=!1):this._updated=!0,this}subWorldDraw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t)}else return e.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new $e(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbLeader"),e.writeString(3,this.dimensionStyle),e.writeInt16(71,this.hasArrowHead?1:0),e.writeInt16(72,this.isSplined?1:0),e.writeInt16(73,this.annoType),e.writeInt16(74,this.isHookLineSameDirection?1:0),e.writeInt16(75,this.hasHookLine?1:0),e.writeInt16(76,this.numVertices),this.textHeight!==0&&e.writeDouble(40,this.textHeight),this.textWidth!==0&&e.writeDouble(41,this.textWidth),this.byBlockColor!=null&&e.writeInt16(77,this.byBlockColor),this.associatedAnnotation&&e.writeHandle(340,this.associatedAnnotation);for(const t of this.vertices)e.writePoint3d(10,t);return e.writeVector3d(210,this.normal),e.writeVector3d(211,this.horizontalDirection),this._offsetFromBlock&&e.writeVector3d(212,this._offsetFromBlock),this._offsetFromAnnotation&&e.writeVector3d(213,this._offsetFromAnnotation),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectPath2d();return t.length<2?1:Ae.from2dPoints(t,!1).getOffsetSideAtPoint(e)}createOffsetCurve(e){return Xi(this.collectPath2d(),!1,e)}collectPath2d(){return this.isSplined&&this.splineGeo?this.splineGeo.getPoints(64).map(e=>new E(e.x,e.y)):this._vertices.map(e=>new E(e.x,e.y))}transformVector(e,t){const r=new b,i=new b(e.x,e.y,e.z);r.applyMatrix4(t),i.applyMatrix4(t),e.set(i.x-r.x,i.y-r.y,i.z-r.z)}};_a.typeName="Leader";let ri=_a;var v=(n=>(n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid",n))(v||{});function hg(n){let e=0;for(const t of n)e|=1<<t-1;return e}function dg(n){const e=[];for(const t of Object.values(v)){if(typeof t!="number")continue;const r=1<<t-1;n&r&&e.push(t)}return e}function ug(n,e){return n^1<<e-1}function gg(n,e){return(n&1<<e-1)!==0}function pg(n,e){return n|1<<e-1}function fg(n,e){return n&~(1<<e-1)}const Ci=class Ci extends ge{get dxfTypeName(){return"LINE"}constructor(e,t){super(),this._geo=new bt(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:e=>{this.startPoint.x=e}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:e=>{this.startPoint.y=e}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:e=>{this.startPoint.z=e}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:e=>{this.endPoint.x=e}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:e=>{this.endPoint.y=e}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:e=>{this.endPoint.z=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,r,i){const s=this.startPoint,a=this.endPoint;switch(e){case v.EndPoint:i.push(s),i.push(a);break;case v.MidPoint:i.push(this.midPoint);break;case v.Nearest:{const o=this._geo.project(t);i.push(o)}break;case v.Perpendicular:{const o=this._geo.perpPoint(t);i.push(o)}break;case v.Tangent:break}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){const t=this.startPoint,r=this.endPoint,i=[new b(t.x,t.y,0),new b(r.x,r.y,0)];return e.lines(i)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLine"),e.writePoint3d(10,this.startPoint),e.writePoint3d(11,this.endPoint),this}getOffsetCurves(e){const t=this._geo.offset(e);return[new Ci(t.startPoint,t.endPoint)]}getOffsetSideAtPoint(e){const t=this.startPoint,r=this.endPoint;return(r.x-t.x)*(e.y-t.y)-(r.y-t.y)*(e.x-t.x)>=0?1:-1}};Ci.typeName="Line";let or=Ci;var Ul=(n=>(n[n.Top=0]="Top",n[n.Zero=1]="Zero",n[n.Bottom=2]="Bottom",n))(Ul||{}),$l=(n=>(n[n.HasVertex=1]="HasVertex",n[n.Closed=2]="Closed",n[n.SuppressStartCaps=4]="SuppressStartCaps",n[n.SuppressEndCaps=8]="SuppressEndCaps",n))($l||{});const ba=class ba extends le{get dxfTypeName(){return"MLINE"}constructor(){super(),this._styleName="",this._styleObjectHandle="",this._scale=1,this._justification=1,this._flags=0,this._styleCount=0,this._startPosition=new b,this._normal=new x(0,0,1),this._segments=[]}get styleName(){return this._styleName||this.getDefaultStyleName()}set styleName(e){this._styleName=e}get styleObjectHandle(){return this._styleObjectHandle}set styleObjectHandle(e){this._styleObjectHandle=e}get scale(){return this._scale}set scale(e){this._scale=e}get justification(){return this._justification}set justification(e){this._justification=e}get flags(){return this._flags}set flags(e){this._flags=e}get styleCount(){return this._styleCount}set styleCount(e){this._styleCount=Math.max(0,e)}get startPosition(){return this._startPosition}set startPosition(e){this._startPosition.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get segments(){return this._segments.map(e=>this.cloneSegment(e))}set segments(e){this._segments=e.map(t=>this.createSegment(t)),this.updateHasVertexFlag()}get vertexCount(){return this._segments.length}get closed(){return(this._flags&2)!==0}set closed(e){this.setFlag(2,e)}get suppressStartCaps(){return(this._flags&4)!==0}set suppressStartCaps(e){this.setFlag(4,e)}get suppressEndCaps(){return(this._flags&8)!==0}set suppressEndCaps(e){this.setFlag(8,e)}appendSegment(e){this._segments.push(this.createSegment(e)),this.updateHasVertexFlag()}clearSegments(){this._segments=[],this.updateHasVertexFlag()}get geometricExtents(){const e=this.collectGeometryPoints();return new R().setFromPoints(e)}transformBy(e){return this._startPosition.applyMatrix4(e),this._segments.forEach(t=>{t.position.applyMatrix4(e),this.transformVector(t.direction,e),this.transformVector(t.miterDirection,e)}),this.transformVector(this._normal,e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"mline",properties:[{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"scale",type:"float",editable:!0,accessor:{get:()=>this.scale,set:e=>{this.scale=e}}},{name:"justification",type:"int",editable:!0,accessor:{get:()=>this.justification,set:e=>{this.justification=e}}},{name:"closed",type:"boolean",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}},{name:"vertexCount",type:"int",editable:!1,accessor:{get:()=>this.vertexCount}}]}]}}subGetOsnapPoints(e,t,r,i){const s=[this._startPosition,...this._segments.map(a=>a.position)];if(s.length!==0)switch(e){case v.EndPoint:i.push(...s);break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const a=[];for(let o=0;o<s.length-1;o++){const l=[];Tn(s[o],s[o+1],e,t,l),a.push(...l)}if(e===v.MidPoint)i.push(...a);else{const o=Be(t,a);o&&i.push(o)}break}}}subWorldDraw(e){if(this._segments.length===0)return;const t=[],r=this.getMLineStyle(),i=this.getRenderableElementCount(r),s=e.subEntityTraits,a=s.color,o=s.rgbColor,l=s.lineType,c=s.fillType,h=s.drawOrder,d=this.createFillArea(r,i);if(d&&(s.color=a,s.rgbColor=o,this.applyFillTraits(r,s),s.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},s.drawOrder=-1,t.push(e.area(d)),s.fillType=c,s.drawOrder=h),i<=0){const p=this.getReferencePath();p.length>=2&&t.push(e.lines(p))}else{for(let p=0;p<i;p++){s.color=a,s.rgbColor=o,s.lineType=l,this.applyStyleElementTraits(r,p,s);const g=this.getElementPath(p,r);g.length>=2&&t.push(e.lines(g))}this.appendStyleDrivenJointAndCapEntities(e,t,r,i,a,o,l)}if(s.color=a,s.rgbColor=o,s.lineType=l,s.fillType=c,s.drawOrder=h,t.length!==0)return t.length===1?t[0]:e.group(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMline"),e.writeString(2,this.styleName),e.writeHandle(340,this._styleObjectHandle),e.writeDouble(40,this._scale),e.writeInt16(70,this._justification),e.writeInt16(71,this._flags),e.writeInt16(72,this.vertexCount),e.writeInt16(73,this._styleCount),e.writePoint3d(10,this._startPosition),e.writeVector3d(210,this._normal),this._segments.forEach(t=>{e.writePoint3d(11,t.position),e.writeVector3d(12,t.direction),e.writeVector3d(13,t.miterDirection),t.elements.forEach(r=>{e.writeInt16(74,r.parameterCount),r.parameters.forEach(i=>e.writeDouble(41,i)),e.writeInt16(75,r.fillCount),r.fillParameters.forEach(i=>e.writeDouble(42,i))})}),this}setFlag(e,t){t?this._flags|=e:this._flags&=~e}updateHasVertexFlag(){this.setFlag(1,this._segments.length>0)}createSegment(e){var t;return{position:new b().copy(e.position),direction:new x().copy(e.direction),miterDirection:new x().copy(e.miterDirection),elements:((t=e.elements)==null?void 0:t.map(r=>this.createElement(r)))??[]}}createElement(e){const t=e.parameters?[...e.parameters]:[],r=e.fillParameters?[...e.fillParameters]:[];return{parameterCount:e.parameterCount??t.length,parameters:t,fillCount:e.fillCount??r.length,fillParameters:r}}cloneSegment(e){return{position:e.position.clone(),direction:e.direction.clone(),miterDirection:e.miterDirection.clone(),elements:e.elements.map(t=>({parameterCount:t.parameterCount,parameters:[...t.parameters],fillCount:t.fillCount,fillParameters:[...t.fillParameters]}))}}collectGeometryPoints(){const e=[this._startPosition];if(this._segments.length===0)return e;const t=this.getMLineStyle(),r=this.getRenderableElementCount(t);if(r<=0)return this._segments.forEach(i=>e.push(i.position)),e;for(let i=0;i<r;i++)e.push(...this.getElementPath(i,t));return e}getRenderableElementCount(e){const t=(e==null?void 0:e.elementCount)??0;return Math.max(this._styleCount,t,...this._segments.map(r=>r.elements.length),0)}getReferencePath(){const e=[this._startPosition.clone(),...this._segments.map(t=>t.position.clone())];return this.closePathIfNeeded(e)}getElementPath(e,t){const r=[],i=this._segments[0];return r.push(this.getElementBoundaryPoint("start",i,e,t)),this._segments.forEach(s=>{r.push(this.offsetPoint(s.position,s.miterDirection,this.getElementMiterOffset(s,e,t)))}),r[r.length-1]=this.getElementBoundaryPoint("end",this._segments[this._segments.length-1],e,t),this.closePathIfNeeded(r)}getElementMiterOffset(e,t,r){var s;const i=e.elements[t];return(s=i==null?void 0:i.parameters)!=null&&s.length?i.parameters[0]:this.getStyleElementOffset(t,r)}getElementBoundaryPoint(e,t,r,i){const s=this.getElementMiterOffset(t,r,i),a=e==="start"?this._startPosition:t.position,o=this.offsetPoint(a,t.miterDirection,s);if(!this.shouldApplyCapCutAtSide(e,i))return o;const l=e==="start"?i==null?void 0:i.startAngle:i==null?void 0:i.endAngle,c=this.computeCapCutDistance(s,l,e);if(c===0)return o;const h=e==="start"?this.getStartSegmentDirection():this.getEndSegmentDirection();return h.lengthSq()===0?o:o.add(h.multiplyScalar(c))}shouldApplyCapCutAtSide(e,t){return!t||this.closed?!1:e==="start"?this.suppressStartCaps?!1:(t.flags&112)!==0:this.suppressEndCaps?!1:(t.flags&1792)!==0}computeCapCutDistance(e,t,r){const i=this.normalizeCapAngle(t),s=Math.tan(i);if(Math.abs(s)<1e-6)return 0;const a=e/s;return a}normalizeCapAngle(e){if(e==null||!Number.isFinite(e))return Math.PI/2;let t=e%180;return t<0&&(t+=180),(t<1||t>179)&&(t=90),t*Math.PI/180}getStartSegmentDirection(){const e=this._segments[0],t=new x;return e&&(t.subVectors(e.position,this._startPosition),t.lengthSq()===0&&t.copy(e.direction)),t.lengthSq()>0&&t.normalize(),t}getEndSegmentDirection(){const e=this._segments[this._segments.length-1];if(!e)return new x;const t=new x,r=this._segments.length>1?this._segments[this._segments.length-2].position:this._startPosition;return t.subVectors(e.position,r),t.lengthSq()===0&&t.copy(e.direction),t.lengthSq()>0&&t.normalize(),t}createFillArea(e,t){if(!e||!(e.flags&1)||t<2)return;const r=this.getFillBoundaryElementIndices(t,e);if(!r)return;const i=this.getElementPath(r.outerIndex,e),s=this.getElementPath(r.innerIndex,e),a=this.stripClosingPoint(i),o=this.stripClosingPoint(s);if(a.length<2||o.length<2)return;const l=new Nt;if(this.closed){if(a.length<3||o.length<3)return;l.add(new ee(a.map(c=>({x:c.x,y:c.y})),!0)),l.add(new ee(o.map(c=>({x:c.x,y:c.y})),!0))}else{const c=[...a,...o.slice().reverse()].map(h=>({x:h.x,y:h.y}));if(c.length<3)return;l.add(new ee(c,!0))}return l}getFillBoundaryElementIndices(e,t){let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=-1,a=-1;for(let o=0;o<e;o++){const l=this.getElementReferenceOffset(o,t);l<r&&(r=l,s=o),l>i&&(i=l,a=o)}if(!(s<0||a<0||s===a))return{outerIndex:a,innerIndex:s}}getElementReferenceOffset(e,t){var i;const r=this._segments[0];if(r){const s=r.elements[e];if((i=s==null?void 0:s.parameters)!=null&&i.length)return s.parameters[0]}return this.getStyleElementOffset(e,t)}getStyleElementOffset(e,t){const r=t==null?void 0:t.elements[e];if(!r)return 0;const i=this.getStyleJustificationShift(t);return(r.offset+i)*this._scale}getStyleJustificationShift(e){const t=(e==null?void 0:e.elements)??[];if(t.length<=0)return 0;let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const s of t){const a=s.offset;a<r&&(r=a),a>i&&(i=a)}return this._justification===0?-i:this._justification===2?-r:0}stripClosingPoint(e){if(e.length<2)return e;const t=e[0],r=e[e.length-1],i=1e-9;return Math.abs(t.x-r.x)<=i&&Math.abs(t.y-r.y)<=i&&Math.abs(t.z-r.z)<=i?e.slice(0,-1):e}offsetPoint(e,t,r){if(r===0||t.lengthSq()===0)return e.clone();const i=t.clone().normalize().multiplyScalar(r);return e.clone().add(i)}closePathIfNeeded(e){if(!this.closed||e.length<2)return e;const t=e[0],r=e[e.length-1],i=1e-9;return Math.abs(t.x-r.x)<=i&&Math.abs(t.y-r.y)<=i&&Math.abs(t.z-r.z)<=i||e.push(t.clone()),e}appendStyleDrivenJointAndCapEntities(e,t,r,i,s,a,o){!r||i<2||(t.push(...this.drawMiterJointEntities(e,r,i,s,a,o)),t.push(...this.drawCapEntities(e,r,i,s,a,o)))}drawMiterJointEntities(e,t,r,i,s,a){if(this.closed||this._segments.length<2||!(t.flags&2))return[];const o=[],l=e.subEntityTraits;for(let c=0;c<this._segments.length-1;c++){const h=this._segments[c],d=Array.from({length:r},(p,g)=>{const f=this.getElementMiterOffset(h,g,t);return{elementIndex:g,offset:f,point:this.offsetPoint(h.position,h.miterDirection,f)}}).sort((p,g)=>g.offset-p.offset);for(let p=0;p<d.length-1;p++)this.applyElementDrawTraits(l,i,s,a,t,d[p].elementIndex),o.push(e.lines([d[p].point,d[p+1].point]))}return o}drawCapEntities(e,t,r,i,s,a){if(this.closed||this._segments.length<=0)return[];const o=[];return o.push(...this.drawCapEntitiesForSide(e,"start",t,r,i,s,a)),o.push(...this.drawCapEntitiesForSide(e,"end",t,r,i,s,a)),o}drawCapEntitiesForSide(e,t,r,i,s,a,o){if(t==="start"&&this.suppressStartCaps)return[];if(t==="end"&&this.suppressEndCaps)return[];const l=r.flags,c=t==="start",h=c?(l&16)!==0:(l&256)!==0,d=c?(l&64)!==0:(l&1024)!==0,p=c?(l&32)!==0:(l&512)!==0;if(!h&&!d&&!p)return[];const g=this.getCapElementPoints(t,i,r);if(g.length<2)return[];const f=[],m=e.subEntityTraits;if(h)for(let _=0;_<g.length-1;_++)this.applyElementDrawTraits(m,s,a,o,r,g[_].elementIndex),f.push(e.lines([g[_].point,g[_+1].point]));const y=c?this.getStartSegmentDirection().multiplyScalar(-1):this.getEndSegmentDirection().clone();if(d){const _=this.drawCapArcBetweenElements(e,t,g[0],g[g.length-1],y,m,s,a,o,r);_&&f.push(_)}if(p)for(let _=1;_<Math.floor(g.length/2);_++){const P=g[_],L=g[g.length-1-_];if(!P||!L||P===L)continue;const S=this.drawCapArcBetweenElements(e,t,P,L,y,m,s,a,o,r);S&&f.push(S)}return f}getCapElementPoints(e,t,r){const i=e==="start"?this._segments[0]:this._segments[this._segments.length-1];return i?Array.from({length:t},(s,a)=>({elementIndex:a,offset:this.getElementMiterOffset(i,a,r),point:this.getElementBoundaryPoint(e,i,a,r)})).sort((s,a)=>a.offset-s.offset):[]}drawCapArcBetweenElements(e,t,r,i,s,a,o,l,c,h){const d=t==="end"?i.point:r.point,p=t==="end"?r.point:i.point,g=d.distanceTo(p);if(g<=1e-9||s.lengthSq()===0)return;const m=d.clone().add(new x().subVectors(p,d).multiplyScalar(.5)).add(s.clone().normalize().multiplyScalar(g/2)),y=Yi.createByThreePoints(d,p,m);if(y)return this.applyElementDrawTraits(a,o,l,c,h,t==="end"?i.elementIndex:r.elementIndex),e.circularArc(y)}applyElementDrawTraits(e,t,r,i,s,a){e.color=t,e.rgbColor=r,e.lineType=i,this.applyStyleElementTraits(s,a,e)}transformVector(e,t){const r=new b,i=new b(e.x,e.y,e.z);r.applyMatrix4(t),i.applyMatrix4(t),e.set(i.x-r.x,i.y-r.y,i.z-r.z)}getMLineStyle(){var s;const e=this.database.objects.mlineStyle,t=this.styleObjectHandle?e.getIdAt(this.styleObjectHandle):void 0;if(t)return t;const r=this.styleName?e.getAt(this.styleName):void 0;if(r)return r;const i=(s=this.styleName)==null?void 0:s.toUpperCase();if(i)for(const[a,o]of e.entries()){const l=(o.styleName||a).toUpperCase();if(a.toUpperCase()===i||l===i)return o}}applyStyleElementTraits(e,t,r){const i=e==null?void 0:e.elements[t];if(!i)return;const s=this.resolveStyleElementLineType(i.lineType);s&&(r.lineType=s),!(i.color.isByBlock||i.color.isByLayer)&&(r.color=i.color.clone(),r.rgbColor=i.color.RGB??this.rgbColor)}applyFillTraits(e,t){const r=e==null?void 0:e.fillColor;!r||r.isByBlock||r.isByLayer||(t.color=r.clone(),t.rgbColor=r.RGB??this.rgbColor)}resolveStyleElementLineType(e){var c;const t=e==null?void 0:e.trim();if(!t)return;const r=t.toUpperCase(),i=fe.toUpperCase(),s=Ct.toUpperCase();let a="UserSpecified",o=t;if(r===i){a="ByLayer";const h=(c=this.database.tables.layerTable.getAt(this.layer))==null?void 0:c.linetype;o=h&&h.toUpperCase()!==i&&h.toUpperCase()!==s?h:Mt}else r===s&&(a="ByBlock",o=Mt);const l=this.database.tables.linetypeTable.getAt(o);return l?{type:a,...l.linetype}:{type:a,name:o,standardFlag:0,description:"",totalPatternLength:0}}resolveEffectiveProperties(){super.resolveEffectiveProperties(),this._styleName||(this._styleName=this.getDefaultStyleName())}getDefaultStyleName(){try{return this.database.cmlstyle||ft}catch{return ft}}};ba.typeName="MLine";let ii=ba;var Pn=(n=>(n[n.InvisibleLeader=0]="InvisibleLeader",n[n.StraightLeader=1]="StraightLeader",n[n.SplineLeader=2]="SplineLeader",n))(Pn||{}),yt=(n=>(n[n.NoneContent=0]="NoneContent",n[n.BlockContent=1]="BlockContent",n[n.MTextContent=2]="MTextContent",n[n.ToleranceContent=3]="ToleranceContent",n))(yt||{}),ql=(n=>(n[n.Horizontal=0]="Horizontal",n[n.Vertical=1]="Vertical",n))(ql||{}),Kl=(n=>(n[n.Unknown=0]="Unknown",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Top=3]="Top",n[n.Bottom=4]="Bottom",n))(Kl||{});const mg=1,yg=2,_g=4,bg=8,xg=64,wg=128,vg=32768,xa=class xa extends le{get dxfTypeName(){return"MULTILEADER"}constructor(){super(),this._leaders=[],this._leaderLineType=1,this._contentType=0,this._doglegEnabled=!1,this._doglegLength=0,this._doglegVector=new x(1,0,0),this._normal=new x(0,0,1),this._mleaderStyleId="",this._textHeight=2.5,this._textWidth=0,this._textRotation=0,this._textDirection=new x(1,0,0),this._textStyleName="",this._textAttachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,this._textDrawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT,this._textLineSpacingFactor=1,this._textAttachmentDirection=0,this._arrowheadOverrides=[],this._blockAttributes=[]}get leaders(){return this._leaders.map(e=>this.cloneLeader(e))}get numberOfLeaders(){return this._leaders.length}get leaderLineType(){return this._leaderLineType}set leaderLineType(e){this._leaderLineType=e}get contentType(){return this._contentType}set contentType(e){this._contentType=e}get doglegEnabled(){return this._doglegEnabled}set doglegEnabled(e){this._doglegEnabled=e}get doglegLength(){return this._doglegLength}set doglegLength(e){this._doglegLength=e}get doglegVector(){return this._doglegVector}set doglegVector(e){this._doglegVector.copy(e)}get landingPoint(){return this._landingPoint}set landingPoint(e){this._landingPoint=e?this.createPoint(e):void 0}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get mleaderStyleId(){return this._mleaderStyleId}set mleaderStyleId(e){this._mleaderStyleId=e}get version(){return this._version}set version(e){this._version=e}get leaderStyleId(){return this._leaderStyleId}set leaderStyleId(e){this._leaderStyleId=e}get propertyOverrideFlag(){return this._propertyOverrideFlag}set propertyOverrideFlag(e){this._propertyOverrideFlag=e}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(e){this._leaderLineColor=e}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(e){this._leaderLineTypeId=e}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(e){this._leaderLineWeight=e}get landingEnabled(){return this._landingEnabled}set landingEnabled(e){this._landingEnabled=e}get arrowheadId(){return this._arrowheadId}set arrowheadId(e){this._arrowheadId=e}get arrowheadSize(){return this._arrowheadSize}set arrowheadSize(e){this._arrowheadSize=e}get textStyleId(){return this._textStyleId}set textStyleId(e){this._textStyleId=e}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(e){this._textLeftAttachmentType=e}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(e){this._textRightAttachmentType=e}get textAngleType(){return this._textAngleType}set textAngleType(e){this._textAngleType=e}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(e){this._textAlignmentType=e}get textColor(){return this._textColor}set textColor(e){this._textColor=e}get textFrameEnabled(){return this._textFrameEnabled}set textFrameEnabled(e){this._textFrameEnabled=e}get landingGap(){return this._landingGap}set landingGap(e){this._landingGap=e}get textAttachment(){return this._textAttachment}set textAttachment(e){this._textAttachment=e}get textFlowDirection(){return this._textFlowDirection}set textFlowDirection(e){this._textFlowDirection=e}get blockContentId(){return this._blockContentId}set blockContentId(e){this._blockContentId=e}get blockContentColor(){return this._blockContentColor}set blockContentColor(e){this._blockContentColor=e}get blockContentScale(){return this._blockContentScale}set blockContentScale(e){this._blockContentScale=e}get blockContentRotation(){return this._blockContentRotation}set blockContentRotation(e){this._blockContentRotation=e}get blockContentConnectionType(){return this._blockContentConnectionType}set blockContentConnectionType(e){this._blockContentConnectionType=e}get annotativeScaleEnabled(){return this._annotativeScaleEnabled}set annotativeScaleEnabled(e){this._annotativeScaleEnabled=e}get arrowheadOverrides(){return this._arrowheadOverrides}set arrowheadOverrides(e){this._arrowheadOverrides=e}get blockAttributes(){return this._blockAttributes}set blockAttributes(e){this._blockAttributes=e}get textDirectionNegative(){return this._textDirectionNegative}set textDirectionNegative(e){this._textDirectionNegative=e}get textAlignInIPE(){return this._textAlignInIPE}set textAlignInIPE(e){this._textAlignInIPE=e}get bottomTextAttachmentDirection(){return this._bottomTextAttachmentDirection}set bottomTextAttachmentDirection(e){this._bottomTextAttachmentDirection=e}get topTextAttachmentDirection(){return this._topTextAttachmentDirection}set topTextAttachmentDirection(e){this._topTextAttachmentDirection=e}get contentScale(){return this._contentScale}set contentScale(e){this._contentScale=e}get contentBasePosition(){return this._contentBasePosition}set contentBasePosition(e){this._contentBasePosition=e}get textAnchor(){return this._textAnchor}set textAnchor(e){this._textAnchor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textBackgroundColor(){return this._textBackgroundColor}set textBackgroundColor(e){this._textBackgroundColor=e}get textBackgroundScaleFactor(){return this._textBackgroundScaleFactor}set textBackgroundScaleFactor(e){this._textBackgroundScaleFactor=e}get textBackgroundTransparency(){return this._textBackgroundTransparency}set textBackgroundTransparency(e){this._textBackgroundTransparency=e}get textBackgroundColorOn(){return this._textBackgroundColorOn}set textBackgroundColorOn(e){this._textBackgroundColorOn=e}get textFillOn(){return this._textFillOn}set textFillOn(e){this._textFillOn=e}get textColumnType(){return this._textColumnType}set textColumnType(e){this._textColumnType=e}get textUseAutoHeight(){return this._textUseAutoHeight}set textUseAutoHeight(e){this._textUseAutoHeight=e}get textColumnWidth(){return this._textColumnWidth}set textColumnWidth(e){this._textColumnWidth=e}get textColumnGutterWidth(){return this._textColumnGutterWidth}set textColumnGutterWidth(e){this._textColumnGutterWidth=e}get textColumnFlowReversed(){return this._textColumnFlowReversed}set textColumnFlowReversed(e){this._textColumnFlowReversed=e}get textColumnHeight(){return this._textColumnHeight}set textColumnHeight(e){this._textColumnHeight=e}get textUseWordBreak(){return this._textUseWordBreak}set textUseWordBreak(e){this._textUseWordBreak=e}get hasMText(){return this._hasMText}set hasMText(e){this._hasMText=e}get hasBlock(){return this._hasBlock}set hasBlock(e){this._hasBlock=e}get planeOrigin(){return this._planeOrigin}set planeOrigin(e){this._planeOrigin=e}get planeXAxisDirection(){return this._planeXAxisDirection}set planeXAxisDirection(e){this._planeXAxisDirection=e}get planeYAxisDirection(){return this._planeYAxisDirection}set planeYAxisDirection(e){this._planeYAxisDirection=e}get planeNormalReversed(){return this._planeNormalReversed}set planeNormalReversed(e){this._planeNormalReversed=e}get leaderSections(){return this.leaders}get blockContentData(){return this.blockContent}get mtextContent(){return this._mtextContent?{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint.clone()}:void 0}set mtextContent(e){if(!e){this._mtextContent=void 0,this._contentType===2&&(this._contentType=0);return}this._mtextContent={text:e.text,anchorPoint:this.createPoint(e.anchorPoint)},this._contentType=2}get contents(){var e;return((e=this._mtextContent)==null?void 0:e.text)??""}set contents(e){this._mtextContent?this._mtextContent.text=e:this._mtextContent={text:e,anchorPoint:new b},this._contentType=2}get textLocation(){var e;return(e=this._mtextContent)==null?void 0:e.anchorPoint}set textLocation(e){if(!e){this._mtextContent=void 0;return}this._mtextContent?this._mtextContent.anchorPoint.copy(e):this._mtextContent={text:"",anchorPoint:this.createPoint(e)},this._contentType=2}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth=e}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get textDirection(){return this._textDirection}set textDirection(e){this._textDirection.copy(e)}get textStyleName(){return this._textStyleName}set textStyleName(e){this._textStyleName=e}get textAttachmentPoint(){return this._textAttachmentPoint}set textAttachmentPoint(e){this._textAttachmentPoint=e}get textDrawingDirection(){return this._textDrawingDirection}set textDrawingDirection(e){this._textDrawingDirection=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(e){this._textAttachmentDirection=e}get blockContent(){var e,t;return this._blockContent?{blockContentId:this._blockContent.blockContentId,blockHandle:this._blockContent.blockHandle,normal:(e=this._blockContent.normal)==null?void 0:e.clone(),position:(t=this._blockContent.position)==null?void 0:t.clone(),scale:this._blockContent.scale.clone(),rotation:this._blockContent.rotation,color:this._blockContent.color,transformationMatrix:[...this._blockContent.transformationMatrix]}:void 0}set blockContent(e){if(!e){this._blockContent=void 0,this._contentType===1&&(this._contentType=0);return}this._blockContent={blockContentId:e.blockContentId??e.blockHandle,blockHandle:e.blockHandle,normal:e.normal?new x(e.normal):void 0,position:e.position?this.createPoint(e.position):void 0,scale:new x(e.scale??{x:1,y:1,z:1}),rotation:e.rotation??0,color:e.color,transformationMatrix:e.transformationMatrix?[...e.transformationMatrix]:[]},this.blockContentId=this._blockContent.blockContentId,this._contentType=1}addLeader(e={}){var r,i;const t={lastLeaderLinePoint:e.lastLeaderLinePoint?this.createPoint(e.lastLeaderLinePoint):void 0,lastLeaderLinePointSet:e.lastLeaderLinePointSet,landingPoint:e.landingPoint?this.createPoint(e.landingPoint):void 0,doglegVector:e.doglegVector?new x(e.doglegVector):void 0,doglegVectorSet:e.doglegVectorSet,doglegLength:e.doglegLength,breaks:((r=e.breaks)==null?void 0:r.map(s=>({index:s.index,start:this.createPoint(s.start),end:this.createPoint(s.end)})))??[],leaderBranchIndex:e.leaderBranchIndex,directionType:e.directionType,leaderLines:[]};return(i=e.leaderLines)==null||i.forEach(s=>{t.leaderLines.push(this.createLeaderLine(s))}),this._leaders.push(t),this._leaders.length-1}removeLeader(e){return this.checkLeaderIndex(e),this._leaders.splice(e,1),this}addLeaderLine(e,t=[]){return this.checkLeaderIndex(e),this._leaders[e].leaderLines.push(this.createLeaderLine({vertices:t})),this._leaders[e].leaderLines.length-1}appendVertex(e,t,r){return this.getMutableLeaderLine(e,t).vertices.push(this.createPoint(r)),this}setLeaderLineVertices(e,t,r){return this.getMutableLeaderLine(e,t).vertices=r.map(i=>this.createPoint(i)),this}getLeaderLineVertices(e,t){return this.getMutableLeaderLine(e,t).vertices.map(r=>r.clone())}addBreak(e,t,r,i){return this.getMutableLeaderLine(e,t).breaks.push({start:this.createPoint(r),end:this.createPoint(i)}),this}setLandingPoint(e,t){return this.checkLeaderIndex(e),this._leaders[e].landingPoint=t?this.createPoint(t):void 0,this}setDoglegDirection(e,t){return this.checkLeaderIndex(e),this._leaders[e].doglegVector=new x(t),this}setDoglegLength(e,t){return this.checkLeaderIndex(e),this._leaders[e].doglegLength=t,this}get geometricExtents(){const e=this.collectGeometryPoints();return e.length>0?new R().setFromPoints(e):new R}subGetGripPoints(){return this.collectGeometryPoints().map(e=>e.clone())}subGetOsnapPoints(e,t,r,i){var s;if(e===v.Insertion){this.contentBasePosition?i.push(this.contentBasePosition):this._mtextContent?i.push(this._mtextContent.anchorPoint):(s=this._blockContent)!=null&&s.position&&i.push(this._blockContent.position);return}this._leaders.forEach(a=>{a.leaderLines.forEach(o=>{const l=this.getLeaderLineDrawPoints(a,o);if(l.length!==0)switch(e){case v.EndPoint:i.push(...l);break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const c=[];for(let h=0;h<l.length-1;h++){const d=[];Tn(l[h],l[h+1],e,t,d),c.push(...d)}if(e===v.MidPoint)i.push(...c);else{const h=Be(t,c);h&&i.push(h)}break}}})})}transformBy(e){var t,r,i,s,a,o,l,c;return this._leaders.forEach(h=>{var d,p;(d=h.lastLeaderLinePoint)==null||d.applyMatrix4(e),(p=h.landingPoint)==null||p.applyMatrix4(e),h.doglegVector&&this.transformVector(h.doglegVector,e),h.breaks.forEach(g=>{g.start.applyMatrix4(e),g.end.applyMatrix4(e)}),h.leaderLines.forEach(g=>{g.vertices.forEach(f=>f.applyMatrix4(e)),g.breaks.forEach(f=>{f.start.applyMatrix4(e),f.end.applyMatrix4(e)})})}),(t=this._landingPoint)==null||t.applyMatrix4(e),(r=this.contentBasePosition)==null||r.applyMatrix4(e),this.transformVector(this._doglegVector,e),this.transformVector(this._normal,e),(i=this.textAnchor)==null||i.applyMatrix4(e),(s=this._mtextContent)==null||s.anchorPoint.applyMatrix4(e),this.transformVector(this._textDirection,e),(o=(a=this._blockContent)==null?void 0:a.position)==null||o.applyMatrix4(e),(l=this._blockContent)!=null&&l.normal&&this.transformVector(this._blockContent.normal,e),this.blockContentScale&&this.transformVector(this.blockContentScale,e),(c=this.planeOrigin)==null||c.applyMatrix4(e),this.planeXAxisDirection&&this.transformVector(this.planeXAxisDirection,e),this.planeYAxisDirection&&this.transformVector(this.planeYAxisDirection,e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"leader",properties:[{name:"contentType",type:"enum",editable:!0,options:[{label:yt[0],value:0},{label:yt[1],value:1},{label:yt[2],value:2},{label:yt[3],value:3}],accessor:{get:()=>this.contentType,set:e=>{this.contentType=e}}},{name:"leaderLineType",type:"enum",editable:!0,options:[{label:Pn[0],value:0},{label:Pn[1],value:1},{label:Pn[2],value:2}],accessor:{get:()=>this.leaderLineType,set:e=>{this.leaderLineType=e}}},{name:"doglegEnabled",type:"boolean",editable:!0,accessor:{get:()=>this.doglegEnabled,set:e=>{this.doglegEnabled=e}}},{name:"doglegLength",type:"float",editable:!0,accessor:{get:()=>this.doglegLength,set:e=>{this.doglegLength=e}}},{name:"leaderCount",type:"int",editable:!1,accessor:{get:()=>this.numberOfLeaders}}]},{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.textHeight,set:e=>{this.textHeight=e}}},{name:"textWidth",type:"float",editable:!0,accessor:{get:()=>this.textWidth,set:e=>{this.textWidth=e}}},{name:"textStyleName",type:"string",editable:!0,accessor:{get:()=>this.textStyleName,set:e=>{this.textStyleName=e}}}]}]}}resolveEffectiveProperties(){if(super.resolveEffectiveProperties(),this._mleaderStyleId)return;const e=this.getDefaultMLeaderStyle();e&&(this._mleaderStyleId=e.objectId)}subWorldDraw(e){const t=[],r=e.subEntityTraits,i=r.color,s=r.rgbColor,a=r.lineType,o=r.lineWeight,l=this.getResolvedLeaderLineColor(),c=this.getResolvedLeaderLineStyle(),h=this.getResolvedLeaderLineWeight(),d=this.getResolvedTextColor();this.getResolvedLeaderLineType()!==0&&(this.applyColorTraits(r,l,i,s),this.applyLineTraits(r,c,h),this._leaders.forEach(g=>{g.leaderLines.forEach(m=>{const y=this.getLeaderLineDrawPoints(g,m);if(y.length>0){const _=this.drawLeaderLine(e,y);_&&t.push(_)}});const f=this.getDoglegPoints(g);f&&t.push(e.lines(f))}));const p=this.getRenderableMTextContent();if(this.contentType===2&&p){this.applyColorTraits(r,d,i,s);const g=this.getResolvedTextHeight(),f={text:p.text,height:g,width:this.getMTextRenderWidth(p.text,g),position:p.anchorPoint,rotation:this.textRotation,directionVector:this.textDirection,attachmentPoint:this.textAttachmentPoint,drawingDirection:this.textDrawingDirection,lineSpaceFactor:this.textLineSpacingFactor};t.push(e.mtext(f,this.getTextStyle(),!1))}if(r.color=i,r.rgbColor=s,r.lineType=a,r.lineWeight=o,t.length!==0)return t.length===1?t[0]:e.group(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMLeader"),e.writeInt16(170,this.leaderLineType),e.writeBoolean(290,this.doglegEnabled),e.writeDouble(41,this.doglegLength),e.writeInt16(172,this.contentType),e.writeVector3d(210,this.normal),e.writeHandle(340,this.mleaderStyleId),this._landingPoint&&e.writePoint3d(10,this._landingPoint),e.writeVector3d(11,this.doglegVector),this._mtextContent&&(e.writeString(1,this._mtextContent.text),e.writePoint3d(12,this._mtextContent.anchorPoint),e.writeDouble(40,this.textHeight),e.writeDouble(42,this.textWidth),e.writeAngle(50,this.textRotation),e.writeString(7,this.textStyleName)),this._blockContent&&(e.writeHandle(341,this._blockContent.blockContentId??""),this._blockContent.position&&e.writePoint3d(15,this._blockContent.position),e.writeVector3d(16,this._blockContent.scale),e.writeAngle(52,this._blockContent.rotation)),this._leaders.forEach(t=>{t.landingPoint&&e.writePoint3d(110,t.landingPoint),t.doglegVector&&e.writeVector3d(111,t.doglegVector),e.writeDouble(140,t.doglegLength),e.writeInt16(171,t.leaderLines.length),t.leaderLines.forEach(r=>{e.writeInt16(90,r.vertices.length),r.vertices.forEach(i=>e.writePoint3d(10,i))})}),this}createPoint(e){return new b().copy(e)}createLeaderLine(e){var t,r;return{vertices:((t=e.vertices)==null?void 0:t.map(i=>this.createPoint(i)))??[],breakPointIndexes:e.breakPointIndexes?[...e.breakPointIndexes]:[],leaderLineIndex:e.leaderLineIndex,breaks:((r=e.breaks)==null?void 0:r.map(i=>({index:i.index,start:this.createPoint(i.start),end:this.createPoint(i.end)})))??[]}}cloneLeader(e){var t,r,i;return{lastLeaderLinePoint:(t=e.lastLeaderLinePoint)==null?void 0:t.clone(),lastLeaderLinePointSet:e.lastLeaderLinePointSet,landingPoint:(r=e.landingPoint)==null?void 0:r.clone(),doglegVector:(i=e.doglegVector)==null?void 0:i.clone(),doglegVectorSet:e.doglegVectorSet,doglegLength:e.doglegLength,breaks:e.breaks.map(s=>({index:s.index,start:s.start.clone(),end:s.end.clone()})),leaderBranchIndex:e.leaderBranchIndex,directionType:e.directionType,leaderLines:e.leaderLines.map(s=>({vertices:s.vertices.map(a=>a.clone()),breakPointIndexes:[...s.breakPointIndexes],leaderLineIndex:s.leaderLineIndex,breaks:s.breaks.map(a=>({index:a.index,start:a.start.clone(),end:a.end.clone()}))}))}}checkLeaderIndex(e){if(e<0||e>=this._leaders.length)throw new Error("The leader index is out of range!")}getMutableLeaderLine(e,t){this.checkLeaderIndex(e);const r=this._leaders[e].leaderLines[t];if(!r)throw new Error("The leader line index is out of range!");return r}collectGeometryPoints(){var t;const e=[];return this._leaders.forEach(r=>{r.lastLeaderLinePoint&&e.push(r.lastLeaderLinePoint),r.landingPoint&&e.push(r.landingPoint),r.breaks.forEach(s=>e.push(s.start,s.end)),r.leaderLines.forEach(s=>{e.push(...s.vertices),s.breaks.forEach(a=>e.push(a.start,a.end))});const i=this.getDoglegPoints(r);i&&e.push(...i),r.leaderLines.forEach(s=>{const a=this.getArrowheadPoints(this.getLeaderLineDrawPoints(r,s));a&&e.push(...a)})}),this._landingPoint&&e.push(this._landingPoint),this.contentBasePosition&&e.push(this.contentBasePosition),this.textAnchor&&e.push(this.textAnchor),this._mtextContent&&e.push(this._mtextContent.anchorPoint),(t=this._blockContent)!=null&&t.position&&e.push(this._blockContent.position),this.planeOrigin&&e.push(this.planeOrigin),e}getLeaderLineDrawPoints(e,t){if(t.vertices.length>=2)return t.vertices;if(t.vertices.length===0)return[];const r=e.lastLeaderLinePoint??e.landingPoint??this._landingPoint??this.contentBasePosition;return!r||t.vertices[0].equals(r)?t.vertices:[t.vertices[0],r]}getDoglegPoints(e){if(!this.getResolvedDoglegEnabled())return;const t=e.lastLeaderLinePoint??e.landingPoint??this._landingPoint,r=e.doglegVector??this._doglegVector,i=e.doglegLength??this.getResolvedDoglegLength();if(!t||i==null||i===0||r.lengthSq()===0)return;const s=t.clone().add(r.clone().normalize().multiplyScalar(i));return[t,s]}getArrowheadPoints(e){if(!this.isArrowheadVisible()||e.length<2)return;const t=this.getArrowheadFrame(e);if(!t)return;const r=this.getResolvedArrowheadSize(),{tip:i,unit:s}=t,a=i.clone().add(s.clone().multiplyScalar(r)),o=r/6,l=new x(-s.y,s.x,0),c=a.clone().add(l.clone().multiplyScalar(o)),h=a.clone().add(l.clone().multiplyScalar(-o));return[i,c,h,i]}isArrowheadVisible(){const e=this.getResolvedArrowheadId();return(e==null?void 0:e.toUpperCase())==="_NONE"?!1:this.getResolvedArrowheadSize()>0}drawLeaderLine(e,t){const r=[],i=this.getLeaderLinePointsForDraw(t);i.length>=2&&r.push(e.lines(i));const s=this.drawArrowhead(e,t);if(s&&r.push(s),r.length!==0)return r.length===1?r[0]:e.group(r)}getLeaderLinePointsForDraw(e){const t=this.getArrowheadLeaderLineTrimDistance();return t<=0?e:this.trimPolylineStart(e,t)}getArrowheadLeaderLineTrimDistance(){if(!this.isArrowheadVisible())return 0;const e=this.getResolvedArrowheadBlockTableRecord();if(!e)return 0;const t=this.getResolvedArrowheadSize();if(t<=0)return 0;const r=e.origin??b.ORIGIN;let i=r.x;for(const s of e.newIterator()){const a=s.geometricExtents;a.isEmpty()||a.max.x>i&&(i=a.max.x)}return Math.max(0,(i-r.x)*t)}trimPolylineStart(e,t){if(e.length<2||t<=0)return e;let r=t;for(let i=0;i<e.length-1;i++){const s=e[i],a=e[i+1],o=a.distanceTo(s);if(!(o<=0)){if(r<o){const l=new x().subVectors(a,s);return[s.clone().add(l.multiplyScalar(r/o)),...e.slice(i+1)]}r-=o}}return[e[e.length-1]]}drawArrowhead(e,t){if(!this.isArrowheadVisible())return;const r=this.drawArrowheadBlock(e,t);if(r)return r;const i=this.getArrowheadPoints(t);if(!i)return;const s=new Nt;s.add(new ee(i,!0));const a=e.subEntityTraits,o=a.fillType;a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]};const l=e.area(s);return a.fillType=o,l}drawArrowheadBlock(e,t){const r=this.getResolvedArrowheadBlockTableRecord();if(!r)return;const i=this.getArrowheadFrame(t);if(!i)return;const{tip:s,unit:a}=i,o=this.getResolvedArrowheadSize(),l=Math.atan2(a.y,a.x),c=r.origin??b.ORIGIN,h=new D().makeTranslation(-c.x,-c.y,-c.z),d=new D().makeScale(o,o,o),p=new D().makeRotationZ(l),g=new D().makeTranslation(s.x,s.y,s.z),f=new D().multiplyMatrices(g,p).multiply(d).multiply(h);return on.instance.draw(e,r,this.rgbColor,[],!0,f,new x(this.normal))}getArrowheadFrame(e){if(e.length<2)return;const t=e[0],r=e.find(s=>!s.equals(t));if(!r)return;const i=new x().subVectors(r,t);if(i.lengthSq()!==0)return{tip:t,unit:i.normalize()}}getResolvedArrowheadId(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.arrowSymbolId;return this.arrowheadId??e}getResolvedArrowheadBlockTableRecord(){const e=this.getResolvedArrowheadId();if(e)return this.database.tables.blockTable.getIdAt(e)}getResolvedArrowheadSize(){const e=this.getMLeaderStyle(),t=(e==null?void 0:e.arrowSize)??(e==null?void 0:e.scale);return this.arrowheadSize??this.contentScale??t??this.getResolvedTextHeight()}getResolvedTextHeight(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.textHeight;return this.textHeight>0?this.textHeight:e!=null&&e>0?e:2.5}getRenderableMTextContent(){var r;if(this._mtextContent)return{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint};const e=(r=this.getMLeaderStyle())==null?void 0:r.defaultMTextContents,t=this.textAnchor??this.contentBasePosition??this._landingPoint;if(!(!e||!t))return{text:e,anchorPoint:t}}getMTextRenderWidth(e,t){if(this._textWidth>0)return this._textWidth;if(!e)return this._textWidth;const r=e.replace(/\\[PpNn]/g,`
|
|
4
|
-
`).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,""),i=Math.max(...r.split(/\r\n|\r|\n/g).map(s=>s.length),1);return Math.max(t,i*t)}transformVector(e,t){const r=new b,i=new b(e.x,e.y,e.z);r.applyMatrix4(t),i.applyMatrix4(t),e.set(i.x-r.x,i.y-r.y,i.z-r.z)}getMLeaderStyle(){const e=this.database.objects.mleaderStyle,t=this.mleaderStyleId||this.leaderStyleId;if(t){const r=e.getIdAt(t);if(r)return r}return this.getDefaultMLeaderStyle()}getDefaultMLeaderStyle(){const e=this.resolveMLeaderStyleByName(this.getDefaultMLeaderStyleName());return e||this.database.objects.mleaderStyle.newIterator().toArray()[0]}resolveMLeaderStyleByName(e){const t=e==null?void 0:e.trim();if(!t)return;const r=this.database.objects.mleaderStyle,i=r.getAt(t);if(i)return i;const s=r.getIdAt(t);if(s)return s;const a=t.toUpperCase();for(const[o,l]of r.entries())if(o.toUpperCase()===a)return l}getDefaultMLeaderStyleName(){try{return this.database.cmleaderstyle||mt}catch{return mt}}getResolvedTextStyleName(){var s,a;const e=this.database.tables.textStyleTable,t=(s=this.getMLeaderStyle())==null?void 0:s.textStyleId,r=t?(a=e.getIdAt(t))==null?void 0:a.name:void 0;if(this.textStyleName)return this.textStyleName;const i=this.textStyleId?e.getIdAt(this.textStyleId):void 0;return i!=null&&i.name?i.name:r}getTextStyle(){const e=this.database.tables.textStyleTable.resolveAt(this.getResolvedTextStyleName());if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}getResolvedLeaderLineColor(){var e;return this.getResolvedComponentColor(this.leaderLineColor,(e=this.getMLeaderStyle())==null?void 0:e.leaderLineColor,yg)}getResolvedLeaderLineType(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.leaderLineType;return this.getResolvedStyleDrivenValue(this.leaderLineType,e,mg)}getResolvedLeaderLineTypeId(){var e;return this.getResolvedStyleDrivenValue(this.leaderLineTypeId,(e=this.getMLeaderStyle())==null?void 0:e.leaderLineTypeId,_g)}getResolvedLeaderLineStyle(){const e=this.getResolvedLeaderLineTypeId();if(!e)return;const t=this.database.tables.linetypeTable.getIdAt(e);if(t)return{type:"UserSpecified",...t.linetype}}getResolvedLeaderLineWeight(){var r;const e=(r=this.getMLeaderStyle())==null?void 0:r.leaderLineWeight,t=this.getResolvedStyleDrivenValue(this.leaderLineWeight,e,bg);if(t!=null)return t}getResolvedDoglegEnabled(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.doglegEnabled;return this.getResolvedStyleDrivenValue(this.doglegEnabled,e,xg)}getResolvedDoglegLength(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.doglegLength;return this.getResolvedStyleDrivenValue(this.doglegLength,e,wg)}getResolvedTextColor(){var e;return this.getResolvedComponentColor(this.textColor,(e=this.getMLeaderStyle())==null?void 0:e.textColor,vg)}getResolvedComponentColor(e,t,r){const i=e!=null?er(e):void 0;if(!i)return t;const s=this.isPropertyOverrideEnabled(r);return s===!0?i:s===!1?t??i:!i.isByBlock&&!i.isByLayer?i:t??i}getResolvedStyleDrivenValue(e,t,r){const i=this.isPropertyOverrideEnabled(r);return i===!0?e??t:t??e}isPropertyOverrideEnabled(e){if(this.propertyOverrideFlag!=null)return(this.propertyOverrideFlag&e)!==0}applyColorTraits(e,t,r,i){e.color=r,e.rgbColor=i,t&&(e.color=t,e.rgbColor=this.resolveColorToRgb(t))}applyLineTraits(e,t,r){t&&(e.lineType=t),r!=null&&(e.lineWeight=r)}resolveColorToRgb(e){if(e.isByLayer){const t=this.getLayerColor();return(t==null?void 0:t.RGB)!=null?t.RGB:this.rgbColor}return e.isByBlock?this.rgbColor:e.RGB??this.rgbColor}};xa.typeName="MLeader";let si=xa;const wa=class wa extends le{get dxfTypeName(){return"MTEXT"}constructor(){super(),this._contents="",this._height=0,this._width=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new b,this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._direction=new x(1,0,0),this._drawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){return new R}subGetGripPoints(){return[this._location]}subGetOsnapPoints(e,t,r,i){v.Insertion===e&&i.push(this._location)}transformBy(e){const t=this._location.clone(),r=this._direction.lengthSq()>0?this._direction.clone().normalize():new x(Math.cos(this._rotation),Math.sin(this._rotation),0),i=new x(-r.y,r.x,r.z);i.lengthSq()===0&&i.set(0,1,0),i.normalize();const s=t.clone().add(r),a=t.clone().add(i);t.applyMatrix4(e),s.applyMatrix4(e),a.applyMatrix4(e);const o=new x(s).sub(t),l=new x(a).sub(t),c=o.length(),h=l.length();return this._location.copy(t),c>0&&(this._direction.copy(o).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=c),h>0&&(this._height*=h),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:exports.AcGiMTextAttachmentPoint[1],value:1},{label:exports.AcGiMTextAttachmentPoint[2],value:2},{label:exports.AcGiMTextAttachmentPoint[3],value:3},{label:exports.AcGiMTextAttachmentPoint[4],value:4},{label:exports.AcGiMTextAttachmentPoint[5],value:5},{label:exports.AcGiMTextAttachmentPoint[6],value:6},{label:exports.AcGiMTextAttachmentPoint[7],value:7},{label:exports.AcGiMTextAttachmentPoint[8],value:8},{label:exports.AcGiMTextAttachmentPoint[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:e=>{this.attachmentPoint=e}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:exports.AcGiMTextFlowDirection[1],value:1},{label:exports.AcGiMTextFlowDirection[2],value:2},{label:exports.AcGiMTextFlowDirection[3],value:3},{label:exports.AcGiMTextFlowDirection[4],value:4},{label:exports.AcGiMTextFlowDirection[5],value:5}],accessor:{get:()=>this.drawingDirection,set:e=>{this.drawingDirection=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:e=>{this.lineSpacingFactor=e}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:e=>{this.width=e}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:e=>{this.direction.x=e}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:e=>{this.direction.y=e}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:e=>{this.direction.z=e}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:e=>{this.location.x=e}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:e=>{this.location.y=e}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:e=>{this.location.z=e}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}subWorldDraw(e,t){const r={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor};return e.mtext(r,this.getTextStyle(),t)}encodeMTextContentsForDxf(e){return e.replace(/\r\n|\r|\n/g,"\\P")}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMText"),e.writePoint3d(10,this.location),e.writeDouble(40,this.height),e.writeDouble(41,this.width),e.writeString(1,this.encodeMTextContentsForDxf(this.contents)),e.writeString(7,this.styleName),e.writeAngle(50,this.rotation),e.writeVector3d(11,this.direction),e.writeInt16(71,this.attachmentPoint),e.writeInt16(72,this.drawingDirection),e.writeInt16(73,this.lineSpacingStyle),e.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(e.writeInt16(90,1),e.writeInt32(63,this.backgroundFillColor),e.writeInt32(441,this.backgroundFillTransparency),e.writeDouble(45,this.backgroundScaleFactor)),this}};wa.typeName="MText";let lr=wa;const va=class va extends ge{get dxfTypeName(){return"SPLINE"}constructor(e,t,r,i,s){super(),this.rebuild(e,t,r,i,s)}rebuild(e,t,r,i,s){const a=+(e!==void 0)+ +(t!==void 0)+ +(r!==void 0)+ +(i!==void 0)+ +(s!==void 0);if(a<2||a>5)throw Pe.ILLEGAL_PARAMETERS;!Array.isArray(t)?this._geo=new $e(e,t,r,i):this._geo=new $e(e,t,r,i,s)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}subGetGripPoints(){return this._geo.controlPoints.map(e=>new b(e.x,e.y,e.z??0))}subGetOsnapPoints(e,t,r,i){switch(e){case v.EndPoint:i.push(this._geo.startPoint),i.push(this._geo.endPoint);break;case v.Node:{const s=new Set;for(const a of this._geo.knots)s.has(a)||(s.add(a),i.push(this._geo.evaluateAt(a)));break}case v.Nearest:i.push(this._geo.nearestPoint(t));break}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){const t=this._geo.getPoints(100);return e.lines(t)}dxfOutFields(e){var r;const t=this._geo;super.dxfOutFields(e),e.writeSubclassMarker("AcDbSpline"),e.writeInt16(70,this.closed?1:0),e.writeInt16(71,t.degree),e.writeInt16(72,t.knots.length),e.writeInt16(73,t.controlPoints.length),e.writeInt16(74,((r=t.fitPoints)==null?void 0:r.length)??0);for(const i of t.knots)e.writeDouble(40,i);for(const i of t.weights)e.writeDouble(41,i);for(const i of t.controlPoints)e.writePoint3d(10,i);for(const i of t.fitPoints??[])e.writePoint3d(11,i);return this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectPath2d(1);return t.length<2?1:Ae.from2dPoints(t,this.closed).getOffsetSideAtPoint(e)}createOffsetCurve(e){const{points:t,tangents:r}=this._geo.getOffsetSamplePath2d(e),i=lu(t,this.closed,e,r);return i?Ae.fromGePolyline(i):null}collectPath2d(e){return this._geo.getOffsetSamplePath2d(e).points}};va.typeName="Spline";let cr=va;const Pg=new x,Pa=class Pa extends sn{get dxfTypeName(){return"ACAD_TABLE"}constructor(e,t,r){super(e),this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._numColumns=r,this._numRows=t,this._columnWidth=new Array(r),this._rowHeight=new Array(t),this._cells=new Array(t*r)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,r){var s;const i=e*this._numColumns+t;return(s=this._cells[i])==null?void 0:s.text}setTextString(e,t,r){const i=e*this._numColumns+t;if(!this._cells[i]){this._cells[i]={text:r,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[i].text=r}isEmpty(e,t){var i;const r=e*this._numColumns+t;return!((i=this._cells[r])!=null&&i.text)}get geometricExtents(){return new R}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:e=>{this.numRows=e}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:e=>{this.numColumns=e}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((e,t)=>e+t,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((e,t)=>e+t,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}subWorldDraw(e){const t=this.blockTableRecord;if(t&&t.newIterator().count>0){const g=this.drawAnonymousTableBlock(e,t);if(g)return g}let r=0,i=0;const s=new Uint16Array(this.numColumns*this.numRows*8),a=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let o=0;for(let g=0;g<=this.numRows;g++){r-=g>0?this.rowHeight(g-1):0,i=0;for(let f=0;f<=this.numColumns;f++)i+=f>0?this.columnWidth(f-1):0,a[o++]=i,a[o++]=r,a[o++]=0}const l=[],c=new Array(this.numRows*this.numColumns).fill(!1);i=0,o=0;let h=0;for(let g=0;g<this.numColumns;g++){i+=g>0?this.columnWidth(g-1):0,r=0;for(let f=0;f<this.numRows;f++){r+=f>0?this.rowHeight(f-1):0;const m=this.cell(f*this.numColumns+g);if(h=f*this.numColumns+g,m&&!c[h]){const y=m.borderWidth??1,_=m.borderHeight??1;this.fillVisited(c,h,this.numColumns,y,_),s[o++]=g+f*(this.numColumns+1),s[o++]=g+f*(this.numColumns+1)+y;const P=a[s[o-1]*3]-i,L=g+(f+_)*(this.numColumns+1)+y;g+y==this.numColumns&&(s[o++]=g+f*(this.numColumns+1)+y,s[o++]=L);const S=-a[L*3+1]-r;if(f+_==this.numRows&&(s[o++]=g+(f+_)*(this.numColumns+1)+_,s[o++]=g+(f+_)*(this.numColumns+1)),s[o++]=g+(f+_)*(this.numColumns+1),s[o++]=g+f*(this.numColumns+1),m.text){const A=m.attachmentPoint||this.attachmentPoint||exports.AcGiMTextAttachmentPoint.MiddleCenter,N=this.getTableTextOffset(A,P,S),C={text:m.text,height:this.getCellTextHeight(m,S),width:P,position:Pg.set(i,-r,0).clone().add(N),rotation:this.rotation,attachmentPoint:A},V=this.getTextStyle(m);l.push(e.mtext(C,V))}}}}l.push(e.lineSegments(a,3,s));const d=e.group(l),p=new pr;return p.setFromAxisAngle(x.Z_AXIS,this.rotation),Tr.compose(this.position,p,this.scaleFactors),d.applyMatrix(Tr),d}drawAnonymousTableBlock(e,t){const r=[],i=t.newIterator();for(const o of i){let l;o.color.isByBlock&&this.rgbColor?(lo.copy(o.color),o.color.setRGBValue(this.rgbColor),l=o.worldDraw(e),o.color.copy(lo)):l=o.worldDraw(e),l&&(l.objectId=this.objectId,l.ownerId=this.ownerId,l.layerName=this.layer,l.visible=this.visibility&&o.visibility,r.push(l))}const s=e.group(r);s.applyMatrix(this.blockTransform);const a=this.normal;return a&&(a.x!==0||a.y!==0||a.z!==1)&&(Tr.setFromExtrusionDirection(a),s.applyMatrix(Tr)),s}fillVisited(e,t,r,i,s){if(s==1&&i==1)e[t]=!0;else for(let a=0;a<i;++a)for(let o=0;o<s;++o)e[t+a+o*r]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable.resolveAt(e.textStyle);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}getTableTextOffset(e,t,r){const i=new x;switch(e){case 1:break;case 2:i.setX(t/2);break;case 3:i.setX(t);break;case 4:i.setY(-r/2);break;case 5:i.set(t/2,-r/2,0);break;case 6:i.set(t,-r/2,0);break;case 7:i.setY(-r);break;case 8:i.set(t/2,-r,0);break;case 9:i.set(t,-r,0);break}return i}getCellTextHeight(e,t){return e.textHeight&&e.textHeight>0?e.textHeight:Math.max(t/2,1)}dxfOutFields(e){var s,a,o,l,c,h,d;super.dxfOutFields(e),e.writeSubclassMarker("AcDbTable");const t=e.version??((s=e.database)==null?void 0:s.version)??((a=this.database)==null?void 0:a.version),r=(t==null?void 0:t.value)!=null?t.value>=27:!1;e.writeInt16(280,this.tableDataVersion),e.writeObjectId(342,this.tableStyleId),e.writeObjectId(343,this.owningBlockRecordId),e.writeVector3d(11,this.horizontalDirection),e.writeUInt32(90,this.tableValueFlag),e.writeUInt32(93,this.tableOverrideFlag),e.writeUInt32(94,this.borderColorOverrideFlag),e.writeUInt32(95,this.borderLineweightOverrideFlag),e.writeUInt32(96,this.borderVisibilityOverrideFlag),e.writeInt16(71,this.attachmentPoint),e.writeInt32(91,this.numRows),e.writeInt32(92,this.numColumns);for(let p=0;p<this.numRows;++p)e.writeDouble(141,this.rowHeight(p));for(let p=0;p<this.numColumns;++p)e.writeDouble(142,this.columnWidth(p));const i=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let p=0;p<i;p++){const g=this._cells[p],f=(g==null?void 0:g.cellType)??(g!=null&&g.blockTableRecordId?2:1);if(e.writeInt16(171,f),e.writeInt16(172,(g==null?void 0:g.flagValue)??0),e.writeInt16(173,(g==null?void 0:g.mergedValue)??0),e.writeBoolean(174,g==null?void 0:g.autoFit),e.writeInt16(175,g==null?void 0:g.borderWidth),e.writeInt16(176,g==null?void 0:g.borderHeight),(g==null?void 0:g.overrideFlag)!=null&&(r?e.writeInt32(91,g.overrideFlag):e.writeInt16(177,g.overrideFlag)),e.writeInt16(178,g==null?void 0:g.virtualEdgeFlag),e.writeAngle(145,g==null?void 0:g.rotation),r&&e.writeInt16(92,g==null?void 0:g.extendedCellFlags),f===1)g!=null&&g.fieldObjetId?e.writeObjectId(344,g.fieldObjetId):this.writeCellText(e,(g==null?void 0:g.text)??"",r,g==null?void 0:g.cellValueBlockBegin);else if(f===2){if(e.writeObjectId(340,g==null?void 0:g.blockTableRecordId),e.writeDouble(144,g==null?void 0:g.blockScale),e.writeInt16(179,g==null?void 0:g.blockAttrNum),(o=g==null?void 0:g.attrDefineId)!=null&&o.length)for(const m of g.attrDefineId)e.writeObjectId(331,m);if((g==null?void 0:g.attrText)!=null)if(Array.isArray(g.attrText))for(const m of g.attrText)e.writeString(300,m);else e.writeString(300,g.attrText)}g!=null&&g.textStyle&&e.writeString(7,g.textStyle),(g==null?void 0:g.textHeight)!=null&&e.writeDouble(140,g.textHeight),(g==null?void 0:g.attachmentPoint)!=null&&e.writeInt16(170,g.attachmentPoint),(g==null?void 0:g.topBorderVisibility)!=null&&e.writeInt16(289,g.topBorderVisibility?1:0),(g==null?void 0:g.rightBorderVisibility)!=null&&e.writeInt16(285,g.rightBorderVisibility?1:0),(g==null?void 0:g.bottomBorderVisibility)!=null&&e.writeInt16(286,g.bottomBorderVisibility?1:0),(g==null?void 0:g.leftBorderVisibility)!=null&&e.writeInt16(288,g.leftBorderVisibility?1:0)}if(e.writeInt16(70,this.flowDirection),e.writeDouble(40,this.horizontalCellMargin),e.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&e.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&e.writeInt16(281,this.suppressHeader?1:0),(l=this.cellTypeOverrides)!=null&&l.length)for(const p of this.cellTypeOverrides){e.writeString(7,p.textStyle),e.writeDouble(140,p.textHeight),e.writeInt16(170,p.alignment),e.writeInt16(63,p.backgroundColor),e.writeInt16(64,p.contentColor),p.backgroundColorEnabled!=null&&e.writeInt16(283,p.backgroundColorEnabled?1:0);const g=p.borderLineweights;g&&(e.writeInt16(274,g.top),e.writeInt16(275,g.right),e.writeInt16(276,g.bottom),e.writeInt16(277,g.left),e.writeInt16(278,g.insideHorizontal),e.writeInt16(279,g.insideVertical));const f=p.borderVisibility;f&&(e.writeInt16(284,f.top?1:0),e.writeInt16(285,f.right?1:0),e.writeInt16(286,f.bottom?1:0),e.writeInt16(287,f.left?1:0),e.writeInt16(288,f.insideHorizontal?1:0),e.writeInt16(289,f.insideVertical?1:0))}if(this.tableBorderColors&&(e.writeInt16(63,this.tableBorderColors.left),e.writeInt16(64,this.tableBorderColors.top),e.writeInt16(65,this.tableBorderColors.insideHorizontal),e.writeInt16(66,this.tableBorderColors.bottom),e.writeInt16(68,this.tableBorderColors.insideVertical),e.writeInt16(69,this.tableBorderColors.right)),(c=this.rowDataTypes)!=null&&c.length)for(const p of this.rowDataTypes)e.writeInt16(97,p);if((h=this.rowUnitTypes)!=null&&h.length)for(const p of this.rowUnitTypes)e.writeInt16(98,p);if((d=this.rowFormats)!=null&&d.length)for(const p of this.rowFormats)e.writeString(4,p);return this}writeCellText(e,t,r,i){if(!r){if(t.length<=250){e.writeString(1,t);return}const o=Math.ceil(t.length/250);for(let l=0;l<o;l++){const c=l*250,h=c+250,d=t.slice(c,h);l===o-1?e.writeString(1,d):e.writeString(2,d)}return}if(e.writeString(301,i??"CELL_VALUE"),t.length<=250){e.writeString(302,t),e.writeString(304,"ACVALUE_END");return}const a=Math.ceil(t.length/250);for(let o=0;o<a;o++){const l=o*250,c=l+250,h=t.slice(l,c);o===a-1?e.writeString(302,h):e.writeString(303,h)}e.writeString(304,"ACVALUE_END")}};Pa.typeName="Table";let ai=Pa;const Tr=new D,lo=new B,nr=class nr extends ge{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new b,new b,new b,new b]}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new R().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;return e.push(...this._vertices),e}subGetOsnapPoints(e,t,r,i){const s=[this._vertices[0],this._vertices[1],this._vertices[3],this._vertices[2]];qs(s,!0,e,t,i)}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this._elevation=this._vertices[0].z,this}subWorldDraw(e){const t=new ee(nr.boundaryPointsFromVertices(this._vertices),!0),r=new Nt;r.add(t);const i=e.subEntityTraits;return i.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.area(r)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbTrace"),e.writeDouble(38,this.elevation),e.writeDouble(39,this.thickness),e.writePoint3d(10,this.getPointAt(0)),e.writePoint3d(11,this.getPointAt(1)),e.writePoint3d(12,this.getPointAt(2)),e.writePoint3d(13,this.getPointAt(3)),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectBoundary2d();return t.length<2?1:Ae.from2dPoints(t,!0).getOffsetSideAtPoint(e)}createOffsetCurve(e){return Xi(this.collectBoundary2d(),!0,e)}collectBoundary2d(){return nr.boundaryPointsFromVertices(this._vertices)}static boundaryPointsFromVertices(e){const t=e[0],r=e[1],i=e[2],s=e[3];return[new E(t.x,t.y),new E(r.x,r.y),new E(s.x,s.y),new E(i.x,i.y)]}};nr.typeName="Trace";let oi=nr;const Aa=class Aa extends le{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new b}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new R().expandByPoint(this._geo)}subGetGripPoints(){return[this._geo]}subGetOsnapPoints(e,t,r,i){e===v.Node&&i.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}transformBy(e){return this._geo.applyMatrix4(e),this}subWorldDraw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbPoint"),e.writePoint3d(10,this.position),this}};Aa.typeName="Point";let li=Aa;var Zl=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(Zl||{}),Ql=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(Ql||{});const Sa=class Sa extends le{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new b,this._scale=new Z(1,1),this._rotation=0,this._imageSize=new E,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get imageSize(){return this._imageSize}set imageSize(e){this._imageSize.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isShownClipped(){return this._isShownClipped}set isShownClipped(e){this._isShownClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new R;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}subGetOsnapPoints(e,t,r,i){if(e===v.Insertion){i.push(this._position);return}const s=this.boundaryPath();if(s.length===0)return;let a=s;if(s.length>1){const o=s[0],l=s[s.length-1];o.x===l.x&&o.y===l.y&&(o.z||0)===(l.z||0)&&(a=s.slice(0,-1))}if(e===v.EndPoint){i.push(...a);return}qs(a,!0,e,t,i)}subWorldDraw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t)}transformBy(e){const t=this._width*this._scale.x,r=this._height*this._scale.y,i=new x(t*Math.cos(this._rotation),t*Math.sin(this._rotation),0),s=new x(-r*Math.sin(this._rotation),r*Math.cos(this._rotation),0),a=this._position.clone(),o=this._position.clone().add(i),l=this._position.clone().add(s);a.applyMatrix4(e),o.applyMatrix4(e),l.applyMatrix4(e);const c=new x(o).sub(a),h=new x(l).sub(a);return this._position.copy(a),this._rotation=Math.atan2(c.y,c.x),this._width=c.length(),this._height=h.length(),this._scale.set(1,1),this}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,r=this._height,i=new xe;i.setFromPoints(this._clipBoundary);const s=new E;s.setX(this._position.x-i.min.x*t),s.setY(this._position.y-i.min.y*r),this._clipBoundary.forEach(a=>{const o=a.x*t+s.x,l=a.y*r+s.y;e.push(new b(o,l,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){co.copy(e[1]);for(let t=1;t<4;t++)Cr.copy(e[t]),Cr.rotateAround(co,this._rotation),e[t].setX(Cr.x),e[t].setY(Cr.y)}e.push(e[0])}return e}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbRasterImage"),e.writePoint3d(10,this.position);const t=this.width*this.scale.x,r=this.height*this.scale.y,i=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:t,y:r},s=i.x>0?t/i.x:t,a=i.y>0?r/i.y:r,o=Math.cos(this._rotation),l=Math.sin(this._rotation);e.writePoint3d(11,{x:s*o,y:s*l,z:0}),e.writePoint3d(12,{x:-a*l,y:a*o,z:0}),e.writePoint2d(13,i),e.writeObjectId(340,this.imageDefId);const c=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(e.writeInt16(70,c),e.writeInt16(280,this.isClipped?1:0),e.writeInt16(281,this.brightness),e.writeInt16(282,this.contrast),e.writeInt16(283,this.fade),e.writeInt16(71,this.clipBoundaryType),this.isClipped){e.writeInt16(91,this.clipBoundary.length);for(const h of this.clipBoundary)e.writePoint2d(14,h)}return this}};Sa.typeName="RasterImage";let hr=Sa;const co=new E,Cr=new E,Mi=class Mi extends ge{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new b,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new R;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}subGetOsnapPoints(e,t,r,i){const s=this.basePoint;if(e===v.EndPoint){i.push(s);return}const a=this.unitDir.clone();if(a.lengthSq()===0)return;a.normalize();const o=new bt(s,s.clone().add(a));switch(e){case v.Nearest:{const l=o.project(t),h=new x(l).sub(s).dot(a);i.push(h<0?s:l);break}case v.Perpendicular:i.push(o.perpPoint(t));break}}transformBy(e){return this._basePoint.applyMatrix4(e),this._unitDir.transformDirection(e),this}subWorldDraw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRay"),e.writePoint3d(10,this.basePoint),e.writeVector3d(11,this.unitDir),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.basePoint,r=this.unitDir,i=Math.hypot(r.x,r.y);return i<=1e-9||(r.x*(e.y-t.y)-r.y*(e.x-t.x))/i>=0?1:-1}createOffsetCurve(e){const t=ol(this.basePoint,this.unitDir,e);if(!t)return null;const r=new Mi;return r.basePoint=t,r.unitDir=this.unitDir.clone(),r}};Mi.typeName="Ray";let ci=Mi;const La=class La extends le{get dxfTypeName(){return"SHAPE"}constructor(){super(),this._position=new b,this._size=1,this._name="",this._rotation=0,this._widthFactor=1,this._oblique=0,this._thickness=0,this._normal=new x(0,0,1),this._shapeNumber=0,this._styleName=""}get position(){return this._position}set position(e){this._position.copy(e)}get size(){return this._size}set size(e){this._size=e}get name(){return this._name}set name(e){this._name=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get shapeNumber(){return this._shapeNumber}set shapeNumber(e){this._shapeNumber=e}get styleId(){var t,r,i;const e=(i=(r=(t=this.database)==null?void 0:t.tables)==null?void 0:r.textStyleTable)==null?void 0:i.resolveAt(this._styleName);return(e==null?void 0:e.objectId)??""}set styleId(e){var r,i,s;const t=(s=(i=(r=this.database)==null?void 0:r.tables)==null?void 0:i.textStyleTable)==null?void 0:s.getIdAt(e);t&&(this._styleName=t.name)}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get isPlanar(){return!0}get geometricExtents(){const e=Math.abs(this._size)/2,t=new R;return t.expandByPoint(this._position),e>0&&(t.expandByPoint(new b(this._position.x-e,this._position.y-e,this._position.z)),t.expandByPoint(new b(this._position.x+e,this._position.y+e,this._position.z))),t}subGetGripPoints(){return[this._position]}subGetOsnapPoints(e,t,r,i){e===v.Insertion&&i.push(this._position)}transformBy(e){const t=new D().setFromExtrusionDirection(this._normal),r=new D().makeRotationZ(this._rotation),i=new D().multiplyMatrices(t,r),s=this._position.clone(),a=new b(this._widthFactor,0,0).applyMatrix4(i).add(s),o=new b(0,1,0).applyMatrix4(i).add(s),l=new b(0,0,1).applyMatrix4(i).add(s);s.applyMatrix4(e),a.applyMatrix4(e),o.applyMatrix4(e),l.applyMatrix4(e);const c=new x(a).sub(s),h=new x(o).sub(s),d=new x(l).sub(s);let p=new x().crossVectors(c,h);p.lengthSq()===0?p=this._normal.clone().transformDirection(e):p.normalize();const f=new D().setFromExtrusionDirection(p).clone().invert(),m=c.clone().applyMatrix4(f),y=h.length(),_=c.length();this._position.copy(s),this._normal.copy(p),_>0&&(this._rotation=Math.atan2(m.y,m.x)),y>0&&(this._size*=y,_>0&&(this._widthFactor*=_/y));const P=d.length();return P>0&&(this._thickness*=P),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"shape",properties:[{name:"name",type:"string",editable:!0,accessor:{get:()=>this.name,set:e=>{this.name=e}}},{name:"size",type:"float",editable:!0,accessor:{get:()=>this.size,set:e=>{this.size=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:e=>{this.widthFactor=e}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:e=>{this.oblique=e}}},{name:"shapeNumber",type:"int",editable:!0,accessor:{get:()=>this.shapeNumber,set:e=>{this.shapeNumber=e}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}subWorldDraw(e,t){const i={...this.getTextStyle(),widthFactor:this.widthFactor,obliqueAngle:this.oblique*180/Math.PI},s={name:this._name.trim()||void 0,shapeNumber:this._shapeNumber!==0?this._shapeNumber:void 0,size:this.size,position:this._position,rotation:this._rotation,directionVector:this._normal,widthFactor:this.widthFactor};return e.shape(s,i,t)}getTextStyle(){const e=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbShape"),e.writePoint3d(10,this.position),e.writeDouble(40,this.size),e.writeString(2,this.name),e.writeAngle(50,this.rotation),e.writeDouble(41,this.widthFactor),e.writeAngle(51,this.oblique),e.writeDouble(39,this.thickness),this._styleName&&e.writeString(3,this._styleName),e.writeVector3d(210,this.normal),this}};La.typeName="Shape";let hi=La;const Ia=class Ia extends le{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new b,this._height=0,this._width=0,this._viewCenter=new b,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new R}transformBy(e){const t=this._centerPoint.clone(),r=this._centerPoint.clone().add(new x(this._width,0,0)),i=this._centerPoint.clone().add(new x(0,this._height,0));t.applyMatrix4(e),r.applyMatrix4(e),i.applyMatrix4(e);const s=new x(r).sub(t),a=new x(i).sub(t),o=this._height!==0?a.length()/this._height:1;return this._centerPoint.copy(t),this._width=s.length(),this._height=a.length(),this._viewHeight*=o,this}subWorldDraw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport();return e.group(this.createViewportRect(t,e))}}toGiViewport(){const e=new Bl;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const r=[];return r.push(t.lines([new b(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new b(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)])),r.push(t.lines([new b(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new b(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)])),r.push(t.lines([new b(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new b(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)])),r.push(t.lines([new b(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new b(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)])),r}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewport"),e.writePoint3d(10,this.centerPoint),e.writeDouble(40,this.height),e.writeDouble(41,this.width),e.writePoint3d(12,this.viewCenter),e.writeDouble(45,this.viewHeight),e.writeInt32(69,this.number),this}};Ia.typeName="Viewport";let di=Ia;const Ea=class Ea extends hr{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(e){const t=this.boundaryPath(),r=new Nt;return r.add(new ee(t)),e.area(r)}dxfOutFields(e){return super.dxfOutFields(e),this}};Ea.typeName="Wipeout";let ui=Ea;const Oi=class Oi extends ge{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new b,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new R;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}subGetOsnapPoints(e,t,r,i){const s=this.basePoint;if(e===v.EndPoint){i.push(s);return}const a=this.unitDir.clone();if(a.lengthSq()===0)return;a.normalize();const o=new bt(s,s.clone().add(a));switch(e){case v.Nearest:i.push(o.project(t));break;case v.Perpendicular:i.push(o.perpPoint(t));break}}transformBy(e){return this._basePoint.applyMatrix4(e),this._unitDir.transformDirection(e),this}subWorldDraw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbXline"),e.writePoint3d(10,this.basePoint),e.writeVector3d(11,this.unitDir),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.basePoint,r=this.unitDir,i=Math.hypot(r.x,r.y);return i<=1e-9||(r.x*(e.y-t.y)-r.y*(e.x-t.x))/i>=0?1:-1}createOffsetCurve(e){const t=ol(this.basePoint,this.unitDir,e);if(!t)return null;const r=new Oi;return r.basePoint=t,r.unitDir=this.unitDir.clone(),r}};Oi.typeName="Xline";let gi=Oi;class Jl{constructor(e){this.position=new b(e.x,e.y,e.z||0)}}const Ta=class Ta extends ge{get dxfTypeName(){return"POLYLINE"}constructor(e,t,r,i=!1,s=!1){super(),this._mCount=e,this._nCount=t,this._closedM=i,this._closedN=s,this._vertices=r.map(a=>new Jl(a))}get mCount(){return this._mCount}get nCount(){return this._nCount}get closedM(){return this._closedM}get closedN(){return this._closedN}get closed(){return this._closedM}set closed(e){this._closedM=e}get numberOfVertices(){return this._vertices.length}getVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[e]}getVertexAtMN(e,t){const r=e*this._nCount+t;return this.getVertexAt(r)}get geometricExtents(){if(this._vertices.length===0)return new R(new b(0,0,0),new b(0,0,0));let e=Number.MAX_VALUE,t=Number.MAX_VALUE,r=Number.MAX_VALUE,i=-Number.MAX_VALUE,s=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{e=Math.min(e,o.position.x),t=Math.min(t,o.position.y),r=Math.min(r,o.position.z),i=Math.max(i,o.position.x),s=Math.max(s,o.position.y),a=Math.max(a,o.position.z)}),new R(new b(e,t,r),new b(i,s,a))}subGetGripPoints(){const e=new Array;return this._vertices.forEach(t=>{e.push(t.position)}),e}subGetOsnapPoints(e,t,r,i){switch(e){case v.EndPoint:this._vertices.forEach(s=>{i.push(s.position)});break}}transformBy(e){return this._vertices.forEach(t=>{t.position.applyMatrix4(e)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"mCount",type:"float",editable:!1,accessor:{get:()=>this._mCount}},{name:"nCount",type:"float",editable:!1,accessor:{get:()=>this._nCount}},{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(e=>({x:e.position.x,y:e.position.y,z:e.position.z}))}}]},{groupName:"others",properties:[{name:"closedM",type:"boolean",editable:!0,accessor:{get:()=>this._closedM,set:e=>{this._closedM=e}}},{name:"closedN",type:"boolean",editable:!0,accessor:{get:()=>this._closedN,set:e=>{this._closedN=e}}}]}]}}subWorldDraw(e){const t=[];for(let r=0;r<this._mCount;r++)for(let i=0;i<this._nCount;i++){const s=this.getVertexAtMN(r,i);let a=i+1;if(a>=this._nCount)if(this._closedN)a=0;else continue;const o=this.getVertexAtMN(r,a);t.push(s.position),t.push(o.position)}for(let r=0;r<this._nCount;r++)for(let i=0;i<this._mCount;i++){const s=this.getVertexAtMN(i,r);let a=i+1;if(a>=this._mCount)if(this._closedM)a=0;else continue;const o=this.getVertexAtMN(a,r);t.push(s.position),t.push(o.position)}return e.lines(t)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolygonMesh");let t=16;return this._closedM&&(t|=1),this._closedN&&(t|=32),e.writeInt16(66,1),e.writeInt16(70,t),e.writeInt32(71,this._mCount),e.writeInt32(72,this._nCount),this}dxfOut(e,t=!1){super.dxfOut(e,t);for(let r=0;r<this.numberOfVertices;r++){const i=this.getVertexAt(r);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolygonMeshVertex"),e.writePoint3d(10,i.position),e.writeInt16(70,16)}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectBoundary2d();return t.length<2?1:Ae.from2dPoints(t,this.isBoundaryClosed()).getOffsetSideAtPoint(e)}createOffsetCurve(e){return Xi(this.collectBoundary2d(),this.isBoundaryClosed(),e)}isBoundaryClosed(){return this._closedM&&this._closedN&&this._mCount>1&&this._nCount>1}collectBoundary2d(){const e=this._mCount,t=this._nCount;if(e<1||t<1)return[];const r=[],i=(s,a)=>{const o=this.getVertexAtMN(s,a).position;r.push(new E(o.x,o.y))};if(e===1){for(let s=0;s<t;s++)i(0,s);return r}if(t===1){for(let s=0;s<e;s++)i(s,0);return r}for(let s=0;s<t;s++)i(0,s);for(let s=1;s<e;s++)i(s,t-1);for(let s=t-2;s>=0;s--)i(e-1,s);for(let s=e-2;s>=1;s--)i(s,0);return r}};Ta.typeName="PolygonMesh";let pi=Ta;class ec{constructor(e){this.position=new b(e.x,e.y,e.z||0)}}class tc{constructor(e){this.vertexIndices=e}}const Ca=class Ca extends ge{get dxfTypeName(){return"POLYLINE"}constructor(e,t){super(),this._vertices=e.map(r=>new ec(r)),this._faces=t.map(r=>new tc(r))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}set closed(e){}getVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[e]}getFaceAt(e){if(e<0||e>=this._faces.length)throw new Error("Face index out of bounds");return this._faces[e]}get geometricExtents(){if(this._vertices.length===0)return new R(new b(0,0,0),new b(0,0,0));let e=Number.MAX_VALUE,t=Number.MAX_VALUE,r=Number.MAX_VALUE,i=-Number.MAX_VALUE,s=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{e=Math.min(e,o.position.x),t=Math.min(t,o.position.y),r=Math.min(r,o.position.z),i=Math.max(i,o.position.x),s=Math.max(s,o.position.y),a=Math.max(a,o.position.z)}),new R(new b(e,t,r),new b(i,s,a))}subGetGripPoints(){const e=new Array;return this._vertices.forEach(t=>{e.push(t.position)}),e}subGetOsnapPoints(e,t,r,i){switch(e){case v.EndPoint:this._vertices.forEach(s=>{i.push(s.position)});break}}transformBy(e){return this._vertices.forEach(t=>{t.position.applyMatrix4(e)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(e=>({x:e.position.x,y:e.position.y,z:e.position.z}))}},{name:"faces",type:"array",editable:!1,itemSchema:{properties:[{name:"vertexIndices",type:"array",editable:!1,itemSchema:{properties:[{name:"index",type:"int",editable:!1}]}}]},accessor:{get:()=>this._faces.map(e=>({vertexIndices:e.vertexIndices}))}}]}]}}subWorldDraw(e){const t=[];return this._faces.forEach(r=>{const i=[];if(r.vertexIndices.forEach(s=>{const a=Math.abs(s)-1;a>=0&&a<this._vertices.length&&i.push(this._vertices[a].position)}),i.length>=3)for(let s=0;s<i.length;s++){const a=i[s],o=i[(s+1)%i.length];t.push(a),t.push(o)}}),e.lines(t)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolyFaceMesh");const t=64;return e.writeInt16(66,1),e.writeInt16(70,t),this}dxfOut(e,t=!1){super.dxfOut(e,t);for(let r=0;r<this.numberOfVertices;r++){const i=this.getVertexAt(r);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolyFaceMeshVertex"),e.writePoint3d(10,i.position),e.writeInt16(70,64)}for(let r=0;r<this.numberOfFaces;r++){const i=this.getFaceAt(r);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolyFaceMeshVertex"),e.writeInt16(70,128),i.vertexIndices.forEach((s,a)=>{e.writeInt32(10+a,s)})}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectLargestFaceBoundary2d();return t.length<2?1:Ae.from2dPoints(t,!0).getOffsetSideAtPoint(e)}createOffsetCurve(e){return Xi(this.collectLargestFaceBoundary2d(),!0,e)}collectLargestFaceBoundary2d(){let e=[];for(const t of this._faces){const r=t.vertexIndices.filter(i=>i>=0);r.length>e.length&&(e=r)}return e.length<2?this._vertices.map(t=>new E(t.position.x,t.position.y)):e.map(t=>{const r=this.getVertexAt(t).position;return new E(r.x,r.y)})}};Ca.typeName="PolyFaceMesh";let fi=Ca;var mi=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(mi||{});const Ma=class Ma extends le{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new b,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new b,this._textRotation=0,this._normal=new x(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(e){this._dimBlockPosition.copy(e)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e,this._dimStyle=void 0}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new an),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get properties(){return this.getBaseProperties()}getBaseProperties(){return{type:this.type,groups:[this.getGeneralProperties(),this.getDimensionProperties()]}}transformBy(e){const t=this._textPosition.clone(),r=this._textPosition.clone().add(new x(Math.cos(this._textRotation),Math.sin(this._textRotation),0));this._dimBlockPosition.applyMatrix4(e),this._textPosition.applyMatrix4(e),this._normal.transformDirection(e),t.applyMatrix4(e),r.applyMatrix4(e);const i=new x(r).sub(t);return i.lengthSq()>0&&(this._textRotation=Math.atan2(i.y,i.x)),this.subTransformBy(e),this}subGetOsnapPoints(e,t,r,i,s){const a=this.getDimBlockTableRecord();if(!a)return;const o=this.getFullDimBlockTransform(),l=new b(t).applyMatrix4(o.clone().invert()),c=new b(r).applyMatrix4(o.clone().invert()),h=(d,p)=>{const g=[];d.subGetOsnapPoints(e,l,c,g,p,o),d instanceof sn?g.forEach(f=>i.push(f.clone())):g.forEach(f=>i.push(new b(f).applyMatrix4(o)))};if(s){const d=a.getIdAt(s);if(d&&(h(d,s),i.length>0))return}for(const d of a.newIterator())h(d)}subWorldDraw(e){const t=this.getDimBlockTableRecord();if(t){const i=this.computeDimBlockTransform();return on.instance.draw(e,t,this.rgbColor,[],!1,i,this._normal)}return e.group([])}getDimBlockGeometricExtents(){const e=new R,t=this.getDimBlockTableRecord();if(!t)return e;for(const r of t.newIterator())e.union(r.geometricExtents);return e.applyMatrix4(this.getFullDimBlockTransform()),e}getDimBlockTableRecord(){return this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0}getDimensionProperties(){return{groupName:"dimension",properties:[this.createProperty("dimensionStyleName","string",()=>this.dimensionStyleName??"",e=>{this.dimensionStyleName=e.trim()===""?null:e}),this.createProperty("dimensionText","string",()=>this.dimensionText??"",e=>{this.dimensionText=e}),this.createProperty("measurement","float",()=>this.getMeasurementPropertyValue()),this.createProperty("dimBlockId","string",()=>this.dimBlockId??""),...this.createPoint3dProperties("dimBlockPosition",()=>this.dimBlockPosition),...this.createPoint3dProperties("textPosition",()=>this.textPosition),this.createProperty("textRotation","float",()=>this.textRotation,e=>{this.textRotation=e}),this.createProperty("textLineSpacingFactor","float",()=>this.textLineSpacingFactor,e=>{this.textLineSpacingFactor=e}),this.createProperty("textLineSpacingStyle","enum",()=>this.textLineSpacingStyle,e=>{this.textLineSpacingStyle=e},[{label:mi[1],value:1},{label:mi[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(e,t,r,i,s){return{name:e,type:t,editable:i!=null,options:s,accessor:i?{get:r,set:i}:{get:r}}}createPoint3dProperties(e,t){return[this.createProperty(`${e}X`,"float",()=>t().x,r=>{t().x=r}),this.createProperty(`${e}Y`,"float",()=>t().y,r=>{t().y=r}),this.createProperty(`${e}Z`,"float",()=>t().z,r=>{t().z=r})]}getMeasurementPropertyValue(){return this.measurement}getFullDimBlockTransform(){const e=this.computeDimBlockTransform();if(this._normal.x===0&&this._normal.y===0&&this._normal.z===1)return e;const t=new D().setFromExtrusionDirection(this._normal);return new D().multiplyMatrices(t,e)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}findPointOnLine1(e,t,r){const i=new b().subVectors(t,e).normalize();return new b(t).addScaledVector(i,r)}findPointOnLine2(e,t,r){const i=e.x+r*Math.cos(t),s=e.y+r*Math.sin(t);return{x:i,y:s}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():exports.AcGiArrowType.Closed}computeDimBlockTransform(){const e=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,t=(e==null?void 0:e.origin)??b.ORIGIN,r=new D().makeTranslation(-t.x,-t.y,-t.z),i=new D().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new D().multiplyMatrices(i,r)}subTransformBy(e){}dxfOutFields(e){super.dxfOutFields(e);const t=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return e.writeSubclassMarker("AcDbDimension"),e.writeInt16(280,0),e.writeString(2,this.dimBlockId??void 0),e.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),e.writePoint3d(10,this.dimBlockPosition),e.writeString(1,this.dimensionText??""),e.writeAngle(53,this.textRotation),e.writePoint3d(11,this.textPosition),e.writeInt16(70,0),e.writeInt16(72,this.textLineSpacingStyle),e.writeDouble(41,this.textLineSpacingFactor),e.writeDouble(42,this.measurement),e.writeVector3d(210,this.normal),e.writeObjectId(340,t==null?void 0:t.objectId),this}};Ma.typeName="Dimension";let xt=Ma;const Oa=class Oa extends xt{constructor(e,t,r,i,s=null,a=null){super(),this._centerPoint=new b().copy(e),this._xLine1Point=new b().copy(t),this._xLine2Point=new b().copy(r),this._arcPoint=new b().copy(i),this.dimensionText=s,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}subTransformBy(e){this._arcPoint.applyMatrix4(e),this._centerPoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e)}get geometricExtents(){return new R}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDb3PointAngularDimension"),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.centerPoint),e.writePoint3d(16,this.arcPoint),this}};Oa.typeName="3PointAngularDimension";let yi=Oa;const ka=class ka extends xt{constructor(e,t,r,i=null,s=null){super(),this._dimLinePoint=new b().copy(r),this._xLine1Point=new b().copy(e),this._xLine2Point=new b().copy(t),this._oblique=0,this._rotation=0,this.calculateRotation(),i?this.dimensionText=i:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=s}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("dimLinePoint",()=>this.dimLinePoint),this.createProperty("rotation","float",()=>this.rotation,t=>{this.rotation=t}),this.createProperty("oblique","float",()=>this.oblique,t=>{this.oblique=t})]}]}}subTransformBy(e){this._dimLinePoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e),this.calculateRotation()}get geometricExtents(){return this.getDimBlockGeometricExtents()}get isAppendArrow(){return!1}createDimBlock(e){const t=new se;t.name=e;const r=this.createLines();r.forEach(o=>t.appendEntity(new or(o.startPoint,o.endPoint))),this.createArrows(r[0]).forEach(o=>t.appendEntity(o));const s=r[0].midPoint,a=this.createMText(s,this._rotation);return a&&t.appendEntity(a),t}createMText(e,t){const r=i=>({x:Math.cos(i),y:Math.sin(i),z:0});if(this.dimensionText){const i=new lr;return i.attachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,i.layer="0",i.color=new B(exports.AcCmColorMethod.ByBlock),i.location=e,i.contents=this.dimensionText??"",i.height=10,i.direction=r(t),i.styleName=this.dimensionStyle.dimtxsty,i}}createArrows(e){const t=[];return t.push(this.createArrow(e.startPoint,this.rotation+Math.PI,10)),t.push(this.createArrow(e.endPoint,this.rotation,10)),t}createArrow(e,t,r){const i="_CAXARROW",s=new sn(i);return s.position=e,s.rotation=t,s.scaleFactors={x:r,y:r,z:r},s}createLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),r=this.createExtensionLine(this._xLine2Point),i=this.findIntersectionPoint(t,this._dimLinePoint),s=this.findIntersectionPoint(r,this._dimLinePoint),a=new bt(i,s);return e.push(a),t.endPoint=i,this.adjustExtensionLine(t),e.push(t),r.endPoint=s,this.adjustExtensionLine(r),e.push(r),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,r=this.findPointOnLine2(e,t,100);return new bt(e,{...r,z:e.z})}findIntersectionPoint(e,t){const r=e.startPoint,i=e.endPoint,s=new x().subVectors(i,r).normalize(),o=new x().subVectors(t,r).dot(s),l=new x().copy(s).multiplyScalar(o);return new x().addVectors(r,l)}calculateRotation(){const e=this._xLine1Point,t=this._xLine2Point,r=t.x-e.x,i=t.y-e.y;this._rotation=Math.atan2(i,r)}get dxfSubclassMarker(){return"AcDbAlignedDimension"}getMeasurementPropertyValue(){return this.measurement??this.xLine1Point.distanceTo(this.xLine2Point)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker(this.dxfSubclassMarker),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.dimLinePoint),e.writeAngle(50,this.rotation),e.writeAngle(52,this.oblique),this}};ka.typeName="AlignedDimension";let dr=ka;const Na=class Na extends xt{constructor(e,t,r,i,s=null,a=null){super(),this._arcPoint=new b().copy(i),this._xLine1Point=new b().copy(t),this._xLine2Point=new b().copy(r),this._centerPoint=new b().copy(e),this.dimensionText=s,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}subTransformBy(e){this._arcPoint.applyMatrix4(e),this._centerPoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e)}get geometricExtents(){return new R}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbArcDimension"),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.centerPoint),e.writePoint3d(16,this.arcPoint),this}};Na.typeName="ArcDimension";let Ss=Na;const Ya=class Ya extends xt{constructor(e,t,r=0,i=null,s=null){super(),this._chordPoint=new b().copy(e),this._farChordPoint=new b().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=r,this.dimensionText=i,this.dimensionStyleName=s}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLength(e){this._leaderLength=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),...this.createPoint3dProperties("farChordPoint",()=>this.farChordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,t=>{this.leaderLength=t}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,t=>{this.extArcStartAngle=t}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,t=>{this.extArcEndAngle=t})]}]}}subTransformBy(e){this._chordPoint.applyMatrix4(e),this._farChordPoint.applyMatrix4(e)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){return new R}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbDiametricDimension"),e.writePoint3d(15,this.chordPoint),e.writePoint3d(16,this.farChordPoint),e.writeDouble(40,this.leaderLength),e.writeAngle(52,this.extArcStartAngle),e.writeAngle(53,this.extArcEndAngle),this}};Ya.typeName="DiametricDimension";let _i=Ya;const Xa=class Xa extends xt{constructor(e,t,r=null,i=null){super(),this._definingPoint=new b().copy(e),this._leaderEndPoint=new b().copy(t),this.dimensionText=r,this.dimensionStyleName=i}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("definingPoint",()=>this.definingPoint),...this.createPoint3dProperties("leaderEndPoint",()=>this.leaderEndPoint)]}]}}subTransformBy(e){this._definingPoint.applyMatrix4(e),this._leaderEndPoint.applyMatrix4(e)}get geometricExtents(){return new R}get arrowLineCount(){return 0}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbOrdinateDimension"),e.writePoint3d(13,this.definingPoint),e.writePoint3d(14,this.leaderEndPoint),this}};Xa.typeName="OrdinateDimension";let bi=Xa;const Ra=class Ra extends xt{constructor(e,t,r,i=null,s=null){super(),this._center=new b().copy(e),this._chordPoint=new b().copy(t),this._leaderLength=r,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=i,this.dimensionStyleName=s}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLength(e){this._leaderLength=e}set leaderLenght(e){this._leaderLength=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("center",()=>this.center),...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,t=>{this.leaderLength=t}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,t=>{this.extArcStartAngle=t}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,t=>{this.extArcEndAngle=t})]}]}}subTransformBy(e){this._center.applyMatrix4(e),this._chordPoint.applyMatrix4(e)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){return new R}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRadialDimension"),e.writePoint3d(15,this.center),e.writePoint3d(13,this.chordPoint),e.writeDouble(40,this.leaderLength),e.writeAngle(52,this.extArcStartAngle),e.writeAngle(53,this.extArcEndAngle),this}};Ra.typeName="RadialDimension";let xi=Ra;const Ba=class Ba extends dr{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};Ba.typeName="RotatedDimension";let wi=Ba;class tn extends Ge{constructor(e){super(),this.database=e,this.objectId=e.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,r=>this.hasId(r)),this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t),this.database.events.dictObjetSet.dispatch({database:this.database,object:t,key:e})}remove(e){const t=this.getAt(e);return t?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e}),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((r,i)=>{r===t&&(this._recordsByName.delete(i),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:i}))}),!0):!1}removeAll(){this._recordsByName.forEach((e,t)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t})}),this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new mr(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbDictionary"),e.writeInt16(280,1),e.writeInt16(281,1);for(const[t,r]of this._recordsByName)e.writeString(3,t),e.writeObjectId(350,r.objectId);return this}}class nc extends tn{getBtrIdAt(e){for(const[t,r]of this._recordsByName)if(r.blockTableRecordId==e)return r}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class Zs extends Ge{constructor(){super(),this._contentType=2,this._drawMLeaderOrderType=1,this._drawLeaderOrderType=0,this._bitFlags=0,this._maxLeaderSegmentsPoints=-1,this._firstSegmentAngleConstraint=0,this._secondSegmentAngleConstraint=0,this._leaderLineType=1,this._leaderLineColor=new B(exports.AcCmColorMethod.ByLayer),this._leaderLineWeight=-2,this._enableLanding=!0,this._landingGap=2,this._enableDogleg=!0,this._doglegLength=8,this._description="",this._arrowSize=4,this._defaultMTextContents="",this._textLeftAttachmentType=1,this._textAngleType=1,this._textAlignmentType=0,this._textRightAttachmentType=1,this._textColor=new B(exports.AcCmColorMethod.ByLayer),this._textHeight=4,this._enableFrameText=!1,this._textAlignAlwaysLeft=!1,this._alignSpace=0,this._blockColor=new B(exports.AcCmColorMethod.ByBlock),this._blockScale=new x(1,1,1),this._enableBlockScale=!0,this._blockRotation=0,this._enableBlockRotation=!1,this._blockConnectionType=0,this._scale=1,this._overwritePropChanged=!1,this._annotative=!1,this._breakSize=0,this._textAttachmentDirection=0,this._bottomTextAttachmentType=9,this._topTextAttachmentType=9,this._extendLeaderToText=!1}get unknown1(){return this._unknown1}set unknown1(e){this._unknown1=e}get contentType(){return this._contentType}set contentType(e){this._contentType=e}get drawMLeaderOrderType(){return this._drawMLeaderOrderType}set drawMLeaderOrderType(e){this._drawMLeaderOrderType=e}get drawLeaderOrderType(){return this._drawLeaderOrderType}set drawLeaderOrderType(e){this._drawLeaderOrderType=e}get bitFlags(){return this._bitFlags}set bitFlags(e){this._bitFlags=e}get maxLeaderSegmentsPoints(){return this._maxLeaderSegmentsPoints}set maxLeaderSegmentsPoints(e){this._maxLeaderSegmentsPoints=e}get maxLeaderSegmentPoints(){return this.maxLeaderSegmentsPoints}set maxLeaderSegmentPoints(e){this.maxLeaderSegmentsPoints=e}get firstSegmentAngleConstraint(){return this._firstSegmentAngleConstraint}set firstSegmentAngleConstraint(e){this._firstSegmentAngleConstraint=e}get secondSegmentAngleConstraint(){return this._secondSegmentAngleConstraint}set secondSegmentAngleConstraint(e){this._secondSegmentAngleConstraint=e}get leaderLineType(){return this._leaderLineType}set leaderLineType(e){this._leaderLineType=e}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(e){this._leaderLineColor.copy(e)}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(e){this._leaderLineTypeId=e}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(e){this._leaderLineWeight=e}get enableLanding(){return this._enableLanding}set enableLanding(e){this._enableLanding=e}get landingEnabled(){return this.enableLanding}set landingEnabled(e){this.enableLanding=e}get landingGap(){return this._landingGap}set landingGap(e){this._landingGap=e}get enableDogleg(){return this._enableDogleg}set enableDogleg(e){this._enableDogleg=e}get doglegEnabled(){return this.enableDogleg}set doglegEnabled(e){this.enableDogleg=e}get doglegLength(){return this._doglegLength}set doglegLength(e){this._doglegLength=e}get description(){return this._description}set description(e){this._description=e}get arrowSymbolId(){return this._arrowSymbolId}set arrowSymbolId(e){this._arrowSymbolId=e}get arrowheadId(){return this.arrowSymbolId}set arrowheadId(e){this.arrowSymbolId=e}get arrowSize(){return this._arrowSize}set arrowSize(e){this._arrowSize=e}get arrowheadSize(){return this.arrowSize}set arrowheadSize(e){this.arrowSize=e}get defaultMTextContents(){return this._defaultMTextContents}set defaultMTextContents(e){this._defaultMTextContents=e}get defaultMText(){return this.defaultMTextContents}set defaultMText(e){this.defaultMTextContents=e}get textString(){return this.defaultMTextContents}set textString(e){this.defaultMTextContents=e}get textStyleId(){return this._textStyleId}set textStyleId(e){this._textStyleId=e}get textStyle(){return this.textStyleId}set textStyle(e){this.textStyleId=e}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(e){this._textLeftAttachmentType=e}get textAngleType(){return this._textAngleType}set textAngleType(e){this._textAngleType=e}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(e){this._textAlignmentType=e}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(e){this._textRightAttachmentType=e}get textColor(){return this._textColor}set textColor(e){this._textColor.copy(e)}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get enableFrameText(){return this._enableFrameText}set enableFrameText(e){this._enableFrameText=e}get textFrameEnabled(){return this.enableFrameText}set textFrameEnabled(e){this.enableFrameText=e}get textAlignAlwaysLeft(){return this._textAlignAlwaysLeft}set textAlignAlwaysLeft(e){this._textAlignAlwaysLeft=e}get alignSpace(){return this._alignSpace}set alignSpace(e){this._alignSpace=e}get blockId(){return this._blockId}set blockId(e){this._blockId=e}get blockContentId(){return this.blockId}set blockContentId(e){this.blockId=e}get blockColor(){return this._blockColor}set blockColor(e){this._blockColor.copy(e)}get blockContentColor(){return this.blockColor}set blockContentColor(e){this.blockColor=e}get blockScale(){return this._blockScale.clone()}set blockScale(e){this._blockScale.copy(e)}get blockContentScale(){return this.blockScale}set blockContentScale(e){this.blockScale=e}get enableBlockScale(){return this._enableBlockScale}set enableBlockScale(e){this._enableBlockScale=e}get blockContentScaleEnabled(){return this.enableBlockScale}set blockContentScaleEnabled(e){this.enableBlockScale=e}get blockRotation(){return this._blockRotation}set blockRotation(e){this._blockRotation=e}get blockContentRotation(){return this.blockRotation}set blockContentRotation(e){this.blockRotation=e}get enableBlockRotation(){return this._enableBlockRotation}set enableBlockRotation(e){this._enableBlockRotation=e}get blockContentRotationEnabled(){return this.enableBlockRotation}set blockContentRotationEnabled(e){this.enableBlockRotation=e}get blockConnectionType(){return this._blockConnectionType}set blockConnectionType(e){this._blockConnectionType=e}get blockContentConnectionType(){return this.blockConnectionType}set blockContentConnectionType(e){this.blockConnectionType=e}get scale(){return this._scale}set scale(e){this._scale=e}get scaleFactor(){return this.scale}set scaleFactor(e){this.scale=e}get overwritePropChanged(){return this._overwritePropChanged}set overwritePropChanged(e){this._overwritePropChanged=e}get overwritePropertyValue(){return this.overwritePropChanged}set overwritePropertyValue(e){this.overwritePropChanged=e}get annotative(){return this._annotative}set annotative(e){this._annotative=e}get breakSize(){return this._breakSize}set breakSize(e){this._breakSize=e}get breakGapSize(){return this.breakSize}set breakGapSize(e){this.breakSize=e}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(e){this._textAttachmentDirection=e}get bottomTextAttachmentType(){return this._bottomTextAttachmentType}set bottomTextAttachmentType(e){this._bottomTextAttachmentType=e}get bottomTextAttachmentDirection(){return this.bottomTextAttachmentType}set bottomTextAttachmentDirection(e){this.bottomTextAttachmentType=e}get topTextAttachmentType(){return this._topTextAttachmentType}set topTextAttachmentType(e){this._topTextAttachmentType=e}get topTextAttachmentDirection(){return this.topTextAttachmentType}set topTextAttachmentDirection(e){this.topTextAttachmentType=e}get extendLeaderToText(){return this._extendLeaderToText}set extendLeaderToText(e){this._extendLeaderToText=e}get unknown2(){return this._unknown2}set unknown2(e){this._unknown2=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMLeaderStyle"),e.writeInt16(179,this.unknown1),e.writeInt16(170,this.contentType),e.writeInt16(171,this.drawMLeaderOrderType),e.writeInt16(172,this.drawLeaderOrderType),e.writeInt32(90,this.maxLeaderSegmentsPoints),e.writeDouble(40,this.firstSegmentAngleConstraint),e.writeDouble(41,this.secondSegmentAngleConstraint),e.writeInt16(173,this.leaderLineType),e.writeInt32(91,Rr(this.leaderLineColor)),e.writeHandle(340,this.leaderLineTypeId),e.writeInt32(92,this.leaderLineWeight),e.writeBoolean(290,this.enableLanding),e.writeDouble(42,this.landingGap),e.writeBoolean(291,this.enableDogleg),e.writeDouble(43,this.doglegLength),e.writeString(3,this.description),e.writeHandle(341,this.arrowSymbolId),e.writeDouble(44,this.arrowSize),e.writeString(300,this.defaultMTextContents),e.writeHandle(342,this.textStyleId),e.writeInt16(174,this.textLeftAttachmentType),e.writeInt16(175,this.textAngleType),e.writeInt16(176,this.textAlignmentType),e.writeInt16(178,this.textRightAttachmentType),e.writeInt32(93,Rr(this.textColor)),e.writeDouble(45,this.textHeight),e.writeBoolean(292,this.enableFrameText),e.writeBoolean(297,this.textAlignAlwaysLeft),e.writeDouble(46,this.alignSpace),e.writeHandle(343,this.blockId),e.writeInt32(94,Rr(this.blockColor)),e.writeDouble(47,this._blockScale.x),e.writeDouble(49,this._blockScale.y),e.writeDouble(140,this._blockScale.z),e.writeBoolean(293,this.enableBlockScale),e.writeDouble(141,this.blockRotation),e.writeBoolean(294,this.enableBlockRotation),e.writeInt16(177,this.blockConnectionType),e.writeDouble(142,this.scale),e.writeBoolean(295,this.overwritePropChanged),e.writeBoolean(296,this.annotative),e.writeDouble(143,this.breakSize),e.writeInt16(271,this.textAttachmentDirection),e.writeInt16(272,this.bottomTextAttachmentType),e.writeInt16(273,this.topTextAttachmentType),e.writeBoolean(298,this.unknown2),this}}class Qs extends Ge{constructor(){super(),this._styleName="STANDARD",this._flags=0,this._description="",this._fillColor=new B,this._startAngle=90,this._endAngle=90,this._elements=[]}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get flags(){return this._flags}set flags(e){this._flags=e}get description(){return this._description}set description(e){this._description=e}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor.copy(e)}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=e}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=e}get elementCount(){return this._elements.length}get elements(){return this._elements.map(e=>({offset:e.offset,color:e.color.clone(),lineType:e.lineType}))}set elements(e){this._elements=e.map(t=>({offset:t.offset,color:t.color.clone(),lineType:t.lineType}))}addElement(e){this._elements.push({offset:e.offset,color:e.color.clone(),lineType:e.lineType})}removeElementAt(e){if(e<0||e>=this._elements.length)throw new Error("The element index is out of range!");this._elements.splice(e,1)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMlineStyle"),e.writeString(2,this.styleName),e.writeInt16(70,this.flags),e.writeString(3,this.description),e.writeCmColor(this.fillColor),e.writeDouble(51,this.startAngle),e.writeDouble(52,this.endAngle),e.writeInt16(71,this.elementCount),this._elements.forEach(t=>{e.writeDouble(49,t.offset),e.writeCmColor(t.color),e.writeString(6,t.lineType)}),this}}class rc extends Ge{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRasterImageDef"),e.writeString(1,this.sourceFileName),e.writeInt16(280,1),e.writeInt16(281,0),this}}var ic=(n=>(n[n.NotApplicable=0]="NotApplicable",n[n.Ignore=1]="Ignore",n[n.Replace=2]="Replace",n[n.XrefMangleName=3]="XrefMangleName",n[n.MangleName=4]="MangleName",n))(ic||{});class Ag extends Ge{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(e){this._data=e}clear(){var e;(e=this._data)==null||e.clear()}clone(){return super.clone()}getDuplicateRecordCloning(){return 0}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbXrecord"),e.writeInt16(280,1),e.writeResultBuffer(this.data),this}}class sc{constructor(e){this.db=e}createDefaultLayer(){const e=new B;return e.colorIndex=7,this.db.tables.layerTable.add(new Ri({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new Ot({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Ot({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Ot({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new Bi({name:oe,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new an({name:oe,dimtxsty:oe}))}createDefaultLayout(){const e=new yr;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(e.layoutName,e),this.db.tables.blockTable.modelSpace.layoutId=e.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const t=new ar;t.patternName=rn;const r=new ir;r.add(new _t({x:0,y:0},{x:-1,y:.125})),r.add(new _t({x:-1,y:.125},{x:-1,y:-.125})),r.add(new _t({x:-1,y:-.125},{x:0,y:0})),t.add(r);const i=new se;i.name="_CAXARROW",i.appendEntity(t),this.db.tables.blockTable.add(i)}}}var ac=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(ac||{});const Js=192,vi=193,ea=194,ta=195,oc=200;function Rr(n){if(n.isByBlock)return vi<<24>>0;if(n.isByLayer)return Js<<24>>0;const e=n.colorIndex;if(e!=null&&e>0&&e<256)return(ta<<24|e&255)>>0;const t=n.RGB;return t!=null?(ea<<24|t&16777215)>>0:vi<<24>>0}function er(n){const e=new B(exports.AcCmColorMethod.ByBlock);switch(n>>>24&255){case Js:e.setByLayer();break;case vi:case oc:e.setByBlock();break;case ta:e.colorIndex=n&255;break;case ea:e.setRGBValue(n&16777215);break;default:n>=0&&n<=256&&(e.colorIndex=n);break}return e}class na{parse(e){const r=this.normalizeLineEndings(e).split(`
|
|
5
|
-
`),i=[],s=[];let a=null;return r.forEach((o,l)=>{const c=l+1,h=this.stripInlineComment(o).trim();if(!h)return;if(h.startsWith("*")){this.flushCurrentPattern(a,i,s);const p=this.parseHeader(h.slice(1));if(!p){s.push({line:c,message:"Invalid pattern header.",source:o}),a=null;return}a={pattern:{name:p.name,description:p.description,lines:[]},headerLine:c};return}if(!a){s.push({line:c,message:"Line descriptor appears before any pattern header.",source:o});return}const d=this.parseLineDescriptor(h,c);if(!d){s.push({line:c,message:"Invalid line descriptor. Expect: angle,x-origin,y-origin,delta-x,delta-y[,dash-1,...].",source:o});return}a.pattern.lines.push(d)}),this.flushCurrentPattern(a,i,s),{patterns:i,issues:s}}static parse(e){return new na().parse(e)}normalizeLineEndings(e){return e.replace(/\r\n/g,`
|
|
3
|
+
`}registerHandle(e){return this._handleMap.has(e)||(/^[0-9A-F]+$/i.test(e)?this._handleMap.set(e,e.toUpperCase()):(this._handleMap.set(e,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1)),this._handleMap.get(e)}resolveHandle(e){if(e)return this.registerHandle(e)}writeGroup(e,t){if(t==null)return this;this._lines.push(String(Math.trunc(e)));const r=this.formatValue(t);return this._lines.push(r===""?"0":r),this}writeStart(e){return this.writeString(0,e)}writeSubclassMarker(e){return this.writeString(100,e)}writeString(e,t){return!t&&t!==""?this:this.writeGroup(e,t)}writeInt8(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt16(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt32(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt64(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeUInt16(e,t){return t==null?this:this.writeGroup(e,Math.max(0,t))}writeUInt32(e,t){return t==null?this:this.writeGroup(e,Math.max(0,t))}writeBoolean(e,t){return t==null?this:this.writeGroup(e,t?1:0)}writeBool(e,t){return this.writeBoolean(e,t)}writeDouble(e,t){return t==null||!Number.isFinite(t)?this:this.writeGroup(e,t)}writeAngle(e,t){return t==null||!Number.isFinite(t)?this:this.writeDouble(e,t*180/Math.PI)}writeHandle(e,t){const r=this.resolveHandle(t);return r?this.writeString(e,r):this}writeObjectId(e,t){return this.writeHandle(e,t)}writePoint2d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this):this}writePoint3d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this.writeDouble(e+20,t.z??0),this):this}writeVector3d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this.writeDouble(e+20,t.z??0),this):this}writeCmColor(e,t=62,r=420){if(!e)return this;const i=e.colorIndex;i!=null&&this.writeInt16(t,i);const s=e.RGB;return s!=null&&e.colorIndex==null&&this.writeInt32(r,s),this}writeTransparency(e,t=440){return!e||e.method===exports.AcCmTransparencyMethod.ErrorValue?this:this.writeInt32(t,e.serialize())}writeResultBuffer(e){if(!e)return this;for(const t of e)this.writeGroup(t.code,t.value);return this}startSection(e){return this.writeStart("SECTION"),this.writeString(2,e),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(e){return this.writeStart("TABLE"),this.writeString(2,e),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(e){if(typeof e=="string")return this.sanitizeStringForDxfLine(e);if(typeof e=="boolean")return e?"1":"0";if(typeof e=="number"){if(!Number.isFinite(e))return"0";if(Number.isInteger(e))return String(e);const r=e.toFixed(this._precision).replace(/\.?0+$/,"");return r===""||r==="-"?"0":r}return String(e)}sanitizeStringForDxfLine(e){return e.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}var pe=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Go=1234567,Ns=Math.PI/180,Ys=180/Math.PI;function Ca(){var n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0,i=pe[n&255]+pe[n>>8&255]+pe[n>>16&255]+pe[n>>24&255]+"-"+pe[e&255]+pe[e>>8&255]+"-"+pe[e>>16&15|64]+pe[e>>24&255]+"-"+pe[t&63|128]+pe[t>>8&255]+"-"+pe[t>>16&255]+pe[t>>24&255]+pe[r&255]+pe[r>>8&255]+pe[r>>16&255]+pe[r>>24&255];return i.toLowerCase()}function pt(n,e,t){return Math.max(e,Math.min(t,n))}function Xs(n,e){return(n%e+e)%e}function Ma(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function Oa(n,e,t){return n!==e?(t-n)/(e-n):0}function Rs(n,e,t){return(1-t)*n+t*e}function ka(n,e,t,r){return Rs(n,e,1-Math.exp(-t*r))}function Na(n,e){return e===void 0&&(e=1),e-Math.abs(Xs(n,e*2)-e)}function Ya(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Xa(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Ra(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Ba(n,e){return n+Math.random()*(e-n)}function Fa(n){return n*(.5-Math.random())}function Da(n){n!==void 0&&(Go=n);var e=Go+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function za(n){return n*Ns}function Va(n){return n*Ys}function ja(n){return(n&n-1)===0&&n!==0}function Ga(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Ha(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Zn(n){var e=Math.PI*2;return(n%e+e)%e}function Wa(n,e,t){return n>e&&n<t||n>t&&n<e}function Ua(n,e,t,r){return r===void 0&&(r=!1),n=Zn(n),e=Zn(e),t=Zn(t),r?e>t?n<=e&&n>=t:n<=e||n>=t:e<t?n>=e&&n<=t:n>=e||n<=t}function Bs(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function $a(n,e){e===void 0&&(e=1e-7);var t=Bs(n);return Math.max(Math.pow(10,t)*e,e)}var T={DEG2RAD:Ns,RAD2DEG:Ys,generateUUID:Ca,clamp:pt,euclideanModulo:Xs,mapLinear:Ma,inverseLerp:Oa,lerp:Rs,damp:ka,pingpong:Na,smoothstep:Ya,smootherstep:Xa,randInt:Ra,randFloat:Ba,randFloatSpread:Fa,seededRandom:Da,degToRad:za,radToDeg:Va,isPowerOfTwo:ja,ceilPowerOfTwo:Ga,floorPowerOfTwo:Ha,normalizeAngle:Zn,isBetween:Wa,isBetweenAngle:Ua,intPartLength:Bs,relativeEps:$a},pd=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Z=function(){function n(e,t){this.x=0,this.y=0;var r=+(e!==void 0)+ +(t!==void 0);if(r!==0){if(r===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(r===1){var i=e,s=i.x,o=i.y;this.x=s,this.y=o;return}if(r===2){this.x=e,this.y=t;return}throw Pe.ILLEGAL_PARAMETERS}}return Object.defineProperty(n.prototype,"width",{get:function(){return this.x},set:function(e){this.x=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.y},set:function(e){this.y=e},enumerable:!1,configurable:!0}),n.prototype.set=function(e,t){return this.x=e,this.y=t,this},n.prototype.setScalar=function(e){return this.x=e,this.y=e,this},n.prototype.setX=function(e){return this.x=e,this},n.prototype.setY=function(e){return this.y=e,this},n.prototype.setComponent=function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},n.prototype.getComponent=function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},n.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},n.prototype.addScalar=function(e){return this.x+=e,this.y+=e,this},n.prototype.addVectors=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},n.prototype.addScaledVector=function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},n.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},n.prototype.subScalar=function(e){return this.x-=e,this.y-=e,this},n.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},n.prototype.multiply=function(e){return this.x*=e.x,this.y*=e.y,this},n.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this},n.prototype.divide=function(e){return this.x/=e.x,this.y/=e.y,this},n.prototype.divideScalar=function(e){return this.multiplyScalar(1/e)},n.prototype.applyMatrix2d=function(e){var t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this},n.prototype.min=function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},n.prototype.max=function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},n.prototype.clamp=function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},n.prototype.clampScalar=function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},n.prototype.clampLength=function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},n.prototype.dot=function(e){return this.x*e.x+this.y*e.y},n.prototype.cross=function(e){return this.x*e.y-this.y*e.x},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.angle=function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e},n.prototype.angleTo=function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var r=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,r)))},n.prototype.distanceTo=function(e){return Math.sqrt(this.distanceToSquared(e))},n.prototype.distanceToSquared=function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},n.prototype.manhattanDistanceTo=function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},n.prototype.setLength=function(e){return this.normalize().multiplyScalar(e)},n.prototype.lerp=function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},n.prototype.lerpVectors=function(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this},n.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},n.prototype.fromArray=function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},n.prototype.toArray=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},n.prototype.rotateAround=function(e,t){var r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},n.prototype.relativeEps=function(e){return e===void 0&&(e=1e-7),Math.min(T.relativeEps(this.x,e),T.relativeEps(this.y,e))},n.prototype[Symbol.iterator]=function(){return pd(this,function(e){switch(e.label){case 0:return[4,this.x];case 1:return e.sent(),[4,this.y];case 2:return e.sent(),[2]}})},n.EMPTY=Object.freeze(new n(0,0)),n}(),mr=function(){function n(e,t,r,i,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&r!=null&&i!=null&&s!=null&&o!=null&&a!=null&&l!=null&&c!=null&&this.set(e,t,r,i,s,o,a,l,c)}return n.prototype.set=function(e,t,r,i,s,o,a,l,c){var h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=s,h[5]=l,h[6]=r,h[7]=o,h[8]=c,this},n.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},n.prototype.copy=function(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this},n.prototype.extractBasis=function(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this},n.prototype.setFromMatrix4=function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},n.prototype.multiply=function(e){return this.multiplyMatrices(this,e)},n.prototype.premultiply=function(e){return this.multiplyMatrices(e,this)},n.prototype.multiplyMatrices=function(e,t){var r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],h=r[4],d=r[7],p=r[2],g=r[5],f=r[8],m=i[0],y=i[3],_=i[6],P=i[1],L=i[4],S=i[7],A=i[2],N=i[5],C=i[8];return s[0]=o*m+a*P+l*A,s[3]=o*y+a*L+l*N,s[6]=o*_+a*S+l*C,s[1]=c*m+h*P+d*A,s[4]=c*y+h*L+d*N,s[7]=c*_+h*S+d*C,s[2]=p*m+g*P+f*A,s[5]=p*y+g*L+f*N,s[8]=p*_+g*S+f*C,this},n.prototype.multiplyScalar=function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},n.prototype.determinant=function(){var e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-r*s*h+r*a*l+i*s*c-i*o*l},n.prototype.invert=function(){var e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],d=h*o-a*c,p=a*l-h*s,g=c*s-o*l,f=t*d+r*p+i*g;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);var m=1/f;return e[0]=d*m,e[1]=(i*c-h*r)*m,e[2]=(a*r-i*o)*m,e[3]=p*m,e[4]=(h*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=g*m,e[7]=(r*l-c*t)*m,e[8]=(o*t-r*s)*m,this},n.prototype.transpose=function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},n.prototype.getNormalMatrix=function(e){return this.setFromMatrix4(e).invert().transpose()},n.prototype.transposeIntoArray=function(e){var t=this.elements;return e.elements[0]=t[0],e.elements[1]=t[3],e.elements[2]=t[6],e.elements[3]=t[1],e.elements[4]=t[4],e.elements[5]=t[7],e.elements[6]=t[2],e.elements[7]=t[5],e.elements[8]=t[8],this},n.prototype.setUvTransform=function(e,t,r,i,s,o,a){var l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this},n.prototype.scale=function(e,t){return this.premultiply(Gi.makeScale(e,t)),this},n.prototype.rotate=function(e){return this.premultiply(Gi.makeRotation(-e)),this},n.prototype.translate=function(e,t){return this.premultiply(Gi.makeTranslation(e,t)),this},n.prototype.makeTranslation=function(e,t){return e instanceof Z?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this},n.prototype.makeRotation=function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this},n.prototype.makeScale=function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this},n.prototype.equals=function(e){for(var t=this.elements,r=e.elements,i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0},n.prototype.fromArray=function(e,t){t===void 0&&(t=0);for(var r=0;r<9;r++)this.elements[r]=e[r+t];return this},n.prototype.toArray=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.IDENTITY=Object.freeze(new n),n}(),Gi=new mr,gt=1e-6,G=2*Math.PI,fd={x:0,y:0},Fs={x:0,y:0,z:0},q=function(){function n(){this.equalPointTol=gt,this.equalVectorTol=gt}return n.prototype.clone=function(){var e=new n;return e.equalPointTol=this.equalPointTol,e.equalVectorTol=this.equalVectorTol,e},n.prototype.equalPoint2d=function(e,t){return new Z(e).sub(t).length()<this.equalPointTol},n.prototype.equalPoint3d=function(e,t){return new x(e).sub(t).length()<this.equalPointTol},n.equalToZero=function(e,t){return t===void 0&&(t=gt),e<t&&e>-t},n.equal=function(e,t,r){return r===void 0&&(r=gt),Math.abs(e-t)<r},n.great=function(e,t,r){return r===void 0&&(r=gt),e-t>r},n.less=function(e,t,r){return r===void 0&&(r=gt),e-t<r},n.isPositive=function(e,t){return t===void 0&&(t=gt),e>t},n.isNonPositive=function(e,t){return t===void 0&&(t=gt),e<=t},n}(),Yi=new q,md=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Sn=function(){function n(e,t,r,i){e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0),i===void 0&&(i=1),this._x=e,this._y=t,this._z=r,this._w=i}return n.slerpFlat=function(e,t,r,i,s,o,a){var l=r[i+0],c=r[i+1],h=r[i+2],d=r[i+3],p=s[o+0],g=s[o+1],f=s[o+2],m=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d;return}if(a===1){e[t+0]=p,e[t+1]=g,e[t+2]=f,e[t+3]=m;return}if(d!==m||l!==p||c!==g||h!==f){var y=1-a,_=l*p+c*g+h*f+d*m,P=_>=0?1:-1,L=1-_*_;if(L>Number.EPSILON){var S=Math.sqrt(L),A=Math.atan2(S,_*P);y=Math.sin(y*A)/S,a=Math.sin(a*A)/S}var N=a*P;if(l=l*y+p*N,c=c*y+g*N,h=h*y+f*N,d=d*y+m*N,y===1-a){var C=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=C,c*=C,h*=C,d*=C}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d},n.multiplyQuaternionsFlat=function(e,t,r,i,s,o){var a=r[i],l=r[i+1],c=r[i+2],h=r[i+3],d=s[o],p=s[o+1],g=s[o+2],f=s[o+3];return e[t]=a*f+h*d+l*g-c*p,e[t+1]=l*f+h*p+c*d-a*g,e[t+2]=c*f+h*g+a*p-l*d,e[t+3]=h*f-a*d-l*p-c*g,e},Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._w)},n.prototype.copy=function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},n.prototype.setFromEuler=function(e,t){t===void 0&&(t=!0);var r=e.x,i=e.y,s=e.z,o=e.order,a=Math.cos,l=Math.sin,c=a(r/2),h=a(i/2),d=a(s/2),p=l(r/2),g=l(i/2),f=l(s/2);switch(o){case"XYZ":this._x=p*h*d+c*g*f,this._y=c*g*d-p*h*f,this._z=c*h*f+p*g*d,this._w=c*h*d-p*g*f;break;case"YXZ":this._x=p*h*d+c*g*f,this._y=c*g*d-p*h*f,this._z=c*h*f-p*g*d,this._w=c*h*d+p*g*f;break;case"ZXY":this._x=p*h*d-c*g*f,this._y=c*g*d+p*h*f,this._z=c*h*f+p*g*d,this._w=c*h*d-p*g*f;break;case"ZYX":this._x=p*h*d-c*g*f,this._y=c*g*d+p*h*f,this._z=c*h*f-p*g*d,this._w=c*h*d+p*g*f;break;case"YZX":this._x=p*h*d+c*g*f,this._y=c*g*d+p*h*f,this._z=c*h*f-p*g*d,this._w=c*h*d-p*g*f;break;case"XZY":this._x=p*h*d-c*g*f,this._y=c*g*d-p*h*f,this._z=c*h*f+p*g*d,this._w=c*h*d+p*g*f;break;default:}return t===!0&&this._onChangeCallback(),this},n.prototype.setFromAxisAngle=function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(e){var t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],d=t[10],p=r+a+d;if(p>0){var g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(h-l)*g,this._y=(s-c)*g,this._z=(o-i)*g}else if(r>a&&r>d){var g=2*Math.sqrt(1+r-a-d);this._w=(h-l)/g,this._x=.25*g,this._y=(i+o)/g,this._z=(s+c)/g}else if(a>d){var g=2*Math.sqrt(1+a-r-d);this._w=(s-c)/g,this._x=(i+o)/g,this._y=.25*g,this._z=(l+h)/g}else{var g=2*Math.sqrt(1+d-r-a);this._w=(o-i)/g,this._x=(s+c)/g,this._y=(l+h)/g,this._z=.25*g}return this._onChangeCallback(),this},n.prototype.setFromUnitVectors=function(e,t){var r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()},n.prototype.angleTo=function(e){return 2*Math.acos(Math.abs(pt(this.dot(e),-1,1)))},n.prototype.rotateTowards=function(e,t){var r=this.angleTo(e);if(r===0)return this;var i=Math.min(1,t/r);return this.slerp(e,i),this},n.prototype.identity=function(){return this.set(0,0,0,1)},n.prototype.invert=function(){return this.conjugate()},n.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},n.prototype.dot=function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},n.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.prototype.normalize=function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},n.prototype.multiply=function(e){return this.multiplyQuaternions(this,e)},n.prototype.premultiply=function(e){return this.multiplyQuaternions(e,this)},n.prototype.multiplyQuaternions=function(e,t){var r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=r*h+o*a+i*c-s*l,this._y=i*h+o*l+s*a-r*c,this._z=s*h+o*c+r*l-i*a,this._w=o*h-r*a-i*l-s*c,this._onChangeCallback(),this},n.prototype.slerp=function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var r=this._x,i=this._y,s=this._z,o=this._w,a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;var l=1-a*a;if(l<=Number.EPSILON){var c=1-t;return this._w=c*o+t*this._w,this._x=c*r+t*this._x,this._y=c*i+t*this._y,this._z=c*s+t*this._z,this.normalize(),this}var h=Math.sqrt(l),d=Math.atan2(h,a),p=Math.sin((1-t)*d)/h,g=Math.sin(t*d)/h;return this._w=o*p+this._w*g,this._x=r*p+this._x*g,this._y=i*p+this._y*g,this._z=s*p+this._z*g,this._onChangeCallback(),this},n.prototype.slerpQuaternions=function(e,t,r){return this.copy(e).slerp(t,r)},n.prototype.random=function(){var e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))},n.prototype.equals=function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},n.prototype.fromArray=function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},n.prototype.toArray=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},n.prototype.toJSON=function(){return this.toArray()},n.prototype._onChange=function(e){return this._onChangeCallback=e,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return md(this,function(e){switch(e.label){case 0:return[4,this._x];case 1:return e.sent(),[4,this._y];case 2:return e.sent(),[4,this._z];case 3:return e.sent(),[4,this._w];case 4:return e.sent(),[2]}})},n}(),yd=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},x=function(){function n(e,t,r){this.x=0,this.y=0,this.z=0;var i=+(e!==void 0)+ +(t!==void 0)+ +(r!==void 0);if(i!==0){if(i===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(i===1){var s=e,o=s.x,a=s.y,l=s.z;this.x=o,this.y=a,this.z=l||0;return}if(i===3){this.x=e,this.y=t,this.z=r;return}throw Pe.ILLEGAL_PARAMETERS}}return n.prototype.set=function(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this},n.prototype.setScalar=function(e){return this.x=e,this.y=e,this.z=e,this},n.prototype.setX=function(e){return this.x=e,this},n.prototype.setY=function(e){return this.y=e,this},n.prototype.setZ=function(e){return this.z=e,this},n.prototype.setComponent=function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},n.prototype.getComponent=function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this},n.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this},n.prototype.addScalar=function(e){return this.x+=e,this.y+=e,this.z+=e,this},n.prototype.addVectors=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},n.prototype.addScaledVector=function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},n.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},n.prototype.subScalar=function(e){return this.x-=e,this.y-=e,this.z-=e,this},n.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},n.prototype.multiply=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},n.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},n.prototype.multiplyVectors=function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},n.prototype.applyEuler=function(e){return this.applyQuaternion(Ho.setFromEuler(e))},n.prototype.applyAxisAngle=function(e,t){return this.applyQuaternion(Ho.setFromAxisAngle(e,t))},n.prototype.applyMatrix3=function(e){var t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this},n.prototype.applyNormalMatrix=function(e){return this.applyMatrix3(e).normalize()},n.prototype.applyMatrix4=function(e){var t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this},n.prototype.applyQuaternion=function(e){var t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),h=2*(a*t-s*i),d=2*(s*r-o*t);return this.x=t+l*c+o*d-a*h,this.y=r+l*h+a*c-s*d,this.z=i+l*d+s*h-o*c,this},n.prototype.transformDirection=function(e){var t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()},n.prototype.divide=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},n.prototype.divideScalar=function(e){return this.multiplyScalar(1/e)},n.prototype.min=function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},n.prototype.max=function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},n.prototype.clamp=function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},n.prototype.clampScalar=function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},n.prototype.clampLength=function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},n.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},n.prototype.isParallelTo=function(e){var t=this.dot(e),r=this.length(),i=e.length();return Math.abs(t)===r*i},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.setLength=function(e){return this.normalize().multiplyScalar(e)},n.prototype.lerp=function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},n.prototype.lerpVectors=function(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this},n.prototype.cross=function(e){return this.crossVectors(this,e)},n.prototype.crossVectors=function(e,t){var r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this},n.prototype.projectOnVector=function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)},n.prototype.projectOnPlane=function(e){return Hi.copy(this).projectOnVector(e),this.sub(Hi)},n.prototype.reflect=function(e){return this.sub(Hi.copy(e).multiplyScalar(2*this.dot(e)))},n.prototype.angleTo=function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var r=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,r)))},n.prototype.distanceTo=function(e){return Math.sqrt(this.distanceToSquared(e))},n.prototype.distanceToSquared=function(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i},n.prototype.manhattanDistanceTo=function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},n.prototype.setFromMatrixPosition=function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},n.prototype.setFromMatrixScale=function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this},n.prototype.setFromMatrixColumn=function(e,t){return this.fromArray(e.elements,t*4)},n.prototype.setFromMatrix3Column=function(e,t){return this.fromArray(e.elements,t*3)},n.prototype.equals=function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},n.prototype.fromArray=function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},n.prototype.toArray=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},n.prototype.randomDirection=function(){var e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this},n.prototype[Symbol.iterator]=function(){return yd(this,function(e){switch(e.label){case 0:return[4,this.x];case 1:return e.sent(),[4,this.y];case 2:return e.sent(),[4,this.z];case 3:return e.sent(),[2]}})},n.ORIGIN=Object.freeze(new n(0,0,0)),n.X_AXIS=Object.freeze(new n(1,0,0)),n.NEGATIVE_X_AXIS=Object.freeze(new n(-1,0,0)),n.Y_AXIS=Object.freeze(new n(0,1,0)),n.NEGATIVE_Y_AXIS=Object.freeze(new n(0,-1,0)),n.Z_AXIS=Object.freeze(new n(0,0,1)),n.NEGATIVE_Z_AXIS=Object.freeze(new n(0,0,-1)),n}(),Hi=new x,Ho=new Sn,D=function(){function n(e,t,r,i,s,o,a,l,c,h,d,p,g,f,m,y){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&r!=null&&i!=null&&s!=null&&o!=null&&a!=null&&l!=null&&c!=null&&h!=null&&d!=null&&p!=null&&g!=null&&f!=null&&m!=null&&y!=null&&this.set(e,t,r,i,s,o,a,l,c,h,d,p,g,f,m,y)}return n.prototype.set=function(e,t,r,i,s,o,a,l,c,h,d,p,g,f,m,y){var _=this.elements;return _[0]=e,_[4]=t,_[8]=r,_[12]=i,_[1]=s,_[5]=o,_[9]=a,_[13]=l,_[2]=c,_[6]=h,_[10]=d,_[14]=p,_[3]=g,_[7]=f,_[11]=m,_[15]=y,this},n.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.prototype.copy=function(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this},n.prototype.copyPosition=function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},n.prototype.setFromMatrix3=function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this},n.prototype.setFromExtrusionDirection=function(e){if(Yi.equalPoint3d(e,x.Z_AXIS))this.identity();else{var t=new x(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(x.Y_AXIS,e).normalize():t.crossVectors(x.Z_AXIS,e).normalize();var r=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,r.x,r.y,r.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this},n.prototype.extractBasis=function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},n.prototype.makeBasis=function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},n.prototype.extractRotation=function(e){var t=this.elements,r=e.elements,i=1/dn.setFromMatrixColumn(e,0).length(),s=1/dn.setFromMatrixColumn(e,1).length(),o=1/dn.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},n.prototype.makeRotationFromQuaternion=function(e){return this.compose(_d,e,bd)},n.prototype.lookAt=function(e,t,r){var i=this.elements;return Se.subVectors(e,t),Se.lengthSq()===0&&(Se.z=1),Se.normalize(),Lt.crossVectors(r,Se),Lt.lengthSq()===0&&(Math.abs(r.z)===1?Se.x+=1e-4:Se.z+=1e-4,Se.normalize(),Lt.crossVectors(r,Se)),Lt.normalize(),wr.crossVectors(Se,Lt),i[0]=Lt.x,i[4]=wr.x,i[8]=Se.x,i[1]=Lt.y,i[5]=wr.y,i[9]=Se.y,i[2]=Lt.z,i[6]=wr.z,i[10]=Se.z,this},n.prototype.multiply=function(e){return this.multiplyMatrices(this,e)},n.prototype.premultiply=function(e){return this.multiplyMatrices(e,this)},n.prototype.multiplyMatrices=function(e,t){var r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],h=r[1],d=r[5],p=r[9],g=r[13],f=r[2],m=r[6],y=r[10],_=r[14],P=r[3],L=r[7],S=r[11],A=r[15],N=i[0],C=i[4],z=i[8],M=i[12],U=i[1],F=i[5],H=i[9],ne=i[13],me=i[2],He=i[6],ln=i[10],cn=i[14],Rt=i[3],hn=i[7],At=i[11],St=i[15];return s[0]=o*N+a*U+l*me+c*Rt,s[4]=o*C+a*F+l*He+c*hn,s[8]=o*z+a*H+l*ln+c*At,s[12]=o*M+a*ne+l*cn+c*St,s[1]=h*N+d*U+p*me+g*Rt,s[5]=h*C+d*F+p*He+g*hn,s[9]=h*z+d*H+p*ln+g*At,s[13]=h*M+d*ne+p*cn+g*St,s[2]=f*N+m*U+y*me+_*Rt,s[6]=f*C+m*F+y*He+_*hn,s[10]=f*z+m*H+y*ln+_*At,s[14]=f*M+m*ne+y*cn+_*St,s[3]=P*N+L*U+S*me+A*Rt,s[7]=P*C+L*F+S*He+A*hn,s[11]=P*z+L*H+S*ln+A*At,s[15]=P*M+L*ne+S*cn+A*St,this},n.prototype.multiplyScalar=function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},n.prototype.determinant=function(){var e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],h=e[2],d=e[6],p=e[10],g=e[14],f=e[3],m=e[7],y=e[11],_=e[15];return f*(+s*l*d-i*c*d-s*a*p+r*c*p+i*a*g-r*l*g)+m*(+t*l*g-t*c*p+s*o*p-i*o*g+i*c*h-s*l*h)+y*(+t*c*d-t*a*g-s*o*d+r*o*g+s*a*h-r*c*h)+_*(-i*a*h-t*l*d+t*a*p+i*o*d-r*o*p+r*l*h)},n.prototype.transpose=function(){var e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},n.prototype.setPosition=function(e,t,r){var i=this.elements;return e instanceof x?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this},n.prototype.invert=function(){var e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15],P=d*y*c-m*p*c+m*l*g-a*y*g-d*l*_+a*p*_,L=f*p*c-h*y*c-f*l*g+o*y*g+h*l*_-o*p*_,S=h*m*c-f*d*c+f*a*g-o*m*g-h*a*_+o*d*_,A=f*d*l-h*m*l-f*a*p+o*m*p+h*a*y-o*d*y,N=t*P+r*L+i*S+s*A;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var C=1/N;return e[0]=P*C,e[1]=(m*p*s-d*y*s-m*i*g+r*y*g+d*i*_-r*p*_)*C,e[2]=(a*y*s-m*l*s+m*i*c-r*y*c-a*i*_+r*l*_)*C,e[3]=(d*l*s-a*p*s-d*i*c+r*p*c+a*i*g-r*l*g)*C,e[4]=L*C,e[5]=(h*y*s-f*p*s+f*i*g-t*y*g-h*i*_+t*p*_)*C,e[6]=(f*l*s-o*y*s-f*i*c+t*y*c+o*i*_-t*l*_)*C,e[7]=(o*p*s-h*l*s+h*i*c-t*p*c-o*i*g+t*l*g)*C,e[8]=S*C,e[9]=(f*d*s-h*m*s-f*r*g+t*m*g+h*r*_-t*d*_)*C,e[10]=(o*m*s-f*a*s+f*r*c-t*m*c-o*r*_+t*a*_)*C,e[11]=(h*a*s-o*d*s-h*r*c+t*d*c+o*r*g-t*a*g)*C,e[12]=A*C,e[13]=(h*m*i-f*d*i+f*r*p-t*m*p-h*r*y+t*d*y)*C,e[14]=(f*a*i-o*m*i-f*r*l+t*m*l+o*r*y-t*a*y)*C,e[15]=(o*d*i-h*a*i+h*r*l-t*d*l-o*r*p+t*a*p)*C,this},n.prototype.scale=function(e){var t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this},n.prototype.getMaxScaleOnAxis=function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))},n.prototype.makeTranslation=function(e,t,r){return e instanceof x?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},n.prototype.makeRotationX=function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},n.prototype.makeRotationY=function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},n.prototype.makeRotationZ=function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},n.prototype.makeRotationAxis=function(e,t){var r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,h=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,h*a+r,h*l-i*o,0,c*l-i*a,h*l+i*o,s*l*l+r,0,0,0,0,1),this},n.prototype.makeScale=function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},n.prototype.makeShear=function(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this},n.prototype.compose=function(e,t,r){var i=this.elements,s=t.x,o=t.y,a=t.z,l=t.w,c=s+s,h=o+o,d=a+a,p=s*c,g=s*h,f=s*d,m=o*h,y=o*d,_=a*d,P=l*c,L=l*h,S=l*d,A=r.x,N=r.y,C=r.z;return i[0]=(1-(m+_))*A,i[1]=(g+S)*A,i[2]=(f-L)*A,i[3]=0,i[4]=(g-S)*N,i[5]=(1-(p+_))*N,i[6]=(y+P)*N,i[7]=0,i[8]=(f+L)*C,i[9]=(y-P)*C,i[10]=(1-(p+m))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},n.prototype.decompose=function(e,t,r){var i=this.elements,s=dn.set(i[0],i[1],i[2]).length(),o=dn.set(i[4],i[5],i[6]).length(),a=dn.set(i[8],i[9],i[10]).length(),l=this.determinant();l<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Fe.copy(this);var c=1/s,h=1/o,d=1/a;return Fe.elements[0]*=c,Fe.elements[1]*=c,Fe.elements[2]*=c,Fe.elements[4]*=h,Fe.elements[5]*=h,Fe.elements[6]*=h,Fe.elements[8]*=d,Fe.elements[9]*=d,Fe.elements[10]*=d,t.setFromRotationMatrix(Fe),r.x=s,r.y=o,r.z=a,this},n.prototype.equals=function(e){for(var t=this.elements,r=e.elements,i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0},n.prototype.fromArray=function(e,t){t===void 0&&(t=0);for(var r=0;r<16;r++)this.elements[r]=e[r+t];return this},n.prototype.toArray=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},n.IDENTITY=Object.freeze(new n),n}(),dn=new x,Fe=new D,_d=new x(0,0,0),bd=new x(1,1,1),Lt=new x,wr=new x,Se=new x,B=function(){function n(e,t){e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.min=e==null?new x(1/0,1/0,1/0):new x(e.x,e.y,e.z),this.max=t==null?new x(-1/0,-1/0,-1/0):new x(t.x,t.y,t.z)}return n.prototype.set=function(e,t){return this.min.copy(e),this.max.copy(t),this},n.prototype.setFromArray=function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t+=3)this.expandByPoint(Wi.fromArray(e,t));return this},n.prototype.setFromPoints=function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},n.prototype.setFromCenterAndSize=function(e,t){var r=Wi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(e){return this.min.copy(e.min),this.max.copy(e.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},n.prototype.getCenter=function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(e){return this.min.min(e),this.max.max(e),this},n.prototype.expandByVector=function(e){return this.min.sub(e),this.max.add(e),this},n.prototype.expandByScalar=function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},n.prototype.containsPoint=function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},n.prototype.containsBox=function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},n.prototype.getParameter=function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},n.prototype.intersectsBox=function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},n.prototype.intersectsPlane=function(e){var t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant},n.prototype.clampPoint=function(e,t){return t.copy(e).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(e){return this.clampPoint(e,Wi).distanceTo(e)},n.prototype.intersect=function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(e){return this.min.min(e.min),this.max.max(e.max),this},n.prototype.applyMatrix4=function(e){return this.isEmpty()?this:(Ke[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ke[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ke[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ke[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ke[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ke[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ke[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ke[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ke),this)},n.prototype.translate=function(e){return this.min.add(e),this.max.add(e),this},n.prototype.equals=function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},n}(),Ke=[new x,new x,new x,new x,new x,new x,new x,new x],Wi=new x,Wo=new Z,xe=function(){function n(e,t){e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.min=e==null?new Z(1/0,1/0):new Z(e.x,e.y),this.max=t==null?new Z(-1/0,-1/0):new Z(t.x,t.y)}return n.prototype.set=function(e,t){return this.min.copy(e),this.max.copy(t),this},n.prototype.setFromPoints=function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},n.prototype.setFromCenterAndSize=function(e,t){var r=Wo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(e){return this.min.copy(e.min),this.max.copy(e.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},n.prototype.getCenter=function(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new Z(0,0):new Z(0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new Z(0,0):new Z(0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(e){return this.min.min(e),this.max.max(e),this},n.prototype.expandByVector=function(e){return this.min.sub(e),this.max.add(e),this},n.prototype.expandByScalar=function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},n.prototype.containsPoint=function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},n.prototype.containsBox=function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},n.prototype.getParameter=function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},n.prototype.intersectsBox=function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},n.prototype.clampPoint=function(e,t){return t.copy(e).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(e){return this.clampPoint(e,Wo).distanceTo(e)},n.prototype.intersect=function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(e){return this.min.min(e.min),this.max.max(e.max),this},n.prototype.translate=function(e){return this.min.add(e),this.max.add(e),this},n.prototype.equals=function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},n}(),Uo=new x,xd=new x,wd=new mr,Ds=function(){function n(e,t){e===void 0&&(e=new x(1,0,0)),t===void 0&&(t=0),this.normal=e,this.constant=t}return n.prototype.set=function(e,t){return this.normal.copy(e),this.constant=t,this},n.prototype.setComponents=function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},n.prototype.setFromNormalAndCoplanarPoint=function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},n.prototype.setFromCoplanarPoints=function(e,t,r){var i=Uo.subVectors(r,t).cross(xd.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},n.prototype.copy=function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},n.prototype.normalize=function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},n.prototype.negate=function(){return this.constant*=-1,this.normal.negate(),this},n.prototype.distanceToPoint=function(e){return this.normal.dot(e)+this.constant},n.prototype.projectPoint=function(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))},n.prototype.intersectsBox=function(e){return e.intersectsPlane(this)},n.prototype.coplanarPoint=function(e){return e.copy(this.normal).multiplyScalar(-this.constant)},n.prototype.applyMatrix4=function(e,t){var r=t||wd.getNormalMatrix(e),i=this.coplanarPoint(Uo).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this},n.prototype.translate=function(e){return this.constant-=e.dot(this.normal),this},n.prototype.equals=function(e){return e.normal.equals(this.normal)&&e.constant===this.constant},n.prototype.clone=function(){return new n().copy(this)},n}(),vd=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),E=function(n){vd(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.clone=function(){return new e(this.x,this.y)},e.pointArrayToNumberArray=function(t){var r=new Array(t.length*2);return t.forEach(function(i,s){i.toArray(r,s*2)}),r},e}(Z),Pd=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),b=function(n){Pd(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e.pointArrayToNumberArray=function(t,r){r===void 0&&(r=!0);var i=r?3:2,s=new Array(t.length*i);return t.forEach(function(o,a){o.toArray(s,a*i)}),s},e}(x),Ad=function(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},$o=new D,qo=new Sn,Sd=function(){function n(e,t,r,i){e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0),i===void 0&&(i=n.DEFAULT_ORDER),this._x=e,this._y=t,this._z=r,this._order=i}return Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"order",{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(e,t,r,i){return i===void 0&&(i=this._order),this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._order)},n.prototype.copy=function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(e,t,r){t===void 0&&(t=this._order),r===void 0&&(r=!0);var i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],d=i[2],p=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(pt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-pt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,g),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(pt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,g),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-pt(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(pt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,g));break;case"XZY":this._z=Math.asin(-pt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,g),this._y=0);break;default:}return this._order=t,r===!0&&this._onChangeCallback(),this},n.prototype.setFromQuaternion=function(e,t,r){return r===void 0&&(r=!0),$o.makeRotationFromQuaternion(e),this.setFromRotationMatrix($o,t,r)},n.prototype.setFromVector3=function(e,t){return t===void 0&&(t=this._order),this.set(e.x,e.y,e.z,t)},n.prototype.reorder=function(e){return qo.setFromEuler(this),this.setFromQuaternion(qo,e)},n.prototype.equals=function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},n.prototype.fromArray=function(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this},n.prototype.toArray=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},n.prototype._onChange=function(e){return this._onChangeCallback=e,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return Ad(this,function(e){switch(e.label){case 0:return[4,this._x];case 1:return e.sent(),[4,this._y];case 2:return e.sent(),[4,this._z];case 3:return e.sent(),[4,this._order];case 4:return e.sent(),[2]}})},n.DEFAULT_ORDER="XYZ",n}();function zs(n,e,t){t===void 0&&(t=!1);for(var r=n.x,i=n.y,s=!1,o=e.length,a=0,l=o-1;a<o;l=a++){var c=e[a].x,h=e[a].y,d=e[l].x,p=e[l].y,g=h>i!=p>i;t&&(g=h>=i!=p>=i);var f=g&&r<(d-c)*(i-h)/(p-h)+c;f&&(s=!s)}return s}function qa(n,e){if(n.length===0||e.length===0)return!1;var t=new xe().setFromPoints(n),r=new xe().setFromPoints(e);if(!t.intersectsBox(r))return!1;for(var i=0;i<n.length;){if(zs(n[i],e,!0))return!0;i<n.length-1&&Yi.equalPoint2d(n[i+1],n[i])&&++i,++i}return!1}var Ka={isPointInPolygon:zs,isPolygonIntersect:qa},vr=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},Pr=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))};function Ld(n,e){for(var t=[],r=e-1,i=n,s=0;s<=i;s++)t.push(0);for(var s=1;s<=r-i;s++)t.push(s);for(var s=0;s<=i;s++)t.push(r-i+1);return t}function Id(n,e){for(var t=e.length-1,r=n,i=[0],s=0,o=1;o<=t;o++){var a=e[o][0]-e[o-1][0],l=e[o][1]-e[o-1][1],c=e[o][2]-e[o-1][2],h=Math.sqrt(a*a+l*l+c*c);s+=h,i.push(s)}for(var d=[],o=0;o<=r;o++)d.push(0);for(var o=1;o<=t-r;o++){var p=i[o]/s;d.push(p*(t-r+1))}for(var o=0;o<=r;o++)d.push(t-r+1);return d}function Za(n,e){e===void 0&&(e="Uniform");var t=n.length;if(t===0)return[];if(t===1)return[0];var r=t-1;if(e==="Uniform")return new Array(t).fill(0).map(function(p,g){return g/r});for(var i=[0],s=0,o=1;o<=r;o++){var a=n[o][0]-n[o-1][0],l=n[o][1]-n[o-1][1],c=n[o][2]-n[o-1][2],h=Math.sqrt(a*a+l*l+c*c),d=e==="SqrtChord"?Math.sqrt(h):h;s+=d,i.push(s)}return s<1e-12?new Array(t).fill(0).map(function(p,g){return g/r}):i.map(function(p){return p/s})}function Qa(n,e){for(var t=e.length-1,r=n,i=t+r+1,s=new Array(i+1).fill(0),o=e[e.length-1],a=i-r;a<=i;a++)s[a]=o;for(var l=1;l<=t-r;l++){for(var c=0,a=l;a<l+r;a++)c+=e[a];s[l+r]=c/r}return s}function Ed(n,e){for(var t=e.length-1,r=n,i=[0],s=0,o=1;o<=t;o++){var a=e[o][0]-e[o-1][0],l=e[o][1]-e[o-1][1],c=e[o][2]-e[o-1][2],h=Math.sqrt(a*a+l*l+c*c),d=Math.sqrt(h);s+=d,i.push(s)}for(var p=[],o=0;o<=r;o++)p.push(0);for(var o=1;o<=t-r;o++){var g=i[o]/s;p.push(g*(t-r+1))}for(var o=0;o<=r;o++)p.push(t-r+1);return p}function Ui(n,e){for(var t=n.length,r=n.map(function(y){return y.slice()}),i=e.slice(),s=0;s<t;s++){for(var o=s,a=Math.abs(r[s][s]),l=s+1;l<t;l++){var c=Math.abs(r[l][s]);c>a&&(a=c,o=l)}if(a<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==s){var h=r[s];r[s]=r[o],r[o]=h;var d=i[s];i[s]=i[o],i[o]=d}for(var l=s+1;l<t;l++){var p=r[l][s]/r[s][s];if(!(Math.abs(p)<1e-14)){for(var g=s;g<t;g++)r[l][g]-=p*r[s][g];i[l]-=p*i[s]}}}for(var f=new Array(t).fill(0),l=t-1;l>=0;l--){for(var m=i[l],g=l+1;g<t;g++)m-=r[l][g]*f[g];f[l]=m/r[l][l]}return f}function Vs(n,e,t,r,i){var s,o,a,l,c,h;if(t===void 0&&(t="Uniform"),n.length===0)return{controlPoints:[],knots:[],weights:[]};var d=n.map(function(At){var St;return[At[0],At[1],(St=At[2])!==null&&St!==void 0?St:0]}),p=!!r,g=!!i,f=(p?1:0)+(g?1:0),m=d.length-1,y=m+f;if(y<e)throw new Error("Not enough points to interpolate a curve of this degree.");var _=Za(d,t),P=_.slice();p&&P.unshift(_[0]),g&&P.push(_[_.length-1]);var L=Qa(e,P),S=y+1,A=new Array(S),N=new Array(S),C=new Array(S),z=new Array(S),M=0;A[M]=new Array(S).fill(0),A[M][0]=1,N[M]=d[0][0],C[M]=d[0][1],z[M]=d[0][2],M++;for(var U=1;U<=m-1;U++){var F=_[U];A[M]=new Array(S).fill(0);for(var H=0;H<=y;H++)A[M][H]=kt(H,e,F,L);N[M]=d[U][0],C[M]=d[U][1],z[M]=d[U][2],M++}if(A[M]=new Array(S).fill(0),A[M][y]=1,N[M]=d[m][0],C[M]=d[m][1],z[M]=d[m][2],M++,p){var ne=L[e+1]-L[0],me=ne!==0?e/ne:0;A[M]=new Array(S).fill(0),A[M][0]=-me,A[M][1]=me,N[M]=(s=r==null?void 0:r[0])!==null&&s!==void 0?s:0,C[M]=(o=r==null?void 0:r[1])!==null&&o!==void 0?o:0,z[M]=(a=r==null?void 0:r[2])!==null&&a!==void 0?a:0,M++}if(g){var ne=L[y+e+1]-L[y],me=ne!==0?e/ne:0;A[M]=new Array(S).fill(0),A[M][y-1]=-me,A[M][y]=me,N[M]=(l=i==null?void 0:i[0])!==null&&l!==void 0?l:0,C[M]=(c=i==null?void 0:i[1])!==null&&c!==void 0?c:0,z[M]=(h=i==null?void 0:i[2])!==null&&h!==void 0?h:0,M++}for(var He=Ui(A,N),ln=Ui(A,C),cn=Ui(A,z),Rt=new Array(S),U=0;U<S;U++)Rt[U]=[He[U],ln[U],cn[U]];var hn=new Array(S).fill(1);return{controlPoints:Rt,knots:L,weights:hn}}function kt(n,e,t,r){if(e===0)return t>=r[n]&&t<r[n+1]?1:0;var i=r[n+e]-r[n],s=r[n+e+1]-r[n+1],o=i>1e-10?(t-r[n])/i:0,a=s>1e-10?(r[n+e+1]-t)/s:0;return o*kt(n,e-1,t,r)+a*kt(n+1,e-1,t,r)}function Qn(n,e,t,r,i){var s=r.length-1,o=e;if(n=Math.max(t[o],Math.min(t[s+1],n)),Math.abs(n-t[s+1])<1e-8)return Pr([],vr(r[s]),!1);if(Math.abs(n-t[o])<1e-8)return Pr([],vr(r[0]),!1);for(var a=[0,0,0],l=0,c=0;c<=s;c++){var h=kt(c,o,n,t),d=i[c]*h;a[0]+=r[c][0]*d,a[1]+=r[c][1]*d,a[2]+=r[c][2]*d,l+=d}if(Math.abs(l)<1e-10){var p=t[t.length-o-1];if(Math.abs(n-p)<1e-8)return Pr([],vr(r[s]),!1);if(Math.abs(n-t[o])<1e-8)return Pr([],vr(r[0]),!1)}return Math.abs(l)>=1e-10&&(a[0]/=l,a[1]/=l,a[2]/=l),a}function ds(n,e,t,r){if(e===0)return 0;var i=r[n+e]-r[n],s=r[n+e+1]-r[n+1],o=0;return i>1e-10&&(o+=e/i*kt(n,e-1,t,r)),s>1e-10&&(o-=e/s*kt(n+1,e-1,t,r)),o}function Td(n,e,t,r){if(e<=1)return 0;var i=r[n+e]-r[n],s=r[n+e+1]-r[n+1],o=0;return i>1e-10&&(o+=e/i*ds(n,e-1,t,r)),s>1e-10&&(o-=e/s*ds(n+1,e-1,t,r)),o}function Cd(n,e,t,r,i){var s=r.length-1,o=e,a=t[o],l=t[s+1];n=Math.max(a,Math.min(l,n));for(var c=[0,0,0],h=[0,0,0],d=[0,0,0],p=0,g=0,f=0,m=0;m<=s;m++){var y=kt(m,o,n,t),_=ds(m,o,n,t),P=Td(m,o,n,t),L=i[m],S=L*y,A=L*_,N=L*P,C=r[m];c[0]+=S*C[0],c[1]+=S*C[1],c[2]+=S*C[2],h[0]+=A*C[0],h[1]+=A*C[1],h[2]+=A*C[2],d[0]+=N*C[0],d[1]+=N*C[1],d[2]+=N*C[2],p+=S,g+=A,f+=N}if(Math.abs(p)<1e-10){var z=Qn(n,e,t,r,i);return{point:z,deriv1:[0,0,0],deriv2:[0,0,0]}}var M=p*p,U=[c[0]/p,c[1]/p,c[2]/p],F=[(h[0]*p-c[0]*g)/M,(h[1]*p-c[1]*g)/M,(h[2]*p-c[2]*g)/M],H=d[0]*p-c[0]*f,ne=d[1]*p-c[1]*f,me=d[2]*p-c[2]*f,He=[H/M-2*g*F[0]/p,ne/M-2*g*F[1]/p,me/M-2*g*F[2]/p];return{point:U,deriv1:F,deriv2:He}}function Md(n,e){var t=n[0],r=n[1],i=e[0],s=e[1],o=t*t+r*r;return o<1e-20?0:(t*s-r*i)/Math.pow(o,1.5)}function Ja(n,e,t,r){for(var i=n,s=e[i],o=e[e.length-i-1],a=0,l=1e3,c=(o-s)/l,h=Qn(s,n,e,t,r),d=1;d<=l;d++){var p=s+d*c,g=Qn(p,n,e,t,r),f=g[0]-h[0],m=g[1]-h[1],y=g[2]-h[2];a+=Math.sqrt(f*f+m*m+y*y),h=g}var _=Qn(o,n,e,t,r),P=_[0]-h[0],L=_[1]-h[1],S=_[2]-h[2];return a+=Math.sqrt(P*P+L*L+S*S),a}function Od(n,e,t,r,i){return e===void 0&&(e=3),t===void 0&&(t="Uniform"),n.length===0?[]:Vs(n,e,t,r,i).controlPoints}var Ko=new D,Zo=new x,kd=new x,Nd=new x,$i=new b;function el(n){return new D().setFromExtrusionDirection(new x(n.x,n.y,n.z))}function js(n){return Ko.setFromExtrusionDirection(new x(n.x,n.y,n.z)),Ko.extractBasis(Zo,kd,Nd),Zo.clone()}function us(n,e){var t;return new b(n.x,n.y,(t=n.z)!==null&&t!==void 0?t:0).applyMatrix4(el(e))}function sr(n,e){var t;return new b(n.x,n.y,(t=n.z)!==null&&t!==void 0?t:0).applyMatrix4(el(e).invert())}function gs(n,e,t){var r,i,s=sr(n,t),o=sr(e,t);return $i.set(o.x-s.x,o.y-s.y,((r=o.z)!==null&&r!==void 0?r:0)-((i=s.z)!==null&&i!==void 0?i:0)),T.normalizeAngle(Math.atan2($i.y,$i.x))}var tl=function(){function n(){this._boundingBoxNeedsUpdate=!1}return Object.defineProperty(n.prototype,"boundingBoxNeedUpdate",{get:function(){return this._boundingBoxNeedsUpdate},enumerable:!1,configurable:!0}),n}(),Yd=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Gs=function(n){Yd(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.translate=function(t){return this.transform(new mr().makeTranslation(t.x,t.y))},Object.defineProperty(e.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),e}(tl),Xd=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),En=function(n){Xd(e,n);function e(){var t=n.call(this)||this;return t.arcLengthDivisions=100,t}return Object.defineProperty(e.prototype,"startPoint",{get:function(){return this.getPoint(0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.getPoint(1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.getLength()},enumerable:!1,configurable:!0}),e.prototype.getPoint=function(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")},e.prototype.getPointAt=function(t){var r=this.getUtoTmapping(t);return this.getPoint(r)},e.prototype.getPoints=function(t){t===void 0&&(t=5);for(var r=[],i=0;i<=t;i++)r.push(this.getPoint(i/t));return r},e.prototype.getSpacedPoints=function(t){t===void 0&&(t=5);for(var r=[],i=0;i<=t;i++)r.push(this.getPointAt(i/t));return r},e.prototype.getLength=function(){var t=this.getLengths();return t[t.length-1]},e.prototype.getLengths=function(t){t===void 0&&(t=this.arcLengthDivisions);var r=[],i,s=this.getPoint(0),o=0;r.push(0);for(var a=1;a<=t;a++)i=this.getPoint(a/t),o+=i.distanceTo(s),r.push(o),s=i;return r},e.prototype.getUtoTmapping=function(t,r){var i=this.getLengths(),s=0,o=i.length,a;r?a=r:a=t*i[o-1];for(var l=0,c=o-1,h;l<=c;)if(s=Math.floor(l+(c-l)/2),h=i[s]-a,h<0)l=s+1;else if(h>0)c=s-1;else{c=s;break}if(s=c,i[s]===a)return s/(o-1);var d=i[s],p=i[s+1],g=p-d,f=(a-d)/g,m=(s+f)/(o-1);return m},e.prototype.getTangent=function(t){var r=1e-4,i=t-r,s=t+r;i<0&&(i=0),s>1&&(s=1);var o=this.getPoint(i),a=this.getPoint(s),l=new E;return l.copy(a).sub(o).normalize(),l},e.prototype.getTangentAt=function(t){var r=this.getUtoTmapping(t);return this.getTangent(r)},e}(Gs),Rd=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ar=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Sr=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},Lr=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},Re=function(n){Rd(e,n);function e(t,r,i,s,o){var a=n.call(this)||this,l=+(t!==void 0)+ +(r!==void 0)+ +(i!==void 0)+ +(s!==void 0)+ +(o!==void 0);if(l==3)typeof t=="object"&&typeof r=="object"&&typeof i=="object"?a.createByThreePoints(t,r,i):a.createByStartEndPointsAndBulge(t,r,i);else if(l==5){var c=t;a.center=new E(c.x,c.y),a.radius=r,a._clockwise=o,a._startAngle=a._clockwise?a._mirrorAngle(T.normalizeAngle(i)):T.normalizeAngle(i),a._endAngle=a._clockwise?a._mirrorAngle(T.normalizeAngle(s)):T.normalizeAngle(s)}else throw Pe.ILLEGAL_PARAMETERS;return a}return e.prototype.createByThreePoints=function(t,r,i){var s=function(z,M){return{x:(z.x+M.x)/2,y:(z.y+M.y)/2}},o=function(z,M){return(M.y-z.y)/(M.x-z.x)},a=function(z){return-1/z},l=s(t,r),c=s(r,i),h=o(t,r),d=o(r,i),p=a(h),g=a(d),f=function(z,M,U,F){var H=(F-M)/(z-U),ne=z*H+M;return{x:H,y:ne}},m=l.y-p*l.x,y=c.y-g*c.x,_=f(p,m,g,y),P=Math.sqrt(Math.pow(t.x-_.x,2)+Math.pow(t.y-_.y,2)),L=function(z,M){return Math.atan2(z.y-M.y,z.x-M.x)},S=L(t,_),A=L(r,_),N=L(i,_),C=N>S&&N<A||S>N&&S<A||A>N&&A<S;this.center=_,this.radius=P,this._clockwise=!C,this._startAngle=S,this._endAngle=N},e.prototype.createByStartEndPointsAndBulge=function(t,r,i){var s,o,a;i<0?(s=Math.atan(-i)*4,o=new Z(t),a=new Z(r)):(s=Math.atan(i)*4,o=new Z(r),a=new Z(t));var l=new Z().subVectors(a,o),c=l.length(),h=new Z().addVectors(o,l.multiplyScalar(.5)),d=Math.abs(c/2/Math.tan(s/2)),p=l.normalize(),g=i<0?-Math.PI/2:Math.PI/2,f=new Z(p.x*Math.cos(g)-p.y*Math.sin(g),p.y*Math.cos(g)+p.x*Math.sin(g)),m;s<Math.PI?i<0?m=h.add(f.multiplyScalar(d)):m=h.add(f.multiplyScalar(-d)):i<0?m=h.add(f.multiplyScalar(-d)):m=h.add(f.multiplyScalar(d)),i<0?(this._startAngle=Math.atan2(o.y-m.y,o.x-m.x),this._endAngle=Math.atan2(a.y-m.y,a.x-m.x)):(this._startAngle=Math.atan2(a.y-m.y,a.x-m.x),this._endAngle=Math.atan2(o.y-m.y,o.x-m.x)),this._clockwise=i<0,this.center=m,this.radius=a.sub(m).length()},Object.defineProperty(e.prototype,"center",{get:function(){return this._center},set:function(t){this._center=new E(t.x,t.y),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle},set:function(t){this._startAngle=this._clockwise?this._mirrorAngle(T.normalizeAngle(t)):T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle},set:function(t){var r=this.startAngle==0&&t==G?t:T.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(r):r,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),e.prototype._mirrorAngle=function(t){var r=t*180/Math.PI,i=(360-r)%360;return i*Math.PI/180},e.prototype._getInternalAngle=function(t){return this._clockwise?this._mirrorAngle(t):t},Object.defineProperty(e.prototype,"deltaAngle",{get:function(){var t=this._getInternalAngle(this.startAngle),r=this._getInternalAngle(this.endAngle);return this.clockwise?T.normalizeAngle(t-r):T.normalizeAngle(r-t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwise",{get:function(){return this._clockwise},set:function(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this.endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midPoint",{get:function(){var t=this._getInternalAngle(this.startAngle),r=this._clockwise?T.normalizeAngle(t-this.deltaAngle/2):T.normalizeAngle(t+this.deltaAngle/2),i=this._clockwise?this._mirrorAngle(r):r;return this.getPointAtAngle(i)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){var t=this._getInternalAngle(this.startAngle),r=this._getInternalAngle(this.endAngle);return Math.abs(r-t)/Math.PI%2==0},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t,r,i=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var o=Ar(s),a=o.next();!a.done;a=o.next()){var l=a.value,c=this._getInternalAngle(l);T.isBetweenAngle(c,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&i.push(this.getPointAtAngle(l))}}catch(p){t={error:p}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}var h=i.map(function(p){return p.x}),d=i.map(function(p){return p.y});return new xe(new E(Math.min.apply(Math,Lr([],Sr(h),!1)),Math.min.apply(Math,Lr([],Sr(d),!1))),new E(Math.max.apply(Math,Lr([],Sr(h),!1)),Math.max.apply(Math,Lr([],Sr(d),!1))))},Object.defineProperty(e.prototype,"length",{get:function(){return Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),e.prototype.transform=function(t){var r=this,i=t,s=this.center.clone().applyMatrix2d(i),o=this.startPoint.clone().applyMatrix2d(i);if(this.closed)return this.center=s,this.radius=s.distanceTo(o),this._startAngle=Math.atan2(o.y-s.y,o.x-s.x),this._endAngle=this._startAngle,this._clockwise=i.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;var a=this.midPoint.clone().applyMatrix2d(i),l=this.endPoint.clone().applyMatrix2d(i),c=new e(o,a,l),h=i.determinant()<0?!this.clockwise:this.clockwise,d=function(p){var g=T.normalizeAngle(p);return h?r._mirrorAngle(g):g};return this.center=c.center,this.radius=c.radius,this.clockwise=h,this.startAngle=d(Math.atan2(o.y-c.center.y,o.x-c.center.x)),this.endAngle=d(Math.atan2(l.y-c.center.y,l.x-c.center.x)),this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)},e.prototype.getPointAtAngle=function(t){var r=this._getInternalAngle(t),i=this.center.x+this.radius*Math.cos(r),s=this.center.y+this.radius*Math.sin(r);return new E(i,s)},e.prototype.getQuadrantPoints=function(){var t,r,i=[],s=this._getInternalAngle(this.startAngle),o=this._getInternalAngle(this.endAngle),a=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var l=Ar(a),c=l.next();!c.done;c=l.next()){var h=c.value,d=this._getInternalAngle(h);T.isBetweenAngle(d,s,o,this.clockwise)&&i.push(this.getPointAtAngle(h))}}catch(p){t={error:p}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return i},e.prototype.nearestPoint=function(t){var r=new E(t.x,t.y),i=r.x-this.center.x,s=r.y-this.center.y,o=Math.hypot(i,s);if(o<1e-12)return this.startPoint.clone();var a=Math.atan2(s,i),l=this.clockwise?this._mirrorAngle(T.normalizeAngle(a)):T.normalizeAngle(a),c=this._getInternalAngle(l),h=this._getInternalAngle(this.startAngle),d=this._getInternalAngle(this.endAngle);if(T.isBetweenAngle(c,h,d,this.clockwise))return this.getPointAtAngle(l);var p=r.distanceToSquared(this.startPoint),g=r.distanceToSquared(this.endPoint);return p<=g?this.startPoint.clone():this.endPoint.clone()},e.prototype.perpendicularPoints=function(t){var r,i,s=new E(t.x,t.y),o=s.x-this.center.x,a=s.y-this.center.y,l=Math.hypot(o,a);if(l<1e-12)return[];var c=o/l,h=a/l,d=[new E(this.center.x+c*this.radius,this.center.y+h*this.radius),new E(this.center.x-c*this.radius,this.center.y-h*this.radius)],p=[],g=this._getInternalAngle(this.startAngle),f=this._getInternalAngle(this.endAngle);try{for(var m=Ar(d),y=m.next();!y.done;y=m.next()){var _=y.value,P=Math.atan2(_.y-this.center.y,_.x-this.center.x),L=this.clockwise?this._mirrorAngle(T.normalizeAngle(P)):T.normalizeAngle(P),S=this._getInternalAngle(L);(this.closed||T.isBetweenAngle(S,g,f,this.clockwise))&&p.push(_)}}catch(A){r={error:A}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}return p},e.prototype.tangentPoints=function(t){var r,i,s=[],o=t.x-this.center.x,a=t.y-this.center.y,l=Math.hypot(o,a),c=this.radius;if(l<c)return s;var h=Math.acos(c/l),d=Math.atan2(a,o),p=[d+h,d-h],g=this._getInternalAngle(this.startAngle),f=this._getInternalAngle(this.endAngle);try{for(var m=Ar(p),y=m.next();!y.done;y=m.next()){var _=y.value,P=this.clockwise?this._mirrorAngle(T.normalizeAngle(_)):T.normalizeAngle(_),L=this._getInternalAngle(P);(this.closed||T.isBetweenAngle(L,g,f,this.clockwise))&&s.push(this.getPointAtAngle(P))}}catch(S){r={error:S}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}return s},e.prototype.getPoints=function(t){t===void 0&&(t=100);var r=[],i=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(i=G,s=0),this.clockwise)for(var o=0;o<=t;o++){var a=s-i*(o/t),l=this._clockwise?this._mirrorAngle(a):a,c=this.getPointAtAngle(l);r.push(new E(c.x,c.y))}else for(var o=0;o<=t;o++){var a=s+i*(o/t),l=this._clockwise?this._mirrorAngle(a):a,c=this.getPointAtAngle(l);r.push(new E(c.x,c.y))}return r},e}(En),ps=function(){return ps=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},ps.apply(this,arguments)},Bd=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ir=1e-6;function nl(n,e){if(ou(n)){var t=Dd(n,e);return t?[t]:[]}var r=ol(n),i=r.numberOfVertices;if(i<2)return[];var s=lu(r,e);return s?[s]:[]}function Fd(n){return ol(n)}function Dd(n,e){var t,r,i=zd(n);if(i.length===0)return null;var s=[];try{for(var o=Bd(i),a=o.next();!a.done;a=o.next()){var l=a.value,c=jd(l,e);if(!c)return null;s.push(c)}}catch(g){t={error:g}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}var h=Vd(n),d=Ud(s,h,n.closed,e);if(d.length<2)return null;var p=new ee;return d.forEach(function(g,f){p.addVertexAt(f,{x:g.x,y:g.y})}),p.closed=n.closed,p}function zd(n){for(var e,t=[],r=n.numberOfVertices,i=n.closed?r:r-1,s=0;s<i;s++){var o=n.vertices[s],a=n.vertices[(s+1)%r];q.isPositive(Math.abs((e=o.bulge)!==null&&e!==void 0?e:0))?t.push({kind:"arc",arc:new Re(o,a,o.bulge)}):t.push({kind:"line",start:new E(o.x,o.y),end:new E(a.x,a.y)})}return t}function Vd(n){for(var e=[],t=0;t<n.numberOfVertices;t++)e.push(n.getPointAt(t));return e}function jd(n,e){if(n.kind==="line"){var t=Wd(n.start,n.end,e);return t?ps({kind:"line"},t):null}var r=Gd(n.arc,n.arc.startPoint,n.arc.endPoint,e);return r?{kind:"arc",arc:r}:null}function Gd(n,e,t,r){var i=Hd(n,e,t,r),s=n.radius+i;return q.isNonPositive(s)?null:new Re(n.center,s,n.startAngle,n.endAngle,n.clockwise)}function Hd(n,e,t,r){var i=t.x-e.x,s=t.y-e.y,o=Math.hypot(i,s);if(q.isNonPositive(o))return n.clockwise?-r:r;var a=-s/o,l=i/o,c=n.center.x-(e.x+t.x)/2,h=n.center.y-(e.y+t.y)/2,d=c*a+h*l>0;return d?-r:r}function Wd(n,e,t){var r=e.x-n.x,i=e.y-n.y,s=Math.hypot(r,i);if(q.isNonPositive(s))return null;var o=-i/s*t,a=r/s*t;return{start:new E(n.x+o,n.y+a),end:new E(e.x+o,e.y+a),dx:r,dy:i}}function Ud(n,e,t,r){var i,s,o,a=n.length;if(a===0)return[];for(var l=$d(n,e,t,r),c=[(s=(i=l[0].nextSegmentStart)===null||i===void 0?void 0:i.clone())!==null&&s!==void 0?s:l[0].point.clone()],h=0;h<a;h++){var d=n[h],p=h===a-1&&!t?{point:Jd(d)}:l[(h+1)%a];if(h>0&&l[h].filletPoints&&l[h].filletPoints.forEach(function(_){return c.push(_.clone())}),d.kind==="arc")for(var g=(o=l[h].nextSegmentStart)!==null&&o!==void 0?o:l[h].point,f=p.point,m=qd(d.arc,g,f,Math.max(16,32)),y=1;y<m.length;y++)c.push(m[y]);else c.push(p.point.clone())}return al(c)}function $d(n,e,t,r){for(var i=n.length,s=[],o=0;o<i;o++)o===0?s.push(t?Qo(n[i-1],n[0],e[0],r):{point:Qd(n[0])}):s.push(Qo(n[o-1],n[o],e[o],r));return s}function qd(n,e,t,r){for(var i=n.nearestPoint(e),s=n.nearestPoint(t),o=fs(n,i),a=fs(n,s),l=Zd(n,o,a),c=[],h=0;h<=r;h++){var d=h/r,p=n.clockwise?o-l*d:o+l*d;c.push(n.getPointAtAngle(Kd(n,p)))}return c}function fs(n,e){return Math.atan2(e.y-n.center.y,e.x-n.center.x)}function Kd(n,e){var t=T.normalizeAngle(e);return n.clockwise?ms(t):t}function ms(n){var e=n*180/Math.PI;return(360-e)%360*(Math.PI/180)}function Zd(n,e,t){if(n.clockwise){var r=e-t;return q.isNonPositive(r)&&(r+=G),r}var i=t-e;return q.isNonPositive(i)&&(i+=G),i}function Qd(n){return n.kind==="line"?n.start.clone():n.arc.startPoint.clone()}function Jd(n){return n.kind==="line"?n.end.clone():n.arc.endPoint.clone()}function Qo(n,e,t,r){return n.kind==="line"&&e.kind==="line"?{point:ys({start:n.start,end:n.end,dx:n.dx,dy:n.dy},{start:e.start,end:e.end,dx:e.dx,dy:e.dy})}:n.kind==="line"&&e.kind==="arc"?Jo(n,e.arc,t,r,!0):n.kind==="arc"&&e.kind==="line"?Jo(e,n.arc,t,r,!1):n.kind==="arc"&&e.kind==="arc"?eu(n.arc,e.arc,t,r):{point:t.clone()}}function eu(n,e,t,r){var i=sl(n.endPoint,e.startPoint),s=su(n,e),o=s.filter(function(h){return Hr(n,h)&&Hr(e,h)});if(o.length>0)return{point:il(o,i)};var a=n.endPoint.clone(),l=e.startPoint.clone(),c=rl(t,Math.abs(r),a,l);return{point:a,filletPoints:c,nextSegmentStart:l}}function Jo(n,e,t,r,i){var s=sl(i?n.end:n.start,i?e.startPoint:e.endPoint),o=iu(n,e,s);if(nu(n,o)&&Hr(e,o))return{point:o};var a=tu(n,t,r),l=i?e.startPoint.clone():e.endPoint.clone(),c=rl(t,Math.abs(r),i?a:l,i?l:a);return i?{point:a,filletPoints:c,nextSegmentStart:l}:{point:l,filletPoints:c,nextSegmentStart:a}}function tu(n,e,t){var r=Math.hypot(n.dx,n.dy),i=-n.dy/r*t,s=n.dx/r*t;return new E(e.x+i,e.y+s)}function nu(n,e){var t=Math.hypot(n.dx,n.dy);if(q.isNonPositive(t))return!1;var r=n.dx/t,i=n.dy/t,s=e.x-n.start.x,o=e.y-n.start.y,a=Math.abs(s*i-o*r);return q.equalToZero(a)}function rl(n,e,t,r){var i=Math.atan2(t.y-n.y,t.x-n.x),s=Math.atan2(r.y-n.y,r.x-n.x),o=ru(i,s);if(q.equalToZero(Math.abs(o)))return[];for(var a=[],l=Math.max(2,Math.ceil(Math.abs(o)/Math.PI*16)),c=1;c<l;c++){var h=c/l,d=i+o*h;a.push(new E(n.x+e*Math.cos(d),n.y+e*Math.sin(d)))}return a}function ru(n,e){for(var t=e-n;t>Math.PI;)t-=G;for(;t<=-Math.PI;)t+=G;return t}function iu(n,e,t){var r=Math.hypot(n.dx,n.dy);if(q.isNonPositive(r))return t.clone();var i=n.dx/r,s=n.dy/r,o=n.start.x-e.center.x,a=n.start.y-e.center.y,l=2*(o*i+a*s),c=o*o+a*a-e.radius*e.radius,h=l*l-4*c;if(h<0)return t.clone();var d=Math.sqrt(h),p=[(-l-d)/2,(-l+d)/2].map(function(f){return new E(n.start.x+i*f,n.start.y+s*f)}),g=p.filter(function(f){return Hr(e,f)});return il(g.length>0?g:p,t)}function Hr(n,e){var t=Math.abs(Math.hypot(e.x-n.center.x,e.y-n.center.y)-n.radius);if(q.isPositive(t))return!1;var r=fs(n,e),i=n.clockwise?ms(T.normalizeAngle(n.startAngle)):T.normalizeAngle(n.startAngle),s=n.clockwise?ms(T.normalizeAngle(n.endAngle)):T.normalizeAngle(n.endAngle);return T.isBetweenAngle(r,i,s,n.clockwise)}function su(n,e){var t=e.center.x-n.center.x,r=e.center.y-n.center.y,i=Math.hypot(t,r);if(q.isNonPositive(i))return[];var s=n.radius+e.radius,o=Math.abs(n.radius-e.radius);if(i>s+Ir)return[];if(i<o-Ir)return[];var a=(n.radius*n.radius-e.radius*e.radius+i*i)/(2*i),l=n.radius*n.radius-a*a;if(l<-Ir)return[];var c=n.center.x+a*t/i,h=n.center.y+a*r/i;if(l<=Ir)return[new E(c,h)];var d=Math.sqrt(l),p=-r*d/i,g=t*d/i;return[new E(c+p,h+g),new E(c-p,h-g)]}function il(n,e){for(var t=n[0],r=t.distanceToSquared(e),i=1;i<n.length;i++){var s=n[i].distanceToSquared(e);s<r&&(t=n[i],r=s)}return t.clone()}function sl(n,e){return new E((n.x+e.x)/2,(n.y+e.y)/2)}function ou(n){for(var e,t=n.numberOfVertices,r=n.closed?t:t-1,i=0;i<r;i++){var s=n.vertices[i];if(q.isPositive(Math.abs((e=s.bulge)!==null&&e!==void 0?e:0)))return!0}return!1}function ol(n){var e=au(n.vertices.map(function(t){return new E(t.x,t.y)}),n.closed);return e.length===n.numberOfVertices?n:new ee(e.map(function(t){return{x:t.x,y:t.y}}),n.closed)}function au(n,e){var t=al(n);if(!e||t.length<2)return t;var r=t[0],i=t[t.length-1];return q.isNonPositive(Math.hypot(r.x-i.x,r.y-i.y))&&t.pop(),t}function al(n){var e=[];return n.forEach(function(t){var r=e[e.length-1];(!r||q.isPositive(Math.hypot(r.x-t.x,r.y-t.y)))&&e.push(new E(t.x,t.y))}),e}function lu(n,e){for(var t=[],r=0;r<n.numberOfVertices;r++)t.push(n.getPointAt(r));var i=cu(t,n.closed,e);if(i.length===0)return null;var s=[];if(n.closed){if(i.length<2)return null;for(var o=i.length,r=0;r<o;r++){var a=i[(r-1+o)%o],l=i[r];s.push(ys(a,l))}}else{s.push(i[0].start);for(var r=1;r<i.length;r++)s.push(ys(i[r-1],i[r]));s.push(i[i.length-1].end)}var c=new ee;return s.forEach(function(h,d){c.addVertexAt(d,{x:h.x,y:h.y})}),c.closed=n.closed,c}function cu(n,e,t){for(var r=[],i=e?n.length:n.length-1,s=0;s<i;s++){var o=n[s],a=n[e?(s+1)%n.length:s+1],l=a.x-o.x,c=a.y-o.y,h=Math.hypot(l,c);if(!q.isNonPositive(h)){var d=-c/h*t,p=l/h*t;r.push({start:new E(o.x+d,o.y+p),end:new E(a.x+d,a.y+p),dx:l,dy:c})}}return r}function ys(n,e){var t=n.dx*e.dy-n.dy*e.dx;if(q.equalToZero(t))return new E((n.end.x+e.start.x)/2,(n.end.y+e.start.y)/2);var r=e.start.x-n.start.x,i=e.start.y-n.start.y,s=(r*e.dy-i*e.dx)/t;return new E(n.start.x+s*n.dx,n.start.y+s*n.dy)}var hu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),_s=function(){return _s=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},_s.apply(this,arguments)},ee=function(n){hu(e,n);function e(t,r){t===void 0&&(t=null),r===void 0&&(r=!1);var i=n.call(this)||this;return i._vertices=t||new Array,i._closed=r,i}return Object.defineProperty(e.prototype,"vertices",{get:function(){return this._vertices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numberOfVertices",{get:function(){return this._vertices.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},set:function(t){this._closed=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){if(this.numberOfVertices>0){var t=this._vertices[0];return new E(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){var t=this.numberOfVertices;if(t>0)if(this.closed){var r=this._vertices[0];return new E(r.x,r.y)}else{var r=this._vertices[t-1];return new E(r.x,r.y)}throw new Error("End point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){for(var t=0,r=this._vertices.length,i=0;i<r;++i){var s=this._vertices[i],o=null;if(i<r-1?o=this._vertices[i+1]:i==r-1&&this.closed&&(o=this._vertices[0]),o)if(s.bulge){var a=new Re(s,o,s.bulge);t+=a.length}else t+=new E(s.x,s.y).distanceTo(o)}return t},enumerable:!1,configurable:!0}),e.prototype.addVertexAt=function(t,r){t<=0?this._vertices.unshift(r):this._vertices.splice(t,0,r),this._boundingBoxNeedsUpdate=!0},e.prototype.removeVertexAt=function(t){if(t<0||t>=this._vertices.length)throw new Error("Index ".concat(t," is out of bounds. Valid range is 0 to ").concat(this._vertices.length-1,"."));this._vertices.splice(t,1),this._boundingBoxNeedsUpdate=!0},e.prototype.reset=function(t,r){t?r!==void 0&&r>=0&&r<this._vertices.length&&(this._vertices=this._vertices.slice(0,r),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)},e.prototype.getPointAt=function(t){var r=this._vertices[t];return new E(r.x,r.y)},e.prototype.calculateBoundingBox=function(){var t=this.getPoints(100);return new xe().setFromPoints(t)},e.prototype.transform=function(t){var r=t.determinant()<0;return this._vertices.forEach(function(i){var s=new E(i).applyMatrix2d(t);i.x=s.x,i.y=s.y,r&&i.bulge!=null&&(i.bulge=-i.bulge)}),this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this._vertices.map(function(t){return _s({},t)}),this._closed)},e.prototype.getPoints3d=function(t,r){var i=[],s=this.getPoints(t);return s.forEach(function(o){return i.push(new b().set(o.x,o.y,r))}),i},e.prototype.getPoints=function(t){for(var r=[],i=this._vertices.length,s=0;s<i;++s){var o=this._vertices[s];if(o.bulge){var a=null;if(s<i-1?a=this._vertices[s+1]:s==i-1&&this.closed&&(a=this._vertices[0]),a)for(var l=new Re(o,a,o.bulge),c=l.getPoints(t),h=c.length,d=0;d<h;++d){var p=c[d];r.push(new E(p.x,p.y))}}else r.push(new E(o.x,o.y)),s==i-1&&this.closed&&r.push(r[0])}return r},e.prototype.offset=function(t){return nl(this,t)},e}(En);function ll(n,e,t){var r=Math.hypot(e.x,e.y);if(q.isNonPositive(r))return null;var i=-e.y/r*t,s=e.x/r*t;return new b(n.x+i,n.y+s,n.z)}function du(n,e,t){var r;if(n.length<2)return null;var i=Fd(new ee(n.map(function(o){return{x:o.x,y:o.y}}),e)),s=nl(i,t);return(r=s[0])!==null&&r!==void 0?r:null}var Wr=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},vn=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))};function uu(n,e,t,r){if(n.length<2||q.equalToZero(t))return null;var i=hl(n,r),s=i.points,o=i.tangents;if(s.length<2)return null;var a=o??gu(s,e),l=pu(s,a,t),c=e?mu(l):fu(l);if(c.length<2)return null;var h=new ee;return c.forEach(function(d,p){h.addVertexAt(p,{x:d.x,y:d.y})}),h.closed=e,h}function gu(n,e){for(var t=n.length,r=new Array(t),i=0;i<t;i++){var s=0,o=0;if(e){var a=n[(i-1+t)%t],l=n[(i+1)%t];s=l.x-a.x,o=l.y-a.y}else i===0?(s=n[1].x-n[0].x,o=n[1].y-n[0].y):i===t-1?(s=n[t-1].x-n[t-2].x,o=n[t-1].y-n[t-2].y):(s=n[i+1].x-n[i-1].x,o=n[i+1].y-n[i-1].y);var c=Math.hypot(s,o);q.isNonPositive(c)?r[i]=new E(1,0):r[i]=new E(s/c,o/c)}return r}function pu(n,e,t){return n.map(function(r,i){var s=e[i],o=-s.y*t,a=s.x*t;return new E(r.x+o,r.y+a)})}function fu(n){var e=Ur(n);if(e.length<3)return e;for(;;){var t=cl(e,!1);if(!t||(e=Ur(vn(vn(vn([],Wr(e.slice(0,t.segmentA+1)),!1),[t.point],!1),Wr(e.slice(t.segmentB+1)),!1)),e.length<2))break}return e}function mu(n){var e=Ur(n);if(e.length<4)return e;for(;;){var t=cl(e,!0);if(!t||(e=Ur(vn(vn(vn([],Wr(e.slice(0,t.segmentA+1)),!1),[t.point],!1),Wr(e.slice(t.segmentB+1)),!1)),e.length<3))break}return e}function cl(n,e){var t=e?n.length:n.length-1;if(t<2)return null;for(var r=0;r<t;r++)for(var i=n[r],s=n[(r+1)%n.length],o=r+1;o<t;o++)if(!yu(r,o,t,e)){var a=n[o],l=n[(o+1)%n.length],c=_u(i,s,a,l);if(c)return{point:c,segmentA:r,segmentB:o}}return null}function yu(n,e,t,r){return!!(e===n||e===n+1||r&&n===0&&e===t-1)}function _u(n,e,t,r){var i=e.x-n.x,s=e.y-n.y,o=r.x-t.x,a=r.y-t.y,l=i*a-s*o;if(q.equalToZero(l))return null;var c=t.x-n.x,h=t.y-n.y,d=(c*a-h*o)/l,p=(c*s-h*i)/l,g=Yi.equalPointTol;return d<-g||d>1+g||p<-g||p>1+g?null:new E(n.x+d*i,n.y+d*s)}function hl(n,e){var t=[],r=[],i=e!=null&&e.length===n.length;return n.forEach(function(s,o){var a=t[t.length-1];if((!a||q.isPositive(Math.hypot(a.x-s.x,a.y-s.y)))&&(t.push(new E(s.x,s.y)),i)){var l=e[o];r.push(new E(l.x,l.y))}}),{points:t,tangents:i?r:void 0}}function Ur(n){return hl(n).points}var bu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Nt=function(n){bu(e,n);function e(){var t=n.call(this)||this;return t._loops=[],t}return e.prototype.add=function(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(e.prototype,"loops",{get:function(){return this._loops},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outter",{get:function(){if(this._loops.length>0)return this._loops[0]},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t=this.outter;return t?t.box:new xe},e.prototype.transform=function(t){return this._loops.forEach(function(r){r.transform(t)}),this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){var t=new e;return this._loops.forEach(function(r){t.add(r.clone())}),t},e.prototype.getPoints=function(t){for(var r=[],i=0;i<this.loops.length;++i){var s=this.loops[i],o=s.getPoints(t);r.push(o)}return r},e.prototype.buildHierarchy=function(){for(var t,r=this.getPoints(100),i=this.calculateBoundaryBoxes(r),s=this.sortBoundaryBoxesByAreas(i),o=new Map,a=s.length,l=0;l<a;l++)o.set(s[l],{index:s[l],children:[]});for(var c={index:-1,children:[]},l=0;l<a;l++){for(var h=s[l],d=r[h],p=i[h],g=l+1;g<a;g++){var f=s[g],m=r[f],y=i[f];if(y.containsBox(p)&&Ka.isPointInPolygon(d[T.randInt(0,d.length-1)],m)){(t=o.get(f))===null||t===void 0||t.children.push(o.get(h));break}}g===a&&c.children.push(o.get(h))}return c},Object.defineProperty(e.prototype,"area",{get:function(){if(this._loops.length===0)return 0;for(var t=0,r=0;r<this._loops.length;r++){var i=this._loops[r],s=i.getPoints(128),o=this.polygonArea(s);r===0?t+=Math.abs(o):t-=Math.abs(o)}return t},enumerable:!1,configurable:!0}),e.prototype.polygonArea=function(t){var r=t.length;if(r<3)return 0;for(var i=0,s=0,o=r-1;s<r;o=s++){var a=t[o],l=t[s];i+=a.x*l.y-l.x*a.y}return i*.5},e.prototype.calculateBoundaryBoxes=function(t){var r=[];return t.forEach(function(i){r.push(new xe().setFromPoints(i))}),r},e.prototype.sortBoundaryBoxesByAreas=function(t){var r=[];t.forEach(function(s,o){var a=s.size,l=a.width*a.height;r.push({area:l,index:o})}),r.sort(function(s,o){return s.area-o.area});var i=[];return r.forEach(function(s){i.push(s.index)}),i},e}(Gs),xu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),wu=function(n){xu(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.translate=function(t){return this.transform(new D().makeTranslation(t.x,t.y,t.z))},Object.defineProperty(e.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),e}(tl),vu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),yr=function(n){vu(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(wu),Pu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),bt=function(n){Pu(e,n);function e(t,r){var i=n.call(this)||this;return i._start=new b(t),i._end=new b(r),i}return Object.defineProperty(e.prototype,"startPoint",{get:function(){return this._start},set:function(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this._end},set:function(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"direction",{get:function(){return new x().subVectors(this.endPoint,this.startPoint).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midPoint",{get:function(){return new b((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)},enumerable:!1,configurable:!0}),e.prototype.nearestPoint=function(t){return this.project(t)},Object.defineProperty(e.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),e.prototype.isPointOnLine=function(t){var r=this.project(t),i=1e-6;return r.distanceTo(t)<i},e.prototype.at=function(t,r){return this.delta(r).multiplyScalar(t).add(this._start)},e.prototype.atLength=function(t,r){if(r===void 0&&(r=!1),r){var i=this.delta(Bt).normalize();return new b(this._start).addScaledVector(i,t)}else{var i=this.delta(Bt).normalize();return new b(this._end).addScaledVector(i,t)}},e.prototype.extend=function(t,r){if(r===void 0&&(r=!1),r){var i=Bt.subVectors(this._start,this._end).normalize();this._start=new b(this._start).addScaledVector(i,t)}else{var i=this.delta(Bt).normalize();this._end=new b(this._end).addScaledVector(i,t)}return this._boundingBoxNeedsUpdate=!0,this},e.prototype.closestPointToPointParameter=function(t,r){ea.subVectors(t,this._start),Er.subVectors(this.endPoint,this.startPoint);var i=Er.dot(Er),s=Er.dot(ea),o=s/i;return r&&(o=T.clamp(o,0,1)),o},e.prototype.closestPointToPoint=function(t,r,i){var s=this.closestPointToPointParameter(t,r);return this.delta(i).multiplyScalar(s).add(this._start)},e.prototype.delta=function(t){return t.subVectors(this._end,this._start)},e.prototype.distanceSq=function(){return this._start.distanceToSquared(this._end)},e.prototype.distance=function(){return this._start.distanceTo(this._end)},e.prototype.project=function(t){var r=this.direction,i=Bt.subVectors(t,this.startPoint),s=i.dot(r);return new b().copy(r).multiplyScalar(s).add(this.startPoint)},e.prototype.perpPoint=function(t){var r=this.direction,i=this.startPoint,s=Bt.subVectors(t,i),o=s.dot(r),a=Bt.copy(r).multiplyScalar(o);return new b().addVectors(i,a)},e.prototype.calculateBoundingBox=function(){var t=new b(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),r=new b(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new B(t,r)},e.prototype.transform=function(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(e.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.copy=function(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this._start.clone(),this._end.clone())},e.prototype.offset=function(t){var r=this.startPoint,i=this.endPoint,s=Math.hypot(i.x-r.x,i.y-r.y);if(s===0)return this.clone();var o=new x(i.x-r.x,i.y-r.y,0).normalize(),a=new x(-o.y,o.x,0);return new e(new b(r.x+a.x*t,r.y+a.y*t,r.z),new b(i.x+a.x*t,i.y+a.y*t,i.z))},e}(yr),Bt=new x,ea=new x,Er=new x,Au=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),qi=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Xi=function(n){Au(e,n);function e(t,r,i,s,o,a){a===void 0&&(a=x.X_AXIS);var l=n.call(this)||this;return l.center=t,l.radius=r,l.startAngle=i,l.endAngle=s,l.normal=o,l.refVec=a,(s-i)%G==0?(l.startAngle=0,l.endAngle=G):(l.startAngle=i,l.endAngle=s),l}return e.computeCenterPoint=function(t,r,i){var s=new x().addVectors(t,r).multiplyScalar(.5),o=new x().addVectors(t,i).multiplyScalar(.5),a=new x().subVectors(r,t),l=new x().subVectors(i,t),c=new x().crossVectors(a,l).normalize();if(c.lengthSq()===0)return null;var h=new x().crossVectors(a,c).normalize(),d=new x().crossVectors(l,c).normalize(),p=h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),g=d.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),f=new bt(s,s.clone().add(p)),m=new bt(o,o.clone().add(g)),y=new x,_=f.closestPointToPoint(m.startPoint,!0,y);return _?y:null},e.createByThreePoints=function(t,r,i){var s=e.computeCenterPoint(t,r,i);if(s){var o=s.distanceTo(t),a=new x().subVectors(t,s),l=new x().subVectors(r,s),c=Math.atan2(a.y,a.x),h=Math.atan2(l.y,l.x);return new e(s,o,c,h,x.Z_AXIS)}},Object.defineProperty(e.prototype,"center",{get:function(){return this._center},set:function(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._startAngle},set:function(t){this._startAngle=T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endAngle",{get:function(){return this._endAngle},set:function(t){this._endAngle=this.startAngle==0&&t==G?t:T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaAngle",{get:function(){return T.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normal",{get:function(){return this._normal},set:function(t){this._normal=new x(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refVec",{get:function(){return this._refVec},set:function(t){this._refVec=new x(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midPoint",{get:function(){var t=this.startAngle,r=this.deltaAngle;this.closed&&(t=0,r=G);var i=t+r*.5;return this.getPointAtAngle(i)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"area",{get:function(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)},enumerable:!1,configurable:!0}),e.prototype.nearestPoint=function(t){var r=new x(t.x,t.y,t.z||0),i=this.center,s=this.normal,o=r.clone().sub(i),a=o.dot(s),l=r.clone().sub(s.clone().multiplyScalar(a)),c=l.clone().sub(i);if(c.lengthSq()===0)return this.startPoint.clone();c.normalize().multiplyScalar(this.radius);var h=i.clone().add(c),d=this.getAngle(h.clone()),p=this.startAngle,g=this.deltaAngle,f=T.normalizeAngle(d-p);f<0&&(f=0),f>g&&(f=g);var m=this.getPointAtAngle(p+f),y=m.distanceTo(r),_=this.startPoint.distanceTo(r),P=this.endPoint.distanceTo(r);return _<y&&_<=P?this.startPoint.clone():P<y&&P<_?this.endPoint.clone():m},e.prototype.tangentPoints=function(t){var r,i,s=[],o=new x(t.x,t.y,t.z||0),a=this.center,l=this.normal,c=this.radius,h=o.clone().sub(a),d=h.dot(l),p=o.clone().sub(l.clone().multiplyScalar(d)),g=a.clone(),f=p.clone().sub(g),m=f.length();if(m<c)return s;var y=Math.acos(c/m),_=this.getAngle(p.clone()),P=[_+y,_-y];try{for(var L=qi(P),S=L.next();!S.done;S=L.next()){var A=S.value,N=T.normalizeAngle(A-this.startAngle);N>=0&&N<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+N))}}catch(C){r={error:C}}finally{try{S&&!S.done&&(i=L.return)&&i.call(L)}finally{if(r)throw r.error}}return s},e.prototype.perpendicularPoints=function(t){var r,i,s=[],o=new x(t.x,t.y,t.z||0),a=this.center,l=this.normal,c=this.radius,h=o.clone().sub(a),d=h.dot(l),p=o.clone().sub(l.clone().multiplyScalar(d)),g=p.clone().sub(a);if(g.lengthSq()<1e-24)return s;g.normalize();var f=[a.clone().add(g.clone().multiplyScalar(c)),a.clone().sub(g.clone().multiplyScalar(c))];try{for(var m=qi(f),y=m.next();!y.done;y=m.next()){var _=y.value,P=this.getAngle(_.clone()),L=T.normalizeAngle(P-this.startAngle);L>=0&&L<=this.deltaAngle&&s.push(new b(_.x,_.y,_.z||0))}}catch(S){r={error:S}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}return s},e.prototype.nearestTangentPoint=function(t){var r=this.tangentPoints(t);if(r.length===0)return null;var i=new b(t.x,t.y,t.z||0);return r.length===1||r[0].distanceTo(i)<r[1].distanceTo(i)?r[0]:r[1]},e.prototype.calculateBoundingBox=function(){for(var t,r,i=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)T.isBetweenAngle(s,this.startAngle,this.endAngle)&&i.push(s);var o=1/0,a=1/0,l=1/0,c=-1/0,h=-1/0,d=-1/0;try{for(var p=qi(i),g=p.next();!g.done;g=p.next()){var f=g.value,m=this.getPointAtAngle(f);m.x<o&&(o=m.x),m.y<a&&(a=m.y),m.z<l&&(l=m.z),m.x>c&&(c=m.x),m.y>h&&(h=m.y),m.z>d&&(d=m.z)}}catch(y){t={error:y}}finally{try{g&&!g.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}return new B({x:o,y:a,z:l},{x:c,y:h,z:d})},Object.defineProperty(e.prototype,"closed",{get:function(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0},enumerable:!1,configurable:!0}),e.prototype.getPoints=function(t){var r=[],i=this.deltaAngle,s=this.startAngle;this.closed&&(i=G,s=0);for(var o=0;o<=t;o++){var a=s+i*(o/t),l=this.getPointAtAngle(a);r.push(l)}return r},e.prototype.transform=function(t){var r=this.center.clone().applyMatrix4(t),i=this.startPoint.clone().applyMatrix4(t),s=this.endPoint.clone().applyMatrix4(t),o=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(t),a=new x(i).sub(r).normalize(),l=r.distanceTo(i),c=new x().crossVectors(new x(i).sub(r),new x(o).sub(r)).normalize();c.lengthSq()===0&&(c=this.normal.clone().transformDirection(t));var h=function(d){var p=new x(d).sub(r);return Math.atan2(p.dot(ta.crossVectors(c,a)),p.dot(a))};return this.center=r,this.radius=l,this.normal=c,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?G:h(s),this._boundingBoxNeedsUpdate=!0,this},e.prototype.copy=function(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)},e.prototype.getAngle=function(t){return t.sub(this.center),Math.atan2(t.dot(ta.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))},e.prototype.getPointAtAngle=function(t){var r=this.normal,i=this.refVec,s={x:r.y*i.z-r.z*i.y,y:r.z*i.x-r.x*i.z,z:r.x*i.y-r.y*i.x},o=this.center,a=this.radius;return new b(o.x+a*(i.x*Math.cos(t)+s.x*Math.sin(t)),o.y+a*(i.y*Math.cos(t)+s.y*Math.sin(t)),o.z+a*(i.z*Math.cos(t)+s.z*Math.sin(t)))},Object.defineProperty(e.prototype,"plane",{get:function(){var t=new x(this.center).distanceTo(Fs);return new Ds(this.normal,t)},enumerable:!1,configurable:!0}),e.prototype.offset=function(t){var r=this.radius+t;return r<=0?null:new e(this.center,r,this.startAngle,this.endAngle,this.normal,this.refVec)},e}(yr),ta=new x,Su=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ln=function(n){Su(e,n);function e(t,r,i,s,o,a,l){s===void 0&&(s=0),o===void 0&&(o=G),a===void 0&&(a=!1),l===void 0&&(l=0);var c=n.call(this)||this;return c.center=t,c.majorAxisRadius=r,c.minorAxisRadius=i,(o-s)%G==0?(c.startAngle=0,c.endAngle=G):(c.startAngle=s,c.endAngle=o),c.clockwise=a,c.rotation=l,c}return Object.defineProperty(e.prototype,"center",{get:function(){return this._center},set:function(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._startAngle},set:function(t){this._startAngle=T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endAngle",{get:function(){return this._endAngle},set:function(t){this._endAngle=this.startAngle==0&&t==G?t:T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwise",{get:function(){return this._clockwise},set:function(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaAngle",{get:function(){return T.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){for(var t=100,r=1/0,i=1/0,s=-1/0,o=-1/0,a=0;a<=t;a++){var l=this.getPoint(a/t);r=Math.min(r,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x),o=Math.max(o,l.y)}return new xe({x:r,y:i},{x:s,y:o})},Object.defineProperty(e.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),e.prototype.getPoint=function(t){for(var r=Math.PI*2,i=this.endAngle-this.startAngle,s=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(s?i=0:i=r),this.clockwise===!0&&!s&&(i===r?i=-r:i=i-r);var o=this.startAngle+t*i,a=this.center.x+this.majorAxisRadius*Math.cos(o),l=this.center.y+this.minorAxisRadius*Math.sin(o);if(this.rotation!==0){var c=Math.cos(this.rotation),h=Math.sin(this.rotation),d=a-this.center.x,p=l-this.center.y;a=d*c-p*h+this.center.x,l=d*h+p*c+this.center.y}return new E(a,l)},e.prototype.transform=function(t){var r=t,i=new E(this.center).applyMatrix2d(r),s=new b(i.x,i.y,this.center.z),o=this.getPointAtAngle(0).clone().applyMatrix2d(r),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(r),l=new E(o).sub(i),c=new E(a).sub(i),h=l.length(),d=c.length(),p=Math.atan2(l.y,l.x),g=l.clone().normalize(),f=c.clone().normalize(),m=function(P){var L=new E(P).sub(i),S=L.dot(g),A=L.dot(f);return T.normalizeAngle(Math.atan2(A/d,S/h))},y=r.determinant()<0?!this.clockwise:this.clockwise,_=this.closed?new e(s,h,d,0,G,y,p):new e(s,h,d,m(this.startPoint.clone().applyMatrix2d(r)),m(this.endPoint.clone().applyMatrix2d(r)),y,p);return this.center=_.center,this.majorAxisRadius=_.majorAxisRadius,this.minorAxisRadius=_.minorAxisRadius,this._startAngle=_._startAngle,this._endAngle=_._endAngle,this._clockwise=_._clockwise,this.rotation=_.rotation,this._boundingBoxNeedsUpdate=!0,this},e.prototype.getPointAtAngle=function(t){return this.getPoint(this.closed?t/G:T.normalizeAngle(t-this.startAngle)/this.deltaAngle)},e.prototype.copy=function(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this},e.prototype.clone=function(){return new e(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)},e.prototype.getFocusPoints=function(){var t=Math.max(this.majorAxisRadius,this.minorAxisRadius),r=Math.min(this.majorAxisRadius,this.minorAxisRadius);if(t-r<1e-9)return[];var i=Math.sqrt(t*t-r*r),s=Math.cos(this.rotation),o=Math.sin(this.rotation),a=this.majorAxisRadius>=this.minorAxisRadius,l=a?s:-o,c=a?o:s;return[new E(this.center.x-i*l,this.center.y-i*c),new E(this.center.x+i*l,this.center.y+i*c)]},e.prototype.getQuadrantPoints=function(){return this.closed?[this.getPoint(0),this.getPoint(.25),this.getPoint(.5),this.getPoint(.75)]:[]},e.prototype.nearestPoint=function(t){for(var r=new E(t.x,t.y),i=this.getPoint(0),s=r.distanceToSquared(i),o=72,a=1;a<=o;a++){var l=this.getPoint(a/o),c=r.distanceToSquared(l);c<s&&(s=c,i=l)}return i},e.prototype.tangentPoints=function(t){var r=this,i=this._projectPointToLocal(t),s=this._findSnapAngles(i,function(o,a,l,c){var h=-r.majorAxisRadius*c,d=r.minorAxisRadius*l;return(o-i.x)*d-(a-i.y)*h});return s.map(function(o){return r.getPointAtAngle(o)})},e.prototype.perpendicularPoints=function(t){var r=this,i=this._projectPointToLocal(t),s=this._findSnapAngles(i,function(o,a,l,c){var h=r.minorAxisRadius*l,d=r.majorAxisRadius*c;return(o-i.x)*d-(a-i.y)*h});return s.map(function(o){return r.getPointAtAngle(o)})},e.prototype._projectPointToLocal=function(t){var r=t.x-this.center.x,i=t.y-this.center.y,s=Math.cos(-this.rotation),o=Math.sin(-this.rotation);return{x:r*s-i*o,y:r*o+i*s}},e.prototype._findSnapAngles=function(t,r,i){i===void 0&&(i=144);for(var s=this.majorAxisRadius,o=this.minorAxisRadius,a=this.startAngle,l=this.deltaAngle,c=[],h=function(S){var A=Math.cos(S),N=Math.sin(S);return r(s*A,o*N,A,N)},d=a,p=h(d),g=1;g<=i;g++){var f=a+l*g/i,m=h(f);if(Math.abs(p)<1e-10&&c.push(d),p*m<0){for(var y=d,_=f,P=0;P<32;P++){var L=(y+_)/2;h(y)*h(L)<=0?_=L:y=L}c.push((y+_)/2)}d=f,p=m}return c},e}(En),Lu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Iu=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},dl=function(n){Lu(e,n);function e(t,r,i,s,o,a,l){a===void 0&&(a=0),l===void 0&&(l=G);var c=n.call(this)||this;c.center=t,c.normal=r,c.majorAxis=i,c.majorAxisRadius=s,c.minorAxisRadius=o;var h=Math.abs(l-a);return Math.abs(h-G)<1e-10||Math.abs(h-2*G)<1e-10?(c.startAngle=0,c.endAngle=G):(c.startAngle=a,c.endAngle=l),c}return Object.defineProperty(e.prototype,"center",{get:function(){return this._center},set:function(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(t){if(t<0)throw Pe.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._startAngle},set:function(t){this._startAngle=T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endAngle",{get:function(){return this._endAngle},set:function(t){this._endAngle=this.startAngle==0&&t==G?t:T.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deltaAngle",{get:function(){var t=this.endAngle-this.startAngle;return Math.abs(t-G)<1e-10?G:T.normalizeAngle(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normal",{get:function(){return this._normal},set:function(t){this._normal=new x(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorAxis",{get:function(){return this._majorAxis},set:function(t){this._majorAxis=new x(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorAxis",{get:function(){return new x().crossVectors(this.normal,this.majorAxis).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midPoint",{get:function(){var t=this.startAngle,r=this.deltaAngle;(this.closed||Math.abs(r-G)<1e-10)&&(t=0,r=G);var i=t+r/2;return this.getPointAtAngle(i)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCircular",{get:function(){return q.equal(this.majorAxisRadius,this.minorAxisRadius)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);for(var t=1e3,r=this.deltaAngle/t,i=0,s=this.getPointAtAngle(this.startAngle),o=1;o<=t;o++){var a=this.startAngle+o*r,l=this.getPointAtAngle(a),c=l.x-s.x,h=l.y-s.y,d=l.z-s.z;i+=Math.sqrt(c*c+h*h+d*d),s=l}return i},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"area",{get:function(){var t=this.majorAxisRadius,r=this.minorAxisRadius,i=this.startAngle,s=i+this.deltaAngle;if(Math.abs(this.deltaAngle-G)<1e-10)return Math.PI*t*r;var o=t*r/2*(s-i-(Math.sin(s)*Math.cos(s)-Math.sin(i)*Math.cos(i)));return Math.abs(o)},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t,r;if(this.majorAxis.equals(x.X_AXIS)||this.majorAxis.equals(x.Y_AXIS)||this.majorAxis.isParallelTo(x.X_AXIS)||this.majorAxis.isParallelTo(x.Y_AXIS)){for(var i=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)T.isBetweenAngle(s,this.startAngle,this.endAngle)&&i.push(s);var o=1/0,a=1/0,l=1/0,c=-1/0,h=-1/0,d=-1/0;try{for(var p=Iu(i),g=p.next();!g.done;g=p.next()){var f=g.value,m=this.getPointAtAngle(f);m.x<o&&(o=m.x),m.y<a&&(a=m.y),m.z<l&&(l=m.z),m.x>c&&(c=m.x),m.y>h&&(h=m.y),m.z>d&&(d=m.z)}}catch(_){t={error:_}}finally{try{g&&!g.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}return new B({x:o,y:a,z:l},{x:c,y:h,z:d})}else{for(var y=100,o=1/0,a=1/0,l=1/0,c=-1/0,h=-1/0,d=-1/0,s=0;s<=y;s++){var f=this.startAngle+this.deltaAngle*(s/y),m=this.getPointAtAngle(f);o=Math.min(o,m.x),a=Math.min(a,m.y),l=Math.min(l,m.z),c=Math.max(c,m.x),h=Math.max(h,m.y),d=Math.max(d,m.z)}return new B({x:o,y:a,z:l},{x:c,y:h,z:d})}},Object.defineProperty(e.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),e.prototype.getPoints=function(t){t===void 0&&(t=100);var r=[],i=this.deltaAngle,s=this.startAngle;this.closed&&(i=G,s=0);for(var o=0;o<=t;o++){var a=s+i*(o/t),l=this.getPointAtAngle(a);r.push(l)}return r},e.prototype.getPointAtAngle=function(t){var r=Math.cos(t),i=Math.sin(t),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(i),o=this.majorAxis.clone().multiplyScalar(r*this.majorAxisRadius).add(s);return new b(this.center.x+o.x,this.center.y+o.y,this.center.z+o.z)},e.prototype.nearestPoint=function(t,r){r===void 0&&(r=72);for(var i=new b(t.x,t.y,t.z||0),s=this.getPointAtAngle(this.startAngle),o=i.distanceToSquared(s),a=1;a<=r;a++){var l=this.startAngle+this.deltaAngle*a/r,c=this.getPointAtAngle(l),h=i.distanceToSquared(c);h<o&&(o=h,s=c)}var d=i.distanceToSquared(this.startPoint),p=i.distanceToSquared(this.endPoint);return d<o&&d<=p?this.startPoint.clone():p<o&&p<d?this.endPoint.clone():s.clone()},e.prototype.tangentPoints=function(t){var r=this,i=this._projectPointToLocalPlane(t),s=this._findSnapParameterAngles(function(o,a,l,c){var h=-r.majorAxisRadius*c,d=r.minorAxisRadius*l;return(o-i.x)*d-(a-i.y)*h});return s.map(function(o){return r.getPointAtAngle(o)})},e.prototype.perpendicularPoints=function(t){var r=this,i=this._projectPointToLocalPlane(t),s=this._findSnapParameterAngles(function(o,a,l,c){var h=r.minorAxisRadius*l,d=r.majorAxisRadius*c;return(o-i.x)*d-(a-i.y)*h});return s.map(function(o){return r.getPointAtAngle(o)})},e.prototype._projectPointToLocalPlane=function(t){var r=new b(t.x,t.y,t.z||0),i=new x(r).sub(this.center),s=i.dot(this.normal);return i.sub(this.normal.clone().multiplyScalar(s)),{x:i.dot(this.majorAxis),y:i.dot(this.minorAxis)}},e.prototype._findSnapParameterAngles=function(t,r){r===void 0&&(r=144);for(var i=this.majorAxisRadius,s=this.minorAxisRadius,o=this.startAngle,a=this.deltaAngle,l=[],c=function(L){var S=Math.cos(L),A=Math.sin(L);return t(i*S,s*A,S,A)},h=o,d=c(h),p=1;p<=r;p++){var g=o+a*p/r,f=c(g);if(Math.abs(d)<1e-10&&l.push(h),d*f<0){for(var m=h,y=g,_=0;_<32;_++){var P=(m+y)/2;c(m)*c(P)<=0?y=P:m=P}l.push((m+y)/2)}h=g,d=f}return l},e.prototype.contains=function(t){var r=new x(t).sub(this.center),i=r.dot(this.majorAxis),s=r.dot(this.minorAxis),o=i/this.majorAxisRadius,a=s/this.minorAxisRadius;return o*o+a*a<=1},e.prototype.transform=function(t){var r=t,i=this.center.clone().applyMatrix4(r),s=this.getPointAtAngle(0).clone().applyMatrix4(r),o=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(r),a=new x(s).sub(i),l=new x(o).sub(i),c=a.length(),h=l.length(),d=a.clone().normalize(),p=new x().crossVectors(a,l).normalize(),g=new x().crossVectors(p,d).normalize();g.dot(l)<0&&(p.negate(),g=new x().crossVectors(p,d).normalize());var f=function(y){var _=new x(y).sub(i),P=_.dot(d),L=_.dot(g);return T.normalizeAngle(Math.atan2(L/h,P/c))},m=this.closed?new e(i,p,d,c,h,0,G):new e(i,p,d,c,h,f(this.startPoint.clone().applyMatrix4(r)),f(this.endPoint.clone().applyMatrix4(r)));return this.center=m.center,this.normal=m.normal,this.majorAxis=m.majorAxis,this.majorAxisRadius=m.majorAxisRadius,this.minorAxisRadius=m.minorAxisRadius,this._startAngle=m._startAngle,this._endAngle=m._endAngle,this._boundingBoxNeedsUpdate=!0,this},e.prototype.copy=function(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)},Object.defineProperty(e.prototype,"plane",{get:function(){var t=new x(this.center).distanceTo(Fs);return new Ds(this.normal,t)},enumerable:!1,configurable:!0}),e.prototype.offset=function(t){var r=this.majorAxisRadius+t,i=this.minorAxisRadius+t;return r<=0||i<=0?null:new e(this.center,this.normal,this.majorAxis,r,i,this.startAngle,this.endAngle)},e}(yr),Eu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),_t=function(n){Eu(e,n);function e(t,r){var i=n.call(this)||this;return i._start=new E(t),i._end=new E(r),i}return Object.defineProperty(e.prototype,"startPoint",{get:function(){return this._start},set:function(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this._end},set:function(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),e.prototype.getPoints=function(){return[this.startPoint,this.endPoint]},Object.defineProperty(e.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t=new E(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),r=new E(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new xe(t,r)},e.prototype.transform=function(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(e.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.copy=function(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this._start.clone(),this._end.clone())},e.prototype.project=function(t){var r=this._end.x-this._start.x,i=this._end.y-this._start.y,s=r*r+i*i;if(s<1e-18)return this._start.clone();var o=((t.x-this._start.x)*r+(t.y-this._start.y)*i)/s;return o=Math.max(0,Math.min(1,o)),new E(this._start.x+o*r,this._start.y+o*i)},e.prototype.nearestPoint=function(t){return this.project(t)},e}(En),Tu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ki=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},Zi=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},or=function(n){Tu(e,n);function e(t){t===void 0&&(t=[]);var r=n.call(this)||this;return r._curves=t,r}return Object.defineProperty(e.prototype,"curves",{get:function(){return this._curves},enumerable:!1,configurable:!0}),e.buildFromEdges=function(t,r){if(r===void 0&&(r=.001),t.length===0)return[];for(var i=Zi([],Ki(t),!1),s=[],o=r*r,a=function(f,m){var y=f.x-m.x,_=f.y-m.y;return y*y+_*_<=o};i.length>0;){var l=[],c=i.shift();l.push(c);var h=e.getEdgeStartPoint(c),d=e.getEdgeEndPoint(c);if(!a(h,d))for(;i.length>0;){var p=e.findConnectingEdge(i,d,o);if(p.index<0)break;var g=i.splice(p.index,1)[0];if(p.reverse&&(g=e.reverseEdge(g)),l.push(g),d=e.getEdgeEndPoint(g),a(d,h))break}s.push(new e(l))}return s},e.prototype.add=function(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(e.prototype,"numberOfEdges",{get:function(){return this._curves.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){if(this._curves.length>0){var t=this._curves[0].startPoint;return new E(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this.startPoint},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){var t=0;return this._curves.forEach(function(r){t+=r.length}),t},enumerable:!1,configurable:!0}),e.prototype.calculateBoundingBox=function(){var t=this.getPoints(100),r=new xe;return r.setFromPoints(t),r},e.prototype.transform=function(t){var r=new D().set(t.elements[0],t.elements[3],0,t.elements[6],t.elements[1],t.elements[4],0,t.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(function(i){i instanceof $e?i.transform(r):i.transform(t)}),this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return new e(this._curves.map(function(t){return t.clone()}))},Object.defineProperty(e.prototype,"closed",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.getPoints=function(t){var r=[];return this.curves.forEach(function(i){i.getPoints(t).forEach(function(s){r.push(new E(s.x,s.y))})}),r},e.findConnectingEdge=function(t,r,i){for(var s=-1,o=!1,a=Number.POSITIVE_INFINITY,l=0;l<t.length;l++){var c=t[l],h=e.getEdgeStartPoint(c),d=e.getEdgeEndPoint(c),p=r.x-h.x,g=r.y-h.y,f=p*p+g*g;f<a&&(a=f,s=l,o=!1);var m=r.x-d.x,y=r.y-d.y,_=m*m+y*y;_<a&&(a=_,s=l,o=!0)}return a>i?{index:-1,reverse:!1}:{index:s,reverse:o}},e.getEdgeStartPoint=function(t){var r=t.startPoint;return new E(r.x,r.y)},e.getEdgeEndPoint=function(t){var r=t.endPoint;return new E(r.x,r.y)},e.reverseEdge=function(t){return t instanceof _t?new _t(t.endPoint,t.startPoint):t instanceof Re?new Re(t.center,t.radius,t.endAngle,t.startAngle,!t.clockwise):t instanceof Ln?new Ln(t.center,t.majorAxisRadius,t.minorAxisRadius,t.endAngle,t.startAngle,!t.clockwise,t.rotation):t instanceof $e?e.reverseSplineEdge(t):t},e.reverseSplineEdge=function(t){var r=Zi([],Ki(t.controlPoints),!1).reverse(),i=t.knots,s=i[0],o=i[i.length-1],a=i.map(function(h){return s+o-h}).reverse(),l=t.weights,c=l.length>0?Zi([],Ki(l),!1).reverse():void 0;return new $e(r,a,c,t.degree,t.closed)},e}(En),Cu=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Qi=function(){function n(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}return n.prototype.init=function(e,t,r,i){this.c0=e,this.c1=r,this.c2=-3*e+3*t-2*r-i,this.c3=2*e-2*t+r+i},n.prototype.initCatmullRom=function(e,t,r,i,s){this.init(t,r,s*(r-e),s*(i-t))},n.prototype.initNonuniformCatmullRom=function(e,t,r,i,s,o,a){var l=(t-e)/s-(r-e)/(s+o)+(r-t)/o,c=(r-t)/o-(i-t)/(o+a)+(i-r)/a;l*=o,c*=o,this.init(t,r,l,c)},n.prototype.calc=function(e){var t=e*e,r=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*r},n}(),ul=function(n){Cu(e,n);function e(t,r,i,s){t===void 0&&(t=[]),r===void 0&&(r=!1),i===void 0&&(i="centripetal"),s===void 0&&(s=.5);var o=n.call(this)||this;return o.isCatmullRomCurve3d=!0,o.type="CatmullRomCurve3d",o._tmp=new x,o._px=new Qi,o._py=new Qi,o._pz=new Qi,o._points=t.map(function(a){return new b(a)}),o._closed=r,o._curveType=i,o._tension=s,o}return Object.defineProperty(e.prototype,"points",{get:function(){return this._points},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"curveType",{get:function(){return this._curveType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tension",{get:function(){return this._tension},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){return this._points.length>0?this._points[0]:new b},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){return this._points.length>0?this._points[this._points.length-1]:new b},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){if(this._points.length<2)return 0;for(var t=0,r=1;r<this._points.length;r++)t+=this._points[r-1].distanceTo(this._points[r]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t},enumerable:!1,configurable:!0}),e.prototype.getPoint=function(t,r){r===void 0&&(r=new b);var i=r,s=this._points,o=s.length;if(o===0)return i.set(0,0,0);if(o===1)return i.copy(s[0]);var a=(o-(this._closed?0:1))*t,l=Math.floor(a),c=a-l;this._closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:c===0&&l===o-1&&(l=o-2,c=1);var h,d;this._closed||l>0?h=s[(l-1)%o]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),h=new b(this._tmp.x,this._tmp.y,this._tmp.z));var p=s[l%o],g=s[(l+1)%o];if(this._closed||l+2<o?d=s[(l+2)%o]:(this._tmp.subVectors(s[o-1],s[o-2]).add(s[o-1]),d=new b(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){var f=this._curveType==="chordal"?.5:.25,m=Math.pow(h.distanceToSquared(p),f),y=Math.pow(p.distanceToSquared(g),f),_=Math.pow(g.distanceToSquared(d),f);y<1e-4&&(y=1),m<1e-4&&(m=y),_<1e-4&&(_=y),this._px.initNonuniformCatmullRom(h.x,p.x,g.x,d.x,m,y,_),this._py.initNonuniformCatmullRom(h.y,p.y,g.y,d.y,m,y,_),this._pz.initNonuniformCatmullRom(h.z,p.z,g.z,d.z,m,y,_)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(h.x,p.x,g.x,d.x,this._tension),this._py.initCatmullRom(h.y,p.y,g.y,d.y,this._tension),this._pz.initCatmullRom(h.z,p.z,g.z,d.z,this._tension));return i.set(this._px.calc(c),this._py.calc(c),this._pz.calc(c)),i},e.prototype.getPoints=function(t){for(var r=[],i=0;i<=t;i++)r.push(this.getPoint(i/t));return r},e.prototype.setPoints=function(t){this._points=t.map(function(r){return new b(r)}),this._boundingBoxNeedsUpdate=!0},e.prototype.setClosed=function(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)},e.prototype.setCurveType=function(t){this._curveType=t},e.prototype.setTension=function(t){this._tension=t},e.prototype.clone=function(){return new e(this._points.map(function(t){return t.clone()}),this._closed,this._curveType,this._tension)},e.prototype.transform=function(t){return this._points=this._points.map(function(r){var i=new b;return i.copy(r),i.applyMatrix4(t),i}),this._boundingBoxNeedsUpdate=!0,this},e.prototype.calculateBoundingBox=function(){if(this._points.length===0)return new B;var t=new B;return this._points.forEach(function(r){t.expandByPoint(r)}),t},e}(yr),fn=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},mn=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))};function na(n,e){var t,r,i=n.x-e[0],s=n.y-e[1],o=((t=n.z)!==null&&t!==void 0?t:0)-((r=e[2])!==null&&r!==void 0?r:0);return i*i+s*s+o*o}var je=function(){function n(e,t,r,i){this._degree=e,this._knots=mn([],fn(t),!1),this._controlPoints=r.map(function(s){return{x:s.x,y:s.y,z:s.z}}),this._weights=i?mn([],fn(i),!1):new Array(r.length).fill(1)}return n.prototype.degree=function(){return this._degree},n.prototype.knots=function(){return mn([],fn(this._knots),!1)},n.prototype.controlPoints=function(){return this._controlPoints.map(function(e){return{x:e.x,y:e.y,z:e.z}})},n.prototype.weights=function(){return mn([],fn(this._weights),!1)},n.prototype.clone=function(){return new n(this._degree,this._knots,this._controlPoints,this._weights)},n.prototype.point=function(e){return this.evaluate(e).point},n.prototype.evaluate=function(e){var t=this._controlPoints.map(function(r){return[r.x,r.y,r.z]});return Cd(e,this._degree,this._knots,t,this._weights)},n.prototype.signedPlanarCurvatureAt=function(e){var t=this.evaluate(e);return Md(t.deriv1,t.deriv2)},n.prototype.getOffsetSamplePath2d=function(e,t){var r=this;t===void 0&&(t=512);for(var i=Math.abs(e),s=this.getParameterRange(),o=s.start,a=s.end,l=this.length(),c=Math.max(64,Math.ceil(l/Math.max(i*.2,1e-6))),h=Mu(o,a,Math.min(c,t)),d=0;d<8&&h.length<t;d++){for(var p=[],g=0;g<h.length-1;g++){var f=h[g],m=h[g+1],y=(f+m)/2,_=Math.max(Math.abs(this.signedPlanarCurvatureAt(f)),Math.abs(this.signedPlanarCurvatureAt(m)),Math.abs(this.signedPlanarCurvatureAt(y)));i*_>.85&&p.push(y)}if(p.length===0)break;if(h=Ou(h,p),h.length>t){h=h.slice(0,t);break}}var P=[],L=[];return h.forEach(function(S){var A=r.evaluate(S);P.push(new E(A.point[0],A.point[1]));var N=A.deriv1[0],C=A.deriv1[1],z=Math.hypot(N,C);L.push(z>1e-10?new E(N/z,C/z):new E(1,0))}),{points:P,tangents:L}},n.prototype.length=function(){var e=this._controlPoints.map(function(t){return[t.x,t.y,t.z]});return Ja(this._degree,this._knots,e,this._weights)},n.byKnotsControlPointsWeights=function(e,t,r,i){return new n(e,t,r,i)},n.byPoints=function(e,t,r,i,s){r===void 0&&(r="Uniform");var o=Vs(e,t,r,i,s),a=o.controlPoints.map(function(l){return{x:l[0],y:l[1],z:l[2]}});return new n(t,o.knots,a,o.weights)},n.prototype.getParameterRange=function(){var e=this._knots[this._degree],t=this._knots[this._knots.length-this._degree-1];return{start:e,end:t}},n.prototype.getPoints=function(e){for(var t=[],r=this.getParameterRange(),i=r.start,s=r.end,o=0;o<=e;o++){var a=i+(s-i)*(o/e);t.push(this.point(a))}return t},n.prototype.isClosed=function(e){e===void 0&&(e=1e-6);var t=this.getParameterRange(),r=t.start,i=t.end,s=this.point(r),o=this.point(i),a=s[0]-o[0],l=s[1]-o[1],c=s[2]-o[2];return Math.sqrt(a*a+l*l+c*c)<e},n.createFitPointsForClosedCurve=function(e){if(e.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");var t=new ul(e,!0,"centripetal"),r=Math.max(50,e.length*2);return t.getPoints(r)},n.prototype.nearestPoint=function(e,t){var r;t===void 0&&(t=64);for(var i=this.getParameterRange(),s=i.start,o=i.end,a=this.point(s),l=na(e,a),c=0;c<=t;c++){var h=s+(o-s)*c/t,d=this.point(h),p=na(e,d);p<l&&(l=p,a=d)}return{x:a[0],y:a[1],z:(r=a[2])!==null&&r!==void 0?r:0}},n.createClosedCurve=function(e,t,r){r===void 0&&(r="Chord");var i=this.createFitPointsForClosedCurve(e),s=i.map(function(o){return[o.x,o.y,o.z]});return n.byPoints(s,t,r)},n}();function Mu(n,e,t){if(t<2)return[n,e];for(var r=[],i=0;i<t;i++)r.push(i===t-1?e:n+(e-n)*i/(t-1));return r}function Ou(n,e){var t=mn(mn([],fn(n),!1),fn(e),!1).sort(function(i,s){return i-s}),r=[];return t.forEach(function(i){var s=r[r.length-1];(s===void 0||Math.abs(s-i)>1e-10)&&r.push(i)}),r}var ku=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),ra=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s},ia=function(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return n.concat(s||Array.prototype.slice.call(e))},$e=function(n){ku(e,n);function e(t,r,i,s,o,a){var l=n.call(this)||this,c=arguments.length;if(l._degree=3,l._closed=!1,Array.isArray(r)){if(c<2||c>5)throw Pe.ILLEGAL_PARAMETERS;l._controlPoints=t;var g=void 0,f=3,m=!1;if(c>=3&&(Array.isArray(i)?(g=i,c>=4&&(f=s||3),c>=5&&(m=o)):i!==void 0&&(f=i||3,c>=4&&(m=s))),i===void 0&&c>=4&&(f=s||3,c>=5&&(m=o)),l._degree=f,l._closed=m,l._controlPoints.length<l._degree+1)throw Pe.ILLEGAL_PARAMETERS;l._nurbsCurve=je.byKnotsControlPointsWeights(l._degree,r,l._controlPoints,g)}else{if(c<2||c>6)throw Pe.ILLEGAL_PARAMETERS;l._fitPoints=t,l._knotParameterization=r,c>=3&&(l._degree=i||3);var h=typeof s=="boolean";c>=4&&h&&(l._closed=s),h?(c>=5&&(l._startTangent=o),c>=6&&(l._endTangent=a)):(c>=4&&(l._startTangent=s),c>=5&&(l._endTangent=o)),l._closed&&(l._startTangent=void 0,l._endTangent=void 0);var d=(l._startTangent?1:0)+(l._endTangent?1:0);if(l._fitPoints.length+d<l._degree+1)throw Pe.ILLEGAL_PARAMETERS;if(l._closed)l._nurbsCurve=je.createClosedCurve(l._fitPoints,l._degree,l._knotParameterization);else{var p=l.toNurbsPoints(l._fitPoints);l._nurbsCurve=je.byPoints(p,l._degree,l._knotParameterization,l._startTangent?l.toNurbsPoint(l._startTangent):void 0,l._endTangent?l.toNurbsPoint(l._endTangent):void 0)}l._controlPoints=l.toGePoints(l._nurbsCurve.controlPoints().map(function(y){return[y.x,y.y,y.z||0]}))}return l}return e.prototype.buildCurve=function(){if(this._fitPoints&&this._knotParameterization){if(this._closed){var t=je.createFitPointsForClosedCurve(this._fitPoints),r=this.toNurbsPoints(t);this._nurbsCurve=je.byPoints(r,this._degree,this._knotParameterization)}else{var r=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=je.byPoints(r,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(o){return[o.x,o.y,o.z||0]}))}else if(this._controlPoints)if(this._closed){var t=je.createFitPointsForClosedCurve(this._controlPoints),r=this.toNurbsPoints(t);this._nurbsCurve=je.byPoints(r,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(l){return[l.x,l.y,l.z||0]}))}else{var i=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=je.byKnotsControlPointsWeights(this._degree,i,this._controlPoints,s)}},e.prototype.setClosed=function(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())},Object.defineProperty(e.prototype,"degree",{get:function(){return this._degree},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"knotParameterization",{get:function(){return this._knotParameterization},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controlPoints",{get:function(){return this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z||0}})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fitPoints",{get:function(){var t;return(t=this._fitPoints)===null||t===void 0?void 0:t.map(function(r){return{x:r.x,y:r.y,z:r.z||0}})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"knots",{get:function(){return ia([],ra(this._nurbsCurve.knots()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"weights",{get:function(){return ia([],ra(this._nurbsCurve.weights()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startPoint",{get:function(){var t=this._nurbsCurve.knots(),r=this._nurbsCurve.degree(),i=t[r],s=this._nurbsCurve.point(i);return new b(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endPoint",{get:function(){var t=this._nurbsCurve.knots(),r=this._nurbsCurve.degree(),i=t[t.length-r-1],s=this._nurbsCurve.point(i);return new b(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._nurbsCurve.length()},enumerable:!1,configurable:!0}),e.prototype.nearestPoint=function(t,r){r===void 0&&(r=64);var i=this._nurbsCurve.nearestPoint(t,r);return new b(i.x,i.y,i.z||0)},e.prototype.evaluateAt=function(t){var r=this._nurbsCurve.point(t);return new b(r[0],r[1],r[2])},e.prototype.getFitPointAt=function(t){if(!this._fitPoints)throw new Error("No fit points in this spline");var r=this._fitPoints.length,i=t<0||t>=r?r-1:t,s=this._fitPoints[i];return{x:s.x,y:s.y,z:s.z||0}},e.prototype.getControlPointAt=function(t){var r=this._controlPoints.length,i=t<0||t>=r?r-1:t;return this._controlPoints[i]},e.prototype.getOffsetSamplePath2d=function(t){return this._nurbsCurve.getOffsetSamplePath2d(t)},e.prototype.getPoints=function(t){t===void 0&&(t=100);for(var r=this._nurbsCurve,i=[],s=r.knots(),o=this._nurbsCurve.degree(),a=s[o],l=s[s.length-o-1],c=(l-a)/(t-1),h=0;h<t;h++){var d=h===t-1?l:a+h*c,p=r.point(d);i.push(new b(p[0],p[1],p[2]))}return i},e.prototype.getCurvePoints=function(t,r){for(var i=[],s=t.knots(),o=t.degree(),a=s[o],l=s[s.length-o-1],c=(l-a)/(r-1),h=0;h<r;h++){var d=a+h*c;i.push(t.point(d))}return i},e.prototype.calculateBoundingBox=function(){var t=this.getPoints(100);return new B().setFromPoints(t)},Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},set:function(t){this.setClosed(t)},enumerable:!1,configurable:!0}),e.prototype.transform=function(t){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(function(s){return new b(s).applyMatrix4(t)}),this._startTangent&&(this._startTangent=new b(this._startTangent).transformDirection(t)),this._endTangent&&(this._endTangent=new b(this._endTangent).transformDirection(t)),this.buildCurve();else{var r=this._nurbsCurve.knots(),i=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(function(s){return new b(s).applyMatrix4(t)}),this._nurbsCurve=je.byKnotsControlPointsWeights(this._degree,r,this._controlPoints,i.length>0?i:void 0)}return this._boundingBoxNeedsUpdate=!0,this},e.prototype.clone=function(){return this._fitPoints&&this._knotParameterization?new e(this._fitPoints.map(function(t){return{x:t.x,y:t.y,z:t.z||0}}),this._knotParameterization,this._degree,this._closed,this._startTangent?{x:this._startTangent.x,y:this._startTangent.y,z:this._startTangent.z||0}:void 0,this._endTangent?{x:this._endTangent.x,y:this._endTangent.y,z:this._endTangent.z||0}:void 0):new e(this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z||0}}),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)},e.prototype.toNurbsPoints=function(t){var r=new Array(t.length);return t.forEach(function(i,s){r[s]=[i.x,i.y,i.z||0]}),r},e.prototype.toGePoints=function(t){var r=new Array(t.length);return t.forEach(function(i,s){r[s]={x:i[0],y:i[1],z:i[2]}}),r},e.prototype.toNurbsPoint=function(t){return[t.x,t.y,t.z||0]},e.createClosedSpline=function(t,r,i){if(r===void 0&&(r="Uniform"),i===void 0&&(i=3),t.length<i+1)throw new Error("At least ".concat(i+1," points are required for a degree ").concat(i," closed spline"));return new e(t,r,i,!0)},e}(yr);class _r{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}var nn=256,gl=[],sa=256,Tr;for(;nn--;)gl[nn]=(nn+256).toString(16).substring(1);function Nu(n){var e=0,t=11;if(!Tr||nn+t>sa*2)for(Tr="",nn=0;e<sa;e++)Tr+=gl[Math.random()*256|0];return Tr.substring(nn,nn+++t)}const Xr="TEMP_";let bs;function pl(n){bs=n}class Ge{constructor(e,t){if(e=e||{},this._attrs=new Aa(e,t),this._xDataMap=new Map,!this._attrs.get("objectId"))try{this._attrs.set("objectId",this.database.generateHandle())}catch{this._attrs.set("objectId",this.generateTemporaryHandle())}}generateTemporaryHandle(){return Xr+Nu()}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e),e&&!e.startsWith(Xr)&&this.database.updateMaxHandle(e)}get isTemp(){const e=this.getAttrWithoutException("objectId");return!!e&&e.startsWith(Xr)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(e){this._attrs.set("extensionDictionary",e)}get database(){if(this._database)return this._database;if(bs)return bs().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(e){this._database=e}getXData(e){return this._xDataMap.get(e)}setXData(e){for(const t of e)t.code===Os.ExtendedDataRegAppName&&this._xDataMap.set(t.value,e)}removeXData(e){this._xDataMap.delete(e)}createExtensionDictionary(){}close(){}clone(){const e=Object.create(Object.getPrototypeOf(this)),t=this,r=e;for(const i of Object.keys(t))i!=="_database"&&(r[i]=this.cloneValue(t[i]));return e.objectId=this.generateTemporaryHandle(),e}cloneValue(e){if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e))return e.map(i=>this.cloneValue(i));if(e instanceof Map){const i=new Map;for(const[s,o]of e.entries())i.set(this.cloneValue(s),this.cloneValue(o));return i}if(e instanceof Set){const i=new Set;for(const s of e.values())i.add(this.cloneValue(s));return i}if(ArrayBuffer.isView(e)){if(e instanceof DataView)return new DataView(e.buffer.slice(0));const i=e.constructor;return new i(e)}if(e instanceof ArrayBuffer)return e.slice(0);if("clone"in e&&typeof e.clone=="function")return e.clone();const t=Object.create(Object.getPrototypeOf(e)),r=e;for(const i of Object.keys(r))t[i]=this.cloneValue(r[i]);return t}dxfOut(...e){const[t,r=!1]=e;if(t.writeHandle(5,this.objectId),t.writeObjectId(330,this.ownerId),t.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(t),r)for(const i of this._xDataMap.values())t.writeResultBuffer(i);return this}dxfOutFields(e){return this}}class Xt extends Ge{constructor(e,t){e=e||{},fr(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var fl=(n=>(n[n.Any=0]="Any",n[n.Uniform=1]="Uniform",n))(fl||{});const Tt=class Tt extends Xt{static isModelSapceName(e){return e.toLowerCase()==Tt.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(e){return e.toLowerCase().startsWith(Tt.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new b,this._layoutId="",this._entities=new Map,this._blockInsertUnits=0,this._explodability=1,this._blockScaling=1,this._bmpPreview=void 0}get isModelSapce(){return Tt.isModelSapceName(this.name)}get isPaperSapce(){return Tt.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(e){this._origin.copy(e)}get layoutId(){return this._layoutId}set layoutId(e){this._layoutId=e}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(e){this._blockInsertUnits=e}get explodability(){return this._explodability}set explodability(e){this._explodability=e}get blockScaling(){return this._blockScaling}set blockScaling(e){this._blockScaling=e}get bmpPreview(){return this._bmpPreview}set bmpPreview(e){this._bmpPreview=e}appendEntity(e){const t=r=>{r.database=this.database,r.ownerId=this.objectId,this.database.ensureEntityStyleDefaults(r),this.database.commitObjectHandle(r,i=>this._entities.has(i)),r.resolveEffectiveProperties(),this._entities.set(r.objectId,r)};if(Array.isArray(e))for(let r=0;r<e.length;++r)t(e[r]);else t(e);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}removeEntity(e){const t=Array.isArray(e)?e:[e],r=[];return t.forEach(i=>{const s=this._entities.get(i);s&&r.push(s),this._entities.delete(i)}),r.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:r}),r.length>0}newIterator(){return new _r(this._entities)}getIdAt(e){return this._entities.get(e)}dxfOutBlockRecord(e){return e.writeStart("BLOCK_RECORD"),this.dxfOut(e),this}dxfOutBlockBegin(e){return e.writeStart("BLOCK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeString(8,"0"),e.writeSubclassMarker("AcDbBlockBegin"),e.writeString(2,this.name),e.writeInt16(70,0),e.writePoint3d(10,this.origin),e.writeString(3,this.name),this}dxfOutBlockEnd(e){return e.writeStart("ENDBLK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbBlockTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.blockInsertUnits),e.writeInt16(280,this.explodability),e.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&e.writeObjectId(340,this.layoutId),this}};Tt.MODEL_SPACE_NAME="*Model_Space",Tt.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let se=Tt;var ml=(n=>(n[n.kInches=0]="kInches",n[n.kMillimeters=1]="kMillimeters",n[n.kPixels=2]="kPixels",n))(ml||{}),yl=(n=>(n[n.k0degrees=0]="k0degrees",n[n.k90degrees=1]="k90degrees",n[n.k180degrees=2]="k180degrees",n[n.k270degrees=3]="k270degrees",n))(yl||{}),_l=(n=>(n[n.kDisplay=0]="kDisplay",n[n.kExtents=1]="kExtents",n[n.kLimits=2]="kLimits",n[n.kView=3]="kView",n[n.kWindow=4]="kWindow",n[n.kLayout=5]="kLayout",n))(_l||{}),Et=(n=>(n[n.kDraft=0]="kDraft",n[n.kPreview=1]="kPreview",n[n.kNormal=2]="kNormal",n[n.kPresentation=3]="kPresentation",n[n.kMaximum=4]="kMaximum",n[n.kCustom=5]="kCustom",n))(Et||{}),yn=(n=>(n[n.kAsDisplayed=0]="kAsDisplayed",n[n.kWireframe=1]="kWireframe",n[n.kHidden=2]="kHidden",n[n.kRendered=3]="kRendered",n[n.kVisualStyle=4]="kVisualStyle",n[n.kRenderPreset=5]="kRenderPreset",n))(yn||{}),bl=(n=>(n[n.kScaleToFit=0]="kScaleToFit",n[n.k1_128in_1ft=1]="k1_128in_1ft",n[n.k1_64in_1ft=2]="k1_64in_1ft",n[n.k1_32in_1ft=3]="k1_32in_1ft",n[n.k1_16in_1ft=4]="k1_16in_1ft",n[n.k3_32in_1ft=5]="k3_32in_1ft",n[n.k1_8in_1ft=6]="k1_8in_1ft",n[n.k3_16in_1ft=7]="k3_16in_1ft",n[n.k1_4in_1ft=8]="k1_4in_1ft",n[n.k3_8in_1ft=9]="k3_8in_1ft",n[n.k1_2in_1ft=10]="k1_2in_1ft",n[n.k3_4in_1ft=11]="k3_4in_1ft",n[n.k1in_1ft=12]="k1in_1ft",n[n.k3in_1ft=13]="k3in_1ft",n[n.k6in_1ft=14]="k6in_1ft",n[n.k1ft_1ft=15]="k1ft_1ft",n[n.k1_1=16]="k1_1",n[n.k1_2=17]="k1_2",n[n.k1_4=18]="k1_4",n[n.k1_5=19]="k1_5",n[n.k1_8=20]="k1_8",n[n.k1_10=21]="k1_10",n[n.k1_16=22]="k1_16",n[n.k1_20=23]="k1_20",n[n.k1_30=24]="k1_30",n[n.k1_40=25]="k1_40",n[n.k1_50=26]="k1_50",n[n.k1_100=27]="k1_100",n[n.k2_1=28]="k2_1",n[n.k4_1=29]="k4_1",n[n.k8_1=30]="k8_1",n[n.k10_1=31]="k10_1",n[n.k100_1=32]="k100_1",n[n.k1000_1=33]="k1000_1",n[n.k1and1_2in_1ft=34]="k1and1_2in_1ft",n))(bl||{});const Yu={0:0,1:1/1536,2:1/768,3:1/384,4:1/192,5:1/128,6:1/96,7:1/64,8:1/48,9:1/32,10:1/24,11:1/16,12:1/12,13:1/4,14:1/2,15:1,16:1,17:1/2,18:1/4,19:1/5,20:1/8,21:1/10,22:1/16,23:1/20,24:1/30,25:1/40,26:1/50,27:1/100,28:2,29:4,30:8,31:10,32:100,33:1e3,34:1/8};class xl extends Ge{constructor(e=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new E,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new E,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new xe,this._modelType=e,this._plotCentered=!1,this._plotHidden=!1,this._plotPaperUnits=1,this._plotPlotStyles=!0,this._plotRotation=0,this._plotType=5,this._plotViewportBorders=!1,this._printLineweights=!0,this._scaleLineweights=!1,this._drawViewportsFirst=!1,this._showPlotStyles=!0,this._shadePlotType=0,this._shadePlotResLevel=2,this._shadePlotCustomDpi=300,this._shadePlotId=void 0,this._stdScaleType=0,this._useStandardScale=!0}get plotSettingsName(){return this._plotSettingsName}set plotSettingsName(e){this._plotSettingsName=e}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(e){this._plotSettingsName=e}get plotCfgName(){return this._plotCfgName}set plotCfgName(e){this._plotCfgName=e}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(e){this._canonicalMediaName=e}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(e){this._currentStyleSheet=e}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(e){this._plotOrigin=e}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(e){this._customPrintScale=e}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(e){this._plotPaperSize=e}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(e){this._plotPaperMargins=e}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(e){this._plotViewName=e}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(e){this._plotWindowArea=e}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(e){this._modelType=e}getModelType(){return this._modelType}setModelType(e){this._modelType=e}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(e){this._drawViewportsFirst=e}setDrawViewportsFirst(e){this._drawViewportsFirst=e}get plotCentered(){return this._plotCentered}set plotCentered(e){this._plotCentered=e}setPlotCentered(e){this._plotCentered=e}get plotHidden(){return this._plotHidden}set plotHidden(e){this._plotHidden=e}setPlotHidden(e){this._plotHidden=e}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(e){this._plotPaperUnits=e}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(e){this._plotPlotStyles=e}setPlotPlotStyles(e){this._plotPlotStyles=e}get plotRotation(){return this._plotRotation}set plotRotation(e){this._plotRotation=e}get plotType(){return this._plotType}set plotType(e){this._plotType=e}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(e){this._plotViewportBorders=e}setPlotViewportBorders(e){this._plotViewportBorders=e}get printLineweights(){return this._printLineweights}set printLineweights(e){this._printLineweights=e}setPrintLineweights(e){this._printLineweights=e}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(e){this._scaleLineweights=e}setScaleLineweights(e){this._scaleLineweights=e}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(e){this._showPlotStyles=e}setShowPlotStyles(e){this._showPlotStyles=e}get shadePlot(){return this._shadePlotType}set shadePlot(e){this._shadePlotType=e}setShadePlot(e){this._shadePlotType=e}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(e){this._shadePlotResLevel=e}setShadePlotResLevel(e){this._shadePlotResLevel=e}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(e){this._shadePlotCustomDpi=e}setShadePlotCustomDPI(e){this._shadePlotCustomDpi=e}get shadePlotId(){return this._shadePlotId}set shadePlotId(e){this._shadePlotId=e}get plotWireframe(){return this._shadePlotType===1}get plotAsRaster(){return this._shadePlotType===3||this._shadePlotType===4||this._shadePlotType===5}get stdScaleType(){return this._stdScaleType}set stdScaleType(e){this._stdScaleType=e}get stdScale(){return Yu[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(e){this._useStandardScale=e}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPlotSettings"),e.writeString(1,this.plotSettingsName),e.writeString(2,this.plotCfgName),e.writeString(4,this.canonicalMediaName),e.writeString(6,this.plotViewName),e.writeDouble(40,this.plotPaperMargins.left),e.writeDouble(41,this.plotPaperMargins.bottom),e.writeDouble(42,this.plotPaperMargins.right),e.writeDouble(43,this.plotPaperMargins.top),e.writeDouble(44,this.plotPaperSize.x),e.writeDouble(45,this.plotPaperSize.y),e.writeDouble(46,this.plotOrigin.x),e.writeDouble(47,this.plotOrigin.y),e.writeDouble(48,this.plotWindowArea.min.x),e.writeDouble(49,this.plotWindowArea.min.y),e.writeDouble(140,this.plotWindowArea.max.x),e.writeDouble(141,this.plotWindowArea.max.y),e.writeDouble(142,this.customPrintScale.numerator),e.writeDouble(143,this.customPrintScale.denominator);let t=0;return this.plotViewportBorders&&(t|=1),this.showPlotStyles&&(t|=2),this.plotCentered&&(t|=4),this.plotHidden&&(t|=8),this.useStandardScale&&(t|=16),this.plotPlotStyles&&(t|=32),this.scaleLineweights&&(t|=64),this.printLineweights&&(t|=128),this.drawViewportsFirst&&(t|=512),this.modelType&&(t|=1024),e.writeInt16(70,t),e.writeInt16(72,this.plotPaperUnits),e.writeInt16(73,this.plotRotation),e.writeInt16(74,this.plotType),e.writeString(7,this.currentStyleSheet),e.writeInt16(75,this.stdScaleType),e.writeInt16(76,this.shadePlot),e.writeInt16(77,this.shadePlotResLevel),e.writeInt16(78,this.shadePlotCustomDPI),e.writeDouble(147,this.stdScale),e.writeObjectId(333,this.shadePlotId),this}}class br extends xl{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new xe,this._extents=new B,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}get viewportArray(){return this._viewportArray}set viewportArray(e){this._viewportArray=e.slice()}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLayout"),e.writeString(1,this.layoutName),e.writeInt16(70,this.tabSelected?1:0),e.writeInt16(71,this.tabOrder),e.writeObjectId(330,this.blockTableRecordId),e.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),e.writePoint2d(10,this.limits.min),e.writePoint2d(11,this.limits.max),e.writePoint3d(14,this.extents.min),e.writePoint3d(15,this.extents.max),this}}class wl{constructor(){this.events={layoutCreated:new ie,layoutRemoved:new ie,layoutRenamed:new ie,layoutSwitched:new ie}}countLayouts(e){return this.getWorkingDatabase(e).objects.layout.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).objects.layout.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const r=this.getWorkingDatabase(t),i=r.objects.layout.getIdAt(e);return this.setCurrentLayoutInternal(i,r)}setCurrentLayoutBtrId(e,t){const r=this.getWorkingDatabase(t),i=r.objects.layout.getBtrIdAt(e);return this.setCurrentLayoutInternal(i,r)}setCurrentLayout(e,t){const r=this.getWorkingDatabase(t),i=r.objects.layout.getAt(e);return this.setCurrentLayoutInternal(i,r)}renameLayout(e,t,r){const s=this.getWorkingDatabase(r).objects.layout.getAt(e);return s?(s.layoutName=t,this.events.layoutRenamed.dispatch({layout:s,oldName:e,newName:t}),!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).objects.layout.has(e)}deleteLayout(e,t){const r=this.getWorkingDatabase(t).objects.layout,i=r.getAt(e);let s=!1;return i&&(s=r.remove(e),s&&this.events.layoutRemoved.dispatch({layout:i})),s}createLayout(e,t){const r=this.getWorkingDatabase(t),i=new br;i.layoutName=e,i.tabOrder=r.objects.layout.maxTabOrder;const s=new se;return s.name=`*Paper_Space${i.tabOrder}`,r.tables.blockTable.add(s),r.objects.layout.setAt(e,i),this.events.layoutCreated.dispatch({layout:i}),{layout:i,btr:s}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.objects.layout.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||Hs().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({layout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}let Rr;function Xu(n){Rr=n}function Hs(){return $r.instance}const Si=class Si{constructor(){this._workingDatabase=null}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(e){this._workingDatabase=e}get layoutManager(){return this._layoutManager||(Rr||(Rr=()=>new wl),this._layoutManager=Rr()),this._layoutManager}};Si.instance=new Si;let $r=Si;pl(Hs);var vl=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(vl||{});class Ws{constructor(e){if(this._values=[],e)for(const t of e)this._values.push({...t})}get length(){return this._values.length}at(e){return this._values[e]}add(e){this._values.push(e)}addRange(e){for(const t of e)this._values.push(t)}clear(){this._values.length=0}toArray(){return this._values.map(e=>({...e}))}clone(){return new Ws(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class Us{constructor(e,t,r){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=r,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){return new Promise((t,r)=>{const i=()=>{Promise.resolve(e()).then(t).catch(r)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(i):setTimeout(i,0)})}async processChunk(e,t){if(this._count<=0){await(t==null?void 0:t());return}let r=0;const i=async()=>{const s=r,o=Math.min(r+this._chunkSize,this._count);await e(s,o),r=o,r<this._count&&await this.scheduleTask(i)};await i(),await(t==null?void 0:t())}}var Jn=(n=>(n.DXF="dxf",n.DWG="dwg",n))(Jn||{});class We{constructor(){this.events={registered:new ie,unregistered:new ie},this._converters=new Map,this.register("dxf",new Wh)}static createInstance(){return We._instance==null&&(We._instance=new We),this._instance}static get instance(){return We._instance||(We._instance=new We),We._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}var ve=(n=>(n[n.DecimalDegrees=0]="DecimalDegrees",n[n.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",n[n.Gradians=2]="Gradians",n[n.Radians=3]="Radians",n[n.SurveyorsUnits=4]="SurveyorsUnits",n))(ve||{}),J=(n=>(n[n.Scientific=1]="Scientific",n[n.Decimal=2]="Decimal",n[n.Engineering=3]="Engineering",n[n.Architectural=4]="Architectural",n[n.Fractional=5]="Fractional",n[n.WindowsDesktop=6]="WindowsDesktop",n))(J||{}),K=(n=>(n[n.Undefined=0]="Undefined",n[n.Inches=1]="Inches",n[n.Feet=2]="Feet",n[n.Miles=3]="Miles",n[n.Millimeters=4]="Millimeters",n[n.Centimeters=5]="Centimeters",n[n.Meters=6]="Meters",n[n.Kilometers=7]="Kilometers",n[n.Microinches=8]="Microinches",n[n.Mils=9]="Mils",n[n.Yards=10]="Yards",n[n.Angstroms=11]="Angstroms",n[n.Nanometers=12]="Nanometers",n[n.Microns=13]="Microns",n[n.Decimeters=14]="Decimeters",n[n.Dekameters=15]="Dekameters",n[n.Hectometers=16]="Hectometers",n[n.Gigameters=17]="Gigameters",n[n.Astronomical=18]="Astronomical",n[n.LightYears=19]="LightYears",n[n.Parsecs=20]="Parsecs",n[n.USSurveyFeet=21]="USSurveyFeet",n[n.USSurveyInch=22]="USSurveyInch",n[n.USSurveyYard=23]="USSurveyYard",n[n.USSurveyMile=24]="USSurveyMile",n[n.Max=24]="Max",n))(K||{});function Pl(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function Al(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}const xs=Math.PI/200;class Sl{constructor(e){this.database=e}formatLength(e,t){const r=this.createContext(t);return un(e,r)}formatPoint2d(e,t){const r=this.createContext(t);return`${un(e.x,r)}, ${un(e.y,r)}`}formatPoint3d(e,t){const r=this.createContext(t);return`${un(e.x,r)}, ${un(e.y,r)}, ${un(e.z,r)}`}formatAngle(e,t){const r=this.createContext(t),s=(t==null?void 0:t.applyAngbaseAngdir)??!0?Bu(e,this.database.angbase,this.database.angdir):T.normalizeAngle(e);return Ru(s,r)}createContext(e){return{lunits:this.database.lunits,luprec:ar(this.database.luprec),insunits:this.database.insunits,unitmode:this.database.unitmode,measurement:this.database.measurement,aunits:this.database.aunits,auprec:ar(this.database.auprec),showUnits:(e==null?void 0:e.showUnits)??!1,showApproximate:(e==null?void 0:e.showApproximate)??!1}}}function un(n,e){let t;switch(e.lunits){case J.Scientific:t=Ji(Uu(n,e.luprec),e);break;case J.Engineering:t=$u(n,e);break;case J.Architectural:t=qu(n,e);break;case J.Fractional:t=Ji(Ku(n,e),e);break;case J.WindowsDesktop:case J.Decimal:default:t=Ji(Cn(n,e.luprec),e)}return Ll(t,Fu(n,e),e)}function Ru(n,e){let t;switch(e.aunits){case ve.DegreesMinutesSeconds:t=Tl(n,e);break;case ve.Gradians:t=Ju(n,e);break;case ve.Radians:t=Qu(n,e);break;case ve.SurveyorsUnits:t=eg(n,e);break;case ve.DecimalDegrees:default:t=Zu(n,e)}return Ll(t,Du(n,e),e)}function Bu(n,e,t){let r=n-e;return t===1&&(r=-r),T.normalizeAngle(r)}function $s(n){const e=n.showUnits?'"':"";return n.unitmode===1?{feetInchSeparator:"",fractionSeparator:"-",inchSuffix:e}:{feetInchSeparator:"-",fractionSeparator:" ",inchSuffix:e}}function ar(n,e=0,t=8){return Number.isFinite(n)?Math.max(e,Math.min(t,Math.round(n))):e}function Tn(n){return Object.is(n,-0)?0:n}function Ll(n,e,t){return!t.showApproximate||!e?n:`~ ${n}`}function Fu(n,e){if(!Number.isFinite(n))return!1;const t=Vu(n,e);return qs(n,t)}function Du(n,e){if(!Number.isFinite(n))return!1;if(e.aunits===ve.SurveyorsUnits)return zu(n,e.auprec);const t=ju(n,e);return qs(n,t)}function zu(n,e){const r=((90-T.radToDeg(n))%360+360)%360,i=Cl(r),s=Math.min(Math.abs(r-i.base),Math.abs(i.base+90-r)),o=T.degToRad(s),a=Il(o,e);return qs(o,a)}function Vu(n,e){const t=Tn(n);switch(e.lunits){case J.Scientific:return Gu(t,e.luprec);case J.Engineering:case J.Architectural:case J.Fractional:return Hu(t,e);case J.WindowsDesktop:case J.Decimal:default:return Pn(t,e.luprec)}}function ju(n,e){const t=Tn(n);switch(e.aunits){case ve.DegreesMinutesSeconds:return Il(t,e.auprec);case ve.Gradians:return Pn(t/xs,e.auprec)*xs;case ve.Radians:return Pn(t,e.auprec);case ve.DecimalDegrees:default:return T.degToRad(Pn(T.radToDeg(t),e.auprec))}}function Pn(n,e){if(!Number.isFinite(n))return 0;const t=10**e;return Math.round(Tn(n)*t)/t}function Gu(n,e){if(!Number.isFinite(n))return 0;const t=Tn(n);if(t===0)return 0;const r=t.toExponential(e);return Number(r)}function Hu(n,e){if(!Number.isFinite(n))return 0;const t=n<0?-1:1,r=Math.abs(n),i=Math.floor(r/12),s=r-i*12;if(e.lunits===J.Architectural||e.lunits===J.Fractional){const o=1<<ar(e.luprec,0,8),a=Wu(s,o);return t*(i*12+a)}return t*(i*12+Pn(s,e.luprec))}function Wu(n,e){const t=Math.floor(n),r=n-t,i=Math.round(r*e);return i>=e?t+1:t+i/e}function Il(n,e){const t=T.radToDeg(n),r=t<0?-1:1,i=Math.abs(t),s=Math.floor(i),o=(i-s)*60,a=Math.floor(o),l=Pn((o-a)*60,e),c=s+a/60+l/3600;return T.degToRad(r*c)}function qs(n,e){if(n===e)return!1;const t=Math.max(Math.abs(n),Math.abs(e),1);return Math.abs(n-e)>t*Number.EPSILON*8}function Cn(n,e){if(!Number.isFinite(n))return"0";const t=Tn(n);if(Number.isInteger(t)&&e===0)return String(t);const i=t.toFixed(e).replace(/\.?0+$/,"");return i===""||i==="-"?"0":i}function Uu(n,e){if(!Number.isFinite(n))return"0";const t=Tn(n);if(t===0)return"0";const r=t.toExponential(e).match(/^(.+)e([+-])(\d+)$/i);if(!r)return"0";const[,i,s,o]=r,a=o.length<2?o.padStart(2,"0"):o;return`${i}E${s}${a}`.toUpperCase()}function $u(n,e){if(!Number.isFinite(n))return"0";const t=$s(e),r=n<0?"-":"",i=Math.abs(n),s=Math.floor(i/12),o=i-s*12,a=Cn(o,e.luprec);return s===0?`${r}${a}${t.inchSuffix}`:`${r}${s}'${t.feetInchSeparator}${a}${t.inchSuffix}`}function qu(n,e){if(!Number.isFinite(n))return"0";const t=$s(e),r=n<0?"-":"",i=Math.abs(n),s=Math.floor(i/12),o=i-s*12,a=1<<ar(e.luprec,0,8),l=El(o,a,t.fractionSeparator);return s===0?`${r}${l}${t.inchSuffix}`:`${r}${s}'${t.feetInchSeparator}${l}${t.inchSuffix}`}function Ku(n,e){if(!Number.isFinite(n))return"0";const t=$s(e),r=n<0?"-":"",i=Math.abs(n),s=1<<ar(e.luprec,0,8);return`${r}${El(i,s,t.fractionSeparator)}`}function El(n,e,t){const r=Math.floor(n),i=n-r;let s=Math.round(i*e);if(s>=e)return String(r+1);if(s===0)return String(r);const o=ig(s,e);s/=o;const a=e/o,l=`${s}/${a}`;return r===0?l:`${r}${t}${l}`}function Zu(n,e){const t=T.radToDeg(n);return`${Cn(t,e.auprec)}${e.showUnits?"°":""}`}function Qu(n,e){return`${Cn(n,e.auprec)}${e.showUnits?" rad":""}`}function Ju(n,e){const t=n/xs;return`${Cn(t,e.auprec)}${e.showUnits?"g":""}`}function Tl(n,e){const t=T.radToDeg(n),r=t<0?"-":"",i=Math.abs(t),s=Math.floor(i),o=(i-s)*60,a=Math.floor(o),l=(o-a)*60,c=Cn(l,e.auprec),h=e.showUnits?'"':"";return`${r}${s}d${a}'${c}${h}`}function eg(n,e){const r=((90-T.radToDeg(n))%360+360)%360,i=Cl(r),s=Math.min(Math.abs(r-i.base),Math.abs(i.base+90-r)),a=Tl(T.degToRad(s),e).replace(/^-/,"");return`${i.prefix} ${a} ${i.suffix}`.trim()}function Cl(n){return n<90?{prefix:"N",suffix:"E",base:0}:n<180?{prefix:"S",suffix:"E",base:90}:n<270?{prefix:"S",suffix:"W",base:180}:{prefix:"N",suffix:"W",base:270}}function Ji(n,e){if(!e.showUnits||e.lunits===J.Engineering||e.lunits===J.Architectural)return n;const t=tg(e.insunits,e.measurement);return t?`${n}${t}`:n}function tg(n,e){return n===K.Undefined?e===0?'"':" mm":Pl(n)?ng(n):Al(n)?rg(n):""}function ng(n){switch(n){case K.Millimeters:return" mm";case K.Centimeters:return" cm";case K.Meters:return" m";case K.Kilometers:return" km";case K.Decimeters:return" dm";case K.Microns:return" µm";case K.Nanometers:return" nm";default:return""}}function rg(n){switch(n){case K.Inches:case K.Microinches:case K.Mils:case K.USSurveyInch:return'"';case K.Feet:case K.USSurveyFeet:return"'";case K.Miles:case K.USSurveyMile:return" mi";case K.Yards:case K.USSurveyYard:return" yd";default:return""}}function ig(n,e){let t=Math.abs(n),r=Math.abs(e);for(;r!==0;){const i=r;r=t%r,t=i}return t||1}class an{static get instance(){return this._instance||(this._instance=new an),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,r,i=[],s=!0,o,a){const l=[];if(t!=null){const c=this.createKey(t.name,r);let h;if(this.has(c))h=this.get(c);else{const d=t.newIterator();for(const p of d)p.visibility&&(p.color.isByBlock&&r?(oa.copy(p.color),p.color.setRGBValue(r),this.addEntity(p,l,e),p.color.copy(oa)):this.addEntity(p,l,e));h=e.group(l),h&&s&&se.name&&!se.name.startsWith("*U")&&this.set(c,h)}return h&&o&&(h.applyMatrix(o),a&&(a.x!=0||a.y!=0||a.z!=1)&&(o.setFromExtrusionDirection(a),h.applyMatrix(o))),h&&i&&i.length>0&&(h.bakeTransformToChildren(),i.forEach(d=>h.addChild(d))),h}else return e.group(l)}addEntity(e,t,r){if(!e.visibility)return;const i=e.worldDraw(r);i&&(this.attachEntityInfo(i,e),t.push(i))}attachEntityInfo(e,t){e.objectId=t.objectId,e.ownerId=t.ownerId,e.layerName=t.layer,e.visible=t.visibility}}const oa=new R;var Ks=(n=>(n[n.UTF8=0]="UTF8",n[n.US_ASCII=1]="US_ASCII",n[n.ISO_8859_1=2]="ISO_8859_1",n[n.ISO_8859_2=3]="ISO_8859_2",n[n.ISO_8859_3=4]="ISO_8859_3",n[n.ISO_8859_4=5]="ISO_8859_4",n[n.ISO_8859_5=6]="ISO_8859_5",n[n.ISO_8859_6=7]="ISO_8859_6",n[n.ISO_8859_7=8]="ISO_8859_7",n[n.ISO_8859_8=9]="ISO_8859_8",n[n.ISO_8859_9=10]="ISO_8859_9",n[n.CP437=11]="CP437",n[n.CP850=12]="CP850",n[n.CP852=13]="CP852",n[n.CP855=14]="CP855",n[n.CP857=15]="CP857",n[n.CP860=16]="CP860",n[n.CP861=17]="CP861",n[n.CP863=18]="CP863",n[n.CP864=19]="CP864",n[n.CP865=20]="CP865",n[n.CP869=21]="CP869",n[n.CP932=22]="CP932",n[n.MACINTOSH=23]="MACINTOSH",n[n.BIG5=24]="BIG5",n[n.CP949=25]="CP949",n[n.JOHAB=26]="JOHAB",n[n.CP866=27]="CP866",n[n.ANSI_1250=28]="ANSI_1250",n[n.ANSI_1251=29]="ANSI_1251",n[n.ANSI_1252=30]="ANSI_1252",n[n.GB2312=31]="GB2312",n[n.ANSI_1253=32]="ANSI_1253",n[n.ANSI_1254=33]="ANSI_1254",n[n.ANSI_1255=34]="ANSI_1255",n[n.ANSI_1256=35]="ANSI_1256",n[n.ANSI_1257=36]="ANSI_1257",n[n.ANSI_874=37]="ANSI_874",n[n.ANSI_932=38]="ANSI_932",n[n.ANSI_936=39]="ANSI_936",n[n.ANSI_949=40]="ANSI_949",n[n.ANSI_950=41]="ANSI_950",n[n.ANSI_1361=42]="ANSI_1361",n[n.UTF16=43]="UTF16",n[n.ANSI_1258=44]="ANSI_1258",n[n.UNDEFINED=255]="UNDEFINED",n))(Ks||{});const sg=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],Ml=n=>sg[n],Mt="Continuous",ae="Standard",ft="Standard",mt="Standard",og="ANSI31",Ol="ANGLE",rn="SOLID",kl="USER",Nl="LINEAR",fe="ByLayer",Ct="ByBlock",lr="*Active",ws="mlightcad",vs="ACAD",Ps=Object.freeze({x:0,y:0}),Yl=Object.freeze({x:0,y:0}),Xl=Object.freeze({x:1,y:1}),Rl=Object.freeze({x:0,y:0,z:1}),Bl=Object.freeze({x:0,y:0,z:0});exports.AcGiArrowType=void 0;(function(n){n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK"})(exports.AcGiArrowType||(exports.AcGiArrowType={}));exports.AcGiLineWeight=void 0;(function(n){n[n.ByBlock=-2]="ByBlock",n[n.ByDIPs=-4]="ByDIPs",n[n.ByLayer=-1]="ByLayer",n[n.ByLineWeightDefault=-3]="ByLineWeightDefault",n[n.LineWeight000=0]="LineWeight000",n[n.LineWeight005=5]="LineWeight005",n[n.LineWeight009=9]="LineWeight009",n[n.LineWeight013=13]="LineWeight013",n[n.LineWeight015=15]="LineWeight015",n[n.LineWeight018=18]="LineWeight018",n[n.LineWeight020=20]="LineWeight020",n[n.LineWeight025=25]="LineWeight025",n[n.LineWeight030=30]="LineWeight030",n[n.LineWeight035=35]="LineWeight035",n[n.LineWeight040=40]="LineWeight040",n[n.LineWeight050=50]="LineWeight050",n[n.LineWeight053=53]="LineWeight053",n[n.LineWeight060=60]="LineWeight060",n[n.LineWeight070=70]="LineWeight070",n[n.LineWeight080=80]="LineWeight080",n[n.LineWeight090=90]="LineWeight090",n[n.LineWeight100=100]="LineWeight100",n[n.LineWeight106=106]="LineWeight106",n[n.LineWeight120=120]="LineWeight120",n[n.LineWeight140=140]="LineWeight140",n[n.LineWeight158=158]="LineWeight158",n[n.LineWeight200=200]="LineWeight200",n[n.LineWeight211=211]="LineWeight211"})(exports.AcGiLineWeight||(exports.AcGiLineWeight={}));exports.AcGiMTextFlowDirection=void 0;(function(n){n[n.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",n[n.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",n[n.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",n[n.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",n[n.BY_STYLE=5]="BY_STYLE"})(exports.AcGiMTextFlowDirection||(exports.AcGiMTextFlowDirection={}));exports.AcGiMTextAttachmentPoint=void 0;(function(n){n[n.TopLeft=1]="TopLeft",n[n.TopCenter=2]="TopCenter",n[n.TopRight=3]="TopRight",n[n.MiddleLeft=4]="MiddleLeft",n[n.MiddleCenter=5]="MiddleCenter",n[n.MiddleRight=6]="MiddleRight",n[n.BottomLeft=7]="BottomLeft",n[n.BottomCenter=8]="BottomCenter",n[n.BottomRight=9]="BottomRight",n[n.BaselineLeft=10]="BaselineLeft",n[n.BaselineCenter=11]="BaselineCenter",n[n.BaselineRight=12]="BaselineRight"})(exports.AcGiMTextAttachmentPoint||(exports.AcGiMTextAttachmentPoint={}));exports.AcGiRenderMode=void 0;(function(n){n[n.OPTIMIZED_2D=0]="OPTIMIZED_2D",n[n.WIREFRAME=1]="WIREFRAME",n[n.HIDDEN_LINE=2]="HIDDEN_LINE",n[n.FLAT_SHADED=3]="FLAT_SHADED",n[n.GOURAUD_SHADED=4]="GOURAUD_SHADED",n[n.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",n[n.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME"})(exports.AcGiRenderMode||(exports.AcGiRenderMode={}));exports.AcGiOrthographicType=void 0;(function(n){n[n.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",n[n.TOP=1]="TOP",n[n.BOTTOM=2]="BOTTOM",n[n.FRONT=3]="FRONT",n[n.BACK=4]="BACK",n[n.LEFT=5]="LEFT",n[n.RIGHT=6]="RIGHT"})(exports.AcGiOrthographicType||(exports.AcGiOrthographicType={}));exports.AcGiDefaultLightingType=void 0;(function(n){n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS"})(exports.AcGiDefaultLightingType||(exports.AcGiDefaultLightingType={}));var Fl=function(){function n(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new b,this._height=0,this._width=0,this._viewCenter=new b,this._viewHeight=0}return Object.defineProperty(n.prototype,"number",{get:function(){return this._number},set:function(e){this._number=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"id",{get:function(){return this._id},set:function(e){this._id=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"groupId",{get:function(){return this._groupId},set:function(e){this._groupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"centerPoint",{get:function(){return this._centerPoint},set:function(e){this._centerPoint.copy(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"box",{get:function(){var e=new xe;return e.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewCenter",{get:function(){return this._viewCenter},set:function(e){this._viewCenter.copy(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewHeight",{get:function(){return this._viewHeight},set:function(e){this._viewHeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewWidth",{get:function(){return this.viewHeight*(this.width/this.height)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewBox",{get:function(){var e=new xe;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var e=new n;return e.id=this.id,e.groupId=this.groupId,e.number=this.number,e.centerPoint.copy(this.centerPoint),e.height=this.height,e.width=this.width,e.viewCenter.copy(this.viewCenter),e.viewHeight=this.viewHeight,e},n.prototype.copy=function(e){return this.id=e.id,this.groupId=e.groupId,this.number=e.number,this.centerPoint.copy(e.centerPoint),this.height=e.height,this.width=e.width,this.viewCenter.copy(e.viewCenter),this.viewHeight=e.viewHeight,this},n}();const co=class co extends Ge{constructor(){super(...arguments),this._visibility=!0,this._transparency=new te,this._transparencySet=!1}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(e){this._layer=e}get color(){return this.getEntityColor()}set color(e){this.setEntityColor(e)}get resolvedColor(){var t;let e=this.color;if(e.isByLayer){const r=this.getLayerColor();r&&r.RGB!=null&&(e=r)}else if(e.isByBlock){const r=this.database.cecolor;if(r&&(e=r,e.isByLayer)){const i=this.database.clayer||this.layer,s=this.database.tables.layerTable.getAt(i);((t=s==null?void 0:s.color)==null?void 0:t.RGB)!=null&&(e=s.color)}}return e}get rgbColor(){const t=this.resolvedColor.RGB;return t??16777215}get lineType(){var e;return this._lineType==null&&(this._lineType=((e=this.database)==null?void 0:e.celtype)??fe),this._lineType}set lineType(e){e?e.toUpperCase()==="BYLAYER"?this._lineType=fe:e.toUpperCase()==="BYBLOCK"?this._lineType=Ct:this._lineType=e:this._lineType=fe}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer),this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e.clone(),this._transparencySet=!0}hasExplicitLayer(){return this._layer!=null}hasExplicitColor(){return this._color!=null}getEntityColor(){return this._color==null&&(this._color=new R,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}setEntityColor(e){this._color==null&&(this._color=new R),this._color.copy(e)}shouldResolveColorFromCecolor(){return!0}hasExplicitTransparency(){return this._transparencySet}dxfOutFields(e){e.writeSubclassMarker("AcDbEntity"),e.writeString(8,this.layer),e.writeString(6,this.lineType),e.writeDouble(48,this.linetypeScale),e.writeInt16(60,this.visibility?0:1),e.writeCmColor(this.color),e.writeInt16(370,this.lineWeight),e.writeTransparency(this.transparency);const t=this.database.tables.blockTable.getIdAt(this.ownerId);return t!=null&&t.isPaperSapce&&e.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new R,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??fe),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,r,i,s,o){}transformBy(e){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(e,t){if(!this.database.isLayerDrawable(this.layer))return;const r=e.subEntityTraits;r.color=this.resolvedColor,r.rgbColor=this.rgbColor,r.lineType=this.lineStyle,r.lineTypeScale=this.linetypeScale,r.lineWeight=this.lineWeight,r.transparency=this.transparency,r.layer=this.layer,r.drawOrder=0,"thickness"in this&&(r.thickness=this.thickness);const i=this.subWorldDraw(e,t);return this.attachEntityInfo(i),i}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:e=>{this.color=e}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:e=>{this.layer=e}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:e=>{this.lineType=e}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:e=>{this.linetypeScale=e}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:e=>{this.lineWeight=e}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:e=>{this.transparency=e}}}]}}get lineStyle(){var i;const{type:e,name:t}=this.getLineType(),r=(i=this.database)==null?void 0:i.tables.linetypeTable.getAt(t);return r?{type:e,...r.linetype}:{type:e,name:t,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==fe){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return{type:"ByLayer",name:e.linetype}}else return this.lineType==Ct?{type:"ByBlock",name:Mt}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:Mt}}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);return e!=null?e.color:null}attachEntityInfo(e){e&&(e.objectId=this.objectId,this.attrs.has("ownerId")&&(e.ownerId=this.ownerId),e.layerName=this.layer,e.visible=this.visibility)}};co.typeName="Entity";let le=co;const ho=class ho extends le{getOffsetSideAtPoint(e){return 1}};ho.typeName="Curve";let ge=ho;function aa(n,e){const t=n.x-e.x,r=n.y-e.y,i=(n.z||0)-(e.z||0);return t*t+r*r+i*i}function Be(n,e){if(e.length===0)return;let t=new b(e[0].x,e[0].y,e[0].z||0),r=aa(n,t);for(let i=1;i<e.length;i++){const s=e[i],o=new b(s.x,s.y,s.z||0),a=aa(n,o);a<r&&(t=o,r=a)}return t}function Mn(n,e,t,r,i){const s=new b(n.x,n.y,n.z||0),o=new b(e.x,e.y,e.z||0),a=new bt(s,o);switch(t){case v.EndPoint:i.push(s,o);break;case v.MidPoint:i.push(a.midPoint);break;case v.Nearest:i.push(a.nearestPoint(r));break;case v.Perpendicular:i.push(a.perpPoint(r));break}}function qr(n,e,t,r,i,s,o){if(t){const a=new Re(n,e,t);switch(i){case v.EndPoint:o.push(new b(a.startPoint.x,a.startPoint.y,r),new b(a.endPoint.x,a.endPoint.y,r));break;case v.MidPoint:o.push(new b(a.midPoint.x,a.midPoint.y,r));break;case v.Nearest:{const l=a.nearestPoint({x:s.x,y:s.y});o.push(new b(l.x,l.y,r));break}case v.Perpendicular:{a.perpendicularPoints({x:s.x,y:s.y}).forEach(c=>o.push(new b(c.x,c.y,r)));break}case v.Tangent:{a.tangentPoints({x:s.x,y:s.y}).forEach(c=>o.push(new b(c.x,c.y,r)));break}}return}Mn(new b(n.x,n.y,r),new b(e.x,e.y,r),i,s,o)}function Zs(n,e,t,r,i){if(n.length!==0)switch(t){case v.EndPoint:n.forEach(s=>i.push(new b(s.x,s.y,s.z||0)));break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const s=n.length,o=[];for(let a=0;a<s;a++){const l=[];Mn(n[a],n[(a+1)%n.length],t,r,l),o.push(...l)}if(t===v.MidPoint)i.push(...o);else{const a=Be(r,o);a&&i.push(a)}break}}}const bn=class bn extends ge{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new ee}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,r=0,i=-1,s=-1){const o=i<0?void 0:i,a=s<0?void 0:s,l={x:t.x,y:t.y,bulge:r,startWidth:o,endWidth:a};this._geo.addVertexAt(e,l)}removeVertexAt(e){this._geo.removeVertexAt(e)}reset(e,t){this._geo.reset(e,t)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new b(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new B({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}subGetOsnapPoints(e,t,r,i){var l;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(e){case v.EndPoint:for(let c=0;c<a;c++){const h=s.getPointAt(c);i.push(new b(h.x,h.y,o))}break;case v.MidPoint:case v.Nearest:case v.Perpendicular:case v.Tangent:{const c=this.closed?a:a-1,h=[];for(let d=0;d<c;d++){const p=[];qr(s.getPointAt(d),s.getPointAt((d+1)%a),(l=s.vertices[d])==null?void 0:l.bulge,o,e,t,p),h.push(...p)}if(e===v.MidPoint)i.push(...h);else{const d=Be(t,h);d&&i.push(d)}break}}}transformBy(e){const t=e.determinant()<0;let r=this._elevation;return this._geo.vertices.forEach(i=>{const s=new b(i.x,i.y,this._elevation).applyMatrix4(e);i.x=s.x,i.y=s.y,r=s.z,t&&i.bulge!=null&&(i.bulge=-i.bulge)}),this._elevation=r,this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:e=>{this.elevation=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=this._geo.getPoints(100),r=this.createWidthProfile();if(r!=null){const s=ag(r,this.closed);if(s!=null){const o=e.subEntityTraits;return o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.area(s)}}const i=[];return t.forEach(s=>i.push(new b().set(s.x,s.y,this.elevation))),e.lines(i)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolyline"),e.writeInt32(90,this.numberOfVertices),e.writeInt16(70,this.closed?1:0),e.writeDouble(38,this.elevation);for(let t=0;t<this.numberOfVertices;++t)e.writePoint2d(10,this.getPoint2dAt(t));return this}createWidthProfile(){const e=this._geo.vertices,t=e.length;if(t<2)return null;const r=this.closed?t:t-1,i=[];let s=!1;for(let o=0;o<r;o++){const a=e[o],l=e[(o+1)%t],c=Math.max(0,a.startWidth??0),h=Math.max(0,a.endWidth??0);(c>Ne||h>Ne)&&(s=!0);const d=this.sampleSegment(a,l),p=d.length-1;for(let g=0;g<=p;g++){if(g===0&&i.length>0||this.closed&&o===r-1&&g===p)continue;const f=p>0?g/p:0;i.push({x:d[g].x,y:d[g].y,width:dg(c,h,f)})}}return s&&i.length>=2?i:null}sampleSegment(e,t){if(e.bulge&&Math.abs(e.bulge)>Ne){const i=new Re(e,t,e.bulge).getPoints(32);if(i.length>1)return i.map(s=>new E(s.x,s.y))}return[new E(e.x,e.y),new E(t.x,t.y)]}static from2dPoints(e,t){const r=new bn;return e.forEach((i,s)=>r.addVertexAt(s,i)),r.closed=t,r}static fromGePolyline(e){const t=new bn;return e.vertices.forEach((r,i)=>{t.addVertexAt(i,new E(r.x,r.y),r.bulge??0)}),t.closed=e.closed,t}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.numberOfVertices;let r=1/0,i=1;const s=this.closed?t:t-1;for(let o=0;o<s;o++){const a=this.getPoint2dAt(o),l=this.getPoint2dAt((o+1)%t),c=l.x-a.x,h=l.y-a.y,d=c*c+h*h;if(d===0)continue;const p=Math.max(0,Math.min(1,((e.x-a.x)*c+(e.y-a.y)*h)/d)),g=(e.x-a.x-p*c)**2+(e.y-a.y-p*h)**2;g<r&&(r=g,i=c*(e.y-a.y)-h*(e.x-a.x)>=0?1:-1)}return i}createOffsetCurve(e){const t=this._geo.offset(e);return t.length===0?null:bn.fromGePolyline(t[0])}};bn.typeName="Polyline";let Ae=bn;function Ri(n,e,t){const r=du(n,e,t);return r?Ae.fromGePolyline(r):null}const Ne=1e-6,la=4;function ag(n,e){if(n.length<2)return null;const t=cg(n,e);if(t.length<2)return null;const{left:r,right:i}=lg(t,e);if(r.length<2||i.length<2)return null;const s=new Nt;if(e){if(!es(r)||!es(i))return null;const a=Math.abs(As(r)),l=Math.abs(As(i)),[c,h]=a>=l?[r,i]:[i,r];return s.add(new ee(c,!0)),s.add(new ee(h,!0)),s}const o=[...r,...i.reverse()];return es(o)?(s.add(new ee(o,!0)),s):null}function lg(n,e){const t=[],r=[];for(let i=0;i<n.length;i++){const s=n[i],o=Math.max(0,s.width)/2;if(o<=Ne)continue;const a=hg(n,i,e);a!=null&&(t.push({x:s.x+a.x*o,y:s.y+a.y*o}),r.push({x:s.x-a.x*o,y:s.y-a.y*o}))}return{left:t,right:r}}function cg(n,e){const t=[];if(n.forEach(r=>{const i=t[t.length-1];(!i||Math.abs(i.x-r.x)>Ne||Math.abs(i.y-r.y)>Ne||Math.abs(i.width-r.width)>Ne)&&t.push(r)}),e&&t.length>1){const r=t[0],i=t[t.length-1];Math.abs(r.x-i.x)<=Ne&&Math.abs(r.y-i.y)<=Ne&&t.pop()}return t}function hg(n,e,t){const r=n.length,i=n[e],s=n[(e-1+r)%r],o=n[(e+1)%r];let a=ca(i.x-s.x,i.y-s.y),l=ca(o.x-i.x,o.y-i.y);if(t||(e===0&&(a=l),e===r-1&&(l=a)),a==null&&l==null)return null;if(a==null)return Cr(l);if(l==null)return Cr(a);const c=Cr(a),h=Cr(l),d=c.x+h.x,p=c.y+h.y,g=Math.hypot(d,p);if(g<=Ne)return h;const f={x:d/g,y:p/g},m=Math.abs(f.x*h.x+f.y*h.y),y=m<=Ne?la:Math.min(1/m,la);return{x:f.x*y,y:f.y*y}}function ca(n,e){const t=Math.hypot(n,e);return t<=Ne?null:{x:n/t,y:e/t}}function Cr(n){return{x:-n.y,y:n.x}}function As(n){let e=0;const t=n.length;for(let r=0;r<t;r++){const i=n[r],s=n[(r+1)%t];e+=i.x*s.y-s.x*i.y}return e/2}function es(n){return n.length>=3&&Math.abs(As(n))>Ne}function dg(n,e,t){return n+(e-n)*t}var _n=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.FitCurvePoly=1]="FitCurvePoly",n[n.QuadSplinePoly=2]="QuadSplinePoly",n[n.CubicSplinePoly=3]="CubicSplinePoly",n))(_n||{});const uo=class uo extends ge{get dxfTypeName(){return"POLYLINE"}constructor(e,t,r=0,i=!1,s=0,o=0,a=null){super(),this._polyType=e,this._elevation=r;const l=a&&(a==null?void 0:a.length)===t.length,c=t.map((h,d)=>({x:h.x,y:h.y,bulge:l?a[d]:void 0}));this._geo=new ee(c,i)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(e){return this._geo.getPointAt(e)}getBulgeAt(e){const t=this._geo.vertices[e];return(t==null?void 0:t.bulge)||0}get geometricExtents(){const e=this._geo.box;return new B({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this._geo.numberOfVertices;++t){const r=this._geo.getPointAt(t);e.push(new b(r.x,r.y,this._elevation))}return e}subGetOsnapPoints(e,t,r,i){var l;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(e){case v.EndPoint:for(let c=0;c<a;c++){const h=s.getPointAt(c);i.push(new b(h.x,h.y,o))}break;case v.MidPoint:case v.Nearest:case v.Perpendicular:case v.Tangent:{const c=this.closed?a:a-1,h=[];for(let d=0;d<c;d++){const p=[];qr(s.getPointAt(d),s.getPointAt((d+1)%a),(l=s.vertices[d])==null?void 0:l.bulge,o,e,t,p),h.push(...p)}if(e===v.MidPoint)i.push(...h);else{const d=Be(t,h);d&&i.push(d)}break}}}transformBy(e){const t=e.determinant()<0;let r=this._elevation;return this._geo.vertices.forEach(i=>{const s=new b(i.x,i.y,this._elevation).applyMatrix4(e);i.x=s.x,i.y=s.y,r=s.z,t&&i.bulge!=null&&(i.bulge=-i.bulge)}),this._elevation=r,this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:e=>{this.elevation=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=[];return this._geo.getPoints(100).forEach(i=>t.push(new b().set(i.x,i.y,this.elevation))),e.lines(t)}dxfOut(e,t=!1){super.dxfOut(e,t);for(let r=0;r<this.numberOfVertices;++r)e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb2dVertex"),e.writePoint3d(10,{x:this.getPointAt(r).x,y:this.getPointAt(r).y,z:this.elevation}),e.writeDouble(42,this.getBulgeAt(r)),e.writeInt16(70,0);return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDb2dPolyline");let t=this.closed?1:0;return this.polyType===1&&(t|=2),this.polyType===2&&(t|=4),this.polyType===3&&(t|=8),e.writeInt16(66,this.numberOfVertices>0?1:0),e.writeInt16(70,t),e.writeDouble(10,0),e.writeDouble(20,0),e.writeDouble(30,this.elevation),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectPath2d();return t.length<2?1:Ae.from2dPoints(t,this.closed).getOffsetSideAtPoint(e)}createOffsetCurve(e){const t=this._geo.offset(e);return t.length===0?null:Ae.fromGePolyline(t[0])}collectPath2d(){const e=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(e)}};uo.typeName="2dPolyline";let Kr=uo;var Dl=(n=>(n[n.Vertex=0]="Vertex",n[n.CurveFitVertex=1]="CurveFitVertex",n[n.SplineFitVertex=8]="SplineFitVertex",n[n.SplineCtlVertex=9]="SplineCtlVertex",n))(Dl||{});const go=class go extends le{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new b,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(e){this._position.copy(e)}get bulge(){return this._bulge}set bulge(e){this._bulge=e}get startWidth(){return this._startWidth}set startWidth(e){this._startWidth=e}get endWidth(){return this._endWidth}set endWidth(e){this._endWidth=e}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new B().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}subGetOsnapPoints(e,t,r,i){(e===v.EndPoint||e===v.Node)&&i.push(this._position)}transformBy(e){return this._position.applyMatrix4(e),this}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb2dVertex"),e.writePoint2d(10,this.position),e.writeDouble(40,this.startWidth),e.writeDouble(41,this.endWidth),e.writeDouble(42,this.bulge),e.writeInt16(70,this.vertexType),this}};go.typeName="2dVertex";let Ss=go;var er=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.QuadSplinePoly=1]="QuadSplinePoly",n[n.CubicSplinePoly=2]="CubicSplinePoly",n))(er||{});const Li=class Li extends ge{get dxfTypeName(){return"POLYLINE"}constructor(e,t,r=!1){super(),this._polyType=e,this._geo=new ee(t,r)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(e){const t=this._geo.vertices[e];return new b(t.x,t.y,t.z||0)}get geometricExtents(){const e=this._geo.vertices.map(t=>new b(t.x,t.y,t.z||0));return new B().setFromPoints(e)}subGetGripPoints(){const e=new Array;for(let t=0;t<this._geo.numberOfVertices;++t)e.push(this.getPointAt(t));return e}subGetOsnapPoints(e,t,r,i){const s=Array.from({length:this._geo.numberOfVertices},(o,a)=>this.getPointAt(a));if(s.length!==0)switch(e){case v.EndPoint:i.push(...s);break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];Mn(s[a],s[a+1],e,t,l),o.push(...l)}if(e===v.MidPoint)i.push(...o);else{const a=Be(t,o);a&&i.push(a)}break}}}transformBy(e){return this._geo.vertices.forEach(t=>{const r=new b(t.x,t.y,t.z||0).applyMatrix4(e);t.x=r.x,t.y=r.y,t.z=r.z}),this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=this._geo.vertices.map(r=>new b(r.x,r.y,r.z||0));return e.lines(t)}dxfOut(e,t=!1){super.dxfOut(e,t);for(let r=0;r<this.numberOfVertices;++r){const i=this.getPointAt(r);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb3dPolylineVertex"),e.writePoint3d(10,{x:i.x,y:i.y,z:i.z}),e.writeInt16(70,32)}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDb3dPolyline");let t=this.closed?1:0;return t|=8,this.polyType===1&&(t|=16),this.polyType===2&&(t|=32),e.writeInt16(66,this.numberOfVertices>0?1:0),e.writeInt16(70,t),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectPath2d();return t.length<2?1:Ae.from2dPoints(t,this.closed).getOffsetSideAtPoint(e)}createOffsetCurve(e){const t=this._geo.offset(e);if(t.length===0)return null;const r=t[0],i=[];for(let s=0;s<r.numberOfVertices;s++){const o=r.getPointAt(s);i.push(new b(o.x,o.y,this.interpolateZ(o.x,o.y)))}return new Li(this.polyType,i,this.closed)}collectPath2d(){const e=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(e)}interpolateZ(e,t){const r=this.numberOfVertices;if(r<=0)return 0;let i=1/0,s=this.getPointAt(0).z;const o=this.closed?r:r-1;for(let a=0;a<o;a++){const l=this.getPointAt(a),c=this.getPointAt((a+1)%r),h=c.x-l.x,d=c.y-l.y,p=h*h+d*d;if(p===0)continue;const g=Math.max(0,Math.min(1,((e-l.x)*h+(t-l.y)*d)/p)),f=l.x+h*g,m=l.y+d*g,y=(e-f)**2+(t-m)**2;y<i&&(i=y,s=l.z+(c.z-l.z)*g)}return s}};Li.typeName="3dPolyline";let Zr=Li;var zl=(n=>(n[n.SimpleVertex=0]="SimpleVertex",n[n.ControlVertex=1]="ControlVertex",n[n.FitVertex=2]="FitVertex",n))(zl||{});const po=class po extends le{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new b,this._vertexType=0}get position(){return this._position}set position(e){this._position.copy(e)}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new B().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}subGetOsnapPoints(e,t,r,i){(e===v.EndPoint||e===v.Node)&&i.push(this._position)}transformBy(e){return this._position.applyMatrix4(e),this}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb3dPolylineVertex"),e.writePoint3d(10,this.position),e.writeInt16(70,this.vertexType|32),this}};po.typeName="3dVertex";let Ls=po;const Ii=class Ii extends ge{get dxfTypeName(){return"ARC"}constructor(e,t,r,i,s=x.Z_AXIS){super();const o=js(s);this._geo=new Xi(e,t,r,i,s,o)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>T.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,r,i){const s=this.startPoint,o=this.endPoint;switch(e){case v.EndPoint:i.push(s),i.push(o);break;case v.MidPoint:i.push(this.midPoint);break;case v.Center:case v.Centroid:i.push(this._geo.center);break;case v.Quadrant:{const a=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const l of a)T.isBetweenAngle(l,this.startAngle,this.endAngle)&&i.push(this._geo.getPointAtAngle(l));break}case v.Nearest:{const a=this._geo.nearestPoint(t);i.push(a)}break;case v.Perpendicular:{const a=this._geo.perpendicularPoints(t),l=Be(t,a);l&&i.push(l);break}case v.Tangent:{const a=this._geo.tangentPoints(t);i.push(...a);break}}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){return e.circularArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e);const t=sr(this.center,this.normal);return e.writeSubclassMarker("AcDbArc"),e.writePoint3d(10,t),e.writeDouble(40,this.radius),e.writeAngle(50,gs(this.center,this.startPoint,this.normal)),e.writeAngle(51,gs(this.center,this.endPoint,this.normal)),e.writeVector3d(210,this.normal),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.center,r=this.radius;return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)>=r?1:-1}createOffsetCurve(e){const t=this._geo.offset(e);return t?new Ii(t.center,t.radius,t.startAngle,t.endAngle,t.normal):null}};Ii.typeName="Arc";let Qr=Ii;const ug=1;function Vl(n){return n.replace(/\\[PpNn]/g,`
|
|
4
|
+
`).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,"")}function jl(n,e,t=1){if(!n||e<=0)return 0;const r=Vl(n),i=Math.max(...r.split(/\r\n|\r|\n/g).map(s=>s.length),0);return i===0?0:Math.max(e,i*e*ug*t)}function gg(n){const e=Vl(n);return Math.max(e.split(/\r\n|\r|\n/g).length,1)}function pg(n,e,t){if(e<=0||n<=0)return 0;if(n===1)return e;const r=Math.max(t,0);return e+(n-1)*e*r}function fg(n,e,t){switch(t){case exports.AcGiMTextAttachmentPoint.TopCenter:return{minX:-n/2,minY:-e,maxX:n/2,maxY:0};case exports.AcGiMTextAttachmentPoint.TopRight:return{minX:-n,minY:-e,maxX:0,maxY:0};case exports.AcGiMTextAttachmentPoint.MiddleLeft:return{minX:0,minY:-e/2,maxX:n,maxY:e/2};case exports.AcGiMTextAttachmentPoint.MiddleCenter:return{minX:-n/2,minY:-e/2,maxX:n/2,maxY:e/2};case exports.AcGiMTextAttachmentPoint.MiddleRight:return{minX:-n,minY:-e/2,maxX:0,maxY:e/2};case exports.AcGiMTextAttachmentPoint.BottomLeft:case exports.AcGiMTextAttachmentPoint.BaselineLeft:return{minX:0,minY:0,maxX:n,maxY:e};case exports.AcGiMTextAttachmentPoint.BottomCenter:case exports.AcGiMTextAttachmentPoint.BaselineCenter:return{minX:-n/2,minY:0,maxX:n/2,maxY:e};case exports.AcGiMTextAttachmentPoint.BottomRight:case exports.AcGiMTextAttachmentPoint.BaselineRight:return{minX:-n,minY:0,maxX:0,maxY:e};case exports.AcGiMTextAttachmentPoint.TopLeft:default:return{minX:0,minY:-e,maxX:n,maxY:0}}}function mg(n,e){let t;e&&e.lengthSq()>0?t=e.clone().normalize():t=new x(Math.cos(n),Math.sin(n),0);const r=new x(-t.y,t.x,t.z);return r.lengthSq()===0?r.set(0,1,0):r.normalize(),{xAxis:t,yAxis:r}}function Gl(n,e,t,r,i,s=0,o){if(t<=0&&r<=0)return n.expandByPoint(e),n;const a=fg(t,r,i),{xAxis:l,yAxis:c}=mg(s,o?new x(o.x,o.y,o.z||0):void 0),h=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]];for(const[d,p]of h)n.expandByPoint(new b(e.x+l.x*d+c.x*p,e.y+l.y*d+c.y*p,e.z+l.z*d+c.z*p));return n}var Hl=(n=>(n[n.LEFT=0]="LEFT",n[n.CENTER=1]="CENTER",n[n.RIGHT=2]="RIGHT",n[n.ALIGNED=3]="ALIGNED",n[n.MIDDLE=4]="MIDDLE",n[n.FIT=5]="FIT",n))(Hl||{}),Wl=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(Wl||{});const fo=class fo extends le{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new b,this._alignmentPoint=new b,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get alignmentPoint(){return this._alignmentPoint}set alignmentPoint(e){this._alignmentPoint.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){const e=new B,{anchor:t,attachmentPoint:r}=this.resolveTextAnchor(),i=jl(this.textString,this.height,this.widthFactor);return Gl(e,t,i,this.height,r,this.rotation)}subGetGripPoints(){return[this._position]}subGetOsnapPoints(e,t,r,i){v.Insertion===e&&i.push(this._position)}transformBy(e){const t=this._position.clone(),r=this._position.clone().add(new x(Math.cos(this._rotation),Math.sin(this._rotation),0)),i=this._position.clone().add(new x(-Math.sin(this._rotation),Math.cos(this._rotation),0)),s=this._position.clone().add(new x(0,0,1));t.applyMatrix4(e),r.applyMatrix4(e),i.applyMatrix4(e),s.applyMatrix4(e);const o=new x(r).sub(t),a=new x(i).sub(t),l=new x(s).sub(t),c=a.length(),h=o.length(),d=l.length();return this._position.copy(t),h>0&&(this._rotation=Math.atan2(o.y,o.x)),c>0&&(this._height*=c,h>0&&(this._widthFactor*=h/c)),d>0&&(this._thickness*=d),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:e=>{this.textString=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:e=>{this.widthFactor=e}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:e=>{this.oblique=e}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}subWorldDraw(e,t){const{anchor:r,attachmentPoint:i}=this.resolveTextAnchor(),s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:r,rotation:this.rotation,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:i};return e.mtext(s,this.getTextStyle(),t)}resolveTextAnchor(){const e=this.resolveAttachmentPoint();if(e===exports.AcGiMTextAttachmentPoint.BaselineLeft)return{anchor:this._position,attachmentPoint:e};const t=this._alignmentPoint;return t.x===0&&t.y===0&&t.z===0||t.x===this._position.x&&t.y===this._position.y&&t.z===this._position.z?{anchor:this._position,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft}:{anchor:t,attachmentPoint:e}}resolveAttachmentPoint(){const e=this._horizontalMode,t=this._verticalModel;if(e===4)return exports.AcGiMTextAttachmentPoint.MiddleCenter;if(e===3||e===5)return exports.AcGiMTextAttachmentPoint.BaselineLeft;switch(t){case 3:return e===1?exports.AcGiMTextAttachmentPoint.TopCenter:e===2?exports.AcGiMTextAttachmentPoint.TopRight:exports.AcGiMTextAttachmentPoint.TopLeft;case 2:return e===1?exports.AcGiMTextAttachmentPoint.MiddleCenter:e===2?exports.AcGiMTextAttachmentPoint.MiddleRight:exports.AcGiMTextAttachmentPoint.MiddleLeft;case 1:return e===1?exports.AcGiMTextAttachmentPoint.BottomCenter:e===2?exports.AcGiMTextAttachmentPoint.BottomRight:exports.AcGiMTextAttachmentPoint.BottomLeft;case 0:default:return e===1?exports.AcGiMTextAttachmentPoint.BaselineCenter:e===2?exports.AcGiMTextAttachmentPoint.BaselineRight:exports.AcGiMTextAttachmentPoint.BaselineLeft}}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbText"),e.writePoint3d(10,this.position),e.writeDouble(39,this.thickness),e.writeDouble(40,this.height),e.writeString(1,this.textString),e.writeAngle(50,this.rotation),e.writeDouble(41,this.widthFactor),e.writeAngle(51,this.oblique),e.writeString(7,this.styleName),e.writeInt16(72,this.horizontalMode),e.writeInt16(73,this.verticalMode),e.writePoint3d(11,this.alignmentPoint),this}};fo.typeName="Text";let In=fo;var oe=(n=>(n[n.Invisible=1]="Invisible",n[n.Const=2]="Const",n[n.Verifiable=4]="Verifiable",n[n.Preset=8]="Preset",n))(oe||{}),Ue=(n=>(n[n.MultiLine=2]="MultiLine",n[n.ConstMultiLine=4]="ConstMultiLine",n))(Ue||{});const mo=class mo extends In{get dxfTypeName(){return"ATTDEF"}constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(e){e?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(e){this._prompt=e}get isConst(){return(this._flags&2)!==0}set isConst(e){e?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(e){e?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(e){e?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(e){e?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(e){e?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(e){this._tag=e}get fieldLength(){return this._fieldLength}set fieldLength(e){this._fieldLength=e}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(e){this._lockPositionInBlock=e}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(e){this._isReallyLocked=e}get mtext(){return this._mtext}set mtext(e){this._mtext=e,this.isMTextAttribute=e!=null}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbAttributeDefinition"),e.writeString(3,this.prompt),e.writeString(2,this.tag),e.writeInt16(70,this.isInvisible?1:0),e.writeInt16(73,this.fieldLength),e.writeInt16(74,this.isReallyLocked?1:0),this}};mo.typeName="AttDef";let Jr=mo;const yo=class yo extends In{get dxfTypeName(){return"ATTRIB"}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&oe.Invisible)!==0}set isInvisible(e){e?this._flags|=oe.Invisible:this._flags&=~oe.Invisible}get isConst(){return(this._flags&oe.Const)!==0}set isConst(e){e?this._flags|=oe.Const:this._flags&=~oe.Const}get isVerifiable(){return(this._flags&oe.Verifiable)!==0}set isVerifiable(e){e?this._flags|=oe.Verifiable:this._flags&=~oe.Verifiable}get isPreset(){return(this._flags&oe.Preset)!==0}set isPreset(e){e?this._flags|=oe.Preset:this._flags&=~oe.Preset}get isMTextAttribute(){return(this._mtextFlag&Ue.MultiLine)!==0}set isMTextAttribute(e){e?this._mtextFlag|=Ue.MultiLine:this._mtextFlag&=~Ue.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&Ue.ConstMultiLine)!==0}set isConstMTextAttribute(e){e?this._mtextFlag|=Ue.ConstMultiLine:this._mtextFlag&=~Ue.ConstMultiLine}get tag(){return this._tag}set tag(e){this._tag=e}get fieldLength(){return this._fieldLength}set fieldLength(e){this._fieldLength=e}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(e){this._lockPositionInBlock=e}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(e){this._isReallyLocked=e}get mtext(){return this._mtext}set mtext(e){this._mtext=e,this.isMTextAttribute=e!=null}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbAttribute"),e.writeInt16(70,this.isInvisible?1:0),e.writeInt16(73,this.fieldLength),e.writeString(2,this.tag),e.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&e.writeInt16(71,this.isMTextAttribute?1:0),this}};yo.typeName="Attrib";let ei=yo;const xn=class xn extends le{get dxfTypeName(){return"INSERT"}constructor(e){super(),this._blockName=e,this._position=new b,this._rotation=0,this._normal=new x(0,0,1),this._scaleFactors=new b(1,1,1),this._attribs=new Map}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(e){this._attribs.set(e.objectId,e),e.ownerId=this.objectId}attributeIterator(){return new _r(this._attribs)}get blockTransform(){const e=this.blockTableRecord,t=(e==null?void 0:e.origin)??b.ORIGIN,r=new D().makeTranslation(-t.x,-t.y,-t.z),i=new D().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),s=new Sn().setFromAxisAngle(x.Z_AXIS,this._rotation),o=new D().makeRotationFromQuaternion(s),a=new D().makeTranslation(this._position.x,this._position.y,this._position.z);return new D().multiplyMatrices(a,o).multiply(i).multiply(r)}subGetGripPoints(){return[this._position]}subGetOsnapPoints(e,t,r,i,s,o){const a=o??new D;v.Insertion===e?i.push(this.getInsertionPoint(a)):s?this.subEntityGetOsnapPoints(e,t,r,i,s,a):this.collectBlockOsnapPoints(e,t,r,i,a)}transformBy(e){const t=new D().setFromExtrusionDirection(this._normal),r=new D().makeRotationZ(this._rotation),i=new D().multiplyMatrices(t,r),s=this._position.clone(),o=new b(this._scaleFactors.x,0,0).applyMatrix4(i).add(s),a=new b(0,this._scaleFactors.y,0).applyMatrix4(i).add(s),l=new b(0,0,this._scaleFactors.z).applyMatrix4(i).add(s);s.applyMatrix4(e),o.applyMatrix4(e),a.applyMatrix4(e),l.applyMatrix4(e);const c=new x(o).sub(s),h=new x(a).sub(s),d=new x(l).sub(s);let p=new x().crossVectors(c,h);p.lengthSq()===0?p=this._normal.clone().transformDirection(e):p.normalize();const f=new D().setFromExtrusionDirection(p).clone().invert(),m=c.clone().applyMatrix4(f);return this._position.copy(s),this._normal.copy(p),this._rotation=Math.atan2(m.y,m.x),this._scaleFactors.set(c.length(),h.length(),d.length()),this._attribs.forEach(y=>y.transformBy(e)),this}get properties(){const e={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:t=>{this.scaleFactors.x=t}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:t=>{this.scaleFactors.y=t}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:t=>{this.scaleFactors.z=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}}]}]};if(this._attribs.size>0){const t={groupName:"attribute",properties:[]};e.groups.push(t),this._attribs.forEach(r=>{t.properties.push({name:r.tag,type:"string",editable:!r.isConst,skipTranslation:!0,accessor:{get:()=>r.textString,set:i=>{r.textString=i}}})})}return e}get geometricExtents(){const e=new B,t=this.blockTableRecord;if(t!=null){const i=t.newIterator();for(const s of i)e.union(s.geometricExtents)}const r=this.blockTransform;return e.applyMatrix4(r),e}subWorldDraw(e){const t=this.blockTableRecord;if(t!=null){const r=this.blockTransform,i=[];return this._attribs.forEach(o=>{if(!o.isInvisible){const a=o.worldDraw(e);a&&i.push(a)}}),an.instance.draw(e,t,this.rgbColor,i,!0,r,this._normal)}else return e.group([])}dxfOut(e,t=!1){super.dxfOut(e,t);let r=!1;for(const i of this.attributeIterator())r=!0,e.writeStart("ATTRIB"),i.dxfOut(e);return r&&(e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity")),this}collectBlockOsnapPoints(e,t,r,i,s){const o=this.blockTableRecord;if(!o)return;const a=new D().multiplyMatrices(s,this.getFullInsertionTransform()),l=a.clone().invert(),c=new b(t).applyMatrix4(l),h=new b(r).applyMatrix4(l),d=[];for(const p of o.newIterator()){const g=[];if(p instanceof xn){p.subGetOsnapPoints(e,t,r,g,void 0,a),d.push(...g);continue}p.subGetOsnapPoints(e,c,h,g,void 0,a),g.forEach(f=>d.push(new b(f).applyMatrix4(a)))}if(d.length!==0)if(e===v.Nearest||e===v.Perpendicular||e===v.Tangent){const p=Be(t,d);p&&i.push(p)}else i.push(...d)}subEntityGetOsnapPoints(e,t,r,i,s,o,a=new Set){if(s===this.objectId||a.has(this.objectId))return!1;a.add(this.objectId);try{const l=this.blockTableRecord;if(l==null)return!1;const c=new D().multiplyMatrices(o,this.getFullInsertionTransform());for(const h of l.newIterator()){if(h.objectId===s){const d=new b(t).applyMatrix4(c.clone().invert()),p=new b(r).applyMatrix4(c.clone().invert()),g=[];return h.subGetOsnapPoints(e,d,p,g,s,c),h instanceof xn?g.forEach(f=>{i.push(f.clone())}):g.forEach(f=>{i.push(new b(f).applyMatrix4(c))}),!0}if(h instanceof xn&&h.subEntityGetOsnapPoints(e,t,r,i,s,c,a))return!0}return!1}finally{a.delete(this.objectId)}}getInsertionPoint(e){var i;const t=((i=this.blockTableRecord)==null?void 0:i.origin)??b.ORIGIN,r=new D().multiplyMatrices(e,this.getFullInsertionTransform());return new b(t).applyMatrix4(r)}getFullInsertionTransform(){const e=new D().setFromExtrusionDirection(this._normal);return new D().multiplyMatrices(e,this.blockTransform)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbBlockReference"),e.writePoint3d(10,this.position),e.writeString(2,this.blockName),e.writeDouble(41,this.scaleFactors.x),e.writeDouble(42,this.scaleFactors.y),e.writeDouble(43,this.scaleFactors.z),e.writeAngle(50,this.rotation),e.writeVector3d(210,this.normal),this}};xn.typeName="BlockReference";let sn=xn;const Ei=class Ei extends ge{get dxfTypeName(){return"CIRCLE"}constructor(e,t,r=x.Z_AXIS){super();const i=js(r);this._geo=new Xi(e,t,0,G,r,i)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(e,t,r,i){switch(e){case v.Center:case v.Centroid:i.push(this._geo.center);break;case v.Quadrant:i.push(this._geo.getPointAtAngle(0)),i.push(this._geo.getPointAtAngle(Math.PI/2)),i.push(this._geo.getPointAtAngle(Math.PI)),i.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case v.Nearest:{const s=this._geo.nearestPoint(t);i.push(s)}break;case v.Tangent:{const s=this._geo.tangentPoints(t);i.push(...s);break}case v.Perpendicular:{const s=this._geo.perpendicularPoints(t),o=Be(t,s);o&&i.push(o);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){return e.circularArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e);const t=sr(this.center,this.normal);return e.writeSubclassMarker("AcDbCircle"),e.writePoint3d(10,t),e.writeDouble(40,this.radius),e.writeVector3d(210,this.normal),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.center,r=this.radius;return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)>=r?1:-1}createOffsetCurve(e){const t=this._geo.offset(e);return t?new Ei(t.center,t.radius,t.normal):null}};Ei.typeName="Circle";let ti=Ei;const Ti=class Ti extends ge{get dxfTypeName(){return"ELLIPSE"}constructor(e,t,r,i,s,o,a){super(),this._geo=new dl(e,t,r,i,s,o,a)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxis(){return this._geo.majorAxis}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this._geo.center),e.push(this._geo.startPoint),e.push(this._geo.endPoint),e}subGetOsnapPoints(e,t,r,i){switch(e){case v.EndPoint:this.closed||(i.push(this._geo.startPoint),i.push(this._geo.endPoint));break;case v.MidPoint:this.closed||i.push(this._geo.midPoint);break;case v.Center:case v.Centroid:i.push(this._geo.center);break;case v.Quadrant:this.closed&&(i.push(this._geo.getPointAtAngle(0)),i.push(this._geo.getPointAtAngle(Math.PI/2)),i.push(this._geo.getPointAtAngle(Math.PI)),i.push(this._geo.getPointAtAngle(Math.PI/2*3)));break;case v.Nearest:i.push(this._geo.nearestPoint(t));break;case v.Tangent:i.push(...this._geo.tangentPoints(t));break;case v.Perpendicular:{const s=this._geo.perpendicularPoints(t),o=Be(t,s);o&&i.push(o);break}}}transformBy(e){return this._geo.transform(e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:e=>{this.center.x=e}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:e=>{this.minorAxisRadius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(e){return e.ellipticalArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbEllipse"),e.writePoint3d(10,this.center);const t=this._geo.majorAxis,r=this.majorAxisRadius;return e.writePoint3d(11,{x:t.x*r,y:t.y*r,z:t.z*r}),e.writeVector3d(210,this.normal),e.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),e.writeDouble(41,this.startAngle),e.writeDouble(42,this.endAngle),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.center,r=e.x-t.x,i=e.y-t.y,s=this.majorAxis,o=Math.hypot(s.x,s.y)||1,a=this.minorAxisRadius/this.majorAxisRadius*o||1,l=s.x/o,c=s.y/o,h=-c,d=l,p=r*l+i*c,g=r*h+i*d;return(p/o)**2+(g/a)**2>=1?1:-1}createOffsetCurve(e){const t=this._geo.offset(e);return t?new Ti(t.center,t.normal,t.majorAxis,t.majorAxisRadius,t.minorAxisRadius,t.startAngle,t.endAngle):null}};Ti.typeName="Ellipse";let ni=Ti;const _o=class _o extends le{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new b,new b,new b],this._edgeInvisibilities=0}getVertexAt(e){return e<0?this._vertices[0]:e>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[e]}setVertexAt(e,t){if(e<0&&this._vertices[0].copy(t),e>=3)return this._vertices.length===3&&this._vertices.push(new b),this._vertices[3].copy(t);this._vertices[e].copy(t)}setEdgeInvisibilities(e){this._edgeInvisibilities=e}isEdgeVisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<e)===0}makeEdgeInvisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<e}get geometricExtents(){return new B().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;return e.push(...this._vertices),e}subGetOsnapPoints(e,t,r,i){Zs(this._vertices,!0,e,t,i)}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this}subWorldDraw(e){const t=this._vertices.length,r=new Float32Array(t*3),i=new Uint16Array(t*2);for(let s=0;s<t;s++)r[s*3]=this._vertices[s].x,r[s*3+1]=this._vertices[s].y,r[s*3+2]=this._vertices[s].z,this.isEdgeVisibleAt(s)&&(i[s*2]=s,i[s*2+1]=(s+1)%4);return e.lineSegments(r,3,i)}dxfOutFields(e){super.dxfOutFields(e);const t=this.getVertexAt(0),r=this.getVertexAt(1),i=this.getVertexAt(2),s=this.getVertexAt(3);e.writeSubclassMarker("AcDbFace"),e.writePoint3d(10,t),e.writePoint3d(11,r),e.writePoint3d(12,i),e.writePoint3d(13,s);let o=0;for(let a=0;a<4;++a)this.isEdgeVisibleAt(a)||(o|=1<<a);return e.writeInt16(70,o),this}};_o.typeName="Face";let ri=_o;const I={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",AUPREC:"AUPREC",CECOLOR:"CECOLOR",CELTSCALE:"CELTSCALE",CELTYPE:"CELTYPE",CELWEIGHT:"CELWEIGHT",CETRANSPARENCY:"CETRANSPARENCY",CLAYER:"CLAYER",CMLEADERSTYLE:"CMLEADERSTYLE",CMLSCALE:"CMLSCALE",CMLSTYLE:"CMLSTYLE",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",HPANG:"HPANG",HPASSOC:"HPASSOC",HPBACKGROUNDCOLOR:"HPBACKGROUNDCOLOR",HPCOLOR:"HPCOLOR",HPDOUBLE:"HPDOUBLE",HPISLANDDETECTION:"HPISLANDDETECTION",HPLAYER:"HPLAYER",HPNAME:"HPNAME",HPSCALE:"HPSCALE",HPSEPARATE:"HPSEPARATE",HPTRANSPARENCY:"HPTRANSPARENCY",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LUNITS:"LUNITS",LUPREC:"LUPREC",LWDISPLAY:"LWDISPLAY",MEASUREMENT:"MEASUREMENT",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",MODELBKCOLOR:"MODELBKCOLOR",OSMODE:"OSMODE",ORTHOMODE:"ORTHOMODE",PAPERBKCOLOR:"PAPERBKCOLOR",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",POLARADDANG:"POLARADDANG",POLARMODE:"POLARMODE",POLARANG:"POLARANG",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",UNITMODE:"UNITMODE"},yg=Object.freeze(Object.values(I)),Ci=class Ci{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new ie},this.registerVar({name:I.ANGBASE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.ANGDIR,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.AUNITS,type:"number",isDbVar:!0,defaultValue:ve.DecimalDegrees}),this.registerVar({name:I.AUPREC,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.CECOLOR,type:"color",isDbVar:!0,defaultValue:new R(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:I.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:I.CELTYPE,type:"string",isDbVar:!0,defaultValue:fe}),this.registerVar({name:I.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:exports.AcGiLineWeight.ByLayer}),this.registerVar({name:I.CETRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new te}),this.registerVar({name:I.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:I.CMLEADERSTYLE,type:"string",isDbVar:!0,defaultValue:mt}),this.registerVar({name:I.CMLSCALE,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:I.CMLSTYLE,type:"string",isDbVar:!0,defaultValue:ft}),this.registerVar({name:I.COLORTHEME,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:I.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:I.HPANG,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.HPASSOC,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:I.HPBACKGROUNDCOLOR,type:"color",isDbVar:!0,defaultValue:new R(exports.AcCmColorMethod.None)}),this.registerVar({name:I.HPCOLOR,type:"color",isDbVar:!0,defaultValue:new R(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:I.HPDOUBLE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.HPISLANDDETECTION,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:I.HPLAYER,type:"string",isDbVar:!0,defaultValue:"."}),this.registerVar({name:I.HPNAME,type:"string",isDbVar:!1,defaultValue:Ol}),this.registerVar({name:I.HPSCALE,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:I.HPSEPARATE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.HPTRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new te}),this.registerVar({name:I.INSUNITS,type:"number",isDbVar:!0,defaultValue:K.Millimeters}),this.registerVar({name:I.LUNITS,type:"number",isDbVar:!0,defaultValue:J.Decimal}),this.registerVar({name:I.LUPREC,type:"number",isDbVar:!0,defaultValue:4}),this.registerVar({name:I.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:I.MEASUREMENT,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:I.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const e=new R(exports.AcCmColorMethod.ByColor);return e.setRGB(96,165,250),e})()}),this.registerVar({name:I.MODELBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const e=new R(exports.AcCmColorMethod.ByColor);return e.setRGB(0,0,0),e})()}),this.registerVar({name:I.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.ORTHOMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:I.PAPERBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const e=new R(exports.AcCmColorMethod.ByColor);return e.setRGB(255,255,255),e})()}),this.registerVar({name:I.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:I.POLARADDANG,type:"string",isDbVar:!1,defaultValue:""}),this.registerVar({name:I.POLARMODE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.POLARANG,type:"number",isDbVar:!1,defaultValue:90}),this.registerVar({name:I.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:I.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:ae}),this.registerVar({name:I.UNITMODE,type:"number",isDbVar:!0,defaultValue:0})}static instance(){return this._instance||(this._instance=new Ci),this._instance}registerVar(e){const t=this.normalizeName(e.name);this.registry.set(t,{...e,name:t}),e.isDbVar||this.cache.set(t,e.defaultValue)}registerMany(e){e.forEach(t=>this.registerVar(t))}getVar(e,t){e=this.normalizeName(e);const r=this.getDescriptor(e);if(!r)throw new Error(`System variable ${e} not found!`);if(r.isDbVar)return t[e.toLowerCase()];if(this.cache.has(e))return this.cache.get(e)}getDefaultValue(e){e=this.normalizeName(e);const t=this.getDescriptor(e);if(!t)throw new Error(`System variable ${e} not found!`);return t.defaultValue}setVar(e,t,r){e=this.normalizeName(e);const i=this.getDescriptor(e);if(i){const s=this.getVar(e,r);if(i.type==="transparency"){const o=this.parseTransparency(t);if(o==null||o.isInvalid)throw new Error("Invalid transparency value!");t=o}else if(i.type!=="string"&&(typeof t=="string"||t instanceof String)){if(i.type==="number"){const o=Number(t);if(Number.isNaN(o))throw new Error("Invalid number input!");t=o}else if(i.type==="boolean")t=this.parseBoolean(t);else if(i.type==="color"){const o=this.parseColorSysVar(e,t,r);if(o==null)throw new Error("Invalid color value!");t=o}}i.isDbVar?r[e.toLowerCase()]=t:(this.cache.set(e,t),this.hasValueChanged(s,t)&&this.events.sysVarChanged.dispatch({database:r,name:e,newVal:t,oldVal:s}))}else throw new Error(`System variable ${e} not found!`)}getDescriptor(e){return this.registry.get(this.normalizeName(e))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(e){if(e==null)return!1;const t=String(e).trim().toLowerCase(),r=new Set(["true","t","1","yes","y"]),i=new Set(["false","f","0","no","n"]);return r.has(t)?!0:(i.has(t),!1)}parseColorSysVar(e,t,r){const i=t.trim().toLowerCase();return e===I.HPCOLOR.toLowerCase()&&(i==="."||i==="use current")?r.cecolor.clone():e===I.HPBACKGROUNDCOLOR.toLowerCase()&&(i===""||i==="."||i==="none")?new R(exports.AcCmColorMethod.None):R.fromString(t)}parseTransparency(e){if(e instanceof te)return e;if(typeof e=="number")return te.deserialize(e);if(!(typeof e!="string"&&!(e instanceof String)))return te.fromString(String(e))}hasValueChanged(e,t){return e instanceof R&&t instanceof R||e instanceof te&&t instanceof te?!e.equals(t):!Object.is(e,t)}normalizeName(e){return e.toLowerCase()}};Ci._instance=null;let Xe=Ci;const _g={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:23},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:24}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:26}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:28},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:29}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:31},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:32}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:34},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:35},{angle:45,originX:.353553391,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:36},{angle:45,originX:.530330086,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:37}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:39},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.3125,-.0625,0,-.0625],sourceLine:40}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:.21875,deltaY:.125,dashes:[.3125,-.0625,0,-.0625],sourceLine:42}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:45}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:47},{angle:135,originX:0,originY:0,deltaX:.25,deltaY:.125,dashes:[.3125,-.1875],sourceLine:48}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:54},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[8,-8],sourceLine:55}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:57},{angle:0,originX:-8,originY:.375,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:58},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:59},{angle:90,originX:-.375,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:60}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:62},{angle:90,originX:0,originY:0,deltaX:8,deltaY:4,dashes:[8,-8],sourceLine:63}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:65},{angle:0,originX:0,originY:2.25,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:66},{angle:0,originX:2,originY:2.667,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:67},{angle:0,originX:2,originY:4.917,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:68},{angle:90,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:69},{angle:90,originX:-.375,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:70},{angle:90,originX:2,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:71},{angle:90,originX:1.625,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:72}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:2.667,dashes:[],sourceLine:74},{angle:90,originX:0,originY:0,deltaX:2.667,deltaY:4,dashes:[2.667,-2.667],sourceLine:75}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:77},{angle:355,originX:0,originY:0,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:78},{angle:100.45144446,originX:.59771681,originY:-.05229344,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.63740192,-7.01142112],sourceLine:79},{angle:46.1842,originX:0,originY:2,deltaX:6.19462554,deltaY:-8.84684596,dashes:[1.125,-12.375],sourceLine:80},{angle:96.63563549,originX:.88936745,originY:1.86206693,deltaX:8.59588239,deltaY:-10.40964966,dashes:[.95610342,-10.5171376],sourceLine:81},{angle:351.18416399,originX:0,originY:2,deltaX:7.74327494,deltaY:11.05855746,dashes:[.9,-9.90000001],sourceLine:82},{angle:21,originX:1,originY:1.5,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:83},{angle:326,originX:1,originY:1.5,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:84},{angle:71.45144474,originX:1.49742254,originY:1.16448426,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.6374019,-7.01142112],sourceLine:85},{angle:37.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-6.52,0,-6.7,0,-6.625],sourceLine:86},{angle:7.5,originX:0,originY:0,deltaX:3.123,deltaY:3.567,dashes:[0,-3.82,0,-6.37,0,-2.525],sourceLine:87},{angle:-32.5,originX:-2.23,originY:0,deltaX:4.6234,deltaY:2.678,dashes:[0,-2.5,0,-7.8,0,-10.35],sourceLine:88},{angle:-42.5,originX:-3.23,originY:0,deltaX:3.6234,deltaY:4.678,dashes:[0,-3.25,0,-5.18,0,-7.35],sourceLine:89}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:4,deltaY:4,dashes:[12,-4],sourceLine:91},{angle:135,originX:2.828427125,originY:2.828427125,deltaX:4,deltaY:-4,dashes:[12,-4],sourceLine:92}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:94},{angle:90,originX:2,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:95},{angle:90,originX:4,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:96},{angle:90,originX:6,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:97},{angle:90,originX:8,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:98},{angle:90,originX:10,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:99},{angle:90,originX:12,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:100},{angle:0,originX:0,originY:12,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:101},{angle:0,originX:0,originY:14,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:102},{angle:0,originX:0,originY:16,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:103},{angle:0,originX:0,originY:18,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:104},{angle:0,originX:0,originY:20,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:105},{angle:0,originX:0,originY:22,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:106},{angle:0,originX:0,originY:24,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:107}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:2.2,deltaY:1,dashes:[15,-2,5,-1],sourceLine:109},{angle:0,originX:1.33,originY:.5,deltaX:-1,deltaY:1.33,dashes:[3,-.33,6,-.75],sourceLine:110},{angle:0,originX:.5,originY:.85,deltaX:5.2,deltaY:.67,dashes:[8,-1.4,4,-1],sourceLine:111}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:25.5,deltaY:12,dashes:[6,-5,7,-3,9,-4],sourceLine:113},{angle:0,originX:6,originY:.5,deltaX:25.5,deltaY:12,dashes:[5,-19,4,-6],sourceLine:114},{angle:0,originX:18,originY:-.75,deltaX:25.5,deltaY:12,dashes:[3,-31],sourceLine:115},{angle:90,originX:0,originY:0,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:116},{angle:90,originX:6,originY:0,deltaX:12,deltaY:8.5,dashes:[11.25,-36.75],sourceLine:117},{angle:90,originX:11,originY:0,deltaX:12,deltaY:8.5,dashes:[10.5,-37.5],sourceLine:118},{angle:90,originX:18,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:119},{angle:90,originX:21,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:120},{angle:90,originX:30,originY:0,deltaX:12,deltaY:8.5,dashes:[11,-37],sourceLine:121}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:1.123,deltaY:1.567,dashes:[0,-1.52,0,-1.7,0,-1.625],sourceLine:123},{angle:7.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-.82,0,-1.37,0,-.525],sourceLine:124},{angle:-32.5,originX:-1.23,originY:0,deltaX:2.6234,deltaY:1.678,dashes:[0,-.5,0,-1.8,0,-2.35],sourceLine:125},{angle:-42.5,originX:-1.23,originY:0,deltaX:1.6234,deltaY:2.678,dashes:[0,-.25,0,-1.18,0,-1.35],sourceLine:126}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:128},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:129},{angle:0,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:130},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:131},{angle:0,originX:0,originY:.5,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:132},{angle:0,originX:0,originY:.75,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:133},{angle:90,originX:.5,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:134},{angle:90,originX:.75,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:135}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:137},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:138}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:140},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.5,dashes:[.25,-.25],sourceLine:141},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:.5,dashes:[-.25,.25],sourceLine:142}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.33,dashes:[],sourceLine:144},{angle:90,originX:.9,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:145},{angle:90,originX:.8,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:146},{angle:0,originX:.9,originY:.055,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:147},{angle:0,originX:.9,originY:.11,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:148},{angle:0,originX:.9,originY:.165,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:149},{angle:0,originX:.9,originY:.22,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:150},{angle:0,originX:.9,originY:.275,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:151}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.1875,dashes:[],sourceLine:153},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.1875,dashes:[],sourceLine:154},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.1875,dashes:[],sourceLine:155},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.1875,dashes:[.1875,-.125],sourceLine:156}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:158},{angle:135,originX:.0625,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:159},{angle:135,originX:.09375,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:160},{angle:135,originX:.125,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:161}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:163},{angle:90,originX:.0625,originY:-.0625,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:164}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:166}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:168},{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[.3535533905932738,-.7071067811865476],sourceLine:169}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.03125,deltaY:.0625,dashes:[0,-.0625],sourceLine:171}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:173},{angle:0,originX:0,originY:.09375,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:174},{angle:0,originX:0,originY:.1875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:175},{angle:90,originX:.03125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:176},{angle:90,originX:.125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:177},{angle:90,originX:.21875,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:178}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:180},{angle:180,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:181},{angle:300,originX:0,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:182},{angle:60,originX:.1,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:183},{angle:300,originX:.1,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:184},{angle:60,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:185},{angle:180,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:186},{angle:300,originX:-.05,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:187},{angle:180,originX:-.05,originY:-.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:188},{angle:60,originX:-.4,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:189},{angle:300,originX:-.4,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:190},{angle:60,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:191},{angle:180,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:192},{angle:300,originX:.2,originY:.346410161,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:193},{angle:180,originX:.2,originY:.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:194},{angle:0,originX:.2,originY:.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:195},{angle:0,originX:.2,originY:-.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:196},{angle:120,originX:.05,originY:.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:197},{angle:120,originX:-.25,originY:.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:198},{angle:240,originX:-.25,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:199},{angle:240,originX:.05,originY:-.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:200}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[.25,-.25],sourceLine:202},{angle:45,originX:.25,originY:0,deltaX:.176776695296,deltaY:.176776695296,dashes:[.0625,-.2285533906,.0625,-.353553390593],sourceLine:203}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:205},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:206},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:207}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:209},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:210},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:211}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:213},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:214},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:215}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:.707106781,deltaY:.707106781,dashes:[.1875,-1.226713563],sourceLine:217},{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:218},{angle:135,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:219}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.03125,dashes:[],sourceLine:221},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:222}]},{name:"GRAVEL",description:"",lines:[{angle:228.012787504,originX:.72,originY:1,deltaX:12.0413651692039,deltaY:.0743294146632,dashes:[.134536,-13.3190880470737],sourceLine:224},{angle:184.969740728,originX:.63,originY:.9,deltaX:-12.0415166747131,deltaY:.0433148081592,dashes:[.230868,-22.85592476123],sourceLine:225},{angle:132.510447078,originX:.4,originY:.88,deltaX:-14.8659418273816,deltaY:.061429511683,dashes:[.162788,-16.1160325960997],sourceLine:226},{angle:267.273689006,originX:.01,originY:.63,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:227},{angle:292.833654178,originX:0,originY:.42,deltaX:-12.9999095019474,deltaY:.048507125026,dashes:[.206155,-20.4093731280883],sourceLine:228},{angle:357.273689006,originX:.08,originY:.23,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:229},{angle:37.6942404667,originX:.29,originY:.22,deltaX:-16.4011800288558,deltaY:.0359675000664,dashes:[.278029,-27.524848548916],sourceLine:230},{angle:72.2553283749,originX:.51,originY:.39,deltaX:23.0867613281116,deltaY:.0380969659053,dashes:[.262488,-25.9863214968134],sourceLine:231},{angle:121.429565615,originX:.59,originY:.64,deltaX:15.2642639131074,deltaY:.047404546271,dashes:[.21095,-20.884073109729],sourceLine:232},{angle:175.236358309,originX:.48,originY:.82,deltaX:-11.0450488205478,deltaY:.083045479801,dashes:[.240832,-11.8007625787923],sourceLine:233},{angle:222.397437798,originX:.24,originY:.84,deltaX:16.2787889313724,deltaY:.0321080648114,dashes:[.311448,-30.8333750047949],sourceLine:234},{angle:138.814074834,originX:1,originY:.62,deltaX:9.2190645101588,deltaY:.0940720868851,dashes:[.106301,-10.5238448127347],sourceLine:235},{angle:171.46923439,originX:.92,originY:.69,deltaX:-13.1528534931484,deltaY:.0494468176315,dashes:[.202237,-20.021511416157],sourceLine:236},{angle:225,originX:.72,originY:.72,deltaX:.7071067811865,deltaY:.7071067811865,dashes:[.141421,-1.2727925623731],sourceLine:237},{angle:203.198590514,originX:.65,originY:.84,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.076158,-7.5396151058639],sourceLine:238},{angle:291.801409486,originX:.58,originY:.81,deltaX:-3.156820749011,deltaY:.185695338158,dashes:[.107703,-5.2774618071345],sourceLine:239},{angle:30.9637565321,originX:.62,originY:.71,deltaX:3.6014702879928,deltaY:.1714985851408,dashes:[.174929,-5.6560228948453],sourceLine:240},{angle:161.565051177,originX:.77,originY:.8,deltaX:-2.2135943621183,deltaY:.3162277660138,dashes:[.126491,-3.0357866601684],sourceLine:241},{angle:16.389540334,originX:0,originY:.81,deltaX:10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.5428451466694],sourceLine:242},{angle:70.3461759419,originX:.17,originY:.86,deltaX:-11.7045066155395,deltaY:.0672672793901,dashes:[.148661,-14.717407747319],sourceLine:243},{angle:293.198590514,originX:.77,originY:1,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.152315,-7.4634581058639],sourceLine:244},{angle:343.610459666,originX:.83,originY:.86,deltaX:-10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.542845146669],sourceLine:245},{angle:339.44395478,originX:0,originY:.19,deltaX:-5.3838927710229,deltaY:.117041147157,dashes:[.17088,-8.3731237453175],sourceLine:246},{angle:294.775140569,originX:.16,originY:.13,deltaX:-12.0828441168135,deltaY:.0698430296124,dashes:[.143178,-14.174643063276],sourceLine:247},{angle:66.8014094864,originX:.78,originY:0,deltaX:5.3835637472487,deltaY:.1313064328552,dashes:[.152315,-7.4634581058639],sourceLine:248},{angle:17.3540246363,originX:.84,originY:.14,deltaX:-13.6013396869991,deltaY:.0596549986364,dashes:[.167631,-16.59542361424],sourceLine:249},{angle:69.4439547804,originX:.29,originY:0,deltaX:-5.383892771022,deltaY:.1170411471946,dashes:[.08544,-8.4585637453175],sourceLine:250},{angle:101.309932474,originX:.72,originY:0,deltaX:4.1184388379018,deltaY:.1961161351396,dashes:[.05099,-5.0480295135928],sourceLine:251},{angle:165.963756532,originX:.71,originY:.05,deltaX:-3.1529631254726,deltaY:.2425356250323,dashes:[.206155,-3.9169506256177],sourceLine:252},{angle:186.009005957,originX:.51,originY:.1,deltaX:-10.0497393137326,deltaY:.0523423921723,dashes:[.19105,-18.9139231745428],sourceLine:253},{angle:303.690067526,originX:.62,originY:.62,deltaX:-2.2188007849008,deltaY:.2773500981134,dashes:[.144222,-3.461329275464],sourceLine:254},{angle:353.157226587,originX:.7,originY:.5,deltaX:17.1171966955143,deltaY:.0397150736497,dashes:[.251794,-24.9275626240283],sourceLine:255},{angle:60.9453959009,originX:.95,originY:.47,deltaX:-8.0616726575653,deltaY:.0971285862325,dashes:[.102956,-10.192674140987],sourceLine:256},{angle:90,originX:1,originY:.56,deltaX:1,deltaY:1,dashes:[.06,-.94],sourceLine:257},{angle:120.256437164,originX:.49,originY:.13,deltaX:-8.0619364083848,deltaY:.0719815751411,dashes:[.138924,-13.7535199894498],sourceLine:258},{angle:48.0127875042,originX:.42,originY:.25,deltaX:12.0413651692041,deltaY:.0743294146212,dashes:[.269072,-13.1845520470737],sourceLine:259},{angle:0,originX:.6,originY:.45,deltaX:1,deltaY:1,dashes:[.26,-.74],sourceLine:260},{angle:325.304846469,originX:.86,originY:.45,deltaX:12.2063917682497,deltaY:-.063245553253,dashes:[.158114,-15.653274300842],sourceLine:261},{angle:254.054604099,originX:.99,originY:.36,deltaX:4.1208169184605,deltaY:.1373605639542,dashes:[.145602,-7.1345078892805],sourceLine:262},{angle:207.645975364,originX:.95,originY:.22,deltaX:21.4708691170287,deltaY:.0421824539631,dashes:[.237065,-23.4694741822594],sourceLine:263},{angle:175.42607874,originX:.74,originY:.11,deltaX:13.0383438432524,deltaY:.039872611164,dashes:[.250799,-24.8290734079689],sourceLine:264}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:266},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:267},{angle:60,originX:.125,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:268}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:270},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:271},{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[-.25,.125],sourceLine:272}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.0625,dashes:[1,-.5],sourceLine:274},{angle:90,originX:0,originY:0,deltaX:-.25,deltaY:.0625,dashes:[1,-.5],sourceLine:275}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:277},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:278},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:279}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:292}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:294}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:296}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:298}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:300},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:301}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:303}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:305}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:307}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:309}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:311}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:313}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:315},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:316}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:318},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:319}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:321},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:322}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:327}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.25,dashes:[.25,-.25,0,-.25,0,-.25],sourceLine:329}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:331},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:332}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:334},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:335},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:336}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:338},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:339},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:340}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:342},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:343},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:344},{angle:0,originX:0,originY:.15625,deltaX:0,deltaY:.25,dashes:[],sourceLine:345}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.09375,dashes:[],sourceLine:347},{angle:45,originX:.066291261,originY:0,deltaX:0,deltaY:.09375,dashes:[0,-.09375],sourceLine:348}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:350},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:351}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:353},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:354},{angle:120,originX:.0625,originY:.108253176,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:355}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:357},{angle:45,originX:0,originY:.0625,deltaX:0,deltaY:.125,dashes:[],sourceLine:358}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.125,-.875],sourceLine:360},{angle:90,originX:.0625,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.0625,-1.669550806],sourceLine:361},{angle:90,originX:.078125,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:362},{angle:90,originX:.046875,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:363},{angle:60,originX:.09375,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:364},{angle:120,originX:.03125,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:365}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:367},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.125],sourceLine:368}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:370},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:371},{angle:0,originX:-.09375,originY:.162379763,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:372}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:374},{angle:90,originX:.125,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:375}]}],issues:[]},Ul={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:20},{angle:90,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:21}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:23}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:25},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:26}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:28},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:29}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:31},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:32},{angle:45,originX:8.98026,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:33},{angle:45,originX:13.4704,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:34}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:36},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:37}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:5.55625,deltaY:3.175,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:39}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:41},{angle:135,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:42}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:6.35,deltaY:3.175,dashes:[7.9375,-4.7625],sourceLine:45}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:47},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[203.2,-203.2],sourceLine:48}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:50},{angle:0,originX:-203.2,originY:9.525,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:51},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:52},{angle:90,originX:-9.525,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:53}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:55},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:101.6,dashes:[203.2,-203.2],sourceLine:56}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:58},{angle:0,originX:0,originY:57.15,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:59},{angle:0,originX:50.8,originY:67.7418,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:60},{angle:0,originX:50.8,originY:124.892,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:61},{angle:90,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:62},{angle:90,originX:-9.525,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:63},{angle:90,originX:50.8,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:64},{angle:90,originX:41.275,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:65}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:67.7418,dashes:[],sourceLine:67},{angle:90,originX:0,originY:0,deltaX:67.7418,deltaY:101.6,dashes:[67.7418,-67.7418],sourceLine:68}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:104.896,deltaY:-149.807,dashes:[19.05,-209.55],sourceLine:70},{angle:355,originX:0,originY:0,deltaX:-51.76101082,deltaY:187.25814969,dashes:[15.24,-167.64058417],sourceLine:71},{angle:100.4514447,originX:15.182007,originY:-1.3282535,deltaX:145.5569059,deltaY:-176.270089,dashes:[16.1900088,-178.0902446],sourceLine:72},{angle:46.1842,originX:0,originY:50.8,deltaX:157.343,deltaY:-224.71,dashes:[28.575,-314.325],sourceLine:73},{angle:96.63555761,originX:22.5899,originY:47.2965,deltaX:218.33577212,deltaY:-264.40480444,dashes:[24.28502314,-267.13560816],sourceLine:74},{angle:351.18415117,originX:0,originY:50.8,deltaX:196.67912063,deltaY:280.88740361,dashes:[22.85996707,-251.45973192],sourceLine:75},{angle:21,originX:25.4,originY:38.1,deltaX:104.89565868,deltaY:-149.80652586,dashes:[19.05,-209.55],sourceLine:76},{angle:326,originX:25.4,originY:38.1,deltaX:-51.7604,deltaY:187.258,dashes:[15.24,-167.64],sourceLine:77},{angle:71.451445,originX:38.0345326,originY:29.5779001,deltaX:145.5567546,deltaY:-176.2700748,dashes:[16.1900088,-178.0899376],sourceLine:78},{angle:37.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-165.608,0,-170.18,0,-168.275],sourceLine:79},{angle:7.5,originX:0,originY:0,deltaX:79.3242,deltaY:90.6018,dashes:[0,-97.028,0,-161.798,0,-64.135],sourceLine:80},{angle:-32.5,originX:-56.642,originY:0,deltaX:117.434,deltaY:68.0212,dashes:[0,-63.5,0,-198.12,0,-262.89],sourceLine:81},{angle:-42.5,originX:-82.042,originY:0,deltaX:92.0344,deltaY:118.821,dashes:[0,-82.55,0,-131.572,0,-186.69],sourceLine:82}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:101.6,deltaY:101.6,dashes:[304.8,-101.6],sourceLine:84},{angle:135,originX:71.842,originY:71.842,deltaX:101.6,deltaY:-101.6,dashes:[304.8,-101.6],sourceLine:85}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:87},{angle:90,originX:50.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:88},{angle:90,originX:101.6,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:89},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:90},{angle:90,originX:203.2,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:91},{angle:90,originX:254,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:92},{angle:90,originX:304.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:93},{angle:0,originX:0,originY:304.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:94},{angle:0,originX:0,originY:355.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:95},{angle:0,originX:0,originY:406.4,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:96},{angle:0,originX:0,originY:457.2,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:97},{angle:0,originX:0,originY:508,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:98},{angle:0,originX:0,originY:558.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:99},{angle:0,originX:0,originY:609.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:100}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:55.88,deltaY:25.4,dashes:[381,-50.8,127,-25.4],sourceLine:102},{angle:0,originX:33.782,originY:12.7,deltaX:-25.4,deltaY:33.782,dashes:[76.2,-8.382,152.4,-19.05],sourceLine:103},{angle:0,originX:12.7,originY:21.59,deltaX:132.08,deltaY:17.018,dashes:[203.2,-35.56,101.6,-25.4],sourceLine:104}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:647.7,deltaY:304.8,dashes:[152.4,-127,177.8,-76.2,228.6,-101.6],sourceLine:106},{angle:0,originX:152.4,originY:12.7,deltaX:647.7,deltaY:304.8,dashes:[127,-482.6,101.6,-152.4],sourceLine:107},{angle:0,originX:457.2,originY:-19.05,deltaX:647.7,deltaY:304.8,dashes:[76.2,-787.4],sourceLine:108},{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:109},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[285.75,-933.45],sourceLine:110},{angle:90,originX:279.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[266.7,-952.5],sourceLine:111},{angle:90,originX:457.2,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:112},{angle:90,originX:533.4,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:113},{angle:90,originX:762,originY:0,deltaX:304.8,deltaY:215.9,dashes:[279.4,-939.8],sourceLine:114}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:28.5242,deltaY:39.8018,dashes:[0,-38.608,0,-43.18,0,-41.275],sourceLine:116},{angle:7.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-20.828,0,-34.798,0,-13.335],sourceLine:117},{angle:-32.5,originX:-31.242,originY:0,deltaX:66.6344,deltaY:42.6212,dashes:[0,-12.7,0,-45.72,0,-59.69],sourceLine:118},{angle:-42.5,originX:-31.242,originY:0,deltaX:41.2344,deltaY:68.0212,dashes:[0,-6.35,0,-29.972,0,-34.29],sourceLine:119}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:121},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:122},{angle:0,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:123},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:124},{angle:0,originX:0,originY:12.7,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:125},{angle:0,originX:0,originY:19.05,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:126},{angle:90,originX:12.7,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:127},{angle:90,originX:19.05,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:128}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:130},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:131}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:133},{angle:90,originX:0,originY:0,deltaX:0,deltaY:12.7,dashes:[6.35,-6.35],sourceLine:134},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:12.7,dashes:[-6.35,6.35],sourceLine:135}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8.382,dashes:[],sourceLine:137},{angle:90,originX:22.86,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:138},{angle:90,originX:20.32,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:139},{angle:0,originX:22.86,originY:1.397,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:140},{angle:0,originX:22.86,originY:2.794,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:141},{angle:0,originX:22.86,originY:4.191,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:142},{angle:0,originX:22.86,originY:5.588,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:143},{angle:0,originX:22.86,originY:6.985,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:144}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:146},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:147},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:148},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:4.7625,dashes:[4.7625,-3.175],sourceLine:149}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:151},{angle:135,originX:1.5875,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:152},{angle:135,originX:2.38125,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:153},{angle:135,originX:3.175,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:154}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:156},{angle:90,originX:1.5875,originY:-1.5875,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:157}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:159}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:161},{angle:45,originX:0,originY:0,deltaX:0,deltaY:17.9605,dashes:[8.980256121069154,-17.960512242138307],sourceLine:162}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.79375,deltaY:1.5875,dashes:[0,-1.5875],sourceLine:164}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:166},{angle:0,originX:0,originY:2.38125,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:167},{angle:0,originX:0,originY:4.7625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:168},{angle:90,originX:.79375,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:169},{angle:90,originX:3.175,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:170},{angle:90,originX:5.55625,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:171}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:173},{angle:180,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:174},{angle:300,originX:0,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:175},{angle:60,originX:2.54,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:176},{angle:300,originX:2.54,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:177},{angle:60,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:178},{angle:180,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:179},{angle:300,originX:-1.27,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:180},{angle:180,originX:-1.27,originY:-2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:181},{angle:60,originX:-10.16,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:182},{angle:300,originX:-10.16,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:183},{angle:60,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:184},{angle:180,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:185},{angle:300,originX:5.08,originY:8.7988180894,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:186},{angle:180,originX:5.08,originY:8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:187},{angle:0,originX:5.08,originY:4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:188},{angle:0,originX:5.08,originY:-4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:189},{angle:120,originX:1.27,originY:6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:190},{angle:120,originX:-6.35,originY:2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:191},{angle:240,originX:-6.35,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:192},{angle:240,originX:1.27,originY:-6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:193}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:195},{angle:45,originX:6.35,originY:0,deltaX:4.490128053,deltaY:4.490128053,dashes:[1.5875,-5.8052561314,1.5875,-8.9802561314],sourceLine:196}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:198},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:199},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:200}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:202},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:203},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:204}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:206},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:207},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:208}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:17.96051224,deltaY:17.96051224,dashes:[4.7625,-31.15852448],sourceLine:210},{angle:45,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:211},{angle:135,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:212}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.79375,dashes:[],sourceLine:214},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:215}]},{name:"GRAVEL",description:"",lines:[{angle:228.0127875,originX:18.288,originY:25.4,deltaX:305.85067529778,deltaY:1.88796713245,dashes:[3.4172144,-338.30483639565],sourceLine:217},{angle:184.969741,originX:16.002,originY:22.86,deltaX:-305.8545235377,deltaY:1.10019612724,dashes:[5.8640472,-580.54048893524],sourceLine:218},{angle:132.5104471,originX:10.16,originY:22.352,deltaX:-377.59492241548,deltaY:1.56030959675,dashes:[4.1348152,-409.347227941],sourceLine:219},{angle:267.273689,originX:.254,originY:16.002,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:220},{angle:292.83365418,originX:0,originY:10.668,deltaX:-330.19770134945,deltaY:1.23208097566,dashes:[5.236337,-518.39807745344],sourceLine:221},{angle:357.273689,originX:2.032,originY:5.842,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:222},{angle:37.69424047,originX:7.366,originY:5.588,deltaX:-416.58997273292,deltaY:.91357450169,dashes:[7.0619366,-699.13115314247],sourceLine:223},{angle:72.25532837,originX:12.954,originY:9.906,deltaX:586.40373773403,deltaY:.96766293399,dashes:[6.6671952,-660.05256601905],sourceLine:224},{angle:121.42956562,originX:14.986,originY:16.256,deltaX:387.71230339293,deltaY:1.2040754753,dashes:[5.35813,-530.45545698712],sourceLine:225},{angle:175.2363583,originX:12.192,originY:20.828,deltaX:-280.5442400419,deltaY:2.10935518695,dashes:[6.1171328,-299.7393695],sourceLine:226},{angle:222.3974378,originX:6.096,originY:21.336,deltaX:413.48123885686,deltaY:.81554484621,dashes:[7.9107792,-783.16772512177],sourceLine:227},{angle:138.81407483,originX:25.4,originY:15.748,deltaX:234.164238558,deltaY:2.38943100688,dashes:[2.7000454,-267.30565824344],sourceLine:228},{angle:171.4692344,originX:23.368,originY:17.526,deltaX:-334.082478726,deltaY:1.25594916784,dashes:[5.1368198,-508.5463899704],sourceLine:229},{angle:225,originX:18.288,originY:18.288,deltaX:17.96051224214,deltaY:17.96051224214,dashes:[3.5920934,-32.32893108428],sourceLine:230},{angle:203.19859051,originX:16.51,originY:21.336,deltaX:-136.74251918,deltaY:3.33518339548,dashes:[1.9344132,-191.50622368894],sourceLine:231},{angle:291.80140949,originX:14.732,originY:20.574,deltaX:-80.18324702488,deltaY:4.71666158921,dashes:[2.7356562,-134.0475299],sourceLine:232},{angle:30.96375653,originX:15.748,originY:18.034,deltaX:91.47734531502,deltaY:4.35606406258,dashes:[4.4431966,-143.6629815291],sourceLine:233},{angle:161.56505118,originX:19.558,originY:20.32,deltaX:-56.2252967978,deltaY:8.03218525675,dashes:[3.2128714,-77.10898116828],sourceLine:234},{angle:16.389540334,originX:0,originY:20.574,deltaX:265.17991128726,deltaY:1.43340492604,dashes:[4.50088,-445.58826672539],sourceLine:235},{angle:70.34617594,originX:4.318,originY:21.844,deltaX:-297.29446803469,deltaY:1.70858889651,dashes:[3.7759894,-373.822156782],sourceLine:236},{angle:293.19859051,originX:19.558,originY:25.4,deltaX:-136.7425191801,deltaY:3.33518339548,dashes:[3.868801,-189.57183588894],sourceLine:237},{angle:343.61045967,originX:21.082,originY:21.844,deltaX:-265.17991128725,deltaY:1.433404926,dashes:[4.50088,-445.5882667254],sourceLine:238},{angle:339.44395478,originX:0,originY:4.826,deltaX:-136.75087638398,deltaY:2.97284513779,dashes:[4.340352,-212.67734313106],sourceLine:239},{angle:294.7751406,originX:4.064,originY:3.302,deltaX:-306.90424056705,deltaY:1.77401295215,dashes:[3.6367212,-360.0359338072],sourceLine:240},{angle:66.80140949,originX:19.812,originY:0,deltaX:136.74251918012,deltaY:3.33518339452,dashes:[3.868801,-189.57183588894],sourceLine:241},{angle:17.35402464,originX:21.336,originY:3.556,deltaX:-345.47402804977,deltaY:1.51523696536,dashes:[4.2578274,-421.523759802],sourceLine:242},{angle:69.44395478,originX:7.366,originY:0,deltaX:-136.75087638396,deltaY:2.97284513874,dashes:[2.170176,-214.84751913106],sourceLine:243},{angle:101.309932474,originX:18.288,originY:0,deltaX:104.60834648271,deltaY:4.98134983255,dashes:[1.295146,-128.21994964526],sourceLine:244},{angle:165.963756532,originX:18.034,originY:1.27,deltaX:-80.085263387,deltaY:6.16040487582,dashes:[5.236337,-99.49054589069],sourceLine:245},{angle:186.00900596,originX:12.954,originY:2.54,deltaX:-255.26337856879,deltaY:1.32949676118,dashes:[4.85267,-480.41364863337],sourceLine:246},{angle:303.69006753,originX:15.748,originY:15.748,deltaX:-56.35753993648,deltaY:7.0446924921,dashes:[3.6632388,-87.9177635968],sourceLine:247},{angle:353.15722659,originX:17.78,originY:12.7,deltaX:434.77679606606,deltaY:1.0087628707,dashes:[6.3955676,-633.16009065031],sourceLine:248},{angle:60.9453959,originX:24.13,originY:11.938,deltaX:-204.76648550216,deltaY:2.46706609031,dashes:[2.6150824,-258.8939231811],sourceLine:249},{angle:90,originX:25.4,originY:14.224,deltaX:25.4,deltaY:25.4,dashes:[1.524,-23.876],sourceLine:250},{angle:120.25643716,originX:12.446,originY:3.302,deltaX:-204.77318477297,deltaY:1.8283320086,dashes:[3.5286696,-349.339407732],sourceLine:251},{angle:48.0127875,originX:10.668,originY:6.35,deltaX:305.85067529778,deltaY:1.88796713138,dashes:[6.8344288,-334.88762199565],sourceLine:252},{angle:0,originX:15.24,originY:11.43,deltaX:25.4,deltaY:25.4,dashes:[6.604,-18.796],sourceLine:253},{angle:325.3048465,originX:21.844,originY:11.43,deltaX:310.04235091354,deltaY:-1.6064370526,dashes:[4.0160956,-397.5931672414],sourceLine:254},{angle:254.0546041,originX:25.146,originY:9.144,deltaX:104.6687497289,deltaY:3.48895832444,dashes:[3.6982908,-181.21650038772],sourceLine:255},{angle:207.64597536,originX:24.13,originY:5.588,deltaX:545.36007557253,deltaY:1.07143433066,dashes:[6.021451,-596.12464422938],sourceLine:256},{angle:175.42607874,originX:18.796,originY:2.794,deltaX:331.1739336186,deltaY:1.01276432357,dashes:[6.3702946,-630.6584645624],sourceLine:257}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:259},{angle:120,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:260},{angle:60,originX:3.175,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:261}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:263},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:264},{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[-6.35,3.175],sourceLine:265}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:267},{angle:90,originX:0,originY:0,deltaX:-6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:268}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:270},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:271},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:272}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:285}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:287}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:289}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:291}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:293},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:294}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:296}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:298}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:300}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:302}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:304}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:306}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:308},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:309}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:311},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:312}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:314},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:315}]},{name:"JIS_LC_20",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:322},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:323}]},{name:"JIS_LC_20A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:325},{angle:45,originX:1,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:326}]},{name:"JIS_LC_8",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:328},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:329}]},{name:"JIS_LC_8A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:331},{angle:45,originX:1,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:332}]},{name:"JIS_RC_10",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:334},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:335},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:336}]},{name:"JIS_RC_15",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:338},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:339},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:340}]},{name:"JIS_RC_18",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:342},{angle:45,originX:1,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:343},{angle:45,originX:2,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:344}]},{name:"JIS_RC_30",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:346},{angle:45,originX:1,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:347},{angle:45,originX:2,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:348}]},{name:"JIS_STN_1E",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:350},{angle:45,originX:.705,originY:0,deltaX:0,deltaY:1,dashes:[1,-.5],sourceLine:351}]},{name:"JIS_STN_2.5",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.5,dashes:[],sourceLine:353},{angle:45,originX:1.765,originY:0,deltaX:0,deltaY:2.5,dashes:[1.2,-.5],sourceLine:354}]},{name:"JIS_WOOD",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[],sourceLine:356}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:359}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:6.35,dashes:[6.35,-6.35,0,-6.35,0,-6.35],sourceLine:361}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:363},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:364}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:366},{angle:60,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:367},{angle:120,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:368}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:370},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:371},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:372}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:374},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:375},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:376},{angle:0,originX:0,originY:3.96875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:377}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.38125,dashes:[],sourceLine:379},{angle:45,originX:1.6838,originY:0,deltaX:0,deltaY:2.38125,dashes:[0,-2.38125],sourceLine:380}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:382},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:383}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:385},{angle:60,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:386},{angle:120,originX:1.5875,originY:2.7496306704,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:387}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:389},{angle:45,originX:0,originY:1.5875,deltaX:0,deltaY:3.175,dashes:[],sourceLine:390}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[3.175,-22.225],sourceLine:392},{angle:90,originX:1.5875,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.5875,-42.4065904724],sourceLine:393},{angle:90,originX:1.984375,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:394},{angle:90,originX:1.190625,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:395},{angle:60,originX:2.38125,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:396},{angle:120,originX:.79375,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:397}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:399},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-3.175],sourceLine:400}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:402},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:403},{angle:0,originX:-2.38125,originY:4.1244459802,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:404}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:406},{angle:90,originX:3.175,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:407}]}],issues:[]};var tr=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(tr||{}),$l=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))($l||{}),Qs=(n=>(n[n.HatchObject=0]="HatchObject",n[n.GradientObject=1]="GradientObject",n))(Qs||{}),ql=(n=>(n[n.PreDefinedGradient=0]="PreDefinedGradient",n[n.UserDefinedGradient=1]="UserDefinedGradient",n))(ql||{});const bo=class bo extends le{constructor(){super(),this._gradientAngle=0,this._elevation=0,this._geo=new Nt,this._isSolidFill=!1,this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1,this._patternName="",this._patternNameSet=!1,this._patternType=1,this._patternAngle=0,this._patternAngleSet=!1,this._patternScale=1,this._patternScaleSet=!1,this._associative=!1,this._associativeSet=!1,this._backgroundColor=void 0,this._backgroundColorSet=!1,this._patternDouble=!1,this._patternDoubleSet=!1,this._hatchStyle=0,this._hatchStyleSet=!1,this._hatchObjectType=0,this._gradientAngle=0,this._gradientShift=0,this._shadeTintValue=0,this._gradientStartColor=void 0,this._gradientEndColor=void 0,this._gradientType=0,this._gradientName="",this._gradientOneColorMode=!1}get dxfTypeName(){return"HATCH"}get isGradient(){return this._hatchObjectType===1}get isHatch(){return this._hatchObjectType===0}get isSolidFill(){return this._isSolidFill||this.getEffectivePatternName().trim().toUpperCase()===rn}set isSolidFill(e){this._isSolidFill=e}get color(){if(this.hasExplicitColor())return this.getEntityColor();const e=this.database,t=Xe.instance().getVar(I.HPCOLOR,e);return t instanceof R&&t.colorMethod!==exports.AcCmColorMethod.None?t.clone():e.cecolor.clone()}set color(e){this.setEntityColor(e)}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e??"",this._isSolidFill=this._patternName.trim().toUpperCase()===rn,this._patternNameSet=!0,this.updatePredefinedPatternDefinitionLines()}get patternType(){return this._patternType}set patternType(e){this._patternType=e,e!==1&&this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1),this.updatePredefinedPatternDefinitionLines()}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e,this._patternAngleSet=!0}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}get associative(){return this._associative}set associative(e){this._associative=!!e,this._associativeSet=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e==null?void 0:e.clone(),this._backgroundColorSet=!0}get patternDouble(){return this._patternDouble}set patternDouble(e){this._patternDouble=!!e,this._patternDoubleSet=!0}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e,this._hatchStyleSet=!0}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get hatchObjectType(){return this._hatchObjectType}set hatchObjectType(e){this._hatchObjectType=e}get gradientAngle(){return this._gradientAngle}set gradientAngle(e){this._gradientAngle=e}get gradientShift(){return this._gradientShift}set gradientShift(e){this._gradientShift=e}get gradientType(){return this._gradientType}set gradientType(e){this._gradientType=e}get gradientName(){return this.isGradient&&this._gradientName.trim()===""?Nl:this._gradientName}set gradientName(e){this._gradientName=e??""}get gradientOneColorMode(){return this._gradientOneColorMode}set gradientOneColorMode(e){this._gradientOneColorMode=e}get shadeTintValue(){return this._shadeTintValue}set shadeTintValue(e){this._shadeTintValue=e}get gradientStartColor(){return this._gradientStartColor}set gradientStartColor(e){this._gradientStartColor=e==null||!Number.isFinite(e)?void 0:e&16777215}get gradientEndColor(){return this._gradientEndColor}set gradientEndColor(e){this._gradientEndColor=e==null||!Number.isFinite(e)?void 0:e&16777215}applyPatternDefaultsFromSysVars(e){const t=Xe.instance();if(!this.hasExplicitLayer()){const r=t.getVar(I.HPLAYER,e);this.shouldUseSysVarOverride(r)&&(this.layer=r)}if(!this.hasExplicitTransparency()){const r=this.parseHpTransparency(t.getVar(I.HPTRANSPARENCY,e));r&&(this.transparency=r)}if(this._backgroundColorSet||(this._backgroundColor=this.parseHpBackgroundColor(t.getVar(I.HPBACKGROUNDCOLOR,e)),this._backgroundColorSet=!0),!this._patternNameSet){const r=t.getVar(I.HPNAME,e);this._patternName=typeof r=="string"?r:"",this._patternNameSet=!0}if(!this._patternAngleSet){const r=t.getVar(I.HPANG,e);this._patternAngle=typeof r=="number"&&Number.isFinite(r)?r:0,this._patternAngleSet=!0}if(this._patternScaleSet||(this._patternScale=this.normalizePatternScale(t.getVar(I.HPSCALE,e)),this._patternScaleSet=!0),!this._associativeSet){const r=t.getVar(I.HPASSOC,e);this._associative=typeof r=="number"?r!==0:!1,this._associativeSet=!0}if(this._hatchStyleSet||(this._hatchStyle=this.normalizeHatchStyle(t.getVar(I.HPISLANDDETECTION,e)),this._hatchStyleSet=!0),!this._patternDoubleSet){const r=t.getVar(I.HPDOUBLE,e);this._patternDouble=typeof r=="number"?r!==0:!1,this._patternDoubleSet=!0}this.updatePredefinedPatternDefinitionLines()}getEffectivePatternName(){if(this._patternNameSet)return this._patternName;const e=this.database,t=Xe.instance().getVar(I.HPNAME,e);return typeof t=="string"?t:this._patternName}shouldResolveColorFromCecolor(){return!1}getEffectivePatternAngle(){if(this._patternAngleSet)return this._patternAngle;const e=this.database,t=Xe.instance().getVar(I.HPANG,e);return typeof t=="number"&&Number.isFinite(t)?t:this._patternAngle}getRenderablePatternAngle(){return!this._definitionLinesAutoGenerated&&this._definitionLines.length>0?0:this.getEffectivePatternAngle()}getEffectivePatternScale(){if(this._patternScaleSet)return this._patternScale;const e=this.database;return this.normalizePatternScale(Xe.instance().getVar(I.HPSCALE,e))}getEffectiveAssociative(){if(this._associativeSet)return this._associative;const e=this.database,t=Xe.instance().getVar(I.HPASSOC,e);return typeof t=="number"?t!==0:this._associative}normalizePatternScale(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:1}normalizeHatchStyle(e){return typeof e!="number"||!Number.isFinite(e)?1:e===0?0:e===2?2:1}shouldUseSysVarOverride(e){if(typeof e!="string")return!1;const t=e.trim().toLowerCase();return t!==""&&t!=="."&&t!=="use current"}parseHpBackgroundColor(e){if(e instanceof R)return e.colorMethod===exports.AcCmColorMethod.None?void 0:e.clone();if(typeof e!="string")return;const t=e.trim().toLowerCase();if(!(!t||t==="."||t==="none"))return R.fromString(e)}parseHpTransparency(e){if(e instanceof te)return e.clone();if(!this.shouldUseSysVarOverride(e))return;const t=e.trim();if(/^bylayer$/i.test(t)||/^byblock$/i.test(t))return te.fromString(t);const r=Number(t);if(Number.isInteger(r)&&r>=0&&r<=90){const i=new te;return i.percentage=r,i}}updatePredefinedPatternDefinitionLines(e=this.getEffectivePatternName(),t=this.getEffectivePatternScale()){if(this.patternType!==1||!(this._definitionLinesAutoGenerated||this._definitionLines.length===0))return;const i=e.trim().toUpperCase();if(!i||i===rn){this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1;return}const s=this.normalizePatternScale(t);if(this._definitionLinesAutoGenerated&&this._definitionLinesPatternName===i&&this._definitionLinesPatternScale===s)return;const o=Ul.patterns.find(a=>a.name.trim().toUpperCase()===i);if(!o){this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1);return}this._definitionLines=o.lines.map(a=>({angle:a.angle*Math.PI/180,base:{x:a.originX*s,y:a.originY*s},offset:{x:a.deltaX*s,y:a.deltaY*s},dashLengths:a.dashes.map(l=>l*s)})),this._definitionLinesAutoGenerated=!0,this._definitionLinesPatternName=i,this._definitionLinesPatternScale=s}add(e){this._geo.add(e)}buildAreasFromLoops(){const e=this._geo.loops;if(e.length===0)return[];if(e.length===1)return[this._geo];const t=this._geo.buildHierarchy(),r=[],i=(s,o)=>{if(s.index>=0&&o%2===0){const a=new Nt;a.add(e[s.index]),s.children.forEach(l=>{l.index>=0&&a.add(e[l.index])}),r.push(a)}s.children.forEach(a=>i(a,o+1))};return t.children.forEach(s=>i(s,0)),r.length>0?r:[this._geo]}getCalculatedAreaValue(){const e=this.buildAreasFromLoops();return e.length===0?0:e.reduce((t,r)=>t+r.area,0)}get geometricExtents(){const e=this.buildAreasFromLoops();if(e.length===0)return new B;const t=new B;return e.forEach(r=>{const i=r.box;t.union(new B({x:i.min.x,y:i.min.y,z:this._elevation},{x:i.max.x,y:i.max.y,z:this._elevation}))}),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:tr[0],value:0},{label:tr[1],value:1},{label:tr[2],value:2}],accessor:{get:()=>this.patternType,set:e=>{this.patternType=e}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:e=>{this.patternName=e}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:e=>{this.patternAngle=e}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:e=>{this.patternScale=e}}},{name:"associative",type:"boolean",editable:!0,accessor:{get:()=>this.associative,set:e=>{this.associative=e}}},{name:"backgroundColor",type:"color",editable:!0,accessor:{get:()=>this.backgroundColor,set:e=>{this.backgroundColor=e}}},{name:"patternDouble",type:"boolean",editable:!0,accessor:{get:()=>this.patternDouble,set:e=>{this.patternDouble=e}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:e=>{this.elevation=e}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.getCalculatedAreaValue()}}]}]}}subGetOsnapPoints(e,t,r,i){const s=this._elevation,o=[];if(this._geo.loops.forEach(a=>{var l;if(a instanceof ee){const c=a,h=c.numberOfVertices;if(h===0)return;switch(e){case v.EndPoint:for(let d=0;d<h;d++){const p=c.getPointAt(d);i.push(new b(p.x,p.y,s))}break;case v.MidPoint:case v.Nearest:case v.Perpendicular:case v.Tangent:{const d=a.closed?h:h-1;for(let p=0;p<d;p++){const g=[];qr(c.getPointAt(p),c.getPointAt((p+1)%h),(l=c.vertices[p])==null?void 0:l.bulge,s,e,t,g),e===v.MidPoint?i.push(...g):o.push(...g)}break}}return}a.curves.forEach(c=>{if(c instanceof _t){const h=[];qr(c.startPoint,c.endPoint,void 0,s,e,t,h),e===v.MidPoint?i.push(...h):e===v.Nearest||e===v.Perpendicular||e===v.Tangent?o.push(...h):i.push(...h)}else if(c instanceof Re)switch(e){case v.EndPoint:i.push(new b(c.startPoint.x,c.startPoint.y,s),new b(c.endPoint.x,c.endPoint.y,s));break;case v.MidPoint:i.push(new b(c.midPoint.x,c.midPoint.y,s));break;case v.Nearest:{const h=c.nearestPoint({x:t.x,y:t.y});o.push(new b(h.x,h.y,s));break}case v.Perpendicular:{c.perpendicularPoints({x:t.x,y:t.y}).forEach(d=>o.push(new b(d.x,d.y,s)));break}case v.Tangent:{c.tangentPoints({x:t.x,y:t.y}).forEach(d=>o.push(new b(d.x,d.y,s)));break}}else if(c instanceof Ln)switch(e){case v.EndPoint:i.push(new b(c.startPoint.x,c.startPoint.y,s),new b(c.endPoint.x,c.endPoint.y,s));break;case v.MidPoint:{const h=c.getPoint(.5);i.push(new b(h.x,h.y,s));break}case v.Nearest:{const h=c.nearestPoint({x:t.x,y:t.y});o.push(new b(h.x,h.y,s));break}case v.Perpendicular:{c.perpendicularPoints({x:t.x,y:t.y}).forEach(d=>o.push(new b(d.x,d.y,s)));break}case v.Tangent:{c.tangentPoints({x:t.x,y:t.y}).forEach(d=>o.push(new b(d.x,d.y,s)));break}}})}),(e===v.Nearest||e===v.Perpendicular||e===v.Tangent)&&o.length>0){const a=Be(t,o);i.length=0,a&&i.push(a)}}subWorldDraw(e){var s;this.updatePredefinedPatternDefinitionLines();const t=e.subEntityTraits;t.fillType={solidFill:this.isSolidFill,patternAngle:this.getRenderablePatternAngle(),definitionLines:this.definitionLines,backgroundColor:(s=this.backgroundColor)==null?void 0:s.clone(),gradient:this.isGradient?{name:this.gradientName,angle:this.gradientAngle,shift:this.gradientShift,oneColorMode:this.gradientOneColorMode,shadeTintValue:this.shadeTintValue,startColor:this.gradientStartColor,endColor:this.gradientEndColor}:void 0},t.drawOrder=-1;const r=this.buildAreasFromLoops();if(r.length===0)return e.area(this._geo);if(r.length===1)return e.area(r[0]);const i=r.map(o=>e.area(o));return e.group(i)}transformBy(e){const t=e.elements,r=new mr(t[0],t[4],t[12],t[1],t[5],t[13],0,0,1);this._geo.transform(r),this._elevation=new b(0,0,this._elevation).applyMatrix4(e).z;const i=new b(1,0,0).applyMatrix4(e),s=new b().applyMatrix4(e),o=new b(i).sub(s);if(o.length()>0){const a=Math.atan2(o.y,o.x);this._patternAngle=this.getEffectivePatternAngle()+a,this._gradientAngle+=a,this._patternScale=this.getEffectivePatternScale()*o.length(),this._patternAngleSet=!0,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}return this}dxfOutFields(e){super.dxfOutFields(e);const t=this._geo.loops,r=this.getEffectivePatternName(),i=this.getEffectivePatternAngle(),s=this.getEffectivePatternScale();return this.updatePredefinedPatternDefinitionLines(r,s),e.writeSubclassMarker("AcDbHatch"),e.writePoint3d(10,{x:0,y:0,z:this.elevation}),e.writeVector3d(210,{x:0,y:0,z:1}),e.writeString(2,r||(this.isSolidFill?rn:kl)),e.writeInt16(70,this.isSolidFill?1:0),e.writeInt16(71,this.getEffectiveAssociative()?1:0),e.writeInt16(91,t.length),t.forEach((o,a)=>{const l=a===0;if(o instanceof ee){const c=o.vertices,h=c.some(p=>(p.bulge??0)!==0);e.writeInt16(92,2),e.writeInt16(72,h?1:0),e.writeInt16(73,o.closed?1:0),e.writeInt16(93,c.length);for(const p of c)e.writePoint2d(10,p),h&&e.writeDouble(42,p.bulge??0);e.writeInt16(97,0);return}if(o instanceof or){const c=l?1:0;e.writeInt16(92,c),e.writeInt16(93,o.numberOfEdges);for(const h of o.curves){if(h instanceof _t){e.writeInt16(72,1),e.writePoint2d(10,h.startPoint),e.writePoint2d(11,h.endPoint);continue}if(h instanceof Re){e.writeInt16(72,2),e.writePoint2d(10,h.center),e.writeDouble(40,h.radius),e.writeAngle(50,h.startAngle),e.writeAngle(51,h.endAngle),e.writeInt16(73,h.clockwise?0:1);continue}if(h instanceof Ln){e.writeInt16(72,3),e.writePoint2d(10,h.center);const d=new E(h.majorAxisRadius*Math.cos(h.rotation),h.majorAxisRadius*Math.sin(h.rotation));e.writePoint2d(11,d);const p=h.majorAxisRadius===0?0:h.minorAxisRadius/h.majorAxisRadius;e.writeDouble(40,p),e.writeAngle(50,h.startAngle),e.writeAngle(51,h.endAngle),e.writeInt16(73,h.clockwise?0:1);continue}if(h instanceof $e){const d=h.knots,p=h.controlPoints,g=h.weights,f=h.fitPoints,m=g.some(y=>y!==1);e.writeInt16(72,4),e.writeInt16(94,h.degree),e.writeInt16(73,m?1:0),e.writeInt16(74,h.closed?1:0),e.writeInt16(95,d.length),e.writeInt16(96,p.length),d.forEach(y=>e.writeDouble(40,y)),p.forEach((y,_)=>{e.writePoint2d(10,y),m&&e.writeDouble(42,g[_]??1)}),e.writeInt16(97,(f==null?void 0:f.length)??0),f==null||f.forEach(y=>e.writePoint2d(11,y))}}e.writeInt16(97,0)}}),e.writeInt16(75,this.hatchStyle),e.writeInt16(76,this.patternType),e.writeAngle(52,i),e.writeDouble(41,s),e.writeInt16(77,0),e.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(o=>{e.writeAngle(53,o.angle),e.writePoint2d(43,o.base),e.writePoint2d(45,o.offset),e.writeInt16(79,o.dashLengths.length),o.dashLengths.forEach(a=>e.writeDouble(49,a))}),this.isGradient&&(e.writeInt16(450,this._hatchObjectType),e.writeInt16(451,0),e.writeInt16(452,this._gradientOneColorMode?1:0),e.writeAngle(460,this._gradientAngle),e.writeDouble(461,this._gradientShift),e.writeString(470,this.gradientName)),e.writeInt16(98,0),this}};bo.typeName="Hatch";let cr=bo;var Kl=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(Kl||{});const xo=class xo extends ge{get dxfTypeName(){return"LEADER"}constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._isHookLineSameDirection=!1,this._annoType=3,this._textHeight=0,this._textWidth=0,this._associatedAnnotation="",this._normal=new x(0,0,1),this._horizontalDirection=new x(1,0,0)}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get isHookLineSameDirection(){return this._isHookLineSameDirection}set isHookLineSameDirection(e){this._isHookLineSameDirection=e}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(e=>e.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth=e}get byBlockColor(){return this._byBlockColor}set byBlockColor(e){this._byBlockColor=e}get associatedAnnotation(){return this._associatedAnnotation}set associatedAnnotation(e){this._associatedAnnotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get horizontalDirection(){return this._horizontalDirection}set horizontalDirection(e){this._horizontalDirection.copy(e)}get offsetFromBlock(){var e;return(e=this._offsetFromBlock)==null?void 0:e.clone()}set offsetFromBlock(e){this._offsetFromBlock=e?new x(e):void 0}get offsetFromAnnotation(){var e;return(e=this._offsetFromAnnotation)==null?void 0:e.clone()}set offsetFromAnnotation(e){this._offsetFromAnnotation=e?new x(e):void 0}appendVertex(e){this._vertices.push(new b().copy(e)),this._updated=!0}setVertexAt(e,t){if(e<0||e>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[e].copy(t),this._updated=!0,this}vertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[e].clone()}subGetGripPoints(){return this._vertices.map(e=>e.clone())}subGetOsnapPoints(e,t,r,i){if(this.numVertices===0)return;if(this.isSplined&&this.splineGeo){switch(e){case v.EndPoint:i.push(this._vertices[0]),i.push(this._vertices[this.numVertices-1]);break;case v.Nearest:i.push(this.splineGeo.nearestPoint(t));break}return}const s=this._vertices;switch(e){case v.EndPoint:i.push(...s);break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];Mn(s[a],s[a+1],e,t,l),o.push(...l)}if(e===v.MidPoint)i.push(...o);else{const a=Be(t,o);a&&i.push(a)}break}}}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new B().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this.transformVector(this._normal,e),this.transformVector(this._horizontalDirection,e),this._offsetFromBlock&&this.transformVector(this._offsetFromBlock,e),this._offsetFromAnnotation&&this.transformVector(this._offsetFromAnnotation,e),this._splineGeo?(this._splineGeo.transform(e),this._updated=!1):this._updated=!0,this}subWorldDraw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t)}else return e.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new $e(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbLeader"),e.writeString(3,this.dimensionStyle),e.writeInt16(71,this.hasArrowHead?1:0),e.writeInt16(72,this.isSplined?1:0),e.writeInt16(73,this.annoType),e.writeInt16(74,this.isHookLineSameDirection?1:0),e.writeInt16(75,this.hasHookLine?1:0),e.writeInt16(76,this.numVertices),this.textHeight!==0&&e.writeDouble(40,this.textHeight),this.textWidth!==0&&e.writeDouble(41,this.textWidth),this.byBlockColor!=null&&e.writeInt16(77,this.byBlockColor),this.associatedAnnotation&&e.writeHandle(340,this.associatedAnnotation);for(const t of this.vertices)e.writePoint3d(10,t);return e.writeVector3d(210,this.normal),e.writeVector3d(211,this.horizontalDirection),this._offsetFromBlock&&e.writeVector3d(212,this._offsetFromBlock),this._offsetFromAnnotation&&e.writeVector3d(213,this._offsetFromAnnotation),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectPath2d();return t.length<2?1:Ae.from2dPoints(t,!1).getOffsetSideAtPoint(e)}createOffsetCurve(e){return Ri(this.collectPath2d(),!1,e)}collectPath2d(){return this.isSplined&&this.splineGeo?this.splineGeo.getPoints(64).map(e=>new E(e.x,e.y)):this._vertices.map(e=>new E(e.x,e.y))}transformVector(e,t){const r=new b,i=new b(e.x,e.y,e.z);r.applyMatrix4(t),i.applyMatrix4(t),e.set(i.x-r.x,i.y-r.y,i.z-r.z)}};xo.typeName="Leader";let ii=xo;var v=(n=>(n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid",n))(v||{});function bg(n){let e=0;for(const t of n)e|=1<<t-1;return e}function xg(n){const e=[];for(const t of Object.values(v)){if(typeof t!="number")continue;const r=1<<t-1;n&r&&e.push(t)}return e}function wg(n,e){return n^1<<e-1}function vg(n,e){return(n&1<<e-1)!==0}function Pg(n,e){return n|1<<e-1}function Ag(n,e){return n&~(1<<e-1)}const Mi=class Mi extends ge{get dxfTypeName(){return"LINE"}constructor(e,t){super(),this._geo=new bt(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:e=>{this.startPoint.x=e}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:e=>{this.startPoint.y=e}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:e=>{this.startPoint.z=e}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:e=>{this.endPoint.x=e}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:e=>{this.endPoint.y=e}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:e=>{this.endPoint.z=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,r,i){const s=this.startPoint,o=this.endPoint;switch(e){case v.EndPoint:i.push(s),i.push(o);break;case v.MidPoint:i.push(this.midPoint);break;case v.Nearest:{const a=this._geo.project(t);i.push(a)}break;case v.Perpendicular:{const a=this._geo.perpPoint(t);i.push(a)}break;case v.Tangent:break}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){const t=this.startPoint,r=this.endPoint,i=[new b(t.x,t.y,0),new b(r.x,r.y,0)];return e.lines(i)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLine"),e.writePoint3d(10,this.startPoint),e.writePoint3d(11,this.endPoint),this}getOffsetCurves(e){const t=this._geo.offset(e);return[new Mi(t.startPoint,t.endPoint)]}getOffsetSideAtPoint(e){const t=this.startPoint,r=this.endPoint;return(r.x-t.x)*(e.y-t.y)-(r.y-t.y)*(e.x-t.x)>=0?1:-1}};Mi.typeName="Line";let hr=Mi;var Zl=(n=>(n[n.Top=0]="Top",n[n.Zero=1]="Zero",n[n.Bottom=2]="Bottom",n))(Zl||{}),Ql=(n=>(n[n.HasVertex=1]="HasVertex",n[n.Closed=2]="Closed",n[n.SuppressStartCaps=4]="SuppressStartCaps",n[n.SuppressEndCaps=8]="SuppressEndCaps",n))(Ql||{});const wo=class wo extends le{get dxfTypeName(){return"MLINE"}constructor(){super(),this._styleName="",this._styleObjectHandle="",this._scale=1,this._justification=1,this._flags=0,this._styleCount=0,this._startPosition=new b,this._normal=new x(0,0,1),this._segments=[]}get styleName(){return this._styleName||this.getDefaultStyleName()}set styleName(e){this._styleName=e}get styleObjectHandle(){return this._styleObjectHandle}set styleObjectHandle(e){this._styleObjectHandle=e}get scale(){return this._scale}set scale(e){this._scale=e}get justification(){return this._justification}set justification(e){this._justification=e}get flags(){return this._flags}set flags(e){this._flags=e}get styleCount(){return this._styleCount}set styleCount(e){this._styleCount=Math.max(0,e)}get startPosition(){return this._startPosition}set startPosition(e){this._startPosition.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get segments(){return this._segments.map(e=>this.cloneSegment(e))}set segments(e){this._segments=e.map(t=>this.createSegment(t)),this.updateHasVertexFlag()}get vertexCount(){return this._segments.length}get closed(){return(this._flags&2)!==0}set closed(e){this.setFlag(2,e)}get suppressStartCaps(){return(this._flags&4)!==0}set suppressStartCaps(e){this.setFlag(4,e)}get suppressEndCaps(){return(this._flags&8)!==0}set suppressEndCaps(e){this.setFlag(8,e)}appendSegment(e){this._segments.push(this.createSegment(e)),this.updateHasVertexFlag()}clearSegments(){this._segments=[],this.updateHasVertexFlag()}get geometricExtents(){const e=this.collectGeometryPoints();return new B().setFromPoints(e)}transformBy(e){return this._startPosition.applyMatrix4(e),this._segments.forEach(t=>{t.position.applyMatrix4(e),this.transformVector(t.direction,e),this.transformVector(t.miterDirection,e)}),this.transformVector(this._normal,e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"mline",properties:[{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"scale",type:"float",editable:!0,accessor:{get:()=>this.scale,set:e=>{this.scale=e}}},{name:"justification",type:"int",editable:!0,accessor:{get:()=>this.justification,set:e=>{this.justification=e}}},{name:"closed",type:"boolean",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}},{name:"vertexCount",type:"int",editable:!1,accessor:{get:()=>this.vertexCount}}]}]}}subGetOsnapPoints(e,t,r,i){const s=[this._startPosition,...this._segments.map(o=>o.position)];if(s.length!==0)switch(e){case v.EndPoint:i.push(...s);break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];Mn(s[a],s[a+1],e,t,l),o.push(...l)}if(e===v.MidPoint)i.push(...o);else{const a=Be(t,o);a&&i.push(a)}break}}}subWorldDraw(e){if(this._segments.length===0)return;const t=[],r=this.getMLineStyle(),i=this.getRenderableElementCount(r),s=e.subEntityTraits,o=s.color,a=s.rgbColor,l=s.lineType,c=s.fillType,h=s.drawOrder,d=this.createFillArea(r,i);if(d&&(s.color=o,s.rgbColor=a,this.applyFillTraits(r,s),s.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},s.drawOrder=-1,t.push(e.area(d)),s.fillType=c,s.drawOrder=h),i<=0){const p=this.getReferencePath();p.length>=2&&t.push(e.lines(p))}else{for(let p=0;p<i;p++){s.color=o,s.rgbColor=a,s.lineType=l,this.applyStyleElementTraits(r,p,s);const g=this.getElementPath(p,r);g.length>=2&&t.push(e.lines(g))}this.appendStyleDrivenJointAndCapEntities(e,t,r,i,o,a,l)}if(s.color=o,s.rgbColor=a,s.lineType=l,s.fillType=c,s.drawOrder=h,t.length!==0)return t.length===1?t[0]:e.group(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMline"),e.writeString(2,this.styleName),e.writeHandle(340,this._styleObjectHandle),e.writeDouble(40,this._scale),e.writeInt16(70,this._justification),e.writeInt16(71,this._flags),e.writeInt16(72,this.vertexCount),e.writeInt16(73,this._styleCount),e.writePoint3d(10,this._startPosition),e.writeVector3d(210,this._normal),this._segments.forEach(t=>{e.writePoint3d(11,t.position),e.writeVector3d(12,t.direction),e.writeVector3d(13,t.miterDirection),t.elements.forEach(r=>{e.writeInt16(74,r.parameterCount),r.parameters.forEach(i=>e.writeDouble(41,i)),e.writeInt16(75,r.fillCount),r.fillParameters.forEach(i=>e.writeDouble(42,i))})}),this}setFlag(e,t){t?this._flags|=e:this._flags&=~e}updateHasVertexFlag(){this.setFlag(1,this._segments.length>0)}createSegment(e){var t;return{position:new b().copy(e.position),direction:new x().copy(e.direction),miterDirection:new x().copy(e.miterDirection),elements:((t=e.elements)==null?void 0:t.map(r=>this.createElement(r)))??[]}}createElement(e){const t=e.parameters?[...e.parameters]:[],r=e.fillParameters?[...e.fillParameters]:[];return{parameterCount:e.parameterCount??t.length,parameters:t,fillCount:e.fillCount??r.length,fillParameters:r}}cloneSegment(e){return{position:e.position.clone(),direction:e.direction.clone(),miterDirection:e.miterDirection.clone(),elements:e.elements.map(t=>({parameterCount:t.parameterCount,parameters:[...t.parameters],fillCount:t.fillCount,fillParameters:[...t.fillParameters]}))}}collectGeometryPoints(){const e=[this._startPosition];if(this._segments.length===0)return e;const t=this.getMLineStyle(),r=this.getRenderableElementCount(t);if(r<=0)return this._segments.forEach(i=>e.push(i.position)),e;for(let i=0;i<r;i++)e.push(...this.getElementPath(i,t));return e}getRenderableElementCount(e){const t=(e==null?void 0:e.elementCount)??0;return Math.max(this._styleCount,t,...this._segments.map(r=>r.elements.length),0)}getReferencePath(){const e=[this._startPosition.clone(),...this._segments.map(t=>t.position.clone())];return this.closePathIfNeeded(e)}getElementPath(e,t){const r=[],i=this._segments[0];return r.push(this.getElementBoundaryPoint("start",i,e,t)),this._segments.forEach(s=>{r.push(this.offsetPoint(s.position,s.miterDirection,this.getElementMiterOffset(s,e,t)))}),r[r.length-1]=this.getElementBoundaryPoint("end",this._segments[this._segments.length-1],e,t),this.closePathIfNeeded(r)}getElementMiterOffset(e,t,r){var s;const i=e.elements[t];return(s=i==null?void 0:i.parameters)!=null&&s.length?i.parameters[0]:this.getStyleElementOffset(t,r)}getElementBoundaryPoint(e,t,r,i){const s=this.getElementMiterOffset(t,r,i),o=e==="start"?this._startPosition:t.position,a=this.offsetPoint(o,t.miterDirection,s);if(!this.shouldApplyCapCutAtSide(e,i))return a;const l=e==="start"?i==null?void 0:i.startAngle:i==null?void 0:i.endAngle,c=this.computeCapCutDistance(s,l,e);if(c===0)return a;const h=e==="start"?this.getStartSegmentDirection():this.getEndSegmentDirection();return h.lengthSq()===0?a:a.add(h.multiplyScalar(c))}shouldApplyCapCutAtSide(e,t){return!t||this.closed?!1:e==="start"?this.suppressStartCaps?!1:(t.flags&112)!==0:this.suppressEndCaps?!1:(t.flags&1792)!==0}computeCapCutDistance(e,t,r){const i=this.normalizeCapAngle(t),s=Math.tan(i);if(Math.abs(s)<1e-6)return 0;const o=e/s;return o}normalizeCapAngle(e){if(e==null||!Number.isFinite(e))return Math.PI/2;let t=e%180;return t<0&&(t+=180),(t<1||t>179)&&(t=90),t*Math.PI/180}getStartSegmentDirection(){const e=this._segments[0],t=new x;return e&&(t.subVectors(e.position,this._startPosition),t.lengthSq()===0&&t.copy(e.direction)),t.lengthSq()>0&&t.normalize(),t}getEndSegmentDirection(){const e=this._segments[this._segments.length-1];if(!e)return new x;const t=new x,r=this._segments.length>1?this._segments[this._segments.length-2].position:this._startPosition;return t.subVectors(e.position,r),t.lengthSq()===0&&t.copy(e.direction),t.lengthSq()>0&&t.normalize(),t}createFillArea(e,t){if(!e||!(e.flags&1)||t<2)return;const r=this.getFillBoundaryElementIndices(t,e);if(!r)return;const i=this.getElementPath(r.outerIndex,e),s=this.getElementPath(r.innerIndex,e),o=this.stripClosingPoint(i),a=this.stripClosingPoint(s);if(o.length<2||a.length<2)return;const l=new Nt;if(this.closed){if(o.length<3||a.length<3)return;l.add(new ee(o.map(c=>({x:c.x,y:c.y})),!0)),l.add(new ee(a.map(c=>({x:c.x,y:c.y})),!0))}else{const c=[...o,...a.slice().reverse()].map(h=>({x:h.x,y:h.y}));if(c.length<3)return;l.add(new ee(c,!0))}return l}getFillBoundaryElementIndices(e,t){let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=-1,o=-1;for(let a=0;a<e;a++){const l=this.getElementReferenceOffset(a,t);l<r&&(r=l,s=a),l>i&&(i=l,o=a)}if(!(s<0||o<0||s===o))return{outerIndex:o,innerIndex:s}}getElementReferenceOffset(e,t){var i;const r=this._segments[0];if(r){const s=r.elements[e];if((i=s==null?void 0:s.parameters)!=null&&i.length)return s.parameters[0]}return this.getStyleElementOffset(e,t)}getStyleElementOffset(e,t){const r=t==null?void 0:t.elements[e];if(!r)return 0;const i=this.getStyleJustificationShift(t);return(r.offset+i)*this._scale}getStyleJustificationShift(e){const t=(e==null?void 0:e.elements)??[];if(t.length<=0)return 0;let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const s of t){const o=s.offset;o<r&&(r=o),o>i&&(i=o)}return this._justification===0?-i:this._justification===2?-r:0}stripClosingPoint(e){if(e.length<2)return e;const t=e[0],r=e[e.length-1],i=1e-9;return Math.abs(t.x-r.x)<=i&&Math.abs(t.y-r.y)<=i&&Math.abs(t.z-r.z)<=i?e.slice(0,-1):e}offsetPoint(e,t,r){if(r===0||t.lengthSq()===0)return e.clone();const i=t.clone().normalize().multiplyScalar(r);return e.clone().add(i)}closePathIfNeeded(e){if(!this.closed||e.length<2)return e;const t=e[0],r=e[e.length-1],i=1e-9;return Math.abs(t.x-r.x)<=i&&Math.abs(t.y-r.y)<=i&&Math.abs(t.z-r.z)<=i||e.push(t.clone()),e}appendStyleDrivenJointAndCapEntities(e,t,r,i,s,o,a){!r||i<2||(t.push(...this.drawMiterJointEntities(e,r,i,s,o,a)),t.push(...this.drawCapEntities(e,r,i,s,o,a)))}drawMiterJointEntities(e,t,r,i,s,o){if(this.closed||this._segments.length<2||!(t.flags&2))return[];const a=[],l=e.subEntityTraits;for(let c=0;c<this._segments.length-1;c++){const h=this._segments[c],d=Array.from({length:r},(p,g)=>{const f=this.getElementMiterOffset(h,g,t);return{elementIndex:g,offset:f,point:this.offsetPoint(h.position,h.miterDirection,f)}}).sort((p,g)=>g.offset-p.offset);for(let p=0;p<d.length-1;p++)this.applyElementDrawTraits(l,i,s,o,t,d[p].elementIndex),a.push(e.lines([d[p].point,d[p+1].point]))}return a}drawCapEntities(e,t,r,i,s,o){if(this.closed||this._segments.length<=0)return[];const a=[];return a.push(...this.drawCapEntitiesForSide(e,"start",t,r,i,s,o)),a.push(...this.drawCapEntitiesForSide(e,"end",t,r,i,s,o)),a}drawCapEntitiesForSide(e,t,r,i,s,o,a){if(t==="start"&&this.suppressStartCaps)return[];if(t==="end"&&this.suppressEndCaps)return[];const l=r.flags,c=t==="start",h=c?(l&16)!==0:(l&256)!==0,d=c?(l&64)!==0:(l&1024)!==0,p=c?(l&32)!==0:(l&512)!==0;if(!h&&!d&&!p)return[];const g=this.getCapElementPoints(t,i,r);if(g.length<2)return[];const f=[],m=e.subEntityTraits;if(h)for(let _=0;_<g.length-1;_++)this.applyElementDrawTraits(m,s,o,a,r,g[_].elementIndex),f.push(e.lines([g[_].point,g[_+1].point]));const y=c?this.getStartSegmentDirection().multiplyScalar(-1):this.getEndSegmentDirection().clone();if(d){const _=this.drawCapArcBetweenElements(e,t,g[0],g[g.length-1],y,m,s,o,a,r);_&&f.push(_)}if(p)for(let _=1;_<Math.floor(g.length/2);_++){const P=g[_],L=g[g.length-1-_];if(!P||!L||P===L)continue;const S=this.drawCapArcBetweenElements(e,t,P,L,y,m,s,o,a,r);S&&f.push(S)}return f}getCapElementPoints(e,t,r){const i=e==="start"?this._segments[0]:this._segments[this._segments.length-1];return i?Array.from({length:t},(s,o)=>({elementIndex:o,offset:this.getElementMiterOffset(i,o,r),point:this.getElementBoundaryPoint(e,i,o,r)})).sort((s,o)=>o.offset-s.offset):[]}drawCapArcBetweenElements(e,t,r,i,s,o,a,l,c,h){const d=t==="end"?i.point:r.point,p=t==="end"?r.point:i.point,g=d.distanceTo(p);if(g<=1e-9||s.lengthSq()===0)return;const m=d.clone().add(new x().subVectors(p,d).multiplyScalar(.5)).add(s.clone().normalize().multiplyScalar(g/2)),y=Xi.createByThreePoints(d,p,m);if(y)return this.applyElementDrawTraits(o,a,l,c,h,t==="end"?i.elementIndex:r.elementIndex),e.circularArc(y)}applyElementDrawTraits(e,t,r,i,s,o){e.color=t,e.rgbColor=r,e.lineType=i,this.applyStyleElementTraits(s,o,e)}transformVector(e,t){const r=new b,i=new b(e.x,e.y,e.z);r.applyMatrix4(t),i.applyMatrix4(t),e.set(i.x-r.x,i.y-r.y,i.z-r.z)}getMLineStyle(){var s;const e=this.database.objects.mlineStyle,t=this.styleObjectHandle?e.getIdAt(this.styleObjectHandle):void 0;if(t)return t;const r=this.styleName?e.getAt(this.styleName):void 0;if(r)return r;const i=(s=this.styleName)==null?void 0:s.toUpperCase();if(i)for(const[o,a]of e.entries()){const l=(a.styleName||o).toUpperCase();if(o.toUpperCase()===i||l===i)return a}}applyStyleElementTraits(e,t,r){const i=e==null?void 0:e.elements[t];if(!i)return;const s=this.resolveStyleElementLineType(i.lineType);s&&(r.lineType=s),!(i.color.isByBlock||i.color.isByLayer)&&(r.color=i.color.clone(),r.rgbColor=i.color.RGB??this.rgbColor)}applyFillTraits(e,t){const r=e==null?void 0:e.fillColor;!r||r.isByBlock||r.isByLayer||(t.color=r.clone(),t.rgbColor=r.RGB??this.rgbColor)}resolveStyleElementLineType(e){var c;const t=e==null?void 0:e.trim();if(!t)return;const r=t.toUpperCase(),i=fe.toUpperCase(),s=Ct.toUpperCase();let o="UserSpecified",a=t;if(r===i){o="ByLayer";const h=(c=this.database.tables.layerTable.getAt(this.layer))==null?void 0:c.linetype;a=h&&h.toUpperCase()!==i&&h.toUpperCase()!==s?h:Mt}else r===s&&(o="ByBlock",a=Mt);const l=this.database.tables.linetypeTable.getAt(a);return l?{type:o,...l.linetype}:{type:o,name:a,standardFlag:0,description:"",totalPatternLength:0}}resolveEffectiveProperties(){super.resolveEffectiveProperties(),this._styleName||(this._styleName=this.getDefaultStyleName())}getDefaultStyleName(){try{return this.database.cmlstyle||ft}catch{return ft}}};wo.typeName="MLine";let si=wo;var An=(n=>(n[n.InvisibleLeader=0]="InvisibleLeader",n[n.StraightLeader=1]="StraightLeader",n[n.SplineLeader=2]="SplineLeader",n))(An||{}),yt=(n=>(n[n.NoneContent=0]="NoneContent",n[n.BlockContent=1]="BlockContent",n[n.MTextContent=2]="MTextContent",n[n.ToleranceContent=3]="ToleranceContent",n))(yt||{}),Jl=(n=>(n[n.Horizontal=0]="Horizontal",n[n.Vertical=1]="Vertical",n))(Jl||{}),ec=(n=>(n[n.Unknown=0]="Unknown",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Top=3]="Top",n[n.Bottom=4]="Bottom",n))(ec||{});const Sg=1,Lg=2,Ig=4,Eg=8,Tg=64,Cg=128,Mg=32768,vo=class vo extends le{get dxfTypeName(){return"MULTILEADER"}constructor(){super(),this._leaders=[],this._leaderLineType=1,this._contentType=0,this._doglegEnabled=!1,this._doglegLength=0,this._doglegVector=new x(1,0,0),this._normal=new x(0,0,1),this._mleaderStyleId="",this._textHeight=2.5,this._textWidth=0,this._textRotation=0,this._textDirection=new x(1,0,0),this._textStyleName="",this._textAttachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,this._textDrawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT,this._textLineSpacingFactor=1,this._textAttachmentDirection=0,this._arrowheadOverrides=[],this._blockAttributes=[]}get leaders(){return this._leaders.map(e=>this.cloneLeader(e))}get numberOfLeaders(){return this._leaders.length}get leaderLineType(){return this._leaderLineType}set leaderLineType(e){this._leaderLineType=e}get contentType(){return this._contentType}set contentType(e){this._contentType=e}get doglegEnabled(){return this._doglegEnabled}set doglegEnabled(e){this._doglegEnabled=e}get doglegLength(){return this._doglegLength}set doglegLength(e){this._doglegLength=e}get doglegVector(){return this._doglegVector}set doglegVector(e){this._doglegVector.copy(e)}get landingPoint(){return this._landingPoint}set landingPoint(e){this._landingPoint=e?this.createPoint(e):void 0}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get mleaderStyleId(){return this._mleaderStyleId}set mleaderStyleId(e){this._mleaderStyleId=e}get version(){return this._version}set version(e){this._version=e}get leaderStyleId(){return this._leaderStyleId}set leaderStyleId(e){this._leaderStyleId=e}get propertyOverrideFlag(){return this._propertyOverrideFlag}set propertyOverrideFlag(e){this._propertyOverrideFlag=e}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(e){this._leaderLineColor=e}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(e){this._leaderLineTypeId=e}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(e){this._leaderLineWeight=e}get landingEnabled(){return this._landingEnabled}set landingEnabled(e){this._landingEnabled=e}get arrowheadId(){return this._arrowheadId}set arrowheadId(e){this._arrowheadId=e}get arrowheadSize(){return this._arrowheadSize}set arrowheadSize(e){this._arrowheadSize=e}get textStyleId(){return this._textStyleId}set textStyleId(e){this._textStyleId=e}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(e){this._textLeftAttachmentType=e}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(e){this._textRightAttachmentType=e}get textAngleType(){return this._textAngleType}set textAngleType(e){this._textAngleType=e}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(e){this._textAlignmentType=e}get textColor(){return this._textColor}set textColor(e){this._textColor=e}get textFrameEnabled(){return this._textFrameEnabled}set textFrameEnabled(e){this._textFrameEnabled=e}get landingGap(){return this._landingGap}set landingGap(e){this._landingGap=e}get textAttachment(){return this._textAttachment}set textAttachment(e){this._textAttachment=e}get textFlowDirection(){return this._textFlowDirection}set textFlowDirection(e){this._textFlowDirection=e}get blockContentId(){return this._blockContentId}set blockContentId(e){this._blockContentId=e}get blockContentColor(){return this._blockContentColor}set blockContentColor(e){this._blockContentColor=e}get blockContentScale(){return this._blockContentScale}set blockContentScale(e){this._blockContentScale=e}get blockContentRotation(){return this._blockContentRotation}set blockContentRotation(e){this._blockContentRotation=e}get blockContentConnectionType(){return this._blockContentConnectionType}set blockContentConnectionType(e){this._blockContentConnectionType=e}get annotativeScaleEnabled(){return this._annotativeScaleEnabled}set annotativeScaleEnabled(e){this._annotativeScaleEnabled=e}get arrowheadOverrides(){return this._arrowheadOverrides}set arrowheadOverrides(e){this._arrowheadOverrides=e}get blockAttributes(){return this._blockAttributes}set blockAttributes(e){this._blockAttributes=e}get textDirectionNegative(){return this._textDirectionNegative}set textDirectionNegative(e){this._textDirectionNegative=e}get textAlignInIPE(){return this._textAlignInIPE}set textAlignInIPE(e){this._textAlignInIPE=e}get bottomTextAttachmentDirection(){return this._bottomTextAttachmentDirection}set bottomTextAttachmentDirection(e){this._bottomTextAttachmentDirection=e}get topTextAttachmentDirection(){return this._topTextAttachmentDirection}set topTextAttachmentDirection(e){this._topTextAttachmentDirection=e}get contentScale(){return this._contentScale}set contentScale(e){this._contentScale=e}get contentBasePosition(){return this._contentBasePosition}set contentBasePosition(e){this._contentBasePosition=e}get textAnchor(){return this._textAnchor}set textAnchor(e){this._textAnchor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textBackgroundColor(){return this._textBackgroundColor}set textBackgroundColor(e){this._textBackgroundColor=e}get textBackgroundScaleFactor(){return this._textBackgroundScaleFactor}set textBackgroundScaleFactor(e){this._textBackgroundScaleFactor=e}get textBackgroundTransparency(){return this._textBackgroundTransparency}set textBackgroundTransparency(e){this._textBackgroundTransparency=e}get textBackgroundColorOn(){return this._textBackgroundColorOn}set textBackgroundColorOn(e){this._textBackgroundColorOn=e}get textFillOn(){return this._textFillOn}set textFillOn(e){this._textFillOn=e}get textColumnType(){return this._textColumnType}set textColumnType(e){this._textColumnType=e}get textUseAutoHeight(){return this._textUseAutoHeight}set textUseAutoHeight(e){this._textUseAutoHeight=e}get textColumnWidth(){return this._textColumnWidth}set textColumnWidth(e){this._textColumnWidth=e}get textColumnGutterWidth(){return this._textColumnGutterWidth}set textColumnGutterWidth(e){this._textColumnGutterWidth=e}get textColumnFlowReversed(){return this._textColumnFlowReversed}set textColumnFlowReversed(e){this._textColumnFlowReversed=e}get textColumnHeight(){return this._textColumnHeight}set textColumnHeight(e){this._textColumnHeight=e}get textUseWordBreak(){return this._textUseWordBreak}set textUseWordBreak(e){this._textUseWordBreak=e}get hasMText(){return this._hasMText}set hasMText(e){this._hasMText=e}get hasBlock(){return this._hasBlock}set hasBlock(e){this._hasBlock=e}get planeOrigin(){return this._planeOrigin}set planeOrigin(e){this._planeOrigin=e}get planeXAxisDirection(){return this._planeXAxisDirection}set planeXAxisDirection(e){this._planeXAxisDirection=e}get planeYAxisDirection(){return this._planeYAxisDirection}set planeYAxisDirection(e){this._planeYAxisDirection=e}get planeNormalReversed(){return this._planeNormalReversed}set planeNormalReversed(e){this._planeNormalReversed=e}get leaderSections(){return this.leaders}get blockContentData(){return this.blockContent}get mtextContent(){return this._mtextContent?{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint.clone()}:void 0}set mtextContent(e){if(!e){this._mtextContent=void 0,this._contentType===2&&(this._contentType=0);return}this._mtextContent={text:e.text,anchorPoint:this.createPoint(e.anchorPoint)},this._contentType=2}get contents(){var e;return((e=this._mtextContent)==null?void 0:e.text)??""}set contents(e){this._mtextContent?this._mtextContent.text=e:this._mtextContent={text:e,anchorPoint:new b},this._contentType=2}get textLocation(){var e;return(e=this._mtextContent)==null?void 0:e.anchorPoint}set textLocation(e){if(!e){this._mtextContent=void 0;return}this._mtextContent?this._mtextContent.anchorPoint.copy(e):this._mtextContent={text:"",anchorPoint:this.createPoint(e)},this._contentType=2}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth=e}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get textDirection(){return this._textDirection}set textDirection(e){this._textDirection.copy(e)}get textStyleName(){return this._textStyleName}set textStyleName(e){this._textStyleName=e}get textAttachmentPoint(){return this._textAttachmentPoint}set textAttachmentPoint(e){this._textAttachmentPoint=e}get textDrawingDirection(){return this._textDrawingDirection}set textDrawingDirection(e){this._textDrawingDirection=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(e){this._textAttachmentDirection=e}get blockContent(){var e,t;return this._blockContent?{blockContentId:this._blockContent.blockContentId,blockHandle:this._blockContent.blockHandle,normal:(e=this._blockContent.normal)==null?void 0:e.clone(),position:(t=this._blockContent.position)==null?void 0:t.clone(),scale:this._blockContent.scale.clone(),rotation:this._blockContent.rotation,color:this._blockContent.color,transformationMatrix:[...this._blockContent.transformationMatrix]}:void 0}set blockContent(e){if(!e){this._blockContent=void 0,this._contentType===1&&(this._contentType=0);return}this._blockContent={blockContentId:e.blockContentId??e.blockHandle,blockHandle:e.blockHandle,normal:e.normal?new x(e.normal):void 0,position:e.position?this.createPoint(e.position):void 0,scale:new x(e.scale??{x:1,y:1,z:1}),rotation:e.rotation??0,color:e.color,transformationMatrix:e.transformationMatrix?[...e.transformationMatrix]:[]},this.blockContentId=this._blockContent.blockContentId,this._contentType=1}addLeader(e={}){var r,i;const t={lastLeaderLinePoint:e.lastLeaderLinePoint?this.createPoint(e.lastLeaderLinePoint):void 0,lastLeaderLinePointSet:e.lastLeaderLinePointSet,landingPoint:e.landingPoint?this.createPoint(e.landingPoint):void 0,doglegVector:e.doglegVector?new x(e.doglegVector):void 0,doglegVectorSet:e.doglegVectorSet,doglegLength:e.doglegLength,breaks:((r=e.breaks)==null?void 0:r.map(s=>({index:s.index,start:this.createPoint(s.start),end:this.createPoint(s.end)})))??[],leaderBranchIndex:e.leaderBranchIndex,directionType:e.directionType,leaderLines:[]};return(i=e.leaderLines)==null||i.forEach(s=>{t.leaderLines.push(this.createLeaderLine(s))}),this._leaders.push(t),this._leaders.length-1}removeLeader(e){return this.checkLeaderIndex(e),this._leaders.splice(e,1),this}addLeaderLine(e,t=[]){return this.checkLeaderIndex(e),this._leaders[e].leaderLines.push(this.createLeaderLine({vertices:t})),this._leaders[e].leaderLines.length-1}appendVertex(e,t,r){return this.getMutableLeaderLine(e,t).vertices.push(this.createPoint(r)),this}setLeaderLineVertices(e,t,r){return this.getMutableLeaderLine(e,t).vertices=r.map(i=>this.createPoint(i)),this}getLeaderLineVertices(e,t){return this.getMutableLeaderLine(e,t).vertices.map(r=>r.clone())}addBreak(e,t,r,i){return this.getMutableLeaderLine(e,t).breaks.push({start:this.createPoint(r),end:this.createPoint(i)}),this}setLandingPoint(e,t){return this.checkLeaderIndex(e),this._leaders[e].landingPoint=t?this.createPoint(t):void 0,this}setDoglegDirection(e,t){return this.checkLeaderIndex(e),this._leaders[e].doglegVector=new x(t),this}setDoglegLength(e,t){return this.checkLeaderIndex(e),this._leaders[e].doglegLength=t,this}get geometricExtents(){const e=this.collectGeometryPoints();return e.length>0?new B().setFromPoints(e):new B}subGetGripPoints(){return this.collectGeometryPoints().map(e=>e.clone())}subGetOsnapPoints(e,t,r,i){var s;if(e===v.Insertion){this.contentBasePosition?i.push(this.contentBasePosition):this._mtextContent?i.push(this._mtextContent.anchorPoint):(s=this._blockContent)!=null&&s.position&&i.push(this._blockContent.position);return}this._leaders.forEach(o=>{o.leaderLines.forEach(a=>{const l=this.getLeaderLineDrawPoints(o,a);if(l.length!==0)switch(e){case v.EndPoint:i.push(...l);break;case v.MidPoint:case v.Nearest:case v.Perpendicular:{const c=[];for(let h=0;h<l.length-1;h++){const d=[];Mn(l[h],l[h+1],e,t,d),c.push(...d)}if(e===v.MidPoint)i.push(...c);else{const h=Be(t,c);h&&i.push(h)}break}}})})}transformBy(e){var t,r,i,s,o,a,l,c;return this._leaders.forEach(h=>{var d,p;(d=h.lastLeaderLinePoint)==null||d.applyMatrix4(e),(p=h.landingPoint)==null||p.applyMatrix4(e),h.doglegVector&&this.transformVector(h.doglegVector,e),h.breaks.forEach(g=>{g.start.applyMatrix4(e),g.end.applyMatrix4(e)}),h.leaderLines.forEach(g=>{g.vertices.forEach(f=>f.applyMatrix4(e)),g.breaks.forEach(f=>{f.start.applyMatrix4(e),f.end.applyMatrix4(e)})})}),(t=this._landingPoint)==null||t.applyMatrix4(e),(r=this.contentBasePosition)==null||r.applyMatrix4(e),this.transformVector(this._doglegVector,e),this.transformVector(this._normal,e),(i=this.textAnchor)==null||i.applyMatrix4(e),(s=this._mtextContent)==null||s.anchorPoint.applyMatrix4(e),this.transformVector(this._textDirection,e),(a=(o=this._blockContent)==null?void 0:o.position)==null||a.applyMatrix4(e),(l=this._blockContent)!=null&&l.normal&&this.transformVector(this._blockContent.normal,e),this.blockContentScale&&this.transformVector(this.blockContentScale,e),(c=this.planeOrigin)==null||c.applyMatrix4(e),this.planeXAxisDirection&&this.transformVector(this.planeXAxisDirection,e),this.planeYAxisDirection&&this.transformVector(this.planeYAxisDirection,e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"leader",properties:[{name:"contentType",type:"enum",editable:!0,options:[{label:yt[0],value:0},{label:yt[1],value:1},{label:yt[2],value:2},{label:yt[3],value:3}],accessor:{get:()=>this.contentType,set:e=>{this.contentType=e}}},{name:"leaderLineType",type:"enum",editable:!0,options:[{label:An[0],value:0},{label:An[1],value:1},{label:An[2],value:2}],accessor:{get:()=>this.leaderLineType,set:e=>{this.leaderLineType=e}}},{name:"doglegEnabled",type:"boolean",editable:!0,accessor:{get:()=>this.doglegEnabled,set:e=>{this.doglegEnabled=e}}},{name:"doglegLength",type:"float",editable:!0,accessor:{get:()=>this.doglegLength,set:e=>{this.doglegLength=e}}},{name:"leaderCount",type:"int",editable:!1,accessor:{get:()=>this.numberOfLeaders}}]},{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.textHeight,set:e=>{this.textHeight=e}}},{name:"textWidth",type:"float",editable:!0,accessor:{get:()=>this.textWidth,set:e=>{this.textWidth=e}}},{name:"textStyleName",type:"string",editable:!0,accessor:{get:()=>this.textStyleName,set:e=>{this.textStyleName=e}}}]}]}}resolveEffectiveProperties(){if(super.resolveEffectiveProperties(),this._mleaderStyleId)return;const e=this.getDefaultMLeaderStyle();e&&(this._mleaderStyleId=e.objectId)}subWorldDraw(e){const t=[],r=e.subEntityTraits,i=r.color,s=r.rgbColor,o=r.lineType,a=r.lineWeight,l=this.getResolvedLeaderLineColor(),c=this.getResolvedLeaderLineStyle(),h=this.getResolvedLeaderLineWeight(),d=this.getResolvedTextColor();this.getResolvedLeaderLineType()!==0&&(this.applyColorTraits(r,l,i,s),this.applyLineTraits(r,c,h),this._leaders.forEach(g=>{g.leaderLines.forEach(m=>{const y=this.getLeaderLineDrawPoints(g,m);if(y.length>0){const _=this.drawLeaderLine(e,y);_&&t.push(_)}});const f=this.getDoglegPoints(g);f&&t.push(e.lines(f))}));const p=this.getRenderableMTextContent();if(this.contentType===2&&p){this.applyColorTraits(r,d,i,s);const g=this.getResolvedTextHeight(),f={text:p.text,height:g,width:this.getMTextRenderWidth(p.text,g),position:p.anchorPoint,rotation:this.textRotation,directionVector:this.textDirection,attachmentPoint:this.textAttachmentPoint,drawingDirection:this.textDrawingDirection,lineSpaceFactor:this.textLineSpacingFactor};t.push(e.mtext(f,this.getTextStyle(),!1))}if(r.color=i,r.rgbColor=s,r.lineType=o,r.lineWeight=a,t.length!==0)return t.length===1?t[0]:e.group(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMLeader"),e.writeInt16(170,this.leaderLineType),e.writeBoolean(290,this.doglegEnabled),e.writeDouble(41,this.doglegLength),e.writeInt16(172,this.contentType),e.writeVector3d(210,this.normal),e.writeHandle(340,this.mleaderStyleId),this._landingPoint&&e.writePoint3d(10,this._landingPoint),e.writeVector3d(11,this.doglegVector),this._mtextContent&&(e.writeString(1,this._mtextContent.text),e.writePoint3d(12,this._mtextContent.anchorPoint),e.writeDouble(40,this.textHeight),e.writeDouble(42,this.textWidth),e.writeAngle(50,this.textRotation),e.writeString(7,this.textStyleName)),this._blockContent&&(e.writeHandle(341,this._blockContent.blockContentId??""),this._blockContent.position&&e.writePoint3d(15,this._blockContent.position),e.writeVector3d(16,this._blockContent.scale),e.writeAngle(52,this._blockContent.rotation)),this._leaders.forEach(t=>{t.landingPoint&&e.writePoint3d(110,t.landingPoint),t.doglegVector&&e.writeVector3d(111,t.doglegVector),e.writeDouble(140,t.doglegLength),e.writeInt16(171,t.leaderLines.length),t.leaderLines.forEach(r=>{e.writeInt16(90,r.vertices.length),r.vertices.forEach(i=>e.writePoint3d(10,i))})}),this}createPoint(e){return new b().copy(e)}createLeaderLine(e){var t,r;return{vertices:((t=e.vertices)==null?void 0:t.map(i=>this.createPoint(i)))??[],breakPointIndexes:e.breakPointIndexes?[...e.breakPointIndexes]:[],leaderLineIndex:e.leaderLineIndex,breaks:((r=e.breaks)==null?void 0:r.map(i=>({index:i.index,start:this.createPoint(i.start),end:this.createPoint(i.end)})))??[]}}cloneLeader(e){var t,r,i;return{lastLeaderLinePoint:(t=e.lastLeaderLinePoint)==null?void 0:t.clone(),lastLeaderLinePointSet:e.lastLeaderLinePointSet,landingPoint:(r=e.landingPoint)==null?void 0:r.clone(),doglegVector:(i=e.doglegVector)==null?void 0:i.clone(),doglegVectorSet:e.doglegVectorSet,doglegLength:e.doglegLength,breaks:e.breaks.map(s=>({index:s.index,start:s.start.clone(),end:s.end.clone()})),leaderBranchIndex:e.leaderBranchIndex,directionType:e.directionType,leaderLines:e.leaderLines.map(s=>({vertices:s.vertices.map(o=>o.clone()),breakPointIndexes:[...s.breakPointIndexes],leaderLineIndex:s.leaderLineIndex,breaks:s.breaks.map(o=>({index:o.index,start:o.start.clone(),end:o.end.clone()}))}))}}checkLeaderIndex(e){if(e<0||e>=this._leaders.length)throw new Error("The leader index is out of range!")}getMutableLeaderLine(e,t){this.checkLeaderIndex(e);const r=this._leaders[e].leaderLines[t];if(!r)throw new Error("The leader line index is out of range!");return r}collectGeometryPoints(){var t;const e=[];return this._leaders.forEach(r=>{r.lastLeaderLinePoint&&e.push(r.lastLeaderLinePoint),r.landingPoint&&e.push(r.landingPoint),r.breaks.forEach(s=>e.push(s.start,s.end)),r.leaderLines.forEach(s=>{e.push(...s.vertices),s.breaks.forEach(o=>e.push(o.start,o.end))});const i=this.getDoglegPoints(r);i&&e.push(...i),r.leaderLines.forEach(s=>{const o=this.getArrowheadPoints(this.getLeaderLineDrawPoints(r,s));o&&e.push(...o)})}),this._landingPoint&&e.push(this._landingPoint),this.contentBasePosition&&e.push(this.contentBasePosition),this.textAnchor&&e.push(this.textAnchor),this._mtextContent&&e.push(this._mtextContent.anchorPoint),(t=this._blockContent)!=null&&t.position&&e.push(this._blockContent.position),this.planeOrigin&&e.push(this.planeOrigin),e}getLeaderLineDrawPoints(e,t){if(t.vertices.length>=2)return t.vertices;if(t.vertices.length===0)return[];const r=e.lastLeaderLinePoint??e.landingPoint??this._landingPoint??this.contentBasePosition;return!r||t.vertices[0].equals(r)?t.vertices:[t.vertices[0],r]}getDoglegPoints(e){if(!this.getResolvedDoglegEnabled())return;const t=e.lastLeaderLinePoint??e.landingPoint??this._landingPoint,r=e.doglegVector??this._doglegVector,i=e.doglegLength??this.getResolvedDoglegLength();if(!t||i==null||i===0||r.lengthSq()===0)return;const s=t.clone().add(r.clone().normalize().multiplyScalar(i));return[t,s]}getArrowheadPoints(e){if(!this.isArrowheadVisible()||e.length<2)return;const t=this.getArrowheadFrame(e);if(!t)return;const r=this.getResolvedArrowheadSize(),{tip:i,unit:s}=t,o=i.clone().add(s.clone().multiplyScalar(r)),a=r/6,l=new x(-s.y,s.x,0),c=o.clone().add(l.clone().multiplyScalar(a)),h=o.clone().add(l.clone().multiplyScalar(-a));return[i,c,h,i]}isArrowheadVisible(){const e=this.getResolvedArrowheadId();return(e==null?void 0:e.toUpperCase())==="_NONE"?!1:this.getResolvedArrowheadSize()>0}drawLeaderLine(e,t){const r=[],i=this.getLeaderLinePointsForDraw(t);i.length>=2&&r.push(e.lines(i));const s=this.drawArrowhead(e,t);if(s&&r.push(s),r.length!==0)return r.length===1?r[0]:e.group(r)}getLeaderLinePointsForDraw(e){const t=this.getArrowheadLeaderLineTrimDistance();return t<=0?e:this.trimPolylineStart(e,t)}getArrowheadLeaderLineTrimDistance(){if(!this.isArrowheadVisible())return 0;const e=this.getResolvedArrowheadBlockTableRecord();if(!e)return 0;const t=this.getResolvedArrowheadSize();if(t<=0)return 0;const r=e.origin??b.ORIGIN;let i=r.x;for(const s of e.newIterator()){const o=s.geometricExtents;o.isEmpty()||o.max.x>i&&(i=o.max.x)}return Math.max(0,(i-r.x)*t)}trimPolylineStart(e,t){if(e.length<2||t<=0)return e;let r=t;for(let i=0;i<e.length-1;i++){const s=e[i],o=e[i+1],a=o.distanceTo(s);if(!(a<=0)){if(r<a){const l=new x().subVectors(o,s);return[s.clone().add(l.multiplyScalar(r/a)),...e.slice(i+1)]}r-=a}}return[e[e.length-1]]}drawArrowhead(e,t){if(!this.isArrowheadVisible())return;const r=this.drawArrowheadBlock(e,t);if(r)return r;const i=this.getArrowheadPoints(t);if(!i)return;const s=new Nt;s.add(new ee(i,!0));const o=e.subEntityTraits,a=o.fillType;o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]};const l=e.area(s);return o.fillType=a,l}drawArrowheadBlock(e,t){const r=this.getResolvedArrowheadBlockTableRecord();if(!r)return;const i=this.getArrowheadFrame(t);if(!i)return;const{tip:s,unit:o}=i,a=this.getResolvedArrowheadSize(),l=Math.atan2(o.y,o.x),c=r.origin??b.ORIGIN,h=new D().makeTranslation(-c.x,-c.y,-c.z),d=new D().makeScale(a,a,a),p=new D().makeRotationZ(l),g=new D().makeTranslation(s.x,s.y,s.z),f=new D().multiplyMatrices(g,p).multiply(d).multiply(h);return an.instance.draw(e,r,this.rgbColor,[],!0,f,new x(this.normal))}getArrowheadFrame(e){if(e.length<2)return;const t=e[0],r=e.find(s=>!s.equals(t));if(!r)return;const i=new x().subVectors(r,t);if(i.lengthSq()!==0)return{tip:t,unit:i.normalize()}}getResolvedArrowheadId(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.arrowSymbolId;return this.arrowheadId??e}getResolvedArrowheadBlockTableRecord(){const e=this.getResolvedArrowheadId();if(e)return this.database.tables.blockTable.getIdAt(e)}getResolvedArrowheadSize(){const e=this.getMLeaderStyle(),t=(e==null?void 0:e.arrowSize)??(e==null?void 0:e.scale);return this.arrowheadSize??this.contentScale??t??this.getResolvedTextHeight()}getResolvedTextHeight(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.textHeight;return this.textHeight>0?this.textHeight:e!=null&&e>0?e:2.5}getRenderableMTextContent(){var r;if(this._mtextContent)return{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint};const e=(r=this.getMLeaderStyle())==null?void 0:r.defaultMTextContents,t=this.textAnchor??this.contentBasePosition??this._landingPoint;if(!(!e||!t))return{text:e,anchorPoint:t}}getMTextRenderWidth(e,t){if(this._textWidth>0)return this._textWidth;if(!e)return this._textWidth;const r=e.replace(/\\[PpNn]/g,`
|
|
5
|
+
`).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,""),i=Math.max(...r.split(/\r\n|\r|\n/g).map(s=>s.length),1);return Math.max(t,i*t)}transformVector(e,t){const r=new b,i=new b(e.x,e.y,e.z);r.applyMatrix4(t),i.applyMatrix4(t),e.set(i.x-r.x,i.y-r.y,i.z-r.z)}getMLeaderStyle(){const e=this.database.objects.mleaderStyle,t=this.mleaderStyleId||this.leaderStyleId;if(t){const r=e.getIdAt(t);if(r)return r}return this.getDefaultMLeaderStyle()}getDefaultMLeaderStyle(){const e=this.resolveMLeaderStyleByName(this.getDefaultMLeaderStyleName());return e||this.database.objects.mleaderStyle.newIterator().toArray()[0]}resolveMLeaderStyleByName(e){const t=e==null?void 0:e.trim();if(!t)return;const r=this.database.objects.mleaderStyle,i=r.getAt(t);if(i)return i;const s=r.getIdAt(t);if(s)return s;const o=t.toUpperCase();for(const[a,l]of r.entries())if(a.toUpperCase()===o)return l}getDefaultMLeaderStyleName(){try{return this.database.cmleaderstyle||mt}catch{return mt}}getResolvedTextStyleName(){var s,o;const e=this.database.tables.textStyleTable,t=(s=this.getMLeaderStyle())==null?void 0:s.textStyleId,r=t?(o=e.getIdAt(t))==null?void 0:o.name:void 0;if(this.textStyleName)return this.textStyleName;const i=this.textStyleId?e.getIdAt(this.textStyleId):void 0;return i!=null&&i.name?i.name:r}getTextStyle(){const e=this.database.tables.textStyleTable.resolveAt(this.getResolvedTextStyleName());if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}getResolvedLeaderLineColor(){var e;return this.getResolvedComponentColor(this.leaderLineColor,(e=this.getMLeaderStyle())==null?void 0:e.leaderLineColor,Lg)}getResolvedLeaderLineType(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.leaderLineType;return this.getResolvedStyleDrivenValue(this.leaderLineType,e,Sg)}getResolvedLeaderLineTypeId(){var e;return this.getResolvedStyleDrivenValue(this.leaderLineTypeId,(e=this.getMLeaderStyle())==null?void 0:e.leaderLineTypeId,Ig)}getResolvedLeaderLineStyle(){const e=this.getResolvedLeaderLineTypeId();if(!e)return;const t=this.database.tables.linetypeTable.getIdAt(e);if(t)return{type:"UserSpecified",...t.linetype}}getResolvedLeaderLineWeight(){var r;const e=(r=this.getMLeaderStyle())==null?void 0:r.leaderLineWeight,t=this.getResolvedStyleDrivenValue(this.leaderLineWeight,e,Eg);if(t!=null)return t}getResolvedDoglegEnabled(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.doglegEnabled;return this.getResolvedStyleDrivenValue(this.doglegEnabled,e,Tg)}getResolvedDoglegLength(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.doglegLength;return this.getResolvedStyleDrivenValue(this.doglegLength,e,Cg)}getResolvedTextColor(){var e;return this.getResolvedComponentColor(this.textColor,(e=this.getMLeaderStyle())==null?void 0:e.textColor,Mg)}getResolvedComponentColor(e,t,r){const i=e!=null?nr(e):void 0;if(!i)return t;const s=this.isPropertyOverrideEnabled(r);return s===!0?i:s===!1?t??i:!i.isByBlock&&!i.isByLayer?i:t??i}getResolvedStyleDrivenValue(e,t,r){const i=this.isPropertyOverrideEnabled(r);return i===!0?e??t:t??e}isPropertyOverrideEnabled(e){if(this.propertyOverrideFlag!=null)return(this.propertyOverrideFlag&e)!==0}applyColorTraits(e,t,r,i){e.color=r,e.rgbColor=i,t&&(e.color=t,e.rgbColor=this.resolveColorToRgb(t))}applyLineTraits(e,t,r){t&&(e.lineType=t),r!=null&&(e.lineWeight=r)}resolveColorToRgb(e){if(e.isByLayer){const t=this.getLayerColor();return(t==null?void 0:t.RGB)!=null?t.RGB:this.rgbColor}return e.isByBlock?this.rgbColor:e.RGB??this.rgbColor}};vo.typeName="MLeader";let oi=vo;const Po=class Po extends le{get dxfTypeName(){return"MTEXT"}constructor(){super(),this._contents="",this._height=0,this._width=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new b,this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._direction=new x(1,0,0),this._drawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){const e=new B,t=this.width>0?this.width:jl(this.contents,this.height),r=gg(this.contents),i=pg(r,this.height,this.lineSpacingFactor);return Gl(e,this._location,t,i,this.attachmentPoint,this.rotation,this.direction)}subGetGripPoints(){return[this._location]}subGetOsnapPoints(e,t,r,i){v.Insertion===e&&i.push(this._location)}transformBy(e){const t=this._location.clone(),r=this._direction.lengthSq()>0?this._direction.clone().normalize():new x(Math.cos(this._rotation),Math.sin(this._rotation),0),i=new x(-r.y,r.x,r.z);i.lengthSq()===0&&i.set(0,1,0),i.normalize();const s=t.clone().add(r),o=t.clone().add(i);t.applyMatrix4(e),s.applyMatrix4(e),o.applyMatrix4(e);const a=new x(s).sub(t),l=new x(o).sub(t),c=a.length(),h=l.length();return this._location.copy(t),c>0&&(this._direction.copy(a).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=c),h>0&&(this._height*=h),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:exports.AcGiMTextAttachmentPoint[1],value:1},{label:exports.AcGiMTextAttachmentPoint[2],value:2},{label:exports.AcGiMTextAttachmentPoint[3],value:3},{label:exports.AcGiMTextAttachmentPoint[4],value:4},{label:exports.AcGiMTextAttachmentPoint[5],value:5},{label:exports.AcGiMTextAttachmentPoint[6],value:6},{label:exports.AcGiMTextAttachmentPoint[7],value:7},{label:exports.AcGiMTextAttachmentPoint[8],value:8},{label:exports.AcGiMTextAttachmentPoint[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:e=>{this.attachmentPoint=e}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:exports.AcGiMTextFlowDirection[1],value:1},{label:exports.AcGiMTextFlowDirection[2],value:2},{label:exports.AcGiMTextFlowDirection[3],value:3},{label:exports.AcGiMTextFlowDirection[4],value:4},{label:exports.AcGiMTextFlowDirection[5],value:5}],accessor:{get:()=>this.drawingDirection,set:e=>{this.drawingDirection=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:e=>{this.lineSpacingFactor=e}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:e=>{this.width=e}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:e=>{this.direction.x=e}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:e=>{this.direction.y=e}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:e=>{this.direction.z=e}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:e=>{this.location.x=e}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:e=>{this.location.y=e}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:e=>{this.location.z=e}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}subWorldDraw(e,t){const r={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor};return e.mtext(r,this.getTextStyle(),t)}encodeMTextContentsForDxf(e){return e.replace(/\r\n|\r|\n/g,"\\P")}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMText"),e.writePoint3d(10,this.location),e.writeDouble(40,this.height),e.writeDouble(41,this.width),e.writeString(1,this.encodeMTextContentsForDxf(this.contents)),e.writeString(7,this.styleName),e.writeAngle(50,this.rotation),e.writeVector3d(11,this.direction),e.writeInt16(71,this.attachmentPoint),e.writeInt16(72,this.drawingDirection),e.writeInt16(73,this.lineSpacingStyle),e.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(e.writeInt16(90,1),e.writeInt32(63,this.backgroundFillColor),e.writeInt32(441,this.backgroundFillTransparency),e.writeDouble(45,this.backgroundScaleFactor)),this}};Po.typeName="MText";let dr=Po;const Ao=class Ao extends ge{get dxfTypeName(){return"SPLINE"}constructor(e,t,r,i,s){super(),this.rebuild(e,t,r,i,s)}rebuild(e,t,r,i,s){const o=+(e!==void 0)+ +(t!==void 0)+ +(r!==void 0)+ +(i!==void 0)+ +(s!==void 0);if(o<2||o>5)throw Pe.ILLEGAL_PARAMETERS;!Array.isArray(t)?this._geo=new $e(e,t,r,i):this._geo=new $e(e,t,r,i,s)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}subGetGripPoints(){return this._geo.controlPoints.map(e=>new b(e.x,e.y,e.z??0))}subGetOsnapPoints(e,t,r,i){switch(e){case v.EndPoint:i.push(this._geo.startPoint),i.push(this._geo.endPoint);break;case v.Node:{const s=new Set;for(const o of this._geo.knots)s.has(o)||(s.add(o),i.push(this._geo.evaluateAt(o)));break}case v.Nearest:i.push(this._geo.nearestPoint(t));break}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){const t=this._geo.getPoints(100);return e.lines(t)}dxfOutFields(e){var r;const t=this._geo;super.dxfOutFields(e),e.writeSubclassMarker("AcDbSpline"),e.writeInt16(70,this.closed?1:0),e.writeInt16(71,t.degree),e.writeInt16(72,t.knots.length),e.writeInt16(73,t.controlPoints.length),e.writeInt16(74,((r=t.fitPoints)==null?void 0:r.length)??0);for(const i of t.knots)e.writeDouble(40,i);for(const i of t.weights)e.writeDouble(41,i);for(const i of t.controlPoints)e.writePoint3d(10,i);for(const i of t.fitPoints??[])e.writePoint3d(11,i);return this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectPath2d(1);return t.length<2?1:Ae.from2dPoints(t,this.closed).getOffsetSideAtPoint(e)}createOffsetCurve(e){const{points:t,tangents:r}=this._geo.getOffsetSamplePath2d(e),i=uu(t,this.closed,e,r);return i?Ae.fromGePolyline(i):null}collectPath2d(e){return this._geo.getOffsetSamplePath2d(e).points}};Ao.typeName="Spline";let ur=Ao;const Og=new x,So=class So extends sn{get dxfTypeName(){return"ACAD_TABLE"}constructor(e,t,r){super(e),this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._numColumns=r,this._numRows=t,this._columnWidth=new Array(r),this._rowHeight=new Array(t),this._cells=new Array(t*r)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,r){var s;const i=e*this._numColumns+t;return(s=this._cells[i])==null?void 0:s.text}setTextString(e,t,r){const i=e*this._numColumns+t;if(!this._cells[i]){this._cells[i]={text:r,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[i].text=r}isEmpty(e,t){var i;const r=e*this._numColumns+t;return!((i=this._cells[r])!=null&&i.text)}get geometricExtents(){let e;try{e=this.blockTableRecord}catch{e=void 0}if(e&&e.newIterator().count>0){const a=new B;for(const l of e.newIterator())a.union(l.geometricExtents);return a.applyMatrix4(this.blockTransform),a}const t=this._columnWidth.reduce((a,l)=>a+l,0),r=this._rowHeight.reduce((a,l)=>a+l,0),i=new B;if(t===0&&r===0)return i.expandByPoint(this.position),i;const s=new Sn;s.setFromAxisAngle(x.Z_AXIS,this.rotation),gn.compose(this.position,s,this.scaleFactors);const o=[new b(0,0,0),new b(t,0,0),new b(t,-r,0),new b(0,-r,0)];for(const a of o)i.expandByPoint(a.applyMatrix4(gn));return i}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:e=>{this.numRows=e}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:e=>{this.numColumns=e}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((e,t)=>e+t,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((e,t)=>e+t,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}subWorldDraw(e){const t=this.blockTableRecord;if(t&&t.newIterator().count>0){const g=this.drawAnonymousTableBlock(e,t);if(g)return g}let r=0,i=0;const s=new Uint16Array(this.numColumns*this.numRows*8),o=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let g=0;g<=this.numRows;g++){r-=g>0?this.rowHeight(g-1):0,i=0;for(let f=0;f<=this.numColumns;f++)i+=f>0?this.columnWidth(f-1):0,o[a++]=i,o[a++]=r,o[a++]=0}const l=[],c=new Array(this.numRows*this.numColumns).fill(!1);i=0,a=0;let h=0;for(let g=0;g<this.numColumns;g++){i+=g>0?this.columnWidth(g-1):0,r=0;for(let f=0;f<this.numRows;f++){r+=f>0?this.rowHeight(f-1):0;const m=this.cell(f*this.numColumns+g);if(h=f*this.numColumns+g,m&&!c[h]){const y=m.borderWidth??1,_=m.borderHeight??1;this.fillVisited(c,h,this.numColumns,y,_),s[a++]=g+f*(this.numColumns+1),s[a++]=g+f*(this.numColumns+1)+y;const P=o[s[a-1]*3]-i,L=g+(f+_)*(this.numColumns+1)+y;g+y==this.numColumns&&(s[a++]=g+f*(this.numColumns+1)+y,s[a++]=L);const S=-o[L*3+1]-r;if(f+_==this.numRows&&(s[a++]=g+(f+_)*(this.numColumns+1)+_,s[a++]=g+(f+_)*(this.numColumns+1)),s[a++]=g+(f+_)*(this.numColumns+1),s[a++]=g+f*(this.numColumns+1),m.text){const A=m.attachmentPoint||this.attachmentPoint||exports.AcGiMTextAttachmentPoint.MiddleCenter,N=this.getTableTextOffset(A,P,S),C={text:m.text,height:this.getCellTextHeight(m,S),width:P,position:Og.set(i,-r,0).clone().add(N),rotation:this.rotation,attachmentPoint:A},z=this.getTextStyle(m);l.push(e.mtext(C,z))}}}}l.push(e.lineSegments(o,3,s));const d=e.group(l),p=new Sn;return p.setFromAxisAngle(x.Z_AXIS,this.rotation),gn.compose(this.position,p,this.scaleFactors),d.applyMatrix(gn),d}drawAnonymousTableBlock(e,t){const r=[],i=t.newIterator();for(const a of i){let l;a.color.isByBlock&&this.rgbColor?(ha.copy(a.color),a.color.setRGBValue(this.rgbColor),l=a.worldDraw(e),a.color.copy(ha)):l=a.worldDraw(e),l&&(l.objectId=this.objectId,l.ownerId=this.ownerId,l.layerName=this.layer,l.visible=this.visibility&&a.visibility,r.push(l))}const s=e.group(r);s.applyMatrix(this.blockTransform);const o=this.normal;return o&&(o.x!==0||o.y!==0||o.z!==1)&&(gn.setFromExtrusionDirection(o),s.applyMatrix(gn)),s}fillVisited(e,t,r,i,s){if(s==1&&i==1)e[t]=!0;else for(let o=0;o<i;++o)for(let a=0;a<s;++a)e[t+o+a*r]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable.resolveAt(e.textStyle);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}getTableTextOffset(e,t,r){const i=new x;switch(e){case 1:break;case 2:i.setX(t/2);break;case 3:i.setX(t);break;case 4:i.setY(-r/2);break;case 5:i.set(t/2,-r/2,0);break;case 6:i.set(t,-r/2,0);break;case 7:i.setY(-r);break;case 8:i.set(t/2,-r,0);break;case 9:i.set(t,-r,0);break}return i}getCellTextHeight(e,t){return e.textHeight&&e.textHeight>0?e.textHeight:Math.max(t/2,1)}dxfOutFields(e){var s,o,a,l,c,h,d;super.dxfOutFields(e),e.writeSubclassMarker("AcDbTable");const t=e.version??((s=e.database)==null?void 0:s.version)??((o=this.database)==null?void 0:o.version),r=(t==null?void 0:t.value)!=null?t.value>=27:!1;e.writeInt16(280,this.tableDataVersion),e.writeObjectId(342,this.tableStyleId),e.writeObjectId(343,this.owningBlockRecordId),e.writeVector3d(11,this.horizontalDirection),e.writeUInt32(90,this.tableValueFlag),e.writeUInt32(93,this.tableOverrideFlag),e.writeUInt32(94,this.borderColorOverrideFlag),e.writeUInt32(95,this.borderLineweightOverrideFlag),e.writeUInt32(96,this.borderVisibilityOverrideFlag),e.writeInt16(71,this.attachmentPoint),e.writeInt32(91,this.numRows),e.writeInt32(92,this.numColumns);for(let p=0;p<this.numRows;++p)e.writeDouble(141,this.rowHeight(p));for(let p=0;p<this.numColumns;++p)e.writeDouble(142,this.columnWidth(p));const i=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let p=0;p<i;p++){const g=this._cells[p],f=(g==null?void 0:g.cellType)??(g!=null&&g.blockTableRecordId?2:1);if(e.writeInt16(171,f),e.writeInt16(172,(g==null?void 0:g.flagValue)??0),e.writeInt16(173,(g==null?void 0:g.mergedValue)??0),e.writeBoolean(174,g==null?void 0:g.autoFit),e.writeInt16(175,g==null?void 0:g.borderWidth),e.writeInt16(176,g==null?void 0:g.borderHeight),(g==null?void 0:g.overrideFlag)!=null&&(r?e.writeInt32(91,g.overrideFlag):e.writeInt16(177,g.overrideFlag)),e.writeInt16(178,g==null?void 0:g.virtualEdgeFlag),e.writeAngle(145,g==null?void 0:g.rotation),r&&e.writeInt16(92,g==null?void 0:g.extendedCellFlags),f===1)g!=null&&g.fieldObjetId?e.writeObjectId(344,g.fieldObjetId):this.writeCellText(e,(g==null?void 0:g.text)??"",r,g==null?void 0:g.cellValueBlockBegin);else if(f===2){if(e.writeObjectId(340,g==null?void 0:g.blockTableRecordId),e.writeDouble(144,g==null?void 0:g.blockScale),e.writeInt16(179,g==null?void 0:g.blockAttrNum),(a=g==null?void 0:g.attrDefineId)!=null&&a.length)for(const m of g.attrDefineId)e.writeObjectId(331,m);if((g==null?void 0:g.attrText)!=null)if(Array.isArray(g.attrText))for(const m of g.attrText)e.writeString(300,m);else e.writeString(300,g.attrText)}g!=null&&g.textStyle&&e.writeString(7,g.textStyle),(g==null?void 0:g.textHeight)!=null&&e.writeDouble(140,g.textHeight),(g==null?void 0:g.attachmentPoint)!=null&&e.writeInt16(170,g.attachmentPoint),(g==null?void 0:g.topBorderVisibility)!=null&&e.writeInt16(289,g.topBorderVisibility?1:0),(g==null?void 0:g.rightBorderVisibility)!=null&&e.writeInt16(285,g.rightBorderVisibility?1:0),(g==null?void 0:g.bottomBorderVisibility)!=null&&e.writeInt16(286,g.bottomBorderVisibility?1:0),(g==null?void 0:g.leftBorderVisibility)!=null&&e.writeInt16(288,g.leftBorderVisibility?1:0)}if(e.writeInt16(70,this.flowDirection),e.writeDouble(40,this.horizontalCellMargin),e.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&e.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&e.writeInt16(281,this.suppressHeader?1:0),(l=this.cellTypeOverrides)!=null&&l.length)for(const p of this.cellTypeOverrides){e.writeString(7,p.textStyle),e.writeDouble(140,p.textHeight),e.writeInt16(170,p.alignment),e.writeInt16(63,p.backgroundColor),e.writeInt16(64,p.contentColor),p.backgroundColorEnabled!=null&&e.writeInt16(283,p.backgroundColorEnabled?1:0);const g=p.borderLineweights;g&&(e.writeInt16(274,g.top),e.writeInt16(275,g.right),e.writeInt16(276,g.bottom),e.writeInt16(277,g.left),e.writeInt16(278,g.insideHorizontal),e.writeInt16(279,g.insideVertical));const f=p.borderVisibility;f&&(e.writeInt16(284,f.top?1:0),e.writeInt16(285,f.right?1:0),e.writeInt16(286,f.bottom?1:0),e.writeInt16(287,f.left?1:0),e.writeInt16(288,f.insideHorizontal?1:0),e.writeInt16(289,f.insideVertical?1:0))}if(this.tableBorderColors&&(e.writeInt16(63,this.tableBorderColors.left),e.writeInt16(64,this.tableBorderColors.top),e.writeInt16(65,this.tableBorderColors.insideHorizontal),e.writeInt16(66,this.tableBorderColors.bottom),e.writeInt16(68,this.tableBorderColors.insideVertical),e.writeInt16(69,this.tableBorderColors.right)),(c=this.rowDataTypes)!=null&&c.length)for(const p of this.rowDataTypes)e.writeInt16(97,p);if((h=this.rowUnitTypes)!=null&&h.length)for(const p of this.rowUnitTypes)e.writeInt16(98,p);if((d=this.rowFormats)!=null&&d.length)for(const p of this.rowFormats)e.writeString(4,p);return this}writeCellText(e,t,r,i){if(!r){if(t.length<=250){e.writeString(1,t);return}const a=Math.ceil(t.length/250);for(let l=0;l<a;l++){const c=l*250,h=c+250,d=t.slice(c,h);l===a-1?e.writeString(1,d):e.writeString(2,d)}return}if(e.writeString(301,i??"CELL_VALUE"),t.length<=250){e.writeString(302,t),e.writeString(304,"ACVALUE_END");return}const o=Math.ceil(t.length/250);for(let a=0;a<o;a++){const l=a*250,c=l+250,h=t.slice(l,c);a===o-1?e.writeString(302,h):e.writeString(303,h)}e.writeString(304,"ACVALUE_END")}};So.typeName="Table";let ai=So;const gn=new D,ha=new R,ir=class ir extends ge{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new b,new b,new b,new b]}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new B().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;return e.push(...this._vertices),e}subGetOsnapPoints(e,t,r,i){const s=[this._vertices[0],this._vertices[1],this._vertices[3],this._vertices[2]];Zs(s,!0,e,t,i)}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this._elevation=this._vertices[0].z,this}subWorldDraw(e){const t=new ee(ir.boundaryPointsFromVertices(this._vertices),!0),r=new Nt;r.add(t);const i=e.subEntityTraits;return i.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.area(r)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbTrace"),e.writeDouble(38,this.elevation),e.writeDouble(39,this.thickness),e.writePoint3d(10,this.getPointAt(0)),e.writePoint3d(11,this.getPointAt(1)),e.writePoint3d(12,this.getPointAt(2)),e.writePoint3d(13,this.getPointAt(3)),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectBoundary2d();return t.length<2?1:Ae.from2dPoints(t,!0).getOffsetSideAtPoint(e)}createOffsetCurve(e){return Ri(this.collectBoundary2d(),!0,e)}collectBoundary2d(){return ir.boundaryPointsFromVertices(this._vertices)}static boundaryPointsFromVertices(e){const t=e[0],r=e[1],i=e[2],s=e[3];return[new E(t.x,t.y),new E(r.x,r.y),new E(s.x,s.y),new E(i.x,i.y)]}};ir.typeName="Trace";let li=ir;const Lo=class Lo extends le{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new b}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new B().expandByPoint(this._geo)}subGetGripPoints(){return[this._geo]}subGetOsnapPoints(e,t,r,i){e===v.Node&&i.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}transformBy(e){return this._geo.applyMatrix4(e),this}subWorldDraw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbPoint"),e.writePoint3d(10,this.position),this}};Lo.typeName="Point";let ci=Lo;var tc=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(tc||{}),nc=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(nc||{});const Io=class Io extends le{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new b,this._scale=new Z(1,1),this._rotation=0,this._imageSize=new E,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get imageSize(){return this._imageSize}set imageSize(e){this._imageSize.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isShownClipped(){return this._isShownClipped}set isShownClipped(e){this._isShownClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new B;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}subGetOsnapPoints(e,t,r,i){if(e===v.Insertion){i.push(this._position);return}const s=this.boundaryPath();if(s.length===0)return;let o=s;if(s.length>1){const a=s[0],l=s[s.length-1];a.x===l.x&&a.y===l.y&&(a.z||0)===(l.z||0)&&(o=s.slice(0,-1))}if(e===v.EndPoint){i.push(...o);return}Zs(o,!0,e,t,i)}subWorldDraw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t)}transformBy(e){const t=this._width*this._scale.x,r=this._height*this._scale.y,i=new x(t*Math.cos(this._rotation),t*Math.sin(this._rotation),0),s=new x(-r*Math.sin(this._rotation),r*Math.cos(this._rotation),0),o=this._position.clone(),a=this._position.clone().add(i),l=this._position.clone().add(s);o.applyMatrix4(e),a.applyMatrix4(e),l.applyMatrix4(e);const c=new x(a).sub(o),h=new x(l).sub(o);return this._position.copy(o),this._rotation=Math.atan2(c.y,c.x),this._width=c.length(),this._height=h.length(),this._scale.set(1,1),this}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,r=this._height,i=new xe;i.setFromPoints(this._clipBoundary);const s=new E;s.setX(this._position.x-i.min.x*t),s.setY(this._position.y-i.min.y*r),this._clipBoundary.forEach(o=>{const a=o.x*t+s.x,l=o.y*r+s.y;e.push(new b(a,l,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){da.copy(e[1]);for(let t=1;t<4;t++)Mr.copy(e[t]),Mr.rotateAround(da,this._rotation),e[t].setX(Mr.x),e[t].setY(Mr.y)}e.push(e[0])}return e}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbRasterImage"),e.writePoint3d(10,this.position);const t=this.width*this.scale.x,r=this.height*this.scale.y,i=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:t,y:r},s=i.x>0?t/i.x:t,o=i.y>0?r/i.y:r,a=Math.cos(this._rotation),l=Math.sin(this._rotation);e.writePoint3d(11,{x:s*a,y:s*l,z:0}),e.writePoint3d(12,{x:-o*l,y:o*a,z:0}),e.writePoint2d(13,i),e.writeObjectId(340,this.imageDefId);const c=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(e.writeInt16(70,c),e.writeInt16(280,this.isClipped?1:0),e.writeInt16(281,this.brightness),e.writeInt16(282,this.contrast),e.writeInt16(283,this.fade),e.writeInt16(71,this.clipBoundaryType),this.isClipped){e.writeInt16(91,this.clipBoundary.length);for(const h of this.clipBoundary)e.writePoint2d(14,h)}return this}};Io.typeName="RasterImage";let gr=Io;const da=new E,Mr=new E,Oi=class Oi extends ge{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new b,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new B;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}subGetOsnapPoints(e,t,r,i){const s=this.basePoint;if(e===v.EndPoint){i.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new bt(s,s.clone().add(o));switch(e){case v.Nearest:{const l=a.project(t),h=new x(l).sub(s).dot(o);i.push(h<0?s:l);break}case v.Perpendicular:i.push(a.perpPoint(t));break}}transformBy(e){return this._basePoint.applyMatrix4(e),this._unitDir.transformDirection(e),this}subWorldDraw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRay"),e.writePoint3d(10,this.basePoint),e.writeVector3d(11,this.unitDir),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.basePoint,r=this.unitDir,i=Math.hypot(r.x,r.y);return i<=1e-9||(r.x*(e.y-t.y)-r.y*(e.x-t.x))/i>=0?1:-1}createOffsetCurve(e){const t=ll(this.basePoint,this.unitDir,e);if(!t)return null;const r=new Oi;return r.basePoint=t,r.unitDir=this.unitDir.clone(),r}};Oi.typeName="Ray";let hi=Oi;const Eo=class Eo extends le{get dxfTypeName(){return"SHAPE"}constructor(){super(),this._position=new b,this._size=1,this._name="",this._rotation=0,this._widthFactor=1,this._oblique=0,this._thickness=0,this._normal=new x(0,0,1),this._shapeNumber=0,this._styleName=""}get position(){return this._position}set position(e){this._position.copy(e)}get size(){return this._size}set size(e){this._size=e}get name(){return this._name}set name(e){this._name=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get shapeNumber(){return this._shapeNumber}set shapeNumber(e){this._shapeNumber=e}get styleId(){var t,r,i;const e=(i=(r=(t=this.database)==null?void 0:t.tables)==null?void 0:r.textStyleTable)==null?void 0:i.resolveAt(this._styleName);return(e==null?void 0:e.objectId)??""}set styleId(e){var r,i,s;const t=(s=(i=(r=this.database)==null?void 0:r.tables)==null?void 0:i.textStyleTable)==null?void 0:s.getIdAt(e);t&&(this._styleName=t.name)}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get isPlanar(){return!0}get geometricExtents(){const e=Math.abs(this._size)/2,t=new B;return t.expandByPoint(this._position),e>0&&(t.expandByPoint(new b(this._position.x-e,this._position.y-e,this._position.z)),t.expandByPoint(new b(this._position.x+e,this._position.y+e,this._position.z))),t}subGetGripPoints(){return[this._position]}subGetOsnapPoints(e,t,r,i){e===v.Insertion&&i.push(this._position)}transformBy(e){const t=new D().setFromExtrusionDirection(this._normal),r=new D().makeRotationZ(this._rotation),i=new D().multiplyMatrices(t,r),s=this._position.clone(),o=new b(this._widthFactor,0,0).applyMatrix4(i).add(s),a=new b(0,1,0).applyMatrix4(i).add(s),l=new b(0,0,1).applyMatrix4(i).add(s);s.applyMatrix4(e),o.applyMatrix4(e),a.applyMatrix4(e),l.applyMatrix4(e);const c=new x(o).sub(s),h=new x(a).sub(s),d=new x(l).sub(s);let p=new x().crossVectors(c,h);p.lengthSq()===0?p=this._normal.clone().transformDirection(e):p.normalize();const f=new D().setFromExtrusionDirection(p).clone().invert(),m=c.clone().applyMatrix4(f),y=h.length(),_=c.length();this._position.copy(s),this._normal.copy(p),_>0&&(this._rotation=Math.atan2(m.y,m.x)),y>0&&(this._size*=y,_>0&&(this._widthFactor*=_/y));const P=d.length();return P>0&&(this._thickness*=P),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"shape",properties:[{name:"name",type:"string",editable:!0,accessor:{get:()=>this.name,set:e=>{this.name=e}}},{name:"size",type:"float",editable:!0,accessor:{get:()=>this.size,set:e=>{this.size=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:e=>{this.widthFactor=e}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:e=>{this.oblique=e}}},{name:"shapeNumber",type:"int",editable:!0,accessor:{get:()=>this.shapeNumber,set:e=>{this.shapeNumber=e}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}subWorldDraw(e,t){const i={...this.getTextStyle(),widthFactor:this.widthFactor,obliqueAngle:this.oblique*180/Math.PI},s={name:this._name.trim()||void 0,shapeNumber:this._shapeNumber!==0?this._shapeNumber:void 0,size:this.size,position:this._position,rotation:this._rotation,directionVector:this._normal,widthFactor:this.widthFactor};return e.shape(s,i,t)}getTextStyle(){const e=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbShape"),e.writePoint3d(10,this.position),e.writeDouble(40,this.size),e.writeString(2,this.name),e.writeAngle(50,this.rotation),e.writeDouble(41,this.widthFactor),e.writeAngle(51,this.oblique),e.writeDouble(39,this.thickness),this._styleName&&e.writeString(3,this._styleName),e.writeVector3d(210,this.normal),this}};Eo.typeName="Shape";let di=Eo;const To=class To extends le{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new b,this._height=0,this._width=0,this._viewCenter=new b,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){const e=this._width/2,t=this._height/2,r=new B;return r.expandByPoint(new b(this._centerPoint.x-e,this._centerPoint.y-t,this._centerPoint.z)),r.expandByPoint(new b(this._centerPoint.x+e,this._centerPoint.y+t,this._centerPoint.z)),r}transformBy(e){const t=this._centerPoint.clone(),r=this._centerPoint.clone().add(new x(this._width,0,0)),i=this._centerPoint.clone().add(new x(0,this._height,0));t.applyMatrix4(e),r.applyMatrix4(e),i.applyMatrix4(e);const s=new x(r).sub(t),o=new x(i).sub(t),a=this._height!==0?o.length()/this._height:1;return this._centerPoint.copy(t),this._width=s.length(),this._height=o.length(),this._viewHeight*=a,this}subWorldDraw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport();return e.group(this.createViewportRect(t,e))}}toGiViewport(){const e=new Fl;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const r=[];return r.push(t.lines([new b(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new b(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)])),r.push(t.lines([new b(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new b(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)])),r.push(t.lines([new b(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new b(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)])),r.push(t.lines([new b(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new b(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)])),r}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewport"),e.writePoint3d(10,this.centerPoint),e.writeDouble(40,this.height),e.writeDouble(41,this.width),e.writePoint3d(12,this.viewCenter),e.writeDouble(45,this.viewHeight),e.writeInt32(69,this.number),this}};To.typeName="Viewport";let ui=To;const Co=class Co extends gr{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(e){const t=this.boundaryPath(),r=new Nt;return r.add(new ee(t)),e.area(r)}dxfOutFields(e){return super.dxfOutFields(e),this}};Co.typeName="Wipeout";let gi=Co;const ki=class ki extends ge{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new b,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new B;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}subGetOsnapPoints(e,t,r,i){const s=this.basePoint;if(e===v.EndPoint){i.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new bt(s,s.clone().add(o));switch(e){case v.Nearest:i.push(a.project(t));break;case v.Perpendicular:i.push(a.perpPoint(t));break}}transformBy(e){return this._basePoint.applyMatrix4(e),this._unitDir.transformDirection(e),this}subWorldDraw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbXline"),e.writePoint3d(10,this.basePoint),e.writeVector3d(11,this.unitDir),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.basePoint,r=this.unitDir,i=Math.hypot(r.x,r.y);return i<=1e-9||(r.x*(e.y-t.y)-r.y*(e.x-t.x))/i>=0?1:-1}createOffsetCurve(e){const t=ll(this.basePoint,this.unitDir,e);if(!t)return null;const r=new ki;return r.basePoint=t,r.unitDir=this.unitDir.clone(),r}};ki.typeName="Xline";let pi=ki;class rc{constructor(e){this.position=new b(e.x,e.y,e.z||0)}}const Mo=class Mo extends ge{get dxfTypeName(){return"POLYLINE"}constructor(e,t,r,i=!1,s=!1){super(),this._mCount=e,this._nCount=t,this._closedM=i,this._closedN=s,this._vertices=r.map(o=>new rc(o))}get mCount(){return this._mCount}get nCount(){return this._nCount}get closedM(){return this._closedM}get closedN(){return this._closedN}get closed(){return this._closedM}set closed(e){this._closedM=e}get numberOfVertices(){return this._vertices.length}getVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[e]}getVertexAtMN(e,t){const r=e*this._nCount+t;return this.getVertexAt(r)}get geometricExtents(){if(this._vertices.length===0)return new B(new b(0,0,0),new b(0,0,0));let e=Number.MAX_VALUE,t=Number.MAX_VALUE,r=Number.MAX_VALUE,i=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{e=Math.min(e,a.position.x),t=Math.min(t,a.position.y),r=Math.min(r,a.position.z),i=Math.max(i,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new B(new b(e,t,r),new b(i,s,o))}subGetGripPoints(){const e=new Array;return this._vertices.forEach(t=>{e.push(t.position)}),e}subGetOsnapPoints(e,t,r,i){switch(e){case v.EndPoint:this._vertices.forEach(s=>{i.push(s.position)});break}}transformBy(e){return this._vertices.forEach(t=>{t.position.applyMatrix4(e)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"mCount",type:"float",editable:!1,accessor:{get:()=>this._mCount}},{name:"nCount",type:"float",editable:!1,accessor:{get:()=>this._nCount}},{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(e=>({x:e.position.x,y:e.position.y,z:e.position.z}))}}]},{groupName:"others",properties:[{name:"closedM",type:"boolean",editable:!0,accessor:{get:()=>this._closedM,set:e=>{this._closedM=e}}},{name:"closedN",type:"boolean",editable:!0,accessor:{get:()=>this._closedN,set:e=>{this._closedN=e}}}]}]}}subWorldDraw(e){const t=[];for(let r=0;r<this._mCount;r++)for(let i=0;i<this._nCount;i++){const s=this.getVertexAtMN(r,i);let o=i+1;if(o>=this._nCount)if(this._closedN)o=0;else continue;const a=this.getVertexAtMN(r,o);t.push(s.position),t.push(a.position)}for(let r=0;r<this._nCount;r++)for(let i=0;i<this._mCount;i++){const s=this.getVertexAtMN(i,r);let o=i+1;if(o>=this._mCount)if(this._closedM)o=0;else continue;const a=this.getVertexAtMN(o,r);t.push(s.position),t.push(a.position)}return e.lines(t)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolygonMesh");let t=16;return this._closedM&&(t|=1),this._closedN&&(t|=32),e.writeInt16(66,1),e.writeInt16(70,t),e.writeInt32(71,this._mCount),e.writeInt32(72,this._nCount),this}dxfOut(e,t=!1){super.dxfOut(e,t);for(let r=0;r<this.numberOfVertices;r++){const i=this.getVertexAt(r);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolygonMeshVertex"),e.writePoint3d(10,i.position),e.writeInt16(70,16)}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectBoundary2d();return t.length<2?1:Ae.from2dPoints(t,this.isBoundaryClosed()).getOffsetSideAtPoint(e)}createOffsetCurve(e){return Ri(this.collectBoundary2d(),this.isBoundaryClosed(),e)}isBoundaryClosed(){return this._closedM&&this._closedN&&this._mCount>1&&this._nCount>1}collectBoundary2d(){const e=this._mCount,t=this._nCount;if(e<1||t<1)return[];const r=[],i=(s,o)=>{const a=this.getVertexAtMN(s,o).position;r.push(new E(a.x,a.y))};if(e===1){for(let s=0;s<t;s++)i(0,s);return r}if(t===1){for(let s=0;s<e;s++)i(s,0);return r}for(let s=0;s<t;s++)i(0,s);for(let s=1;s<e;s++)i(s,t-1);for(let s=t-2;s>=0;s--)i(e-1,s);for(let s=e-2;s>=1;s--)i(s,0);return r}};Mo.typeName="PolygonMesh";let fi=Mo;class ic{constructor(e){this.position=new b(e.x,e.y,e.z||0)}}class sc{constructor(e){this.vertexIndices=e}}const Oo=class Oo extends ge{get dxfTypeName(){return"POLYLINE"}constructor(e,t){super(),this._vertices=e.map(r=>new ic(r)),this._faces=t.map(r=>new sc(r))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}set closed(e){}getVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[e]}getFaceAt(e){if(e<0||e>=this._faces.length)throw new Error("Face index out of bounds");return this._faces[e]}get geometricExtents(){if(this._vertices.length===0)return new B(new b(0,0,0),new b(0,0,0));let e=Number.MAX_VALUE,t=Number.MAX_VALUE,r=Number.MAX_VALUE,i=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{e=Math.min(e,a.position.x),t=Math.min(t,a.position.y),r=Math.min(r,a.position.z),i=Math.max(i,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new B(new b(e,t,r),new b(i,s,o))}subGetGripPoints(){const e=new Array;return this._vertices.forEach(t=>{e.push(t.position)}),e}subGetOsnapPoints(e,t,r,i){switch(e){case v.EndPoint:this._vertices.forEach(s=>{i.push(s.position)});break}}transformBy(e){return this._vertices.forEach(t=>{t.position.applyMatrix4(e)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(e=>({x:e.position.x,y:e.position.y,z:e.position.z}))}},{name:"faces",type:"array",editable:!1,itemSchema:{properties:[{name:"vertexIndices",type:"array",editable:!1,itemSchema:{properties:[{name:"index",type:"int",editable:!1}]}}]},accessor:{get:()=>this._faces.map(e=>({vertexIndices:e.vertexIndices}))}}]}]}}subWorldDraw(e){const t=[];return this._faces.forEach(r=>{const i=[];if(r.vertexIndices.forEach(s=>{const o=Math.abs(s)-1;o>=0&&o<this._vertices.length&&i.push(this._vertices[o].position)}),i.length>=3)for(let s=0;s<i.length;s++){const o=i[s],a=i[(s+1)%i.length];t.push(o),t.push(a)}}),e.lines(t)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolyFaceMesh");const t=64;return e.writeInt16(66,1),e.writeInt16(70,t),this}dxfOut(e,t=!1){super.dxfOut(e,t);for(let r=0;r<this.numberOfVertices;r++){const i=this.getVertexAt(r);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolyFaceMeshVertex"),e.writePoint3d(10,i.position),e.writeInt16(70,64)}for(let r=0;r<this.numberOfFaces;r++){const i=this.getFaceAt(r);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolyFaceMeshVertex"),e.writeInt16(70,128),i.vertexIndices.forEach((s,o)=>{e.writeInt32(10+o,s)})}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(e){const t=this.createOffsetCurve(e);return t?[t]:[]}getOffsetSideAtPoint(e){const t=this.collectLargestFaceBoundary2d();return t.length<2?1:Ae.from2dPoints(t,!0).getOffsetSideAtPoint(e)}createOffsetCurve(e){return Ri(this.collectLargestFaceBoundary2d(),!0,e)}collectLargestFaceBoundary2d(){let e=[];for(const t of this._faces){const r=t.vertexIndices.filter(i=>i>=0);r.length>e.length&&(e=r)}return e.length<2?this._vertices.map(t=>new E(t.position.x,t.position.y)):e.map(t=>{const r=this.getVertexAt(t).position;return new E(r.x,r.y)})}};Oo.typeName="PolyFaceMesh";let mi=Oo;var yi=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(yi||{});const ko=class ko extends le{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new b,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new b,this._textRotation=0,this._normal=new x(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(e){this._dimBlockPosition.copy(e)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e,this._dimStyle=void 0}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new on),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get properties(){return this.getBaseProperties()}getBaseProperties(){return{type:this.type,groups:[this.getGeneralProperties(),this.getDimensionProperties()]}}transformBy(e){const t=this._textPosition.clone(),r=this._textPosition.clone().add(new x(Math.cos(this._textRotation),Math.sin(this._textRotation),0));this._dimBlockPosition.applyMatrix4(e),this._textPosition.applyMatrix4(e),this._normal.transformDirection(e),t.applyMatrix4(e),r.applyMatrix4(e);const i=new x(r).sub(t);return i.lengthSq()>0&&(this._textRotation=Math.atan2(i.y,i.x)),this.subTransformBy(e),this}subGetOsnapPoints(e,t,r,i,s){const o=this.getDimBlockTableRecord();if(!o)return;const a=this.getFullDimBlockTransform(),l=new b(t).applyMatrix4(a.clone().invert()),c=new b(r).applyMatrix4(a.clone().invert()),h=(d,p)=>{const g=[];d.subGetOsnapPoints(e,l,c,g,p,a),d instanceof sn?g.forEach(f=>i.push(f.clone())):g.forEach(f=>i.push(new b(f).applyMatrix4(a)))};if(s){const d=o.getIdAt(s);if(d&&(h(d,s),i.length>0))return}for(const d of o.newIterator())h(d)}subWorldDraw(e){const t=this.getDimBlockTableRecord();if(t){const i=this.computeDimBlockTransform();return an.instance.draw(e,t,this.rgbColor,[],!1,i,this._normal)}return e.group([])}getDimBlockGeometricExtents(){const e=new B,t=this.getDimBlockTableRecord();if(!t)return e;for(const r of t.newIterator())e.union(r.geometricExtents);return e.applyMatrix4(this.getFullDimBlockTransform()),e}getGeometricExtentsFromDimBlockOrPoints(e){const t=this.getDimBlockGeometricExtents();if(!t.isEmpty())return t;const r=new B;for(const i of e)r.expandByPoint(i);return this.hasExplicitTextPosition()&&r.expandByPoint(this.textPosition),r}hasExplicitTextPosition(){const{x:e,y:t,z:r}=this.textPosition;return e!==0||t!==0||r!==0}getDimBlockTableRecord(){return this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0}getDimensionProperties(){return{groupName:"dimension",properties:[this.createProperty("dimensionStyleName","string",()=>this.dimensionStyleName??"",e=>{this.dimensionStyleName=e.trim()===""?null:e}),this.createProperty("dimensionText","string",()=>this.dimensionText??"",e=>{this.dimensionText=e}),this.createProperty("measurement","float",()=>this.getMeasurementPropertyValue()),this.createProperty("dimBlockId","string",()=>this.dimBlockId??""),...this.createPoint3dProperties("dimBlockPosition",()=>this.dimBlockPosition),...this.createPoint3dProperties("textPosition",()=>this.textPosition),this.createProperty("textRotation","float",()=>this.textRotation,e=>{this.textRotation=e}),this.createProperty("textLineSpacingFactor","float",()=>this.textLineSpacingFactor,e=>{this.textLineSpacingFactor=e}),this.createProperty("textLineSpacingStyle","enum",()=>this.textLineSpacingStyle,e=>{this.textLineSpacingStyle=e},[{label:yi[1],value:1},{label:yi[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(e,t,r,i,s){return{name:e,type:t,editable:i!=null,options:s,accessor:i?{get:r,set:i}:{get:r}}}createPoint3dProperties(e,t){return[this.createProperty(`${e}X`,"float",()=>t().x,r=>{t().x=r}),this.createProperty(`${e}Y`,"float",()=>t().y,r=>{t().y=r}),this.createProperty(`${e}Z`,"float",()=>t().z,r=>{t().z=r})]}getMeasurementPropertyValue(){return this.measurement}getFullDimBlockTransform(){const e=this.computeDimBlockTransform();if(this._normal.x===0&&this._normal.y===0&&this._normal.z===1)return e;const t=new D().setFromExtrusionDirection(this._normal);return new D().multiplyMatrices(t,e)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}findPointOnLine1(e,t,r){const i=new b().subVectors(t,e).normalize();return new b(t).addScaledVector(i,r)}findPointOnLine2(e,t,r){const i=e.x+r*Math.cos(t),s=e.y+r*Math.sin(t);return{x:i,y:s}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():exports.AcGiArrowType.Closed}computeDimBlockTransform(){const e=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,t=(e==null?void 0:e.origin)??b.ORIGIN,r=new D().makeTranslation(-t.x,-t.y,-t.z),i=new D().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new D().multiplyMatrices(i,r)}subTransformBy(e){}dxfOutFields(e){super.dxfOutFields(e);const t=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return e.writeSubclassMarker("AcDbDimension"),e.writeInt16(280,0),e.writeString(2,this.dimBlockId??void 0),e.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),e.writePoint3d(10,this.dimBlockPosition),e.writeString(1,this.dimensionText??""),e.writeAngle(53,this.textRotation),e.writePoint3d(11,this.textPosition),e.writeInt16(70,0),e.writeInt16(72,this.textLineSpacingStyle),e.writeDouble(41,this.textLineSpacingFactor),e.writeDouble(42,this.measurement),e.writeVector3d(210,this.normal),e.writeObjectId(340,t==null?void 0:t.objectId),this}};ko.typeName="Dimension";let xt=ko;const No=class No extends xt{constructor(e,t,r,i,s=null,o=null){super(),this._centerPoint=new b().copy(e),this._xLine1Point=new b().copy(t),this._xLine2Point=new b().copy(r),this._arcPoint=new b().copy(i),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}subTransformBy(e){this._arcPoint.applyMatrix4(e),this._centerPoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDb3PointAngularDimension"),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.centerPoint),e.writePoint3d(16,this.arcPoint),this}};No.typeName="3PointAngularDimension";let _i=No;const Yo=class Yo extends xt{constructor(e,t,r,i=null,s=null){super(),this._dimLinePoint=new b().copy(r),this._xLine1Point=new b().copy(e),this._xLine2Point=new b().copy(t),this._oblique=0,this._rotation=0,this.calculateRotation(),i?this.dimensionText=i:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=s}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("dimLinePoint",()=>this.dimLinePoint),this.createProperty("rotation","float",()=>this.rotation,t=>{this.rotation=t}),this.createProperty("oblique","float",()=>this.oblique,t=>{this.oblique=t})]}]}}subTransformBy(e){this._dimLinePoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e),this.calculateRotation()}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.dimLinePoint])}get isAppendArrow(){return!1}createDimBlock(e){const t=new se;t.name=e;const r=this.createLines();r.forEach(a=>t.appendEntity(new hr(a.startPoint,a.endPoint))),this.createArrows(r[0]).forEach(a=>t.appendEntity(a));const s=r[0].midPoint,o=this.createMText(s,this._rotation);return o&&t.appendEntity(o),t}createMText(e,t){const r=i=>({x:Math.cos(i),y:Math.sin(i),z:0});if(this.dimensionText){const i=new dr;return i.attachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,i.layer="0",i.color=new R(exports.AcCmColorMethod.ByBlock),i.location=e,i.contents=this.dimensionText??"",i.height=10,i.direction=r(t),i.styleName=this.dimensionStyle.dimtxsty,i}}createArrows(e){const t=[];return t.push(this.createArrow(e.startPoint,this.rotation+Math.PI,10)),t.push(this.createArrow(e.endPoint,this.rotation,10)),t}createArrow(e,t,r){const i="_CAXARROW",s=new sn(i);return s.position=e,s.rotation=t,s.scaleFactors={x:r,y:r,z:r},s}createLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),r=this.createExtensionLine(this._xLine2Point),i=this.findIntersectionPoint(t,this._dimLinePoint),s=this.findIntersectionPoint(r,this._dimLinePoint),o=new bt(i,s);return e.push(o),t.endPoint=i,this.adjustExtensionLine(t),e.push(t),r.endPoint=s,this.adjustExtensionLine(r),e.push(r),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,r=this.findPointOnLine2(e,t,100);return new bt(e,{...r,z:e.z})}findIntersectionPoint(e,t){const r=e.startPoint,i=e.endPoint,s=new x().subVectors(i,r).normalize(),a=new x().subVectors(t,r).dot(s),l=new x().copy(s).multiplyScalar(a);return new x().addVectors(r,l)}calculateRotation(){const e=this._xLine1Point,t=this._xLine2Point,r=t.x-e.x,i=t.y-e.y;this._rotation=Math.atan2(i,r)}get dxfSubclassMarker(){return"AcDbAlignedDimension"}getMeasurementPropertyValue(){return this.measurement??this.xLine1Point.distanceTo(this.xLine2Point)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker(this.dxfSubclassMarker),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.dimLinePoint),e.writeAngle(50,this.rotation),e.writeAngle(52,this.oblique),this}};Yo.typeName="AlignedDimension";let pr=Yo;const Xo=class Xo extends xt{constructor(e,t,r,i,s=null,o=null){super(),this._arcPoint=new b().copy(i),this._xLine1Point=new b().copy(t),this._xLine2Point=new b().copy(r),this._centerPoint=new b().copy(e),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}subTransformBy(e){this._arcPoint.applyMatrix4(e),this._centerPoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbArcDimension"),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.centerPoint),e.writePoint3d(16,this.arcPoint),this}};Xo.typeName="ArcDimension";let Is=Xo;const Ro=class Ro extends xt{constructor(e,t,r=0,i=null,s=null){super(),this._chordPoint=new b().copy(e),this._farChordPoint=new b().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=r,this.dimensionText=i,this.dimensionStyleName=s}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLength(e){this._leaderLength=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),...this.createPoint3dProperties("farChordPoint",()=>this.farChordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,t=>{this.leaderLength=t}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,t=>{this.extArcStartAngle=t}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,t=>{this.extArcEndAngle=t})]}]}}subTransformBy(e){this._chordPoint.applyMatrix4(e),this._farChordPoint.applyMatrix4(e)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){const e=[this.chordPoint,this.farChordPoint];if(this.leaderLength>0){const t=this.farChordPoint.clone().sub(this.chordPoint);t.lengthSq()>0&&(t.normalize().multiplyScalar(this.leaderLength),e.push(this.farChordPoint.clone().add(t)))}return this.getGeometricExtentsFromDimBlockOrPoints(e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbDiametricDimension"),e.writePoint3d(15,this.chordPoint),e.writePoint3d(16,this.farChordPoint),e.writeDouble(40,this.leaderLength),e.writeAngle(52,this.extArcStartAngle),e.writeAngle(53,this.extArcEndAngle),this}};Ro.typeName="DiametricDimension";let bi=Ro;const Bo=class Bo extends xt{constructor(e,t,r=null,i=null){super(),this._definingPoint=new b().copy(e),this._leaderEndPoint=new b().copy(t),this.dimensionText=r,this.dimensionStyleName=i}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("definingPoint",()=>this.definingPoint),...this.createPoint3dProperties("leaderEndPoint",()=>this.leaderEndPoint)]}]}}subTransformBy(e){this._definingPoint.applyMatrix4(e),this._leaderEndPoint.applyMatrix4(e)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.definingPoint,this.leaderEndPoint])}get arrowLineCount(){return 0}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbOrdinateDimension"),e.writePoint3d(13,this.definingPoint),e.writePoint3d(14,this.leaderEndPoint),this}};Bo.typeName="OrdinateDimension";let xi=Bo;const Fo=class Fo extends xt{constructor(e,t,r,i=null,s=null){super(),this._center=new b().copy(e),this._chordPoint=new b().copy(t),this._leaderLength=r,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=i,this.dimensionStyleName=s}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLength(e){this._leaderLength=e}set leaderLenght(e){this._leaderLength=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("center",()=>this.center),...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,t=>{this.leaderLength=t}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,t=>{this.extArcStartAngle=t}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,t=>{this.extArcEndAngle=t})]}]}}subTransformBy(e){this._center.applyMatrix4(e),this._chordPoint.applyMatrix4(e)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){const e=[this.center,this.chordPoint];if(this.leaderLength>0){const t=this.chordPoint.clone().sub(this.center);t.lengthSq()>0&&(t.normalize().multiplyScalar(this.leaderLength),e.push(this.chordPoint.clone().add(t)))}return this.getGeometricExtentsFromDimBlockOrPoints(e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRadialDimension"),e.writePoint3d(15,this.center),e.writePoint3d(13,this.chordPoint),e.writeDouble(40,this.leaderLength),e.writeAngle(52,this.extArcStartAngle),e.writeAngle(53,this.extArcEndAngle),this}};Fo.typeName="RadialDimension";let wi=Fo;const Do=class Do extends pr{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};Do.typeName="RotatedDimension";let vi=Do;class tn extends Ge{constructor(e){super(),this.database=e,this.objectId=e.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,r=>this.hasId(r)),this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t),this.database.events.dictObjetSet.dispatch({database:this.database,object:t,key:e})}remove(e){const t=this.getAt(e);return t?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e}),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((r,i)=>{r===t&&(this._recordsByName.delete(i),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:i}))}),!0):!1}removeAll(){this._recordsByName.forEach((e,t)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t})}),this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new _r(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbDictionary"),e.writeInt16(280,1),e.writeInt16(281,1);for(const[t,r]of this._recordsByName)e.writeString(3,t),e.writeObjectId(350,r.objectId);return this}}class oc extends tn{getBtrIdAt(e){for(const[t,r]of this._recordsByName)if(r.blockTableRecordId==e)return r}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class Js extends Ge{constructor(){super(),this._contentType=2,this._drawMLeaderOrderType=1,this._drawLeaderOrderType=0,this._bitFlags=0,this._maxLeaderSegmentsPoints=-1,this._firstSegmentAngleConstraint=0,this._secondSegmentAngleConstraint=0,this._leaderLineType=1,this._leaderLineColor=new R(exports.AcCmColorMethod.ByLayer),this._leaderLineWeight=-2,this._enableLanding=!0,this._landingGap=2,this._enableDogleg=!0,this._doglegLength=8,this._description="",this._arrowSize=4,this._defaultMTextContents="",this._textLeftAttachmentType=1,this._textAngleType=1,this._textAlignmentType=0,this._textRightAttachmentType=1,this._textColor=new R(exports.AcCmColorMethod.ByLayer),this._textHeight=4,this._enableFrameText=!1,this._textAlignAlwaysLeft=!1,this._alignSpace=0,this._blockColor=new R(exports.AcCmColorMethod.ByBlock),this._blockScale=new x(1,1,1),this._enableBlockScale=!0,this._blockRotation=0,this._enableBlockRotation=!1,this._blockConnectionType=0,this._scale=1,this._overwritePropChanged=!1,this._annotative=!1,this._breakSize=0,this._textAttachmentDirection=0,this._bottomTextAttachmentType=9,this._topTextAttachmentType=9,this._extendLeaderToText=!1}get unknown1(){return this._unknown1}set unknown1(e){this._unknown1=e}get contentType(){return this._contentType}set contentType(e){this._contentType=e}get drawMLeaderOrderType(){return this._drawMLeaderOrderType}set drawMLeaderOrderType(e){this._drawMLeaderOrderType=e}get drawLeaderOrderType(){return this._drawLeaderOrderType}set drawLeaderOrderType(e){this._drawLeaderOrderType=e}get bitFlags(){return this._bitFlags}set bitFlags(e){this._bitFlags=e}get maxLeaderSegmentsPoints(){return this._maxLeaderSegmentsPoints}set maxLeaderSegmentsPoints(e){this._maxLeaderSegmentsPoints=e}get maxLeaderSegmentPoints(){return this.maxLeaderSegmentsPoints}set maxLeaderSegmentPoints(e){this.maxLeaderSegmentsPoints=e}get firstSegmentAngleConstraint(){return this._firstSegmentAngleConstraint}set firstSegmentAngleConstraint(e){this._firstSegmentAngleConstraint=e}get secondSegmentAngleConstraint(){return this._secondSegmentAngleConstraint}set secondSegmentAngleConstraint(e){this._secondSegmentAngleConstraint=e}get leaderLineType(){return this._leaderLineType}set leaderLineType(e){this._leaderLineType=e}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(e){this._leaderLineColor.copy(e)}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(e){this._leaderLineTypeId=e}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(e){this._leaderLineWeight=e}get enableLanding(){return this._enableLanding}set enableLanding(e){this._enableLanding=e}get landingEnabled(){return this.enableLanding}set landingEnabled(e){this.enableLanding=e}get landingGap(){return this._landingGap}set landingGap(e){this._landingGap=e}get enableDogleg(){return this._enableDogleg}set enableDogleg(e){this._enableDogleg=e}get doglegEnabled(){return this.enableDogleg}set doglegEnabled(e){this.enableDogleg=e}get doglegLength(){return this._doglegLength}set doglegLength(e){this._doglegLength=e}get description(){return this._description}set description(e){this._description=e}get arrowSymbolId(){return this._arrowSymbolId}set arrowSymbolId(e){this._arrowSymbolId=e}get arrowheadId(){return this.arrowSymbolId}set arrowheadId(e){this.arrowSymbolId=e}get arrowSize(){return this._arrowSize}set arrowSize(e){this._arrowSize=e}get arrowheadSize(){return this.arrowSize}set arrowheadSize(e){this.arrowSize=e}get defaultMTextContents(){return this._defaultMTextContents}set defaultMTextContents(e){this._defaultMTextContents=e}get defaultMText(){return this.defaultMTextContents}set defaultMText(e){this.defaultMTextContents=e}get textString(){return this.defaultMTextContents}set textString(e){this.defaultMTextContents=e}get textStyleId(){return this._textStyleId}set textStyleId(e){this._textStyleId=e}get textStyle(){return this.textStyleId}set textStyle(e){this.textStyleId=e}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(e){this._textLeftAttachmentType=e}get textAngleType(){return this._textAngleType}set textAngleType(e){this._textAngleType=e}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(e){this._textAlignmentType=e}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(e){this._textRightAttachmentType=e}get textColor(){return this._textColor}set textColor(e){this._textColor.copy(e)}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get enableFrameText(){return this._enableFrameText}set enableFrameText(e){this._enableFrameText=e}get textFrameEnabled(){return this.enableFrameText}set textFrameEnabled(e){this.enableFrameText=e}get textAlignAlwaysLeft(){return this._textAlignAlwaysLeft}set textAlignAlwaysLeft(e){this._textAlignAlwaysLeft=e}get alignSpace(){return this._alignSpace}set alignSpace(e){this._alignSpace=e}get blockId(){return this._blockId}set blockId(e){this._blockId=e}get blockContentId(){return this.blockId}set blockContentId(e){this.blockId=e}get blockColor(){return this._blockColor}set blockColor(e){this._blockColor.copy(e)}get blockContentColor(){return this.blockColor}set blockContentColor(e){this.blockColor=e}get blockScale(){return this._blockScale.clone()}set blockScale(e){this._blockScale.copy(e)}get blockContentScale(){return this.blockScale}set blockContentScale(e){this.blockScale=e}get enableBlockScale(){return this._enableBlockScale}set enableBlockScale(e){this._enableBlockScale=e}get blockContentScaleEnabled(){return this.enableBlockScale}set blockContentScaleEnabled(e){this.enableBlockScale=e}get blockRotation(){return this._blockRotation}set blockRotation(e){this._blockRotation=e}get blockContentRotation(){return this.blockRotation}set blockContentRotation(e){this.blockRotation=e}get enableBlockRotation(){return this._enableBlockRotation}set enableBlockRotation(e){this._enableBlockRotation=e}get blockContentRotationEnabled(){return this.enableBlockRotation}set blockContentRotationEnabled(e){this.enableBlockRotation=e}get blockConnectionType(){return this._blockConnectionType}set blockConnectionType(e){this._blockConnectionType=e}get blockContentConnectionType(){return this.blockConnectionType}set blockContentConnectionType(e){this.blockConnectionType=e}get scale(){return this._scale}set scale(e){this._scale=e}get scaleFactor(){return this.scale}set scaleFactor(e){this.scale=e}get overwritePropChanged(){return this._overwritePropChanged}set overwritePropChanged(e){this._overwritePropChanged=e}get overwritePropertyValue(){return this.overwritePropChanged}set overwritePropertyValue(e){this.overwritePropChanged=e}get annotative(){return this._annotative}set annotative(e){this._annotative=e}get breakSize(){return this._breakSize}set breakSize(e){this._breakSize=e}get breakGapSize(){return this.breakSize}set breakGapSize(e){this.breakSize=e}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(e){this._textAttachmentDirection=e}get bottomTextAttachmentType(){return this._bottomTextAttachmentType}set bottomTextAttachmentType(e){this._bottomTextAttachmentType=e}get bottomTextAttachmentDirection(){return this.bottomTextAttachmentType}set bottomTextAttachmentDirection(e){this.bottomTextAttachmentType=e}get topTextAttachmentType(){return this._topTextAttachmentType}set topTextAttachmentType(e){this._topTextAttachmentType=e}get topTextAttachmentDirection(){return this.topTextAttachmentType}set topTextAttachmentDirection(e){this.topTextAttachmentType=e}get extendLeaderToText(){return this._extendLeaderToText}set extendLeaderToText(e){this._extendLeaderToText=e}get unknown2(){return this._unknown2}set unknown2(e){this._unknown2=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMLeaderStyle"),e.writeInt16(179,this.unknown1),e.writeInt16(170,this.contentType),e.writeInt16(171,this.drawMLeaderOrderType),e.writeInt16(172,this.drawLeaderOrderType),e.writeInt32(90,this.maxLeaderSegmentsPoints),e.writeDouble(40,this.firstSegmentAngleConstraint),e.writeDouble(41,this.secondSegmentAngleConstraint),e.writeInt16(173,this.leaderLineType),e.writeInt32(91,Br(this.leaderLineColor)),e.writeHandle(340,this.leaderLineTypeId),e.writeInt32(92,this.leaderLineWeight),e.writeBoolean(290,this.enableLanding),e.writeDouble(42,this.landingGap),e.writeBoolean(291,this.enableDogleg),e.writeDouble(43,this.doglegLength),e.writeString(3,this.description),e.writeHandle(341,this.arrowSymbolId),e.writeDouble(44,this.arrowSize),e.writeString(300,this.defaultMTextContents),e.writeHandle(342,this.textStyleId),e.writeInt16(174,this.textLeftAttachmentType),e.writeInt16(175,this.textAngleType),e.writeInt16(176,this.textAlignmentType),e.writeInt16(178,this.textRightAttachmentType),e.writeInt32(93,Br(this.textColor)),e.writeDouble(45,this.textHeight),e.writeBoolean(292,this.enableFrameText),e.writeBoolean(297,this.textAlignAlwaysLeft),e.writeDouble(46,this.alignSpace),e.writeHandle(343,this.blockId),e.writeInt32(94,Br(this.blockColor)),e.writeDouble(47,this._blockScale.x),e.writeDouble(49,this._blockScale.y),e.writeDouble(140,this._blockScale.z),e.writeBoolean(293,this.enableBlockScale),e.writeDouble(141,this.blockRotation),e.writeBoolean(294,this.enableBlockRotation),e.writeInt16(177,this.blockConnectionType),e.writeDouble(142,this.scale),e.writeBoolean(295,this.overwritePropChanged),e.writeBoolean(296,this.annotative),e.writeDouble(143,this.breakSize),e.writeInt16(271,this.textAttachmentDirection),e.writeInt16(272,this.bottomTextAttachmentType),e.writeInt16(273,this.topTextAttachmentType),e.writeBoolean(298,this.unknown2),this}}class eo extends Ge{constructor(){super(),this._styleName="STANDARD",this._flags=0,this._description="",this._fillColor=new R,this._startAngle=90,this._endAngle=90,this._elements=[]}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get flags(){return this._flags}set flags(e){this._flags=e}get description(){return this._description}set description(e){this._description=e}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor.copy(e)}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=e}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=e}get elementCount(){return this._elements.length}get elements(){return this._elements.map(e=>({offset:e.offset,color:e.color.clone(),lineType:e.lineType}))}set elements(e){this._elements=e.map(t=>({offset:t.offset,color:t.color.clone(),lineType:t.lineType}))}addElement(e){this._elements.push({offset:e.offset,color:e.color.clone(),lineType:e.lineType})}removeElementAt(e){if(e<0||e>=this._elements.length)throw new Error("The element index is out of range!");this._elements.splice(e,1)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMlineStyle"),e.writeString(2,this.styleName),e.writeInt16(70,this.flags),e.writeString(3,this.description),e.writeCmColor(this.fillColor),e.writeDouble(51,this.startAngle),e.writeDouble(52,this.endAngle),e.writeInt16(71,this.elementCount),this._elements.forEach(t=>{e.writeDouble(49,t.offset),e.writeCmColor(t.color),e.writeString(6,t.lineType)}),this}}class ac extends Ge{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRasterImageDef"),e.writeString(1,this.sourceFileName),e.writeInt16(280,1),e.writeInt16(281,0),this}}var lc=(n=>(n[n.NotApplicable=0]="NotApplicable",n[n.Ignore=1]="Ignore",n[n.Replace=2]="Replace",n[n.XrefMangleName=3]="XrefMangleName",n[n.MangleName=4]="MangleName",n))(lc||{});class kg extends Ge{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(e){this._data=e}clear(){var e;(e=this._data)==null||e.clear()}clone(){return super.clone()}getDuplicateRecordCloning(){return 0}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbXrecord"),e.writeInt16(280,1),e.writeResultBuffer(this.data),this}}class cc{constructor(e){this.db=e}createDefaultLayer(){const e=new R;return e.colorIndex=7,this.db.tables.layerTable.add(new Bi({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new Ot({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Ot({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Ot({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new Fi({name:ae,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new on({name:ae,dimtxsty:ae}))}createDefaultLayout(){const e=new br;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(e.layoutName,e),this.db.tables.blockTable.modelSpace.layoutId=e.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const t=new cr;t.patternName=rn;const r=new or;r.add(new _t({x:0,y:0},{x:-1,y:.125})),r.add(new _t({x:-1,y:.125},{x:-1,y:-.125})),r.add(new _t({x:-1,y:-.125},{x:0,y:0})),t.add(r);const i=new se;i.name="_CAXARROW",i.appendEntity(t),this.db.tables.blockTable.add(i)}}}var hc=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(hc||{});const to=192,Pi=193,no=194,ro=195,dc=200;function Br(n){if(n.isByBlock)return Pi<<24>>0;if(n.isByLayer)return to<<24>>0;const e=n.colorIndex;if(e!=null&&e>0&&e<256)return(ro<<24|e&255)>>0;const t=n.RGB;return t!=null?(no<<24|t&16777215)>>0:Pi<<24>>0}function nr(n){const e=new R(exports.AcCmColorMethod.ByBlock);switch(n>>>24&255){case to:e.setByLayer();break;case Pi:case dc:e.setByBlock();break;case ro:e.colorIndex=n&255;break;case no:e.setRGBValue(n&16777215);break;default:n>=0&&n<=256&&(e.colorIndex=n);break}return e}class io{parse(e){const r=this.normalizeLineEndings(e).split(`
|
|
6
|
+
`),i=[],s=[];let o=null;return r.forEach((a,l)=>{const c=l+1,h=this.stripInlineComment(a).trim();if(!h)return;if(h.startsWith("*")){this.flushCurrentPattern(o,i,s);const p=this.parseHeader(h.slice(1));if(!p){s.push({line:c,message:"Invalid pattern header.",source:a}),o=null;return}o={pattern:{name:p.name,description:p.description,lines:[]},headerLine:c};return}if(!o){s.push({line:c,message:"Line descriptor appears before any pattern header.",source:a});return}const d=this.parseLineDescriptor(h,c);if(!d){s.push({line:c,message:"Invalid line descriptor. Expect: angle,x-origin,y-origin,delta-x,delta-y[,dash-1,...].",source:a});return}o.pattern.lines.push(d)}),this.flushCurrentPattern(o,i,s),{patterns:i,issues:s}}static parse(e){return new io().parse(e)}normalizeLineEndings(e){return e.replace(/\r\n/g,`
|
|
6
7
|
`).replace(/\r/g,`
|
|
7
|
-
`)}stripInlineComment(e){const t=e.indexOf(";");return t<0?e:e.slice(0,t)}parseHeader(e){const t=e.indexOf(",");if(t<0){const s=e.trim();return s?{name:s,description:""}:null}const r=e.slice(0,t).trim(),i=e.slice(t+1).trim();return r?{name:r,description:i}:null}parseNumber(e){const t=Number(e.trim());return Number.isFinite(t)?t:null}parseLineDescriptor(e,t){const r=e.split(",").map(d=>d.trim()).filter(d=>d.length>0);if(r.length<5)return null;const i=this.parseNumber(r[0]),s=this.parseNumber(r[1]),a=this.parseNumber(r[2]),o=this.parseNumber(r[3]),l=this.parseNumber(r[4]);if(i==null||s==null||a==null||o==null||l==null)return null;const c=r.slice(5),h=[];for(const d of c){const p=this.parseNumber(d);if(p==null)return null;h.push(p)}return{angle:i,originX:s,originY:a,deltaX:o,deltaY:l,dashes:h,sourceLine:t}}flushCurrentPattern(e,t,r){e&&(e.pattern.lines.length===0&&r.push({line:e.headerLine,message:`Pattern "${e.pattern.name}" has no line descriptor.`,source:""}),t.push(e.pattern))}}const z=class z{static nextGradientId(e){return z.gradientIdCounter+=1,`acdb-pat-gradient-${e.toLowerCase()}-${z.gradientIdCounter}`}static packedRgbToCss(e){return`#${(e&16777215).toString(16).padStart(6,"0")}`}static gradientColorToCss(e,t){return typeof e=="number"?z.packedRgbToCss(e):e??t}static applyShadeTint(e,t){const r=T.clamp(t,0,1),i=r<.5?0:16777215,s=r<.5?1-r*2:r*2-1,a=e>>16&255,o=e>>8&255,l=e&255,c=i>>16&255,h=i>>8&255,d=i&255;return Math.round(a+(c-a)*s)*65536+Math.round(o+(h-o)*s)*256+Math.round(l+(d-l)*s)}static resolveGradientColors(e){const t="#2563eb",r="#f8fafc",i=z.gradientColorToCss(e.startColor,t);if(e.oneColorMode&&e.endColor==null){if(typeof e.startColor=="number"){const s=z.applyShadeTint(e.startColor,e.shadeTintValue??.5);return{start:i,end:z.packedRgbToCss(s)}}return{start:i,end:(e.shadeTintValue??.5)<.5?"#000000":"#ffffff"}}return{start:i,end:z.gradientColorToCss(e.endColor,r)}}static renderGradientStops(e){return e.map(t=>`<stop offset="${(T.clamp(t.offset,0,1)*100).toFixed(2)}%" stop-color="${t.color}" />`).join("")}static getGradientVector(e){return{x:Math.cos(e),y:-Math.sin(e)}}static isSolidPattern(e){return e.name.trim().toUpperCase()===rn}static renderBackground(e,t,r){return`<rect x="${-e/2}" y="${-t/2}" width="${e}" height="${t}" fill="${r}" />`}static estimateUnitScale(e){const t=[];for(const s of e.lines){t.push(Math.abs(s.deltaX),Math.abs(s.deltaY));for(const a of s.dashes)t.push(Math.abs(a))}const r=t.filter(s=>s>z.EPSILON);if(r.length===0)return 1;const i=r.sort((s,a)=>s-a);return i[Math.floor(i.length/2)]||1}static segmentToSvgPath(e){return`M ${e.x1.toFixed(2)} ${(-e.y1).toFixed(2)} L ${e.x2.toFixed(2)} ${(-e.y2).toFixed(2)}`}static buildDashSegments(e,t,r,i,s,a,o){const l=e.dashes;if(l.length===0)return[{x1:i+a*t,y1:s+o*t,x2:i+a*r,y2:s+o*r}];const c=l.reduce((g,f)=>g+Math.abs(f),0);if(c<=z.EPSILON)return[{x1:i+a*t,y1:s+o*t,x2:i+a*r,y2:s+o*r}];const h=[],d=Math.ceil((r-t)/c)+2;let p=t-c;for(let g=0;g<d;g++){let f=p;for(const m of l){const y=Math.abs(m),_=f+y;if(m>0||m===0){const P=T.clamp(f,t,r),L=T.clamp(_,t,r);L>P?h.push({x1:i+a*P,y1:s+o*P,x2:i+a*L,y2:s+o*L}):m===0&&P>=t&&P<=r&&h.push({x1:i+a*(P-.35),y1:s+o*(P-.35),x2:i+a*(P+.35),y2:s+o*(P+.35)})}f=_}p+=c}return h}static renderFamily(e,t){const r=T.degToRad(e.angle),i=Math.cos(r),s=Math.sin(r),a=-s,o=i,l=i*e.deltaX+a*e.deltaY,c=s*e.deltaX+o*e.deltaY,h=Math.hypot(l,c),d=h<=z.EPSILON?1:Math.max(1,Math.ceil(t*2/h)+1),p=Math.floor(d/2),g=-t*1.5,f=t*1.5,m=[];for(let y=-p;y<=p;y++){const _=e.originX+l*y,P=e.originY+c*y,L=z.buildDashSegments(e,g,f,_,P,i,s);for(const S of L)m.push(z.segmentToSvgPath(S))}return`<path d="${m.join(" ")}" fill="none" />`}static renderLinearGradientDef(e,t,r,i,s){const a=z.getGradientVector(t),o=T.clamp(r,-1,1)*i*.5,l=a.x*o,c=a.y*o;return[`<linearGradient id="${e}" gradientUnits="userSpaceOnUse"`,` x1="${(-a.x*i+l).toFixed(2)}"`,` y1="${(-a.y*i+c).toFixed(2)}"`,` x2="${(a.x*i+l).toFixed(2)}"`,` y2="${(a.y*i+c).toFixed(2)}">`,z.renderGradientStops(s),"</linearGradient>"].join("")}static renderRadialGradientDef(e,t,r,i,s){return[`<radialGradient id="${e}" gradientUnits="userSpaceOnUse"`,` cx="${t.toFixed(2)}" cy="${r.toFixed(2)}" r="${i.toFixed(2)}"`,` fx="${t.toFixed(2)}" fy="${r.toFixed(2)}">`,z.renderGradientStops(s),"</radialGradient>"].join("")}static renderGradientDef(e,t,r,i,s,a,o){const l=t.toUpperCase(),c=l.startsWith("INV"),h=l.replace(/^INV/,""),d=c?r.end:r.start,p=c?r.start:r.end,g=Math.hypot(a,o)/2,f=z.getGradientVector(i),m=T.clamp(s,-1,1),y=f.x*m*a*.25,_=f.y*m*o*.25;switch(h){case"CYLINDER":{const P=T.clamp(.5+m*.45,.05,.95);return z.renderLinearGradientDef(e,i,0,g,[{offset:0,color:d},{offset:P,color:p},{offset:1,color:d}])}case"SPHERICAL":return z.renderRadialGradientDef(e,y,_,g,[{offset:0,color:p},{offset:1,color:d}]);case"HEMISPHERICAL":return z.renderRadialGradientDef(e,y+f.x*a*.18,_+f.y*o*.18,g*.92,[{offset:0,color:p},{offset:.72,color:d},{offset:1,color:d}]);case"CURVED":return z.renderRadialGradientDef(e,-f.x*a*.95+y,-f.y*o*.95+_,g*1.65,[{offset:0,color:d},{offset:.55,color:d},{offset:1,color:p}]);case"LINEAR":default:return z.renderLinearGradientDef(e,i,s,g,[{offset:0,color:d},{offset:1,color:p}])}}renderPattern(e,t={}){const r=t.width??260,i=t.height??160,s=t.stroke??"#1f2937",a=t.strokeWidth??1.3,o=t.background??"#ffffff",l=`${-r/2} ${-i/2} ${r} ${i}`;if(z.isSolidPattern(e))return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${r}" height="${i}">`,z.renderBackground(r,i,o),`<rect x="${-r/2}" y="${-i/2}" width="${r}" height="${i}" fill="${s}" />`,"</svg>"].join("");const c=z.estimateUnitScale(e),d=Math.min(r,i)*.18/Math.max(c,z.EPSILON),p={...e,lines:e.lines.map(m=>({...m,originX:m.originX*d,originY:m.originY*d,deltaX:m.deltaX*d,deltaY:m.deltaY*d,dashes:m.dashes.map(y=>y*d)}))},g=Math.hypot(r,i)*.75,f=p.lines.map(m=>z.renderFamily(m,g)).join("");return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${r}" height="${i}">`,z.renderBackground(r,i,o),`<g stroke="${s}" stroke-width="${a.toFixed(2)}" stroke-linecap="round">`,f,"</g>","</svg>"].join("")}renderGradient(e,t={}){const r=t.width??260,i=t.height??160,s=t.background??"#ffffff",a=t.angle??0,o=t.shift??0,l=`${-r/2} ${-i/2} ${r} ${i}`,c=z.nextGradientId(e),h=z.resolveGradientColors(t),d=z.renderGradientDef(c,e,h,a,o,r,i);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${r}" height="${i}">`,z.renderBackground(r,i,s),"<defs>",d,"</defs>",`<rect x="${-r/2}" y="${-i/2}" width="${r}" height="${i}" fill="url(#${c})" />`,"</svg>"].join("")}};z.EPSILON=1e-9,z.gradientIdCounter=0;let Ls=z;class wt extends Ge{constructor(e){super(),this.database=e,this.objectId=e.generateHandle(),this.ownerId=e.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,r=>this.hasId(r));const t=this.normalizeName(e.name);this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this.normalizeName(e),r=this._recordsByName.get(t);return r?(this._recordsById.delete(r.objectId),this._recordsByName.delete(t),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(this.normalizeName(t.name)),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){const t=this.normalizeName(e);return this._recordsByName.has(t)}hasId(e){return this._recordsById.has(e)}getAt(e){const t=this.normalizeName(e);return this._recordsByName.get(t)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){return this._recordsById.get(e)}newIterator(){return new mr(this._recordsByName)}normalizeName(e){return e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbSymbolTable"),e.writeInt16(70,this.numEntries),this}}class lc extends wt{constructor(e){super(e)}get modelSpace(){let e=this.getAt(se.MODEL_SPACE_NAME);return e||(e=new se,e.name=se.MODEL_SPACE_NAME,this.add(e)),e}getEntityById(e){for(const t of this.database.tables.blockTable.newIterator()){const r=t.getIdAt(e);if(r)return r}}removeEntity(e){let t=!1;for(const r of this.database.tables.blockTable.newIterator())if(r.removeEntity(e)){t=!0;break}return t}normalizeName(e){let t=e;if(se.isModelSapceName(e))t=se.MODEL_SPACE_NAME;else if(se.isPaperSapceName(e)){const r=se.PAPER_SPACE_NAME_PREFIX,i=e.substring(r.length);t=r+i}return t}}class cc extends wt{constructor(e){super(e)}}var hc=(n=>(n[n.Center=0]="Center",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.OverFirst=3]="OverFirst",n[n.OverSecond=4]="OverSecond",n))(hc||{}),dc=(n=>(n[n.Center=0]="Center",n[n.Above=1]="Above",n[n.Outside=2]="Outside",n[n.JIS=3]="JIS",n[n.Below=4]="Below",n))(dc||{}),uc=(n=>(n[n.Feet=0]="Feet",n[n.None=1]="None",n[n.Inch=2]="Inch",n[n.FeetAndInch=3]="FeetAndInch",n[n.Leading=4]="Leading",n[n.Trailing=8]="Trailing",n[n.LeadingAndTrailing=12]="LeadingAndTrailing",n))(uc||{}),gc=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(gc||{}),pc=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(pc||{});const ki=class ki extends Xt{constructor(e,t){e=e||{},ur(e,ki.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}dxfOutFields(e){super.dxfOutFields(e);const t=this.database.tables.textStyleTable.getAt(this.dimtxsty),r=this.database.tables.blockTable.getAt(this.dimldrblk),i=this.database.tables.blockTable.getAt(this.dimblk),s=this.database.tables.blockTable.getAt(this.dimblk1),a=this.database.tables.blockTable.getAt(this.dimblk2);return e.writeSubclassMarker("AcDbDimStyleTableRecord"),e.writeString(2,this.name),e.writeInt16(70,0),e.writeString(3,this.dimpost),e.writeString(4,this.dimapost),e.writeDouble(40,this.dimscale),e.writeDouble(41,this.dimasz),e.writeDouble(42,this.dimexo),e.writeDouble(43,this.dimdli),e.writeDouble(44,this.dimexe),e.writeDouble(140,this.dimtxt),e.writeDouble(147,this.dimgap),e.writeInt16(170,this.dimalt),e.writeInt16(171,this.dimtol),e.writeInt16(172,this.dimlim),e.writeInt16(173,this.dimtih),e.writeInt16(174,this.dimtoh),e.writeObjectId(340,t==null?void 0:t.objectId),e.writeObjectId(341,r==null?void 0:r.objectId),e.writeObjectId(342,i==null?void 0:i.objectId),e.writeObjectId(343,s==null?void 0:s.objectId),e.writeObjectId(344,a==null?void 0:a.objectId),e.writeInt16(371,this.dimlwd),e.writeInt16(372,this.dimlwe),this}};ki.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:oe,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let an=ki;class fc extends wt{constructor(e){super(e)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class Ri extends Xt{constructor(e,t){e=e||{},ur(e,{color:new B,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new te,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(r=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:r.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e.clone())}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineStyle(){var t;const e=(t=this.database)==null?void 0:t.tables.linetypeTable.getAt(this.linetype);if(e)return{type:"UserSpecified",...e.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLayerTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.standardFlags),e.writeCmColor(this.color),e.writeString(6,this.linetype),e.writeInt16(290,this.isPlottable?1:0),e.writeInt16(370,this.lineWeight),e.writeTransparency(this.transparency),this.description&&e.writeString(4,this.description),this}}class mc extends wt{constructor(e){super(e)}}class Ot extends Xt{constructor(e){super(),this.name=e.name,this._linetype=e}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(e){if(e<0||e>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[e].elementLength}toPreviewSvgString(e){const t=Math.max((e==null?void 0:e.width)??220,1),r=Math.max((e==null?void 0:e.height)??36,1),i=Math.min(Math.max((e==null?void 0:e.padding)??8,0),Math.floor(t/2)),s=Math.max((e==null?void 0:e.strokeWidth)??2,.5),a=this.escapeSvgAttribute((e==null?void 0:e.stroke)??"currentColor"),o=Math.max((e==null?void 0:e.repeats)??4,1),l=r/2,c=i,h=Math.max(t-i,c+1),d=h-c,p=this._linetype.pattern??[];if(p.length===0||this.patternLength<=0||!p.some(L=>L.elementLength!==0))return this.buildSvgString({width:t,height:r,stroke:a,strokeWidth:s,lineSegments:[[c,h]],dots:[],y:l});const g=[],f=[],m=d/(this.patternLength*o),y=.5,_=Math.max(s*2,2);let P=c;for(;P<h;)for(const L of p){if(P>=h)break;const S=L.elementLength;if(S===0){f.push(P),P=Math.min(P+_,h);continue}const A=Math.max(Math.abs(S)*m,y),N=Math.min(P+A,h);S>0&&N>P&&g.push([P,N]),P=N}return this.buildSvgString({width:t,height:r,stroke:a,strokeWidth:s,lineSegments:g,dots:f,y:l})}buildSvgString(e){const{width:t,height:r,stroke:i,strokeWidth:s,lineSegments:a,dots:o,y:l}=e,c=a.map(([d,p])=>`<line x1="${d.toFixed(2)}" y1="${l.toFixed(2)}" x2="${p.toFixed(2)}" y2="${l.toFixed(2)}" stroke="${i}" stroke-width="${s.toFixed(2)}" stroke-linecap="round" />`).join(""),h=o.map(d=>`<circle cx="${d.toFixed(2)}" cy="${l.toFixed(2)}" r="${(s/2).toFixed(2)}" fill="${i}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${c}${h}</svg>`}escapeSvgAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'")}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbLinetypeTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.linetype.standardFlag),e.writeString(3,this.comments),e.writeInt16(72,65),e.writeInt16(73,this.numDashes),e.writeDouble(40,this.patternLength);for(const t of this.linetype.pattern??[])e.writeDouble(49,t.elementLength),e.writeInt16(74,t.elementTypeFlag);return this}}class yc extends wt{constructor(e){super(e)}resolveAt(e){this.database.ensureTextStyleDefaults();const t=[],r=i=>{const s=i==null?void 0:i.trim();s&&!t.includes(s)&&t.push(s)};r(e),r(this.database.textstyle),r(oe),r("STANDARD");for(const i of t){const s=this.getAt(i);if(s)return s;const a=i.toUpperCase();for(const o of this.newIterator())if(o.name.toUpperCase()===a)return o}return this.newIterator().next().value??void 0}get fonts(){const e=new Set,t=i=>{if(i){const s=i.lastIndexOf(".");if(s>=0){const a=i.substring(0,s).toLowerCase();e.add(a)}else e.add(i.toLowerCase())}},r=this.newIterator();for(const i of r)t(i.fileName),t(i.bigFontFileName);return Array.from(e)}}class Bi extends Xt{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const r=t.lastIndexOf(".");return r===-1?t:t.substring(0,r)}return e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbTextStyleTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.textStyle.standardFlag),e.writeDouble(40,this.textSize),e.writeDouble(41,this.xScale),e.writeAngle(50,this.obliquingAngle),e.writeInt16(71,this.isVertical?4:this.textStyle.textGenerationFlag),e.writeDouble(42,this.priorSize),e.writeString(3,this.fileName),e.writeString(4,this.bigFontFileName),this}}class _c extends wt{constructor(e){super(e)}}class bc extends wt{constructor(e){super(e)}}const Sg=()=>({center:new E,viewDirectionFromTarget:new b(0,0,1),viewTarget:new b(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:exports.AcGiRenderMode.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new b(0,0,0),ucsXAxis:new b(1,0,0),ucsYAxis:new b(0,1,0),orthographicType:exports.AcGiOrthographicType.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:exports.AcGiDefaultLightingType.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0});class ra extends Xt{constructor(){super(),this._gsView=Sg(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get viewDirectionFromTarget(){return this._gsView.viewDirectionFromTarget}set viewDirectionFromTarget(e){this._gsView.viewDirectionFromTarget.copy(e)}get viewTarget(){return this._gsView.viewTarget}set viewTarget(e){this._gsView.viewTarget.copy(e)}get viewHeight(){return this._gsView.viewHeight}set viewHeight(e){this._gsView.viewHeight=e}get viewTwistAngle(){return this._gsView.viewTwistAngle}set viewTwistAngle(e){this._gsView.viewTwistAngle=e}get lensLength(){return this._gsView.lensLength}set lensLength(e){this._gsView.lensLength=e}get frontClippingPlane(){return this._gsView.frontClippingPlane}set frontClippingPlane(e){this._gsView.frontClippingPlane=e}get backClippingPlane(){return this._gsView.backClippingPlane}set backClippingPlane(e){this._gsView.backClippingPlane=e}get renderMode(){return this._gsView.renderMode}set renderMode(e){this._gsView.renderMode=e}get viewMode(){return this._gsView.viewMode}set viewMode(e){this._gsView.viewMode=e}get ucsIconSetting(){return this._gsView.ucsIconSetting}set ucsIconSetting(e){this._gsView.ucsIconSetting=e}get ucsOrigin(){return this._gsView.ucsOrigin}set ucsOrigin(e){this._gsView.ucsOrigin.copy(e)}get ucsXAxis(){return this._gsView.ucsXAxis}set ucsXAxis(e){this._gsView.ucsXAxis.copy(e)}get ucsYAxis(){return this._gsView.ucsYAxis}set ucsYAxis(e){this._gsView.ucsYAxis.copy(e)}get orthographicType(){return this._gsView.orthographicType}set orthographicType(e){this._gsView.orthographicType=e}get shadePlotSetting(){return this._gsView.shadePlotSetting}set shadePlotSetting(e){this._gsView.shadePlotSetting=e}get shadePlotObjectId(){return this._gsView.shadePlotObjectId}set shadePlotObjectId(e){this._gsView.shadePlotObjectId=e}get visualStyleObjectId(){return this._gsView.visualStyleObjectId}set visualStyleObjectId(e){this._gsView.visualStyleObjectId=e}get isDefaultLightingOn(){return this._gsView.isDefaultLightingOn}set isDefaultLightingOn(e){this._gsView.isDefaultLightingOn=e}get defaultLightingType(){return this._gsView.defaultLightingType}set defaultLightingType(e){this._gsView.defaultLightingType=e}get brightness(){return this._gsView.brightness}set brightness(e){this._gsView.brightness=e}get contrast(){return this._gsView.contrast}set contrast(e){this._gsView.contrast=e}get ambientColor(){return this._gsView.ambientColor}set ambientColor(e){this._gsView.ambientColor=e}}class ia extends ra{constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new E(0,0),this._upperRightCorner=new E(1,1),this._snapBase=new E(0,0),this._snapAngle=0,this._snapSpacing=new E(0,0),this._standardFlag=0,this._gridSpacing=new E,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this.centerPoint}set center(e){this.centerPoint=e}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewportTableRecord"),e.writeString(2,this.name),e.writeDouble(45,this.gsView.viewHeight),e.writePoint2d(10,this.lowerLeftCorner),e.writePoint2d(11,this.upperRightCorner),e.writePoint2d(12,this.center),e.writePoint2d(13,this.snapBase),e.writePoint2d(14,this.snapIncrements),e.writePoint2d(15,this.gridIncrements),e.writeInt16(70,this.standardFlag),e.writeInt16(71,this.circleSides),e.writeDouble(42,this.gsView.lensLength),e.writePoint3d(16,this.gsView.viewDirectionFromTarget),e.writePoint3d(17,this.gsView.viewTarget),e.writeAngle(50,this.snapAngle),e.writeAngle(51,this.gsView.viewTwistAngle),e.writeInt16(61,this.gridMajor),e.writeInt16(281,this.backgroundObjectId?1:0),e.writeObjectId(332,this.backgroundObjectId),this}}class xc extends wt{constructor(e){super(e)}}class Is extends Xt{constructor(e){super(),this.name=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRegAppTableRecord"),e.writeString(2,this.name),e.writeInt16(70,0),this}}class Lg extends Ge{constructor(){super({objectId:"0"}),this.events={dictObjetSet:new ie,dictObjectErased:new ie,entityAppended:new ie,entityModified:new ie,entityErased:new ie,layerAppended:new ie,layerModified:new ie,layerErased:new ie,openProgress:new ie},this._version=new Ye("AC1014"),this._angbase=0,this._angdir=0,this._aunits=ve.DecimalDegrees,this._auprec=0,this._lunits=J.Decimal,this._luprec=4,this._celtscale=1,this._cecolor=new B,this._celtype=fe,this._celweight=exports.AcGiLineWeight.ByLayer,this._cetransparency=new te,this._clayer="0",this._cmlstyle=ft,this._cmlscale=1,this._cmleaderstyle=mt,this._hpbackgroundcolor=new B(exports.AcCmColorMethod.None),this._hpcolor=this._cecolor.clone(),this._hplayer=".",this._hptransparency=new te,this._textstyle=oe,this._extents=new R,this._insunits=K.Millimeters,this._unitmode=0,this._measurement=1,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._orthomode=0,this._maxHandle=0,this._tables={appIdTable:new xc(this),blockTable:new lc(this),dimStyleTable:new cc(this),linetypeTable:new mc(this),textStyleTable:new yc(this),viewTable:new _c(this),layerTable:new fc(this),viewportTable:new bc(this)},this._objects={dictionary:new tn(this),imageDefinition:new tn(this),layout:new nc(this),mleaderStyle:new tn(this),mlineStyle:new tn(this),xrecord:new tn(this)}}get tables(){return this._tables}get objects(){return this._objects}get formatter(){return this._formatter??(this._formatter=new Al(this))}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(e){const t=parseInt(e,16);!isNaN(t)&&t>this._maxHandle&&(this._maxHandle=t)}commitObjectHandle(e,t){const r=e.getAttrWithoutException("objectId");!r||e.isTemp||t&&t(r)?e.objectId=this.generateHandle():this.updateMaxHandle(r)}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this.updateSysVar(I.AUNITS,this._aunits,e??0,t=>{this._aunits=t})}get auprec(){return this._auprec}set auprec(e){this.updateSysVar(I.AUPREC,this._auprec,e??0,t=>{this._auprec=t})}get lunits(){return this._lunits}set lunits(e){this.updateSysVar(I.LUNITS,this._lunits,e??J.Decimal,t=>{this._lunits=t})}get luprec(){return this._luprec}set luprec(e){this.updateSysVar(I.LUPREC,this._luprec,e??4,t=>{this._luprec=t})}get version(){return this._version}set version(e){this.updateSysVar(I.ACADVER,this._version,new Ye(e),t=>{this._version=t})}get insunits(){return this._insunits}set insunits(e){this.updateSysVar(I.INSUNITS,this._insunits,e??4,t=>{this._insunits=t})}get unitmode(){return this._unitmode}set unitmode(e){this.updateSysVar(I.UNITMODE,this._unitmode,e??0,t=>{this._unitmode=t})}get measurement(){return this._measurement}set measurement(e){this.updateSysVar(I.MEASUREMENT,this._measurement,e??1,t=>{this._measurement=t})}get ltscale(){return this._ltscale}set ltscale(e){this.updateSysVar(I.LTSCALE,this._ltscale,e??1,t=>{this._ltscale=t})}get lwdisplay(){return this._lwdisplay}set lwdisplay(e){this.updateSysVar(I.LWDISPLAY,this._lwdisplay,e??!1,t=>{this._lwdisplay=t})}get cecolor(){return this._cecolor}set cecolor(e){this.updateSysVar(I.CECOLOR,this._cecolor,e||0,t=>{this._cecolor=t.clone()})}get celtscale(){return this._celtscale}set celtscale(e){this.updateSysVar(I.CELTSCALE,this._celtscale,e??1,t=>{this._celtscale=t})}get celtype(){return this._celtype}set celtype(e){const t=this.normalizeLinetypeName(e??fe);this.updateSysVar(I.CELTYPE,this._celtype,t,r=>{this._celtype=r})}get celweight(){return this._celweight}set celweight(e){this.updateSysVar(I.CELWEIGHT,this._celweight,e??exports.AcGiLineWeight.ByLayer,t=>{this._celweight=t})}get cetransparency(){return this._cetransparency}set cetransparency(e){this.updateSysVar(I.CETRANSPARENCY,this._cetransparency,e??new te,t=>{this._cetransparency=t.clone()})}get clayer(){return this._clayer}set clayer(e){this.updateSysVar(I.CLAYER,this._clayer,e??"0",t=>{this._clayer=t})}get cmlstyle(){return this._cmlstyle}set cmlstyle(e){this.updateSysVar(I.CMLSTYLE,this._cmlstyle,e??ft,t=>{this._cmlstyle=t})}get cmlscale(){return this._cmlscale}set cmlscale(e){this.updateSysVar(I.CMLSCALE,this._cmlscale,e??1,t=>{this._cmlscale=t})}get cmleaderstyle(){return this._cmleaderstyle}set cmleaderstyle(e){this.updateSysVar(I.CMLEADERSTYLE,this._cmleaderstyle,e??mt,t=>{this._cmleaderstyle=t})}get hpbackgroundcolor(){return this._hpbackgroundcolor}set hpbackgroundcolor(e){this.updateSysVar(I.HPBACKGROUNDCOLOR,this._hpbackgroundcolor,e??new B(exports.AcCmColorMethod.None),t=>{this._hpbackgroundcolor=t.clone()})}get hpcolor(){return this._hpcolor}set hpcolor(e){this.updateSysVar(I.HPCOLOR,this._hpcolor,e??this._cecolor,t=>{this._hpcolor=t.clone()})}get hplayer(){return this._hplayer}set hplayer(e){this.updateSysVar(I.HPLAYER,this._hplayer,e??".",t=>{this._hplayer=t})}get hptransparency(){return this._hptransparency}set hptransparency(e){this.updateSysVar(I.HPTRANSPARENCY,this._hptransparency,e??new te,t=>{this._hptransparency=t.clone()})}get textstyle(){return this._textstyle}set textstyle(e){this.updateSysVar(I.TEXTSTYLE,this._textstyle,e??oe,t=>{this._textstyle=t})}get angbase(){return this._angbase}set angbase(e){this.updateSysVar(I.ANGBASE,this._angbase,e??0,t=>{this._angbase=t})}get angdir(){return this._angdir}set angdir(e){this.updateSysVar(I.ANGDIR,this._angdir,e??0,t=>{this._angdir=t})}get extmax(){return this._extents.max}set extmax(e){if(e){const t=this._extents.max.clone();this._extents.expandByPoint(e),this._extents.max.equals(t)||this.triggerSysVarChangedEvent(I.EXTMAX,t,this._extents.max)}}get extmin(){return this._extents.min}set extmin(e){if(e){const t=this._extents.min.clone();this._extents.expandByPoint(e),this._extents.min.equals(t)||this.triggerSysVarChangedEvent(I.EXTMIN,t,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(e){this.updateSysVar(I.PDMODE,this._pdmode,e??0,t=>{this._pdmode=t})}get pdsize(){return this._pdsize}set pdsize(e){this.updateSysVar(I.PDSIZE,this._pdsize,e??0,t=>{this._pdsize=t})}get osmode(){return this._osmode}set osmode(e){this.updateSysVar(I.OSMODE,this._osmode,e??0,t=>{this._osmode=t})}get orthomode(){return this._orthomode}set orthomode(e){this.updateSysVar(I.ORTHOMODE,this._orthomode,e??0,t=>{this._orthomode=t})}async read(e,t,r=Zn.DXF){const i=We.instance.get(r);if(i==null)throw new Error(`Database converter for file type '${r}' isn't registered and can can't read this file!`);this.clear(),await i.read(e,this,t&&t.minimumChunkSize||10,async(s,a,o,l)=>{if(this.events.openProgress.dispatch({database:this,percentage:s,stage:"CONVERSION",subStage:a,subStageStatus:o,data:l}),t&&t.fontLoader&&a=="FONT"&&o=="END"){const c=l||this.tables.textStyleTable.fonts;await t.fontLoader.load(c)}},t==null?void 0:t.timeout,t==null?void 0:t.sysVars),this.ensureDatabaseDefaults()}async openUri(e,t){var g;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const r=await fetch(e);if(!r.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${e}' with HTTP status code '${r.status}'!`);const i=r.headers.get("content-length"),s=i?parseInt(i,10):null;let a=0;const o=(g=r.body)==null?void 0:g.getReader();if(!o)throw new Error("Failed to get response reader");const l=[];for(;;){const{done:f,value:m}=await o.read();if(f)break;if(l.push(m),a+=m.length,s!==null){const y=Math.round(a/s*100);this.events.openProgress.dispatch({database:this,percentage:y,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const c=new Uint8Array(a);let h=0;for(const f of l)c.set(f,h),h+=f.length;const p=this.getFileNameFromUri(e).toLowerCase().split(".").pop();p==="dwg"?await this.read(c.buffer,t,Zn.DWG):p==="dxf"?await this.read(c.buffer,t,Zn.DXF):await this.read(c.buffer,t,p),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(e,t=16,r=this.version.name,i=!1){this.ensureDatabaseDefaults();const s=r instanceof Ye?r:new Ye(r),a=new Eo({database:this,precision:t,version:s});return this.writeDxfHeaderSection(a),this.writeDxfTablesSection(a,s),this.writeDxfBlocksSection(a),this.writeDxfEntitiesSection(a),this.writeDxfObjectsSection(a),a.writeStart("EOF"),a.toString()}async regen(){await new jh(this).read(null,this,500,async(t,r,i,s)=>{this.events.openProgress.dispatch({database:this,percentage:t,stage:"CONVERSION",subStage:r,subStageStatus:i,data:s})})}createDefaultData(e={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const t=new sc(this);e.layer&&t.createDefaultLayer(),e.lineType&&t.createDefaultLineType(),e.textStyle&&t.createDefaultTextStyle(),e.dimStyle&&t.createDefaultDimStyle(),e.layout&&t.createDefaultLayout()}ensureEntityStyleDefaults(e){var t;if(e.dxfTypeName==="MLINE"){this.ensureMLineStyle(this._cmlstyle||ft);return}if(e.dxfTypeName==="MULTILEADER"){this.ensureMLeaderStyle(this._cmleaderstyle||mt);return}if(e.dxfTypeName==="HATCH"){const r=e;(t=r.applyPatternDefaultsFromSysVars)==null||t.call(r,this)}}ensureTextStyleDefaults(){this.hasDefaultTextStyle()||this.tables.textStyleTable.add(new Bi({name:oe,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}hasDefaultTextStyle(){const e=[oe,"STANDARD"];for(const t of e)if(this.tables.textStyleTable.has(t))return!0;for(const t of this.tables.textStyleTable.newIterator())if(t.name.toUpperCase()===oe.toUpperCase())return!0;return!1}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const t=new B;t.colorIndex=7,this.tables.layerTable.add(new Ri({name:"0",standardFlags:0,linetype:Mt,lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}if(this.tables.linetypeTable.has(Ct)||this.tables.linetypeTable.add(new Ot({name:Ct,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(fe)||this.tables.linetypeTable.add(new Ot({name:fe,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Mt)||this.tables.linetypeTable.add(new Ot({name:Mt,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.ensureTextStyleDefaults(),this.tables.dimStyleTable.has(oe)||this.tables.dimStyleTable.add(new an({name:oe,dimtxsty:oe})),!this.tables.viewportTable.has("*Active")){const t=new ia;t.name="*Active",this.tables.viewportTable.add(t)}this.ensureMLineStyle(this._cmlstyle||ft),this.ensureMLeaderStyle(this._cmleaderstyle||mt);const e=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const t=new yr;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=e.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.objects.layout.setAt(t.layoutName,t),e.layoutId=t.objectId}this.tables.appIdTable.has(xs)||this.tables.appIdTable.add(new Is(xs)),this.tables.appIdTable.has(bs)||this.tables.appIdTable.add(new Is(bs))}ensureMLineStyle(e){const t=this.objects.mlineStyle,r=e.trim();if(!r||t.getAt(r))return;for(const[s,a]of t.entries())if(s.toUpperCase()===r.toUpperCase()||a.styleName.toUpperCase()===r.toUpperCase())return;const i=new Qs;i.styleName=r,i.elements=[{offset:.5,color:new B().setByLayer(),lineType:fe},{offset:-.5,color:new B().setByLayer(),lineType:fe}],t.setAt(r,i)}ensureMLeaderStyle(e){const t=this.objects.mleaderStyle,r=e.trim();if(!r||t.getAt(r))return;for(const[o]of t.entries())if(o.toUpperCase()===r.toUpperCase())return;const i=new Zs;i.unknown1=2,i.maxLeaderSegmentsPoints=2,i.leaderLineColor=new B().setByBlock(),i.textColor=new B().setByBlock(),i.blockColor=new B().setByBlock(),i.alignSpace=4,i.breakSize=3.75,i.enableBlockRotation=!0,i.unknown2=!1;const s=this.tables.linetypeTable.getAt(Ct);i.leaderLineTypeId=s==null?void 0:s.objectId;const a=this.tables.textStyleTable.getAt(oe);i.textStyleId=a==null?void 0:a.objectId,t.setAt(r,i)}writeDxfHeaderSection(e){var t;e.startSection("HEADER"),e.writeString(9,"$ACADVER"),e.writeString(1,((t=e.version)==null?void 0:t.name)??this.version.name),e.writeString(9,"$HANDSEED"),e.writeString(5,e.nextHandle.toString(16).toUpperCase()),e.version!=null&&e.version.value>=27&&(e.writeString(9,"$DWGCODEPAGE"),e.writeString(3,"UTF-8")),e.writeString(9,"$INSUNITS"),e.writeInt16(70,this.insunits),e.writeString(9,"$LUNITS"),e.writeInt16(70,this.lunits),e.writeString(9,"$LUPREC"),e.writeInt16(70,this.luprec),e.writeString(9,"$UNITMODE"),e.writeInt16(70,this.unitmode),e.writeString(9,"$MEASUREMENT"),e.writeInt16(70,this.measurement),e.writeString(9,"$LTSCALE"),e.writeDouble(40,this.ltscale),e.writeString(9,"$LWDISPLAY"),e.writeInt16(70,this.lwdisplay?1:0),e.writeString(9,"$CLAYER"),e.writeString(8,this.clayer),e.writeString(9,"$CELTYPE"),e.writeString(6,this.celtype),this.cetransparency.isInvalid||(e.writeString(9,"$CETRANSPARENCY"),e.writeTransparency(this.cetransparency)),e.writeString(9,"$CMLSTYLE"),e.writeString(2,this.cmlstyle),e.writeString(9,"$CMLSCALE"),e.writeDouble(40,this.cmlscale),e.writeString(9,"$CMLEADERSTYLE"),e.writeString(2,this.cmleaderstyle),this.hpcolor.colorMethod!==exports.AcCmColorMethod.None&&(e.writeString(9,"$HPCOLOR"),e.writeCmColor(this.hpcolor,2)),this.hpbackgroundcolor.colorMethod!==exports.AcCmColorMethod.None&&(e.writeString(9,"$HPBACKGROUNDCOLOR"),e.writeCmColor(this.hpbackgroundcolor,2)),e.writeString(9,"$HPLAYER"),e.writeString(8,this.hplayer),this.hptransparency.isInvalid||(e.writeString(9,"$HPTRANSPARENCY"),e.writeTransparency(this.hptransparency)),e.writeString(9,"$TEXTSTYLE"),e.writeString(7,this.textstyle),e.writeString(9,"$ANGBASE"),e.writeAngle(50,this.angbase),e.writeString(9,"$ANGDIR"),e.writeInt16(70,this.angdir),e.writeString(9,"$AUNITS"),e.writeInt16(70,this.aunits),e.writeString(9,"$AUPREC"),e.writeInt16(70,this.auprec),e.writeString(9,"$EXTMIN"),e.writePoint3d(10,this.extmin),e.writeString(9,"$EXTMAX"),e.writePoint3d(10,this.extmax),e.writeString(9,"$PDMODE"),e.writeInt32(70,this.pdmode),e.writeString(9,"$PDSIZE"),e.writeDouble(40,this.pdsize),e.writeString(9,"$OSMODE"),e.writeInt32(70,this.osmode),e.writeString(9,"$ORTHOMODE"),e.writeInt16(70,this.orthomode),e.endSection()}writeDxfTablesSection(e,t){e.startSection("TABLES"),this.writeDxfTable(e,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(e,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(e,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(e,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(e,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(),"STYLE"),this.writeDxfTable(e,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(e,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),t.value>=19&&this.writeDxfTable(e,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),e.endSection()}writeDxfBlocksSection(e){e.startSection("BLOCKS");for(const t of this.tables.blockTable.newIterator()){if(t.dxfOutBlockBegin(e),!t.isModelSapce&&!t.isPaperSapce)for(const r of t.newIterator())this.writeDxfEntity(e,r);t.dxfOutBlockEnd(e)}e.endSection()}writeDxfEntitiesSection(e){e.startSection("ENTITIES");for(const t of this.tables.blockTable.newIterator())if(!(!t.isModelSapce&&!t.isPaperSapce))for(const r of t.newIterator())this.writeDxfEntity(e,r);e.endSection()}writeDxfObjectsSection(e){e.startSection("OBJECTS");const t=this.objects.dictionary;t.ownerId="0";const r=a=>{e.writeStart("DICTIONARY"),a.dxfOut(e)},i=(a,o)=>{t.getAt(a)!==o&&t.setAt(a,o)},s=a=>{t.getAt(a)&&t.remove(a)};i("ACAD_LAYOUT",this.objects.layout),this.objects.mleaderStyle.numEntries>0?i("ACAD_MLEADERSTYLE",this.objects.mleaderStyle):s("ACAD_MLEADERSTYLE"),this.objects.mlineStyle.numEntries>0?i("ACAD_MLINESTYLE",this.objects.mlineStyle):s("ACAD_MLINESTYLE"),this.objects.imageDefinition.numEntries>0?i("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):s("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?i("MLIGHT_XRECORD",this.objects.xrecord):s("MLIGHT_XRECORD"),r(t),r(this.objects.layout),this.objects.mleaderStyle.numEntries>0&&r(this.objects.mleaderStyle),this.objects.mlineStyle.numEntries>0&&r(this.objects.mlineStyle),this.objects.imageDefinition.numEntries>0&&r(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&r(this.objects.xrecord);for(const[a,o]of this.objects.layout.entries())e.writeStart("LAYOUT"),o.dxfOut(e);for(const[a,o]of this.objects.imageDefinition.entries())e.writeStart("IMAGEDEF"),o.dxfOut(e);for(const[a,o]of this.objects.mleaderStyle.entries())e.writeStart("MLEADERSTYLE"),o.dxfOut(e);for(const[a,o]of this.objects.mlineStyle.entries())e.writeStart("MLINESTYLE"),o.dxfOut(e);for(const[a,o]of this.objects.xrecord.entries())e.writeStart("XRECORD"),o.dxfOut(e);e.endSection()}writeDxfTable(e,t,r,i,s){const a=[...i];e.startTable(t),r.dxfOut(e);for(const o of a){if(s==="BLOCK_RECORD"&&o instanceof se){o.dxfOutBlockRecord(e);continue}e.writeStart(s),o.dxfOut(e)}e.endTable()}writeDxfEntity(e,t){e.writeStart(t.dxfTypeName),t.dxfOut(e)}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.viewTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._objects.layout.removeAll(),this._objects.imageDefinition.removeAll(),this._objects.mleaderStyle.removeAll(),this._objects.mlineStyle.removeAll(),this._objects.xrecord.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(e,t,r,i){this.hasSysVarValueChanged(t,r)&&(i(r),this.triggerSysVarChangedEvent(e,t,r))}hasSysVarValueChanged(e,t){return e instanceof B&&t instanceof B||e instanceof te&&t instanceof te?!e.equals(t):e instanceof Ye&&t instanceof Ye?e.value!==t.value:!Object.is(e,t)}normalizeLinetypeName(e){const t=e.trim();return t.toUpperCase()==="BYLAYER"?fe:t.toUpperCase()==="BYBLOCK"?Ct:t}triggerSysVarChangedEvent(e,t,r){const i=Xe.instance(),s=e.toLowerCase();i.getDescriptor(s)!=null&&i.events.sysVarChanged.dispatch({database:this,name:s,oldVal:t,newVal:r})}getFileNameFromUri(e){try{const r=new URL(e).pathname.split("/");return r[r.length-1]||""}catch{return""}}}const wc="Load Database",ho=3e4,Ig=12e4,Eg=1024*1024;class we extends Ao{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=Ms.getInstance().getEntry(wc),r=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const i=await this.data.task(e);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",i?i.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),t&&(t.data[this.name]=Date.now()-r),i}}class sa{constructor(e={}){this.config=e}async read(e,t,r,i,s,a){const o={name:wc,data:{total:0},format(){let d="";return Object.keys(this.data).forEach(p=>{p!=="total"&&(d+=`- ${p}: ${this.data[p]} ms
|
|
8
|
-
`)}),d+=`- total: ${this.data.total} ms`,d}};Ms.getInstance().collect(o),this.progress=i;const l={value:0},c=new So;c.setCompleteCallback(()=>this.onFinished()),c.setErrorCallback(d=>this.onError(d)),c.addTask(new we({stage:"START",step:1,progress:l,task:async d=>d},i)),c.addTask(new we({stage:"PARSE",step:5,progress:l,task:async d=>await this.parse(d,s)},i)),c.addTask(new we({stage:"FONT",step:5,progress:l,task:async d=>{const p=this.getFonts(d.model);return{model:d.model,data:p}}},i)),c.addTask(new we({stage:"LTYPE",step:1,progress:l,task:async d=>(this.processLineTypes(d.model,t),d)},i)),c.addTask(new we({stage:"STYLE",step:1,progress:l,task:async d=>(this.processTextStyles(d.model,t),d)},i)),c.addTask(new we({stage:"DIMSTYLE",step:1,progress:l,task:async d=>(this.processDimStyles(d.model,t),d)},i)),c.addTask(new we({stage:"LAYER",step:1,progress:l,task:async d=>(this.processLayers(d.model,t),t.tables.layerTable.numEntries===0&&t.createDefaultData({layer:!0}),d)},i)),c.addTask(new we({stage:"VPORT",step:1,progress:l,task:async d=>(this.processViewports(d.model,t),d)},i)),c.addTask(new we({stage:"HEADER",step:1,progress:l,task:async d=>{if(this.processHeader(d.model,t),a){const p=Xe.instance();for(const[g,f]of Object.entries(a))p.setVar(g,f,t)}return d}},i)),c.addTask(new we({stage:"BLOCK_RECORD",step:5,progress:l,task:async d=>(this.processBlockTables(d.model,t),d)},i)),c.addTask(new we({stage:"OBJECT",step:5,progress:l,task:async d=>(this.processObjects(d.model,t),t.objects.layout.numEntries===0&&t.createDefaultData({layout:!0}),d)},i)),c.addTask(new we({stage:"BLOCK",step:5,progress:l,task:async d=>(await this.processBlocks(d.model,t),d)},i)),c.addTask(new we({stage:"ENTITY",step:100,progress:l,task:async d=>(await this.processEntities(d.model,t,r,l,i),d)},i)),c.addTask(new we({stage:"END",step:0,progress:l,task:async d=>d},i));const h=Date.now();await c.run(e),o.data.total=Date.now()-h}onError(e){if(this.progress){const t=e.task;this.progress(t.data.progress.value,t.data.stage,"ERROR",void 0,e)}return e.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),on.instance.clear())}getParserWorkerTimeout(e,t){const r=t??this.config.timeout;if(r!=null)return r;const i=Math.ceil(e.byteLength/Eg),s=ho+i*1e3;return Math.min(Ig,Math.max(ho,s))}async parse(e,t){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,r,i,s){throw new Error("Not impelemented yet!")}}class Tg extends ra{constructor(){super(),this._standardFlags=0,this._viewWidth=this.viewHeight,this._ucsAssociated=!1,this._cameraPlottable=!1,this._ucsElevation=0}get standardFlags(){return this._standardFlags}set standardFlags(e){this._standardFlags=e}get viewWidth(){return this._viewWidth}set viewWidth(e){this._viewWidth=e}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(e){this._ucsAssociated=e}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(e){this._cameraPlottable=e}get ucsElevation(){return this._ucsElevation}set ucsElevation(e){this._ucsElevation=e}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(e){this._ucsObjectId=e}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(e){this._ucsBaseObjectId=e}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(e){this._liveSectionObjectId=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.standardFlags),e.writeDouble(40,this.gsView.viewHeight),e.writePoint2d(10,this.centerPoint),e.writeDouble(41,this.viewWidth),e.writePoint3d(11,this.gsView.viewDirectionFromTarget),e.writePoint3d(12,this.gsView.viewTarget),e.writeDouble(42,this.gsView.lensLength),e.writeDouble(43,this.gsView.frontClippingPlane),e.writeDouble(44,this.gsView.backClippingPlane),e.writeAngle(50,this.gsView.viewTwistAngle),e.writeInt16(71,this.gsView.viewMode),e.writeInt16(281,this.gsView.renderMode),e.writeInt16(72,this.ucsAssociated?1:0),e.writeInt16(73,this.cameraPlottable?1:0),e.writeObjectId(332,this.backgroundObjectId),e.writeObjectId(334,this.liveSectionObjectId),e.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(e.writePoint3d(110,this.gsView.ucsOrigin),e.writePoint3d(111,this.gsView.ucsXAxis),e.writePoint3d(112,this.gsView.ucsYAxis),e.writeInt16(79,this.gsView.orthographicType),e.writeDouble(146,this.ucsElevation),e.writeObjectId(345,this.ucsObjectId),e.writeObjectId(346,this.ucsBaseObjectId)),this}}var ce,Cn,Q,re,Mn,De,Ft,Ze,ye,Qe,Ve,Dt,Vt,zt,Le,Je,On,kn,jt,Gt,Nn,Yn,Xn,Ie,et,$,Ht,Rn,Y,_e,Bn,be,Fn,tt,W,Dn,nt,Wt,Ji,es,ze,Vn,Ut,Ee,rt,it,st,zn,jn,at,$t,qt,ts,Gn,Kt,ot,Zt,he,lt,Te,ns,de,rs,ct,Ce,Qt,Hn,Jt,Me,ht,Oe,dt,is,en,ke;(ce={})[ce.None=0]="None",ce[ce.Anonymous=1]="Anonymous",ce[ce.NonConstant=2]="NonConstant",ce[ce.Xref=4]="Xref",ce[ce.XrefOverlay=8]="XrefOverlay",ce[ce.ExternallyDependent=16]="ExternallyDependent",ce[ce.ResolvedOrDependent=32]="ResolvedOrDependent",ce[ce.ReferencedXref=64]="ReferencedXref";(Cn={})[Cn.BYBLOCK=0]="BYBLOCK",Cn[Cn.BYLAYER=256]="BYLAYER";(Q={})[Q.Rotated=0]="Rotated",Q[Q.Aligned=1]="Aligned",Q[Q.Angular=2]="Angular",Q[Q.Diameter=3]="Diameter",Q[Q.Radius=4]="Radius",Q[Q.Angular3Point=5]="Angular3Point",Q[Q.Ordinate=6]="Ordinate",Q[Q.ReferenceIsExclusive=32]="ReferenceIsExclusive",Q[Q.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Q[Q.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(re={})[re.TopLeft=1]="TopLeft",re[re.TopCenter=2]="TopCenter",re[re.TopRight=3]="TopRight",re[re.MiddleLeft=4]="MiddleLeft",re[re.MiddleCenter=5]="MiddleCenter",re[re.MiddleRight=6]="MiddleRight",re[re.BottomLeft=7]="BottomLeft",re[re.BottomCenter=8]="BottomCenter",re[re.BottomRight=9]="BottomRight";(Mn={})[Mn.AtLeast=1]="AtLeast",Mn[Mn.Exact=2]="Exact";var uo=((De={})[De.Center=0]="Center",De[De.Above=1]="Above",De[De.Outside=2]="Outside",De[De.JIS=3]="JIS",De[De.Below=4]="Below",De);(Ft={})[Ft.WithDimension=0]="WithDimension",Ft[Ft.AddLeader=1]="AddLeader",Ft[Ft.Independent=2]="Independent";(Ze={})[Ze.BothOutside=0]="BothOutside",Ze[Ze.ArrowFirst=1]="ArrowFirst",Ze[Ze.TextFirst=2]="TextFirst",Ze[Ze.Auto=3]="Auto";var gn=((ye={})[ye.Feet=0]="Feet",ye[ye.None=1]="None",ye[ye.Inch=2]="Inch",ye[ye.FeetAndInch=3]="FeetAndInch",ye[ye.Leading=4]="Leading",ye[ye.Trailing=8]="Trailing",ye[ye.LeadingAndTrailing=12]="LeadingAndTrailing",ye),Cg=((Qe={})[Qe.None=0]="None",Qe[Qe.Leading=1]="Leading",Qe[Qe.Trailing=2]="Trailing",Qe[Qe.LeadingAndTrailing=3]="LeadingAndTrailing",Qe),Mg=((Ve={})[Ve.Center=0]="Center",Ve[Ve.First=1]="First",Ve[Ve.Second=2]="Second",Ve[Ve.OverFirst=3]="OverFirst",Ve[Ve.OverSecond=4]="OverSecond",Ve),Og=((Dt={})[Dt.Bottom=0]="Bottom",Dt[Dt.Center=1]="Center",Dt[Dt.Top=2]="Top",Dt);(Vt={})[Vt.None=0]="None",Vt[Vt.UseDrawingBackground=1]="UseDrawingBackground",Vt[Vt.Custom=2]="Custom";(zt={})[zt.Horizontal=0]="Horizontal",zt[zt.Diagonal=1]="Diagonal",zt[zt.NotStacked=2]="NotStacked";(Le={})[Le.Scientific=1]="Scientific",Le[Le.Decimal=2]="Decimal",Le[Le.Engineering=3]="Engineering",Le[Le.Architectural=4]="Architectural",Le[Le.Fractional=5]="Fractional",Le[Le.WindowDesktop=6]="WindowDesktop";(Je={})[Je.Decimal=0]="Decimal",Je[Je.DegreesMinutesSecond=1]="DegreesMinutesSecond",Je[Je.Gradian=2]="Gradian",Je[Je.Radian=3]="Radian";var kg=((On={})[On.PatternFill=0]="PatternFill",On[On.SolidFill=1]="SolidFill",On);(kn={})[kn.NonAssociative=0]="NonAssociative",kn[kn.Associative=1]="Associative";(jt={})[jt.Normal=0]="Normal",jt[jt.Outer=1]="Outer",jt[jt.Ignore=2]="Ignore";(Gt={})[Gt.UserDefined=0]="UserDefined",Gt[Gt.Predefined=1]="Predefined",Gt[Gt.Custom=2]="Custom";(Nn={})[Nn.NotAnnotated=0]="NotAnnotated",Nn[Nn.Annotated=1]="Annotated";(Yn={})[Yn.Solid=0]="Solid",Yn[Yn.Gradient=1]="Gradient";(Xn={})[Xn.TwoColor=0]="TwoColor",Xn[Xn.OneColor=1]="OneColor";var Ng=((Ie={})[Ie.Default=0]="Default",Ie[Ie.External=1]="External",Ie[Ie.Polyline=2]="Polyline",Ie[Ie.Derived=4]="Derived",Ie[Ie.Textbox=8]="Textbox",Ie[Ie.Outermost=16]="Outermost",Ie),Mr=((et={})[et.Line=1]="Line",et[et.Circular=2]="Circular",et[et.Elliptic=3]="Elliptic",et[et.Spline=4]="Spline",et),Yg=(($={})[$.Off=0]="Off",$[$.Solid=1]="Solid",$[$.Dashed=2]="Dashed",$[$.Dotted=3]="Dotted",$[$.ShotDash=4]="ShotDash",$[$.MediumDash=5]="MediumDash",$[$.LongDash=6]="LongDash",$[$.DoubleShortDash=7]="DoubleShortDash",$[$.DoubleMediumDash=8]="DoubleMediumDash",$[$.DoubleLongDash=9]="DoubleLongDash",$[$.DoubleMediumLongDash=10]="DoubleMediumLongDash",$[$.SparseDot=11]="SparseDot",$);Yg.Off;(Ht={})[Ht.Standard=-3]="Standard",Ht[Ht.ByLayer=-2]="ByLayer",Ht[Ht.ByBlock=-1]="ByBlock";(Rn={})[Rn.English=0]="English",Rn[Rn.Metric=1]="Metric";(Y={})[Y.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",Y[Y.FRONT_CLIPPING=2]="FRONT_CLIPPING",Y[Y.BACK_CLIPPING=4]="BACK_CLIPPING",Y[Y.UCS_FOLLOW=8]="UCS_FOLLOW",Y[Y.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",Y[Y.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",Y[Y.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",Y[Y.FAST_ZOOM=128]="FAST_ZOOM",Y[Y.SNAP_MODE=256]="SNAP_MODE",Y[Y.GRID_MODE=512]="GRID_MODE",Y[Y.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",Y[Y.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",Y[Y.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",Y[Y.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",Y[Y.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",Y[Y.UNUSED=32768]="UNUSED",Y[Y.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",Y[Y.VIEWPORT_OFF=131072]="VIEWPORT_OFF",Y[Y.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",Y[Y.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",Y[Y.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",Y[Y.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(_e={})[_e.OPTIMIZED_2D=0]="OPTIMIZED_2D",_e[_e.WIREFRAME=1]="WIREFRAME",_e[_e.HIDDEN_LINE=2]="HIDDEN_LINE",_e[_e.FLAT_SHADED=3]="FLAT_SHADED",_e[_e.GOURAUD_SHADED=4]="GOURAUD_SHADED",_e[_e.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",_e[_e.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(Bn={})[Bn.UCS_UNCHANGED=0]="UCS_UNCHANGED",Bn[Bn.HAS_OWN_UCS=1]="HAS_OWN_UCS";(be={})[be.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",be[be.TOP=1]="TOP",be[be.BOTTOM=2]="BOTTOM",be[be.FRONT=3]="FRONT",be[be.BACK=4]="BACK",be[be.LEFT=5]="LEFT",be[be.RIGHT=6]="RIGHT";(Fn={})[Fn.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Fn[Fn.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(tt={})[tt.ByLayer=0]="ByLayer",tt[tt.ByBlock=1]="ByBlock",tt[tt.ByDictionaryDefault=2]="ByDictionaryDefault",tt[tt.ByObject=3]="ByObject";(W={})[W.NotAllowed=0]="NotAllowed",W[W.AllowErase=1]="AllowErase",W[W.AllowTransform=2]="AllowTransform",W[W.AllowChangeColor=4]="AllowChangeColor",W[W.AllowChangeLayer=8]="AllowChangeLayer",W[W.AllowChangeLinetype=16]="AllowChangeLinetype",W[W.AllowChangeLinetypeScale=32]="AllowChangeLinetypeScale",W[W.AllowChangeVisibility=64]="AllowChangeVisibility",W[W.AllowClone=128]="AllowClone",W[W.AllowChangeLineweight=256]="AllowChangeLineweight",W[W.AllowChangePlotStyleName=512]="AllowChangePlotStyleName",W[W.AllowAllExceptClone=895]="AllowAllExceptClone",W[W.AllowAll=1023]="AllowAll",W[W.DisableProxyWarning=1024]="DisableProxyWarning",W[W.R13FormatProxy=32768]="R13FormatProxy";function X(n,e,t){return n.code===e&&(t==null||n.value===t)}function Yt(n){let e={};n.rewind();let t=n.next(),r=t.code;if(e.x=t.value,(t=n.next()).code!==r+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=n.next()).code!==r+20?n.rewind():e.z=t.value,e}let _r=Symbol();function k(n,e){return(t,r,i)=>{let s=function(l,c=!1){return l.reduce((h,d)=>{d.pushContext&&h.push({});let p=h[h.length-1];for(let g of typeof d.code=="number"?[d.code]:d.code){let f=p[g]??(p[g]=[]);d.isMultiple&&f.length,f.push(d)}return h},[{}])}(n,r.debug),a=!1,o=s.length-1;for(;!X(t,0,"EOF");){let l=function(y,_,P){return y.find((L,S)=>{var A;return S>=P&&((A=L[_])==null?void 0:A.length)})}(s,t.code,o),c=l==null?void 0:l[t.code],h=c==null?void 0:c[c.length-1];if(!l||!h){r.rewind();break}h.isMultiple||l[t.code].pop();let{name:d,parser:p,isMultiple:g,isReducible:f}=h,m=p==null?void 0:p(t,r,i);if(m===_r){r.rewind();break}if(d){let[y,_]=Xg(i,d);g&&!f?(Object.prototype.hasOwnProperty.call(y,_)||(y[_]=[]),y[_].push(m)):y[_]=m}h.pushContext&&(o-=1),a=!0,t=r.next()}return e&&Object.setPrototypeOf(i,e),a}}function Xg(n,e){let t=e.split(".");if(!t.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let r=n;for(let i=0;i<t.length-1;++i){let s=ss(t[i]),a=ss(t[i+1]);Object.prototype.hasOwnProperty.call(r,s)||(typeof a=="number"?r[s]=[]:r[s]={}),r=r[s]}return[r,ss(t[t.length-1])]}function ss(n){let e=Number.parseInt(n);return Number.isNaN(e)?n:e}function u({value:n}){return n}function w(n,e){return Yt(e)}function O({value:n}){return!!n}function Rg({value:n}){return n.trim()}let Bg=[{code:281,name:"isEntity",parser:O},{code:280,name:"wasProxy",parser:O},{code:91,name:"instanceCount",parser:u},{code:90,name:"proxyFlag",parser:u},{code:3,name:"appName",parser:u},{code:2,name:"cppClassName",parser:u},{code:1,name:"name",parser:u}],Fg=k(Bg),Dg=[{code:0,name:"classes",isMultiple:!0,parser(n,e){if(n.value!=="CLASS")return _r;n=e.next();let t={};return Fg(n,e,t),t}}],Vg=k(Dg);(Dn={})[Dn.RayTrace=0]="RayTrace",Dn[Dn.ShadowMap=1]="ShadowMap";function qe(n,e,t){for(;X(n,102);){var r;let i=n.value;if(n=e.next(),!i.startsWith("{")){e.debug,function(a,o){for(;!X(a,102)&&!X(a,0,"EOF");)a=o.next()}(n,e),n=e.next();continue}let s=i.slice(1).trim();t.extensions??(t.extensions={}),(r=t.extensions)[s]??(r[s]=[]),function(a,o,l){for(;!X(a,102,"}")&&!X(a,0,"EOF");)l.push(a),a=o.next()}(n,e,t.extensions[s]),n=e.next()}e.rewind()}let zg=[{code:1001,name:"xdata",isMultiple:!0,parser:vc}],jg=new Set([1010,1011,1012,1013]);function vc(n,e){var i;if(!X(n,1001))throw Error("XData must starts with code 1001");let t={appName:n.value,value:[]};n=e.next();let r=[t.value];for(;!X(n,0,"EOF")&&!X(n,1001)&&n.code>=1e3;){let s=r[r.length-1];if(n.code===1002){n.value==="{"?r.push([]):(r.pop(),(i=r[r.length-1])==null||i.push(s)),n=e.next();continue}jg.has(n.code)?s.push(Yt(e)):s.push(n.value),n=e.next()}return e.rewind(),t}(nt={})[nt.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",nt[nt.CAST=1]="CAST",nt[nt.RECEIVE=2]="RECEIVE",nt[nt.IGNORE=3]="IGNORE";let j=[...zg,{code:284,name:"shadowMode",parser:u},{code:390,name:"plotStyleHardId",parser:u},{code:380,name:"plotStyleType",parser:u},{code:440,name:"transparency",parser:u},{code:430,name:"colorName",parser:u},{code:420,name:"color",parser:u},{code:310,name:"proxyEntity",isMultiple:!0,isReducible:!0,parser:(n,e,t)=>(t.proxyEntity??"")+n.value},{code:[92,160],name:"proxyByte",parser:u},{code:60,name:"isVisible",parser:O},{code:48,name:"lineTypeScale",parser:u},{code:370,name:"lineweight",parser:u},{code:62,name:"colorIndex",parser:u},{code:347,name:"materialObjectHardId",parser:u},{code:6,name:"lineType",parser:u},{code:8,name:"layer",parser:u},{code:410,name:"layoutTabName",parser:u},{code:67,name:"isInPaperSpace",parser:O},{code:100},{code:330,name:"ownerBlockRecordSoftId",parser:u},{code:102,parser:qe},{code:102,parser:qe},{code:102,parser:qe},{code:5,name:"handle",parser:u}];function Fi(n){return[{code:3,name:n,parser:(e,t,r)=>(r._code3text=(r._code3text??"")+e.value,r._code3text+(r._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:n,parser:(e,t,r)=>(r._code1text=e.value,(r._code3text??"")+r._code1text)}]}function Pc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Gg={extrusionDirection:{x:0,y:0,z:1}},Hg=[{code:210,name:"extrusionDirection",parser:w},{code:51,name:"endAngle",parser:u},{code:50,name:"startAngle",parser:u},{code:100,name:"subclassMarker",parser:u},{code:40,name:"radius",parser:u},{code:10,name:"center",parser:w},{code:39,name:"thickness",parser:u},{code:100},...j];class Ac{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Pc(this,"parser",k(Hg,Gg))}}Pc(Ac,"ForEntityName","ARC");(Wt={})[Wt.BeforeText=0]="BeforeText",Wt[Wt.AboveText=1]="AboveText",Wt[Wt.None=2]="None";let aa=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4,defaultValue:""},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMFXL",code:49,defaultValue:1},{name:"DIMJOGANG",code:50,defaultValue:45},{name:"DIMTFILL",code:69,defaultValue:0},{name:"DIMTFILLCLR",code:70,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:uo.Above,defaultValueImperial:uo.Center},{name:"DIMZIN",code:78,defaultValue:gn.Trailing,defaultValueImperial:gn.Feet},{name:"DIMAZIN",code:79,defaultValue:Cg.None},{name:"DIMARCSYM",code:90,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179,defaultValue:0},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:3,defaultValueImperial:2},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:44,defaultValueImperial:46},{name:"DIMTMOVE",code:279,defaultValue:0},{name:"DIMJUST",code:280,defaultValue:Mg.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Og.Center},{name:"DIMTZIN",code:284,defaultValue:gn.Trailing,defaultValueImperial:gn.Feet},{name:"DIMALTZ",code:285,defaultValue:gn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:gn.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMFXLON",code:290,defaultValue:0},{name:"DIMTXTDIRECTION",code:294,defaultValue:0},{name:"DIMTXSTY",code:340,defaultValue:"Standard"},{name:"DIMLDRBLK",code:341,defaultValue:""},{name:"DIMBLK",code:342,defaultValue:""},{name:"DIMBLK1",code:343,defaultValue:""},{name:"DIMBLK2",code:344,defaultValue:""},{name:"DIMLTYPE",code:345,defaultValue:""},{name:"DIMLTEX1",code:346,defaultValue:""},{name:"DIMLTEX2",code:347,defaultValue:""},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWE",code:372,defaultValue:-2}],Sc=[{code:3,name:"styleName",parser:u},{code:210,name:"extrusionDirection",parser:w},{code:51,name:"ocsRotation",parser:u},{code:53,name:"textRotation",parser:u},{code:1,name:"text",parser:u},{code:42,name:"measurement",parser:u},{code:72,name:"textLineSpacingStyle",parser:u},{code:71,name:"attachmentPoint",parser:u},{code:70,name:"dimensionType",parser:u},{code:11,name:"textPoint",parser:w},{code:10,name:"definitionPoint",parser:w},{code:2,name:"name",parser:u},{code:280,name:"version",parser:u},{code:100}],Wg=[{code:100},{code:52,name:"obliqueAngle",parser:u},{code:50,name:"rotationAngle",parser:u},{code:14,name:"subDefinitionPoint2",parser:w},{code:13,name:"subDefinitionPoint1",parser:w},{code:12,name:"insertionPoint",parser:w},{code:100,name:"subclassMarker",parser:u}],Ug=[{code:16,name:"arcPoint",parser:w},{code:15,name:"centerPoint",parser:w},{code:14,name:"subDefinitionPoint2",parser:w},{code:13,name:"subDefinitionPoint1",parser:w},{code:100,name:"subclassMarker",parser:u}],$g=[{code:14,name:"subDefinitionPoint2",parser:w},{code:13,name:"subDefinitionPoint1",parser:w},{code:100,name:"subclassMarker",parser:u}],qg=[{code:40,name:"leaderLength",parser:u},{code:15,name:"subDefinitionPoint",parser:w},{code:100,name:"subclassMarker",parser:u}],Kg=[{code:100,parser(n,e,t){let r=function(i){switch(i){case"AcDbAlignedDimension":return k(Wg);case"AcDb3PointAngularDimension":case"AcDb2LineAngularDimension":return k(Ug);case"AcDbOrdinateDimension":return k($g);case"AcDbRadialDimension":case"AcDbDiametricDimension":return k(qg)}return null}(n.value);if(!r)return _r;r(n,e,t)},pushContext:!0},...aa.map(n=>({...n,parser:u})),...Sc,...j];class Br{parseEntity(e,t){let r={};return k(Kg)(t,e,r),r}}(Ji="ForEntityName")in Br?Object.defineProperty(Br,Ji,{value:"DIMENSION",enumerable:!0,configurable:!0,writable:!0}):Br[Ji]="DIMENSION";let Zg=[{code:73},{code:17,name:"leaderEnd",parser:w},{code:16,name:"leaderStart",parser:w},{code:71,name:"hasLeader",parser:O},{code:41,name:"endAngle",parser:u},{code:40,name:"startAngle",parser:u},{code:70,name:"isPartial",parser:O},{code:15,name:"centerPoint",parser:w},{code:14,name:"xline2Point",parser:w},{code:13,name:"xline1Point",parser:w},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...aa.map(n=>({...n,parser:u})),...Sc,...j];class Fr{parseEntity(e,t){let r={};return k(Zg)(t,e,r),r}}(es="ForEntityName")in Fr?Object.defineProperty(Fr,es,{value:"ARC_DIMENSION",enumerable:!0,configurable:!0,writable:!0}):Fr[es]="ARC_DIMENSION";(ze={})[ze.NONE=0]="NONE",ze[ze.INVISIBLE=1]="INVISIBLE",ze[ze.CONSTANT=2]="CONSTANT",ze[ze.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",ze[ze.PRESET=8]="PRESET";(Vn={})[Vn.MULTILINE=2]="MULTILINE",Vn[Vn.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(Ut={})[Ut.NONE=0]="NONE",Ut[Ut.MIRRORED_X=2]="MIRRORED_X",Ut[Ut.MIRRORED_Y=4]="MIRRORED_Y";var Qg=((Ee={})[Ee.LEFT=0]="LEFT",Ee[Ee.CENTER=1]="CENTER",Ee[Ee.RIGHT=2]="RIGHT",Ee[Ee.ALIGNED=3]="ALIGNED",Ee[Ee.MIDDLE=4]="MIDDLE",Ee[Ee.FIT=5]="FIT",Ee),Jg=((rt={})[rt.BASELINE=0]="BASELINE",rt[rt.BOTTOM=1]="BOTTOM",rt[rt.MIDDLE=2]="MIDDLE",rt[rt.TOP=3]="TOP",rt);function Lc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ic={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Qg.LEFT,valign:Jg.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Ec=[{code:73,name:"valign",parser:u},{code:100},{code:210,name:"extrusionDirection",parser:w},{code:11,name:"endPoint",parser:w},{code:72,name:"valign",parser:u},{code:72,name:"halign",parser:u},{code:71,name:"generationFlag",parser:u},{code:7,name:"styleName",parser:u},{code:51,name:"obliqueAngle",parser:u},{code:41,name:"xScale",parser:u},{code:50,name:"rotation",parser:u},{code:1,name:"text",parser:u},{code:40,name:"textHeight",parser:u},{code:10,name:"startPoint",parser:w},{code:39,name:"thickness",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Tc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Lc(this,"parser",k(Ec,Ic))}}function Cc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Lc(Tc,"ForEntityName","TEXT");let ep={...Ic},tp=[{code:2},{code:40,name:"annotationScale",parser:u},{code:10,name:"alignmentPoint",parser:w},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:u},{code:70,name:"numberOfSecondaryAttributes",parser:u},{code:70,name:"isReallyLocked",parser:O},{code:70,name:"mtextFlag",parser:u},{code:280,name:"isDuplicatedRecord",parser:O},{code:100},{code:280,name:"isLocked",parser:O},{code:74,name:"valign",parser:u},{code:73},{code:70,name:"attributeFlag",parser:u},{code:2,name:"tag",parser:u},{code:3,name:"prompt",parser:u},{code:280},{code:100,name:"subclassMarker",parser:u},...Ec.slice(2)];class Mc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Cc(this,"parser",k(tp,ep))}}function np(n,e){let t={};for(let r of n){let i=e(r);i!=null&&(t[i]??(t[i]=[]),t[i].push(r))}return t}function*Pi(n,e=1/0,t=1){for(let r=n;r!==e;r+=t)yield r}function Es(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}Cc(Mc,"ForEntityName","ATTDEF");var rp=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function ip(n){return rp[n]}function sp(n){n.rewind();let e=n.next();if(e.code!==101)throw Error("Bad call for skipEmbeddedObject()");do e=n.next();while(e.code!==0);n.rewind()}function ap(n,e,t){if(X(e,102))return qe(e,t,n),!0;switch(e.code){case 0:n.type=e.value;break;case 5:n.handle=e.value;break;case 330:n.ownerBlockRecordSoftId=e.value;break;case 67:n.isInPaperSpace=!!e.value;break;case 8:n.layer=e.value;break;case 6:n.lineType=e.value;break;case 347:n.materialObjectHardId=e.value;break;case 62:n.colorIndex=e.value,n.color=ip(Math.abs(e.value));break;case 370:n.lineweight=e.value;break;case 48:n.lineTypeScale=e.value;break;case 60:n.isVisible=!!e.value;break;case 92:n.proxyByte=e.value;break;case 310:n.proxyEntity=e.value;break;case 100:break;case 420:n.color=e.value;break;case 430:n.transparency=e.value;break;case 390:n.plotStyleHardId=e.value;break;case 284:n.shadowMode=e.value;break;case 1001:(n.xdata??(n.xdata=[])).push(vc(e,t));break;default:return!1}return!0}function Oc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let op={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Dr=[{code:46,name:"annotationHeight",parser:u},{code:101,parser(n,e){sp(e)}},{code:50,name:"columnHeight",parser:u},{code:49,name:"columnGutter",parser:u},{code:48,name:"columnWidth",parser:u},{code:79,name:"columnAutoHeight",parser:u},{code:78,name:"columnFlowReversed",parser:u},{code:76,name:"columnCount",parser:u},{code:75,name:"columnType",parser:u},{code:441,name:"backgroundFillTransparency",parser:u},{code:63,name:"backgroundFillColor",parser:u},{code:45,name:"fillBoxScale",parser:u},{code:[...Pi(430,440)],name:"backgroundColor",parser:u},{code:[...Pi(420,430)],name:"backgroundColor",parser:u},{code:90,name:"backgroundFill",parser:u},{code:44,name:"lineSpacing",parser:u},{code:73,name:"lineSpacingStyle",parser:u},{code:50,name:"rotation",parser:u},{code:43},{code:42},{code:11,name:"direction",parser:w},{code:210,name:"extrusionDirection",parser:w},{code:7,name:"styleName",parser:u},...Fi("text"),{code:72,name:"drawingDirection",parser:u},{code:71,name:"attachmentPoint",parser:u},{code:41,name:"width",parser:u},{code:40,name:"height",parser:u},{code:10,name:"insertionPoint",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class kc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Oc(this,"parser",k(Dr,op))}}function Nc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Oc(kc,"ForEntityName","MTEXT");let lp={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},cp=[...Dr.slice(Dr.findIndex(({name:n})=>n==="columnType"),Dr.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!X(n,0,"MTEXT"))return _r}},{code:2,name:"definitionTag",parser:u},{code:40,name:"annotationScale",parser:u},{code:10,name:"alignmentPoint",parser:w},{code:340,name:"secondaryAttributesHardId",parser:u},{code:70,name:"numberOfSecondaryAttributes",parser:u},{code:70,name:"isReallyLocked",parser:O},{code:70,name:"mtextFlag",parser:u},{code:280,name:"isDuplicatedEntriesKeep",parser:O},{code:100},{code:280,name:"lockPositionFlag",parser:O},{code:210,name:"extrusionDirection",parser:w},{code:11,name:"alignmentPoint",parser:w},{code:74,name:"verticalJustification",parser:u},{code:72,name:"horizontalJustification",parser:u},{code:71,name:"textGenerationFlag",parser:u},{code:7,name:"textStyle",parser:u},{code:51,name:"obliqueAngle",parser:u},{code:41,name:"scale",parser:u},{code:50,name:"rotation",parser:u},{code:73},{code:70,name:"attributeFlag",parser:u},{code:2,name:"tag",parser:u},{code:280},{code:100,name:"subclassMarker",parser:u},{code:1,name:"text",parser:u},{code:40,name:"textHeight",parser:u},{code:10,name:"startPoint",parser:w},{code:39,name:"thickness",parser:u},{code:100},...j];class Yc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Nc(this,"parser",k(cp,lp))}}function Xc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Nc(Yc,"ForEntityName","ATTRIB");let hp=[...Fi("data"),{code:70,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Rc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Xc(this,"parser",k(hp))}}function Bc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Xc(Rc,"ForEntityName","BODY");let dp={thickness:0,extrusionDirection:{x:0,y:0,z:1}},up=[{code:210,name:"extrusionDirection",parser:w},{code:40,name:"radius",parser:u},{code:10,name:"center",parser:w},{code:39,name:"thickness",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Fc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Bc(this,"parser",k(up,dp))}}function Dc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Bc(Fc,"ForEntityName","CIRCLE");let gp={extrusionDirection:{x:0,y:0,z:1}},pp=[{code:42,name:"endAngle",parser:u},{code:41,name:"startAngle",parser:u},{code:40,name:"axisRatio",parser:u},{code:210,name:"extrusionDirection",parser:w},{code:11,name:"majorAxisEndPoint",parser:w},{code:10,name:"center",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Vc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Dc(this,"parser",k(pp,gp))}}function zc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Dc(Vc,"ForEntityName","ELLIPSE");let fp=[{code:13,name:"vertices.3",parser:w},{code:12,name:"vertices.2",parser:w},{code:11,name:"vertices.1",parser:w},{code:10,name:"vertices.0",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class jc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){zc(this,"parser",k(fp))}}zc(jc,"ForEntityName","3DFACE");(it={})[it.First=1]="First",it[it.Second=2]="Second",it[it.Third=4]="Third",it[it.Fourth=8]="Fourth";function Wn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class go{getReadIndex(){return this._pointer}getLines(){return this._data}next(){if(!this.hasNext())return this._eof?this.debug:this.debug,{code:0,value:"EOF"};let e=this._data[this._pointer++],t=parseInt(e,10);Number.isNaN(t)&&po(e);let r=Ts(t,this._data[this._pointer++],this.debug),i={code:t,value:r};return X(i,0,"EOF")&&(this._eof=!0),this.lastReadGroup=i,i}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let e=this._data[this._pointer],t=parseInt(e,10);Number.isNaN(t)&&po(e);let r={code:t,value:0};return r.value=Ts(r.code,this._data[this._pointer+1],this.debug),r}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e,t=!1){Wn(this,"_data",void 0),Wn(this,"debug",void 0),Wn(this,"_pointer",void 0),Wn(this,"_eof",void 0),Wn(this,"lastReadGroup",void 0),this._data=e,this.debug=t,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function Ts(n,e,t=!1){var r;let i=(r=e).endsWith("\r")?r.slice(0,-1):r;return n<=9?i:n>=10&&n<=59?parseFloat(e.trim()):n>=60&&n<=99?parseInt(e.trim()):n>=100&&n<=109?i:n>=110&&n<=149?parseFloat(e.trim()):n>=160&&n<=179?parseInt(e.trim()):n>=210&&n<=239?parseFloat(e.trim()):n>=270&&n<=289?parseInt(e.trim()):n>=290&&n<=299?function(s){let a=s.trim().toLowerCase();if(a===""||a==="0"||a==="false"||a==="f"||a==="no")return!1;if(a==="1"||a==="true"||a==="t"||a==="yes")return!0;let o=Number.parseFloat(a);if(!Number.isNaN(o))return o!==0;throw TypeError("String '"+s+"' cannot be cast to Boolean type")}(e.trim()):n>=300&&n<=369?i:n>=370&&n<=389?parseInt(e.trim()):n>=390&&n<=399?i:n>=400&&n<=409?parseInt(e.trim()):n>=410&&n<=419?i:n>=420&&n<=429?parseInt(e.trim()):n>=430&&n<=439?i:n>=440&&n<=459?parseInt(e.trim()):n>=460&&n<=469?parseFloat(e.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?i:n>=1010&&n<=1059?parseFloat(e.trim()):n>=1060&&n<=1071?parseInt(e.trim()):i}function po(n){let e=n.length>120?`${n.slice(0,120)}…`:n;throw Error(`Invalid DXF group code line: "${e}". Expected a numeric group code (often caused by binary DXF, UTF-16-encoded DXF, or stray blank lines). Use ASCII/text DXF or remove blank lines between code/value pairs.`)}let Gc=[{code:330,name:"sourceBoundaryObjects",parser:u,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:u}],mp=[{code:11,name:"end",parser:w},{code:10,name:"start",parser:w}],yp=[{code:73,name:"isCCW",parser:O},{code:51,name:"endAngle",parser:u},{code:50,name:"startAngle",parser:u},{code:40,name:"radius",parser:u},{code:10,name:"center",parser:w}],_p=[{code:73,name:"isCCW",parser:O},{code:51,name:"endAngle",parser:u},{code:50,name:"startAngle",parser:u},{code:40,name:"lengthOfMinorAxis",parser:u},{code:11,name:"end",parser:w},{code:10,name:"center",parser:w}],bp=[{code:13,name:"endTangent",parser:w},{code:12,name:"startTangent",parser:w},{code:11,name:"fitDatum",isMultiple:!0,parser:w},{code:97,name:"numberOfFitData",parser:u},{code:10,name:"controlPoints",isMultiple:!0,parser(n,e){let t={...Yt(e),weight:1};return(n=e.next()).code===42?t.weight=n.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:u},{code:96,name:"numberOfControlPoints",parser:u},{code:95,name:"numberOfKnots",parser:u},{code:74,name:"isPeriodic",parser:O},{code:73,name:"splineFlag",parser:u},{code:94,name:"degree",parser:u}],xp={[Mr.Line]:mp,[Mr.Circular]:yp,[Mr.Elliptic]:_p,[Mr.Spline]:bp},wp=[...Gc,{code:72,name:"edges",parser(n,e){let t={type:n.value},r=xp[t.type];if(r==null)throw Error(`Unsupported HATCH boundary edge type: ${t.type} (expected 1–4: line, arc, elliptic arc, spline). This often happens when a polyline hatch boundary is parsed as edge segments (e.g. group 92 boundary flag missing the polyline bit). Try re-saving as ASCII DXF or simplifying hatch boundaries in CAD.`);return k(r)(n=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:u}],vp=[...Gc,{code:10,name:"vertices",parser(n,e){let t={...Yt(e),bulge:0};return(n=e.next()).code===42?t.bulge=n.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:u},{code:73,name:"isClosed",parser:O},{code:72,name:"hasBulge",parser:O}];function Pp(n,e){let t={boundaryPathTypeFlag:n.value},r=!!(t.boundaryPathTypeFlag&Ng.Polyline),i=e.getReadIndex();return n=e.next(),!r&&function(s,a){let o=Math.min(s.length,a+120),l=a;for(;l<o-1;){let c=parseInt(s[l],10);if(Number.isNaN(c))break;if(c===93){if(l+3>=s.length||parseInt(s[l+2],10)!==72)return!1;let h=Ts(72,s[l+3]);if(h===0)return!0;if(h===1){if(l+5<s.length&&parseInt(s[l+4],10)===73)return!0;if(l+8<s.length&&parseInt(s[l+4],10)===10){let d=parseInt(s[l+8],10);if(d===10||d===42)return!0}}break}if(c===0)break;l+=2}return!1}(e.getLines(),i)&&(r=!0),r?k(vp)(n,e,t):k(wp)(n,e,t),t}let Ap=[{code:49,name:"dashLengths",parser:u,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:u},{code:45,name:"offset",parser:fo},{code:43,name:"base",parser:fo},{code:53,name:"angle",parser:u}];function fo(n,e){let t=n.code+1,r={x:n.value,y:1};return(n=e.next()).code===t?r.y=n.value:e.rewind(),r}function Sp(n,e){let t={};return k(Ap)(n,e,t),t}function Lp(n,e){let t=[];for(;n.code===463;){let r={reservedField:n.value};if((n=e.next()).code===63&&(r.colorIndex=n.value,n=e.next()),n.code===421)r.rgb=n.value,t.push(r),n=e.next();else{e.rewind();break}}return n.code!==463&&t.length>0&&e.rewind(),t}function Hc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ip={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Ep=[{code:470,name:"gradientName",parser:u},{code:463,name:"gradientColors",parser:Lp},{code:462,name:"colorTint",parser:u},{code:461,name:"gradientDefinition",parser:u},{code:460,name:"gradientRotation",parser:u},{code:453,name:"numberOfColors",parser:u},{code:452,name:"gradientColorFlag",parser:u},{code:451},{code:450,name:"gradientFlag",parser:u},{code:10,name:"seedPoints",parser:w,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:w},{code:98,name:"numberOfSeedPoints",parser:u},{code:47,name:"pixelSize",parser:u},{code:53,name:"definitionLines",parser:Sp,isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:u},{code:77,name:"isDouble",parser:O},{code:73,name:"isAnnotated",parser:O},{code:41,name:"patternScale",parser:u},{code:52,name:"patternAngle",parser:u},{code:76,name:"patternType",parser:u},{code:75,name:"hatchStyle",parser:u},{code:92,name:"boundaryPaths",parser:Pp,isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:u},{code:71,name:"associativity",parser:u},{code:63,name:"patternFillColor",parser:u},{code:70,name:"solidFill",parser:u},{code:2,name:"patternName",parser:u},{code:210,name:"extrusionDirection",parser:w},{code:10,name:"elevationPoint",parser:w},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...j];class Wc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Hc(this,"parser",k(Ep,Ip))}}function Uc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Hc(Wc,"ForEntityName","HATCH");let Tp={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Cp=[{code:290,name:"clipMode",parser:u},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:w},{code:91,name:"countBoundaryPoints",parser:u},{code:71,name:"clippingBoundaryType",parser:u},{code:360,name:"imageDefReactorHandle",parser:u},{code:283,name:"fade",parser:u},{code:282,name:"contrast",parser:u},{code:281,name:"brightness",parser:u},{code:280,name:"isClipped",parser:O},{code:70,name:"flags",parser:u},{code:340,name:"imageDefHandle",parser:u},{code:13,name:"imageSize",parser:w},{code:12,name:"vPixel",parser:w},{code:11,name:"uPixel",parser:w},{code:10,name:"position",parser:w},{code:90,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class $c{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Uc(this,"parser",k(Cp,Tp))}}Uc($c,"ForEntityName","IMAGE");(st={})[st.ShowImage=1]="ShowImage",st[st.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",st[st.UseClippingBoundary=4]="UseClippingBoundary",st[st.TransparencyIsOn=8]="TransparencyIsOn";(zn={})[zn.Rectangular=1]="Rectangular",zn[zn.Polygonal=2]="Polygonal";(jn={})[jn.Outside=0]="Outside",jn[jn.Inside=1]="Inside";function qc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Mp={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},Op=[{code:210,name:"extrusionDirection",parser:w},{code:45,name:"rowSpacing",parser:u},{code:44,name:"columnSpacing",parser:u},{code:71,name:"rowCount",parser:u},{code:70,name:"columnCount",parser:u},{code:50,name:"rotation",parser:u},{code:43,name:"zScale",parser:u},{code:42,name:"yScale",parser:u},{code:41,name:"xScale",parser:u},{code:10,name:"insertionPoint",parser:w},{code:2,name:"name",parser:u},{code:66,name:"isVariableAttributes",parser:O},{code:100,name:"subclassMarker",parser:u},...j];class Kc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){qc(this,"parser",k(Op,Mp))}}function Zc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}qc(Kc,"ForEntityName","INSERT");let kp={isArrowheadEnabled:!0},Np=[{code:213,name:"offsetFromAnnotation",parser:w},{code:212,name:"offsetFromBlock",parser:w},{code:211,name:"horizontalDirection",parser:w},{code:210,name:"normal",parser:w},{code:340,name:"associatedAnnotation",parser:u},{code:77,name:"byBlockColor",parser:u},{code:10,name:"vertices",parser:w,isMultiple:!0},{code:76,name:"numberOfVertices",parser:u},{code:41,name:"textWidth",parser:u},{code:40,name:"textHeight",parser:u},{code:75,name:"isHooklineExists",parser:O},{code:74,name:"isHooklineSameDirection",parser:O},{code:73,name:"leaderCreationFlag",parser:u},{code:72,name:"isSpline",parser:O},{code:71,name:"isArrowheadEnabled",parser:O},{code:3,name:"styleName",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Qc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Zc(this,"parser",k(Np,kp))}}Zc(Qc,"ForEntityName","LEADER");(at={})[at.TextAnnotation=0]="TextAnnotation",at[at.ToleranceAnnotation=1]="ToleranceAnnotation",at[at.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",at[at.NoAnnotation=3]="NoAnnotation";function Jc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Yp={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Xp=[{code:210,name:"extrusionDirection",parser:w},{code:11,name:"endPoint",parser:w},{code:10,name:"startPoint",parser:w},{code:39,name:"thickness",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class eh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Jc(this,"parser",k(Xp,Yp))}}function th(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Jc(eh,"ForEntityName","LINE");let Rp=[{code:280,name:"shadowMapSoftness",parser:u},{code:91,name:"shadowMapSize",parser:u},{code:73,name:"shadowType",parser:u},{code:293,name:"isShadowCast",parser:O},{code:51,name:"falloffAngle",parser:u},{code:50,name:"hotspotAngle",parser:u},{code:42,name:"limitEnd",parser:u},{code:41,name:"limitStart",parser:u},{code:292,name:"isAttenuationLimited",parser:O},{code:72,name:"attenuationType",parser:u},{code:11,name:"target",parser:w},{code:10,name:"position",parser:w},{code:40,name:"intensity",parser:u},{code:291,name:"isPlotGlyph",parser:O},{code:290,name:"isOn",parser:O},{code:421,name:"lightColorInstance",parser:u},{code:63,name:"lightColorIndex",parser:u},{code:70,name:"lightType",parser:u},{code:1,name:"name",parser:u},{code:90,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class nh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){th(this,"parser",k(Rp))}}th(nh,"ForEntityName","LIGHT");($t={})[$t.Distant=1]="Distant",$t[$t.Point=2]="Point",$t[$t.Spot=3]="Spot";(qt={})[qt.None=0]="None",qt[qt.InverseLinear=1]="InverseLinear",qt[qt.InverseSquare=2]="InverseSquare";let Bp={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Fp={bulge:0},Dp=[{code:42,name:"bulge",parser:u},{code:41,name:"endWidth",parser:u},{code:40,name:"startWidth",parser:u},{code:91,name:"id",parser:u},{code:20,name:"y",parser:u},{code:10,name:"x",parser:u}],Vp=[{code:210,name:"extrusionDirection",parser:w},{code:10,name:"vertices",isMultiple:!0,parser(n,e){let t={};return k(Dp,Fp)(n,e,t),t}},{code:39,name:"thickness",parser:u},{code:38,name:"elevation",parser:u},{code:43,name:"constantWidth",parser:u},{code:70,name:"flag",parser:u},{code:90,name:"numberOfVertices",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Vr{parseEntity(e,t){let r={};return k(Vp,Bp)(t,e,r),r}}(ts="ForEntityName")in Vr?Object.defineProperty(Vr,ts,{value:"LWPOLYLINE",enumerable:!0,configurable:!0,writable:!0}):Vr[ts]="LWPOLYLINE";(Gn={})[Gn.IS_CLOSED=1]="IS_CLOSED",Gn[Gn.PLINE_GEN=128]="PLINE_GEN";function rh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let zp=[{code:90,name:"overridenSubEntityCount",parser:u},{code:140,name:"edgeCreaseWeights",parser:u,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:u},{code:94,parser(n,e,t){t.edgeCount=n.value,t.edgeIndices=[];for(let r=0;r<t.edgeCount;++r){let i=[];n=e.next(),i[0]=n.value,n=e.next(),i[1]=n.value,t.edgeIndices.push(i)}}},{code:93,parser(n,e,t){t.totalFaceIndices=n.value,t.faceIndices=[];let r=[];for(let s=0;s<t.totalFaceIndices&&!X(n,0);++s)n=e.next(),r.push(n.value);let i=0;for(;i<r.length;){let s=r[i++],a=[];for(let o=0;o<s;++o)a.push(r[i++]);t.faceIndices.push(a)}}},{code:10,name:"vertices",parser:w,isMultiple:!0},{code:92,name:"verticesCount",parser:u},{code:91,name:"subdivisionLevel",parser:u},{code:40,name:"blendCrease",parser:u},{code:72,name:"isBlendCreased",parser:O},{code:71,name:"version",parser:u},{code:100,name:"subclassMarker",parser:Rg,pushContext:!0},...j];class ih{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){rh(this,"parser",k(zp))}}function sh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}rh(ih,"ForEntityName","MESH");let jp=[{code:42,name:"fillParameters",parser:u,isMultiple:!0},{code:75,name:"fillCount",parser:u},{code:41,name:"parameters",parser:u,isMultiple:!0},{code:74,name:"parameterCount",parser:u}],Gp=[{code:[74,41,75,42],name:"elements",parser(n,e){let t=k(jp),r={};return t(n,e,r),r},isMultiple:!0},{code:13,name:"miterDirection",parser:w},{code:12,name:"direction",parser:w},{code:11,name:"position",parser:w}],Hp=[{code:[11,12,13],name:"segments",parser(n,e){let t=k(Gp),r={};return t(n,e,r),r},isMultiple:!0},{code:210,name:"extrusionDirection",parser:w},{code:10,name:"startPosition",parser:w},{code:73,name:"styleCount",parser:u},{code:72,name:"vertexCount",parser:u},{code:71,name:"flags",parser:u},{code:70,name:"justification",parser:u},{code:40,name:"scale",parser:u},{code:340,name:"styleObjectHandle",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...j];class ah{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){sh(this,"parser",k(Hp))}}sh(ah,"ForEntityName","MLINE");(Kt={})[Kt.Top=0]="Top",Kt[Kt.Zero=1]="Zero",Kt[Kt.Bottom=2]="Bottom";(ot={})[ot.HasVertex=1]="HasVertex",ot[ot.Closed=2]="Closed",ot[ot.SuppressStartCaps=4]="SuppressStartCaps",ot[ot.SuppressEndCaps=8]="SuppressEndCaps";(Zt={})[Zt.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Zt[Zt.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Zt[Zt.BY_STYLE=5]="BY_STYLE";function oh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Wp={},Up=[{code:300,parser:function(n,e,t){var s;let r;if(n.value==="CONTEXT_DATA{")for(;e.hasNext();){var i;if((r=e.next()).code===301)break;switch(r.code){case 10:t.contentBasePosition=ue(r,e);break;case 11:t.normal=ue(r,e);break;case 12:t.textAnchor=ue(r,e);break;case 13:t.textDirection=ue(r,e);break;case 14:ut(t).normal=ue(r,e);break;case 15:ut(t).position=ue(r,e);break;case 16:ut(t).scale=ue(r,e);break;case 40:t.contentScale=r.value;break;case 41:case 44:t.textHeight=r.value;break;case 42:t.textRotation=r.value;break;case 43:t.textWidth=r.value;break;case 45:t.textLineSpacingFactor=r.value;break;case 46:ut(t).rotation=r.value;break;case 47:(i=ut(t)).transformationMatrix??(i.transformationMatrix=[]),(s=ut(t).transformationMatrix)==null||s.push(r.value);break;case 90:t.textColor=r.value;break;case 91:t.textBackgroundColor=r.value;break;case 92:t.textBackgroundTransparency=r.value;break;case 93:ut(t).color=r.value;break;case 110:t.planeOrigin=ue(r,e);break;case 111:t.planeXAxisDirection=ue(r,e);break;case 112:t.planeYAxisDirection=ue(r,e);break;case 140:t.arrowheadSize=r.value;break;case 141:t.textBackgroundScaleFactor=r.value;break;case 142:t.textColumnWidth=r.value;break;case 143:t.textColumnGutterWidth=r.value;break;case 144:t.textColumnHeight=r.value;break;case 145:t.landingGap=r.value;break;case 170:t.textLineSpacingStyle=r.value;break;case 171:t.textAttachment=r.value;break;case 172:t.textFlowDirection=r.value;break;case 173:t.textColumnType=r.value;break;case 290:t.hasMText=r.value;break;case 291:t.textBackgroundColorOn=r.value;break;case 292:t.textFillOn=r.value;break;case 293:t.textUseAutoHeight=r.value;break;case 294:t.textColumnFlowReversed=r.value;break;case 295:t.textUseWordBreak=r.value;break;case 296:t.hasBlock=r.value;break;case 297:t.planeNormalReversed=r.value;break;case 302:r.value==="LEADER{"&&(t.leaderSections??(t.leaderSections=[]),t.leaderSections.push(function(a,o){let l,c;if(a.value!=="LEADER{")return{leaderLines:[]};let h={leaderLines:[]};for(;o.hasNext();){if((c=o.next()).code===303){Or(h,l);break}switch(c.code){case 290:h.lastLeaderLinePointSet=c.value;break;case 291:h.doglegVectorSet=c.value;break;case 10:h.lastLeaderLinePoint=ue(c,o);break;case 11:h.doglegVector=ue(c,o);break;case 12:l??(l={}),l.start=ue(c,o);break;case 13:l??(l={}),l.end=ue(c,o),Or(h,l),l=void 0;break;case 90:h.leaderBranchIndex=c.value;break;case 40:h.doglegLength=c.value;break;case 304:c.value==="LEADER_LINE{"&&h.leaderLines.push(function(d,p){let g,f;if(d.value!=="LEADER_LINE{")return{vertices:[]};let m={vertices:[]};for(;p.hasNext();){if((f=p.next()).code===305){Or(m,g);break}switch(f.code){case 10:m.vertices.push(ue(f,p));break;case 11:g??(g={}),g.start=ue(f,p);break;case 12:g??(g={}),g.end=ue(f,p),Or(m,g),g=void 0;break;case 90:m.breakPointIndexes??(m.breakPointIndexes=[]),m.breakPointIndexes.push(f.value),g??(g={}),g.index=f.value;break;case 91:m.leaderLineIndex=f.value}}return m}(c,o))}}return h}(r,e)));break;case 304:r.value!=="LEADER_LINE{"&&(t.textContent=r.value,t.contentType??(t.contentType=2));break;case 340:t.textStyleId=r.value;break;case 341:t.blockContentId=r.value,ut(t).blockContentId=r.value}}}},{code:270,name:"version",parser:u},{code:340,name:"leaderStyleId",parser:u},{code:90,name:"propertyOverrideFlag",parser:u},{code:170,name:"leaderLineType",parser:u},{code:91,name:"leaderLineColor",parser:u},{code:341,name:"leaderLineTypeId",parser:u},{code:171,name:"leaderLineWeight",parser:u},{code:290,name:"landingEnabled",parser:O},{code:291,name:"doglegEnabled",parser:O},{code:[40,41],name:"doglegLength",parser:u},{code:342,name:"arrowheadId",parser:u},{code:42,name:"arrowheadSize",parser:u},{code:172,name:"contentType",parser:u},{code:343,name:"textStyleId",parser:u},{code:173,name:"textLeftAttachmentType",parser:u},{code:95,name:"textRightAttachmentType",parser:u},{code:174,name:"textAngleType",parser:u},{code:175,name:"textAlignmentType",parser:u},{code:92,name:"textColor",parser:u},{code:292,name:"textFrameEnabled",parser:O},{code:344,parser:function(n,e,t){t.blockContentId=n.value,ut(t).blockContentId=n.value}},{code:93,name:"blockContentColor",parser:u},{code:10,name:"blockContentScale",parser:w},{code:43,name:"blockContentRotation",parser:u},{code:176,name:"blockContentConnectionType",parser:u},{code:293,name:"annotativeScaleEnabled",parser:O},{code:94,parser:function(n,e,t){t.arrowheadOverrides??(t.arrowheadOverrides=[]),t.arrowheadOverrides.push({index:n.value})},isMultiple:!0},{code:345,parser:function(n,e,t){var r;((r=t).arrowheadOverrides??(r.arrowheadOverrides=[]),r.arrowheadOverrides.length||r.arrowheadOverrides.push({}),r.arrowheadOverrides[r.arrowheadOverrides.length-1]).handle=n.value},isMultiple:!0},{code:330,parser:function(n,e,t){t.blockAttributes??(t.blockAttributes=[]),t.blockAttributes.push({id:n.value})},isMultiple:!0},{code:177,parser:function(n,e,t){as(t).index=n.value},isMultiple:!0},{code:44,parser:function(n,e,t){as(t).width=n.value},isMultiple:!0},{code:302,parser:function(n,e,t){as(t).text=n.value},isMultiple:!0},{code:294,name:"textDirectionNegative",parser:O},{code:178,name:"textAlignInIPE",parser:u},{code:179,name:"textAttachmentPoint",parser:u},{code:271,name:"textAttachmentDirection",parser:u},{code:272,name:"bottomTextAttachmentDirection",parser:u},{code:273,name:"topTextAttachmentDirection",parser:u},{code:100,name:"subclassMarker",parser:u},...j];function ue(n,e){return Es(w(n,e))}function Or(n,e){(e!=null&&e.start||e!=null&&e.end)&&(n.breaks??(n.breaks=[]),n.breaks.push(e))}function ut(n){return n.blockContent??(n.blockContent={})}function as(n){return n.blockAttributes??(n.blockAttributes=[]),n.blockAttributes.length||n.blockAttributes.push({}),n.blockAttributes[n.blockAttributes.length-1]}class lh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){oh(this,"parser",k(Up,Wp))}}function ch(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}oh(lh,"ForEntityName","MULTILEADER");let $p={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},qp=[{code:50,name:"angle",parser:u},{code:210,name:"extrusionDirection",parser:w},{code:39,name:"thickness",parser:u},{code:10,name:"position",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class hh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){ch(this,"parser",k(qp,$p))}}function dh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ch(hh,"ForEntityName","POINT");let Kp={startWidth:0,endWidth:0,bulge:0},Zp=[{code:91,name:"id",parser:u},{code:[...Pi(71,75)],name:"faces",isMultiple:!0,parser:u},{code:50,name:"tangentDirection",parser:u},{code:70,name:"flag",parser:u},{code:42,name:"bulge",parser:u},{code:41,name:"endWidth",parser:u},{code:40,name:"startWidth",parser:u},{code:30,name:"z",parser:u},{code:20,name:"y",parser:u},{code:10,name:"x",parser:u},{code:100,name:"subclassMarker",parser:u},{code:100},...j];class oa{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){dh(this,"parser",k(Zp,Kp))}}function uh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}dh(oa,"ForEntityName","VERTEX");let Qp={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Jp=[{code:0,name:"vertices",isMultiple:!0,parser:(n,e)=>X(n,0,"VERTEX")?(n=e.next(),new oa().parseEntity(e,n)):_r},{code:210,name:"extrusionDirection",parser:w},{code:75,name:"smoothType",parser:u},{code:74,name:"surfaceNDensity",parser:u},{code:73,name:"surfaceMDensity",parser:u},{code:72,name:"meshNVertexCount",parser:u},{code:71,name:"meshMVertexCount",parser:u},{code:41,name:"endWidth",parser:u},{code:40,name:"startWidth",parser:u},{code:70,name:"flag",parser:u},{code:39,name:"thickness",parser:u},{code:30,name:"elevation",parser:u},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:u},...j];class gh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){uh(this,"parser",k(Jp,Qp))}}uh(gh,"ForEntityName","POLYLINE");(he={})[he.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",he[he.CURVE_FIT=2]="CURVE_FIT",he[he.SPLINE_FIT=4]="SPLINE_FIT",he[he.POLYLINE_3D=8]="POLYLINE_3D",he[he.POLYGON_3D=16]="POLYGON_3D",he[he.CLOSED_POLYGON=32]="CLOSED_POLYGON",he[he.POLYFACE=64]="POLYFACE",he[he.CONTINUOUS=128]="CONTINUOUS";var kr=((lt={})[lt.NONE=0]="NONE",lt[lt.QUADRATIC=5]="QUADRATIC",lt[lt.CUBIC=6]="CUBIC",lt[lt.BEZIER=8]="BEZIER",lt);function ph(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let e0=[{code:11,name:"direction",parser:w},{code:10,name:"position",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class fh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){ph(this,"parser",k(e0))}}function mh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ph(fh,"ForEntityName","RAY");let t0=[...Fi("data"),{code:70,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class yh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){mh(this,"parser",k(t0))}}function _h(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}mh(yh,"ForEntityName","REGION");let n0={vertices:[],backLineVertices:[]},r0=[{code:360,name:"geometrySettingHardId",parser:u},{code:12,name:"backLineVertices",isMultiple:!0,parser:w},{code:93,name:"numberOfBackLineVertices",parser:u},{code:11,name:"vertices",isMultiple:!0,parser:w},{code:92,name:"verticesCount",parser:u},{code:[63,411],name:"indicatorColor",parser:u},{code:70,name:"indicatorTransparency",parser:u},{code:41,name:"bottomHeight",parser:u},{code:40,name:"topHeight",parser:u},{code:10,name:"verticalDirection",parser:w},{code:1,name:"name",parser:u},{code:91,name:"flag",parser:u},{code:90,name:"state",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class bh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){_h(this,"parser",k(r0,n0))}}function xh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}_h(bh,"ForEntityName","SECTION");let i0={thickness:0,rotation:0,xScale:1,obliqueAngle:0,extrusionDirection:{x:0,y:0,z:1}},s0=[{code:210,name:"extrusionDirection",parser:w},{code:51,name:"obliqueAngle",parser:u},{code:41,name:"xScale",parser:u},{code:50,name:"rotation",parser:u},{code:2,name:"shapeName",parser:u},{code:40,name:"size",parser:u},{code:10,name:"insertionPoint",parser:w},{code:39,name:"thickness",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class wh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){xh(this,"parser",k(s0,i0))}}function vh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}xh(wh,"ForEntityName","SHAPE");let a0={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},o0=[{code:210,name:"extrusionDirection",parser:w},{code:39,name:"thickness",parser:u},{code:[...Pi(10,14)],name:"points",isMultiple:!0,parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Ph{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){vh(this,"parser",k(o0,a0))}}function Ah(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}vh(Ph,"ForEntityName","SOLID");let l0=[{code:350,name:"historyObjectSoftId",parser:u},{code:100,name:"subclassMarker",parser:u},...Fi("data"),{code:70,name:"version",parser:u},{code:100},...j];class Sh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Ah(this,"parser",k(l0))}}function Lh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Ah(Sh,"ForEntityName","3DSOLID");let c0={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},h0=[{code:11,name:"fitPoints",isMultiple:!0,parser:w},{code:10,name:"controlPoints",isMultiple:!0,parser:w},{code:41,name:"weights",isMultiple:!0,parser:u},{code:40,name:"knots",isMultiple:!0,parser:u},{code:13,name:"endTangent",parser:w},{code:12,name:"startTangent",parser:w},{code:44,name:"fitTolerance",parser:u},{code:43,name:"controlTolerance",parser:u},{code:42,name:"knotTolerance",parser:u},{code:74,name:"numberOfFitPoints",parser:u},{code:73,name:"numberOfControlPoints",parser:u},{code:72,name:"numberOfKnots",parser:u},{code:71,name:"degree",parser:u},{code:70,name:"flag",parser:u},{code:210,name:"normal",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Ih{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Lh(this,"parser",k(h0,c0))}}Lh(Ih,"ForEntityName","SPLINE");(Te={})[Te.NONE=0]="NONE",Te[Te.CLOSED=1]="CLOSED",Te[Te.PERIODIC=2]="PERIODIC",Te[Te.RATIONAL=4]="RATIONAL",Te[Te.PLANAR=8]="PLANAR",Te[Te.LINEAR=16]="LINEAR";function Eh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let d0=[{code:280,name:"shadowMapSoftness",parser:u},{code:71,name:"shadowMapSize",parser:u},{code:70,name:"shadowType",parser:u},{code:292,name:"isSummerTime",parser:O},{code:92,name:"time",parser:u},{code:91,name:"julianDay",parser:u},{code:291,name:"hasShadow",parser:O},{code:40,name:"intensity",parser:u},{code:421,name:"lightColorInstance",parser:u},{code:63,name:"lightColorIndex",parser:u},{code:290,name:"isOn",parser:O},{code:90,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...j.filter(n=>n.code!==100)];class Th{parseEntity(e,t){let r={layer:""};return this.parser(t,e,r),r}constructor(){Eh(this,"parser",k(d0))}}Eh(Th,"ForEntityName","SUN");class zr{parseEntity(e,t){let r={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:r.subclassMarker=t.value,t=e.next();break;case 2:r.name=t.value,t=e.next();break;case 5:r.handle=t.value,t=e.next();break;case 10:r.startPoint=Es(Yt(e)),t=e.lastReadGroup;break;case 11:r.directionVector=Es(Yt(e)),t=e.lastReadGroup;break;case 90:r.tableValue=t.value,t=e.next();break;case 91:r.rowCount=t.value,t=e.next();break;case 92:r.columnCount=t.value,t=e.next();break;case 93:r.overrideFlag=t.value,t=e.next();break;case 94:r.borderColorOverrideFlag=t.value,t=e.next();break;case 95:r.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:r.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:r.rowHeightArr??(r.rowHeightArr=[]),r.rowHeightArr.push(t.value),t=e.next();break;case 142:r.columnWidthArr??(r.columnWidthArr=[]),r.columnWidthArr.push(t.value),t=e.next();break;case 280:r.version=t.value,t=e.next();break;case 310:r.bmpPreview??(r.bmpPreview=""),r.bmpPreview+=t.value,t=e.next();break;case 330:r.ownerBlockRecordSoftId=t.value,t=e.next();break;case 342:r.tableStyleId=t.value,t=e.next();break;case 343:r.blockRecordHandle=t.value,t=e.next();break;case 170:r.attachmentPoint=t.value,t=e.next();break;case 171:r.cells??(r.cells=[]),r.cells.push(function(i,s){let a=!1,o=!1,l={};for(;!i.isEOF()&&s.code!==0&&!o;)switch(s.code){case 171:if(a){o=!0;continue}l.cellType=s.value,a=!0,s=i.next();break;case 172:l.flagValue=s.value,s=i.next();break;case 173:l.mergedValue=s.value,s=i.next();break;case 174:l.autoFit=s.value,s=i.next();break;case 175:l.borderWidth=s.value,s=i.next();break;case 176:l.borderHeight=s.value,s=i.next();break;case 91:l.overrideFlag=s.value,s=i.next();break;case 178:l.virtualEdgeFlag=s.value,s=i.next();break;case 145:l.rotation=s.value,s=i.next();break;case 345:l.fieldObjetId=s.value,s=i.next();break;case 340:l.blockTableRecordId=s.value,s=i.next();break;case 146:l.blockScale=s.value,s=i.next();break;case 177:l.blockAttrNum=s.value,s=i.next();break;case 7:l.textStyle=s.value,s=i.next();break;case 140:l.textHeight=s.value,s=i.next();break;case 170:l.attachmentPoint=s.value,s=i.next();break;case 92:l.extendedCellFlags=s.value,s=i.next();break;case 285:l.rightBorderVisibility=!!(s.value??!0),s=i.next();break;case 286:l.bottomBorderVisibility=!!(s.value??!0),s=i.next();break;case 288:l.leftBorderVisibility=!!(s.value??!0),s=i.next();break;case 289:l.topBorderVisibility=!!(s.value??!0),s=i.next();break;case 301:(function(c,h,d){for(;d.code!==304;)switch(d.code){case 301:case 93:case 90:case 94:d=h.next();break;case 1:c.text=d.value,d=h.next();break;case 300:c.attrText=d.value,d=h.next();break;case 302:c.text=d.value?d.value:c.text,d=h.next();break;default:d=h.next()}})(l,i,s),s=i.next();break;default:return l}return a=!1,o=!1,l}(e,t)),t=e.lastReadGroup;break;default:ap(r,t,e),t=e.next()}}return r}}function Ch(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}(ns="ForEntityName")in zr?Object.defineProperty(zr,ns,{value:"ACAD_TABLE",enumerable:!0,configurable:!0,writable:!0}):zr[ns]="ACAD_TABLE";let u0=[{code:11,name:"xAxisDirection",parser:w},{code:210,name:"extrusionDirection",parser:w},{code:1,name:"text",parser:u},{code:10,name:"position",parser:w},{code:3,name:"styleName",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Mh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Ch(this,"parser",k(u0))}}Ch(Mh,"ForEntityName","TOLERANCE");var g0=((de={})[de.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",de[de.TANGENT_DEFINED=2]="TANGENT_DEFINED",de[de.NOT_USED=4]="NOT_USED",de[de.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",de[de.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",de[de.FOR_POLYLINE=32]="FOR_POLYLINE",de[de.FOR_POLYGON=64]="FOR_POLYGON",de[de.POLYFACE=128]="POLYFACE",de);let p0=[{code:[335,343,344,91],name:"softPointers",isMultiple:!0,parser:u},{code:361,name:"sunId",parser:u},{code:431,name:"ambientLightColorName",parser:u},{code:421,name:"ambientLightColorInstance",parser:u},{code:63,name:"ambientLightColorIndex",parser:u},{code:142,name:"contrast",parser:u},{code:141,name:"brightness",parser:u},{code:282,name:"defaultLightingType",parser:u},{code:292,name:"isDefaultLighting",parser:O},{code:348,name:"visualStyleId",parser:u},{code:333,name:"shadePlotId",parser:u},{code:332,name:"backgroundId",parser:u},{code:61,name:"majorGridFrequency",parser:u},{code:170,name:"shadePlotMode",parser:u},{code:146,name:"elevation",parser:u},{code:79,name:"orthographicType",parser:u},{code:346,name:"ucsBaseId",parser:u},{code:345,name:"ucsId",parser:u},{code:112,name:"ucsYAxis",parser:w},{code:111,name:"ucsXAxis",parser:w},{code:110,name:"ucsOrigin",parser:w},{code:74,name:"iconFlag",parser:u},{code:71,name:"ucsPerViewport",parser:u},{code:281,name:"renderMode",parser:u},{code:1,name:"sheetName",parser:u},{code:340,name:"clippingBoundaryId",parser:u},{code:90,name:"statusBitFlags",parser:u},{code:331,name:"frozenLayerIds",isMultiple:!0,parser:u},{code:72,name:"circleZoomPercent",parser:u},{code:51,name:"viewTwistAngle",parser:u},{code:50,name:"snapAngle",parser:u},{code:45,name:"viewHeight",parser:u},{code:44,name:"backClipZ",parser:u},{code:43,name:"frontClipZ",parser:u},{code:42,name:"perspectiveLensLength",parser:u},{code:17,name:"targetPoint",parser:w},{code:16,name:"viewDirection",parser:w},{code:15,name:"gridSpacing",parser:w},{code:14,name:"snapSpacing",parser:w},{code:13,name:"snapBase",parser:w},{code:12,name:"displayCenter",parser:w},{code:69,name:"viewportId",parser:u},{code:68,name:"status",parser:u},{code:41,name:"height",parser:u},{code:40,name:"width",parser:u},{code:10,name:"viewportCenter",parser:w},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...j];class jr{parseEntity(e,t){let r={};return k(p0)(t,e,r),r}}function Oh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}(rs="ForEntityName")in jr?Object.defineProperty(jr,rs,{value:"VIEWPORT",enumerable:!0,configurable:!0,writable:!0}):jr[rs]="VIEWPORT";let f0={brightness:50,constrast:50,fade:0},m0=[{code:14,name:"boundary",isMultiple:!0,parser:w},{code:91,name:"numberOfVertices",parser:u},{code:71,name:"boundaryType",parser:u},{code:360,name:"imageDefReactorHardId",parser:u},{code:283,name:"fade",parser:u},{code:282,name:"contrast",parser:u},{code:281,name:"brightness",parser:u},{code:280,name:"isClipping",parser:O},{code:70,name:"displayFlag",parser:u},{code:340,name:"imageDefHardId",parser:u},{code:13,name:"imageSize",parser:w},{code:12,name:"vDirection",parser:w},{code:11,name:"uDirection",parser:w},{code:10,name:"position",parser:w},{code:90,name:"classVersion",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class kh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Oh(this,"parser",k(m0,f0))}}Oh(kh,"ForEntityName","WIPEOUT");(ct={})[ct.ShowImage=1]="ShowImage",ct[ct.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",ct[ct.UseClippingBoundary=4]="UseClippingBoundary",ct[ct.Transparency=8]="Transparency";function Nh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let y0=[{code:11,name:"direction",parser:w},{code:10,name:"position",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Yh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Nh(this,"parser",k(y0))}}Nh(Yh,"ForEntityName","XLINE");let _0=0;function Xh(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=_0++)}let b0=Object.fromEntries([Ac,Fr,Mc,Yc,Rc,Fc,Br,Vc,jc,$c,Kc,Qc,eh,nh,Vr,ih,ah,kc,lh,hh,gh,fh,yh,bh,wh,Ph,Sh,Ih,Th,zr,Tc,Mh,Wc,oa,jr,kh,Yh].map(n=>[n.ForEntityName,new n]));function Rh(n,e){let t=[];for(;!X(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){e.rewind();break}let r=b0[n.value];if(r){let i=n.value;n=e.next();let s=r.parseEntity(e,n);s.type=i,Xh(s),t.push(s)}else e.debug}n=e.next()}return t}function x0(n,e){let t=null,r={};for(;!X(n,0,"EOF")&&!X(n,0,"ENDSEC");)n.code===9?t=typeof n.value=="string"?n.value:null:t!=null&&(n.code===10?r[t]=Yt(e):r[t]=n.value),n=e.next();return r}let vt=[{code:100,name:"subclassMarker",parser:u},{code:330,name:"ownerObjectId",parser:u},{code:102,isMultiple:!0,parser(n,e){for(;!X(n,0,"EOF")&&!X(n,102,"}");)n=e.next()}},{code:5,name:"handle",parser:u}],w0=[{code:70,name:"flag",parser:u},{code:2,name:"appName",parser:u},{code:100,name:"subclassMarker",parser:u},...vt],v0=k(w0),P0=k([{code:310,name:"bmpPreview",parser:u},{code:281,name:"scalability",parser:u},{code:280,name:"explodability",parser:u},{code:70,name:"insertionUnits",parser:u},{code:340,name:"layoutObjects",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),A0=k([...aa.map(n=>({...n,parser:u})),{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},{code:105,name:"handle",parser:u},...vt.filter(n=>n.code!==5)]),S0=k([{code:347,name:"materialObjectId",parser:u},{code:390,name:"plotStyleNameObjectId",parser:u},{code:370,name:"lineweight",parser:u},{code:290,name:"isPlotting",parser:O},{code:6,name:"lineType",parser:u},{code:62,name:"colorIndex",parser:u},{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),L0=k([{code:9,name:"text",parser:u},{code:45,name:"offsetY",parser:u},{code:44,name:"offsetX",parser:u},{code:50,name:"rotation",parser:u},{code:46,name:"scale",parser:u},{code:340,name:"styleObjectId",parser:u},{code:75,name:"shapeNumber",parser:u},{code:74,name:"elementTypeFlag",parser:u},{code:49,name:"elementLength",parser:u}],{elementTypeFlag:0,elementLength:0}),I0=k([{code:49,name:"pattern",parser(n,e){let t={};return L0(n,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:u},{code:73,name:"numberOfLineTypes",parser:u},{code:72,parser:u},{code:3,name:"description",parser:u},{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),E0=k([{code:1e3,name:"extendedFont",parser:u},{code:1001},{code:4,name:"bigFont",parser:u},{code:3,name:"font",parser:u},{code:42,name:"lastHeight",parser:u},{code:71,name:"textGenerationFlag",parser:u},{code:50,name:"obliqueAngle",parser:u},{code:41,name:"widthFactor",parser:u},{code:40,name:"fixedTextHeight",parser:u},{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),T0=[{code:13,name:"orthographicOrigin",parser:w},{code:71,name:"orthographicType",parser:u},{code:346,name:"baseUcsHandle",parser:u},{code:146,name:"elevation",parser:u},{code:79,name:"isOrthographic",parser:O},{code:12,name:"yAxis",parser:w},{code:11,name:"xAxis",parser:w},{code:10,name:"origin",parser:w},{code:70,name:"flag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt],C0=k(T0),M0=[{code:346,name:"baseUcsId",parser:u},{code:345,name:"ucsId",parser:u},{code:146,name:"elevation",parser:u},{code:79,name:"orthographicType",parser:u},{code:112,name:"ucsYAxis",parser:w},{code:111,name:"ucsXAxis",parser:w},{code:110,name:"ucsOrigin",parser:w},{code:361,name:"sunHardId",parser:u},{code:348,name:"styleHardId",parser:u},{code:334,name:"liveSectionSoftId",parser:u},{code:332,name:"backgroundSoftId",parser:u},{code:73,name:"isPlottable",parser:O},{code:72,name:"isUcsAssociated",parser:O},{code:281,name:"renderMode",parser:u},{code:71,name:"viewMode",parser:u},{code:50,name:"twistAngle",parser:u},{code:44,name:"backClippingPlane",parser:u},{code:43,name:"frontClippingPlane",parser:u},{code:42,name:"lensLength",parser:u},{code:12,name:"target",parser:w},{code:11,name:"direction",parser:w},{code:10,name:"center",parser:w},{code:41,name:"width",parser:u},{code:40,name:"height",parser:u},{code:70,name:"flag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt],O0=k(M0),k0=k([{code:[63,421,431],name:"ambientColor",parser:u},{code:142,name:"contrast",parser:u},{code:141,name:"brightness",parser:u},{code:282,name:"defaultLightingType",parser:u},{code:292,name:"isDefaultLightingOn",parser:O},{code:348,name:"visualStyleObjectId",parser:u},{code:333,name:"shadePlotObjectId",parser:u},{code:332,name:"backgroundObjectId",parser:u},{code:61,name:"majorGridLines",parser:u},{code:170,name:"shadePlotSetting",parser:u},{code:146,name:"elevation",parser:u},{code:79,name:"orthographicType",parser:u},{code:112,name:"ucsYAxis",parser:w},{code:111,name:"ucsXAxis",parser:w},{code:110,name:"ucsOrigin",parser:w},{code:74,name:"ucsIconSetting",parser:u},{code:71,name:"viewMode",parser:u},{code:281,name:"renderMode",parser:u},{code:1,name:"styleSheet",parser:u},{code:[331,441],name:"frozenLayers",parser:u,isMultiple:!0},{code:72,name:"circleSides",parser:u},{code:51,name:"viewTwistAngle",parser:u},{code:50,name:"snapRotationAngle",parser:u},{code:45,name:"viewHeight",parser:u},{code:44,name:"backClippingPlane",parser:u},{code:43,name:"frontClippingPlane",parser:u},{code:42,name:"lensLength",parser:u},{code:17,name:"viewTarget",parser:w},{code:16,name:"viewDirectionFromTarget",parser:w},{code:15,name:"gridSpacing",parser:w},{code:14,name:"snapSpacing",parser:w},{code:13,name:"snapBasePoint",parser:w},{code:12,name:"center",parser:w},{code:11,name:"upperRightCorner",parser:w},{code:10,name:"lowerLeftCorner",parser:w},{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),N0={APPID:v0,BLOCK_RECORD:P0,DIMSTYLE:A0,LAYER:S0,LTYPE:I0,STYLE:E0,UCS:C0,VIEW:O0,VPORT:k0},Y0=k([{code:70,name:"maxNumberOfEntries",parser:u},{code:100,name:"subclassMarker",parser:u},{code:330,name:"ownerObjectId",parser:u},{code:102,parser:qe},{code:102,parser:qe},{code:102,parser:qe},{code:360,isMultiple:!0},{code:5,name:"handle",parser:u},{code:2,name:"name",parser:u}]);function X0(n,e){var r;let t={};for(;!X(n,0,"EOF")&&!X(n,0,"ENDSEC");){if(X(n,0,"TABLE")){n=e.next();let i={entries:[]};Y0(n,e,i),t[i.name]=i}if(X(n,0)&&!X(n,0,"ENDTAB")){let i=n.value;n=e.next();let s=N0[i];if(!s){e.debug,n=e.next();continue}let a={};s(n,e,a),i==="VPORT"&&(a.lowerLeftCorner==null&&(a.lowerLeftCorner={x:0,y:0}),a.upperRightCorner==null&&(a.upperRightCorner={x:1,y:1}),a.center==null&&(a.center={x:0,y:0}),a.snapBasePoint==null&&(a.snapBasePoint={x:0,y:0}),a.snapSpacing==null&&(a.snapSpacing={x:0,y:0}),a.gridSpacing==null&&(a.gridSpacing={x:0,y:0}),a.viewDirectionFromTarget==null&&(a.viewDirectionFromTarget={x:0,y:0,z:1}),a.viewTarget==null&&(a.viewTarget={x:0,y:0,z:0})),(r=t[i])==null||r.entries.push(a)}n=e.next()}return t}function R0(n,e){let t={};for(;!X(n,0,"EOF")&&!X(n,0,"ENDSEC");){if(X(n,0,"BLOCK")){let r=B0(n=e.next(),e);Xh(r),r.name&&(t[r.name]=r)}n=e.next()}return t}function B0(n,e){let t={};for(;!X(n,0,"EOF");){if(X(n,0,"ENDBLK")){for(n=e.next();!X(n,0,"EOF");){if(X(n,100,"AcDbBlockEnd"))return t;n=e.next()}break}switch(n.code){case 1:t.xrefPath=n.value;break;case 2:t.name=n.value;break;case 3:t.name2=n.value;break;case 5:t.handle=n.value;break;case 8:t.layer=n.value;break;case 10:t.position=Yt(e);break;case 67:t.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(t.type=n.value);break;case 100:break;case 330:t.ownerHandle=n.value;break;case 0:t.entities=Rh(n,e)}n=e.next()}return t}let Pt=[{code:330,name:"ownerObjectId",parser:u},{code:102,parser:qe},{code:102,parser:qe},{code:102,parser:qe},{code:5,name:"handle",parser:u}],Bh=[{code:333,name:"shadePlotId",parser:u},{code:149,name:"imageOriginY",parser:u},{code:148,name:"imageOriginX",parser:u},{code:147,name:"scaleFactor",parser:u},{code:78,name:"shadePlotCustomDPI",parser:u},{code:77,name:"shadePlotResolution",parser:u},{code:76,name:"shadePlotMode",parser:u},{code:75,name:"standardScaleType",parser:u},{code:7,name:"currentStyleSheet",parser:u},{code:74,name:"plotType",parser:u},{code:73,name:"plotRotation",parser:u},{code:72,name:"plotPaperUnit",parser:u},{code:70,name:"layoutFlag",parser:u},{code:143,name:"printScaleDenominator",parser:u},{code:142,name:"printScaleNumerator",parser:u},{code:141,name:"windowAreaYMax",parser:u},{code:140,name:"windowAreaXMax",parser:u},{code:49,name:"windowAreaYMin",parser:u},{code:48,name:"windowAreaXMin",parser:u},{code:47,name:"plotOriginY",parser:u},{code:46,name:"plotOriginX",parser:u},{code:45,name:"paperHeight",parser:u},{code:44,name:"paperWidth",parser:u},{code:43,name:"marginTop",parser:u},{code:42,name:"marginRight",parser:u},{code:41,name:"marginBottom",parser:u},{code:40,name:"marginLeft",parser:u},{code:6,name:"plotViewName",parser:u},{code:4,name:"paperSize",parser:u},{code:2,name:"configName",parser:u},{code:1,name:"pageSetupName",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt],F0=[{code:346,name:"orthographicUcsId",parser:u},{code:345,name:"namedUcsId",parser:u},{code:331,name:"viewportId",parser:u},{code:330,name:"paperSpaceTableId",parser:u},{code:76,name:"orthographicType",parser:u},{code:17,name:"ucsYAxis",parser:w},{code:16,name:"ucsXAxis",parser:w},{code:13,name:"ucsOrigin",parser:w},{code:146,name:"elevation",parser:u},{code:15,name:"maxExtent",parser:w},{code:14,name:"minExtent",parser:w},{code:12,name:"insertionPoint",parser:w},{code:11,name:"maxLimit",parser:w},{code:10,name:"minLimit",parser:w},{code:71,name:"tabOrder",parser:u},{code:70,name:"controlFlag",parser:u},{code:1,name:"layoutName",parser:u},{code:100,name:"subclassMarker",parser:u},...Bh],D0=[{code:3,name:"entries",parser:(n,e)=>{let t={name:n.value};return(n=e.next()).code===350?t.objectSoftId=n.value:n.code===360?t.objectHardId=n.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:u},{code:280,name:"isHardOwned",parser:O},{code:100,name:"subclassMarker",parser:u},...Pt],V0=[{code:40,name:"wcsToOCSTransform",parser:mo},{code:40,name:"ocsToWCSTransform",parser:mo},{code:41,name:"backClippingDistance",parser:u},{code:73,name:"isBackClipping",parser:O,pushContext:!0},{code:40,name:"frontClippingDistance",parser:u},{code:72,name:"isFrontClipping",parser:O,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:O},{code:11,name:"position",parser:w},{code:210,name:"normal",parser:w},{code:10,name:"boundaryVertices",parser:w,isMultiple:!0},{code:70,name:"boundaryCount",parser:u},{code:100,name:"subclassMarker",parser:u},{code:100},...Pt];function mo(n,e){let t=[];for(let r=0;r<3&&X(n,40);++r){let i=[];for(let s=0;s<4&&X(n,40);++s)i.push(n.value),n=e.next();t.push(i)}return e.rewind(),t}let z0=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:u},{code:90,name:"version",parser:u},{code:1,name:"fileName",parser:u},{code:10,name:"size",parser:w},{code:11,name:"sizeOfOnePixel",parser:w},{code:280,name:"isLoaded",parser:u},{code:281,name:"resolutionUnits",parser:u},{code:100,name:"subclassMarker",parser:u}],j0=[{code:179,name:"unknown1",parser:u},{code:170,name:"contentType",parser:u},{code:171,name:"drawMLeaderOrderType",parser:u},{code:172,name:"drawLeaderOrderType",parser:u},{code:90,name:"maxLeaderSegmentPoints",parser:u},{code:40,name:"firstSegmentAngleConstraint",parser:u},{code:41,name:"secondSegmentAngleConstraint",parser:u},{code:173,name:"leaderLineType",parser:u},{code:91,name:"leaderLineColor",parser:u},{code:340,name:"leaderLineTypeId",parser:u},{code:92,name:"leaderLineWeight",parser:u},{code:290,name:"landingEnabled",parser:O},{code:42,name:"landingGap",parser:u},{code:291,name:"doglegEnabled",parser:O},{code:43,name:"doglegLength",parser:u},{code:3,name:"description",parser:u},{code:341,name:"arrowheadId",parser:u},{code:44,name:"arrowheadSize",parser:u},{code:300,name:"defaultMTextContents",parser:u},{code:342,name:"textStyleId",parser:u},{code:174,name:"textLeftAttachmentType",parser:u},{code:175,name:"textAngleType",parser:u},{code:176,name:"textAlignmentType",parser:u},{code:178,name:"textRightAttachmentType",parser:u},{code:93,name:"textColor",parser:u},{code:45,name:"textHeight",parser:u},{code:292,name:"textFrameEnabled",parser:O},{code:297,name:"textAlignAlwaysLeft",parser:O},{code:46,name:"alignSpace",parser:u},{code:343,name:"blockContentId",parser:u},{code:94,name:"blockContentColor",parser:u},{code:47,name:"blockContentScale.x",parser:u},{code:49,name:"blockContentScale.y",parser:u},{code:140,name:"blockContentScale.z",parser:u},{code:293,name:"blockContentScaleEnabled",parser:O},{code:141,name:"blockContentRotation",parser:u},{code:294,name:"blockContentRotationEnabled",parser:O},{code:177,name:"blockContentConnectionType",parser:u},{code:142,name:"scale",parser:u},{code:295,name:"overwritePropertyValue",parser:O},{code:296,name:"annotative",parser:O},{code:143,name:"breakGapSize",parser:u},{code:271,name:"textAttachmentDirection",parser:u},{code:272,name:"bottomTextAttachmentDirection",parser:u},{code:273,name:"topTextAttachmentDirection",parser:u},{code:298,name:"unknown2",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt];function Nr(n,e,t){n.elements||(n.elements=[]);let r=n.elements.find(i=>i[e]===void 0);if(r){r[e]=t;return}n.elements.push({[e]:t})}let G0=[{code:6,parser:function({value:n},e,t){Nr(t,"lineType",n)},isMultiple:!0},{code:62,parser:function({value:n},e,t){var r;if(t.fillColorIndex===void 0&&!((r=t.elements)!=null&&r.length)){t.fillColorIndex=n;return}Nr(t,"colorIndex",n)},isMultiple:!0},{code:420,parser:function({value:n},e,t){var r;if(t.fillColor===void 0&&!((r=t.elements)!=null&&r.length)){t.fillColor=n;return}Nr(t,"color",n)},isMultiple:!0},{code:49,parser:function({value:n},e,t){Nr(t,"offset",n)},isMultiple:!0},{code:71,name:"elementCount",parser:u},{code:52,name:"endAngle",parser:u},{code:51,name:"startAngle",parser:u},{code:3,name:"description",parser:u},{code:70,name:"flags",parser:u},{code:2,name:"styleName",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt],H0=[{code:340,name:"entityIds",parser:u,isMultiple:!0},{code:71,name:"isSelectable",parser:O},{code:70,name:"isUnnamed",parser:O},{code:300,name:"description",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt],W0=[{code:8,name:"layerNames",parser:u,isMultiple:!0},{code:100,name:"subclassMarker",parser:u},{code:100,name:"filterSubclassMarker",parser:u},...Pt],U0=[{code:90,name:"idBufferEntryCounts",parser:u,isMultiple:!0},{code:360,name:"idBufferIds",parser:u,isMultiple:!0},{code:8,name:"layerNames",parser:u,isMultiple:!0},{code:100,name:"subclassMarker",parser:u},{code:40,name:"timeStamp",parser:u},{code:100,name:"indexSubclassMarker",parser:u},...Pt],$0=[{code:75,name:"hasLastPointRef",parser:O},{code:1,name:"pointRefs",parser:function(n,e){let t={className:n.value};for(;;)switch((n=e.next()).code){case 72:t.objectOsnapType=n.value;continue;case 331:t.mainObjectId=n.value;continue;case 73:t.mainObjectSubentityType=n.value;continue;case 91:t.mainObjectGsMarker=n.value;continue;case 301:t.mainObjectXrefHandle=n.value;continue;case 40:t.nearOsnapGeometryParameter=n.value;continue;case 10:{let r=w(n,e);t.osnapPoint="z"in r?r:{...r,z:0}}continue;case 332:t.intersectionObjectId=n.value;continue;case 74:t.intersectionObjectSubentityType=n.value;continue;case 92:t.intersectionObjectGsMarker=n.value;continue;case 302:t.intersectionObjectXrefHandle=n.value;continue;default:return e.rewind(),t}},isMultiple:!0},{code:71,name:"rotatedDimensionType",parser:u},{code:70,name:"transSpaceFlag",parser:O},{code:90,name:"associativityFlag",parser:u},{code:330,name:"dimensionObjectId",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt],q0={LAYOUT:F0,PLOTSETTINGS:Bh,DICTIONARY:D0,SPATIAL_FILTER:V0,IMAGEDEF:z0,MLEADERSTYLE:j0,MLINESTYLE:G0,GROUP:H0,LAYER_FILTER:W0,LAYER_INDEX:U0,DIMASSOC:$0};function K0(n,e){let t=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let r=n.value,i=q0[r];if(n.code===0&&(i!=null&&i.length)){let s=k(i),a={name:r};s(n=e.next(),e,a)?(t.push(a),n=e.peek()):n=e.next()}else n=e.next()}return{byName:np(t,({name:r})=>r)}}function yo(n){if((n.charCodeAt(0)===65279?n.slice(1):n).startsWith("AutoCAD Binary DXF"))throw Error("Binary DXF is not supported. Re-save the drawing as ASCII (text) DXF from your CAD application.")}function tr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class Z0{constructor(){tr(this,"encoding","utf-8"),tr(this,"encodingFailureFatal",!1),tr(this,"thumbnailImageFormat","base64")}}class Q0 extends EventTarget{parseSync(e,t=!1){yo(e);let r=new go(e.split(/\r\n|\r|\n/g),t);if(!r.hasNext())throw Error("Empty file");return this.parseAll(r)}parseStream(e){let t="",r=this;return new Promise((i,s)=>{e.on("data",a=>{t+=a}),e.on("end",()=>{try{yo(t);let a=t.split(/\r\n|\r|\n/g),o=new go(a);if(!o.hasNext())throw Error("Empty file");i(r.parseAll(o))}catch(a){s(a)}}),e.on("error",a=>{s(a)})})}async parseFromUrl(e,t){let r=await fetch(e,t);if(!r.body)return null;let i=r.body.getReader(),s="";for(;;){let{done:a,value:o}=await i.read();if(a){s+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}s+=this._decoder.decode(o,{stream:!0})}return this.parseSync(s)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},r=e.next();for(;!X(r,0,"EOF");)X(r,0,"SECTION")&&(X(r=e.next(),2,"HEADER")?t.header=x0(r=e.next(),e):X(r,2,"CLASSES")?Vg(r=e.next(),e,t):X(r,2,"BLOCKS")?t.blocks=R0(r=e.next(),e):X(r,2,"ENTITIES")?t.entities=Rh(r=e.next(),e):X(r,2,"TABLES")?t.tables=X0(r=e.next(),e):X(r,2,"OBJECTS")?t.objects=K0(r=e.next(),e):X(r,2,"THUMBNAILIMAGE")&&(t.thumbnailImage=function(i,s,a="base64"){let o,l="",c=0;for(;!X(i,0,"EOF")&&!X(i,0,"ENDSEC");)i.code===90?c=i.value:i.code===310&&(l+=i.value),i=s.next();if(a==="hex")o=l;else{let h=function(d){let p=d.length/2,g=new Uint8Array(p);for(let f=0;f<p;f++)g[f]=parseInt(d.substr(2*f,2),16);return g}(l);o=a==="buffer"?h:function(d){let p="";for(let g=0;g<d.length;g++)p+=String.fromCharCode(d[g]);return btoa(p)}(h)}return{size:c,data:o}}(r=e.next(),e,this._options.thumbnailImageFormat))),r=e.next();return t}constructor(e={}){super(),tr(this,"_decoder",void 0),tr(this,"_options",void 0);let t=new Z0;this._options=Object.assign(t,e),this._decoder=new TextDecoder(this._options.encoding,{fatal:this._options.encodingFailureFatal})}}(Ce={})[Ce.NOT_APPLICABLE=0]="NOT_APPLICABLE",Ce[Ce.KEEP_EXISTING=1]="KEEP_EXISTING",Ce[Ce.USE_CLONE=2]="USE_CLONE",Ce[Ce.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",Ce[Ce.VALUE_NAME=4]="VALUE_NAME",Ce[Ce.UNMANGLE_NAME=5]="UNMANGLE_NAME";(Qt={})[Qt.NOUNIT=0]="NOUNIT",Qt[Qt.CENTIMETERS=2]="CENTIMETERS",Qt[Qt.INCH=5]="INCH";(Hn={})[Hn.PSLTSCALE=1]="PSLTSCALE",Hn[Hn.LIMCHECK=2]="LIMCHECK";(Jt={})[Jt.INCHES=0]="INCHES",Jt[Jt.MILLIMETERS=1]="MILLIMETERS",Jt[Jt.PIXELS=2]="PIXELS";(Me={})[Me.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",Me[Me.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",Me[Me.DRAWING_LIMITS=2]="DRAWING_LIMITS",Me[Me.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",Me[Me.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",Me[Me.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(ht={})[ht.AS_DISPLAYED=0]="AS_DISPLAYED",ht[ht.WIREFRAME=1]="WIREFRAME",ht[ht.HIDDEN=2]="HIDDEN",ht[ht.RENDERED=3]="RENDERED";(Oe={})[Oe.DRAFT=0]="DRAFT",Oe[Oe.PREVIEW=1]="PREVIEW",Oe[Oe.NORMAL=2]="NORMAL",Oe[Oe.PRESENTATION=3]="PRESENTATION",Oe[Oe.MAXIMUM=4]="MAXIMUM",Oe[Oe.CUSTOM=5]="CUSTOM";(dt={})[dt.NONE=0]="NONE",dt[dt.AbsoluteRotation=1]="AbsoluteRotation",dt[dt.TextEmbedded=2]="TextEmbedded",dt[dt.ShapeEmbedded=4]="ShapeEmbedded";(is={})[is.PaperSpace=1]="PaperSpace";(en={})[en.XrefDependent=16]="XrefDependent",en[en.XrefResolved=32]="XrefResolved",en[en.Referenced=64]="Referenced";(ke={})[ke.Off=0]="Off",ke[ke.Perspective=1]="Perspective",ke[ke.ClipFront=2]="ClipFront",ke[ke.ClipBack=4]="ClipBack",ke[ke.UcsFollow=8]="UcsFollow",ke[ke.ClipFrontByFrontZ=16]="ClipFrontByFrontZ";class J0{parse(e){const t=new Q0,r=this.getDxfInfoFromBuffer(e);let i="";return r.version&&r.version.value<=23&&r.encoding?i=new TextDecoder(r.encoding).decode(e):i=new TextDecoder().decode(e),t.parseSync(i)}getDxfInfoFromBuffer(e){var c,h,d;const r=new TextDecoder("utf-8");let i=0,s="",a=null,o=null,l=!1;for(;i<e.byteLength;){const p=Math.min(i+65536,e.byteLength),g=e.slice(i,p);i=p;const m=(s+r.decode(g,{stream:!0})).split(/\r?\n/);s=m.pop()??"";for(let y=0;y<m.length;y++){const _=m[y].trim();if(_==="SECTION"&&((c=m[y+2])==null?void 0:c.trim())==="HEADER")l=!0;else if(_==="ENDSEC"&&l)return{version:a,encoding:o};if(l&&_==="$ACADVER"){const P=(h=m[y+2])==null?void 0:h.trim();P&&(a=new Ye(P))}else if(l&&_==="$DWGCODEPAGE"){const P=(d=m[y+2])==null?void 0:d.trim();if(P){const L=$s[P];o=Cl(L)}}if(a&&o)return{version:a,encoding:o}}}return{version:a,encoding:o}}}class _o{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="3DFACE"?this.convertFace(e):e.type=="ARC"?this.convertArc(e):e.type=="ATTDEF"?this.convertAttributeDefinition(e):e.type=="ATTRIB"?this.convertAttribute(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="LWPOLYLINE"?this.convertLWPolyline(e):e.type=="MTEXT"?this.convertMText(e):e.type=="MLINE"?this.convertMLine(e):e.type=="MULTILEADER"||e.type=="MLEADER"?this.convertMLeader(e):e.type=="POLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SHAPE"?this.convertShape(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertFace(e){const t=new ni;return e.vertices.forEach((r,i)=>t.setVertexAt(i,r)),t}convertArc(e){const t=e.extrusionDirection??x.Z_AXIS;return new Zr(hs(e.center,t),e.radius,T.degToRad(e.startAngle),T.degToRad(e.endAngle),t)}convertAttributeCommon(e,t){t.textString=e.text,t.height=e.textHeight,t.position.copy(e.startPoint);const r=e.alignmentPoint,i=!r||r.x===0&&r.y===0&&(r.z??0)===0;r&&!i?t.alignmentPoint.copy(r):t.alignmentPoint.copy(e.startPoint),t.rotation=e.rotation,t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.tag=e.tag,t.fieldLength=0,t.isInvisible=(e.attributeFlag&ae.Invisible)!==0,t.isConst=(e.attributeFlag&ae.Const)!==0,t.isVerifiable=(e.attributeFlag&ae.Verifiable)!==0,t.isPreset=(e.attributeFlag&ae.Preset)!==0,t.isReallyLocked=!!e.isReallyLocked,t.isMTextAttribute=(e.mtextFlag&Ue.MultiLine)!==0,t.isConstMTextAttribute=(e.mtextFlag&Ue.ConstMultiLine)!==0}convertAttribute(e){const t=new Jr;return this.convertAttributeCommon(e,t),t.styleName=e.textStyle,t.horizontalMode=e.horizontalJustification,t.verticalMode=e.verticalJustification,t.widthFactor=e.scale??1,t.lockPositionInBlock=e.lockPositionFlag,t}convertAttributeDefinition(e){const t=new Qr;return this.convertAttributeCommon(e,t),t.styleName=e.styleName,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t.prompt=e.prompt,t}convertCirle(e){const t=e.extrusionDirection??x.Z_AXIS;return new ei(hs(e.center,t),e.radius,t)}convertEllipse(e){const t=new x(e.majorAxisEndPoint),r=t.length();return new ti(e.center,e.extrusionDirection??x.Z_AXIS,t,r,r*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,r=e.endPoint;return new or(new b(t.x,t.y,t.z||0),new b(r.x,r.y,r.z||0))}convertSpline(e){try{if(e.numberOfControlPoints>0&&e.numberOfKnots>0)return new cr(e.controlPoints,e.knots,e.weights,e.degree,!!(e.flag&1));if(e.numberOfFitPoints>0)return new cr(e.fitPoints,"Uniform",e.degree,!!(e.flag&1))}catch{}return null}convertPoint(e){const t=new li;return t.position=e.position,t}convertShape(e){const t=new hi;return t.position.copy(e.insertionPoint),t.size=e.size,t.name=e.shapeName,t.rotation=T.degToRad(e.rotation||0),t.widthFactor=e.xScale??1,t.oblique=T.degToRad(e.obliqueAngle||0),t.thickness=e.thickness??0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}convertSolid(e){const t=new oi;return e.points.forEach((r,i)=>t.setPointAt(i,r)),t.thickness=e.thickness,t}convertPolyline(e){var h;const t=!!(e.flag&1),r=!!(e.flag&8),i=!!(e.flag&16),s=!!(e.flag&64),a=!!(e.flag&32),o=[],l=[],c=[];if((h=e.vertices)==null||h.map(d=>{d.flag&g0.SPLINE_CONTROL_POINT||(s&&d.flag&128?d.flag&64?(o.push({x:d.x,y:d.y,z:d.z}),l.push(d.bulge??0)):d.faces&&d.faces.length>=3&&c.push([...d.faces]):(o.push({x:d.x,y:d.y,z:d.z}),l.push(d.bulge??0)))}),i){const d=e.meshMVertexCount,p=e.meshNVertexCount;return new pi(d,p,o,t,a)}else{if(s)return new fi(o,c);if(r){let d=Qn.SimplePoly;return e.flag&4&&(e.smoothType==kr.CUBIC?d=Qn.CubicSplinePoly:e.smoothType==kr.QUADRATIC&&(d=Qn.QuadSplinePoly)),new Kr(d,o,t)}else{let d=yn.SimplePoly;return e.flag&2?d=yn.FitCurvePoly:e.flag&4&&(e.smoothType==kr.CUBIC?d=yn.CubicSplinePoly:e.smoothType==kr.QUADRATIC&&(d=yn.QuadSplinePoly)),new qr(d,o,0,t,e.startWidth,e.endWidth,l)}}}convertLWPolyline(e){var i;const t=new Ae;t.closed=!!(e.flag&1);const r=e.constantWidth??-1;return(i=e.vertices)==null||i.forEach((s,a)=>{t.addVertexAt(a,new E(s.x,s.y),s.bulge,s.startWidth??r,s.endWidth??r)}),t}convertHatch(e){var i;const t=new ar;if((i=e.definitionLines)==null||i.forEach(s=>{t.definitionLines.push({angle:T.degToRad(s.angle||0),base:s.base,offset:s.offset,dashLengths:s.numberOfDashLengths>0?s.dashLengths:[]})}),t.isSolidFill=e.solidFill==kg.SolidFill,t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:T.degToRad(e.patternAngle),t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(s=>{if(s.boundaryPathTypeFlag&2){const o=s,l=new ee;l.closed=o.isClosed,o.vertices.forEach((c,h)=>{l.addVertexAt(h,{x:c.x,y:c.y,bulge:c.bulge})}),t.add(l)}else{const o=s,l=[];o.edges.forEach(h=>{if(h.type==1){const d=h;l.push(new _t(d.start,d.end))}else if(h.type==2){const d=h;l.push(new Re(d.center,d.radius,T.degToRad(d.startAngle||0),T.degToRad(d.endAngle||0),!d.isCCW))}else if(h.type==3){const d=h;new Z().subVectors(d.end,d.center);const g=Math.sqrt(Math.pow(d.end.x,2)+Math.pow(d.end.y,2)),f=g*d.lengthOfMinorAxis;let m=T.degToRad(d.startAngle||0),y=T.degToRad(d.endAngle||0);const _=Math.atan2(d.end.y,d.end.x);d.isCCW||(m=Math.PI*2-m,y=Math.PI*2-y),l.push(new An({...d.center,z:0},g,f,m,y,!d.isCCW,_))}else if(h.type==4){const d=h;if(d.numberOfControlPoints>0&&d.numberOfKnots>0){const p=d.controlPoints.map(m=>({x:m.x,y:m.y,z:0}));let g=!0;const f=d.controlPoints.map(m=>(m.weight==null&&(g=!1),m.weight||1));l.push(new $e(p,d.knots,g?f:void 0))}else if(d.numberOfFitData>0){const p=d.fitDatum.map(g=>({x:g.x,y:g.y,z:0}));l.push(new $e(p,"Uniform"))}}});const c=ir.buildFromEdges(l);c.length==0&&l.length>0?t.add(new ir(l)):c.forEach(h=>t.add(h))}}),e.gradientFlag){const s=e;if(t.hatchObjectType=Ks.GradientObject,t.gradientName=s.gradientName,t.gradientAngle=s.gradientRotation??0,t.gradientShift=s.gradientDefinition??0,t.gradientOneColorMode=s.gradientColorFlag==1,t.shadeTintValue=s.colorTint??0,s.gradientColors){const a=s.gradientColors.length;a>1?(t.gradientStartColor=s.gradientColors[0].rgb,t.gradientEndColor=s.gradientColors[1].rgb):a>0&&(t.gradientStartColor=s.gradientColors[0].rgb)}}return t}convertTable(e){const t=new ai(e.name,e.rowCount,e.columnCount);return t.tableDataVersion=e.version,t.tableStyleId=e.tableStyleId,t.owningBlockRecordId=e.blockRecordHandle,e.directionVector&&(t.horizontalDirection=new x(e.directionVector)),t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),t.tableValueFlag=e.tableValue,t.tableOverrideFlag=e.overrideFlag,t.borderColorOverrideFlag=e.borderColorOverrideFlag,t.borderLineweightOverrideFlag=e.borderLineWeightOverrideFlag,t.borderVisibilityOverrideFlag=e.borderVisibilityOverrideFlag,e.columnWidthArr.forEach((r,i)=>t.setColumnWidth(i,r)),e.rowHeightArr.forEach((r,i)=>t.setRowHeight(i,r)),e.cells.forEach((r,i)=>{t.setCell(i,r)}),t}convertText(e){const t=new Sn;t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint);const r=e.endPoint,i=!r||r.x===0&&r.y===0&&(r.z??0)===0;return r&&!i?t.alignmentPoint.copy(r):t.alignmentPoint.copy(e.startPoint),t.rotation=T.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new lr;return t.contents=e.text,e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=T.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new x(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){var r;const t=new ri;return(r=e.vertices)==null||r.forEach(i=>{t.appendVertex(i)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isHookLineSameDirection=e.isHooklineSameDirection,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName??"",t.annoType=e.leaderCreationFlag,t.textHeight=e.textHeight??0,t.textWidth=e.textWidth??0,t.byBlockColor=e.byBlockColor,t.associatedAnnotation=e.associatedAnnotation??"",e.normal&&(t.normal=e.normal),e.horizontalDirection&&(t.horizontalDirection=e.horizontalDirection),e.offsetFromBlock&&(t.offsetFromBlock=e.offsetFromBlock),e.offsetFromAnnotation&&(t.offsetFromAnnotation=e.offsetFromAnnotation),t}convertMLine(e){const t=new ii;return t.styleName=e.name||"STANDARD",t.styleObjectHandle=e.styleObjectHandle,t.scale=e.scale,t.justification=e.justification,t.flags=e.flags,t.styleCount=e.styleCount,t.startPosition=e.startPosition,t.normal=e.extrusionDirection??x.Z_AXIS,t.segments=(e.segments??[]).map(r=>{var i;return{position:r.position,direction:r.direction,miterDirection:r.miterDirection,elements:((i=r.elements)==null?void 0:i.map(s=>({parameterCount:s.parameterCount,parameters:s.parameters??[],fillCount:s.fillCount,fillParameters:s.fillParameters??[]})))??[]}}),t}convertMLeader(e){var L,S;const t=new si,r=e;t.version=e.version,t.leaderStyleId=e.leaderStyleId,e.leaderStyleId&&(t.mleaderStyleId=e.leaderStyleId),t.propertyOverrideFlag=e.propertyOverrideFlag,t.leaderLineType=e.leaderLineType??Pn.StraightLeader,t.leaderLineColor=e.leaderLineColor,t.leaderLineTypeId=e.leaderLineTypeId,t.leaderLineWeight=e.leaderLineWeight,t.landingEnabled=e.landingEnabled,t.doglegEnabled=e.doglegEnabled??!1,t.doglegLength=e.doglegLength??0,t.arrowheadId=e.arrowheadId,t.arrowheadSize=e.arrowheadSize,t.textStyleId=e.textStyleId,t.textLeftAttachmentType=e.textLeftAttachmentType,t.textRightAttachmentType=e.textRightAttachmentType,t.textAngleType=e.textAngleType,t.textAlignmentType=e.textAlignmentType,t.textColor=e.textColor,t.textFrameEnabled=e.textFrameEnabled,t.landingGap=e.landingGap,t.textAttachment=e.textAttachment,t.textFlowDirection=e.textFlowDirection,t.blockContentId=e.blockContentId,t.blockContentColor=e.blockContentColor,t.blockContentRotation=e.blockContentRotation,t.blockContentConnectionType=e.blockContentConnectionType,t.annotativeScaleEnabled=e.annotativeScaleEnabled,t.arrowheadOverrides=e.arrowheadOverrides?e.arrowheadOverrides.map(A=>({...A})):[],t.blockAttributes=e.blockAttributes?e.blockAttributes.map(A=>({...A})):[],t.textDirectionNegative=e.textDirectionNegative,t.textAlignInIPE=e.textAlignInIPE,t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection,t.topTextAttachmentDirection=e.topTextAttachmentDirection,t.contentScale=e.contentScale,t.textLineSpacingStyle=e.textLineSpacingStyle,t.textBackgroundColor=e.textBackgroundColor,t.textBackgroundScaleFactor=e.textBackgroundScaleFactor,t.textBackgroundTransparency=e.textBackgroundTransparency,t.textBackgroundColorOn=e.textBackgroundColorOn,t.textFillOn=e.textFillOn,t.textColumnType=e.textColumnType,t.textUseAutoHeight=e.textUseAutoHeight,t.textColumnWidth=e.textColumnWidth,t.textColumnGutterWidth=e.textColumnGutterWidth,t.textColumnFlowReversed=e.textColumnFlowReversed,t.textColumnHeight=e.textColumnHeight,t.textUseWordBreak=e.textUseWordBreak,t.hasMText=e.hasMText,t.hasBlock=e.hasBlock,t.planeNormalReversed=e.planeNormalReversed,e.blockContentScale&&(t.blockContentScale=new x(e.blockContentScale)),e.contentBasePosition&&(t.contentBasePosition=new b().copy(e.contentBasePosition)),e.textAnchor&&(t.textAnchor=new b().copy(e.textAnchor)),e.planeOrigin&&(t.planeOrigin=new b().copy(e.planeOrigin)),e.planeXAxisDirection&&(t.planeXAxisDirection=new x(e.planeXAxisDirection)),e.planeYAxisDirection&&(t.planeYAxisDirection=new x(e.planeYAxisDirection));const i=r.textContent,s=i&&typeof i=="object"?i:void 0,a=typeof i=="string"&&i.length>0||this.readString(s??{},["text","contents"])!=null||this.readString(r,["text","contents","mtext"])!=null,o=e.contentType??(a?yt.MTextContent:e.blockContent?yt.BlockContent:yt.NoneContent);t.contentType=o;const l=this.readPoint(r,["normal","extrusionDirection"]);l&&(t.normal=l);const c=this.readString(s??{},["styleName","textStyleName","textStyle"])??this.readString(r,["textStyleName","textStyle","styleName","textStyleId"]);c&&(t.textStyleName=c);const h=this.readPositiveNumber(s??{},["textHeight","height"])??this.readPositiveNumber(r,["textHeight","mtextHeight","textContentHeight"])??this.readPositiveNumber(r,["arrowheadSize","contentScale"]);h!=null&&(t.textHeight=h);const d=this.readPositiveNumber(s??{},["textWidth","width"])??this.readPositiveNumber(r,["textWidth","mtextWidth","textContentWidth"]);d!=null&&(t.textWidth=d),t.textLineSpacingFactor=this.readNumber(s??{},["lineSpacingFactor","textLineSpacingFactor"])??this.readNumber(r,["textLineSpacingFactor"])??t.textLineSpacingFactor;const p=this.readNumber(s??{},["textRotation","rotation"])??this.readNumber(r,["textRotation","mtextRotation","textContentRotation"]);p!=null&&(t.textRotation=T.degToRad(p));const g=this.readPoint(r,["textDirection","mtextDirection","textDirectionVector"]);g&&(t.textDirection=g);const f=this.readNumber(r,["textAttachmentPoint","attachmentPoint"]);f!=null&&(t.textAttachmentPoint=f);const m=e.textAttachmentDirection;m!=null&&(t.textAttachmentDirection=m);const y=this.readNumber(r,["textDrawingDirection","drawingDirection"]);y!=null&&(t.textDrawingDirection=y);const _=typeof i=="string"?i:this.readString(s??{},["text","contents"])??this.readString(r,["text","contents","mtext"]),P=this.readPoint(s??{},["anchorPoint","textAnchor","textLocation","textPosition","textAnchorPoint"])??this.readPoint(r,["textAnchor","textLocation","textPosition","textAnchorPoint","contentBasePosition"]);if(_!=null&&P&&(t.mtextContent={text:_,anchorPoint:P}),e.blockContent){const A=e.blockContent;t.blockContent={blockContentId:e.blockContent.blockContentId,normal:this.readPoint(A,["normal"]),position:e.blockContent.position,scale:this.readPoint(A,["scale"]),rotation:this.readNumber(A,["rotation"]),color:this.readNumber(A,["color"]),transformationMatrix:Array.isArray(e.blockContent.transformationMatrix)?e.blockContent.transformationMatrix:[]}}else e.blockContentId&&(t.blockContent={blockContentId:e.blockContentId,scale:e.blockContentScale,rotation:e.blockContentRotation,color:e.blockContentColor,transformationMatrix:[]});return(L=this.readMLeaderLeaders(r))==null||L.forEach(A=>{t.addLeader({lastLeaderLinePoint:A.lastLeaderLinePoint,lastLeaderLinePointSet:A.lastLeaderLinePointSet,doglegVector:A.doglegVector,doglegVectorSet:A.doglegVectorSet,doglegLength:A.doglegLength??e.doglegLength,breaks:A.breaks,leaderBranchIndex:A.leaderBranchIndex,leaderLines:A.leaderLines})}),t.numberOfLeaders===0&&((S=this.readLeaderLineArray(r))==null||S.forEach(A=>{t.addLeader({doglegLength:e.doglegLength}),t.addLeaderLine(t.numberOfLeaders-1,A)})),t.numberOfLeaders===0&&e.contentBasePosition&&t.addLeader({lastLeaderLinePoint:e.contentBasePosition,lastLeaderLinePointSet:!0,doglegLength:e.doglegLength}),t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"){const t=e,r=new dr(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(r.dimBlockPosition={...t.insertionPoint,z:0}),r.rotation=T.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDbRotatedDimension"){const t=e,r=new wi(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(r.dimBlockPosition={...t.insertionPoint,z:0}),r.rotation=T.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,r=new yi(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,r=new bi(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,r=new xi(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,r=new _i(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,r),r}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,t.imageDefId=e.imageDefHandle,t.isClipped=e.isClipped,e.clippingBoundaryPath.forEach(r=>{t.clipBoundary.push(new E(r))}),t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new hr;return this.processImage(e,t),t.clipBoundaryType=e.clippingBoundaryType,t}processWipeout(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.displayFlag|4)>0,t.isImageShown=(e.displayFlag|3)>0,t.isImageTransparent=(e.displayFlag|8)>0,t.imageDefId=e.imageDefHardId,t.isClipped=e.isClipping,e.boundary.forEach(r=>{t.clipBoundary.push(new E(r))}),t.clipBoundaryType=e.boundaryType,t.width=Math.sqrt(e.uDirection.x**2+e.uDirection.y**2+e.uDirection.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vDirection.x**2+e.vDirection.y**2+e.vDirection.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uDirection.y,e.uDirection.x)}convertWipeout(e){const t=new ui;return this.processWipeout(e,t),t}convertViewport(e){const t=new di;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new ci;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertXline(e){const t=new gi;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertBlockReference(e){const t=new sn(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?T.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(e,t){if(t.layer=e.layer||"0",e.handle&&(t.objectId=e.handle.toString()),t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null||e.colorIndex!=null||e.colorName){const r=new B;e.color!=null&&r.setRGBValue(e.color),e.colorIndex!=null&&(r.colorIndex=e.colorIndex),e.colorName&&(r.colorName=e.colorName),t.color=r}e.isVisible!=null&&(t.visibility=!e.isVisible),e.transparency!=null&&(t.transparency=te.deserialize(e.transparency))}readNumber(e,t){for(const r of t){const i=e[r];if(typeof i=="number"&&Number.isFinite(i))return i}}readPositiveNumber(e,t){const r=this.readNumber(e,t);return r!=null&&r>0?r:void 0}readString(e,t){for(const r of t){const i=e[r];if(typeof i=="string")return i}}readBoolean(e,t){for(const r of t){const i=e[r];if(typeof i=="boolean")return i;if(typeof i=="number")return i!==0}}readPoint(e,t){for(const r of t){const i=e[r];if(this.isPointLike(i))return i;if(Array.isArray(i)&&typeof i[0]=="number"&&typeof i[1]=="number")return{x:i[0],y:i[1],z:i[2]??0}}}readLeaderLineArray(e){const t=e.leaderLines;if(Array.isArray(t))return t.map(i=>{if(!i||typeof i!="object")return;const s=i.vertices;return Array.isArray(s)?s.filter(a=>this.isPointLike(a)):void 0}).filter(i=>!!i&&i.length>0);const r=e.vertices;if(Array.isArray(r)){const i=r.filter(s=>this.isPointLike(s));return i.length>0?[i]:void 0}}readMLeaderLeaders(e){const t=e.leaderSections;if(!Array.isArray(t))return;const r=[];return t.forEach(i=>{if(!i||typeof i!="object")return;const s=i,a=s.leaderLines,o=Array.isArray(a)?a.reduce((f,m)=>{const y=this.readMLeaderLine(m);return y&&f.push(y),f},[]):void 0,l={},c=this.readPoint(s,["lastLeaderLinePoint"]),h=this.readPoint(s,["doglegVector"]),d=this.readNumber(s,["doglegLength"]),p=this.readMLeaderBreaks(s.breaks),g=this.readNumber(s,["leaderBranchIndex"]);c&&(l.lastLeaderLinePoint=c),s.lastLeaderLinePointSet!=null&&(l.lastLeaderLinePointSet=this.readBoolean(s,["lastLeaderLinePointSet"])),h&&(l.doglegVector=h),s.doglegVectorSet!=null&&(l.doglegVectorSet=this.readBoolean(s,["doglegVectorSet"])),d!=null&&(l.doglegLength=d),p&&(l.breaks=p),g!=null&&(l.leaderBranchIndex=g),o&&(l.leaderLines=o),r.push(l)}),r}readMLeaderLine(e){if(!e||typeof e!="object")return;const t=e,r=t.vertices,i=Array.isArray(r)?r.filter(l=>this.isPointLike(l)):[],s=this.readMLeaderBreaks(t.breaks),a=Array.isArray(t.breakPointIndexes)?t.breakPointIndexes.filter(l=>typeof l=="number"):void 0,o=this.readNumber(t,["leaderLineIndex"]);return i.length>0||s&&s.length>0?{vertices:i,breakPointIndexes:a,leaderLineIndex:o,breaks:s}:void 0}readMLeaderBreaks(e){if(!Array.isArray(e))return;const t=e.map(r=>{if(!r||typeof r!="object")return;const i=r,s=this.readPoint(i,["start"]),a=this.readPoint(i,["end"]),o=this.readNumber(i,["index"]);if(!s||!a)return;const l={start:s,end:a};return o!=null&&(l.index=o),l}).filter(r=>!!r);return t.length>0?t:void 0}isPointLike(e){return!!e&&typeof e=="object"&&typeof e.x=="number"&&typeof e.y=="number"}}class ef{convertLayout(e,t){var s,a;const r=new yr;r.layoutName=e.layoutName,r.tabOrder=e.tabOrder,r.plotSettingsName=e.pageSetupName,r.plotCfgName=e.configName,r.canonicalMediaName=e.paperSize,r.plotViewName=e.plotViewName,r.currentStyleSheet=e.currentStyleSheet,r.plotPaperMargins={left:e.marginLeft,right:e.marginRight,top:e.marginTop,bottom:e.marginBottom},r.plotPaperSize.copy({x:e.paperWidth,y:e.paperHeight}),r.plotOrigin.copy({x:e.plotOriginX,y:e.plotOriginY}),r.plotWindowArea.min.copy({x:e.windowAreaXMin,y:e.windowAreaYMin}),r.plotWindowArea.max.copy({x:e.windowAreaXMax,y:e.windowAreaYMax}),r.customPrintScale={numerator:e.printScaleNumerator,denominator:e.printScaleDenominator},r.plotPaperUnits=e.plotPaperUnit,r.plotRotation=e.plotRotation,r.plotType=e.plotType,r.stdScaleType=e.standardScaleType,r.shadePlot=(()=>{switch(e.shadePlotMode){case 1:return mn.kWireframe;case 2:return mn.kHidden;case 3:return mn.kRendered;default:return mn.kAsDisplayed}})(),r.shadePlotResLevel=(()=>{switch(e.shadePlotResolution){case 1:return Et.kPreview;case 2:return Et.kNormal;case 3:return Et.kPresentation;case 4:return Et.kMaximum;case 5:return Et.kCustom;default:return Et.kDraft}})(),e.shadePlotCustomDPI!=null&&(r.shadePlotCustomDPI=e.shadePlotCustomDPI),e.shadePlotId&&(r.shadePlotId=e.shadePlotId);const i=e.layoutFlag??0;if(r.plotViewportBorders=(i&1)!==0,r.showPlotStyles=(i&2)!==0,r.plotCentered=(i&4)!==0,r.plotHidden=(i&8)!==0,r.useStandardScale=(i&16)!==0,r.plotPlotStyles=(i&32)!==0,r.scaleLineweights=(i&64)!==0,r.printLineweights=(i&128)!==0,r.drawViewportsFirst=(i&512)!==0,r.modelType=(i&1024)!==0,e.viewportId&&r.viewportArray.push(e.viewportId),e.layoutName==="Model"){const o=se.MODEL_SPACE_NAME.toUpperCase();(s=t.tables.BLOCK_RECORD)==null||s.entries.some(l=>l.name.toUpperCase()===o?(r.blockTableRecordId=l.handle,!0):!1)}else(a=t.tables.BLOCK_RECORD)==null||a.entries.some(o=>o.layoutObjects===e.handle?(r.blockTableRecordId=o.handle,!0):!1),r.blockTableRecordId||(r.blockTableRecordId=e.paperSpaceTableId);return e.minLimit&&r.limits.min.copy(e.minLimit),e.maxLimit&&r.limits.max.copy(e.maxLimit),e.minExtent&&r.extents.min.copy(e.minExtent),e.maxExtent&&r.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,r),r}convertImageDef(e){const t=new rc;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}convertMLeaderStyle(e){const t=new Zs;return t.unknown1=e.unknown1,e.contentType!=null&&(t.contentType=e.contentType),e.drawMLeaderOrderType!=null&&(t.drawMLeaderOrderType=e.drawMLeaderOrderType),e.drawLeaderOrderType!=null&&(t.drawLeaderOrderType=e.drawLeaderOrderType),e.maxLeaderSegmentPoints!=null&&(t.maxLeaderSegmentPoints=e.maxLeaderSegmentPoints),e.firstSegmentAngleConstraint!=null&&(t.firstSegmentAngleConstraint=e.firstSegmentAngleConstraint),e.secondSegmentAngleConstraint!=null&&(t.secondSegmentAngleConstraint=e.secondSegmentAngleConstraint),e.leaderLineType!=null&&(t.leaderLineType=e.leaderLineType),e.leaderLineColor!=null&&(t.leaderLineColor=er(e.leaderLineColor)),t.leaderLineTypeId=e.leaderLineTypeId,e.leaderLineWeight!=null&&(t.leaderLineWeight=e.leaderLineWeight),e.landingEnabled!=null&&(t.landingEnabled=e.landingEnabled),e.landingGap!=null&&(t.landingGap=e.landingGap),e.doglegEnabled!=null&&(t.doglegEnabled=e.doglegEnabled),e.doglegLength!=null&&(t.doglegLength=e.doglegLength),e.description!=null&&(t.description=e.description),t.arrowheadId=e.arrowheadId,e.arrowheadSize!=null&&(t.arrowheadSize=e.arrowheadSize),e.defaultMTextContents!=null&&(t.defaultMTextContents=e.defaultMTextContents),t.textStyleId=e.textStyleId,e.textLeftAttachmentType!=null&&(t.textLeftAttachmentType=e.textLeftAttachmentType),e.textAngleType!=null&&(t.textAngleType=e.textAngleType),e.textAlignmentType!=null&&(t.textAlignmentType=e.textAlignmentType),e.textRightAttachmentType!=null&&(t.textRightAttachmentType=e.textRightAttachmentType),e.textColor!=null&&(t.textColor=er(e.textColor)),e.textHeight!=null&&(t.textHeight=e.textHeight),e.textFrameEnabled!=null&&(t.textFrameEnabled=e.textFrameEnabled),e.textAlignAlwaysLeft!=null&&(t.textAlignAlwaysLeft=e.textAlignAlwaysLeft),e.alignSpace!=null&&(t.alignSpace=e.alignSpace),t.blockContentId=e.blockContentId,e.blockContentColor!=null&&(t.blockContentColor=er(e.blockContentColor)),e.blockContentScale&&(t.blockContentScale={x:e.blockContentScale.x,y:e.blockContentScale.y,z:e.blockContentScale.z??1}),e.blockContentScaleEnabled!=null&&(t.blockContentScaleEnabled=e.blockContentScaleEnabled),e.blockContentRotation!=null&&(t.blockContentRotation=e.blockContentRotation),e.blockContentRotationEnabled!=null&&(t.blockContentRotationEnabled=e.blockContentRotationEnabled),e.blockContentConnectionType!=null&&(t.blockContentConnectionType=e.blockContentConnectionType),e.scale!=null&&(t.scale=e.scale),e.overwritePropertyValue!=null&&(t.overwritePropertyValue=e.overwritePropertyValue),e.annotative!=null&&(t.annotative=e.annotative),e.breakGapSize!=null&&(t.breakGapSize=e.breakGapSize),e.textAttachmentDirection!=null&&(t.textAttachmentDirection=e.textAttachmentDirection),e.bottomTextAttachmentDirection!=null&&(t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection),e.topTextAttachmentDirection!=null&&(t.topTextAttachmentDirection=e.topTextAttachmentDirection),t.unknown2=e.unknown2,this.processCommonAttrs(e,t),t}convertMLineStyle(e){var i;const t=new Qs;if(e.styleName!=null&&(t.styleName=e.styleName),e.flags!=null&&(t.flags=e.flags),e.description!=null&&(t.description=e.description),e.fillColor!=null)t.fillColor=new B().setRGBValue(e.fillColor);else if(e.fillColorIndex!=null){const s=new B;s.colorIndex=e.fillColorIndex,t.fillColor=s}e.startAngle!=null&&(t.startAngle=e.startAngle),e.endAngle!=null&&(t.endAngle=e.endAngle);const r=Math.max(e.elementCount??0,((i=e.elements)==null?void 0:i.length)??0);return r>0&&(t.elements=Array.from({length:r},(s,a)=>{var o,l,c,h;return{offset:((l=(o=e.elements)==null?void 0:o[a])==null?void 0:l.offset)??0,color:(()=>{var p,g,f,m;const d=new B;return((g=(p=e.elements)==null?void 0:p[a])==null?void 0:g.color)!=null?d.setRGBValue(e.elements[a].color):d.colorIndex=((m=(f=e.elements)==null?void 0:f[a])==null?void 0:m.colorIndex)??256,d})(),lineType:((h=(c=e.elements)==null?void 0:c[a])==null?void 0:h.lineType)??"BYLAYER"}})),this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}}class Fh{constructor(e){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:e.workerUrl,timeout:e.timeout??3e4,maxConcurrentWorkers:e.maxConcurrentWorkers??4}}async execute(e,t){const r=Date.now(),i=this.generateTaskId();try{return await this.executeInWorker(i,e,t||this.config.workerUrl)}catch(s){const a=Date.now()-r;return{success:!1,error:s instanceof Error?s.message:String(s),duration:a}}}async executeInWorker(e,t,r){const i=Date.now();return new Promise((s,a)=>{const o=this.getAvailableWorker(r),l=setTimeout(()=>{this.cleanupTask(e),this.releaseWorker(o),a(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(e,{resolve:d=>{clearTimeout(l),this.releaseWorker(o),s(d)},reject:d=>{clearTimeout(l),this.releaseWorker(o),a(d)},timeout:l});const c=d=>{const{id:p,success:g,data:f,error:m}=d.data;if(p!==e)return;this.cleanupTask(e);const y=Date.now()-i;s(g?{success:!0,data:f,duration:y}:{success:!1,error:m,duration:y})},h=d=>{this.cleanupTask(e),a(new Error(`Worker error: ${d.message}`))};o.addEventListener("message",c),o.addEventListener("error",h),o.postMessage({id:e,input:t})})}cleanupTask(e){const t=this.pendingTasks.get(e);t&&(clearTimeout(t.timeout),this.pendingTasks.delete(e))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(e){for(const[r,i]of this.workers)if(!i.isBusy)return i.isBusy=!0,i.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const r=new Worker(e,{type:"module"}),i=this.generateWorkerId(),s={worker:r,isBusy:!0,id:i,createdAt:new Date};return this.workers.set(i,s),r}const t=Array.from(this.workers.values()).sort((r,i)=>r.createdAt.getTime()-i.createdAt.getTime())[0];return t.isBusy=!0,t.worker}releaseWorker(e){for(const[t,r]of this.workers)if(r.worker===e){r.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(e=>e.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[e,t]of this.pendingTasks)clearTimeout(t.timeout),t.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[e,t]of this.workers)t.worker.terminate();this.workers.clear()}}class Dh{constructor(e){this.framework=new Fh(e)}async execute(e,t){return this.framework.execute(e,t)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Vh(n){return new Dh(n)}class tf{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async e=>{const{id:t,input:r}=e.data;try{const i=await this.executeTask(r);this.sendResponse(t,!0,i)}catch(i){this.sendResponse(t,!1,void 0,i instanceof Error?i.message:String(i))}}}sendResponse(e,t,r,i){const s={id:e,success:t,data:r,error:i};self.postMessage(s)}}class zh extends sa{constructor(e={}){super(e),e.parserWorkerUrl||(e.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(e,t){const r=this.config,i=this.getParserWorkerTimeout(e,t);if(r.useWorker&&r.parserWorkerUrl){const s=Vh({workerUrl:r.parserWorkerUrl,timeout:i,maxConcurrentWorkers:1}),a=await s.execute(e);if(s.destroy(),a.success)return{model:a.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${a.error}'`)}else return{model:new J0().parse(e),data:{unknownEntityCount:0}}}getFonts(e){var s;const t=new Map,r=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(s=e.tables.STYLE)==null||s.entries.forEach(a=>{const o=[];if(a.font){const l=r(a.font);l&&o.push(l)}if(a.bigFont){const l=r(a.bigFont);l&&o.push(l)}if(a.extendedFont){const l=r(a.extendedFont);l&&o.push(l)}t.set(a.name,o)});const i=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,i),Array.from(i)}getFontsInBlock(e,t,r,i){const s=/\\f(.*?)\|/g;e.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.matchAll(s)].forEach(h=>{i.add(h[1].toLowerCase())});const c=r.get(o.styleName);c==null||c.forEach(h=>i.add(h))}else if(a.type=="TEXT"){const o=a,l=r.get(o.styleName);l==null||l.forEach(c=>i.add(c))}else if(a.type=="MULTILEADER"||a.type=="MLEADER"){const o=a;[...(typeof o.textContent=="string"?o.textContent:"").matchAll(s)].forEach(d=>{i.add(d[1].toLowerCase())});const c=typeof o.textStyleName=="string"?o.textStyleName:typeof o.styleName=="string"?o.styleName:void 0,h=c?r.get(c):void 0;h==null||h.forEach(d=>i.add(d))}else if(a.type=="INSERT"){const l=t[a.name];l&&l.entities&&this.getFontsInBlock(l.entities,t,r,i)}})}async processEntities(e,t,r,i,s){const a=new _o;let o=e.entities;const l=o.length,c=new Hs(l,100-i.value,r);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const h=new Map;for(let p=0;p<l;p++){const g=o[p];if(g.type==="ATTRIB"){const f=a.convert(g);if(f&&f.ownerId&&f.ownerId!=="0"){let m=h.get(f==null?void 0:f.ownerId);m==null&&(m=[],h.set(f.ownerId,m)),m.push(f)}}}const d=t.tables.blockTable.modelSpace;await c.processChunk(async(p,g)=>{let f=[],m=p<g?o[p].type:"";for(let _=p;_<g;_++){const P=o[_];if(!(P.ownerBlockRecordSoftId&&P.ownerBlockRecordSoftId!==d.objectId)&&P.type!=="ATTRIB"){const L=a.convert(P);if(L){if(this.config.convertByEntityType&&P.type!==m&&(d.appendEntity(f),f=[],m=P.type),P.type==="INSERT"){const S=h.get(L.objectId);S&&S.length>0&&S.forEach(A=>{L.appendAttributes(A)})}f.push(L)}}}d.appendEntity(f);let y=i.value+g/l*(100-i.value);y>100&&(y=100),s&&await s(y,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(e,t,r=!1){const i=new _o,s=e.length,a=[],o=t.objectId,l=[];for(let c=0;c<s;c++){const h=e[c],d=i.convert(h);d&&(h.type==="ATTRIB"?l.push(d):(!r||h.ownerBlockRecordSoftId===o)&&a.push(d))}t.appendEntity(a),l.forEach(c=>{const h=t.getIdAt(c.ownerId);h&&h.appendAttributes(c)})}processBlocks(e,t){const r=e.blocks;for(const[i,s]of Object.entries(r)){let a=t.tables.blockTable.getAt(s.name);a||(a=new se,s.handle!=null&&(a.objectId=String(s.handle)),a.name=i,a.origin.copy(s.position),t.tables.blockTable.add(a)),s.entities?this.processEntitiesInBlock(s.entities,a):a.isPaperSapce&&this.processEntitiesInBlock(e.entities,a,!0)}}processHeader(e,t){const r=e.header;r.$ACADVER&&(t.version=r.$ACADVER),t.cecolor.colorIndex=r.$CECOLOR||256,t.angbase=r.$ANGBASE||0,t.angdir=r.$ANGDIR||0,r.$AUNITS!=null&&(t.aunits=r.$AUNITS),r.$AUPREC!=null&&(t.auprec=r.$AUPREC),r.$LUNITS!=null&&(t.lunits=r.$LUNITS),r.$LUPREC!=null&&(t.luprec=r.$LUPREC),r.$UNITMODE!=null&&(t.unitmode=r.$UNITMODE),r.$MEASUREMENT!=null&&(t.measurement=r.$MEASUREMENT),t.celtype=r.$CELTYPE||fe,Xe.instance().setVar(I.CETRANSPARENCY,r.$CETRANSPARENCY||"ByLayer",t),t.celtscale=r.$CELTSCALE||1;const i=this.normalizeHeaderStringValue(r.$CMLSTYLE)||this.normalizeHeaderStringValue(r.CMLSTYLE)||ft;t.cmlstyle=i;const s=r.$CMLSCALE??r.CMLSCALE;typeof s=="number"&&Number.isFinite(s)&&(t.cmlscale=s);const a=this.normalizeHeaderStringValue(r.$CMLEADERSTYLE)||this.normalizeHeaderStringValue(r.CMLEADERSTYLE)||mt;t.cmleaderstyle=a,t.hplayer=this.normalizeHeaderStringValue(r.$HPLAYER)||this.normalizeHeaderStringValue(r.HPLAYER)||".",t.ltscale=r.$LTSCALE||1,r.$EXTMAX&&(t.extmax=r.$EXTMAX),r.$EXTMIN&&(t.extmin=r.$EXTMIN),r.$INSUNITS!=null&&(t.insunits=r.$INSUNITS),t.osmode=r.$OSMODE||0,t.orthomode=r.$ORTHOMODE||0,t.pdmode=r.$PDMODE||0,t.pdsize=r.$PDSIZE||0,t.textstyle=r.$TEXTSTYLE||oe}processBlockTables(e,t){var i;const r=(i=e.tables.BLOCK_RECORD)==null?void 0:i.entries;r&&r.length>0&&(t.tables.blockTable.removeAll(),r.forEach(s=>{const a=new se;a.objectId=s.handle,a.name=s.name,a.layoutId=s.layoutObjects,a.blockInsertUnits=s.insertionUnits,a.explodability=s.explodability,a.blockScaling=s.scalability,s.bmpPreview&&(a.bmpPreview=s.bmpPreview),t.tables.blockTable.add(a)}))}processObjects(e,t){const r=e.objects.byName,i=new ef;if("LAYOUT"in r){const s=t.objects.layout;r.LAYOUT.forEach(a=>{const o=i.convertLayout(a,e);s.setAt(o.layoutName,o)})}if("IMAGEDEF"in r){const s=t.objects.imageDefinition;r.IMAGEDEF.forEach(a=>{const o=i.convertImageDef(a);s.setAt(o.objectId,o)})}if("MLEADERSTYLE"in r){const s=t.objects.mleaderStyle;r.MLEADERSTYLE.forEach(a=>{const o=i.convertMLeaderStyle(a);s.setAt(o.objectId,o)})}if("MLINESTYLE"in r){const s=t.objects.mlineStyle;r.MLINESTYLE.forEach(a=>{const o=i.convertMLineStyle(a);s.setAt(o.styleName||o.objectId,o)})}}processViewports(e,t){var i;const r=(i=e.tables)==null?void 0:i.VPORT;if(r){this.processCommonTableAttrs(r,t.tables.viewportTable);const s=r.entries;s&&s.length>0&&s.forEach(a=>{const o=new ia;this.processCommonTableEntryAttrs(a,o),a.circleSides&&(o.circleSides=a.circleSides),o.standardFlag=a.standardFlag,o.center.copy(a.center??ws),o.lowerLeftCorner.copy(a.lowerLeftCorner??Nl),o.upperRightCorner.copy(a.upperRightCorner??Yl),a.snapBasePoint&&o.snapBase.copy(a.snapBasePoint),a.snapRotationAngle&&(o.snapAngle=a.snapRotationAngle),a.snapSpacing&&o.snapIncrements.copy(a.snapSpacing),a.majorGridLines&&(o.gridMajor=a.majorGridLines),a.gridSpacing&&o.gridIncrements.copy(a.gridSpacing),a.backgroundObjectId&&(o.backgroundObjectId=a.backgroundObjectId),o.gsView.center.copy(a.center??ws),o.gsView.viewDirectionFromTarget.copy(a.viewDirectionFromTarget??Xl),o.gsView.viewTarget.copy(a.viewTarget??Rl),a.lensLength&&(o.gsView.lensLength=a.lensLength),a.frontClippingPlane&&(o.gsView.frontClippingPlane=a.frontClippingPlane),a.backClippingPlane&&(o.gsView.backClippingPlane=a.backClippingPlane),a.viewHeight&&(o.gsView.viewHeight=a.viewHeight),a.viewTwistAngle&&(o.gsView.viewTwistAngle=a.viewTwistAngle),a.frozenLayers&&(o.gsView.frozenLayers=a.frozenLayers),a.styleSheet&&(o.gsView.styleSheet=a.styleSheet),a.renderMode&&(o.gsView.renderMode=a.renderMode),a.viewMode&&(o.gsView.viewMode=a.viewMode),a.ucsIconSetting&&(o.gsView.ucsIconSetting=a.ucsIconSetting),a.ucsOrigin&&o.gsView.ucsOrigin.copy(a.ucsOrigin),a.ucsXAxis&&o.gsView.ucsXAxis.copy(a.ucsXAxis),a.ucsYAxis&&o.gsView.ucsYAxis.copy(a.ucsYAxis),a.orthographicType&&(o.gsView.orthographicType=a.orthographicType),a.shadePlotSetting&&(o.gsView.shadePlotSetting=a.shadePlotSetting),a.shadePlotObjectId&&(o.gsView.shadePlotObjectId=a.shadePlotObjectId),a.visualStyleObjectId&&(o.gsView.visualStyleObjectId=a.visualStyleObjectId),a.isDefaultLightingOn&&(o.gsView.isDefaultLightingOn=a.isDefaultLightingOn),a.defaultLightingType&&(o.gsView.defaultLightingType=a.defaultLightingType),a.brightness&&(o.gsView.brightness=a.brightness),a.contrast&&(o.gsView.contrast=a.contrast),a.ambientColor&&(o.gsView.ambientColor=a.ambientColor),t.tables.viewportTable.add(o)})}}processLayers(e,t){var i;const r=(i=e.tables)==null?void 0:i.LAYER;if(r){this.processCommonTableAttrs(r,t.tables.layerTable);const s=r.entries;s&&s.length>0&&s.forEach(a=>{const o=new B;o.colorIndex=a.colorIndex;const l=new Ri({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,l),t.tables.layerTable.add(l)})}}processLineTypes(e,t){var i;const r=(i=e.tables)==null?void 0:i.LTYPE;if(r){this.processCommonTableAttrs(r,t.tables.linetypeTable);const s=r.entries;s&&s.length>0&&s.forEach(a=>{const o=new Ot(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,t.tables.linetypeTable.add(o)})}}processTextStyles(e,t){var i;const r=(i=e.tables)==null?void 0:i.STYLE;if(r){this.processCommonTableAttrs(r,t.tables.textStyleTable);const s=r.entries;s&&s.length>0&&s.forEach(a=>{const o=new Bi(a);this.processCommonTableEntryAttrs(a,o),t.tables.textStyleTable.add(o)})}t.ensureTextStyleDefaults()}processDimStyles(e,t){var i;const r=(i=e.tables)==null?void 0:i.DIMSTYLE;if(r){this.processCommonTableAttrs(r,t.tables.dimStyleTable);const s=r.entries;s&&s.length>0&&s.forEach(a=>{const o={name:a.name,ownerId:a.ownerObjectId,dimpost:a.DIMPOST||"",dimapost:a.DIMAPOST||"",dimscale:a.DIMSCALE,dimasz:a.DIMASZ,dimexo:a.DIMEXO,dimdli:a.DIMDLI,dimexe:a.DIMEXE,dimrnd:a.DIMRND,dimdle:a.DIMDLE,dimtp:a.DIMTP,dimtm:a.DIMTM,dimtxt:a.DIMTXT,dimcen:a.DIMCEN,dimtsz:a.DIMTSZ,dimaltf:a.DIMALTF,dimlfac:a.DIMLFAC,dimtvp:a.DIMTVP,dimtfac:a.DIMTFAC,dimgap:a.DIMGAP,dimaltrnd:a.DIMALTRND,dimtol:a.DIMTOL==null||a.DIMTOL==0?0:1,dimlim:a.DIMLIM==null||a.DIMLIM==0?0:1,dimtih:a.DIMTIH==null||a.DIMTIH==0?0:1,dimtoh:a.DIMTOH==null||a.DIMTOH==0?0:1,dimse1:a.DIMSE1==null||a.DIMSE1==0?0:1,dimse2:a.DIMSE2==null||a.DIMSE2==0?0:1,dimtad:a.DIMTAD,dimzin:a.DIMZIN,dimazin:a.DIMAZIN,dimalt:a.DIMALT,dimaltd:a.DIMALTD,dimtofl:a.DIMTOFL,dimsah:a.DIMSAH,dimtix:a.DIMTIX,dimsoxd:a.DIMSOXD,dimclrd:a.DIMCLRD,dimclre:a.DIMCLRE,dimclrt:a.DIMCLRT,dimadec:a.DIMADEC||0,dimunit:a.DIMUNIT||2,dimdec:a.DIMDEC,dimtdec:a.DIMTDEC,dimaltu:a.DIMALTU,dimalttd:a.DIMALTTD,dimaunit:a.DIMAUNIT,dimfrac:a.DIMFRAC,dimlunit:a.DIMLUNIT,dimdsep:a.DIMDSEP?a.DIMDSEP.toString():".",dimtmove:a.DIMTMOVE||0,dimjust:a.DIMJUST,dimsd1:a.DIMSD1,dimsd2:a.DIMSD2,dimtolj:a.DIMTOLJ,dimtzin:a.DIMTZIN,dimaltz:a.DIMALTZ,dimalttz:a.DIMALTTZ,dimfit:a.DIMFIT||0,dimupt:a.DIMUPT,dimatfit:a.DIMATFIT,dimtxsty:a.DIMTXSTY||oe,dimldrblk:a.DIMLDRBLK||"",dimblk:a.DIMBLK||"",dimblk1:a.DIMBLK1||"",dimblk2:a.DIMBLK2||"",dimlwd:a.DIMLWD,dimlwe:a.DIMLWE},l=new an(o);this.processCommonTableEntryAttrs(a,l),t.tables.dimStyleTable.add(l)})}}processCommonTableAttrs(e,t){e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}processCommonTableEntryAttrs(e,t){t.name="name"in e?e.name:"",e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}groupAndFlattenByType(e){const t={},r=[];for(const i of e)t[i.type]||(t[i.type]=[],r.push(i.type)),t[i.type].push(i);return r.flatMap(i=>t[i])}normalizeHeaderStringValue(e){if(typeof e!="string")return;const t=e.trim();return t.length>0?t:void 0}}class jh extends sa{constructor(e){super({}),this._database=e}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(e,t,r,i,s){let a=e.tables.blockTable.modelSpace.newIterator().toArray();const o=a.length,l=new Hs(o,100-i.value,r);this.config.convertByEntityType&&(a=this.groupAndFlattenByType(a));const c=t.tables.blockTable.modelSpace;await l.processChunk(async(h,d)=>{let p=[],g=h<d?a[h].type:"";for(let f=h;f<d;f++){const m=a[f];this.config.convertByEntityType&&m.type!==g&&(this.triggerEvents(c,p),p=[],g=m.type),p.push(m)}if(this.triggerEvents(c,p),s){let f=i.value+d/o*(100-i.value);f>100&&(f=100),await s(f,"ENTITY","IN-PROGRESS")}})}processBlocks(){const e=this._database.tables.blockTable.newIterator();for(const t of e){const r=t.newIterator().toArray();this.triggerEvents(t,r)}}processHeader(){}processBlockTables(){}processObjects(){const e=this._database.objects.layout.newIterator();for(const i of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.layoutName});const t=this._database.objects.imageDefinition.newIterator();for(const i of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.objectId});const r=this._database.objects.mleaderStyle.newIterator();for(const i of r)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(t=>{this._database.events.layerAppended.dispatch({database:this._database,layer:t})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(e){const t={},r=[];for(const i of e)t[i.type]||(t[i.type]=[],r.push(i.type)),t[i.type].push(i);return r.flatMap(i=>t[i])}triggerEvents(e,t){(e.isModelSapce||e.isPaperSapce)&&e.database.events.entityAppended.dispatch({database:e.database,entity:t})}}exports.ACAD_APPID=xs;exports.AC_DB_SYSTEM_VARIABLE_NAMES=lg;exports.AcCmColor=B;exports.AcCmColorUtil=It;exports.AcCmEntityColor=Uh;exports.AcCmErrors=Pe;exports.AcCmEventDispatcher=$h;exports.AcCmEventManager=ie;exports.AcCmLoader=cd;exports.AcCmLoadingManager=Lo;exports.AcCmObject=Po;exports.AcCmPerformanceCollector=Ms;exports.AcCmTask=Ao;exports.AcCmTaskScheduler=So;exports.AcCmTransparency=te;exports.AcDb2dPolyline=qr;exports.AcDb2dVertex=Ps;exports.AcDb2dVertexType=Fl;exports.AcDb3PointAngularDimension=yi;exports.AcDb3dPolyline=Kr;exports.AcDb3dVertex=As;exports.AcDb3dVertexType=Dl;exports.AcDbAbstractViewTableRecord=ra;exports.AcDbAlignedDimension=dr;exports.AcDbAngleUnits=ve;exports.AcDbArc=Zr;exports.AcDbArcDimension=Ss;exports.AcDbAttribute=Jr;exports.AcDbAttributeDefinition=Qr;exports.AcDbAttributeFlags=ae;exports.AcDbAttributeMTextFlag=Ue;exports.AcDbBaseWorker=tf;exports.AcDbBatchProcessing=Hs;exports.AcDbBlockReference=sn;exports.AcDbBlockScaling=pl;exports.AcDbBlockTable=lc;exports.AcDbBlockTableRecord=se;exports.AcDbCircle=ei;exports.AcDbCodePage=$s;exports.AcDbCurve=ge;exports.AcDbDataGenerator=sc;exports.AcDbDatabase=Lg;exports.AcDbDatabaseConverter=sa;exports.AcDbDatabaseConverterManager=We;exports.AcDbDiametricDimension=_i;exports.AcDbDictionary=tn;exports.AcDbDimArrowType=ac;exports.AcDbDimStyleTable=cc;exports.AcDbDimStyleTableRecord=an;exports.AcDbDimTextHorizontal=hc;exports.AcDbDimTextVertical=dc;exports.AcDbDimVerticalJustification=pc;exports.AcDbDimZeroSuppression=uc;exports.AcDbDimZeroSuppressionAngular=gc;exports.AcDbDimension=xt;exports.AcDbDuplicateRecordCloning=ic;exports.AcDbDwgVersion=Ye;exports.AcDbDxfCode=Cs;exports.AcDbDxfConverter=zh;exports.AcDbDxfFiler=Eo;exports.AcDbEllipse=ti;exports.AcDbEntity=le;exports.AcDbFace=ni;exports.AcDbFileType=Zn;exports.AcDbFormatter=Al;exports.AcDbGradientPatternType=Hl;exports.AcDbHatch=ar;exports.AcDbHatchObjectType=Ks;exports.AcDbHatchPatternType=Jn;exports.AcDbHatchStyle=Gl;exports.AcDbHostApplicationServices=Ur;exports.AcDbLayerTable=fc;exports.AcDbLayerTableRecord=Ri;exports.AcDbLayout=yr;exports.AcDbLayoutDictionary=nc;exports.AcDbLayoutManager=xl;exports.AcDbLeader=ri;exports.AcDbLeaderAnnotationType=Wl;exports.AcDbLine=or;exports.AcDbLineSpacingStyle=mi;exports.AcDbLinearUnits=J;exports.AcDbLinetypeTable=mc;exports.AcDbLinetypeTableRecord=Ot;exports.AcDbMLeader=si;exports.AcDbMLeaderContentType=yt;exports.AcDbMLeaderDirectionType=Kl;exports.AcDbMLeaderLineType=Pn;exports.AcDbMLeaderStyle=Zs;exports.AcDbMLeaderTextAttachmentDirection=ql;exports.AcDbMLine=ii;exports.AcDbMLineFlags=$l;exports.AcDbMLineJustification=Ul;exports.AcDbMText=lr;exports.AcDbMlineStyle=Qs;exports.AcDbObject=Ge;exports.AcDbObjectIterator=mr;exports.AcDbOpenMode=wl;exports.AcDbOrdinateDimension=bi;exports.AcDbOsnapMode=v;exports.AcDbPatParser=na;exports.AcDbPatSvgRenderer=Ls;exports.AcDbPlotPaperUnits=fl;exports.AcDbPlotRotation=ml;exports.AcDbPlotSettings=bl;exports.AcDbPlotShadePlotResLevel=Et;exports.AcDbPlotShadePlotType=mn;exports.AcDbPlotStdScaleType=_l;exports.AcDbPlotType=yl;exports.AcDbPoint=li;exports.AcDbPoly2dType=yn;exports.AcDbPoly3dType=Qn;exports.AcDbPolyFaceMesh=fi;exports.AcDbPolyFaceMeshFace=tc;exports.AcDbPolyFaceMeshVertex=ec;exports.AcDbPolygonMesh=pi;exports.AcDbPolygonMeshVertex=Jl;exports.AcDbPolyline=Ae;exports.AcDbPredefinedAcadIsoPat=jl;exports.AcDbPredefinedAcadPat=cg;exports.AcDbRadialDimension=xi;exports.AcDbRasterImage=hr;exports.AcDbRasterImageClipBoundaryType=Zl;exports.AcDbRasterImageDef=rc;exports.AcDbRasterImageImageDisplayOpt=Ql;exports.AcDbRay=ci;exports.AcDbRegAppTable=xc;exports.AcDbRegAppTableRecord=Is;exports.AcDbRegenerator=jh;exports.AcDbRenderingCache=on;exports.AcDbResultBuffer=Gs;exports.AcDbRotatedDimension=wi;exports.AcDbShape=hi;exports.AcDbSpline=cr;exports.AcDbSymbolTable=wt;exports.AcDbSymbolTableRecord=Xt;exports.AcDbSysVarManager=Xe;exports.AcDbSystemVariables=I;exports.AcDbTable=ai;exports.AcDbText=Sn;exports.AcDbTextHorizontalMode=Vl;exports.AcDbTextStyleTable=yc;exports.AcDbTextStyleTableRecord=Bi;exports.AcDbTextVerticalMode=zl;exports.AcDbTrace=oi;exports.AcDbUnitsValue=K;exports.AcDbViewTable=_c;exports.AcDbViewTableRecord=Tg;exports.AcDbViewport=di;exports.AcDbViewportTable=bc;exports.AcDbViewportTableRecord=ia;exports.AcDbWipeout=ui;exports.AcDbWorkerApi=Dh;exports.AcDbWorkerManager=Fh;exports.AcDbXline=gi;exports.AcDbXrecord=Ag;exports.AcGeArea2d=Nt;exports.AcGeBox2d=xe;exports.AcGeBox3d=R;exports.AcGeCatmullRomCurve3d=dl;exports.AcGeCircArc2d=Re;exports.AcGeCircArc3d=Yi;exports.AcGeCurve2d=Ln;exports.AcGeEllipseArc2d=An;exports.AcGeEllipseArc3d=hl;exports.AcGeEuler=wd;exports.AcGeGeometryUtil=qo;exports.AcGeLine2d=_t;exports.AcGeLine3d=bt;exports.AcGeLoop2d=ir;exports.AcGeMathUtil=T;exports.AcGeMatrix2d=gr;exports.AcGeMatrix3d=D;exports.AcGeNurbsCurve=je;exports.AcGePlane=Bs;exports.AcGePoint2d=E;exports.AcGePoint3d=b;exports.AcGePolyline2d=ee;exports.AcGeQuaternion=pr;exports.AcGeShape2d=zs;exports.AcGeSpline3d=$e;exports.AcGeTol=q;exports.AcGeVector2d=Z;exports.AcGeVector3d=x;exports.AcGiViewport=Bl;exports.AcTrStringUtil=ld;exports.ByBlock=Ct;exports.ByLayer=fe;exports.DEBUG_MODE=id;exports.DEFAULT_GRADIENT_HATCH_NAME=kl;exports.DEFAULT_HATCH_PATTERN_IMPERIAL=ng;exports.DEFAULT_HATCH_PATTERN_METRIC=Ml;exports.DEFAULT_LINE_TYPE=Mt;exports.DEFAULT_MLEADER_STYLE=mt;exports.DEFAULT_MLINE_STYLE=ft;exports.DEFAULT_TEXT_STYLE=oe;exports.DEFAULT_TOL=Ni;exports.DEG2RAD=Os;exports.DefaultLoadingManager=Io;exports.FLOAT_TOL=gt;exports.HATCH_PATTERN_SOLID=rn;exports.HATCH_PATTERN_USER=Ol;exports.MLIGHTCAD_APPID=bs;exports.ORIGIN_POINT_2D=dd;exports.ORIGIN_POINT_3D=Rs;exports.RAD2DEG=ks;exports.RAW_COLOR_TYPE_ACI=ta;exports.RAW_COLOR_TYPE_BY_BLOCK=vi;exports.RAW_COLOR_TYPE_BY_LAYER=Js;exports.RAW_COLOR_TYPE_RGB=ea;exports.RAW_COLOR_TYPE_WINDOW_BG=oc;exports.TAU=G;exports.TEMP_OBJECT_ID_PREFIX=Yr;exports.VPORT_FALLBACK_CENTER_2D=ws;exports.VPORT_FALLBACK_LLC=Nl;exports.VPORT_FALLBACK_URC=Yl;exports.VPORT_FALLBACK_VIEW_DIR=Xl;exports.VPORT_FALLBACK_VIEW_TARGET=Rl;exports.acdbDisableOsnapMode=fg;exports.acdbEnableOsnapMode=pg;exports.acdbHasOsnapMode=gg;exports.acdbHostApplicationServices=js;exports.acdbMaskToOsnapModes=dg;exports.acdbOsnapModesToMask=hg;exports.acdbToggleOsnapMode=ug;exports.basisFunction=kt;exports.calculateCurveLength=Qo;exports.ceilPowerOfTwo=jo;exports.clamp=pt;exports.clone=Un;exports.computeParameterValues=Ko;exports.createWorkerApi=Vh;exports.damp=Oo;exports.decodeMLeaderStyleRawColor=er;exports.deepClone=ls;exports.defaults=ur;exports.degToRad=Do;exports.dwgCodePageToEncoding=Cl;exports.encodeMLeaderStyleRawColor=Rr;exports.euclideanModulo=Ns;exports.evaluateNurbsPoint=Kn;exports.floorPowerOfTwo=Go;exports.generateAveragedKnots=Zo;exports.generateChordKnots=Pd;exports.generateSqrtChordKnots=Ad;exports.generateUUID=To;exports.generateUniformKnots=vd;exports.getOcsAngle=ds;exports.getOcsReferenceVector=Vs;exports.has=xo;exports.intPartLength=Xs;exports.interpolateControlPoints=Ed;exports.interpolateNurbsCurve=Ds;exports.inverseLerp=Mo;exports.isBetween=Ho;exports.isBetweenAngle=Wo;exports.isEmpty=wo;exports.isEqual=xn;exports.isImperialUnits=Pl;exports.isMetricUnits=vl;exports.isPointInPolygon=Fs;exports.isPolygonIntersect=$o;exports.isPowerOfTwo=zo;exports.lerp=Ys;exports.log=$n;exports.mapLinear=Co;exports.normalizeAngle=qn;exports.pingpong=ko;exports.radToDeg=Vo;exports.randFloat=Ro;exports.randFloatSpread=Bo;exports.randInt=Xo;exports.relativeEps=Uo;exports.seededRandom=Fo;exports.setAcDbHostApplicationServicesProvider=gl;exports.setAcDbLayoutManagerFactory=Ou;exports.setLogLevel=sd;exports.smootherstep=Yo;exports.smoothstep=No;exports.transformOcsPointToWcs=hs;exports.transformWcsPointToOcs=rr;
|
|
8
|
+
`)}stripInlineComment(e){const t=e.indexOf(";");return t<0?e:e.slice(0,t)}parseHeader(e){const t=e.indexOf(",");if(t<0){const s=e.trim();return s?{name:s,description:""}:null}const r=e.slice(0,t).trim(),i=e.slice(t+1).trim();return r?{name:r,description:i}:null}parseNumber(e){const t=Number(e.trim());return Number.isFinite(t)?t:null}parseLineDescriptor(e,t){const r=e.split(",").map(d=>d.trim()).filter(d=>d.length>0);if(r.length<5)return null;const i=this.parseNumber(r[0]),s=this.parseNumber(r[1]),o=this.parseNumber(r[2]),a=this.parseNumber(r[3]),l=this.parseNumber(r[4]);if(i==null||s==null||o==null||a==null||l==null)return null;const c=r.slice(5),h=[];for(const d of c){const p=this.parseNumber(d);if(p==null)return null;h.push(p)}return{angle:i,originX:s,originY:o,deltaX:a,deltaY:l,dashes:h,sourceLine:t}}flushCurrentPattern(e,t,r){e&&(e.pattern.lines.length===0&&r.push({line:e.headerLine,message:`Pattern "${e.pattern.name}" has no line descriptor.`,source:""}),t.push(e.pattern))}}const V=class V{static nextGradientId(e){return V.gradientIdCounter+=1,`acdb-pat-gradient-${e.toLowerCase()}-${V.gradientIdCounter}`}static packedRgbToCss(e){return`#${(e&16777215).toString(16).padStart(6,"0")}`}static gradientColorToCss(e,t){return typeof e=="number"?V.packedRgbToCss(e):e??t}static applyShadeTint(e,t){const r=T.clamp(t,0,1),i=r<.5?0:16777215,s=r<.5?1-r*2:r*2-1,o=e>>16&255,a=e>>8&255,l=e&255,c=i>>16&255,h=i>>8&255,d=i&255;return Math.round(o+(c-o)*s)*65536+Math.round(a+(h-a)*s)*256+Math.round(l+(d-l)*s)}static resolveGradientColors(e){const t="#2563eb",r="#f8fafc",i=V.gradientColorToCss(e.startColor,t);if(e.oneColorMode&&e.endColor==null){if(typeof e.startColor=="number"){const s=V.applyShadeTint(e.startColor,e.shadeTintValue??.5);return{start:i,end:V.packedRgbToCss(s)}}return{start:i,end:(e.shadeTintValue??.5)<.5?"#000000":"#ffffff"}}return{start:i,end:V.gradientColorToCss(e.endColor,r)}}static renderGradientStops(e){return e.map(t=>`<stop offset="${(T.clamp(t.offset,0,1)*100).toFixed(2)}%" stop-color="${t.color}" />`).join("")}static getGradientVector(e){return{x:Math.cos(e),y:-Math.sin(e)}}static isSolidPattern(e){return e.name.trim().toUpperCase()===rn}static renderBackground(e,t,r){return`<rect x="${-e/2}" y="${-t/2}" width="${e}" height="${t}" fill="${r}" />`}static estimateUnitScale(e){const t=[];for(const s of e.lines){t.push(Math.abs(s.deltaX),Math.abs(s.deltaY));for(const o of s.dashes)t.push(Math.abs(o))}const r=t.filter(s=>s>V.EPSILON);if(r.length===0)return 1;const i=r.sort((s,o)=>s-o);return i[Math.floor(i.length/2)]||1}static segmentToSvgPath(e){return`M ${e.x1.toFixed(2)} ${(-e.y1).toFixed(2)} L ${e.x2.toFixed(2)} ${(-e.y2).toFixed(2)}`}static buildDashSegments(e,t,r,i,s,o,a){const l=e.dashes;if(l.length===0)return[{x1:i+o*t,y1:s+a*t,x2:i+o*r,y2:s+a*r}];const c=l.reduce((g,f)=>g+Math.abs(f),0);if(c<=V.EPSILON)return[{x1:i+o*t,y1:s+a*t,x2:i+o*r,y2:s+a*r}];const h=[],d=Math.ceil((r-t)/c)+2;let p=t-c;for(let g=0;g<d;g++){let f=p;for(const m of l){const y=Math.abs(m),_=f+y;if(m>0||m===0){const P=T.clamp(f,t,r),L=T.clamp(_,t,r);L>P?h.push({x1:i+o*P,y1:s+a*P,x2:i+o*L,y2:s+a*L}):m===0&&P>=t&&P<=r&&h.push({x1:i+o*(P-.35),y1:s+a*(P-.35),x2:i+o*(P+.35),y2:s+a*(P+.35)})}f=_}p+=c}return h}static renderFamily(e,t){const r=T.degToRad(e.angle),i=Math.cos(r),s=Math.sin(r),o=-s,a=i,l=i*e.deltaX+o*e.deltaY,c=s*e.deltaX+a*e.deltaY,h=Math.hypot(l,c),d=h<=V.EPSILON?1:Math.max(1,Math.ceil(t*2/h)+1),p=Math.floor(d/2),g=-t*1.5,f=t*1.5,m=[];for(let y=-p;y<=p;y++){const _=e.originX+l*y,P=e.originY+c*y,L=V.buildDashSegments(e,g,f,_,P,i,s);for(const S of L)m.push(V.segmentToSvgPath(S))}return`<path d="${m.join(" ")}" fill="none" />`}static renderLinearGradientDef(e,t,r,i,s){const o=V.getGradientVector(t),a=T.clamp(r,-1,1)*i*.5,l=o.x*a,c=o.y*a;return[`<linearGradient id="${e}" gradientUnits="userSpaceOnUse"`,` x1="${(-o.x*i+l).toFixed(2)}"`,` y1="${(-o.y*i+c).toFixed(2)}"`,` x2="${(o.x*i+l).toFixed(2)}"`,` y2="${(o.y*i+c).toFixed(2)}">`,V.renderGradientStops(s),"</linearGradient>"].join("")}static renderRadialGradientDef(e,t,r,i,s){return[`<radialGradient id="${e}" gradientUnits="userSpaceOnUse"`,` cx="${t.toFixed(2)}" cy="${r.toFixed(2)}" r="${i.toFixed(2)}"`,` fx="${t.toFixed(2)}" fy="${r.toFixed(2)}">`,V.renderGradientStops(s),"</radialGradient>"].join("")}static renderGradientDef(e,t,r,i,s,o,a){const l=t.toUpperCase(),c=l.startsWith("INV"),h=l.replace(/^INV/,""),d=c?r.end:r.start,p=c?r.start:r.end,g=Math.hypot(o,a)/2,f=V.getGradientVector(i),m=T.clamp(s,-1,1),y=f.x*m*o*.25,_=f.y*m*a*.25;switch(h){case"CYLINDER":{const P=T.clamp(.5+m*.45,.05,.95);return V.renderLinearGradientDef(e,i,0,g,[{offset:0,color:d},{offset:P,color:p},{offset:1,color:d}])}case"SPHERICAL":return V.renderRadialGradientDef(e,y,_,g,[{offset:0,color:p},{offset:1,color:d}]);case"HEMISPHERICAL":return V.renderRadialGradientDef(e,y+f.x*o*.18,_+f.y*a*.18,g*.92,[{offset:0,color:p},{offset:.72,color:d},{offset:1,color:d}]);case"CURVED":return V.renderRadialGradientDef(e,-f.x*o*.95+y,-f.y*a*.95+_,g*1.65,[{offset:0,color:d},{offset:.55,color:d},{offset:1,color:p}]);case"LINEAR":default:return V.renderLinearGradientDef(e,i,s,g,[{offset:0,color:d},{offset:1,color:p}])}}renderPattern(e,t={}){const r=t.width??260,i=t.height??160,s=t.stroke??"#1f2937",o=t.strokeWidth??1.3,a=t.background??"#ffffff",l=`${-r/2} ${-i/2} ${r} ${i}`;if(V.isSolidPattern(e))return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${r}" height="${i}">`,V.renderBackground(r,i,a),`<rect x="${-r/2}" y="${-i/2}" width="${r}" height="${i}" fill="${s}" />`,"</svg>"].join("");const c=V.estimateUnitScale(e),d=Math.min(r,i)*.18/Math.max(c,V.EPSILON),p={...e,lines:e.lines.map(m=>({...m,originX:m.originX*d,originY:m.originY*d,deltaX:m.deltaX*d,deltaY:m.deltaY*d,dashes:m.dashes.map(y=>y*d)}))},g=Math.hypot(r,i)*.75,f=p.lines.map(m=>V.renderFamily(m,g)).join("");return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${r}" height="${i}">`,V.renderBackground(r,i,a),`<g stroke="${s}" stroke-width="${o.toFixed(2)}" stroke-linecap="round">`,f,"</g>","</svg>"].join("")}renderGradient(e,t={}){const r=t.width??260,i=t.height??160,s=t.background??"#ffffff",o=t.angle??0,a=t.shift??0,l=`${-r/2} ${-i/2} ${r} ${i}`,c=V.nextGradientId(e),h=V.resolveGradientColors(t),d=V.renderGradientDef(c,e,h,o,a,r,i);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${r}" height="${i}">`,V.renderBackground(r,i,s),"<defs>",d,"</defs>",`<rect x="${-r/2}" y="${-i/2}" width="${r}" height="${i}" fill="url(#${c})" />`,"</svg>"].join("")}};V.EPSILON=1e-9,V.gradientIdCounter=0;let Es=V;class wt extends Ge{constructor(e){super(),this.database=e,this.objectId=e.generateHandle(),this.ownerId=e.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,r=>this.hasId(r));const t=this.normalizeName(e.name);this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this.normalizeName(e),r=this._recordsByName.get(t);return r?(this._recordsById.delete(r.objectId),this._recordsByName.delete(t),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(this.normalizeName(t.name)),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){const t=this.normalizeName(e);return this._recordsByName.has(t)}hasId(e){return this._recordsById.has(e)}getAt(e){const t=this.normalizeName(e);return this._recordsByName.get(t)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){return this._recordsById.get(e)}newIterator(){return new _r(this._recordsByName)}normalizeName(e){return e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbSymbolTable"),e.writeInt16(70,this.numEntries),this}}class uc extends wt{constructor(e){super(e)}get modelSpace(){let e=this.getAt(se.MODEL_SPACE_NAME);return e||(e=new se,e.name=se.MODEL_SPACE_NAME,this.add(e)),e}getEntityById(e){for(const t of this.database.tables.blockTable.newIterator()){const r=t.getIdAt(e);if(r)return r}}removeEntity(e){let t=!1;for(const r of this.database.tables.blockTable.newIterator())if(r.removeEntity(e)){t=!0;break}return t}normalizeName(e){let t=e;if(se.isModelSapceName(e))t=se.MODEL_SPACE_NAME;else if(se.isPaperSapceName(e)){const r=se.PAPER_SPACE_NAME_PREFIX,i=e.substring(r.length);t=r+i}return t}}class gc extends wt{constructor(e){super(e)}}var pc=(n=>(n[n.Center=0]="Center",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.OverFirst=3]="OverFirst",n[n.OverSecond=4]="OverSecond",n))(pc||{}),fc=(n=>(n[n.Center=0]="Center",n[n.Above=1]="Above",n[n.Outside=2]="Outside",n[n.JIS=3]="JIS",n[n.Below=4]="Below",n))(fc||{}),mc=(n=>(n[n.Feet=0]="Feet",n[n.None=1]="None",n[n.Inch=2]="Inch",n[n.FeetAndInch=3]="FeetAndInch",n[n.Leading=4]="Leading",n[n.Trailing=8]="Trailing",n[n.LeadingAndTrailing=12]="LeadingAndTrailing",n))(mc||{}),yc=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(yc||{}),_c=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(_c||{});const Ni=class Ni extends Xt{constructor(e,t){e=e||{},fr(e,Ni.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}dxfOutFields(e){super.dxfOutFields(e);const t=this.database.tables.textStyleTable.getAt(this.dimtxsty),r=this.database.tables.blockTable.getAt(this.dimldrblk),i=this.database.tables.blockTable.getAt(this.dimblk),s=this.database.tables.blockTable.getAt(this.dimblk1),o=this.database.tables.blockTable.getAt(this.dimblk2);return e.writeSubclassMarker("AcDbDimStyleTableRecord"),e.writeString(2,this.name),e.writeInt16(70,0),e.writeString(3,this.dimpost),e.writeString(4,this.dimapost),e.writeDouble(40,this.dimscale),e.writeDouble(41,this.dimasz),e.writeDouble(42,this.dimexo),e.writeDouble(43,this.dimdli),e.writeDouble(44,this.dimexe),e.writeDouble(140,this.dimtxt),e.writeDouble(147,this.dimgap),e.writeInt16(170,this.dimalt),e.writeInt16(171,this.dimtol),e.writeInt16(172,this.dimlim),e.writeInt16(173,this.dimtih),e.writeInt16(174,this.dimtoh),e.writeObjectId(340,t==null?void 0:t.objectId),e.writeObjectId(341,r==null?void 0:r.objectId),e.writeObjectId(342,i==null?void 0:i.objectId),e.writeObjectId(343,s==null?void 0:s.objectId),e.writeObjectId(344,o==null?void 0:o.objectId),e.writeInt16(371,this.dimlwd),e.writeInt16(372,this.dimlwe),this}};Ni.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:ae,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let on=Ni;class bc extends wt{constructor(e){super(e)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class Bi extends Xt{constructor(e,t){e=e||{},fr(e,{color:new R,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new te,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(r=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:r.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e.clone())}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineStyle(){var t;const e=(t=this.database)==null?void 0:t.tables.linetypeTable.getAt(this.linetype);if(e)return{type:"UserSpecified",...e.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLayerTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.standardFlags),e.writeCmColor(this.color),e.writeString(6,this.linetype),e.writeInt16(290,this.isPlottable?1:0),e.writeInt16(370,this.lineWeight),e.writeTransparency(this.transparency),this.description&&e.writeString(4,this.description),this}}class xc extends wt{constructor(e){super(e)}}class Ot extends Xt{constructor(e){super(),this.name=e.name,this._linetype=e}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(e){if(e<0||e>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[e].elementLength}toPreviewSvgString(e){const t=Math.max((e==null?void 0:e.width)??220,1),r=Math.max((e==null?void 0:e.height)??36,1),i=Math.min(Math.max((e==null?void 0:e.padding)??8,0),Math.floor(t/2)),s=Math.max((e==null?void 0:e.strokeWidth)??2,.5),o=this.escapeSvgAttribute((e==null?void 0:e.stroke)??"currentColor"),a=Math.max((e==null?void 0:e.repeats)??4,1),l=r/2,c=i,h=Math.max(t-i,c+1),d=h-c,p=this._linetype.pattern??[];if(p.length===0||this.patternLength<=0||!p.some(L=>L.elementLength!==0))return this.buildSvgString({width:t,height:r,stroke:o,strokeWidth:s,lineSegments:[[c,h]],dots:[],y:l});const g=[],f=[],m=d/(this.patternLength*a),y=.5,_=Math.max(s*2,2);let P=c;for(;P<h;)for(const L of p){if(P>=h)break;const S=L.elementLength;if(S===0){f.push(P),P=Math.min(P+_,h);continue}const A=Math.max(Math.abs(S)*m,y),N=Math.min(P+A,h);S>0&&N>P&&g.push([P,N]),P=N}return this.buildSvgString({width:t,height:r,stroke:o,strokeWidth:s,lineSegments:g,dots:f,y:l})}buildSvgString(e){const{width:t,height:r,stroke:i,strokeWidth:s,lineSegments:o,dots:a,y:l}=e,c=o.map(([d,p])=>`<line x1="${d.toFixed(2)}" y1="${l.toFixed(2)}" x2="${p.toFixed(2)}" y2="${l.toFixed(2)}" stroke="${i}" stroke-width="${s.toFixed(2)}" stroke-linecap="round" />`).join(""),h=a.map(d=>`<circle cx="${d.toFixed(2)}" cy="${l.toFixed(2)}" r="${(s/2).toFixed(2)}" fill="${i}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${c}${h}</svg>`}escapeSvgAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'")}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbLinetypeTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.linetype.standardFlag),e.writeString(3,this.comments),e.writeInt16(72,65),e.writeInt16(73,this.numDashes),e.writeDouble(40,this.patternLength);for(const t of this.linetype.pattern??[])e.writeDouble(49,t.elementLength),e.writeInt16(74,t.elementTypeFlag);return this}}class wc extends wt{constructor(e){super(e)}resolveAt(e){this.database.ensureTextStyleDefaults();const t=[],r=i=>{const s=i==null?void 0:i.trim();s&&!t.includes(s)&&t.push(s)};r(e),r(this.database.textstyle),r(ae),r("STANDARD");for(const i of t){const s=this.getAt(i);if(s)return s;const o=i.toUpperCase();for(const a of this.newIterator())if(a.name.toUpperCase()===o)return a}return this.newIterator().next().value??void 0}get fonts(){const e=new Set,t=i=>{if(i){const s=i.lastIndexOf(".");if(s>=0){const o=i.substring(0,s).toLowerCase();e.add(o)}else e.add(i.toLowerCase())}},r=this.newIterator();for(const i of r)t(i.fileName),t(i.bigFontFileName);return Array.from(e)}}class Fi extends Xt{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const r=t.lastIndexOf(".");return r===-1?t:t.substring(0,r)}return e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbTextStyleTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.textStyle.standardFlag),e.writeDouble(40,this.textSize),e.writeDouble(41,this.xScale),e.writeAngle(50,this.obliquingAngle),e.writeInt16(71,this.isVertical?4:this.textStyle.textGenerationFlag),e.writeDouble(42,this.priorSize),e.writeString(3,this.fileName),e.writeString(4,this.bigFontFileName),this}}class vc extends wt{constructor(e){super(e)}}const Ng=()=>({center:new E,viewDirectionFromTarget:new b(0,0,1),viewTarget:new b(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:exports.AcGiRenderMode.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new b(0,0,0),ucsXAxis:new b(1,0,0),ucsYAxis:new b(0,1,0),orthographicType:exports.AcGiOrthographicType.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:exports.AcGiDefaultLightingType.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0,aspectRatio:void 0});class so extends Xt{constructor(){super(),this._gsView=Ng(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get viewDirectionFromTarget(){return this._gsView.viewDirectionFromTarget}set viewDirectionFromTarget(e){this._gsView.viewDirectionFromTarget.copy(e)}get viewTarget(){return this._gsView.viewTarget}set viewTarget(e){this._gsView.viewTarget.copy(e)}get viewHeight(){return this._gsView.viewHeight}set viewHeight(e){this._gsView.viewHeight=e}get viewTwistAngle(){return this._gsView.viewTwistAngle}set viewTwistAngle(e){this._gsView.viewTwistAngle=e}get lensLength(){return this._gsView.lensLength}set lensLength(e){this._gsView.lensLength=e}get frontClippingPlane(){return this._gsView.frontClippingPlane}set frontClippingPlane(e){this._gsView.frontClippingPlane=e}get backClippingPlane(){return this._gsView.backClippingPlane}set backClippingPlane(e){this._gsView.backClippingPlane=e}get renderMode(){return this._gsView.renderMode}set renderMode(e){this._gsView.renderMode=e}get viewMode(){return this._gsView.viewMode}set viewMode(e){this._gsView.viewMode=e}get ucsIconSetting(){return this._gsView.ucsIconSetting}set ucsIconSetting(e){this._gsView.ucsIconSetting=e}get ucsOrigin(){return this._gsView.ucsOrigin}set ucsOrigin(e){this._gsView.ucsOrigin.copy(e)}get ucsXAxis(){return this._gsView.ucsXAxis}set ucsXAxis(e){this._gsView.ucsXAxis.copy(e)}get ucsYAxis(){return this._gsView.ucsYAxis}set ucsYAxis(e){this._gsView.ucsYAxis.copy(e)}get orthographicType(){return this._gsView.orthographicType}set orthographicType(e){this._gsView.orthographicType=e}get shadePlotSetting(){return this._gsView.shadePlotSetting}set shadePlotSetting(e){this._gsView.shadePlotSetting=e}get shadePlotObjectId(){return this._gsView.shadePlotObjectId}set shadePlotObjectId(e){this._gsView.shadePlotObjectId=e}get visualStyleObjectId(){return this._gsView.visualStyleObjectId}set visualStyleObjectId(e){this._gsView.visualStyleObjectId=e}get isDefaultLightingOn(){return this._gsView.isDefaultLightingOn}set isDefaultLightingOn(e){this._gsView.isDefaultLightingOn=e}get defaultLightingType(){return this._gsView.defaultLightingType}set defaultLightingType(e){this._gsView.defaultLightingType=e}get brightness(){return this._gsView.brightness}set brightness(e){this._gsView.brightness=e}get contrast(){return this._gsView.contrast}set contrast(e){this._gsView.contrast=e}get ambientColor(){return this._gsView.ambientColor}set ambientColor(e){this._gsView.ambientColor=e}get aspectRatio(){return this._gsView.aspectRatio}set aspectRatio(e){this._gsView.aspectRatio=e}}class Di extends so{static isActiveVportName(e){return e.toLowerCase()===lr.toLowerCase()}constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new E(0,0),this._upperRightCorner=new E(1,1),this._snapBase=new E(0,0),this._snapAngle=0,this._snapSpacing=new E(0,0),this._standardFlag=0,this._gridSpacing=new E,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this.centerPoint}set center(e){this.centerPoint=e}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewportTableRecord"),e.writeString(2,this.name),e.writeDouble(40,this.gsView.viewHeight),this.gsView.aspectRatio!=null&&Number.isFinite(this.gsView.aspectRatio)&&e.writeDouble(41,this.gsView.aspectRatio),e.writeDouble(45,this.gsView.viewHeight),e.writePoint2d(10,this.lowerLeftCorner),e.writePoint2d(11,this.upperRightCorner),e.writePoint2d(12,this.center),e.writePoint2d(13,this.snapBase),e.writePoint2d(14,this.snapIncrements),e.writePoint2d(15,this.gridIncrements),e.writeInt16(70,this.standardFlag),e.writeInt16(71,this.circleSides),e.writeDouble(42,this.gsView.lensLength),e.writePoint3d(16,this.gsView.viewDirectionFromTarget),e.writePoint3d(17,this.gsView.viewTarget),e.writeAngle(50,this.snapAngle),e.writeAngle(51,this.gsView.viewTwistAngle),e.writeInt16(61,this.gridMajor),e.writeInt16(281,this.backgroundObjectId?1:0),e.writeObjectId(332,this.backgroundObjectId),this}}class Pc extends wt{constructor(e){super(e)}normalizeName(e){return Di.isActiveVportName(e)?lr:e.toUpperCase()}}class Ac extends wt{constructor(e){super(e)}}class Ts extends Xt{constructor(e){super(),this.name=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRegAppTableRecord"),e.writeString(2,this.name),e.writeInt16(70,0),this}}class Yg extends Ge{constructor(){super({objectId:"0"}),this._drawNoPlotLayers=!0,this.events={dictObjetSet:new ie,dictObjectErased:new ie,entityAppended:new ie,entityModified:new ie,entityErased:new ie,layerAppended:new ie,layerModified:new ie,layerErased:new ie,openProgress:new ie},this._version=new Ye("AC1014"),this._angbase=0,this._angdir=0,this._aunits=ve.DecimalDegrees,this._auprec=0,this._lunits=J.Decimal,this._luprec=4,this._celtscale=1,this._cecolor=new R,this._celtype=fe,this._celweight=exports.AcGiLineWeight.ByLayer,this._cetransparency=new te,this._clayer="0",this._cmlstyle=ft,this._cmlscale=1,this._cmleaderstyle=mt,this._hpbackgroundcolor=new R(exports.AcCmColorMethod.None),this._hpcolor=this._cecolor.clone(),this._hplayer=".",this._hptransparency=new te,this._textstyle=ae,this._extents=new B,this._insunits=K.Millimeters,this._unitmode=0,this._measurement=1,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._orthomode=0,this._maxHandle=0,this._tables={appIdTable:new Ac(this),blockTable:new uc(this),dimStyleTable:new gc(this),linetypeTable:new xc(this),textStyleTable:new wc(this),viewTable:new vc(this),layerTable:new bc(this),viewportTable:new Pc(this)},this._objects={dictionary:new tn(this),imageDefinition:new tn(this),layout:new oc(this),mleaderStyle:new tn(this),mlineStyle:new tn(this),xrecord:new tn(this)}}get tables(){return this._tables}get objects(){return this._objects}get formatter(){return this._formatter??(this._formatter=new Sl(this))}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(e){const t=parseInt(e,16);!isNaN(t)&&t>this._maxHandle&&(this._maxHandle=t)}commitObjectHandle(e,t){const r=e.getAttrWithoutException("objectId");!r||e.isTemp||t&&t(r)?e.objectId=this.generateHandle():this.updateMaxHandle(r)}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this.updateSysVar(I.AUNITS,this._aunits,e??0,t=>{this._aunits=t})}get auprec(){return this._auprec}set auprec(e){this.updateSysVar(I.AUPREC,this._auprec,e??0,t=>{this._auprec=t})}get lunits(){return this._lunits}set lunits(e){this.updateSysVar(I.LUNITS,this._lunits,e??J.Decimal,t=>{this._lunits=t})}get luprec(){return this._luprec}set luprec(e){this.updateSysVar(I.LUPREC,this._luprec,e??4,t=>{this._luprec=t})}get version(){return this._version}set version(e){this.updateSysVar(I.ACADVER,this._version,new Ye(e),t=>{this._version=t})}get insunits(){return this._insunits}set insunits(e){this.updateSysVar(I.INSUNITS,this._insunits,e??4,t=>{this._insunits=t})}get unitmode(){return this._unitmode}set unitmode(e){this.updateSysVar(I.UNITMODE,this._unitmode,e??0,t=>{this._unitmode=t})}get measurement(){return this._measurement}set measurement(e){this.updateSysVar(I.MEASUREMENT,this._measurement,e??1,t=>{this._measurement=t})}get ltscale(){return this._ltscale}set ltscale(e){this.updateSysVar(I.LTSCALE,this._ltscale,e??1,t=>{this._ltscale=t})}get lwdisplay(){return this._lwdisplay}get drawNoPlotLayers(){return this._drawNoPlotLayers}isLayerDrawable(e){if(this._drawNoPlotLayers)return!0;const t=this.tables.layerTable.getAt(e);return t==null||t.isPlottable}set lwdisplay(e){this.updateSysVar(I.LWDISPLAY,this._lwdisplay,e??!1,t=>{this._lwdisplay=t})}get cecolor(){return this._cecolor}set cecolor(e){this.updateSysVar(I.CECOLOR,this._cecolor,e||0,t=>{this._cecolor=t.clone()})}get celtscale(){return this._celtscale}set celtscale(e){this.updateSysVar(I.CELTSCALE,this._celtscale,e??1,t=>{this._celtscale=t})}get celtype(){return this._celtype}set celtype(e){const t=this.normalizeLinetypeName(e??fe);this.updateSysVar(I.CELTYPE,this._celtype,t,r=>{this._celtype=r})}get celweight(){return this._celweight}set celweight(e){this.updateSysVar(I.CELWEIGHT,this._celweight,e??exports.AcGiLineWeight.ByLayer,t=>{this._celweight=t})}get cetransparency(){return this._cetransparency}set cetransparency(e){this.updateSysVar(I.CETRANSPARENCY,this._cetransparency,e??new te,t=>{this._cetransparency=t.clone()})}get clayer(){return this._clayer}set clayer(e){this.updateSysVar(I.CLAYER,this._clayer,e??"0",t=>{this._clayer=t})}get cmlstyle(){return this._cmlstyle}set cmlstyle(e){this.updateSysVar(I.CMLSTYLE,this._cmlstyle,e??ft,t=>{this._cmlstyle=t})}get cmlscale(){return this._cmlscale}set cmlscale(e){this.updateSysVar(I.CMLSCALE,this._cmlscale,e??1,t=>{this._cmlscale=t})}get cmleaderstyle(){return this._cmleaderstyle}set cmleaderstyle(e){this.updateSysVar(I.CMLEADERSTYLE,this._cmleaderstyle,e??mt,t=>{this._cmleaderstyle=t})}get hpbackgroundcolor(){return this._hpbackgroundcolor}set hpbackgroundcolor(e){this.updateSysVar(I.HPBACKGROUNDCOLOR,this._hpbackgroundcolor,e??new R(exports.AcCmColorMethod.None),t=>{this._hpbackgroundcolor=t.clone()})}get hpcolor(){return this._hpcolor}set hpcolor(e){this.updateSysVar(I.HPCOLOR,this._hpcolor,e??this._cecolor,t=>{this._hpcolor=t.clone()})}get hplayer(){return this._hplayer}set hplayer(e){this.updateSysVar(I.HPLAYER,this._hplayer,e??".",t=>{this._hplayer=t})}get hptransparency(){return this._hptransparency}set hptransparency(e){this.updateSysVar(I.HPTRANSPARENCY,this._hptransparency,e??new te,t=>{this._hptransparency=t.clone()})}get textstyle(){return this._textstyle}set textstyle(e){this.updateSysVar(I.TEXTSTYLE,this._textstyle,e??ae,t=>{this._textstyle=t})}get angbase(){return this._angbase}set angbase(e){this.updateSysVar(I.ANGBASE,this._angbase,e??0,t=>{this._angbase=t})}get angdir(){return this._angdir}set angdir(e){this.updateSysVar(I.ANGDIR,this._angdir,e??0,t=>{this._angdir=t})}get extmax(){return this._extents.max}set extmax(e){if(e){const t=this._extents.max.clone();this._extents.expandByPoint(e),this._extents.max.equals(t)||this.triggerSysVarChangedEvent(I.EXTMAX,t,this._extents.max)}}get extmin(){return this._extents.min}set extmin(e){if(e){const t=this._extents.min.clone();this._extents.expandByPoint(e),this._extents.min.equals(t)||this.triggerSysVarChangedEvent(I.EXTMIN,t,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(e){this.updateSysVar(I.PDMODE,this._pdmode,e??0,t=>{this._pdmode=t})}get pdsize(){return this._pdsize}set pdsize(e){this.updateSysVar(I.PDSIZE,this._pdsize,e??0,t=>{this._pdsize=t})}get osmode(){return this._osmode}set osmode(e){this.updateSysVar(I.OSMODE,this._osmode,e??0,t=>{this._osmode=t})}get orthomode(){return this._orthomode}set orthomode(e){this.updateSysVar(I.ORTHOMODE,this._orthomode,e??0,t=>{this._orthomode=t})}async read(e,t,r=Jn.DXF){const i=We.instance.get(r);if(i==null)throw new Error(`Database converter for file type '${r}' isn't registered and can can't read this file!`);this.clear(),this._drawNoPlotLayers=(t==null?void 0:t.drawNoPlotLayers)??!0,await i.read(e,this,t&&t.minimumChunkSize||10,async(s,o,a,l)=>{if(this.events.openProgress.dispatch({database:this,percentage:s,stage:"CONVERSION",subStage:o,subStageStatus:a,data:l}),t&&t.fontLoader&&o=="FONT"&&a=="END"){const c=l||this.tables.textStyleTable.fonts;await t.fontLoader.load(c)}},t==null?void 0:t.timeout,t==null?void 0:t.sysVars),this.ensureDatabaseDefaults()}async openUri(e,t){var g;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const r=await fetch(e);if(!r.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${e}' with HTTP status code '${r.status}'!`);const i=r.headers.get("content-length"),s=i?parseInt(i,10):null;let o=0;const a=(g=r.body)==null?void 0:g.getReader();if(!a)throw new Error("Failed to get response reader");const l=[];for(;;){const{done:f,value:m}=await a.read();if(f)break;if(l.push(m),o+=m.length,s!==null){const y=Math.round(o/s*100);this.events.openProgress.dispatch({database:this,percentage:y,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const c=new Uint8Array(o);let h=0;for(const f of l)c.set(f,h),h+=f.length;const p=this.getFileNameFromUri(e).toLowerCase().split(".").pop();p==="dwg"?await this.read(c.buffer,t,Jn.DWG):p==="dxf"?await this.read(c.buffer,t,Jn.DXF):await this.read(c.buffer,t,p),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(e,t=16,r=this.version.name,i=!1){this.ensureDatabaseDefaults();const s=r instanceof Ye?r:new Ye(r),o=new Ta({database:this,precision:t,version:s});return this.writeDxfHeaderSection(o),this.writeDxfTablesSection(o,s),this.writeDxfBlocksSection(o),this.writeDxfEntitiesSection(o),this.writeDxfObjectsSection(o),o.writeStart("EOF"),o.toString()}async regen(){await new Uh(this).read(null,this,500,async(t,r,i,s)=>{this.events.openProgress.dispatch({database:this,percentage:t,stage:"CONVERSION",subStage:r,subStageStatus:i,data:s})})}createDefaultData(e={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const t=new cc(this);e.layer&&t.createDefaultLayer(),e.lineType&&t.createDefaultLineType(),e.textStyle&&t.createDefaultTextStyle(),e.dimStyle&&t.createDefaultDimStyle(),e.layout&&t.createDefaultLayout()}ensureEntityStyleDefaults(e){var t;if(e.dxfTypeName==="MLINE"){this.ensureMLineStyle(this._cmlstyle||ft);return}if(e.dxfTypeName==="MULTILEADER"){this.ensureMLeaderStyle(this._cmleaderstyle||mt);return}if(e.dxfTypeName==="HATCH"){const r=e;(t=r.applyPatternDefaultsFromSysVars)==null||t.call(r,this)}}ensureTextStyleDefaults(){this.hasDefaultTextStyle()||this.tables.textStyleTable.add(new Fi({name:ae,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}hasDefaultTextStyle(){const e=[ae,"STANDARD"];for(const t of e)if(this.tables.textStyleTable.has(t))return!0;for(const t of this.tables.textStyleTable.newIterator())if(t.name.toUpperCase()===ae.toUpperCase())return!0;return!1}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const t=new R;t.colorIndex=7,this.tables.layerTable.add(new Bi({name:"0",standardFlags:0,linetype:Mt,lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}if(this.tables.linetypeTable.has(Ct)||this.tables.linetypeTable.add(new Ot({name:Ct,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(fe)||this.tables.linetypeTable.add(new Ot({name:fe,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Mt)||this.tables.linetypeTable.add(new Ot({name:Mt,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.ensureTextStyleDefaults(),this.tables.dimStyleTable.has(ae)||this.tables.dimStyleTable.add(new on({name:ae,dimtxsty:ae})),!this.tables.viewportTable.has(lr)){const t=new Di;t.name=lr,this.tables.viewportTable.add(t)}this.ensureMLineStyle(this._cmlstyle||ft),this.ensureMLeaderStyle(this._cmleaderstyle||mt);const e=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const t=new br;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=e.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.objects.layout.setAt(t.layoutName,t),e.layoutId=t.objectId}this.tables.appIdTable.has(vs)||this.tables.appIdTable.add(new Ts(vs)),this.tables.appIdTable.has(ws)||this.tables.appIdTable.add(new Ts(ws))}ensureMLineStyle(e){const t=this.objects.mlineStyle,r=e.trim();if(!r||t.getAt(r))return;for(const[s,o]of t.entries())if(s.toUpperCase()===r.toUpperCase()||o.styleName.toUpperCase()===r.toUpperCase())return;const i=new eo;i.styleName=r,i.elements=[{offset:.5,color:new R().setByLayer(),lineType:fe},{offset:-.5,color:new R().setByLayer(),lineType:fe}],t.setAt(r,i)}ensureMLeaderStyle(e){const t=this.objects.mleaderStyle,r=e.trim();if(!r||t.getAt(r))return;for(const[a]of t.entries())if(a.toUpperCase()===r.toUpperCase())return;const i=new Js;i.unknown1=2,i.maxLeaderSegmentsPoints=2,i.leaderLineColor=new R().setByBlock(),i.textColor=new R().setByBlock(),i.blockColor=new R().setByBlock(),i.alignSpace=4,i.breakSize=3.75,i.enableBlockRotation=!0,i.unknown2=!1;const s=this.tables.linetypeTable.getAt(Ct);i.leaderLineTypeId=s==null?void 0:s.objectId;const o=this.tables.textStyleTable.getAt(ae);i.textStyleId=o==null?void 0:o.objectId,t.setAt(r,i)}writeDxfHeaderSection(e){var t;e.startSection("HEADER"),e.writeString(9,"$ACADVER"),e.writeString(1,((t=e.version)==null?void 0:t.name)??this.version.name),e.writeString(9,"$HANDSEED"),e.writeString(5,e.nextHandle.toString(16).toUpperCase()),e.version!=null&&e.version.value>=27&&(e.writeString(9,"$DWGCODEPAGE"),e.writeString(3,"UTF-8")),e.writeString(9,"$INSUNITS"),e.writeInt16(70,this.insunits),e.writeString(9,"$LUNITS"),e.writeInt16(70,this.lunits),e.writeString(9,"$LUPREC"),e.writeInt16(70,this.luprec),e.writeString(9,"$UNITMODE"),e.writeInt16(70,this.unitmode),e.writeString(9,"$MEASUREMENT"),e.writeInt16(70,this.measurement),e.writeString(9,"$LTSCALE"),e.writeDouble(40,this.ltscale),e.writeString(9,"$LWDISPLAY"),e.writeInt16(70,this.lwdisplay?1:0),e.writeString(9,"$CLAYER"),e.writeString(8,this.clayer),e.writeString(9,"$CELTYPE"),e.writeString(6,this.celtype),this.cetransparency.isInvalid||(e.writeString(9,"$CETRANSPARENCY"),e.writeTransparency(this.cetransparency)),e.writeString(9,"$CMLSTYLE"),e.writeString(2,this.cmlstyle),e.writeString(9,"$CMLSCALE"),e.writeDouble(40,this.cmlscale),e.writeString(9,"$CMLEADERSTYLE"),e.writeString(2,this.cmleaderstyle),this.hpcolor.colorMethod!==exports.AcCmColorMethod.None&&(e.writeString(9,"$HPCOLOR"),e.writeCmColor(this.hpcolor,2)),this.hpbackgroundcolor.colorMethod!==exports.AcCmColorMethod.None&&(e.writeString(9,"$HPBACKGROUNDCOLOR"),e.writeCmColor(this.hpbackgroundcolor,2)),e.writeString(9,"$HPLAYER"),e.writeString(8,this.hplayer),this.hptransparency.isInvalid||(e.writeString(9,"$HPTRANSPARENCY"),e.writeTransparency(this.hptransparency)),e.writeString(9,"$TEXTSTYLE"),e.writeString(7,this.textstyle),e.writeString(9,"$ANGBASE"),e.writeAngle(50,this.angbase),e.writeString(9,"$ANGDIR"),e.writeInt16(70,this.angdir),e.writeString(9,"$AUNITS"),e.writeInt16(70,this.aunits),e.writeString(9,"$AUPREC"),e.writeInt16(70,this.auprec),e.writeString(9,"$EXTMIN"),e.writePoint3d(10,this.extmin),e.writeString(9,"$EXTMAX"),e.writePoint3d(10,this.extmax),e.writeString(9,"$PDMODE"),e.writeInt32(70,this.pdmode),e.writeString(9,"$PDSIZE"),e.writeDouble(40,this.pdsize),e.writeString(9,"$OSMODE"),e.writeInt32(70,this.osmode),e.writeString(9,"$ORTHOMODE"),e.writeInt16(70,this.orthomode),e.endSection()}writeDxfTablesSection(e,t){e.startSection("TABLES"),this.writeDxfTable(e,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(e,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(e,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(e,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(e,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(),"STYLE"),this.writeDxfTable(e,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(e,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),t.value>=19&&this.writeDxfTable(e,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),e.endSection()}writeDxfBlocksSection(e){e.startSection("BLOCKS");for(const t of this.tables.blockTable.newIterator()){if(t.dxfOutBlockBegin(e),!t.isModelSapce&&!t.isPaperSapce)for(const r of t.newIterator())this.writeDxfEntity(e,r);t.dxfOutBlockEnd(e)}e.endSection()}writeDxfEntitiesSection(e){e.startSection("ENTITIES");for(const t of this.tables.blockTable.newIterator())if(!(!t.isModelSapce&&!t.isPaperSapce))for(const r of t.newIterator())this.writeDxfEntity(e,r);e.endSection()}writeDxfObjectsSection(e){e.startSection("OBJECTS");const t=this.objects.dictionary;t.ownerId="0";const r=o=>{e.writeStart("DICTIONARY"),o.dxfOut(e)},i=(o,a)=>{t.getAt(o)!==a&&t.setAt(o,a)},s=o=>{t.getAt(o)&&t.remove(o)};i("ACAD_LAYOUT",this.objects.layout),this.objects.mleaderStyle.numEntries>0?i("ACAD_MLEADERSTYLE",this.objects.mleaderStyle):s("ACAD_MLEADERSTYLE"),this.objects.mlineStyle.numEntries>0?i("ACAD_MLINESTYLE",this.objects.mlineStyle):s("ACAD_MLINESTYLE"),this.objects.imageDefinition.numEntries>0?i("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):s("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?i("MLIGHT_XRECORD",this.objects.xrecord):s("MLIGHT_XRECORD"),r(t),r(this.objects.layout),this.objects.mleaderStyle.numEntries>0&&r(this.objects.mleaderStyle),this.objects.mlineStyle.numEntries>0&&r(this.objects.mlineStyle),this.objects.imageDefinition.numEntries>0&&r(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&r(this.objects.xrecord);for(const[o,a]of this.objects.layout.entries())e.writeStart("LAYOUT"),a.dxfOut(e);for(const[o,a]of this.objects.imageDefinition.entries())e.writeStart("IMAGEDEF"),a.dxfOut(e);for(const[o,a]of this.objects.mleaderStyle.entries())e.writeStart("MLEADERSTYLE"),a.dxfOut(e);for(const[o,a]of this.objects.mlineStyle.entries())e.writeStart("MLINESTYLE"),a.dxfOut(e);for(const[o,a]of this.objects.xrecord.entries())e.writeStart("XRECORD"),a.dxfOut(e);e.endSection()}writeDxfTable(e,t,r,i,s){const o=[...i];e.startTable(t),r.dxfOut(e);for(const a of o){if(s==="BLOCK_RECORD"&&a instanceof se){a.dxfOutBlockRecord(e);continue}e.writeStart(s),a.dxfOut(e)}e.endTable()}writeDxfEntity(e,t){e.writeStart(t.dxfTypeName),t.dxfOut(e)}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.viewTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._objects.layout.removeAll(),this._objects.imageDefinition.removeAll(),this._objects.mleaderStyle.removeAll(),this._objects.mlineStyle.removeAll(),this._objects.xrecord.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(e,t,r,i){this.hasSysVarValueChanged(t,r)&&(i(r),this.triggerSysVarChangedEvent(e,t,r))}hasSysVarValueChanged(e,t){return e instanceof R&&t instanceof R||e instanceof te&&t instanceof te?!e.equals(t):e instanceof Ye&&t instanceof Ye?e.value!==t.value:!Object.is(e,t)}normalizeLinetypeName(e){const t=e.trim();return t.toUpperCase()==="BYLAYER"?fe:t.toUpperCase()==="BYBLOCK"?Ct:t}triggerSysVarChangedEvent(e,t,r){const i=Xe.instance(),s=e.toLowerCase();i.getDescriptor(s)!=null&&i.events.sysVarChanged.dispatch({database:this,name:s,oldVal:t,newVal:r})}getFileNameFromUri(e){try{const r=new URL(e).pathname.split("/");return r[r.length-1]||""}catch{return""}}}const Sc="Load Database",ua=3e4,Xg=12e4,Rg=1024*1024;class we extends Sa{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=ks.getInstance().getEntry(Sc),r=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const i=await this.data.task(e);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",i?i.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),t&&(t.data[this.name]=Date.now()-r),i}}class oo{constructor(e={}){this.config=e}async read(e,t,r,i,s,o){const a={name:Sc,data:{total:0},format(){let d="";return Object.keys(this.data).forEach(p=>{p!=="total"&&(d+=`- ${p}: ${this.data[p]} ms
|
|
9
|
+
`)}),d+=`- total: ${this.data.total} ms`,d}};ks.getInstance().collect(a),this.progress=i;const l={value:0},c=new La;c.setCompleteCallback(()=>this.onFinished()),c.setErrorCallback(d=>this.onError(d)),c.addTask(new we({stage:"START",step:1,progress:l,task:async d=>d},i)),c.addTask(new we({stage:"PARSE",step:5,progress:l,task:async d=>await this.parse(d,s)},i)),c.addTask(new we({stage:"FONT",step:5,progress:l,task:async d=>{const p=this.getFonts(d.model);return{model:d.model,data:p}}},i)),c.addTask(new we({stage:"LTYPE",step:1,progress:l,task:async d=>(this.processLineTypes(d.model,t),d)},i)),c.addTask(new we({stage:"STYLE",step:1,progress:l,task:async d=>(this.processTextStyles(d.model,t),d)},i)),c.addTask(new we({stage:"DIMSTYLE",step:1,progress:l,task:async d=>(this.processDimStyles(d.model,t),d)},i)),c.addTask(new we({stage:"LAYER",step:1,progress:l,task:async d=>(this.processLayers(d.model,t),t.tables.layerTable.numEntries===0&&t.createDefaultData({layer:!0}),d)},i)),c.addTask(new we({stage:"VPORT",step:1,progress:l,task:async d=>(this.processViewports(d.model,t),d)},i)),c.addTask(new we({stage:"HEADER",step:1,progress:l,task:async d=>{if(this.processHeader(d.model,t),o){const p=Xe.instance();for(const[g,f]of Object.entries(o))p.setVar(g,f,t)}return d}},i)),c.addTask(new we({stage:"BLOCK_RECORD",step:5,progress:l,task:async d=>(this.processBlockTables(d.model,t),d)},i)),c.addTask(new we({stage:"OBJECT",step:5,progress:l,task:async d=>(this.processObjects(d.model,t),t.objects.layout.numEntries===0&&t.createDefaultData({layout:!0}),d)},i)),c.addTask(new we({stage:"BLOCK",step:5,progress:l,task:async d=>(await this.processBlocks(d.model,t),d)},i)),c.addTask(new we({stage:"ENTITY",step:100,progress:l,task:async d=>(await this.processEntities(d.model,t,r,l,i),d)},i)),c.addTask(new we({stage:"END",step:0,progress:l,task:async d=>d},i));const h=Date.now();await c.run(e),a.data.total=Date.now()-h}onError(e){if(this.progress){const t=e.task;this.progress(t.data.progress.value,t.data.stage,"ERROR",void 0,e)}return e.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),an.instance.clear())}getParserWorkerTimeout(e,t){const r=t??this.config.timeout;if(r!=null)return r;const i=Math.ceil(e.byteLength/Rg),s=ua+i*1e3;return Math.min(Xg,Math.max(ua,s))}async parse(e,t){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,r,i,s){throw new Error("Not impelemented yet!")}}class Bg extends so{constructor(){super(),this._standardFlags=0,this._viewWidth=this.viewHeight,this._ucsAssociated=!1,this._cameraPlottable=!1,this._ucsElevation=0}get standardFlags(){return this._standardFlags}set standardFlags(e){this._standardFlags=e}get viewWidth(){return this._viewWidth}set viewWidth(e){this._viewWidth=e}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(e){this._ucsAssociated=e}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(e){this._cameraPlottable=e}get ucsElevation(){return this._ucsElevation}set ucsElevation(e){this._ucsElevation=e}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(e){this._ucsObjectId=e}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(e){this._ucsBaseObjectId=e}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(e){this._liveSectionObjectId=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.standardFlags),e.writeDouble(40,this.gsView.viewHeight),e.writePoint2d(10,this.centerPoint),e.writeDouble(41,this.viewWidth),e.writePoint3d(11,this.gsView.viewDirectionFromTarget),e.writePoint3d(12,this.gsView.viewTarget),e.writeDouble(42,this.gsView.lensLength),e.writeDouble(43,this.gsView.frontClippingPlane),e.writeDouble(44,this.gsView.backClippingPlane),e.writeAngle(50,this.gsView.viewTwistAngle),e.writeInt16(71,this.gsView.viewMode),e.writeInt16(281,this.gsView.renderMode),e.writeInt16(72,this.ucsAssociated?1:0),e.writeInt16(73,this.cameraPlottable?1:0),e.writeObjectId(332,this.backgroundObjectId),e.writeObjectId(334,this.liveSectionObjectId),e.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(e.writePoint3d(110,this.gsView.ucsOrigin),e.writePoint3d(111,this.gsView.ucsXAxis),e.writePoint3d(112,this.gsView.ucsYAxis),e.writeInt16(79,this.gsView.orthographicType),e.writeDouble(146,this.ucsElevation),e.writeObjectId(345,this.ucsObjectId),e.writeObjectId(346,this.ucsBaseObjectId)),this}}var ce,On,Q,re,kn,De,Ft,Ze,ye,Qe,ze,Dt,zt,Vt,Le,Je,Nn,Yn,jt,Gt,Xn,Rn,Bn,Ie,et,$,Ht,Fn,Y,_e,Dn,be,zn,tt,W,Vn,nt,Wt,ts,ns,Ve,jn,Ut,Ee,rt,it,st,Gn,Hn,ot,$t,qt,rs,Wn,Kt,at,Zt,he,lt,Te,is,de,ss,ct,Ce,Qt,Un,Jt,Me,ht,Oe,dt,os,en,ke;(ce={})[ce.None=0]="None",ce[ce.Anonymous=1]="Anonymous",ce[ce.NonConstant=2]="NonConstant",ce[ce.Xref=4]="Xref",ce[ce.XrefOverlay=8]="XrefOverlay",ce[ce.ExternallyDependent=16]="ExternallyDependent",ce[ce.ResolvedOrDependent=32]="ResolvedOrDependent",ce[ce.ReferencedXref=64]="ReferencedXref";(On={})[On.BYBLOCK=0]="BYBLOCK",On[On.BYLAYER=256]="BYLAYER";(Q={})[Q.Rotated=0]="Rotated",Q[Q.Aligned=1]="Aligned",Q[Q.Angular=2]="Angular",Q[Q.Diameter=3]="Diameter",Q[Q.Radius=4]="Radius",Q[Q.Angular3Point=5]="Angular3Point",Q[Q.Ordinate=6]="Ordinate",Q[Q.ReferenceIsExclusive=32]="ReferenceIsExclusive",Q[Q.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Q[Q.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(re={})[re.TopLeft=1]="TopLeft",re[re.TopCenter=2]="TopCenter",re[re.TopRight=3]="TopRight",re[re.MiddleLeft=4]="MiddleLeft",re[re.MiddleCenter=5]="MiddleCenter",re[re.MiddleRight=6]="MiddleRight",re[re.BottomLeft=7]="BottomLeft",re[re.BottomCenter=8]="BottomCenter",re[re.BottomRight=9]="BottomRight";(kn={})[kn.AtLeast=1]="AtLeast",kn[kn.Exact=2]="Exact";var ga=((De={})[De.Center=0]="Center",De[De.Above=1]="Above",De[De.Outside=2]="Outside",De[De.JIS=3]="JIS",De[De.Below=4]="Below",De);(Ft={})[Ft.WithDimension=0]="WithDimension",Ft[Ft.AddLeader=1]="AddLeader",Ft[Ft.Independent=2]="Independent";(Ze={})[Ze.BothOutside=0]="BothOutside",Ze[Ze.ArrowFirst=1]="ArrowFirst",Ze[Ze.TextFirst=2]="TextFirst",Ze[Ze.Auto=3]="Auto";var pn=((ye={})[ye.Feet=0]="Feet",ye[ye.None=1]="None",ye[ye.Inch=2]="Inch",ye[ye.FeetAndInch=3]="FeetAndInch",ye[ye.Leading=4]="Leading",ye[ye.Trailing=8]="Trailing",ye[ye.LeadingAndTrailing=12]="LeadingAndTrailing",ye),Fg=((Qe={})[Qe.None=0]="None",Qe[Qe.Leading=1]="Leading",Qe[Qe.Trailing=2]="Trailing",Qe[Qe.LeadingAndTrailing=3]="LeadingAndTrailing",Qe),Dg=((ze={})[ze.Center=0]="Center",ze[ze.First=1]="First",ze[ze.Second=2]="Second",ze[ze.OverFirst=3]="OverFirst",ze[ze.OverSecond=4]="OverSecond",ze),zg=((Dt={})[Dt.Bottom=0]="Bottom",Dt[Dt.Center=1]="Center",Dt[Dt.Top=2]="Top",Dt);(zt={})[zt.None=0]="None",zt[zt.UseDrawingBackground=1]="UseDrawingBackground",zt[zt.Custom=2]="Custom";(Vt={})[Vt.Horizontal=0]="Horizontal",Vt[Vt.Diagonal=1]="Diagonal",Vt[Vt.NotStacked=2]="NotStacked";(Le={})[Le.Scientific=1]="Scientific",Le[Le.Decimal=2]="Decimal",Le[Le.Engineering=3]="Engineering",Le[Le.Architectural=4]="Architectural",Le[Le.Fractional=5]="Fractional",Le[Le.WindowDesktop=6]="WindowDesktop";(Je={})[Je.Decimal=0]="Decimal",Je[Je.DegreesMinutesSecond=1]="DegreesMinutesSecond",Je[Je.Gradian=2]="Gradian",Je[Je.Radian=3]="Radian";var Vg=((Nn={})[Nn.PatternFill=0]="PatternFill",Nn[Nn.SolidFill=1]="SolidFill",Nn);(Yn={})[Yn.NonAssociative=0]="NonAssociative",Yn[Yn.Associative=1]="Associative";(jt={})[jt.Normal=0]="Normal",jt[jt.Outer=1]="Outer",jt[jt.Ignore=2]="Ignore";(Gt={})[Gt.UserDefined=0]="UserDefined",Gt[Gt.Predefined=1]="Predefined",Gt[Gt.Custom=2]="Custom";(Xn={})[Xn.NotAnnotated=0]="NotAnnotated",Xn[Xn.Annotated=1]="Annotated";(Rn={})[Rn.Solid=0]="Solid",Rn[Rn.Gradient=1]="Gradient";(Bn={})[Bn.TwoColor=0]="TwoColor",Bn[Bn.OneColor=1]="OneColor";var jg=((Ie={})[Ie.Default=0]="Default",Ie[Ie.External=1]="External",Ie[Ie.Polyline=2]="Polyline",Ie[Ie.Derived=4]="Derived",Ie[Ie.Textbox=8]="Textbox",Ie[Ie.Outermost=16]="Outermost",Ie),Or=((et={})[et.Line=1]="Line",et[et.Circular=2]="Circular",et[et.Elliptic=3]="Elliptic",et[et.Spline=4]="Spline",et),Gg=(($={})[$.Off=0]="Off",$[$.Solid=1]="Solid",$[$.Dashed=2]="Dashed",$[$.Dotted=3]="Dotted",$[$.ShotDash=4]="ShotDash",$[$.MediumDash=5]="MediumDash",$[$.LongDash=6]="LongDash",$[$.DoubleShortDash=7]="DoubleShortDash",$[$.DoubleMediumDash=8]="DoubleMediumDash",$[$.DoubleLongDash=9]="DoubleLongDash",$[$.DoubleMediumLongDash=10]="DoubleMediumLongDash",$[$.SparseDot=11]="SparseDot",$);Gg.Off;(Ht={})[Ht.Standard=-3]="Standard",Ht[Ht.ByLayer=-2]="ByLayer",Ht[Ht.ByBlock=-1]="ByBlock";(Fn={})[Fn.English=0]="English",Fn[Fn.Metric=1]="Metric";(Y={})[Y.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",Y[Y.FRONT_CLIPPING=2]="FRONT_CLIPPING",Y[Y.BACK_CLIPPING=4]="BACK_CLIPPING",Y[Y.UCS_FOLLOW=8]="UCS_FOLLOW",Y[Y.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",Y[Y.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",Y[Y.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",Y[Y.FAST_ZOOM=128]="FAST_ZOOM",Y[Y.SNAP_MODE=256]="SNAP_MODE",Y[Y.GRID_MODE=512]="GRID_MODE",Y[Y.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",Y[Y.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",Y[Y.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",Y[Y.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",Y[Y.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",Y[Y.UNUSED=32768]="UNUSED",Y[Y.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",Y[Y.VIEWPORT_OFF=131072]="VIEWPORT_OFF",Y[Y.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",Y[Y.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",Y[Y.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",Y[Y.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(_e={})[_e.OPTIMIZED_2D=0]="OPTIMIZED_2D",_e[_e.WIREFRAME=1]="WIREFRAME",_e[_e.HIDDEN_LINE=2]="HIDDEN_LINE",_e[_e.FLAT_SHADED=3]="FLAT_SHADED",_e[_e.GOURAUD_SHADED=4]="GOURAUD_SHADED",_e[_e.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",_e[_e.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(Dn={})[Dn.UCS_UNCHANGED=0]="UCS_UNCHANGED",Dn[Dn.HAS_OWN_UCS=1]="HAS_OWN_UCS";(be={})[be.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",be[be.TOP=1]="TOP",be[be.BOTTOM=2]="BOTTOM",be[be.FRONT=3]="FRONT",be[be.BACK=4]="BACK",be[be.LEFT=5]="LEFT",be[be.RIGHT=6]="RIGHT";(zn={})[zn.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",zn[zn.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(tt={})[tt.ByLayer=0]="ByLayer",tt[tt.ByBlock=1]="ByBlock",tt[tt.ByDictionaryDefault=2]="ByDictionaryDefault",tt[tt.ByObject=3]="ByObject";(W={})[W.NotAllowed=0]="NotAllowed",W[W.AllowErase=1]="AllowErase",W[W.AllowTransform=2]="AllowTransform",W[W.AllowChangeColor=4]="AllowChangeColor",W[W.AllowChangeLayer=8]="AllowChangeLayer",W[W.AllowChangeLinetype=16]="AllowChangeLinetype",W[W.AllowChangeLinetypeScale=32]="AllowChangeLinetypeScale",W[W.AllowChangeVisibility=64]="AllowChangeVisibility",W[W.AllowClone=128]="AllowClone",W[W.AllowChangeLineweight=256]="AllowChangeLineweight",W[W.AllowChangePlotStyleName=512]="AllowChangePlotStyleName",W[W.AllowAllExceptClone=895]="AllowAllExceptClone",W[W.AllowAll=1023]="AllowAll",W[W.DisableProxyWarning=1024]="DisableProxyWarning",W[W.R13FormatProxy=32768]="R13FormatProxy";function X(n,e,t){return n.code===e&&(t==null||n.value===t)}function Yt(n){let e={};n.rewind();let t=n.next(),r=t.code;if(e.x=t.value,(t=n.next()).code!==r+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=n.next()).code!==r+20?n.rewind():e.z=t.value,e}let xr=Symbol();function k(n,e){return(t,r,i)=>{let s=function(l,c=!1){return l.reduce((h,d)=>{d.pushContext&&h.push({});let p=h[h.length-1];for(let g of typeof d.code=="number"?[d.code]:d.code){let f=p[g]??(p[g]=[]);d.isMultiple&&f.length,f.push(d)}return h},[{}])}(n,r.debug),o=!1,a=s.length-1;for(;!X(t,0,"EOF");){let l=function(y,_,P){return y.find((L,S)=>{var A;return S>=P&&((A=L[_])==null?void 0:A.length)})}(s,t.code,a),c=l==null?void 0:l[t.code],h=c==null?void 0:c[c.length-1];if(!l||!h){r.rewind();break}h.isMultiple||l[t.code].pop();let{name:d,parser:p,isMultiple:g,isReducible:f}=h,m=p==null?void 0:p(t,r,i);if(m===xr){r.rewind();break}if(d){let[y,_]=Hg(i,d);g&&!f?(Object.prototype.hasOwnProperty.call(y,_)||(y[_]=[]),y[_].push(m)):y[_]=m}h.pushContext&&(a-=1),o=!0,t=r.next()}return e&&Object.setPrototypeOf(i,e),o}}function Hg(n,e){let t=e.split(".");if(!t.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let r=n;for(let i=0;i<t.length-1;++i){let s=as(t[i]),o=as(t[i+1]);Object.prototype.hasOwnProperty.call(r,s)||(typeof o=="number"?r[s]=[]:r[s]={}),r=r[s]}return[r,as(t[t.length-1])]}function as(n){let e=Number.parseInt(n);return Number.isNaN(e)?n:e}function u({value:n}){return n}function w(n,e){return Yt(e)}function O({value:n}){return!!n}function Wg({value:n}){return n.trim()}let Ug=[{code:281,name:"isEntity",parser:O},{code:280,name:"wasProxy",parser:O},{code:91,name:"instanceCount",parser:u},{code:90,name:"proxyFlag",parser:u},{code:3,name:"appName",parser:u},{code:2,name:"cppClassName",parser:u},{code:1,name:"name",parser:u}],$g=k(Ug),qg=[{code:0,name:"classes",isMultiple:!0,parser(n,e){if(n.value!=="CLASS")return xr;n=e.next();let t={};return $g(n,e,t),t}}],Kg=k(qg);(Vn={})[Vn.RayTrace=0]="RayTrace",Vn[Vn.ShadowMap=1]="ShadowMap";function qe(n,e,t){for(;X(n,102);){var r;let i=n.value;if(n=e.next(),!i.startsWith("{")){e.debug,function(o,a){for(;!X(o,102)&&!X(o,0,"EOF");)o=a.next()}(n,e),n=e.next();continue}let s=i.slice(1).trim();t.extensions??(t.extensions={}),(r=t.extensions)[s]??(r[s]=[]),function(o,a,l){for(;!X(o,102,"}")&&!X(o,0,"EOF");)l.push(o),o=a.next()}(n,e,t.extensions[s]),n=e.next()}e.rewind()}let Zg=[{code:1001,name:"xdata",isMultiple:!0,parser:Lc}],Qg=new Set([1010,1011,1012,1013]);function Lc(n,e){var i;if(!X(n,1001))throw Error("XData must starts with code 1001");let t={appName:n.value,value:[]};n=e.next();let r=[t.value];for(;!X(n,0,"EOF")&&!X(n,1001)&&n.code>=1e3;){let s=r[r.length-1];if(n.code===1002){n.value==="{"?r.push([]):(r.pop(),(i=r[r.length-1])==null||i.push(s)),n=e.next();continue}Qg.has(n.code)?s.push(Yt(e)):s.push(n.value),n=e.next()}return e.rewind(),t}(nt={})[nt.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",nt[nt.CAST=1]="CAST",nt[nt.RECEIVE=2]="RECEIVE",nt[nt.IGNORE=3]="IGNORE";let j=[...Zg,{code:284,name:"shadowMode",parser:u},{code:390,name:"plotStyleHardId",parser:u},{code:380,name:"plotStyleType",parser:u},{code:440,name:"transparency",parser:u},{code:430,name:"colorName",parser:u},{code:420,name:"color",parser:u},{code:310,name:"proxyEntity",isMultiple:!0,isReducible:!0,parser:(n,e,t)=>(t.proxyEntity??"")+n.value},{code:[92,160],name:"proxyByte",parser:u},{code:60,name:"isVisible",parser:O},{code:48,name:"lineTypeScale",parser:u},{code:370,name:"lineweight",parser:u},{code:62,name:"colorIndex",parser:u},{code:347,name:"materialObjectHardId",parser:u},{code:6,name:"lineType",parser:u},{code:8,name:"layer",parser:u},{code:410,name:"layoutTabName",parser:u},{code:67,name:"isInPaperSpace",parser:O},{code:100},{code:330,name:"ownerBlockRecordSoftId",parser:u},{code:102,parser:qe},{code:102,parser:qe},{code:102,parser:qe},{code:5,name:"handle",parser:u}];function zi(n){return[{code:3,name:n,parser:(e,t,r)=>(r._code3text=(r._code3text??"")+e.value,r._code3text+(r._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:n,parser:(e,t,r)=>(r._code1text=e.value,(r._code3text??"")+r._code1text)}]}function Ic(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Jg={extrusionDirection:{x:0,y:0,z:1}},ep=[{code:210,name:"extrusionDirection",parser:w},{code:51,name:"endAngle",parser:u},{code:50,name:"startAngle",parser:u},{code:100,name:"subclassMarker",parser:u},{code:40,name:"radius",parser:u},{code:10,name:"center",parser:w},{code:39,name:"thickness",parser:u},{code:100},...j];class Ec{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Ic(this,"parser",k(ep,Jg))}}Ic(Ec,"ForEntityName","ARC");(Wt={})[Wt.BeforeText=0]="BeforeText",Wt[Wt.AboveText=1]="AboveText",Wt[Wt.None=2]="None";let ao=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4,defaultValue:""},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMFXL",code:49,defaultValue:1},{name:"DIMJOGANG",code:50,defaultValue:45},{name:"DIMTFILL",code:69,defaultValue:0},{name:"DIMTFILLCLR",code:70,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:ga.Above,defaultValueImperial:ga.Center},{name:"DIMZIN",code:78,defaultValue:pn.Trailing,defaultValueImperial:pn.Feet},{name:"DIMAZIN",code:79,defaultValue:Fg.None},{name:"DIMARCSYM",code:90,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179,defaultValue:0},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:3,defaultValueImperial:2},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:44,defaultValueImperial:46},{name:"DIMTMOVE",code:279,defaultValue:0},{name:"DIMJUST",code:280,defaultValue:Dg.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:zg.Center},{name:"DIMTZIN",code:284,defaultValue:pn.Trailing,defaultValueImperial:pn.Feet},{name:"DIMALTZ",code:285,defaultValue:pn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:pn.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMFXLON",code:290,defaultValue:0},{name:"DIMTXTDIRECTION",code:294,defaultValue:0},{name:"DIMTXSTY",code:340,defaultValue:"Standard"},{name:"DIMLDRBLK",code:341,defaultValue:""},{name:"DIMBLK",code:342,defaultValue:""},{name:"DIMBLK1",code:343,defaultValue:""},{name:"DIMBLK2",code:344,defaultValue:""},{name:"DIMLTYPE",code:345,defaultValue:""},{name:"DIMLTEX1",code:346,defaultValue:""},{name:"DIMLTEX2",code:347,defaultValue:""},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWE",code:372,defaultValue:-2}],Tc=[{code:3,name:"styleName",parser:u},{code:210,name:"extrusionDirection",parser:w},{code:51,name:"ocsRotation",parser:u},{code:53,name:"textRotation",parser:u},{code:1,name:"text",parser:u},{code:42,name:"measurement",parser:u},{code:72,name:"textLineSpacingStyle",parser:u},{code:71,name:"attachmentPoint",parser:u},{code:70,name:"dimensionType",parser:u},{code:11,name:"textPoint",parser:w},{code:10,name:"definitionPoint",parser:w},{code:2,name:"name",parser:u},{code:280,name:"version",parser:u},{code:100}],tp=[{code:100},{code:52,name:"obliqueAngle",parser:u},{code:50,name:"rotationAngle",parser:u},{code:14,name:"subDefinitionPoint2",parser:w},{code:13,name:"subDefinitionPoint1",parser:w},{code:12,name:"insertionPoint",parser:w},{code:100,name:"subclassMarker",parser:u}],np=[{code:16,name:"arcPoint",parser:w},{code:15,name:"centerPoint",parser:w},{code:14,name:"subDefinitionPoint2",parser:w},{code:13,name:"subDefinitionPoint1",parser:w},{code:100,name:"subclassMarker",parser:u}],rp=[{code:14,name:"subDefinitionPoint2",parser:w},{code:13,name:"subDefinitionPoint1",parser:w},{code:100,name:"subclassMarker",parser:u}],ip=[{code:40,name:"leaderLength",parser:u},{code:15,name:"subDefinitionPoint",parser:w},{code:100,name:"subclassMarker",parser:u}],sp=[{code:100,parser(n,e,t){let r=function(i){switch(i){case"AcDbAlignedDimension":return k(tp);case"AcDb3PointAngularDimension":case"AcDb2LineAngularDimension":return k(np);case"AcDbOrdinateDimension":return k(rp);case"AcDbRadialDimension":case"AcDbDiametricDimension":return k(ip)}return null}(n.value);if(!r)return xr;r(n,e,t)},pushContext:!0},...ao.map(n=>({...n,parser:u})),...Tc,...j];class Fr{parseEntity(e,t){let r={};return k(sp)(t,e,r),r}}(ts="ForEntityName")in Fr?Object.defineProperty(Fr,ts,{value:"DIMENSION",enumerable:!0,configurable:!0,writable:!0}):Fr[ts]="DIMENSION";let op=[{code:73},{code:17,name:"leaderEnd",parser:w},{code:16,name:"leaderStart",parser:w},{code:71,name:"hasLeader",parser:O},{code:41,name:"endAngle",parser:u},{code:40,name:"startAngle",parser:u},{code:70,name:"isPartial",parser:O},{code:15,name:"centerPoint",parser:w},{code:14,name:"xline2Point",parser:w},{code:13,name:"xline1Point",parser:w},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...ao.map(n=>({...n,parser:u})),...Tc,...j];class Dr{parseEntity(e,t){let r={};return k(op)(t,e,r),r}}(ns="ForEntityName")in Dr?Object.defineProperty(Dr,ns,{value:"ARC_DIMENSION",enumerable:!0,configurable:!0,writable:!0}):Dr[ns]="ARC_DIMENSION";(Ve={})[Ve.NONE=0]="NONE",Ve[Ve.INVISIBLE=1]="INVISIBLE",Ve[Ve.CONSTANT=2]="CONSTANT",Ve[Ve.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",Ve[Ve.PRESET=8]="PRESET";(jn={})[jn.MULTILINE=2]="MULTILINE",jn[jn.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(Ut={})[Ut.NONE=0]="NONE",Ut[Ut.MIRRORED_X=2]="MIRRORED_X",Ut[Ut.MIRRORED_Y=4]="MIRRORED_Y";var ap=((Ee={})[Ee.LEFT=0]="LEFT",Ee[Ee.CENTER=1]="CENTER",Ee[Ee.RIGHT=2]="RIGHT",Ee[Ee.ALIGNED=3]="ALIGNED",Ee[Ee.MIDDLE=4]="MIDDLE",Ee[Ee.FIT=5]="FIT",Ee),lp=((rt={})[rt.BASELINE=0]="BASELINE",rt[rt.BOTTOM=1]="BOTTOM",rt[rt.MIDDLE=2]="MIDDLE",rt[rt.TOP=3]="TOP",rt);function Cc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Mc={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:ap.LEFT,valign:lp.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Oc=[{code:73,name:"valign",parser:u},{code:100},{code:210,name:"extrusionDirection",parser:w},{code:11,name:"endPoint",parser:w},{code:72,name:"valign",parser:u},{code:72,name:"halign",parser:u},{code:71,name:"generationFlag",parser:u},{code:7,name:"styleName",parser:u},{code:51,name:"obliqueAngle",parser:u},{code:41,name:"xScale",parser:u},{code:50,name:"rotation",parser:u},{code:1,name:"text",parser:u},{code:40,name:"textHeight",parser:u},{code:10,name:"startPoint",parser:w},{code:39,name:"thickness",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class kc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Cc(this,"parser",k(Oc,Mc))}}function Nc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Cc(kc,"ForEntityName","TEXT");let cp={...Mc},hp=[{code:2},{code:40,name:"annotationScale",parser:u},{code:10,name:"alignmentPoint",parser:w},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:u},{code:70,name:"numberOfSecondaryAttributes",parser:u},{code:70,name:"isReallyLocked",parser:O},{code:70,name:"mtextFlag",parser:u},{code:280,name:"isDuplicatedRecord",parser:O},{code:100},{code:280,name:"isLocked",parser:O},{code:74,name:"valign",parser:u},{code:73},{code:70,name:"attributeFlag",parser:u},{code:2,name:"tag",parser:u},{code:3,name:"prompt",parser:u},{code:280},{code:100,name:"subclassMarker",parser:u},...Oc.slice(2)];class Yc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Nc(this,"parser",k(hp,cp))}}function dp(n,e){let t={};for(let r of n){let i=e(r);i!=null&&(t[i]??(t[i]=[]),t[i].push(r))}return t}function*Ai(n,e=1/0,t=1){for(let r=n;r!==e;r+=t)yield r}function Cs(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}Nc(Yc,"ForEntityName","ATTDEF");var up=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function gp(n){return up[n]}function pp(n){n.rewind();let e=n.next();if(e.code!==101)throw Error("Bad call for skipEmbeddedObject()");do e=n.next();while(e.code!==0);n.rewind()}function fp(n,e,t){if(X(e,102))return qe(e,t,n),!0;switch(e.code){case 0:n.type=e.value;break;case 5:n.handle=e.value;break;case 330:n.ownerBlockRecordSoftId=e.value;break;case 67:n.isInPaperSpace=!!e.value;break;case 8:n.layer=e.value;break;case 6:n.lineType=e.value;break;case 347:n.materialObjectHardId=e.value;break;case 62:n.colorIndex=e.value,n.color=gp(Math.abs(e.value));break;case 370:n.lineweight=e.value;break;case 48:n.lineTypeScale=e.value;break;case 60:n.isVisible=!!e.value;break;case 92:n.proxyByte=e.value;break;case 310:n.proxyEntity=e.value;break;case 100:break;case 420:n.color=e.value;break;case 430:n.transparency=e.value;break;case 390:n.plotStyleHardId=e.value;break;case 284:n.shadowMode=e.value;break;case 1001:(n.xdata??(n.xdata=[])).push(Lc(e,t));break;default:return!1}return!0}function Xc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let mp={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},zr=[{code:46,name:"annotationHeight",parser:u},{code:101,parser(n,e){pp(e)}},{code:50,name:"columnHeight",parser:u},{code:49,name:"columnGutter",parser:u},{code:48,name:"columnWidth",parser:u},{code:79,name:"columnAutoHeight",parser:u},{code:78,name:"columnFlowReversed",parser:u},{code:76,name:"columnCount",parser:u},{code:75,name:"columnType",parser:u},{code:441,name:"backgroundFillTransparency",parser:u},{code:63,name:"backgroundFillColor",parser:u},{code:45,name:"fillBoxScale",parser:u},{code:[...Ai(430,440)],name:"backgroundColor",parser:u},{code:[...Ai(420,430)],name:"backgroundColor",parser:u},{code:90,name:"backgroundFill",parser:u},{code:44,name:"lineSpacing",parser:u},{code:73,name:"lineSpacingStyle",parser:u},{code:50,name:"rotation",parser:u},{code:43},{code:42},{code:11,name:"direction",parser:w},{code:210,name:"extrusionDirection",parser:w},{code:7,name:"styleName",parser:u},...zi("text"),{code:72,name:"drawingDirection",parser:u},{code:71,name:"attachmentPoint",parser:u},{code:41,name:"width",parser:u},{code:40,name:"height",parser:u},{code:10,name:"insertionPoint",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Rc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Xc(this,"parser",k(zr,mp))}}function Bc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Xc(Rc,"ForEntityName","MTEXT");let yp={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},_p=[...zr.slice(zr.findIndex(({name:n})=>n==="columnType"),zr.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!X(n,0,"MTEXT"))return xr}},{code:2,name:"definitionTag",parser:u},{code:40,name:"annotationScale",parser:u},{code:10,name:"alignmentPoint",parser:w},{code:340,name:"secondaryAttributesHardId",parser:u},{code:70,name:"numberOfSecondaryAttributes",parser:u},{code:70,name:"isReallyLocked",parser:O},{code:70,name:"mtextFlag",parser:u},{code:280,name:"isDuplicatedEntriesKeep",parser:O},{code:100},{code:280,name:"lockPositionFlag",parser:O},{code:210,name:"extrusionDirection",parser:w},{code:11,name:"alignmentPoint",parser:w},{code:74,name:"verticalJustification",parser:u},{code:72,name:"horizontalJustification",parser:u},{code:71,name:"textGenerationFlag",parser:u},{code:7,name:"textStyle",parser:u},{code:51,name:"obliqueAngle",parser:u},{code:41,name:"scale",parser:u},{code:50,name:"rotation",parser:u},{code:73},{code:70,name:"attributeFlag",parser:u},{code:2,name:"tag",parser:u},{code:280},{code:100,name:"subclassMarker",parser:u},{code:1,name:"text",parser:u},{code:40,name:"textHeight",parser:u},{code:10,name:"startPoint",parser:w},{code:39,name:"thickness",parser:u},{code:100},...j];class Fc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Bc(this,"parser",k(_p,yp))}}function Dc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Bc(Fc,"ForEntityName","ATTRIB");let bp=[...zi("data"),{code:70,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class zc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Dc(this,"parser",k(bp))}}function Vc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Dc(zc,"ForEntityName","BODY");let xp={thickness:0,extrusionDirection:{x:0,y:0,z:1}},wp=[{code:210,name:"extrusionDirection",parser:w},{code:40,name:"radius",parser:u},{code:10,name:"center",parser:w},{code:39,name:"thickness",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class jc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Vc(this,"parser",k(wp,xp))}}function Gc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Vc(jc,"ForEntityName","CIRCLE");let vp={extrusionDirection:{x:0,y:0,z:1}},Pp=[{code:42,name:"endAngle",parser:u},{code:41,name:"startAngle",parser:u},{code:40,name:"axisRatio",parser:u},{code:210,name:"extrusionDirection",parser:w},{code:11,name:"majorAxisEndPoint",parser:w},{code:10,name:"center",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Hc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Gc(this,"parser",k(Pp,vp))}}function Wc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Gc(Hc,"ForEntityName","ELLIPSE");let Ap=[{code:13,name:"vertices.3",parser:w},{code:12,name:"vertices.2",parser:w},{code:11,name:"vertices.1",parser:w},{code:10,name:"vertices.0",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Uc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Wc(this,"parser",k(Ap))}}Wc(Uc,"ForEntityName","3DFACE");(it={})[it.First=1]="First",it[it.Second=2]="Second",it[it.Third=4]="Third",it[it.Fourth=8]="Fourth";function $n(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class pa{getReadIndex(){return this._pointer}getLines(){return this._data}next(){if(!this.hasNext())return this._eof?this.debug:this.debug,{code:0,value:"EOF"};let e=this._data[this._pointer++],t=parseInt(e,10);Number.isNaN(t)&&fa(e);let r=Ms(t,this._data[this._pointer++],this.debug),i={code:t,value:r};return X(i,0,"EOF")&&(this._eof=!0),this.lastReadGroup=i,i}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let e=this._data[this._pointer],t=parseInt(e,10);Number.isNaN(t)&&fa(e);let r={code:t,value:0};return r.value=Ms(r.code,this._data[this._pointer+1],this.debug),r}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e,t=!1){$n(this,"_data",void 0),$n(this,"debug",void 0),$n(this,"_pointer",void 0),$n(this,"_eof",void 0),$n(this,"lastReadGroup",void 0),this._data=e,this.debug=t,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function Ms(n,e,t=!1){var r;let i=(r=e).endsWith("\r")?r.slice(0,-1):r;return n<=9?i:n>=10&&n<=59?parseFloat(e.trim()):n>=60&&n<=99?parseInt(e.trim()):n>=100&&n<=109?i:n>=110&&n<=149?parseFloat(e.trim()):n>=160&&n<=179?parseInt(e.trim()):n>=210&&n<=239?parseFloat(e.trim()):n>=270&&n<=289?parseInt(e.trim()):n>=290&&n<=299?function(s){let o=s.trim().toLowerCase();if(o===""||o==="0"||o==="false"||o==="f"||o==="no")return!1;if(o==="1"||o==="true"||o==="t"||o==="yes")return!0;let a=Number.parseFloat(o);if(!Number.isNaN(a))return a!==0;throw TypeError("String '"+s+"' cannot be cast to Boolean type")}(e.trim()):n>=300&&n<=369?i:n>=370&&n<=389?parseInt(e.trim()):n>=390&&n<=399?i:n>=400&&n<=409?parseInt(e.trim()):n>=410&&n<=419?i:n>=420&&n<=429?parseInt(e.trim()):n>=430&&n<=439?i:n>=440&&n<=459?parseInt(e.trim()):n>=460&&n<=469?parseFloat(e.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?i:n>=1010&&n<=1059?parseFloat(e.trim()):n>=1060&&n<=1071?parseInt(e.trim()):i}function fa(n){let e=n.length>120?`${n.slice(0,120)}…`:n;throw Error(`Invalid DXF group code line: "${e}". Expected a numeric group code (often caused by binary DXF, UTF-16-encoded DXF, or stray blank lines). Use ASCII/text DXF or remove blank lines between code/value pairs.`)}let $c=[{code:330,name:"sourceBoundaryObjects",parser:u,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:u}],Sp=[{code:11,name:"end",parser:w},{code:10,name:"start",parser:w}],Lp=[{code:73,name:"isCCW",parser:O},{code:51,name:"endAngle",parser:u},{code:50,name:"startAngle",parser:u},{code:40,name:"radius",parser:u},{code:10,name:"center",parser:w}],Ip=[{code:73,name:"isCCW",parser:O},{code:51,name:"endAngle",parser:u},{code:50,name:"startAngle",parser:u},{code:40,name:"lengthOfMinorAxis",parser:u},{code:11,name:"end",parser:w},{code:10,name:"center",parser:w}],Ep=[{code:13,name:"endTangent",parser:w},{code:12,name:"startTangent",parser:w},{code:11,name:"fitDatum",isMultiple:!0,parser:w},{code:97,name:"numberOfFitData",parser:u},{code:10,name:"controlPoints",isMultiple:!0,parser(n,e){let t={...Yt(e),weight:1};return(n=e.next()).code===42?t.weight=n.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:u},{code:96,name:"numberOfControlPoints",parser:u},{code:95,name:"numberOfKnots",parser:u},{code:74,name:"isPeriodic",parser:O},{code:73,name:"splineFlag",parser:u},{code:94,name:"degree",parser:u}],Tp={[Or.Line]:Sp,[Or.Circular]:Lp,[Or.Elliptic]:Ip,[Or.Spline]:Ep},Cp=[...$c,{code:72,name:"edges",parser(n,e){let t={type:n.value},r=Tp[t.type];if(r==null)throw Error(`Unsupported HATCH boundary edge type: ${t.type} (expected 1–4: line, arc, elliptic arc, spline). This often happens when a polyline hatch boundary is parsed as edge segments (e.g. group 92 boundary flag missing the polyline bit). Try re-saving as ASCII DXF or simplifying hatch boundaries in CAD.`);return k(r)(n=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:u}],Mp=[...$c,{code:10,name:"vertices",parser(n,e){let t={...Yt(e),bulge:0};return(n=e.next()).code===42?t.bulge=n.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:u},{code:73,name:"isClosed",parser:O},{code:72,name:"hasBulge",parser:O}];function Op(n,e){let t={boundaryPathTypeFlag:n.value},r=!!(t.boundaryPathTypeFlag&jg.Polyline),i=e.getReadIndex();return n=e.next(),!r&&function(s,o){let a=Math.min(s.length,o+120),l=o;for(;l<a-1;){let c=parseInt(s[l],10);if(Number.isNaN(c))break;if(c===93){if(l+3>=s.length||parseInt(s[l+2],10)!==72)return!1;let h=Ms(72,s[l+3]);if(h===0)return!0;if(h===1){if(l+5<s.length&&parseInt(s[l+4],10)===73)return!0;if(l+8<s.length&&parseInt(s[l+4],10)===10){let d=parseInt(s[l+8],10);if(d===10||d===42)return!0}}break}if(c===0)break;l+=2}return!1}(e.getLines(),i)&&(r=!0),r?k(Mp)(n,e,t):k(Cp)(n,e,t),t}let kp=[{code:49,name:"dashLengths",parser:u,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:u},{code:45,name:"offset",parser:ma},{code:43,name:"base",parser:ma},{code:53,name:"angle",parser:u}];function ma(n,e){let t=n.code+1,r={x:n.value,y:1};return(n=e.next()).code===t?r.y=n.value:e.rewind(),r}function Np(n,e){let t={};return k(kp)(n,e,t),t}function Yp(n,e){let t=[];for(;n.code===463;){let r={reservedField:n.value};if((n=e.next()).code===63&&(r.colorIndex=n.value,n=e.next()),n.code===421)r.rgb=n.value,t.push(r),n=e.next();else{e.rewind();break}}return n.code!==463&&t.length>0&&e.rewind(),t}function qc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Xp={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Rp=[{code:470,name:"gradientName",parser:u},{code:463,name:"gradientColors",parser:Yp},{code:462,name:"colorTint",parser:u},{code:461,name:"gradientDefinition",parser:u},{code:460,name:"gradientRotation",parser:u},{code:453,name:"numberOfColors",parser:u},{code:452,name:"gradientColorFlag",parser:u},{code:451},{code:450,name:"gradientFlag",parser:u},{code:10,name:"seedPoints",parser:w,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:w},{code:98,name:"numberOfSeedPoints",parser:u},{code:47,name:"pixelSize",parser:u},{code:53,name:"definitionLines",parser:Np,isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:u},{code:77,name:"isDouble",parser:O},{code:73,name:"isAnnotated",parser:O},{code:41,name:"patternScale",parser:u},{code:52,name:"patternAngle",parser:u},{code:76,name:"patternType",parser:u},{code:75,name:"hatchStyle",parser:u},{code:92,name:"boundaryPaths",parser:Op,isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:u},{code:71,name:"associativity",parser:u},{code:63,name:"patternFillColor",parser:u},{code:70,name:"solidFill",parser:u},{code:2,name:"patternName",parser:u},{code:210,name:"extrusionDirection",parser:w},{code:10,name:"elevationPoint",parser:w},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...j];class Kc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){qc(this,"parser",k(Rp,Xp))}}function Zc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}qc(Kc,"ForEntityName","HATCH");let Bp={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Fp=[{code:290,name:"clipMode",parser:u},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:w},{code:91,name:"countBoundaryPoints",parser:u},{code:71,name:"clippingBoundaryType",parser:u},{code:360,name:"imageDefReactorHandle",parser:u},{code:283,name:"fade",parser:u},{code:282,name:"contrast",parser:u},{code:281,name:"brightness",parser:u},{code:280,name:"isClipped",parser:O},{code:70,name:"flags",parser:u},{code:340,name:"imageDefHandle",parser:u},{code:13,name:"imageSize",parser:w},{code:12,name:"vPixel",parser:w},{code:11,name:"uPixel",parser:w},{code:10,name:"position",parser:w},{code:90,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Qc{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Zc(this,"parser",k(Fp,Bp))}}Zc(Qc,"ForEntityName","IMAGE");(st={})[st.ShowImage=1]="ShowImage",st[st.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",st[st.UseClippingBoundary=4]="UseClippingBoundary",st[st.TransparencyIsOn=8]="TransparencyIsOn";(Gn={})[Gn.Rectangular=1]="Rectangular",Gn[Gn.Polygonal=2]="Polygonal";(Hn={})[Hn.Outside=0]="Outside",Hn[Hn.Inside=1]="Inside";function Jc(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Dp={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},zp=[{code:210,name:"extrusionDirection",parser:w},{code:45,name:"rowSpacing",parser:u},{code:44,name:"columnSpacing",parser:u},{code:71,name:"rowCount",parser:u},{code:70,name:"columnCount",parser:u},{code:50,name:"rotation",parser:u},{code:43,name:"zScale",parser:u},{code:42,name:"yScale",parser:u},{code:41,name:"xScale",parser:u},{code:10,name:"insertionPoint",parser:w},{code:2,name:"name",parser:u},{code:66,name:"isVariableAttributes",parser:O},{code:100,name:"subclassMarker",parser:u},...j];class eh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Jc(this,"parser",k(zp,Dp))}}function th(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Jc(eh,"ForEntityName","INSERT");let Vp={isArrowheadEnabled:!0},jp=[{code:213,name:"offsetFromAnnotation",parser:w},{code:212,name:"offsetFromBlock",parser:w},{code:211,name:"horizontalDirection",parser:w},{code:210,name:"normal",parser:w},{code:340,name:"associatedAnnotation",parser:u},{code:77,name:"byBlockColor",parser:u},{code:10,name:"vertices",parser:w,isMultiple:!0},{code:76,name:"numberOfVertices",parser:u},{code:41,name:"textWidth",parser:u},{code:40,name:"textHeight",parser:u},{code:75,name:"isHooklineExists",parser:O},{code:74,name:"isHooklineSameDirection",parser:O},{code:73,name:"leaderCreationFlag",parser:u},{code:72,name:"isSpline",parser:O},{code:71,name:"isArrowheadEnabled",parser:O},{code:3,name:"styleName",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class nh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){th(this,"parser",k(jp,Vp))}}th(nh,"ForEntityName","LEADER");(ot={})[ot.TextAnnotation=0]="TextAnnotation",ot[ot.ToleranceAnnotation=1]="ToleranceAnnotation",ot[ot.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",ot[ot.NoAnnotation=3]="NoAnnotation";function rh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Gp={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Hp=[{code:210,name:"extrusionDirection",parser:w},{code:11,name:"endPoint",parser:w},{code:10,name:"startPoint",parser:w},{code:39,name:"thickness",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class ih{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){rh(this,"parser",k(Hp,Gp))}}function sh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}rh(ih,"ForEntityName","LINE");let Wp=[{code:280,name:"shadowMapSoftness",parser:u},{code:91,name:"shadowMapSize",parser:u},{code:73,name:"shadowType",parser:u},{code:293,name:"isShadowCast",parser:O},{code:51,name:"falloffAngle",parser:u},{code:50,name:"hotspotAngle",parser:u},{code:42,name:"limitEnd",parser:u},{code:41,name:"limitStart",parser:u},{code:292,name:"isAttenuationLimited",parser:O},{code:72,name:"attenuationType",parser:u},{code:11,name:"target",parser:w},{code:10,name:"position",parser:w},{code:40,name:"intensity",parser:u},{code:291,name:"isPlotGlyph",parser:O},{code:290,name:"isOn",parser:O},{code:421,name:"lightColorInstance",parser:u},{code:63,name:"lightColorIndex",parser:u},{code:70,name:"lightType",parser:u},{code:1,name:"name",parser:u},{code:90,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class oh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){sh(this,"parser",k(Wp))}}sh(oh,"ForEntityName","LIGHT");($t={})[$t.Distant=1]="Distant",$t[$t.Point=2]="Point",$t[$t.Spot=3]="Spot";(qt={})[qt.None=0]="None",qt[qt.InverseLinear=1]="InverseLinear",qt[qt.InverseSquare=2]="InverseSquare";let Up={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},$p={bulge:0},qp=[{code:42,name:"bulge",parser:u},{code:41,name:"endWidth",parser:u},{code:40,name:"startWidth",parser:u},{code:91,name:"id",parser:u},{code:20,name:"y",parser:u},{code:10,name:"x",parser:u}],Kp=[{code:210,name:"extrusionDirection",parser:w},{code:10,name:"vertices",isMultiple:!0,parser(n,e){let t={};return k(qp,$p)(n,e,t),t}},{code:39,name:"thickness",parser:u},{code:38,name:"elevation",parser:u},{code:43,name:"constantWidth",parser:u},{code:70,name:"flag",parser:u},{code:90,name:"numberOfVertices",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Vr{parseEntity(e,t){let r={};return k(Kp,Up)(t,e,r),r}}(rs="ForEntityName")in Vr?Object.defineProperty(Vr,rs,{value:"LWPOLYLINE",enumerable:!0,configurable:!0,writable:!0}):Vr[rs]="LWPOLYLINE";(Wn={})[Wn.IS_CLOSED=1]="IS_CLOSED",Wn[Wn.PLINE_GEN=128]="PLINE_GEN";function ah(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Zp=[{code:90,name:"overridenSubEntityCount",parser:u},{code:140,name:"edgeCreaseWeights",parser:u,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:u},{code:94,parser(n,e,t){t.edgeCount=n.value,t.edgeIndices=[];for(let r=0;r<t.edgeCount;++r){let i=[];n=e.next(),i[0]=n.value,n=e.next(),i[1]=n.value,t.edgeIndices.push(i)}}},{code:93,parser(n,e,t){t.totalFaceIndices=n.value,t.faceIndices=[];let r=[];for(let s=0;s<t.totalFaceIndices&&!X(n,0);++s)n=e.next(),r.push(n.value);let i=0;for(;i<r.length;){let s=r[i++],o=[];for(let a=0;a<s;++a)o.push(r[i++]);t.faceIndices.push(o)}}},{code:10,name:"vertices",parser:w,isMultiple:!0},{code:92,name:"verticesCount",parser:u},{code:91,name:"subdivisionLevel",parser:u},{code:40,name:"blendCrease",parser:u},{code:72,name:"isBlendCreased",parser:O},{code:71,name:"version",parser:u},{code:100,name:"subclassMarker",parser:Wg,pushContext:!0},...j];class lh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){ah(this,"parser",k(Zp))}}function ch(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ah(lh,"ForEntityName","MESH");let Qp=[{code:42,name:"fillParameters",parser:u,isMultiple:!0},{code:75,name:"fillCount",parser:u},{code:41,name:"parameters",parser:u,isMultiple:!0},{code:74,name:"parameterCount",parser:u}],Jp=[{code:[74,41,75,42],name:"elements",parser(n,e){let t=k(Qp),r={};return t(n,e,r),r},isMultiple:!0},{code:13,name:"miterDirection",parser:w},{code:12,name:"direction",parser:w},{code:11,name:"position",parser:w}],e0=[{code:[11,12,13],name:"segments",parser(n,e){let t=k(Jp),r={};return t(n,e,r),r},isMultiple:!0},{code:210,name:"extrusionDirection",parser:w},{code:10,name:"startPosition",parser:w},{code:73,name:"styleCount",parser:u},{code:72,name:"vertexCount",parser:u},{code:71,name:"flags",parser:u},{code:70,name:"justification",parser:u},{code:40,name:"scale",parser:u},{code:340,name:"styleObjectHandle",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...j];class hh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){ch(this,"parser",k(e0))}}ch(hh,"ForEntityName","MLINE");(Kt={})[Kt.Top=0]="Top",Kt[Kt.Zero=1]="Zero",Kt[Kt.Bottom=2]="Bottom";(at={})[at.HasVertex=1]="HasVertex",at[at.Closed=2]="Closed",at[at.SuppressStartCaps=4]="SuppressStartCaps",at[at.SuppressEndCaps=8]="SuppressEndCaps";(Zt={})[Zt.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Zt[Zt.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Zt[Zt.BY_STYLE=5]="BY_STYLE";function dh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let t0={},n0=[{code:300,parser:function(n,e,t){var s;let r;if(n.value==="CONTEXT_DATA{")for(;e.hasNext();){var i;if((r=e.next()).code===301)break;switch(r.code){case 10:t.contentBasePosition=ue(r,e);break;case 11:t.normal=ue(r,e);break;case 12:t.textAnchor=ue(r,e);break;case 13:t.textDirection=ue(r,e);break;case 14:ut(t).normal=ue(r,e);break;case 15:ut(t).position=ue(r,e);break;case 16:ut(t).scale=ue(r,e);break;case 40:t.contentScale=r.value;break;case 41:case 44:t.textHeight=r.value;break;case 42:t.textRotation=r.value;break;case 43:t.textWidth=r.value;break;case 45:t.textLineSpacingFactor=r.value;break;case 46:ut(t).rotation=r.value;break;case 47:(i=ut(t)).transformationMatrix??(i.transformationMatrix=[]),(s=ut(t).transformationMatrix)==null||s.push(r.value);break;case 90:t.textColor=r.value;break;case 91:t.textBackgroundColor=r.value;break;case 92:t.textBackgroundTransparency=r.value;break;case 93:ut(t).color=r.value;break;case 110:t.planeOrigin=ue(r,e);break;case 111:t.planeXAxisDirection=ue(r,e);break;case 112:t.planeYAxisDirection=ue(r,e);break;case 140:t.arrowheadSize=r.value;break;case 141:t.textBackgroundScaleFactor=r.value;break;case 142:t.textColumnWidth=r.value;break;case 143:t.textColumnGutterWidth=r.value;break;case 144:t.textColumnHeight=r.value;break;case 145:t.landingGap=r.value;break;case 170:t.textLineSpacingStyle=r.value;break;case 171:t.textAttachment=r.value;break;case 172:t.textFlowDirection=r.value;break;case 173:t.textColumnType=r.value;break;case 290:t.hasMText=r.value;break;case 291:t.textBackgroundColorOn=r.value;break;case 292:t.textFillOn=r.value;break;case 293:t.textUseAutoHeight=r.value;break;case 294:t.textColumnFlowReversed=r.value;break;case 295:t.textUseWordBreak=r.value;break;case 296:t.hasBlock=r.value;break;case 297:t.planeNormalReversed=r.value;break;case 302:r.value==="LEADER{"&&(t.leaderSections??(t.leaderSections=[]),t.leaderSections.push(function(o,a){let l,c;if(o.value!=="LEADER{")return{leaderLines:[]};let h={leaderLines:[]};for(;a.hasNext();){if((c=a.next()).code===303){kr(h,l);break}switch(c.code){case 290:h.lastLeaderLinePointSet=c.value;break;case 291:h.doglegVectorSet=c.value;break;case 10:h.lastLeaderLinePoint=ue(c,a);break;case 11:h.doglegVector=ue(c,a);break;case 12:l??(l={}),l.start=ue(c,a);break;case 13:l??(l={}),l.end=ue(c,a),kr(h,l),l=void 0;break;case 90:h.leaderBranchIndex=c.value;break;case 40:h.doglegLength=c.value;break;case 304:c.value==="LEADER_LINE{"&&h.leaderLines.push(function(d,p){let g,f;if(d.value!=="LEADER_LINE{")return{vertices:[]};let m={vertices:[]};for(;p.hasNext();){if((f=p.next()).code===305){kr(m,g);break}switch(f.code){case 10:m.vertices.push(ue(f,p));break;case 11:g??(g={}),g.start=ue(f,p);break;case 12:g??(g={}),g.end=ue(f,p),kr(m,g),g=void 0;break;case 90:m.breakPointIndexes??(m.breakPointIndexes=[]),m.breakPointIndexes.push(f.value),g??(g={}),g.index=f.value;break;case 91:m.leaderLineIndex=f.value}}return m}(c,a))}}return h}(r,e)));break;case 304:r.value!=="LEADER_LINE{"&&(t.textContent=r.value,t.contentType??(t.contentType=2));break;case 340:t.textStyleId=r.value;break;case 341:t.blockContentId=r.value,ut(t).blockContentId=r.value}}}},{code:270,name:"version",parser:u},{code:340,name:"leaderStyleId",parser:u},{code:90,name:"propertyOverrideFlag",parser:u},{code:170,name:"leaderLineType",parser:u},{code:91,name:"leaderLineColor",parser:u},{code:341,name:"leaderLineTypeId",parser:u},{code:171,name:"leaderLineWeight",parser:u},{code:290,name:"landingEnabled",parser:O},{code:291,name:"doglegEnabled",parser:O},{code:[40,41],name:"doglegLength",parser:u},{code:342,name:"arrowheadId",parser:u},{code:42,name:"arrowheadSize",parser:u},{code:172,name:"contentType",parser:u},{code:343,name:"textStyleId",parser:u},{code:173,name:"textLeftAttachmentType",parser:u},{code:95,name:"textRightAttachmentType",parser:u},{code:174,name:"textAngleType",parser:u},{code:175,name:"textAlignmentType",parser:u},{code:92,name:"textColor",parser:u},{code:292,name:"textFrameEnabled",parser:O},{code:344,parser:function(n,e,t){t.blockContentId=n.value,ut(t).blockContentId=n.value}},{code:93,name:"blockContentColor",parser:u},{code:10,name:"blockContentScale",parser:w},{code:43,name:"blockContentRotation",parser:u},{code:176,name:"blockContentConnectionType",parser:u},{code:293,name:"annotativeScaleEnabled",parser:O},{code:94,parser:function(n,e,t){t.arrowheadOverrides??(t.arrowheadOverrides=[]),t.arrowheadOverrides.push({index:n.value})},isMultiple:!0},{code:345,parser:function(n,e,t){var r;((r=t).arrowheadOverrides??(r.arrowheadOverrides=[]),r.arrowheadOverrides.length||r.arrowheadOverrides.push({}),r.arrowheadOverrides[r.arrowheadOverrides.length-1]).handle=n.value},isMultiple:!0},{code:330,parser:function(n,e,t){t.blockAttributes??(t.blockAttributes=[]),t.blockAttributes.push({id:n.value})},isMultiple:!0},{code:177,parser:function(n,e,t){ls(t).index=n.value},isMultiple:!0},{code:44,parser:function(n,e,t){ls(t).width=n.value},isMultiple:!0},{code:302,parser:function(n,e,t){ls(t).text=n.value},isMultiple:!0},{code:294,name:"textDirectionNegative",parser:O},{code:178,name:"textAlignInIPE",parser:u},{code:179,name:"textAttachmentPoint",parser:u},{code:271,name:"textAttachmentDirection",parser:u},{code:272,name:"bottomTextAttachmentDirection",parser:u},{code:273,name:"topTextAttachmentDirection",parser:u},{code:100,name:"subclassMarker",parser:u},...j];function ue(n,e){return Cs(w(n,e))}function kr(n,e){(e!=null&&e.start||e!=null&&e.end)&&(n.breaks??(n.breaks=[]),n.breaks.push(e))}function ut(n){return n.blockContent??(n.blockContent={})}function ls(n){return n.blockAttributes??(n.blockAttributes=[]),n.blockAttributes.length||n.blockAttributes.push({}),n.blockAttributes[n.blockAttributes.length-1]}class uh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){dh(this,"parser",k(n0,t0))}}function gh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}dh(uh,"ForEntityName","MULTILEADER");let r0={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},i0=[{code:50,name:"angle",parser:u},{code:210,name:"extrusionDirection",parser:w},{code:39,name:"thickness",parser:u},{code:10,name:"position",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class ph{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){gh(this,"parser",k(i0,r0))}}function fh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}gh(ph,"ForEntityName","POINT");let s0={startWidth:0,endWidth:0,bulge:0},o0=[{code:91,name:"id",parser:u},{code:[...Ai(71,75)],name:"faces",isMultiple:!0,parser:u},{code:50,name:"tangentDirection",parser:u},{code:70,name:"flag",parser:u},{code:42,name:"bulge",parser:u},{code:41,name:"endWidth",parser:u},{code:40,name:"startWidth",parser:u},{code:30,name:"z",parser:u},{code:20,name:"y",parser:u},{code:10,name:"x",parser:u},{code:100,name:"subclassMarker",parser:u},{code:100},...j];class lo{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){fh(this,"parser",k(o0,s0))}}function mh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}fh(lo,"ForEntityName","VERTEX");let a0={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},l0=[{code:0,name:"vertices",isMultiple:!0,parser:(n,e)=>X(n,0,"VERTEX")?(n=e.next(),new lo().parseEntity(e,n)):xr},{code:210,name:"extrusionDirection",parser:w},{code:75,name:"smoothType",parser:u},{code:74,name:"surfaceNDensity",parser:u},{code:73,name:"surfaceMDensity",parser:u},{code:72,name:"meshNVertexCount",parser:u},{code:71,name:"meshMVertexCount",parser:u},{code:41,name:"endWidth",parser:u},{code:40,name:"startWidth",parser:u},{code:70,name:"flag",parser:u},{code:39,name:"thickness",parser:u},{code:30,name:"elevation",parser:u},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:u},...j];class yh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){mh(this,"parser",k(l0,a0))}}mh(yh,"ForEntityName","POLYLINE");(he={})[he.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",he[he.CURVE_FIT=2]="CURVE_FIT",he[he.SPLINE_FIT=4]="SPLINE_FIT",he[he.POLYLINE_3D=8]="POLYLINE_3D",he[he.POLYGON_3D=16]="POLYGON_3D",he[he.CLOSED_POLYGON=32]="CLOSED_POLYGON",he[he.POLYFACE=64]="POLYFACE",he[he.CONTINUOUS=128]="CONTINUOUS";var Nr=((lt={})[lt.NONE=0]="NONE",lt[lt.QUADRATIC=5]="QUADRATIC",lt[lt.CUBIC=6]="CUBIC",lt[lt.BEZIER=8]="BEZIER",lt);function _h(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let c0=[{code:11,name:"direction",parser:w},{code:10,name:"position",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class bh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){_h(this,"parser",k(c0))}}function xh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}_h(bh,"ForEntityName","RAY");let h0=[...zi("data"),{code:70,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class wh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){xh(this,"parser",k(h0))}}function vh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}xh(wh,"ForEntityName","REGION");let d0={vertices:[],backLineVertices:[]},u0=[{code:360,name:"geometrySettingHardId",parser:u},{code:12,name:"backLineVertices",isMultiple:!0,parser:w},{code:93,name:"numberOfBackLineVertices",parser:u},{code:11,name:"vertices",isMultiple:!0,parser:w},{code:92,name:"verticesCount",parser:u},{code:[63,411],name:"indicatorColor",parser:u},{code:70,name:"indicatorTransparency",parser:u},{code:41,name:"bottomHeight",parser:u},{code:40,name:"topHeight",parser:u},{code:10,name:"verticalDirection",parser:w},{code:1,name:"name",parser:u},{code:91,name:"flag",parser:u},{code:90,name:"state",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Ph{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){vh(this,"parser",k(u0,d0))}}function Ah(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}vh(Ph,"ForEntityName","SECTION");let g0={thickness:0,rotation:0,xScale:1,obliqueAngle:0,extrusionDirection:{x:0,y:0,z:1}},p0=[{code:210,name:"extrusionDirection",parser:w},{code:51,name:"obliqueAngle",parser:u},{code:41,name:"xScale",parser:u},{code:50,name:"rotation",parser:u},{code:2,name:"shapeName",parser:u},{code:40,name:"size",parser:u},{code:10,name:"insertionPoint",parser:w},{code:39,name:"thickness",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Sh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Ah(this,"parser",k(p0,g0))}}function Lh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Ah(Sh,"ForEntityName","SHAPE");let f0={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},m0=[{code:210,name:"extrusionDirection",parser:w},{code:39,name:"thickness",parser:u},{code:[...Ai(10,14)],name:"points",isMultiple:!0,parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Ih{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Lh(this,"parser",k(m0,f0))}}function Eh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Lh(Ih,"ForEntityName","SOLID");let y0=[{code:350,name:"historyObjectSoftId",parser:u},{code:100,name:"subclassMarker",parser:u},...zi("data"),{code:70,name:"version",parser:u},{code:100},...j];class Th{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Eh(this,"parser",k(y0))}}function Ch(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Eh(Th,"ForEntityName","3DSOLID");let _0={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},b0=[{code:11,name:"fitPoints",isMultiple:!0,parser:w},{code:10,name:"controlPoints",isMultiple:!0,parser:w},{code:41,name:"weights",isMultiple:!0,parser:u},{code:40,name:"knots",isMultiple:!0,parser:u},{code:13,name:"endTangent",parser:w},{code:12,name:"startTangent",parser:w},{code:44,name:"fitTolerance",parser:u},{code:43,name:"controlTolerance",parser:u},{code:42,name:"knotTolerance",parser:u},{code:74,name:"numberOfFitPoints",parser:u},{code:73,name:"numberOfControlPoints",parser:u},{code:72,name:"numberOfKnots",parser:u},{code:71,name:"degree",parser:u},{code:70,name:"flag",parser:u},{code:210,name:"normal",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Mh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Ch(this,"parser",k(b0,_0))}}Ch(Mh,"ForEntityName","SPLINE");(Te={})[Te.NONE=0]="NONE",Te[Te.CLOSED=1]="CLOSED",Te[Te.PERIODIC=2]="PERIODIC",Te[Te.RATIONAL=4]="RATIONAL",Te[Te.PLANAR=8]="PLANAR",Te[Te.LINEAR=16]="LINEAR";function Oh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let x0=[{code:280,name:"shadowMapSoftness",parser:u},{code:71,name:"shadowMapSize",parser:u},{code:70,name:"shadowType",parser:u},{code:292,name:"isSummerTime",parser:O},{code:92,name:"time",parser:u},{code:91,name:"julianDay",parser:u},{code:291,name:"hasShadow",parser:O},{code:40,name:"intensity",parser:u},{code:421,name:"lightColorInstance",parser:u},{code:63,name:"lightColorIndex",parser:u},{code:290,name:"isOn",parser:O},{code:90,name:"version",parser:u},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...j.filter(n=>n.code!==100)];class kh{parseEntity(e,t){let r={layer:""};return this.parser(t,e,r),r}constructor(){Oh(this,"parser",k(x0))}}Oh(kh,"ForEntityName","SUN");class jr{parseEntity(e,t){let r={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:r.subclassMarker=t.value,t=e.next();break;case 2:r.name=t.value,t=e.next();break;case 5:r.handle=t.value,t=e.next();break;case 10:r.startPoint=Cs(Yt(e)),t=e.lastReadGroup;break;case 11:r.directionVector=Cs(Yt(e)),t=e.lastReadGroup;break;case 90:r.tableValue=t.value,t=e.next();break;case 91:r.rowCount=t.value,t=e.next();break;case 92:r.columnCount=t.value,t=e.next();break;case 93:r.overrideFlag=t.value,t=e.next();break;case 94:r.borderColorOverrideFlag=t.value,t=e.next();break;case 95:r.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:r.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:r.rowHeightArr??(r.rowHeightArr=[]),r.rowHeightArr.push(t.value),t=e.next();break;case 142:r.columnWidthArr??(r.columnWidthArr=[]),r.columnWidthArr.push(t.value),t=e.next();break;case 280:r.version=t.value,t=e.next();break;case 310:r.bmpPreview??(r.bmpPreview=""),r.bmpPreview+=t.value,t=e.next();break;case 330:r.ownerBlockRecordSoftId=t.value,t=e.next();break;case 342:r.tableStyleId=t.value,t=e.next();break;case 343:r.blockRecordHandle=t.value,t=e.next();break;case 170:r.attachmentPoint=t.value,t=e.next();break;case 171:r.cells??(r.cells=[]),r.cells.push(function(i,s){let o=!1,a=!1,l={};for(;!i.isEOF()&&s.code!==0&&!a;)switch(s.code){case 171:if(o){a=!0;continue}l.cellType=s.value,o=!0,s=i.next();break;case 172:l.flagValue=s.value,s=i.next();break;case 173:l.mergedValue=s.value,s=i.next();break;case 174:l.autoFit=s.value,s=i.next();break;case 175:l.borderWidth=s.value,s=i.next();break;case 176:l.borderHeight=s.value,s=i.next();break;case 91:l.overrideFlag=s.value,s=i.next();break;case 178:l.virtualEdgeFlag=s.value,s=i.next();break;case 145:l.rotation=s.value,s=i.next();break;case 345:l.fieldObjetId=s.value,s=i.next();break;case 340:l.blockTableRecordId=s.value,s=i.next();break;case 146:l.blockScale=s.value,s=i.next();break;case 177:l.blockAttrNum=s.value,s=i.next();break;case 7:l.textStyle=s.value,s=i.next();break;case 140:l.textHeight=s.value,s=i.next();break;case 170:l.attachmentPoint=s.value,s=i.next();break;case 92:l.extendedCellFlags=s.value,s=i.next();break;case 285:l.rightBorderVisibility=!!(s.value??!0),s=i.next();break;case 286:l.bottomBorderVisibility=!!(s.value??!0),s=i.next();break;case 288:l.leftBorderVisibility=!!(s.value??!0),s=i.next();break;case 289:l.topBorderVisibility=!!(s.value??!0),s=i.next();break;case 301:(function(c,h,d){for(;d.code!==304;)switch(d.code){case 301:case 93:case 90:case 94:d=h.next();break;case 1:c.text=d.value,d=h.next();break;case 300:c.attrText=d.value,d=h.next();break;case 302:c.text=d.value?d.value:c.text,d=h.next();break;default:d=h.next()}})(l,i,s),s=i.next();break;default:return l}return o=!1,a=!1,l}(e,t)),t=e.lastReadGroup;break;default:fp(r,t,e),t=e.next()}}return r}}function Nh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}(is="ForEntityName")in jr?Object.defineProperty(jr,is,{value:"ACAD_TABLE",enumerable:!0,configurable:!0,writable:!0}):jr[is]="ACAD_TABLE";let w0=[{code:11,name:"xAxisDirection",parser:w},{code:210,name:"extrusionDirection",parser:w},{code:1,name:"text",parser:u},{code:10,name:"position",parser:w},{code:3,name:"styleName",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Yh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Nh(this,"parser",k(w0))}}Nh(Yh,"ForEntityName","TOLERANCE");var v0=((de={})[de.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",de[de.TANGENT_DEFINED=2]="TANGENT_DEFINED",de[de.NOT_USED=4]="NOT_USED",de[de.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",de[de.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",de[de.FOR_POLYLINE=32]="FOR_POLYLINE",de[de.FOR_POLYGON=64]="FOR_POLYGON",de[de.POLYFACE=128]="POLYFACE",de);let P0=[{code:[335,343,344,91],name:"softPointers",isMultiple:!0,parser:u},{code:361,name:"sunId",parser:u},{code:431,name:"ambientLightColorName",parser:u},{code:421,name:"ambientLightColorInstance",parser:u},{code:63,name:"ambientLightColorIndex",parser:u},{code:142,name:"contrast",parser:u},{code:141,name:"brightness",parser:u},{code:282,name:"defaultLightingType",parser:u},{code:292,name:"isDefaultLighting",parser:O},{code:348,name:"visualStyleId",parser:u},{code:333,name:"shadePlotId",parser:u},{code:332,name:"backgroundId",parser:u},{code:61,name:"majorGridFrequency",parser:u},{code:170,name:"shadePlotMode",parser:u},{code:146,name:"elevation",parser:u},{code:79,name:"orthographicType",parser:u},{code:346,name:"ucsBaseId",parser:u},{code:345,name:"ucsId",parser:u},{code:112,name:"ucsYAxis",parser:w},{code:111,name:"ucsXAxis",parser:w},{code:110,name:"ucsOrigin",parser:w},{code:74,name:"iconFlag",parser:u},{code:71,name:"ucsPerViewport",parser:u},{code:281,name:"renderMode",parser:u},{code:1,name:"sheetName",parser:u},{code:340,name:"clippingBoundaryId",parser:u},{code:90,name:"statusBitFlags",parser:u},{code:331,name:"frozenLayerIds",isMultiple:!0,parser:u},{code:72,name:"circleZoomPercent",parser:u},{code:51,name:"viewTwistAngle",parser:u},{code:50,name:"snapAngle",parser:u},{code:45,name:"viewHeight",parser:u},{code:44,name:"backClipZ",parser:u},{code:43,name:"frontClipZ",parser:u},{code:42,name:"perspectiveLensLength",parser:u},{code:17,name:"targetPoint",parser:w},{code:16,name:"viewDirection",parser:w},{code:15,name:"gridSpacing",parser:w},{code:14,name:"snapSpacing",parser:w},{code:13,name:"snapBase",parser:w},{code:12,name:"displayCenter",parser:w},{code:69,name:"viewportId",parser:u},{code:68,name:"status",parser:u},{code:41,name:"height",parser:u},{code:40,name:"width",parser:u},{code:10,name:"viewportCenter",parser:w},{code:100,name:"subclassMarker",parser:u,pushContext:!0},...j];class Gr{parseEntity(e,t){let r={};return k(P0)(t,e,r),r}}function Xh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}(ss="ForEntityName")in Gr?Object.defineProperty(Gr,ss,{value:"VIEWPORT",enumerable:!0,configurable:!0,writable:!0}):Gr[ss]="VIEWPORT";let A0={brightness:50,constrast:50,fade:0},S0=[{code:14,name:"boundary",isMultiple:!0,parser:w},{code:91,name:"numberOfVertices",parser:u},{code:71,name:"boundaryType",parser:u},{code:360,name:"imageDefReactorHardId",parser:u},{code:283,name:"fade",parser:u},{code:282,name:"contrast",parser:u},{code:281,name:"brightness",parser:u},{code:280,name:"isClipping",parser:O},{code:70,name:"displayFlag",parser:u},{code:340,name:"imageDefHardId",parser:u},{code:13,name:"imageSize",parser:w},{code:12,name:"vDirection",parser:w},{code:11,name:"uDirection",parser:w},{code:10,name:"position",parser:w},{code:90,name:"classVersion",parser:u},{code:100,name:"subclassMarker",parser:u},...j];class Rh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Xh(this,"parser",k(S0,A0))}}Xh(Rh,"ForEntityName","WIPEOUT");(ct={})[ct.ShowImage=1]="ShowImage",ct[ct.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",ct[ct.UseClippingBoundary=4]="UseClippingBoundary",ct[ct.Transparency=8]="Transparency";function Bh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let L0=[{code:11,name:"direction",parser:w},{code:10,name:"position",parser:w},{code:100,name:"subclassMarker",parser:u},...j];class Fh{parseEntity(e,t){let r={};return this.parser(t,e,r),r}constructor(){Bh(this,"parser",k(L0))}}Bh(Fh,"ForEntityName","XLINE");let I0=0;function Dh(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=I0++)}let E0=Object.fromEntries([Ec,Dr,Yc,Fc,zc,jc,Fr,Hc,Uc,Qc,eh,nh,ih,oh,Vr,lh,hh,Rc,uh,ph,yh,bh,wh,Ph,Sh,Ih,Th,Mh,kh,jr,kc,Yh,Kc,lo,Gr,Rh,Fh].map(n=>[n.ForEntityName,new n]));function zh(n,e){let t=[];for(;!X(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){e.rewind();break}let r=E0[n.value];if(r){let i=n.value;n=e.next();let s=r.parseEntity(e,n);s.type=i,Dh(s),t.push(s)}else e.debug}n=e.next()}return t}function T0(n,e){let t=null,r={};for(;!X(n,0,"EOF")&&!X(n,0,"ENDSEC");)n.code===9?t=typeof n.value=="string"?n.value:null:t!=null&&(n.code===10?r[t]=Yt(e):r[t]=n.value),n=e.next();return r}let vt=[{code:100,name:"subclassMarker",parser:u},{code:330,name:"ownerObjectId",parser:u},{code:102,isMultiple:!0,parser(n,e){for(;!X(n,0,"EOF")&&!X(n,102,"}");)n=e.next()}},{code:5,name:"handle",parser:u}],C0=[{code:70,name:"flag",parser:u},{code:2,name:"appName",parser:u},{code:100,name:"subclassMarker",parser:u},...vt],M0=k(C0),O0=k([{code:310,name:"bmpPreview",parser:u},{code:281,name:"scalability",parser:u},{code:280,name:"explodability",parser:u},{code:70,name:"insertionUnits",parser:u},{code:340,name:"layoutObjects",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),k0=k([...ao.map(n=>({...n,parser:u})),{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},{code:105,name:"handle",parser:u},...vt.filter(n=>n.code!==5)]),N0=k([{code:347,name:"materialObjectId",parser:u},{code:390,name:"plotStyleNameObjectId",parser:u},{code:370,name:"lineweight",parser:u},{code:290,name:"isPlotting",parser:O},{code:6,name:"lineType",parser:u},{code:62,name:"colorIndex",parser:u},{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),Y0=k([{code:9,name:"text",parser:u},{code:45,name:"offsetY",parser:u},{code:44,name:"offsetX",parser:u},{code:50,name:"rotation",parser:u},{code:46,name:"scale",parser:u},{code:340,name:"styleObjectId",parser:u},{code:75,name:"shapeNumber",parser:u},{code:74,name:"elementTypeFlag",parser:u},{code:49,name:"elementLength",parser:u}],{elementTypeFlag:0,elementLength:0}),X0=k([{code:49,name:"pattern",parser(n,e){let t={};return Y0(n,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:u},{code:73,name:"numberOfLineTypes",parser:u},{code:72,parser:u},{code:3,name:"description",parser:u},{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),R0=k([{code:1e3,name:"extendedFont",parser:u},{code:1001},{code:4,name:"bigFont",parser:u},{code:3,name:"font",parser:u},{code:42,name:"lastHeight",parser:u},{code:71,name:"textGenerationFlag",parser:u},{code:50,name:"obliqueAngle",parser:u},{code:41,name:"widthFactor",parser:u},{code:40,name:"fixedTextHeight",parser:u},{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),B0=[{code:13,name:"orthographicOrigin",parser:w},{code:71,name:"orthographicType",parser:u},{code:346,name:"baseUcsHandle",parser:u},{code:146,name:"elevation",parser:u},{code:79,name:"isOrthographic",parser:O},{code:12,name:"yAxis",parser:w},{code:11,name:"xAxis",parser:w},{code:10,name:"origin",parser:w},{code:70,name:"flag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt],F0=k(B0),D0=[{code:346,name:"baseUcsId",parser:u},{code:345,name:"ucsId",parser:u},{code:146,name:"elevation",parser:u},{code:79,name:"orthographicType",parser:u},{code:112,name:"ucsYAxis",parser:w},{code:111,name:"ucsXAxis",parser:w},{code:110,name:"ucsOrigin",parser:w},{code:361,name:"sunHardId",parser:u},{code:348,name:"styleHardId",parser:u},{code:334,name:"liveSectionSoftId",parser:u},{code:332,name:"backgroundSoftId",parser:u},{code:73,name:"isPlottable",parser:O},{code:72,name:"isUcsAssociated",parser:O},{code:281,name:"renderMode",parser:u},{code:71,name:"viewMode",parser:u},{code:50,name:"twistAngle",parser:u},{code:44,name:"backClippingPlane",parser:u},{code:43,name:"frontClippingPlane",parser:u},{code:42,name:"lensLength",parser:u},{code:12,name:"target",parser:w},{code:11,name:"direction",parser:w},{code:10,name:"center",parser:w},{code:41,name:"width",parser:u},{code:40,name:"height",parser:u},{code:70,name:"flag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt],z0=k(D0),V0=k([{code:[63,421,431],name:"ambientColor",parser:u},{code:142,name:"contrast",parser:u},{code:141,name:"brightness",parser:u},{code:282,name:"defaultLightingType",parser:u},{code:292,name:"isDefaultLightingOn",parser:O},{code:348,name:"visualStyleObjectId",parser:u},{code:333,name:"shadePlotObjectId",parser:u},{code:332,name:"backgroundObjectId",parser:u},{code:61,name:"majorGridLines",parser:u},{code:170,name:"shadePlotSetting",parser:u},{code:146,name:"elevation",parser:u},{code:79,name:"orthographicType",parser:u},{code:112,name:"ucsYAxis",parser:w},{code:111,name:"ucsXAxis",parser:w},{code:110,name:"ucsOrigin",parser:w},{code:74,name:"ucsIconSetting",parser:u},{code:71,name:"viewMode",parser:u},{code:281,name:"renderMode",parser:u},{code:1,name:"styleSheet",parser:u},{code:[331,441],name:"frozenLayers",parser:u,isMultiple:!0},{code:72,name:"circleSides",parser:u},{code:51,name:"viewTwistAngle",parser:u},{code:50,name:"snapRotationAngle",parser:u},{code:45,name:"viewHeight",parser:u},{code:44,name:"backClippingPlane",parser:u},{code:43,name:"frontClippingPlane",parser:u},{code:42,name:"lensLength",parser:u},{code:41,name:"aspectRatio",parser:u},{code:40,name:"viewHeight",parser:u},{code:17,name:"viewTarget",parser:w},{code:16,name:"viewDirectionFromTarget",parser:w},{code:15,name:"gridSpacing",parser:w},{code:14,name:"snapSpacing",parser:w},{code:13,name:"snapBasePoint",parser:w},{code:12,name:"center",parser:w},{code:11,name:"upperRightCorner",parser:w},{code:10,name:"lowerLeftCorner",parser:w},{code:70,name:"standardFlag",parser:u},{code:2,name:"name",parser:u},{code:100,name:"subclassMarker",parser:u},...vt]),j0={APPID:M0,BLOCK_RECORD:O0,DIMSTYLE:k0,LAYER:N0,LTYPE:X0,STYLE:R0,UCS:F0,VIEW:z0,VPORT:V0},G0=k([{code:70,name:"maxNumberOfEntries",parser:u},{code:100,name:"subclassMarker",parser:u},{code:330,name:"ownerObjectId",parser:u},{code:102,parser:qe},{code:102,parser:qe},{code:102,parser:qe},{code:360,isMultiple:!0},{code:5,name:"handle",parser:u},{code:2,name:"name",parser:u}]);function H0(n,e){var r;let t={};for(;!X(n,0,"EOF")&&!X(n,0,"ENDSEC");){if(X(n,0,"TABLE")){n=e.next();let i={entries:[]};G0(n,e,i),t[i.name]=i}if(X(n,0)&&!X(n,0,"ENDTAB")){let i=n.value;n=e.next();let s=j0[i];if(!s){e.debug,n=e.next();continue}let o={};s(n,e,o),i==="VPORT"&&(o.lowerLeftCorner==null&&(o.lowerLeftCorner={x:0,y:0}),o.upperRightCorner==null&&(o.upperRightCorner={x:1,y:1}),o.center==null&&(o.center={x:0,y:0}),o.snapBasePoint==null&&(o.snapBasePoint={x:0,y:0}),o.snapSpacing==null&&(o.snapSpacing={x:0,y:0}),o.gridSpacing==null&&(o.gridSpacing={x:0,y:0}),o.viewDirectionFromTarget==null&&(o.viewDirectionFromTarget={x:0,y:0,z:1}),o.viewTarget==null&&(o.viewTarget={x:0,y:0,z:0})),(r=t[i])==null||r.entries.push(o)}n=e.next()}return t}function W0(n,e){let t={};for(;!X(n,0,"EOF")&&!X(n,0,"ENDSEC");){if(X(n,0,"BLOCK")){let r=U0(n=e.next(),e);Dh(r),r.name&&(t[r.name]=r)}n=e.next()}return t}function U0(n,e){let t={};for(;!X(n,0,"EOF");){if(X(n,0,"ENDBLK")){for(n=e.next();!X(n,0,"EOF");){if(X(n,100,"AcDbBlockEnd"))return t;n=e.next()}break}switch(n.code){case 1:t.xrefPath=n.value;break;case 2:t.name=n.value;break;case 3:t.name2=n.value;break;case 5:t.handle=n.value;break;case 8:t.layer=n.value;break;case 10:t.position=Yt(e);break;case 67:t.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(t.type=n.value);break;case 100:break;case 330:t.ownerHandle=n.value;break;case 0:t.entities=zh(n,e)}n=e.next()}return t}let Pt=[{code:330,name:"ownerObjectId",parser:u},{code:102,parser:qe},{code:102,parser:qe},{code:102,parser:qe},{code:5,name:"handle",parser:u}],Vh=[{code:333,name:"shadePlotId",parser:u},{code:149,name:"imageOriginY",parser:u},{code:148,name:"imageOriginX",parser:u},{code:147,name:"scaleFactor",parser:u},{code:78,name:"shadePlotCustomDPI",parser:u},{code:77,name:"shadePlotResolution",parser:u},{code:76,name:"shadePlotMode",parser:u},{code:75,name:"standardScaleType",parser:u},{code:7,name:"currentStyleSheet",parser:u},{code:74,name:"plotType",parser:u},{code:73,name:"plotRotation",parser:u},{code:72,name:"plotPaperUnit",parser:u},{code:70,name:"layoutFlag",parser:u},{code:143,name:"printScaleDenominator",parser:u},{code:142,name:"printScaleNumerator",parser:u},{code:141,name:"windowAreaYMax",parser:u},{code:140,name:"windowAreaXMax",parser:u},{code:49,name:"windowAreaYMin",parser:u},{code:48,name:"windowAreaXMin",parser:u},{code:47,name:"plotOriginY",parser:u},{code:46,name:"plotOriginX",parser:u},{code:45,name:"paperHeight",parser:u},{code:44,name:"paperWidth",parser:u},{code:43,name:"marginTop",parser:u},{code:42,name:"marginRight",parser:u},{code:41,name:"marginBottom",parser:u},{code:40,name:"marginLeft",parser:u},{code:6,name:"plotViewName",parser:u},{code:4,name:"paperSize",parser:u},{code:2,name:"configName",parser:u},{code:1,name:"pageSetupName",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt],$0=[{code:346,name:"orthographicUcsId",parser:u},{code:345,name:"namedUcsId",parser:u},{code:331,name:"viewportId",parser:u},{code:330,name:"paperSpaceTableId",parser:u},{code:76,name:"orthographicType",parser:u},{code:17,name:"ucsYAxis",parser:w},{code:16,name:"ucsXAxis",parser:w},{code:13,name:"ucsOrigin",parser:w},{code:146,name:"elevation",parser:u},{code:15,name:"maxExtent",parser:w},{code:14,name:"minExtent",parser:w},{code:12,name:"insertionPoint",parser:w},{code:11,name:"maxLimit",parser:w},{code:10,name:"minLimit",parser:w},{code:71,name:"tabOrder",parser:u},{code:70,name:"controlFlag",parser:u},{code:1,name:"layoutName",parser:u},{code:100,name:"subclassMarker",parser:u},...Vh],q0=[{code:3,name:"entries",parser:(n,e)=>{let t={name:n.value};return(n=e.next()).code===350?t.objectSoftId=n.value:n.code===360?t.objectHardId=n.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:u},{code:280,name:"isHardOwned",parser:O},{code:100,name:"subclassMarker",parser:u},...Pt],K0=[{code:40,name:"wcsToOCSTransform",parser:ya},{code:40,name:"ocsToWCSTransform",parser:ya},{code:41,name:"backClippingDistance",parser:u},{code:73,name:"isBackClipping",parser:O,pushContext:!0},{code:40,name:"frontClippingDistance",parser:u},{code:72,name:"isFrontClipping",parser:O,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:O},{code:11,name:"position",parser:w},{code:210,name:"normal",parser:w},{code:10,name:"boundaryVertices",parser:w,isMultiple:!0},{code:70,name:"boundaryCount",parser:u},{code:100,name:"subclassMarker",parser:u},{code:100},...Pt];function ya(n,e){let t=[];for(let r=0;r<3&&X(n,40);++r){let i=[];for(let s=0;s<4&&X(n,40);++s)i.push(n.value),n=e.next();t.push(i)}return e.rewind(),t}let Z0=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:u},{code:90,name:"version",parser:u},{code:1,name:"fileName",parser:u},{code:10,name:"size",parser:w},{code:11,name:"sizeOfOnePixel",parser:w},{code:280,name:"isLoaded",parser:u},{code:281,name:"resolutionUnits",parser:u},{code:100,name:"subclassMarker",parser:u}],Q0=[{code:179,name:"unknown1",parser:u},{code:170,name:"contentType",parser:u},{code:171,name:"drawMLeaderOrderType",parser:u},{code:172,name:"drawLeaderOrderType",parser:u},{code:90,name:"maxLeaderSegmentPoints",parser:u},{code:40,name:"firstSegmentAngleConstraint",parser:u},{code:41,name:"secondSegmentAngleConstraint",parser:u},{code:173,name:"leaderLineType",parser:u},{code:91,name:"leaderLineColor",parser:u},{code:340,name:"leaderLineTypeId",parser:u},{code:92,name:"leaderLineWeight",parser:u},{code:290,name:"landingEnabled",parser:O},{code:42,name:"landingGap",parser:u},{code:291,name:"doglegEnabled",parser:O},{code:43,name:"doglegLength",parser:u},{code:3,name:"description",parser:u},{code:341,name:"arrowheadId",parser:u},{code:44,name:"arrowheadSize",parser:u},{code:300,name:"defaultMTextContents",parser:u},{code:342,name:"textStyleId",parser:u},{code:174,name:"textLeftAttachmentType",parser:u},{code:175,name:"textAngleType",parser:u},{code:176,name:"textAlignmentType",parser:u},{code:178,name:"textRightAttachmentType",parser:u},{code:93,name:"textColor",parser:u},{code:45,name:"textHeight",parser:u},{code:292,name:"textFrameEnabled",parser:O},{code:297,name:"textAlignAlwaysLeft",parser:O},{code:46,name:"alignSpace",parser:u},{code:343,name:"blockContentId",parser:u},{code:94,name:"blockContentColor",parser:u},{code:47,name:"blockContentScale.x",parser:u},{code:49,name:"blockContentScale.y",parser:u},{code:140,name:"blockContentScale.z",parser:u},{code:293,name:"blockContentScaleEnabled",parser:O},{code:141,name:"blockContentRotation",parser:u},{code:294,name:"blockContentRotationEnabled",parser:O},{code:177,name:"blockContentConnectionType",parser:u},{code:142,name:"scale",parser:u},{code:295,name:"overwritePropertyValue",parser:O},{code:296,name:"annotative",parser:O},{code:143,name:"breakGapSize",parser:u},{code:271,name:"textAttachmentDirection",parser:u},{code:272,name:"bottomTextAttachmentDirection",parser:u},{code:273,name:"topTextAttachmentDirection",parser:u},{code:298,name:"unknown2",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt];function Yr(n,e,t){n.elements||(n.elements=[]);let r=n.elements.find(i=>i[e]===void 0);if(r){r[e]=t;return}n.elements.push({[e]:t})}let J0=[{code:6,parser:function({value:n},e,t){Yr(t,"lineType",n)},isMultiple:!0},{code:62,parser:function({value:n},e,t){var r;if(t.fillColorIndex===void 0&&!((r=t.elements)!=null&&r.length)){t.fillColorIndex=n;return}Yr(t,"colorIndex",n)},isMultiple:!0},{code:420,parser:function({value:n},e,t){var r;if(t.fillColor===void 0&&!((r=t.elements)!=null&&r.length)){t.fillColor=n;return}Yr(t,"color",n)},isMultiple:!0},{code:49,parser:function({value:n},e,t){Yr(t,"offset",n)},isMultiple:!0},{code:71,name:"elementCount",parser:u},{code:52,name:"endAngle",parser:u},{code:51,name:"startAngle",parser:u},{code:3,name:"description",parser:u},{code:70,name:"flags",parser:u},{code:2,name:"styleName",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt],ef=[{code:340,name:"entityIds",parser:u,isMultiple:!0},{code:71,name:"isSelectable",parser:O},{code:70,name:"isUnnamed",parser:O},{code:300,name:"description",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt],tf=[{code:8,name:"layerNames",parser:u,isMultiple:!0},{code:100,name:"subclassMarker",parser:u},{code:100,name:"filterSubclassMarker",parser:u},...Pt],nf=[{code:90,name:"idBufferEntryCounts",parser:u,isMultiple:!0},{code:360,name:"idBufferIds",parser:u,isMultiple:!0},{code:8,name:"layerNames",parser:u,isMultiple:!0},{code:100,name:"subclassMarker",parser:u},{code:40,name:"timeStamp",parser:u},{code:100,name:"indexSubclassMarker",parser:u},...Pt],rf=[{code:75,name:"hasLastPointRef",parser:O},{code:1,name:"pointRefs",parser:function(n,e){let t={className:n.value};for(;;)switch((n=e.next()).code){case 72:t.objectOsnapType=n.value;continue;case 331:t.mainObjectId=n.value;continue;case 73:t.mainObjectSubentityType=n.value;continue;case 91:t.mainObjectGsMarker=n.value;continue;case 301:t.mainObjectXrefHandle=n.value;continue;case 40:t.nearOsnapGeometryParameter=n.value;continue;case 10:{let r=w(n,e);t.osnapPoint="z"in r?r:{...r,z:0}}continue;case 332:t.intersectionObjectId=n.value;continue;case 74:t.intersectionObjectSubentityType=n.value;continue;case 92:t.intersectionObjectGsMarker=n.value;continue;case 302:t.intersectionObjectXrefHandle=n.value;continue;default:return e.rewind(),t}},isMultiple:!0},{code:71,name:"rotatedDimensionType",parser:u},{code:70,name:"transSpaceFlag",parser:O},{code:90,name:"associativityFlag",parser:u},{code:330,name:"dimensionObjectId",parser:u},{code:100,name:"subclassMarker",parser:u},...Pt],sf={LAYOUT:$0,PLOTSETTINGS:Vh,DICTIONARY:q0,SPATIAL_FILTER:K0,IMAGEDEF:Z0,MLEADERSTYLE:Q0,MLINESTYLE:J0,GROUP:ef,LAYER_FILTER:tf,LAYER_INDEX:nf,DIMASSOC:rf};function of(n,e){let t=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let r=n.value,i=sf[r];if(n.code===0&&(i!=null&&i.length)){let s=k(i),o={name:r};s(n=e.next(),e,o)?(t.push(o),n=e.peek()):n=e.next()}else n=e.next()}return{byName:dp(t,({name:r})=>r)}}function _a(n){if((n.charCodeAt(0)===65279?n.slice(1):n).startsWith("AutoCAD Binary DXF"))throw Error("Binary DXF is not supported. Re-save the drawing as ASCII (text) DXF from your CAD application.")}function rr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class af{constructor(){rr(this,"encoding","utf-8"),rr(this,"encodingFailureFatal",!1),rr(this,"thumbnailImageFormat","base64")}}class lf extends EventTarget{parseSync(e,t=!1){_a(e);let r=new pa(e.split(/\r\n|\r|\n/g),t);if(!r.hasNext())throw Error("Empty file");return this.parseAll(r)}parseStream(e){let t="",r=this;return new Promise((i,s)=>{e.on("data",o=>{t+=o}),e.on("end",()=>{try{_a(t);let o=t.split(/\r\n|\r|\n/g),a=new pa(o);if(!a.hasNext())throw Error("Empty file");i(r.parseAll(a))}catch(o){s(o)}}),e.on("error",o=>{s(o)})})}async parseFromUrl(e,t){let r=await fetch(e,t);if(!r.body)return null;let i=r.body.getReader(),s="";for(;;){let{done:o,value:a}=await i.read();if(o){s+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}s+=this._decoder.decode(a,{stream:!0})}return this.parseSync(s)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},r=e.next();for(;!X(r,0,"EOF");)X(r,0,"SECTION")&&(X(r=e.next(),2,"HEADER")?t.header=T0(r=e.next(),e):X(r,2,"CLASSES")?Kg(r=e.next(),e,t):X(r,2,"BLOCKS")?t.blocks=W0(r=e.next(),e):X(r,2,"ENTITIES")?t.entities=zh(r=e.next(),e):X(r,2,"TABLES")?t.tables=H0(r=e.next(),e):X(r,2,"OBJECTS")?t.objects=of(r=e.next(),e):X(r,2,"THUMBNAILIMAGE")&&(t.thumbnailImage=function(i,s,o="base64"){let a,l="",c=0;for(;!X(i,0,"EOF")&&!X(i,0,"ENDSEC");)i.code===90?c=i.value:i.code===310&&(l+=i.value),i=s.next();if(o==="hex")a=l;else{let h=function(d){let p=d.length/2,g=new Uint8Array(p);for(let f=0;f<p;f++)g[f]=parseInt(d.substr(2*f,2),16);return g}(l);a=o==="buffer"?h:function(d){let p="";for(let g=0;g<d.length;g++)p+=String.fromCharCode(d[g]);return btoa(p)}(h)}return{size:c,data:a}}(r=e.next(),e,this._options.thumbnailImageFormat))),r=e.next();return t}constructor(e={}){super(),rr(this,"_decoder",void 0),rr(this,"_options",void 0);let t=new af;this._options=Object.assign(t,e),this._decoder=new TextDecoder(this._options.encoding,{fatal:this._options.encodingFailureFatal})}}(Ce={})[Ce.NOT_APPLICABLE=0]="NOT_APPLICABLE",Ce[Ce.KEEP_EXISTING=1]="KEEP_EXISTING",Ce[Ce.USE_CLONE=2]="USE_CLONE",Ce[Ce.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",Ce[Ce.VALUE_NAME=4]="VALUE_NAME",Ce[Ce.UNMANGLE_NAME=5]="UNMANGLE_NAME";(Qt={})[Qt.NOUNIT=0]="NOUNIT",Qt[Qt.CENTIMETERS=2]="CENTIMETERS",Qt[Qt.INCH=5]="INCH";(Un={})[Un.PSLTSCALE=1]="PSLTSCALE",Un[Un.LIMCHECK=2]="LIMCHECK";(Jt={})[Jt.INCHES=0]="INCHES",Jt[Jt.MILLIMETERS=1]="MILLIMETERS",Jt[Jt.PIXELS=2]="PIXELS";(Me={})[Me.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",Me[Me.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",Me[Me.DRAWING_LIMITS=2]="DRAWING_LIMITS",Me[Me.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",Me[Me.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",Me[Me.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(ht={})[ht.AS_DISPLAYED=0]="AS_DISPLAYED",ht[ht.WIREFRAME=1]="WIREFRAME",ht[ht.HIDDEN=2]="HIDDEN",ht[ht.RENDERED=3]="RENDERED";(Oe={})[Oe.DRAFT=0]="DRAFT",Oe[Oe.PREVIEW=1]="PREVIEW",Oe[Oe.NORMAL=2]="NORMAL",Oe[Oe.PRESENTATION=3]="PRESENTATION",Oe[Oe.MAXIMUM=4]="MAXIMUM",Oe[Oe.CUSTOM=5]="CUSTOM";(dt={})[dt.NONE=0]="NONE",dt[dt.AbsoluteRotation=1]="AbsoluteRotation",dt[dt.TextEmbedded=2]="TextEmbedded",dt[dt.ShapeEmbedded=4]="ShapeEmbedded";(os={})[os.PaperSpace=1]="PaperSpace";(en={})[en.XrefDependent=16]="XrefDependent",en[en.XrefResolved=32]="XrefResolved",en[en.Referenced=64]="Referenced";(ke={})[ke.Off=0]="Off",ke[ke.Perspective=1]="Perspective",ke[ke.ClipFront=2]="ClipFront",ke[ke.ClipBack=4]="ClipBack",ke[ke.UcsFollow=8]="UcsFollow",ke[ke.ClipFrontByFrontZ=16]="ClipFrontByFrontZ";class cf{parse(e){const t=new lf,r=this.getDxfInfoFromBuffer(e);let i="";return r.version&&r.version.value<=23&&r.encoding?i=new TextDecoder(r.encoding).decode(e):i=new TextDecoder().decode(e),t.parseSync(i)}getDxfInfoFromBuffer(e){var c,h,d;const r=new TextDecoder("utf-8");let i=0,s="",o=null,a=null,l=!1;for(;i<e.byteLength;){const p=Math.min(i+65536,e.byteLength),g=e.slice(i,p);i=p;const m=(s+r.decode(g,{stream:!0})).split(/\r?\n/);s=m.pop()??"";for(let y=0;y<m.length;y++){const _=m[y].trim();if(_==="SECTION"&&((c=m[y+2])==null?void 0:c.trim())==="HEADER")l=!0;else if(_==="ENDSEC"&&l)return{version:o,encoding:a};if(l&&_==="$ACADVER"){const P=(h=m[y+2])==null?void 0:h.trim();P&&(o=new Ye(P))}else if(l&&_==="$DWGCODEPAGE"){const P=(d=m[y+2])==null?void 0:d.trim();if(P){const L=Ks[P];a=Ml(L)}}if(o&&a)return{version:o,encoding:a}}}return{version:o,encoding:a}}}class ba{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="3DFACE"?this.convertFace(e):e.type=="ARC"?this.convertArc(e):e.type=="ATTDEF"?this.convertAttributeDefinition(e):e.type=="ATTRIB"?this.convertAttribute(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="LWPOLYLINE"?this.convertLWPolyline(e):e.type=="MTEXT"?this.convertMText(e):e.type=="MLINE"?this.convertMLine(e):e.type=="MULTILEADER"||e.type=="MLEADER"?this.convertMLeader(e):e.type=="POLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SHAPE"?this.convertShape(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertFace(e){const t=new ri;return e.vertices.forEach((r,i)=>t.setVertexAt(i,r)),t}convertArc(e){const t=e.extrusionDirection??x.Z_AXIS;return new Qr(us(e.center,t),e.radius,T.degToRad(e.startAngle),T.degToRad(e.endAngle),t)}convertAttributeCommon(e,t){t.textString=e.text,t.height=e.textHeight,t.position.copy(e.startPoint);const r=e.alignmentPoint,i=!r||r.x===0&&r.y===0&&(r.z??0)===0;r&&!i?t.alignmentPoint.copy(r):t.alignmentPoint.copy(e.startPoint),t.rotation=e.rotation,t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.tag=e.tag,t.fieldLength=0,t.isInvisible=(e.attributeFlag&oe.Invisible)!==0,t.isConst=(e.attributeFlag&oe.Const)!==0,t.isVerifiable=(e.attributeFlag&oe.Verifiable)!==0,t.isPreset=(e.attributeFlag&oe.Preset)!==0,t.isReallyLocked=!!e.isReallyLocked,t.isMTextAttribute=(e.mtextFlag&Ue.MultiLine)!==0,t.isConstMTextAttribute=(e.mtextFlag&Ue.ConstMultiLine)!==0}convertAttribute(e){const t=new ei;return this.convertAttributeCommon(e,t),t.styleName=e.textStyle,t.horizontalMode=e.horizontalJustification,t.verticalMode=e.verticalJustification,t.widthFactor=e.scale??1,t.lockPositionInBlock=e.lockPositionFlag,t}convertAttributeDefinition(e){const t=new Jr;return this.convertAttributeCommon(e,t),t.styleName=e.styleName,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t.prompt=e.prompt,t}convertCirle(e){const t=e.extrusionDirection??x.Z_AXIS;return new ti(us(e.center,t),e.radius,t)}convertEllipse(e){const t=new x(e.majorAxisEndPoint),r=t.length();return new ni(e.center,e.extrusionDirection??x.Z_AXIS,t,r,r*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,r=e.endPoint;return new hr(new b(t.x,t.y,t.z||0),new b(r.x,r.y,r.z||0))}convertSpline(e){try{if(e.numberOfControlPoints>0&&e.numberOfKnots>0)return new ur(e.controlPoints,e.knots,e.weights,e.degree,!!(e.flag&1));if(e.numberOfFitPoints>0)return new ur(e.fitPoints,"Uniform",e.degree,!!(e.flag&1))}catch{}return null}convertPoint(e){const t=new ci;return t.position=e.position,t}convertShape(e){const t=new di;return t.position.copy(e.insertionPoint),t.size=e.size,t.name=e.shapeName,t.rotation=T.degToRad(e.rotation||0),t.widthFactor=e.xScale??1,t.oblique=T.degToRad(e.obliqueAngle||0),t.thickness=e.thickness??0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}convertSolid(e){const t=new li;return e.points.forEach((r,i)=>t.setPointAt(i,r)),t.thickness=e.thickness,t}convertPolyline(e){var h;const t=!!(e.flag&1),r=!!(e.flag&8),i=!!(e.flag&16),s=!!(e.flag&64),o=!!(e.flag&32),a=[],l=[],c=[];if((h=e.vertices)==null||h.map(d=>{d.flag&v0.SPLINE_CONTROL_POINT||(s&&d.flag&128?d.flag&64?(a.push({x:d.x,y:d.y,z:d.z}),l.push(d.bulge??0)):d.faces&&d.faces.length>=3&&c.push([...d.faces]):(a.push({x:d.x,y:d.y,z:d.z}),l.push(d.bulge??0)))}),i){const d=e.meshMVertexCount,p=e.meshNVertexCount;return new fi(d,p,a,t,o)}else{if(s)return new mi(a,c);if(r){let d=er.SimplePoly;return e.flag&4&&(e.smoothType==Nr.CUBIC?d=er.CubicSplinePoly:e.smoothType==Nr.QUADRATIC&&(d=er.QuadSplinePoly)),new Zr(d,a,t)}else{let d=_n.SimplePoly;return e.flag&2?d=_n.FitCurvePoly:e.flag&4&&(e.smoothType==Nr.CUBIC?d=_n.CubicSplinePoly:e.smoothType==Nr.QUADRATIC&&(d=_n.QuadSplinePoly)),new Kr(d,a,0,t,e.startWidth,e.endWidth,l)}}}convertLWPolyline(e){var i;const t=new Ae;t.closed=!!(e.flag&1);const r=e.constantWidth??-1;return(i=e.vertices)==null||i.forEach((s,o)=>{t.addVertexAt(o,new E(s.x,s.y),s.bulge,s.startWidth??r,s.endWidth??r)}),t}convertHatch(e){var i;const t=new cr;if((i=e.definitionLines)==null||i.forEach(s=>{t.definitionLines.push({angle:T.degToRad(s.angle||0),base:s.base,offset:s.offset,dashLengths:s.numberOfDashLengths>0?s.dashLengths:[]})}),t.isSolidFill=e.solidFill==Vg.SolidFill,t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:T.degToRad(e.patternAngle),t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(s=>{if(s.boundaryPathTypeFlag&2){const a=s,l=new ee;l.closed=a.isClosed,a.vertices.forEach((c,h)=>{l.addVertexAt(h,{x:c.x,y:c.y,bulge:c.bulge})}),t.add(l)}else{const a=s,l=[];a.edges.forEach(h=>{if(h.type==1){const d=h;l.push(new _t(d.start,d.end))}else if(h.type==2){const d=h;l.push(new Re(d.center,d.radius,T.degToRad(d.startAngle||0),T.degToRad(d.endAngle||0),!d.isCCW))}else if(h.type==3){const d=h;new Z().subVectors(d.end,d.center);const g=Math.sqrt(Math.pow(d.end.x,2)+Math.pow(d.end.y,2)),f=g*d.lengthOfMinorAxis;let m=T.degToRad(d.startAngle||0),y=T.degToRad(d.endAngle||0);const _=Math.atan2(d.end.y,d.end.x);d.isCCW||(m=Math.PI*2-m,y=Math.PI*2-y),l.push(new Ln({...d.center,z:0},g,f,m,y,!d.isCCW,_))}else if(h.type==4){const d=h;if(d.numberOfControlPoints>0&&d.numberOfKnots>0){const p=d.controlPoints.map(m=>({x:m.x,y:m.y,z:0}));let g=!0;const f=d.controlPoints.map(m=>(m.weight==null&&(g=!1),m.weight||1));l.push(new $e(p,d.knots,g?f:void 0))}else if(d.numberOfFitData>0){const p=d.fitDatum.map(g=>({x:g.x,y:g.y,z:0}));l.push(new $e(p,"Uniform"))}}});const c=or.buildFromEdges(l);c.length==0&&l.length>0?t.add(new or(l)):c.forEach(h=>t.add(h))}}),e.gradientFlag){const s=e;if(t.hatchObjectType=Qs.GradientObject,t.gradientName=s.gradientName,t.gradientAngle=s.gradientRotation??0,t.gradientShift=s.gradientDefinition??0,t.gradientOneColorMode=s.gradientColorFlag==1,t.shadeTintValue=s.colorTint??0,s.gradientColors){const o=s.gradientColors.length;o>1?(t.gradientStartColor=s.gradientColors[0].rgb,t.gradientEndColor=s.gradientColors[1].rgb):o>0&&(t.gradientStartColor=s.gradientColors[0].rgb)}}return t}convertTable(e){const t=new ai(e.name,e.rowCount,e.columnCount);return t.tableDataVersion=e.version,t.tableStyleId=e.tableStyleId,t.owningBlockRecordId=e.blockRecordHandle,e.directionVector&&(t.horizontalDirection=new x(e.directionVector)),t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),t.tableValueFlag=e.tableValue,t.tableOverrideFlag=e.overrideFlag,t.borderColorOverrideFlag=e.borderColorOverrideFlag,t.borderLineweightOverrideFlag=e.borderLineWeightOverrideFlag,t.borderVisibilityOverrideFlag=e.borderVisibilityOverrideFlag,e.columnWidthArr.forEach((r,i)=>t.setColumnWidth(i,r)),e.rowHeightArr.forEach((r,i)=>t.setRowHeight(i,r)),e.cells.forEach((r,i)=>{t.setCell(i,r)}),t}convertText(e){const t=new In;t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint);const r=e.endPoint,i=!r||r.x===0&&r.y===0&&(r.z??0)===0;return r&&!i?t.alignmentPoint.copy(r):t.alignmentPoint.copy(e.startPoint),t.rotation=T.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new dr;return t.contents=e.text,e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=T.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new x(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){var r;const t=new ii;return(r=e.vertices)==null||r.forEach(i=>{t.appendVertex(i)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isHookLineSameDirection=e.isHooklineSameDirection,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName??"",t.annoType=e.leaderCreationFlag,t.textHeight=e.textHeight??0,t.textWidth=e.textWidth??0,t.byBlockColor=e.byBlockColor,t.associatedAnnotation=e.associatedAnnotation??"",e.normal&&(t.normal=e.normal),e.horizontalDirection&&(t.horizontalDirection=e.horizontalDirection),e.offsetFromBlock&&(t.offsetFromBlock=e.offsetFromBlock),e.offsetFromAnnotation&&(t.offsetFromAnnotation=e.offsetFromAnnotation),t}convertMLine(e){const t=new si;return t.styleName=e.name||"STANDARD",t.styleObjectHandle=e.styleObjectHandle,t.scale=e.scale,t.justification=e.justification,t.flags=e.flags,t.styleCount=e.styleCount,t.startPosition=e.startPosition,t.normal=e.extrusionDirection??x.Z_AXIS,t.segments=(e.segments??[]).map(r=>{var i;return{position:r.position,direction:r.direction,miterDirection:r.miterDirection,elements:((i=r.elements)==null?void 0:i.map(s=>({parameterCount:s.parameterCount,parameters:s.parameters??[],fillCount:s.fillCount,fillParameters:s.fillParameters??[]})))??[]}}),t}convertMLeader(e){var L,S;const t=new oi,r=e;t.version=e.version,t.leaderStyleId=e.leaderStyleId,e.leaderStyleId&&(t.mleaderStyleId=e.leaderStyleId),t.propertyOverrideFlag=e.propertyOverrideFlag,t.leaderLineType=e.leaderLineType??An.StraightLeader,t.leaderLineColor=e.leaderLineColor,t.leaderLineTypeId=e.leaderLineTypeId,t.leaderLineWeight=e.leaderLineWeight,t.landingEnabled=e.landingEnabled,t.doglegEnabled=e.doglegEnabled??!1,t.doglegLength=e.doglegLength??0,t.arrowheadId=e.arrowheadId,t.arrowheadSize=e.arrowheadSize,t.textStyleId=e.textStyleId,t.textLeftAttachmentType=e.textLeftAttachmentType,t.textRightAttachmentType=e.textRightAttachmentType,t.textAngleType=e.textAngleType,t.textAlignmentType=e.textAlignmentType,t.textColor=e.textColor,t.textFrameEnabled=e.textFrameEnabled,t.landingGap=e.landingGap,t.textAttachment=e.textAttachment,t.textFlowDirection=e.textFlowDirection,t.blockContentId=e.blockContentId,t.blockContentColor=e.blockContentColor,t.blockContentRotation=e.blockContentRotation,t.blockContentConnectionType=e.blockContentConnectionType,t.annotativeScaleEnabled=e.annotativeScaleEnabled,t.arrowheadOverrides=e.arrowheadOverrides?e.arrowheadOverrides.map(A=>({...A})):[],t.blockAttributes=e.blockAttributes?e.blockAttributes.map(A=>({...A})):[],t.textDirectionNegative=e.textDirectionNegative,t.textAlignInIPE=e.textAlignInIPE,t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection,t.topTextAttachmentDirection=e.topTextAttachmentDirection,t.contentScale=e.contentScale,t.textLineSpacingStyle=e.textLineSpacingStyle,t.textBackgroundColor=e.textBackgroundColor,t.textBackgroundScaleFactor=e.textBackgroundScaleFactor,t.textBackgroundTransparency=e.textBackgroundTransparency,t.textBackgroundColorOn=e.textBackgroundColorOn,t.textFillOn=e.textFillOn,t.textColumnType=e.textColumnType,t.textUseAutoHeight=e.textUseAutoHeight,t.textColumnWidth=e.textColumnWidth,t.textColumnGutterWidth=e.textColumnGutterWidth,t.textColumnFlowReversed=e.textColumnFlowReversed,t.textColumnHeight=e.textColumnHeight,t.textUseWordBreak=e.textUseWordBreak,t.hasMText=e.hasMText,t.hasBlock=e.hasBlock,t.planeNormalReversed=e.planeNormalReversed,e.blockContentScale&&(t.blockContentScale=new x(e.blockContentScale)),e.contentBasePosition&&(t.contentBasePosition=new b().copy(e.contentBasePosition)),e.textAnchor&&(t.textAnchor=new b().copy(e.textAnchor)),e.planeOrigin&&(t.planeOrigin=new b().copy(e.planeOrigin)),e.planeXAxisDirection&&(t.planeXAxisDirection=new x(e.planeXAxisDirection)),e.planeYAxisDirection&&(t.planeYAxisDirection=new x(e.planeYAxisDirection));const i=r.textContent,s=i&&typeof i=="object"?i:void 0,o=typeof i=="string"&&i.length>0||this.readString(s??{},["text","contents"])!=null||this.readString(r,["text","contents","mtext"])!=null,a=e.contentType??(o?yt.MTextContent:e.blockContent?yt.BlockContent:yt.NoneContent);t.contentType=a;const l=this.readPoint(r,["normal","extrusionDirection"]);l&&(t.normal=l);const c=this.readString(s??{},["styleName","textStyleName","textStyle"])??this.readString(r,["textStyleName","textStyle","styleName","textStyleId"]);c&&(t.textStyleName=c);const h=this.readPositiveNumber(s??{},["textHeight","height"])??this.readPositiveNumber(r,["textHeight","mtextHeight","textContentHeight"])??this.readPositiveNumber(r,["arrowheadSize","contentScale"]);h!=null&&(t.textHeight=h);const d=this.readPositiveNumber(s??{},["textWidth","width"])??this.readPositiveNumber(r,["textWidth","mtextWidth","textContentWidth"]);d!=null&&(t.textWidth=d),t.textLineSpacingFactor=this.readNumber(s??{},["lineSpacingFactor","textLineSpacingFactor"])??this.readNumber(r,["textLineSpacingFactor"])??t.textLineSpacingFactor;const p=this.readNumber(s??{},["textRotation","rotation"])??this.readNumber(r,["textRotation","mtextRotation","textContentRotation"]);p!=null&&(t.textRotation=T.degToRad(p));const g=this.readPoint(r,["textDirection","mtextDirection","textDirectionVector"]);g&&(t.textDirection=g);const f=this.readNumber(r,["textAttachmentPoint","attachmentPoint"]);f!=null&&(t.textAttachmentPoint=f);const m=e.textAttachmentDirection;m!=null&&(t.textAttachmentDirection=m);const y=this.readNumber(r,["textDrawingDirection","drawingDirection"]);y!=null&&(t.textDrawingDirection=y);const _=typeof i=="string"?i:this.readString(s??{},["text","contents"])??this.readString(r,["text","contents","mtext"]),P=this.readPoint(s??{},["anchorPoint","textAnchor","textLocation","textPosition","textAnchorPoint"])??this.readPoint(r,["textAnchor","textLocation","textPosition","textAnchorPoint","contentBasePosition"]);if(_!=null&&P&&(t.mtextContent={text:_,anchorPoint:P}),e.blockContent){const A=e.blockContent;t.blockContent={blockContentId:e.blockContent.blockContentId,normal:this.readPoint(A,["normal"]),position:e.blockContent.position,scale:this.readPoint(A,["scale"]),rotation:this.readNumber(A,["rotation"]),color:this.readNumber(A,["color"]),transformationMatrix:Array.isArray(e.blockContent.transformationMatrix)?e.blockContent.transformationMatrix:[]}}else e.blockContentId&&(t.blockContent={blockContentId:e.blockContentId,scale:e.blockContentScale,rotation:e.blockContentRotation,color:e.blockContentColor,transformationMatrix:[]});return(L=this.readMLeaderLeaders(r))==null||L.forEach(A=>{t.addLeader({lastLeaderLinePoint:A.lastLeaderLinePoint,lastLeaderLinePointSet:A.lastLeaderLinePointSet,doglegVector:A.doglegVector,doglegVectorSet:A.doglegVectorSet,doglegLength:A.doglegLength??e.doglegLength,breaks:A.breaks,leaderBranchIndex:A.leaderBranchIndex,leaderLines:A.leaderLines})}),t.numberOfLeaders===0&&((S=this.readLeaderLineArray(r))==null||S.forEach(A=>{t.addLeader({doglegLength:e.doglegLength}),t.addLeaderLine(t.numberOfLeaders-1,A)})),t.numberOfLeaders===0&&e.contentBasePosition&&t.addLeader({lastLeaderLinePoint:e.contentBasePosition,lastLeaderLinePointSet:!0,doglegLength:e.doglegLength}),t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"){const t=e,r=new pr(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(r.dimBlockPosition={...t.insertionPoint,z:0}),r.rotation=T.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDbRotatedDimension"){const t=e,r=new vi(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(r.dimBlockPosition={...t.insertionPoint,z:0}),r.rotation=T.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,r=new _i(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,r=new xi(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,r=new wi(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,r),r}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,r=new bi(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,r),r}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,t.imageDefId=e.imageDefHandle,t.isClipped=e.isClipped,e.clippingBoundaryPath.forEach(r=>{t.clipBoundary.push(new E(r))}),t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new gr;return this.processImage(e,t),t.clipBoundaryType=e.clippingBoundaryType,t}processWipeout(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.displayFlag|4)>0,t.isImageShown=(e.displayFlag|3)>0,t.isImageTransparent=(e.displayFlag|8)>0,t.imageDefId=e.imageDefHardId,t.isClipped=e.isClipping,e.boundary.forEach(r=>{t.clipBoundary.push(new E(r))}),t.clipBoundaryType=e.boundaryType,t.width=Math.sqrt(e.uDirection.x**2+e.uDirection.y**2+e.uDirection.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vDirection.x**2+e.vDirection.y**2+e.vDirection.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uDirection.y,e.uDirection.x)}convertWipeout(e){const t=new gi;return this.processWipeout(e,t),t}convertViewport(e){const t=new ui;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new hi;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertXline(e){const t=new pi;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertBlockReference(e){const t=new sn(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?T.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(e,t){if(t.layer=e.layer||"0",e.handle&&(t.objectId=e.handle.toString()),t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null||e.colorIndex!=null||e.colorName){const r=new R;e.color!=null&&r.setRGBValue(e.color),e.colorIndex!=null&&(r.colorIndex=e.colorIndex),e.colorName&&(r.colorName=e.colorName),t.color=r}e.isVisible!=null&&(t.visibility=!e.isVisible),e.transparency!=null&&(t.transparency=te.deserialize(e.transparency))}readNumber(e,t){for(const r of t){const i=e[r];if(typeof i=="number"&&Number.isFinite(i))return i}}readPositiveNumber(e,t){const r=this.readNumber(e,t);return r!=null&&r>0?r:void 0}readString(e,t){for(const r of t){const i=e[r];if(typeof i=="string")return i}}readBoolean(e,t){for(const r of t){const i=e[r];if(typeof i=="boolean")return i;if(typeof i=="number")return i!==0}}readPoint(e,t){for(const r of t){const i=e[r];if(this.isPointLike(i))return i;if(Array.isArray(i)&&typeof i[0]=="number"&&typeof i[1]=="number")return{x:i[0],y:i[1],z:i[2]??0}}}readLeaderLineArray(e){const t=e.leaderLines;if(Array.isArray(t))return t.map(i=>{if(!i||typeof i!="object")return;const s=i.vertices;return Array.isArray(s)?s.filter(o=>this.isPointLike(o)):void 0}).filter(i=>!!i&&i.length>0);const r=e.vertices;if(Array.isArray(r)){const i=r.filter(s=>this.isPointLike(s));return i.length>0?[i]:void 0}}readMLeaderLeaders(e){const t=e.leaderSections;if(!Array.isArray(t))return;const r=[];return t.forEach(i=>{if(!i||typeof i!="object")return;const s=i,o=s.leaderLines,a=Array.isArray(o)?o.reduce((f,m)=>{const y=this.readMLeaderLine(m);return y&&f.push(y),f},[]):void 0,l={},c=this.readPoint(s,["lastLeaderLinePoint"]),h=this.readPoint(s,["doglegVector"]),d=this.readNumber(s,["doglegLength"]),p=this.readMLeaderBreaks(s.breaks),g=this.readNumber(s,["leaderBranchIndex"]);c&&(l.lastLeaderLinePoint=c),s.lastLeaderLinePointSet!=null&&(l.lastLeaderLinePointSet=this.readBoolean(s,["lastLeaderLinePointSet"])),h&&(l.doglegVector=h),s.doglegVectorSet!=null&&(l.doglegVectorSet=this.readBoolean(s,["doglegVectorSet"])),d!=null&&(l.doglegLength=d),p&&(l.breaks=p),g!=null&&(l.leaderBranchIndex=g),a&&(l.leaderLines=a),r.push(l)}),r}readMLeaderLine(e){if(!e||typeof e!="object")return;const t=e,r=t.vertices,i=Array.isArray(r)?r.filter(l=>this.isPointLike(l)):[],s=this.readMLeaderBreaks(t.breaks),o=Array.isArray(t.breakPointIndexes)?t.breakPointIndexes.filter(l=>typeof l=="number"):void 0,a=this.readNumber(t,["leaderLineIndex"]);return i.length>0||s&&s.length>0?{vertices:i,breakPointIndexes:o,leaderLineIndex:a,breaks:s}:void 0}readMLeaderBreaks(e){if(!Array.isArray(e))return;const t=e.map(r=>{if(!r||typeof r!="object")return;const i=r,s=this.readPoint(i,["start"]),o=this.readPoint(i,["end"]),a=this.readNumber(i,["index"]);if(!s||!o)return;const l={start:s,end:o};return a!=null&&(l.index=a),l}).filter(r=>!!r);return t.length>0?t:void 0}isPointLike(e){return!!e&&typeof e=="object"&&typeof e.x=="number"&&typeof e.y=="number"}}class hf{convertLayout(e,t){var s,o;const r=new br;r.layoutName=e.layoutName,r.tabOrder=e.tabOrder,r.plotSettingsName=e.pageSetupName,r.plotCfgName=e.configName,r.canonicalMediaName=e.paperSize,r.plotViewName=e.plotViewName,r.currentStyleSheet=e.currentStyleSheet,r.plotPaperMargins={left:e.marginLeft,right:e.marginRight,top:e.marginTop,bottom:e.marginBottom},r.plotPaperSize.copy({x:e.paperWidth,y:e.paperHeight}),r.plotOrigin.copy({x:e.plotOriginX,y:e.plotOriginY}),r.plotWindowArea.min.copy({x:e.windowAreaXMin,y:e.windowAreaYMin}),r.plotWindowArea.max.copy({x:e.windowAreaXMax,y:e.windowAreaYMax}),r.customPrintScale={numerator:e.printScaleNumerator,denominator:e.printScaleDenominator},r.plotPaperUnits=e.plotPaperUnit,r.plotRotation=e.plotRotation,r.plotType=e.plotType,r.stdScaleType=e.standardScaleType,r.shadePlot=(()=>{switch(e.shadePlotMode){case 1:return yn.kWireframe;case 2:return yn.kHidden;case 3:return yn.kRendered;default:return yn.kAsDisplayed}})(),r.shadePlotResLevel=(()=>{switch(e.shadePlotResolution){case 1:return Et.kPreview;case 2:return Et.kNormal;case 3:return Et.kPresentation;case 4:return Et.kMaximum;case 5:return Et.kCustom;default:return Et.kDraft}})(),e.shadePlotCustomDPI!=null&&(r.shadePlotCustomDPI=e.shadePlotCustomDPI),e.shadePlotId&&(r.shadePlotId=e.shadePlotId);const i=e.layoutFlag??0;if(r.plotViewportBorders=(i&1)!==0,r.showPlotStyles=(i&2)!==0,r.plotCentered=(i&4)!==0,r.plotHidden=(i&8)!==0,r.useStandardScale=(i&16)!==0,r.plotPlotStyles=(i&32)!==0,r.scaleLineweights=(i&64)!==0,r.printLineweights=(i&128)!==0,r.drawViewportsFirst=(i&512)!==0,r.modelType=(i&1024)!==0,e.viewportId&&r.viewportArray.push(e.viewportId),e.layoutName==="Model"){const a=se.MODEL_SPACE_NAME.toUpperCase();(s=t.tables.BLOCK_RECORD)==null||s.entries.some(l=>l.name.toUpperCase()===a?(r.blockTableRecordId=l.handle,!0):!1)}else(o=t.tables.BLOCK_RECORD)==null||o.entries.some(a=>a.layoutObjects===e.handle?(r.blockTableRecordId=a.handle,!0):!1),r.blockTableRecordId||(r.blockTableRecordId=e.paperSpaceTableId);return e.minLimit&&r.limits.min.copy(e.minLimit),e.maxLimit&&r.limits.max.copy(e.maxLimit),e.minExtent&&r.extents.min.copy(e.minExtent),e.maxExtent&&r.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,r),r}convertImageDef(e){const t=new ac;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}convertMLeaderStyle(e){const t=new Js;return t.unknown1=e.unknown1,e.contentType!=null&&(t.contentType=e.contentType),e.drawMLeaderOrderType!=null&&(t.drawMLeaderOrderType=e.drawMLeaderOrderType),e.drawLeaderOrderType!=null&&(t.drawLeaderOrderType=e.drawLeaderOrderType),e.maxLeaderSegmentPoints!=null&&(t.maxLeaderSegmentPoints=e.maxLeaderSegmentPoints),e.firstSegmentAngleConstraint!=null&&(t.firstSegmentAngleConstraint=e.firstSegmentAngleConstraint),e.secondSegmentAngleConstraint!=null&&(t.secondSegmentAngleConstraint=e.secondSegmentAngleConstraint),e.leaderLineType!=null&&(t.leaderLineType=e.leaderLineType),e.leaderLineColor!=null&&(t.leaderLineColor=nr(e.leaderLineColor)),t.leaderLineTypeId=e.leaderLineTypeId,e.leaderLineWeight!=null&&(t.leaderLineWeight=e.leaderLineWeight),e.landingEnabled!=null&&(t.landingEnabled=e.landingEnabled),e.landingGap!=null&&(t.landingGap=e.landingGap),e.doglegEnabled!=null&&(t.doglegEnabled=e.doglegEnabled),e.doglegLength!=null&&(t.doglegLength=e.doglegLength),e.description!=null&&(t.description=e.description),t.arrowheadId=e.arrowheadId,e.arrowheadSize!=null&&(t.arrowheadSize=e.arrowheadSize),e.defaultMTextContents!=null&&(t.defaultMTextContents=e.defaultMTextContents),t.textStyleId=e.textStyleId,e.textLeftAttachmentType!=null&&(t.textLeftAttachmentType=e.textLeftAttachmentType),e.textAngleType!=null&&(t.textAngleType=e.textAngleType),e.textAlignmentType!=null&&(t.textAlignmentType=e.textAlignmentType),e.textRightAttachmentType!=null&&(t.textRightAttachmentType=e.textRightAttachmentType),e.textColor!=null&&(t.textColor=nr(e.textColor)),e.textHeight!=null&&(t.textHeight=e.textHeight),e.textFrameEnabled!=null&&(t.textFrameEnabled=e.textFrameEnabled),e.textAlignAlwaysLeft!=null&&(t.textAlignAlwaysLeft=e.textAlignAlwaysLeft),e.alignSpace!=null&&(t.alignSpace=e.alignSpace),t.blockContentId=e.blockContentId,e.blockContentColor!=null&&(t.blockContentColor=nr(e.blockContentColor)),e.blockContentScale&&(t.blockContentScale={x:e.blockContentScale.x,y:e.blockContentScale.y,z:e.blockContentScale.z??1}),e.blockContentScaleEnabled!=null&&(t.blockContentScaleEnabled=e.blockContentScaleEnabled),e.blockContentRotation!=null&&(t.blockContentRotation=e.blockContentRotation),e.blockContentRotationEnabled!=null&&(t.blockContentRotationEnabled=e.blockContentRotationEnabled),e.blockContentConnectionType!=null&&(t.blockContentConnectionType=e.blockContentConnectionType),e.scale!=null&&(t.scale=e.scale),e.overwritePropertyValue!=null&&(t.overwritePropertyValue=e.overwritePropertyValue),e.annotative!=null&&(t.annotative=e.annotative),e.breakGapSize!=null&&(t.breakGapSize=e.breakGapSize),e.textAttachmentDirection!=null&&(t.textAttachmentDirection=e.textAttachmentDirection),e.bottomTextAttachmentDirection!=null&&(t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection),e.topTextAttachmentDirection!=null&&(t.topTextAttachmentDirection=e.topTextAttachmentDirection),t.unknown2=e.unknown2,this.processCommonAttrs(e,t),t}convertMLineStyle(e){var i;const t=new eo;if(e.styleName!=null&&(t.styleName=e.styleName),e.flags!=null&&(t.flags=e.flags),e.description!=null&&(t.description=e.description),e.fillColor!=null)t.fillColor=new R().setRGBValue(e.fillColor);else if(e.fillColorIndex!=null){const s=new R;s.colorIndex=e.fillColorIndex,t.fillColor=s}e.startAngle!=null&&(t.startAngle=e.startAngle),e.endAngle!=null&&(t.endAngle=e.endAngle);const r=Math.max(e.elementCount??0,((i=e.elements)==null?void 0:i.length)??0);return r>0&&(t.elements=Array.from({length:r},(s,o)=>{var a,l,c,h;return{offset:((l=(a=e.elements)==null?void 0:a[o])==null?void 0:l.offset)??0,color:(()=>{var p,g,f,m;const d=new R;return((g=(p=e.elements)==null?void 0:p[o])==null?void 0:g.color)!=null?d.setRGBValue(e.elements[o].color):d.colorIndex=((m=(f=e.elements)==null?void 0:f[o])==null?void 0:m.colorIndex)??256,d})(),lineType:((h=(c=e.elements)==null?void 0:c[o])==null?void 0:h.lineType)??"BYLAYER"}})),this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}}class jh{constructor(e){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:e.workerUrl,timeout:e.timeout??3e4,maxConcurrentWorkers:e.maxConcurrentWorkers??4}}async execute(e,t){const r=Date.now(),i=this.generateTaskId();try{return await this.executeInWorker(i,e,t||this.config.workerUrl)}catch(s){const o=Date.now()-r;return{success:!1,error:s instanceof Error?s.message:String(s),duration:o}}}async executeInWorker(e,t,r){const i=Date.now();return new Promise((s,o)=>{const a=this.getAvailableWorker(r),l=setTimeout(()=>{this.cleanupTask(e),this.releaseWorker(a),o(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(e,{resolve:d=>{clearTimeout(l),this.releaseWorker(a),s(d)},reject:d=>{clearTimeout(l),this.releaseWorker(a),o(d)},timeout:l});const c=d=>{const{id:p,success:g,data:f,error:m}=d.data;if(p!==e)return;this.cleanupTask(e);const y=Date.now()-i;s(g?{success:!0,data:f,duration:y}:{success:!1,error:m,duration:y})},h=d=>{this.cleanupTask(e),o(new Error(`Worker error: ${d.message}`))};a.addEventListener("message",c),a.addEventListener("error",h),a.postMessage({id:e,input:t})})}cleanupTask(e){const t=this.pendingTasks.get(e);t&&(clearTimeout(t.timeout),this.pendingTasks.delete(e))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(e){for(const[r,i]of this.workers)if(!i.isBusy)return i.isBusy=!0,i.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const r=new Worker(e,{type:"module"}),i=this.generateWorkerId(),s={worker:r,isBusy:!0,id:i,createdAt:new Date};return this.workers.set(i,s),r}const t=Array.from(this.workers.values()).sort((r,i)=>r.createdAt.getTime()-i.createdAt.getTime())[0];return t.isBusy=!0,t.worker}releaseWorker(e){for(const[t,r]of this.workers)if(r.worker===e){r.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(e=>e.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[e,t]of this.pendingTasks)clearTimeout(t.timeout),t.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[e,t]of this.workers)t.worker.terminate();this.workers.clear()}}class Gh{constructor(e){this.framework=new jh(e)}async execute(e,t){return this.framework.execute(e,t)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Hh(n){return new Gh(n)}class df{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async e=>{const{id:t,input:r}=e.data;try{const i=await this.executeTask(r);this.sendResponse(t,!0,i)}catch(i){this.sendResponse(t,!1,void 0,i instanceof Error?i.message:String(i))}}}sendResponse(e,t,r,i){const s={id:e,success:t,data:r,error:i};self.postMessage(s)}}class Wh extends oo{constructor(e={}){super(e),e.parserWorkerUrl||(e.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(e,t){const r=this.config,i=this.getParserWorkerTimeout(e,t);if(r.useWorker&&r.parserWorkerUrl){const s=Hh({workerUrl:r.parserWorkerUrl,timeout:i,maxConcurrentWorkers:1}),o=await s.execute(e);if(s.destroy(),o.success)return{model:o.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${o.error}'`)}else return{model:new cf().parse(e),data:{unknownEntityCount:0}}}getFonts(e){var s;const t=new Map,r=o=>{if(o){const a=o.lastIndexOf(".");return a>=0?o.substring(0,a).toLowerCase():o.toLowerCase()}};(s=e.tables.STYLE)==null||s.entries.forEach(o=>{const a=[];if(o.font){const l=r(o.font);l&&a.push(l)}if(o.bigFont){const l=r(o.bigFont);l&&a.push(l)}if(o.extendedFont){const l=r(o.extendedFont);l&&a.push(l)}t.set(o.name,a)});const i=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,i),Array.from(i)}getFontsInBlock(e,t,r,i){const s=/\\f(.*?)\|/g;e.forEach(o=>{if(o.type=="MTEXT"){const a=o;[...a.text.matchAll(s)].forEach(h=>{i.add(h[1].toLowerCase())});const c=r.get(a.styleName);c==null||c.forEach(h=>i.add(h))}else if(o.type=="TEXT"){const a=o,l=r.get(a.styleName);l==null||l.forEach(c=>i.add(c))}else if(o.type=="MULTILEADER"||o.type=="MLEADER"){const a=o;[...(typeof a.textContent=="string"?a.textContent:"").matchAll(s)].forEach(d=>{i.add(d[1].toLowerCase())});const c=typeof a.textStyleName=="string"?a.textStyleName:typeof a.styleName=="string"?a.styleName:void 0,h=c?r.get(c):void 0;h==null||h.forEach(d=>i.add(d))}else if(o.type=="INSERT"){const l=t[o.name];l&&l.entities&&this.getFontsInBlock(l.entities,t,r,i)}})}async processEntities(e,t,r,i,s){const o=new ba;let a=e.entities;const l=a.length,c=new Us(l,100-i.value,r);this.config.convertByEntityType&&(a=this.groupAndFlattenByType(a));const h=new Map;for(let p=0;p<l;p++){const g=a[p];if(g.type==="ATTRIB"){const f=o.convert(g);if(f&&f.ownerId&&f.ownerId!=="0"){let m=h.get(f==null?void 0:f.ownerId);m==null&&(m=[],h.set(f.ownerId,m)),m.push(f)}}}const d=t.tables.blockTable.modelSpace;await c.processChunk(async(p,g)=>{let f=[],m=p<g?a[p].type:"";for(let _=p;_<g;_++){const P=a[_];if(!(P.ownerBlockRecordSoftId&&P.ownerBlockRecordSoftId!==d.objectId)&&P.type!=="ATTRIB"){const L=o.convert(P);if(L){if(this.config.convertByEntityType&&P.type!==m&&(d.appendEntity(f),f=[],m=P.type),P.type==="INSERT"){const S=h.get(L.objectId);S&&S.length>0&&S.forEach(A=>{L.appendAttributes(A)})}f.push(L)}}}d.appendEntity(f);let y=i.value+g/l*(100-i.value);y>100&&(y=100),s&&await s(y,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(e,t,r=!1){const i=new ba,s=e.length,o=[],a=t.objectId,l=[];for(let c=0;c<s;c++){const h=e[c],d=i.convert(h);d&&(h.type==="ATTRIB"?l.push(d):(!r||h.ownerBlockRecordSoftId===a)&&o.push(d))}t.appendEntity(o),l.forEach(c=>{const h=t.getIdAt(c.ownerId);h&&h.appendAttributes(c)})}processBlocks(e,t){const r=e.blocks;for(const[i,s]of Object.entries(r)){let o=t.tables.blockTable.getAt(s.name);o||(o=new se,s.handle!=null&&(o.objectId=String(s.handle)),o.name=i,o.origin.copy(s.position),t.tables.blockTable.add(o)),s.entities?this.processEntitiesInBlock(s.entities,o):o.isPaperSapce&&this.processEntitiesInBlock(e.entities,o,!0)}}processHeader(e,t){const r=e.header;r.$ACADVER&&(t.version=r.$ACADVER),t.cecolor.colorIndex=r.$CECOLOR||256,t.angbase=r.$ANGBASE||0,t.angdir=r.$ANGDIR||0,r.$AUNITS!=null&&(t.aunits=r.$AUNITS),r.$AUPREC!=null&&(t.auprec=r.$AUPREC),r.$LUNITS!=null&&(t.lunits=r.$LUNITS),r.$LUPREC!=null&&(t.luprec=r.$LUPREC),r.$UNITMODE!=null&&(t.unitmode=r.$UNITMODE),r.$MEASUREMENT!=null&&(t.measurement=r.$MEASUREMENT),t.celtype=r.$CELTYPE||fe,Xe.instance().setVar(I.CETRANSPARENCY,r.$CETRANSPARENCY||"ByLayer",t),t.celtscale=r.$CELTSCALE||1;const i=this.normalizeHeaderStringValue(r.$CMLSTYLE)||this.normalizeHeaderStringValue(r.CMLSTYLE)||ft;t.cmlstyle=i;const s=r.$CMLSCALE??r.CMLSCALE;typeof s=="number"&&Number.isFinite(s)&&(t.cmlscale=s);const o=this.normalizeHeaderStringValue(r.$CMLEADERSTYLE)||this.normalizeHeaderStringValue(r.CMLEADERSTYLE)||mt;t.cmleaderstyle=o,t.hplayer=this.normalizeHeaderStringValue(r.$HPLAYER)||this.normalizeHeaderStringValue(r.HPLAYER)||".",t.ltscale=r.$LTSCALE||1,r.$EXTMAX&&(t.extmax=r.$EXTMAX),r.$EXTMIN&&(t.extmin=r.$EXTMIN),r.$INSUNITS!=null&&(t.insunits=r.$INSUNITS),t.osmode=r.$OSMODE||0,t.orthomode=r.$ORTHOMODE||0,t.pdmode=r.$PDMODE||0,t.pdsize=r.$PDSIZE||0,t.textstyle=r.$TEXTSTYLE||ae}processBlockTables(e,t){var i;const r=(i=e.tables.BLOCK_RECORD)==null?void 0:i.entries;r&&r.length>0&&(t.tables.blockTable.removeAll(),r.forEach(s=>{const o=new se;o.objectId=s.handle,o.name=s.name,o.layoutId=s.layoutObjects,o.blockInsertUnits=s.insertionUnits,o.explodability=s.explodability,o.blockScaling=s.scalability,s.bmpPreview&&(o.bmpPreview=s.bmpPreview),t.tables.blockTable.add(o)}))}processObjects(e,t){const r=e.objects.byName,i=new hf;if("LAYOUT"in r){const s=t.objects.layout;r.LAYOUT.forEach(o=>{const a=i.convertLayout(o,e);s.setAt(a.layoutName,a)})}if("IMAGEDEF"in r){const s=t.objects.imageDefinition;r.IMAGEDEF.forEach(o=>{const a=i.convertImageDef(o);s.setAt(a.objectId,a)})}if("MLEADERSTYLE"in r){const s=t.objects.mleaderStyle;r.MLEADERSTYLE.forEach(o=>{const a=i.convertMLeaderStyle(o);s.setAt(a.objectId,a)})}if("MLINESTYLE"in r){const s=t.objects.mlineStyle;r.MLINESTYLE.forEach(o=>{const a=i.convertMLineStyle(o);s.setAt(a.styleName||a.objectId,a)})}}processViewports(e,t){var i;const r=(i=e.tables)==null?void 0:i.VPORT;if(r){this.processCommonTableAttrs(r,t.tables.viewportTable);const s=r.entries;s&&s.length>0&&s.forEach(o=>{const a=new Di;this.processCommonTableEntryAttrs(o,a),o.circleSides&&(a.circleSides=o.circleSides),a.standardFlag=o.standardFlag,a.center.copy(o.center??Ps),a.lowerLeftCorner.copy(o.lowerLeftCorner??Yl),a.upperRightCorner.copy(o.upperRightCorner??Xl),o.snapBasePoint&&a.snapBase.copy(o.snapBasePoint),o.snapRotationAngle&&(a.snapAngle=o.snapRotationAngle),o.snapSpacing&&a.snapIncrements.copy(o.snapSpacing),o.majorGridLines&&(a.gridMajor=o.majorGridLines),o.gridSpacing&&a.gridIncrements.copy(o.gridSpacing),o.backgroundObjectId&&(a.backgroundObjectId=o.backgroundObjectId),a.gsView.center.copy(o.center??Ps),a.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget??Rl),a.gsView.viewTarget.copy(o.viewTarget??Bl),o.lensLength&&(a.gsView.lensLength=o.lensLength),o.frontClippingPlane&&(a.gsView.frontClippingPlane=o.frontClippingPlane),o.backClippingPlane&&(a.gsView.backClippingPlane=o.backClippingPlane),o.viewHeight&&(a.gsView.viewHeight=o.viewHeight),o.aspectRatio!=null&&Number.isFinite(o.aspectRatio)&&o.aspectRatio>0&&(a.gsView.aspectRatio=o.aspectRatio),o.viewTwistAngle&&(a.gsView.viewTwistAngle=o.viewTwistAngle),o.frozenLayers&&(a.gsView.frozenLayers=o.frozenLayers),o.styleSheet&&(a.gsView.styleSheet=o.styleSheet),o.renderMode&&(a.gsView.renderMode=o.renderMode),o.viewMode&&(a.gsView.viewMode=o.viewMode),o.ucsIconSetting&&(a.gsView.ucsIconSetting=o.ucsIconSetting),o.ucsOrigin&&a.gsView.ucsOrigin.copy(o.ucsOrigin),o.ucsXAxis&&a.gsView.ucsXAxis.copy(o.ucsXAxis),o.ucsYAxis&&a.gsView.ucsYAxis.copy(o.ucsYAxis),o.orthographicType&&(a.gsView.orthographicType=o.orthographicType),o.shadePlotSetting&&(a.gsView.shadePlotSetting=o.shadePlotSetting),o.shadePlotObjectId&&(a.gsView.shadePlotObjectId=o.shadePlotObjectId),o.visualStyleObjectId&&(a.gsView.visualStyleObjectId=o.visualStyleObjectId),o.isDefaultLightingOn&&(a.gsView.isDefaultLightingOn=o.isDefaultLightingOn),o.defaultLightingType&&(a.gsView.defaultLightingType=o.defaultLightingType),o.brightness&&(a.gsView.brightness=o.brightness),o.contrast&&(a.gsView.contrast=o.contrast),o.ambientColor&&(a.gsView.ambientColor=o.ambientColor),t.tables.viewportTable.add(a)})}}processLayers(e,t){var i;const r=(i=e.tables)==null?void 0:i.LAYER;if(r){this.processCommonTableAttrs(r,t.tables.layerTable);const s=r.entries;s&&s.length>0&&s.forEach(o=>{const a=new R;a.colorIndex=o.colorIndex;const l=new Bi({name:o.name,standardFlags:o.standardFlag,linetype:o.lineType,lineWeight:o.lineweight,isOff:o.colorIndex<0,color:a,isPlottable:o.isPlotting});this.processCommonTableEntryAttrs(o,l),t.tables.layerTable.add(l)})}}processLineTypes(e,t){var i;const r=(i=e.tables)==null?void 0:i.LTYPE;if(r){this.processCommonTableAttrs(r,t.tables.linetypeTable);const s=r.entries;s&&s.length>0&&s.forEach(o=>{const a=new Ot(o);this.processCommonTableEntryAttrs(o,a),a.name=o.name,t.tables.linetypeTable.add(a)})}}processTextStyles(e,t){var i;const r=(i=e.tables)==null?void 0:i.STYLE;if(r){this.processCommonTableAttrs(r,t.tables.textStyleTable);const s=r.entries;s&&s.length>0&&s.forEach(o=>{const a=new Fi(o);this.processCommonTableEntryAttrs(o,a),t.tables.textStyleTable.add(a)})}t.ensureTextStyleDefaults()}processDimStyles(e,t){var i;const r=(i=e.tables)==null?void 0:i.DIMSTYLE;if(r){this.processCommonTableAttrs(r,t.tables.dimStyleTable);const s=r.entries;s&&s.length>0&&s.forEach(o=>{const a={name:o.name,ownerId:o.ownerObjectId,dimpost:o.DIMPOST||"",dimapost:o.DIMAPOST||"",dimscale:o.DIMSCALE,dimasz:o.DIMASZ,dimexo:o.DIMEXO,dimdli:o.DIMDLI,dimexe:o.DIMEXE,dimrnd:o.DIMRND,dimdle:o.DIMDLE,dimtp:o.DIMTP,dimtm:o.DIMTM,dimtxt:o.DIMTXT,dimcen:o.DIMCEN,dimtsz:o.DIMTSZ,dimaltf:o.DIMALTF,dimlfac:o.DIMLFAC,dimtvp:o.DIMTVP,dimtfac:o.DIMTFAC,dimgap:o.DIMGAP,dimaltrnd:o.DIMALTRND,dimtol:o.DIMTOL==null||o.DIMTOL==0?0:1,dimlim:o.DIMLIM==null||o.DIMLIM==0?0:1,dimtih:o.DIMTIH==null||o.DIMTIH==0?0:1,dimtoh:o.DIMTOH==null||o.DIMTOH==0?0:1,dimse1:o.DIMSE1==null||o.DIMSE1==0?0:1,dimse2:o.DIMSE2==null||o.DIMSE2==0?0:1,dimtad:o.DIMTAD,dimzin:o.DIMZIN,dimazin:o.DIMAZIN,dimalt:o.DIMALT,dimaltd:o.DIMALTD,dimtofl:o.DIMTOFL,dimsah:o.DIMSAH,dimtix:o.DIMTIX,dimsoxd:o.DIMSOXD,dimclrd:o.DIMCLRD,dimclre:o.DIMCLRE,dimclrt:o.DIMCLRT,dimadec:o.DIMADEC||0,dimunit:o.DIMUNIT||2,dimdec:o.DIMDEC,dimtdec:o.DIMTDEC,dimaltu:o.DIMALTU,dimalttd:o.DIMALTTD,dimaunit:o.DIMAUNIT,dimfrac:o.DIMFRAC,dimlunit:o.DIMLUNIT,dimdsep:o.DIMDSEP?o.DIMDSEP.toString():".",dimtmove:o.DIMTMOVE||0,dimjust:o.DIMJUST,dimsd1:o.DIMSD1,dimsd2:o.DIMSD2,dimtolj:o.DIMTOLJ,dimtzin:o.DIMTZIN,dimaltz:o.DIMALTZ,dimalttz:o.DIMALTTZ,dimfit:o.DIMFIT||0,dimupt:o.DIMUPT,dimatfit:o.DIMATFIT,dimtxsty:o.DIMTXSTY||ae,dimldrblk:o.DIMLDRBLK||"",dimblk:o.DIMBLK||"",dimblk1:o.DIMBLK1||"",dimblk2:o.DIMBLK2||"",dimlwd:o.DIMLWD,dimlwe:o.DIMLWE},l=new on(a);this.processCommonTableEntryAttrs(o,l),t.tables.dimStyleTable.add(l)})}}processCommonTableAttrs(e,t){e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}processCommonTableEntryAttrs(e,t){t.name="name"in e?e.name:"",e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}groupAndFlattenByType(e){const t={},r=[];for(const i of e)t[i.type]||(t[i.type]=[],r.push(i.type)),t[i.type].push(i);return r.flatMap(i=>t[i])}normalizeHeaderStringValue(e){if(typeof e!="string")return;const t=e.trim();return t.length>0?t:void 0}}class Uh extends oo{constructor(e){super({}),this._database=e}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(e,t,r,i,s){let o=e.tables.blockTable.modelSpace.newIterator().toArray();const a=o.length,l=new Us(a,100-i.value,r);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const c=t.tables.blockTable.modelSpace;await l.processChunk(async(h,d)=>{let p=[],g=h<d?o[h].type:"";for(let f=h;f<d;f++){const m=o[f];this.config.convertByEntityType&&m.type!==g&&(this.triggerEvents(c,p),p=[],g=m.type),p.push(m)}if(this.triggerEvents(c,p),s){let f=i.value+d/a*(100-i.value);f>100&&(f=100),await s(f,"ENTITY","IN-PROGRESS")}})}processBlocks(){const e=this._database.tables.blockTable.newIterator();for(const t of e){const r=t.newIterator().toArray();this.triggerEvents(t,r)}}processHeader(){}processBlockTables(){}processObjects(){const e=this._database.objects.layout.newIterator();for(const i of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.layoutName});const t=this._database.objects.imageDefinition.newIterator();for(const i of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.objectId});const r=this._database.objects.mleaderStyle.newIterator();for(const i of r)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(t=>{this._database.events.layerAppended.dispatch({database:this._database,layer:t})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(e){const t={},r=[];for(const i of e)t[i.type]||(t[i.type]=[],r.push(i.type)),t[i.type].push(i);return r.flatMap(i=>t[i])}triggerEvents(e,t){(e.isModelSapce||e.isPaperSapce)&&e.database.events.entityAppended.dispatch({database:e.database,entity:t})}}exports.ACAD_APPID=vs;exports.ACTIVE_VPORT_NAME=lr;exports.AC_DB_SYSTEM_VARIABLE_NAMES=yg;exports.AcCmColor=R;exports.AcCmColorUtil=It;exports.AcCmEntityColor=Zh;exports.AcCmErrors=Pe;exports.AcCmEventDispatcher=Qh;exports.AcCmEventManager=ie;exports.AcCmLoader=gd;exports.AcCmLoadingManager=Ia;exports.AcCmObject=Aa;exports.AcCmPerformanceCollector=ks;exports.AcCmTask=Sa;exports.AcCmTaskScheduler=La;exports.AcCmTransparency=te;exports.AcDb2dPolyline=Kr;exports.AcDb2dVertex=Ss;exports.AcDb2dVertexType=Dl;exports.AcDb3PointAngularDimension=_i;exports.AcDb3dPolyline=Zr;exports.AcDb3dVertex=Ls;exports.AcDb3dVertexType=zl;exports.AcDbAbstractViewTableRecord=so;exports.AcDbAlignedDimension=pr;exports.AcDbAngleUnits=ve;exports.AcDbArc=Qr;exports.AcDbArcDimension=Is;exports.AcDbAttribute=ei;exports.AcDbAttributeDefinition=Jr;exports.AcDbAttributeFlags=oe;exports.AcDbAttributeMTextFlag=Ue;exports.AcDbBaseWorker=df;exports.AcDbBatchProcessing=Us;exports.AcDbBlockReference=sn;exports.AcDbBlockScaling=fl;exports.AcDbBlockTable=uc;exports.AcDbBlockTableRecord=se;exports.AcDbCircle=ti;exports.AcDbCodePage=Ks;exports.AcDbCurve=ge;exports.AcDbDataGenerator=cc;exports.AcDbDatabase=Yg;exports.AcDbDatabaseConverter=oo;exports.AcDbDatabaseConverterManager=We;exports.AcDbDiametricDimension=bi;exports.AcDbDictionary=tn;exports.AcDbDimArrowType=hc;exports.AcDbDimStyleTable=gc;exports.AcDbDimStyleTableRecord=on;exports.AcDbDimTextHorizontal=pc;exports.AcDbDimTextVertical=fc;exports.AcDbDimVerticalJustification=_c;exports.AcDbDimZeroSuppression=mc;exports.AcDbDimZeroSuppressionAngular=yc;exports.AcDbDimension=xt;exports.AcDbDuplicateRecordCloning=lc;exports.AcDbDwgVersion=Ye;exports.AcDbDxfCode=Os;exports.AcDbDxfConverter=Wh;exports.AcDbDxfFiler=Ta;exports.AcDbEllipse=ni;exports.AcDbEntity=le;exports.AcDbFace=ri;exports.AcDbFileType=Jn;exports.AcDbFormatter=Sl;exports.AcDbGradientPatternType=ql;exports.AcDbHatch=cr;exports.AcDbHatchObjectType=Qs;exports.AcDbHatchPatternType=tr;exports.AcDbHatchStyle=$l;exports.AcDbHostApplicationServices=$r;exports.AcDbLayerTable=bc;exports.AcDbLayerTableRecord=Bi;exports.AcDbLayout=br;exports.AcDbLayoutDictionary=oc;exports.AcDbLayoutManager=wl;exports.AcDbLeader=ii;exports.AcDbLeaderAnnotationType=Kl;exports.AcDbLine=hr;exports.AcDbLineSpacingStyle=yi;exports.AcDbLinearUnits=J;exports.AcDbLinetypeTable=xc;exports.AcDbLinetypeTableRecord=Ot;exports.AcDbMLeader=oi;exports.AcDbMLeaderContentType=yt;exports.AcDbMLeaderDirectionType=ec;exports.AcDbMLeaderLineType=An;exports.AcDbMLeaderStyle=Js;exports.AcDbMLeaderTextAttachmentDirection=Jl;exports.AcDbMLine=si;exports.AcDbMLineFlags=Ql;exports.AcDbMLineJustification=Zl;exports.AcDbMText=dr;exports.AcDbMlineStyle=eo;exports.AcDbObject=Ge;exports.AcDbObjectIterator=_r;exports.AcDbOpenMode=vl;exports.AcDbOrdinateDimension=xi;exports.AcDbOsnapMode=v;exports.AcDbPatParser=io;exports.AcDbPatSvgRenderer=Es;exports.AcDbPlotPaperUnits=ml;exports.AcDbPlotRotation=yl;exports.AcDbPlotSettings=xl;exports.AcDbPlotShadePlotResLevel=Et;exports.AcDbPlotShadePlotType=yn;exports.AcDbPlotStdScaleType=bl;exports.AcDbPlotType=_l;exports.AcDbPoint=ci;exports.AcDbPoly2dType=_n;exports.AcDbPoly3dType=er;exports.AcDbPolyFaceMesh=mi;exports.AcDbPolyFaceMeshFace=sc;exports.AcDbPolyFaceMeshVertex=ic;exports.AcDbPolygonMesh=fi;exports.AcDbPolygonMeshVertex=rc;exports.AcDbPolyline=Ae;exports.AcDbPredefinedAcadIsoPat=Ul;exports.AcDbPredefinedAcadPat=_g;exports.AcDbRadialDimension=wi;exports.AcDbRasterImage=gr;exports.AcDbRasterImageClipBoundaryType=tc;exports.AcDbRasterImageDef=ac;exports.AcDbRasterImageImageDisplayOpt=nc;exports.AcDbRay=hi;exports.AcDbRegAppTable=Ac;exports.AcDbRegAppTableRecord=Ts;exports.AcDbRegenerator=Uh;exports.AcDbRenderingCache=an;exports.AcDbResultBuffer=Ws;exports.AcDbRotatedDimension=vi;exports.AcDbShape=di;exports.AcDbSpline=ur;exports.AcDbSymbolTable=wt;exports.AcDbSymbolTableRecord=Xt;exports.AcDbSysVarManager=Xe;exports.AcDbSystemVariables=I;exports.AcDbTable=ai;exports.AcDbText=In;exports.AcDbTextHorizontalMode=Hl;exports.AcDbTextStyleTable=wc;exports.AcDbTextStyleTableRecord=Fi;exports.AcDbTextVerticalMode=Wl;exports.AcDbTrace=li;exports.AcDbUnitsValue=K;exports.AcDbViewTable=vc;exports.AcDbViewTableRecord=Bg;exports.AcDbViewport=ui;exports.AcDbViewportTable=Pc;exports.AcDbViewportTableRecord=Di;exports.AcDbWipeout=gi;exports.AcDbWorkerApi=Gh;exports.AcDbWorkerManager=jh;exports.AcDbXline=pi;exports.AcDbXrecord=kg;exports.AcGeArea2d=Nt;exports.AcGeBox2d=xe;exports.AcGeBox3d=B;exports.AcGeCatmullRomCurve3d=ul;exports.AcGeCircArc2d=Re;exports.AcGeCircArc3d=Xi;exports.AcGeCurve2d=En;exports.AcGeEllipseArc2d=Ln;exports.AcGeEllipseArc3d=dl;exports.AcGeEuler=Sd;exports.AcGeGeometryUtil=Ka;exports.AcGeLine2d=_t;exports.AcGeLine3d=bt;exports.AcGeLoop2d=or;exports.AcGeMathUtil=T;exports.AcGeMatrix2d=mr;exports.AcGeMatrix3d=D;exports.AcGeNurbsCurve=je;exports.AcGePlane=Ds;exports.AcGePoint2d=E;exports.AcGePoint3d=b;exports.AcGePolyline2d=ee;exports.AcGeQuaternion=Sn;exports.AcGeShape2d=Gs;exports.AcGeSpline3d=$e;exports.AcGeTol=q;exports.AcGeVector2d=Z;exports.AcGeVector3d=x;exports.AcGiViewport=Fl;exports.AcTrStringUtil=ud;exports.ByBlock=Ct;exports.ByLayer=fe;exports.DEBUG_MODE=ld;exports.DEFAULT_GRADIENT_HATCH_NAME=Nl;exports.DEFAULT_HATCH_PATTERN_IMPERIAL=og;exports.DEFAULT_HATCH_PATTERN_METRIC=Ol;exports.DEFAULT_LINE_TYPE=Mt;exports.DEFAULT_MLEADER_STYLE=mt;exports.DEFAULT_MLINE_STYLE=ft;exports.DEFAULT_TEXT_STYLE=ae;exports.DEFAULT_TOL=Yi;exports.DEG2RAD=Ns;exports.DefaultLoadingManager=Ea;exports.FLOAT_TOL=gt;exports.HATCH_PATTERN_SOLID=rn;exports.HATCH_PATTERN_USER=kl;exports.MLIGHTCAD_APPID=ws;exports.ORIGIN_POINT_2D=fd;exports.ORIGIN_POINT_3D=Fs;exports.RAD2DEG=Ys;exports.RAW_COLOR_TYPE_ACI=ro;exports.RAW_COLOR_TYPE_BY_BLOCK=Pi;exports.RAW_COLOR_TYPE_BY_LAYER=to;exports.RAW_COLOR_TYPE_RGB=no;exports.RAW_COLOR_TYPE_WINDOW_BG=dc;exports.TAU=G;exports.TEMP_OBJECT_ID_PREFIX=Xr;exports.VPORT_FALLBACK_CENTER_2D=Ps;exports.VPORT_FALLBACK_LLC=Yl;exports.VPORT_FALLBACK_URC=Xl;exports.VPORT_FALLBACK_VIEW_DIR=Rl;exports.VPORT_FALLBACK_VIEW_TARGET=Bl;exports.acdbDisableOsnapMode=Ag;exports.acdbEnableOsnapMode=Pg;exports.acdbHasOsnapMode=vg;exports.acdbHostApplicationServices=Hs;exports.acdbMaskToOsnapModes=xg;exports.acdbOsnapModesToMask=bg;exports.acdbToggleOsnapMode=wg;exports.basisFunction=kt;exports.calculateCurveLength=Ja;exports.ceilPowerOfTwo=Ga;exports.clamp=pt;exports.clone=qn;exports.computeParameterValues=Za;exports.createWorkerApi=Hh;exports.damp=ka;exports.decodeMLeaderStyleRawColor=nr;exports.deepClone=hs;exports.defaults=fr;exports.degToRad=za;exports.dwgCodePageToEncoding=Ml;exports.encodeMLeaderStyleRawColor=Br;exports.euclideanModulo=Xs;exports.evaluateNurbsPoint=Qn;exports.floorPowerOfTwo=Ha;exports.generateAveragedKnots=Qa;exports.generateChordKnots=Id;exports.generateSqrtChordKnots=Ed;exports.generateUUID=Ca;exports.generateUniformKnots=Ld;exports.getOcsAngle=gs;exports.getOcsReferenceVector=js;exports.has=wa;exports.intPartLength=Bs;exports.interpolateControlPoints=Od;exports.interpolateNurbsCurve=Vs;exports.inverseLerp=Oa;exports.isBetween=Wa;exports.isBetweenAngle=Ua;exports.isEmpty=va;exports.isEqual=wn;exports.isImperialUnits=Al;exports.isMetricUnits=Pl;exports.isPointInPolygon=zs;exports.isPolygonIntersect=qa;exports.isPowerOfTwo=ja;exports.lerp=Rs;exports.log=Kn;exports.mapLinear=Ma;exports.normalizeAngle=Zn;exports.pingpong=Na;exports.radToDeg=Va;exports.randFloat=Ba;exports.randFloatSpread=Fa;exports.randInt=Ra;exports.relativeEps=$a;exports.seededRandom=Da;exports.setAcDbHostApplicationServicesProvider=pl;exports.setAcDbLayoutManagerFactory=Xu;exports.setLogLevel=cd;exports.smootherstep=Xa;exports.smoothstep=Ya;exports.transformOcsPointToWcs=us;exports.transformWcsPointToOcs=sr;
|