!function(i,M,J){"use strict";var Y="ht",U=i[Y],h=U.Default,P=h.getInternal();P.addMethod(h,{cadToShape:function(Z,p){var j=new U.DxfViewer(p);return j.toShape(Z)}}),function(I){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=I();else if("function"==typeof define&&define.amd)define([],I);else{var b;b="undefined"!=typeof i?i:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.DxfParser=I()}}(function(){var y;return function d(U,t,c){function e(v,O){if(!t[v]){if(!U[v]){var p="function"==typeof require&&require;if(!O&&p)return p(v,!0);if(E)return E(v,!0);var I=new Error("Cannot find module '"+v+"'");throw I.code="MODULE_NOT_FOUND",I}var P=t[v]={exports:{}};U[v][0].call(P.exports,function(E){var w=U[v][1][E];return e(w?w:E)},P,P.exports,d,U,t,c)}return t[v].exports}for(var E="function"==typeof require&&require,k=0;k=c?m:c>=10&&59>=c?parseFloat(m):c>=60&&99>=c?parseInt(m):c>=100&&109>=c?m:c>=110&&149>=c?parseFloat(m):c>=160&&179>=c?parseInt(m):c>=210&&239>=c?parseFloat(m):c>=270&&289>=c?parseInt(m):c>=290&&299>=c?r(m):c>=300&&369>=c?m:c>=370&&389>=c?parseInt(m):c>=390&&399>=c?m:c>=400&&409>=c?parseInt(m):c>=410&&419>=c?m:c>=420&&429>=c?parseInt(m):c>=430&&439>=c?m:c>=440&&459>=c?parseInt(m):c>=460&&469>=c?parseFloat(m):c>=470&&481>=c?m:999===c?m:c>=1e3&&1009>=c?m:c>=1010&&1059>=c?parseFloat(m):c>=1060&&1071>=c?parseInt(m):(console.log("WARNING: Group code does not have a defined type: %j",{code:c,value:m}),m)}function r(H){if("0"===H)return!1;if("1"===H)return!0;throw TypeError("String '"+H+"' cannot be cast to Boolean type")}m.prototype.next=function(){var O;if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);return O={code:parseInt(this._data[this._pointer])},this._pointer++,O.value=s(O.code,this._data[this._pointer].trim()),this._pointer++,0===O.code&&"EOF"===O.value&&(this._eof=!0),O},m.prototype.hasNext=function(){return this._eof?!1:this._pointer>this._data.length-2?!1:!0},m.prototype.isEOF=function(){return this._eof},B.exports=m},{}],3:[function(Z,I){function g(){}function k(E){D.debug("unhandled group "+m(E))}function m(R){return R.code+":"+R.value}function n(d){return y[d]}var X=Z("./DxfArrayScanner.js"),y=Z("./AutoCadColorIndex"),D=Z("loglevel");D.setLevel("error"),g.prototype.parse=function(){throw new Error("read() not implemented. Use readSync()")},g.prototype.parseSync=function(y){return"string"==typeof y?this._parse(y):(console.error("Cannot read dxf source of type `"+typeof y),null)},g.prototype.parseStream=function(n,I){function z(l){p+=l}function i(){try{var o=J._parse(p)}catch(X){return I(X)}I(null,o)}function A(V){I(V)}var p="",J=this;n.on("data",z),n.on("end",i),n.on("error",A)},g.prototype._parse=function(F){var V,j,p={},T=0,v=F.split(/\r\n|\r|\n/g);if(V=new X(v),!V.hasNext())throw Error("Empty file");var f=function(){for(j=V.next();!V.isEOF();)if(0===j.code&&"SECTION"===j.value){if(j=V.next(),2!==j.code){console.error("Unexpected code %s after 0:SECTION",m(j)),j=V.next();continue}"HEADER"===j.value?(D.debug("> HEADER"),p.header=Z(),D.debug("<")):"BLOCKS"===j.value?(D.debug("> BLOCKS"),p.blocks=c(),D.debug("<")):"ENTITIES"===j.value?(D.debug("> ENTITIES"),p.entities=L(!1),D.debug("<")):"TABLES"===j.value?(D.debug("> TABLES"),p.tables=g(),D.debug("<")):"EOF"===j.value?D.debug("EOF"):D.warn("Skipping section '%s'",j.value)}else j=V.next()},h=function(c,s){return j.code===c&&j.value===s},Z=function(){var $=null,I=null,W={};for(j=V.next();;){if(h(0,"ENDSEC")){$&&(W[$]=I);break}9===j.code?($&&(W[$]=I),$=j.value):10===j.code?I={x:j.value}:20===j.code?I.y=j.value:30===j.code?I.z=j.value:I=j.value,j=V.next()}return j=V.next(),W},c=function(){var G,R={};for(j=V.next();"EOF"!==j.value&&!h(0,"ENDSEC");)h(0,"BLOCK")?(D.debug("block {"),G=$(),D.debug("}"),P(G),G.name?R[G.name]=G:D.error('block with handle "'+G.handle+'" is missing a name.')):(k(j),j=V.next());return R},$=function(){var B={};for(j=V.next();"EOF"!==j.value;){switch(j.code){case 1:B.xrefPath=j.value,j=V.next();break;case 2:B.name=j.value,j=V.next();break;case 3:B.name2=j.value,j=V.next();break;case 5:B.handle=j.value,j=V.next();break;case 8:B.layer=j.value,j=V.next();break;case 10:B.position=w();break;case 67:B.paperSpace=j.value&&1==j.value?!0:!1,j=V.next();break;case 70:0!=j.value&&(B.type=j.value),j=V.next();break;case 100:j=V.next();break;case 330:B.ownerHandle=j.value,j=V.next();break;case 0:if("ENDBLK"==j.value)break;V._pointer-=2,B.entities=L(!0);break;default:k(j),j=V.next()}if(h(0,"ENDBLK")){j=V.next();break}}return B},g=function(){var p={};for(j=V.next();"EOF"!==j.value&&!h(0,"ENDSEC");)if(h(0,"TABLE")){j=V.next();var _=o[j.value];_?(D.debug(j.value+" Table {"),p[o[j.value].tableName]=E(),D.debug("}")):D.debug("Unhandled Table "+j.value)}else j=V.next();return j=V.next(),p},e="ENDTAB",E=function(){var U,W=o[j.value],Z={},t=0;for(j=V.next();!h(0,e);)switch(j.code){case 5:Z.handle=j.value,j=V.next();break;case 330:Z.ownerHandle=j.value,j=V.next();break;case 100:"AcDbSymbolTable"===j.value?j=V.next():(k(j),j=V.next());break;case 70:t=j.value,j=V.next();break;case 0:j.value===W.dxfSymbolName?Z[W.tableRecordsProperty]=W.parseTableRecords():(k(j),j=V.next());break;default:k(j),j=V.next()}var b=Z[W.tableRecordsProperty];return b&&(b.constructor===Array?U=b.length:"object"==typeof b&&(U=M.keys(b).length),t!==U&&D.warn("Parsed "+U+" "+W.dxfSymbolName+"'s but expected "+t)),j=V.next(),Z},U=function(){var Y=[],f={};for(D.debug("ViewPort {"),j=V.next();!h(0,e);)switch(j.code){case 2:f.name=j.value,j=V.next();break;case 10:f.lowerLeftCorner=w();break;case 11:f.upperRightCorner=w();break;case 12:f.center=w();break;case 13:f.snapBasePoint=w();break;case 14:f.snapSpacing=w();break;case 15:f.gridSpacing=w();break;case 16:f.viewDirectionFromTarget=w();break;case 17:f.viewTarget=w();break;case 40:f.viewHeight=j.value,f.aspectRatio!==J&&(f.viewWidth=j.value*f.aspectRatio),j=V.next();break;case 41:f.aspectRatio=j.value,f.viewHeight!==J&&(f.viewWidth=j.value*f.viewHeight),j=V.next();break;case 42:f.lensLength=j.value,j=V.next();break;case 43:f.frontClippingPlane=j.value,j=V.next();break;case 44:f.backClippingPlane=j.value,j=V.next();break;case 45:f.viewHeight=j.value,j=V.next();break;case 50:f.snapRotationAngle=j.value,j=V.next();break;case 51:f.viewTwistAngle=j.value,j=V.next();break;case 79:f.orthographicType=j.value,j=V.next();break;case 110:f.ucsOrigin=w();break;case 111:f.ucsXAxis=w();break;case 112:f.ucsYAxis=w();break;case 110:f.ucsOrigin=w();break;case 281:f.renderMode=j.value,j=V.next();break;case 281:f.defaultLightingType=j.value,j=V.next();break;case 292:f.defaultLightingOn=j.value,j=V.next();break;case 330:f.ownerHandle=j.value,j=V.next();break;case 63:case 421:case 431:f.ambientColor=j.value,j=V.next();break;case 0:"VPORT"===j.value&&(D.debug("}"),Y.push(f),D.debug("ViewPort {"),f={},j=V.next());break;default:k(j),j=V.next()}return D.debug("}"),Y.push(f),Y},O=function(){var d,p,C={},v={};for(D.debug("LType {"),j=V.next();!h(0,"ENDTAB");)switch(j.code){case 2:v.name=j.value,d=j.value,j=V.next();break;case 3:v.description=j.value,j=V.next();break;case 73:p=j.value,p>0&&(v.pattern=[]),j=V.next();break;case 40:v.patternLength=j.value,j=V.next();break;case 49:v.pattern.push(j.value),j=V.next();break;case 0:D.debug("}"),p>0&&p!==v.pattern.length&&D.warn("lengths do not match on LTYPE pattern"),C[d]=v,v={},D.debug("LType {"),j=V.next();break;default:j=V.next()}return D.debug("}"),C[d]=v,C},u=function(){var f,O={},M={};for(D.debug("Layer {"),j=V.next();!h(0,"ENDTAB");)switch(j.code){case 2:M.name=j.value,f=j.value,j=V.next();break;case 62:M.visible=j.value>0,M.color=n(Math.abs(j.value)),j=V.next();break;case 6:M.lineType=j.value,j=V.next();break;case 0:"LAYER"===j.value&&(D.debug("}"),O[f]=M,D.debug("Layer {"),M={},f=J,j=V.next());break;default:k(j),j=V.next()}return D.debug("}"),O[f]=M,O},o={VPORT:{tableRecordsProperty:"viewPorts",tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:U},LTYPE:{tableRecordsProperty:"lineTypes",tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:O},LAYER:{tableRecordsProperty:"layers",tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:u}},L=function(E){var a=[],w=E?"ENDBLK":"ENDSEC";for(j=V.next();;)if(0===j.code){if(j.value===w)break;var I;if("LWPOLYLINE"===j.value)D.debug("LWPOLYLINE {"),I=N(),D.debug("}");else if("POLYLINE"===j.value)D.debug("POLYLINE {"),I=Q(),D.debug("}");else if("LINE"===j.value)D.debug("LINE {"),I=t(),D.debug("}");else if("CIRCLE"===j.value)D.debug("CIRCLE {"),I=S(),D.debug("}");else if("ARC"===j.value)D.debug("ARC {"),I=S(),D.debug("}");else if("ELLIPSE"===j.value)D.debug("ELLIPSE {"),I=l(),D.debug("}");else if("SPLINE"===j.value)D.debug("SPLINE {"),I=s(),D.debug("}");else if("TEXT"===j.value)D.debug("TEXT {"),I=H(),D.debug("}");else if("DIMENSION"===j.value)D.debug("DIMENSION {"),I=b(),D.debug("}");else if("INSERT"===j.value)D.debug("INSERT {"),I=C(),D.debug("}");else if("HATCH"===j.value)D.debug("HATCH {"),I=i(),D.debug("}");else if("SOLID"===j.value)D.debug("SOLID {"),I=G(),D.debug("}");else if("POINT"===j.value)D.debug("POINT {"),I=q(),D.debug("}");else if("MTEXT"===j.value)D.debug("MTEXT {"),I=K(),D.debug("}");else{if("ATTDEF"!==j.value){D.warn("Unhandled entity "+j.value),j=V.next();continue}D.debug("ATTDEF {"),I=_(),D.debug("}")}P(I),a.push(I)}else j=V.next();return"ENDSEC"==w&&(j=V.next()),a},d=function(G){switch(j.code){case 0:G.type=j.value,j=V.next();break;case 5:G.handle=j.value,j=V.next();break;case 6:G.lineType=j.value,j=V.next();break;case 8:G.layer=j.value,j=V.next();break;case 48:G.lineTypeScale=j.value,j=V.next();break;case 60:G.visible=0===j.value,j=V.next();break;case 62:G.colorIndex=j.value,G.color=n(Math.abs(j.value)),j=V.next();break;case 67:G.inPaperSpace=0!==j.value,j=V.next();break;case 210:G.extrusionDirection=w();break;case 230:G.extrusionDirection={x:0,y:0,z:j.value},j=V.next();break;case 330:G.ownerHandle=j.value,j=V.next();break;case 347:G.materialObjectHandle=j.value,j=V.next();break;case 370:G.lineweight=j.value,j=V.next();break;case 420:G.color=j.value,j=V.next();break;case 100:if("AcDbEntity"==j.value){j=V.next();break}default:k(j),j=V.next()}},Y=function(){var Z={type:j.value};for(j=V.next();"EOF"!==j&&0!==j.code;)switch(j.code){case 10:Z.x=j.value,j=V.next();break;case 20:Z.y=j.value,j=V.next();break;case 30:Z.z=j.value,j=V.next();break;case 40:case 41:case 42:j=V.next();break;case 70:Z.curveFittingVertex=0!==(1|j.value),Z.curveFitTangent=0!==(2|j.value),Z.splineVertex=0!==(8|j.value),Z.splineControlPoint=0!==(16|j.value),Z.ThreeDPolylineVertex=0!==(32|j.value),Z.ThreeDPolylineMesh=0!==(64|j.value),Z.polyfaceMeshVertex=0!==(128|j.value),j=V.next();break;case 50:case 71:case 72:case 73:case 74:j=V.next();break;default:d(Z)}return Z},x=function(){var c={type:j.value};for(j=V.next();"EOF"!=j&&0!=j.code;)d(c);return c},w=function(){var s={},g=j.code;if(s.x=j.value,g+=10,j=V.next(),j.code!=g)throw new Error("Expected code for point value to be "+g+" but got "+j.code+".");return s.y=j.value,g+=10,j=V.next(),j.code!=g?s:(s.z=j.value,j=V.next(),s)},r=function(){var k={},O=j.code;return k.x=j.value,O+=1,j=V.next(),j.code!=O?(V._pointer-=2,k.y=1):k.y=j.value,O+=1,j=V.next(),j.code!=O?(V._pointer-=2,k):(k.z=j.value,j=V.next(),k)},y=function(u){if(!u||0>=u)throw Error("n must be greater than 0 verticies");var A,X=[],H=!1,N=!1;for(A=0;u>A;A++){for(var w={};"EOF"!==j&&0!==j.code&&!N;){switch(j.code){case 10:if(H){N=!0;continue}w.x=j.value,H=!0;break;case 20:w.y=j.value;break;case 30:w.z=j.value;break;case 40:w.startWidth=j.value;break;case 41:w.endWidth=j.value;break;case 42:0!=j.value&&(w.bulge=j.value);break;default:if(H){N=!0;continue}continue}j=V.next()}X.push(w),H=!1,N=!1}return X},R=function(){for(var e=[];"EOF"!==j;)if(0===j.code)if("VERTEX"===j.value)e.push(Y());else if("SEQEND"===j.value){x();break}return e},K=function(){var G={type:j.value};for(j=V.next();"EOF"!==j&&0!==j.code;)switch(j.code){case 1:G.text=j.value,j=V.next();break;case 3:G.text+=j.value,j=V.next();break;case 10:G.position=w();break;case 40:G.height=j.value,j=V.next();break;case 41:G.width=j.value,j=V.next();break;case 71:G.attachmentPoint=j.value,j=V.next();break;case 72:G.drawingDirection=j.value,j=V.next();break;case 50:G.angle=2*j.value*Math.PI/360,j=V.next();break;case 11:G.directionX=j.value,j=V.next();break;case 21:G.directionY=j.value,j=V.next();break;default:d(G)}return G},_=function(){var T={type:j.value,scale:1,textStyle:"STANDARD"};for(j=V.next();"EOF"!==j&&0!==j.code;)switch(j.code){case 1:T.text=j.value,j=V.next();break;case 2:T.tag=j.value,j=V.next();break;case 3:T.prompt=j.value,j=V.next();break;case 7:T.textStyle=j.value,j=V.next();break;case 10:T.x=j.value,j=V.next();break;case 20:T.y=j.value,j=V.next();break;case 30:T.z=j.value,j=V.next();break;case 39:T.thickness=j.value,j=V.next();break;case 40:T.textHeight=j.value,j=V.next();break;case 41:T.scale=j.value,j=V.next();break;case 50:T.rotation=j.value,j=V.next();break;case 51:T.obliqueAngle=j.value,j=V.next();break;case 70:T.invisible=!!(1&j.value),T.constant=!!(2&j.value),T.verificationRequired=!!(4&j.value),T.preset=!!(8&j.value),j=V.next();break;case 71:T.backwards=!!(2&j.value),T.mirrored=!!(4&j.value),j=V.next();break;case 72:T.horizontalJustification=j.value,j=V.next();break;case 73:T.fieldLength=j.value,j=V.next();break;case 74:T.verticalJustification=j.value,j=V.next();break;case 100:j=V.next();break;case 210:T.extrusionDirectionX=j.value,j=V.next();break;case 220:T.extrusionDirectionY=j.value,j=V.next();break;case 230:T.extrusionDirectionZ=j.value,j=V.next();break;default:d(T)}return T},N=function(){var Q={type:j.value,vertices:[]},v=0;for(j=V.next();"EOF"!==j&&0!==j.code;)switch(j.code){case 38:Q.elevation=j.value,j=V.next();break;case 39:Q.depth=j.value,j=V.next();break;case 70:Q.shape=1===j.value,j=V.next();break;case 90:v=j.value,j=V.next();break;case 10:Q.vertices=y(v);break;case 43:0!==j.value&&(Q.width=j.value),j=V.next();break;default:d(Q)}return Q},Q=function(){var N={type:j.value,vertices:[]};for(j=V.next();"EOF"!==j&&0!==j.code;)switch(j.code){case 10:case 20:case 30:case 39:case 40:case 41:j=V.next();break;case 70:N.shape=0!==(1|j.value),j=V.next();break;case 71:case 72:case 73:case 74:case 75:j=V.next();break;case 100:j=V.next();break;default:d(N)}return N.vertices=R(),N},t=function(){var J={type:j.value,vertices:[]};for(j=V.next();"EOF"!==j&&0!==j.code;)switch(j.code){case 10:J.vertices.unshift(w());break;case 11:J.vertices.push(w());break;case 100:if("AcDbLine"==j.value){j=V.next();break}default:d(J)}return J},S=function(){var B,E;for(B={type:j.value},j=V.next();"EOF"!==j&&0!==j.code;)switch(j.code){case 10:B.center=w();break;case 40:B.radius=j.value,j=V.next();break;case 50:B.startAngle=Math.PI/180*j.value,j=V.next();break;case 51:E=Math.PI/180*j.value,B.angleLength=Eq?e:O.methodFactory(S,$)}}function z(G){var Q=(n[G]||"silent").toUpperCase();try{return i.localStorage.loglevel=Q,void 0}catch(f){}try{i.document.cookie="loglevel="+Q+";"}catch(f){}}function H(){var j;try{j=i.localStorage.loglevel}catch(q){}if(typeof j===t)try{j=/loglevel=([^;]+)/.exec(i.document.cookie)[1]}catch(q){}O.levels[j]===J&&(j="WARN"),O.setLevel(O.levels[j],!1)}var O={},e=function(){},t="undefined",n=["trace","debug","info","warn","error"];O.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},O.methodFactory=function(G,B){return j(G)||v(G,B)},O.setLevel=function(s,T){if("string"==typeof s&&O.levels[s.toUpperCase()]!==J&&(s=O.levels[s.toUpperCase()]),!("number"==typeof s&&s>=0&&s<=O.levels.SILENT))throw"log.setLevel() called with invalid level: "+s;return T!==!1&&z(s),q(s),typeof console===t&&sC;C++){o=r[C],S=y[o];for(A in S)for(J=S[A],e=0,l=J.length;l>e;e++)if(K=J[e],E=K.vertices,E&&E.length){for(w=u.$3w(E[0].x,1),R=u.$3w(E[0].y,2),H={type:"shape",borderColor:A,points:[w,R],segments:[1]},H.borderWidth=Math.max(1,u.$3w(K.width||0)),p=1,d=E.length;d>p;p++)F=E[p],H.points.push(u.$3w(F.x,1),u.$3w(F.y,2)),H.segments.push(2);K.shape&&H.segments.push(5),u.shapeComps.push(H)}}},X.prototype.$11w=function(){var u,P,o,G,S,r,z,Y,b,h,c,H=this,C=H._models;for(u=s.SOLID,G=0,S=u.length;S>G;G++){P=u[G],o=C[P];for(Y in o)for(b=o[Y],r=0,z=b.length;z>r;r++)h=b[r],c=h.points,H.shapeComps.push({type:"shape",background:Y,points:[H.$3w(c[0].x,1),H.$3w(c[0].y,2),H.$3w(c[1].x,1),H.$3w(c[1].y,2),H.$3w(c[3].x,1),H.$3w(c[3].y,2),H.$3w(c[2].x,1),H.$3w(c[2].y,2)],segments:[1,2,2,2,5]})}},X.prototype.extrusionZNagative=function(x){var _=x.extrusionDirection;return _?Math.abs(_.z+1)<1e-5:!1},X.prototype.$9w=function(){var F,d,U,W,j,G,N,T,q,y,D,I,V,w,k,_,f,J,g,L,a=this,S=a._models;for(F=s.CIRCLE,W=0,j=F.length;j>W;W++){d=F[W],U=S[d];for(T in U)for(q=U[T],G=0,N=q.length;N>G;G++){if(y=q[G],D=y.startAngle||0,I=y.angleLength||2*Math.PI,V=D+I,w=a.$3w(y.radius),k=y.addonAngle||0,_=a.$3w(y.center.x,1),f=a.$3w(y.center.y,2),L=y.xInvert^a.extrusionZNagative(y),g=y.yInvert,g||L?L&&g?(D=Math.PI+D,V=Math.PI+V,J=!1):(D=Math.PI*(L?1:2)-D,V=Math.PI*(L?1:2)-V,J=!0):J=!1,J=!J,D=2*Math.PI-D-k,V=2*Math.PI-V-k,J){var t=D;D=V,V=t}a.shapeComps.push({type:"arc",borderColor:T,borderWidth:1,rect:[_-w,f-w,2*w,2*w],arcFrom:D,arcTo:V,arcClose:!1})}}},X.prototype.$8w=function(){var S,C,T,q,Y,I,b,W,y,x,n,L,g,d,p,j,U,z,N,J,R,a,t,w,G,D=this,O=D._models;for(S=s.TEXT,w=D.options.textScaleRatio,q=0,Y=S.length;Y>q;q++){C=S[q],T=O[C];for(W in T)for(y=T[W],I=0,b=y.length;b>I;I++)if(x=y[I],n=x.text,n&&n.length)if("MTEXT"===C?(L=D.$3w(x.height||12),g=D.$3w(x.position.x,1),d=D.$3w(x.position.y,2),J=x.angle?x.angle:x.directionX?Math.atan2(x.directionY,x.directionX):0,J+=x.addonAngle||0,t=1,N=x.attachmentPoint||1,U=N%3,z=Math.floor(N/3)):(L=D.$3w(x.textHeight||12),g=x.startPoint.x,d=x.startPoint.y,J=x.rotation||0,t=x.xScale||1,2===x.generationFlags?J=2*Math.PI-J:4===x.generationFlags?J=Math.PI-J:6===x.generationFlags&&(J=Math.PI+J),g=D.$3w(g,1),d=D.$3w(d,2),U=(x.halign||0)+1,3===x.valign?z=0:2===x.valign?(z=1,x.endPoint&&(g=(g+D.$3w(x.endPoint.x,1))/2)):z=2),D._isAc2015&&(d-=L),J=2*Math.PI-J,z=1===z?"middle":0===z?"top":"bottom",j=0===U?"right":2===U?"center":"left",p=L*w+"px "+D.options.font,"MTEXT"===C)for(n=n.replace(/\\{/g,"#@#"),n=n.replace(/\\}/g,"#@@"),n=n.replace(/({|})/g,""),n=n.replace(/#@#/g,"{"),n=n.replace(/#@@/g,"}"),n=n.replace(/\\[ACT]\d+;/g,""),(G=n.match(/\\f[^;]*;/))&&(n=n.replace(G[0],""),G=G[0].match(/\|p(\d+)/),G&&(p=G[0]/10*L*w+"px "+p)),R=n.split("\\P"),a=0;ai;i++){D=r[i],p=y[D];for(G in p)for(l=p[G],b=0,k=l.length;k>b;b++){if(u=l[b],E=u.major,m=Math.atan2(E.y,E.x),I=f.$3w(Math.sqrt(E.x*E.x+E.y*E.y)),g=I*u.ratio,C=u.startAngle||0,j=u.angleLength||2*Math.PI,J=C+j,F=f.$3w(u.center.x,1),K=f.$3w(u.center.y,2),h=u.xInvert,B=u.yInvert^f.extrusionZNagative(u),B^=1,B||h?h&&B?(C=Math.PI+C,J=Math.PI+J,V=!1):(C=Math.PI*(h?1:2)-C,J=Math.PI*(h?1:2)-J,V=!0):V=!1,V){var n=C;C=J,J=n}m=2*Math.PI-m,f.shapeComps.push({type:"arc",borderColor:G,borderWidth:1,rotation:m,rect:[F-I,K-g,2*I,2*g],arcFrom:C,arcTo:J,arcClose:!1,arcOval:!0})}}},X.prototype.$4w=function(m,a,J,H){var F=this,q=F.$2w(a,J);if(q&&(!F.options.filter||!F.options.filter(a))){var n,z,S,g=a.type;if("DIMENSION"!==g&&"INSERT"!==g){(n=m[g])||(n=m[g]={}),(z=n[q])||(z=n[q]=[]);var B=F.extrusionZNagative(a)&&["POINT","LINE","ELLIPSE"].indexOf(g)<0;if(H||B){H||(H={a:1,b:0,c:0,d:1,tx:0,ty:0});var D={};for(var N in a)D[N]=a[N];D.radius&&(D.radius*=Math.sqrt(H.a*H.a+H.b*H.b)),D.textHeight&&(D.textHeight*=Math.sqrt(H.a*H.a+H.b*H.b));var f=B?-1:1,Q=function(R,M){if(R){var u=R.x,e=R.y;return{x:u*f*M.a+e*M.c+M.tx,y:u*f*M.b+e*M.d+M.ty}}};if(D.position=Q(D.position,H),D.startPoint=Q(D.startPoint,H),D.center=Q(D.center,H),"ELLIPSE"===g){var i;i=Q({x:a.major.x+a.center.x,y:a.major.y+a.center.y},H),D.major={x:i.x-D.center.x,y:i.y-D.center.y},F.extrusionZNagative(a)&&(D.major.x*=-1)}var O;D.vertices&&(O=[],D.vertices.forEach(function(u){O.push(Q(u,H))}),D.vertices=O),D.points&&(O=[],D.points.forEach(function(U){O.push(Q(U,H))}),D.points=O);var o=Math.atan2(H.b,H.a),e=Math.cos(o);D.yInvert=H.d*e<0,D.xInvert=H.a*e<0,0!==o&&(D.addonAngle=o),a=D}F.$8dw(a),z.push(a)}else{if(!a.block)return;if(F.extrusionZNagative(a))return;var T=J.blocks[a.block];if(!T||!T.entities)return;var c=H;if("INSERT"===g){var r=a.scale?a.scale.x:1,j=a.scale?a.scale.y:1,l=0,R=1,V=0;if(a.deg&&(l=a.deg*Math.PI/180,R=Math.cos(l),V=Math.sin(l)),H){var L=r*R,E=r*V,A=-j*V,y=j*R,P=a.center.x,Y=a.center.y;c={a:H.a*L+H.c*E,b:H.b*L+H.d*E,c:H.a*A+H.c*y,d:H.b*A+H.d*y,tx:H.a*P+H.c*Y+H.tx,ty:H.b*P+H.d*Y+H.ty}}else c={a:r*R,b:r*V,c:-j*V,d:j*R,tx:a.center.x,ty:a.center.y}}for(S=0;Sr;r++){var m=s[r];g=Math.min(g,m.x),o=Math.min(o,m.y),x=Math.max(x,m.x),w=Math.max(w,m.y)}return{xMin:g,yMin:o,xMax:x,yMax:w}},X.prototype.$8dw=function(Z){var f,m,l=this;m=Z.type;for(f in s)if(s[f].indexOf(m)>=0)break;var F,A,B,M,x,W,o,K,C,D,Y,O,h,y,P,G,u=l.$8cw;switch(f){case"LINE":F=u(Z.vertices);break;case"SOLID":F=u(Z.points);break;case"POINT":if(!Z.position)return;A=Z.position.x,B=Z.position.y,F={xMin:A,yMin:B,xMax:A,yMax:B};break;case"CIRCLE":for(A=Z.center.x,B=Z.center.y,M=Z.radius,x=[],W=Z.startAngle||0,o=W+(Z.angleLength||2*Math.PI),K=Z.xInvert^l.extrusionZNagative(Z),C=Z.yInvert,D=K?-1:1,Y=C?-1:1,O=W;Ob;b++)J=K.entities[b],t.$4w(q,J,K)},X.prototype.$3w=function(a,R){var c,J=this;return c=2===R?-(a-J._shiftY):1===R?a-J._shiftX:a,c*J._scale},X.prototype.$2w=function(L,b){var l,Z=this;if(b.tables&&b.tables.layer&&(l=b.tables.layer.layers[L.layer]),!l||l.visible){var x;return L.color!==J?(x=L.color,0===x&&(x=Z.options.defaultColor)):l&&(x=l.color),x&&16777215!==x||(x=Z.options.defaultColor),"#"+((1<<24)+x).toString(16).slice(1)}}}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:this,Object);