pccv_front/public/autodesk/extensions/CompGeom/CompGeom.min.js
2025-08-29 11:44:29 +08:00

18 lines
185 KiB
JavaScript

/*!
* LMV v7.99.1
*
* Copyright 2024 Autodesk, Inc.
* All rights reserved.
*
* This computer source code and related instructions and comments are the
* unpublished confidential and proprietary information of Autodesk, Inc.
* and are protected under Federal copyright and state trade secret law.
* They may not be disclosed to, copied or used by any third party without
* the prior written consent of Autodesk, Inc.
*
* Autodesk Viewer SDK Usage Limitations:
*
* The Autodesk Viewer SDK JavaScript must be delivered from an
* Autodesk-hosted URL.
*/(()=>{var t={6986:(t,e,i)=>{"use strict";i.r(e),i.d(e,{LmvCanvasContext:()=>x,hijackContextAPI:()=>l});var n=i(8917),s=Autodesk.Viewing,r=s.Private;const o=r.VertexBufferBuilder;function l(t,e){["fillRect","strokeRect","clearRect","beginPath","closePath","moveTo","lineTo","arc","arcTo","quadraticCurveTo","bezierCurveTo","rect","fill","stroke","clip","strokeText","fillText","drawImage","save","restore","setLineDash","createPattern","beginMarkedContent","beginMarkedContentProps","endMarkedContent","setCurrentOperatorIndex","isLMVCanvasContext","beginChildGroup","endChildGroup"].forEach((i=>{t["_original"+i]=t[i],t[i]=e[i].bind(e)}))}let h=new Array(6),a=new THREE.Vector2,p=new THREE.Box2;var u=new THREE.Vector3,d=new THREE.Quaternion,c=new THREE.Vector3,f=new THREE.Vector3,y=new THREE.Matrix4;class x{static getLayerKey(t){let e;return t&&"object"==typeof t?(e=t.ocgId,void 0===e&&(e=t.name)):e=t,e}static isRef(t){return null!=t&&"number"==typeof t.num&&"number"==typeof t.gen}static refKey(t){return`${t.num}-${t.gen}`}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}constructor(t,e,i,n,r,h,a){var p=s.getGlobal().document.createElement("canvas"),u=p.getContext("2d");if(p.height=t.height,p.width=t.width,u.imageSmoothingEnabled=!1,this.canvasContext=u,this.viewport=t,this.toPageUnits=e,this.meshCallback=i,1==t.clipToViewport){let i=t.offsetX||0,n=t.offsetY||0;this.bounds=new THREE.Vector4(i*e,n*e,(t.width+i)*e,(t.height+n)*e)}this.currentMeshIndex=0,this.imageNumber=0,this.currentVbb=new o(!1),this._curPath=null,this._curClip=null,this.first=!0,this.states=[],this.glyphCache={},this.usingTextLayer=r,this.precisionTolerance=.1,this.dbId=-1,this.maxDbId=0,this.consecutiveIds=!1,s.isMobileDevice()&&Autodesk.Extensions.CompGeom.SetTesselationParams(void 0,.1),this.fontEngine=n,this.lineStyle=0,this.isScreenSpace=!1,l(u,this),this.layers={},this.defaultLayerId=0,this.currentLayerId=this.defaultLayerId,this.sequencedDbId=-1,this.taggedId=null,this.defaultVPId=0,this.viewportCounter=1,this.currentVpId=this.defaultVPId,this.viewports=[this.createViewPortData((new THREE.Matrix4).makeScale(t.scale,t.scale,t.scale).elements)],this.viewportMap={},this.ocgStack=[],this.msdfRender=!0,this.fontAtlas=h,this.pdfRefMap=a||{},this.smallImageSequenceToCheck=-1,this.inSmallImageRendering=!1,this.inChildGroup=!1,this.overrideCompositeOperation="source-over",this.overrideAlpha=1}destroy(){this.canvasContext=null,this.meshCallback=null}updateDBId(){null!=this.taggedId?this.dbId=this.taggedId:this.consecutiveIds&&(this.sequencedDbId++,this.dbId=this.sequencedDbId),this.maxDbId=Math.max(this.maxDbId,this.dbId)}snapToPixel(t,e){const i=this.canvasContext.mozCurrentTransformInverse,n=this.canvasContext.mozCurrentTransform;let s=x.applyTransform([t,e],n);return s[0]=Math.round(s[0]),s[1]=Math.round(s[1]),x.applyTransform(s,i)}save(){this.states.push({clip:this._curClip,consecutiveIds:this.consecutiveIds,lineDashedDef:this.lineDashedDef,lineStyle:this.lineStyle,overrideCompositeOperation:this.overrideCompositeOperation,overrideAlpha:this.overrideAlpha,inChildGroup:this.inChildGroup}),this.canvasContext._originalsave()}restore(){let t=this.states.pop();t&&(this._curClip=t.clip,this.consecutiveIds=t.consecutiveIds,this.lineDashedDef=t.lineDashedDef,this.lineStyle=t.lineStyle,this.overrideCompositeOperation=t.overrideCompositeOperation,this.overrideAlpha=t.overrideAlpha,this.inChildGroup=t.inChildGroup),this.canvasContext._originalrestore()}flushBuffer(t,e,i){if(!this.currentVbb.vcount&&!e)return;let n="source-over";const s="source-over"!=this.overrideCompositeOperation?this.overrideCompositeOperation:this.canvasContext.globalCompositeOperation;"multiply"!==s&&"min"!==s&&"darken"!==s&&"lighten"!==s||(n=s);const r=this.currentCompositeOperation!==n;if((e||this.currentVbb.isFull(t)||r)&&this.currentVbb.vcount){const t=this.currentVbb.toMesh();t.material={skipEllipticals:!this.currentVbb.numEllipticals,skipCircles:!this.currentVbb.numCirculars,skipTriangleGeoms:!this.currentVbb.numTriangleGeoms,skipMiterLines:!this.currentVbb.numMiterLines,useInstancing:this.currentVbb.useInstancing,isScreenSpace:!this.currentImage,hasLineStyles:this.currentVbb.hasLineStyles,msdfFontTexture:!!this.hasMSDFContent,viewportBounds:this.bounds,imageUVTexture:2===i},this.currentImage&&(t.material.image=this.currentImage,t.material.image.name=this.currentImage.cacheKey||this.imageNumber++,t.material.compositeCanvasColor="#ffffff",t.material.opacity=this.canvasContext.globalAlpha,this.currentImage=null),t.material.compositeOperation=this.currentCompositeOperation,this.inChildGroup&&t.material.opacity!==this.overrideAlpha&&(t.material.hasOpacity=!!this.overrideAlpha,t.material.opacity=this.overrideAlpha),this.meshCallback(t,this.currentMeshIndex++),this.currentVbb.reset(0),this.hasMSDFContent=!1}this.currentCompositeOperation=n}addPolyTriangle(t,e,i,n,s,r){var o=this,l=null,h=this.currentVpId;function a(t,e){if(t>e){var i=t;t=e,e=i}if(l[t]){var n=l[t],s=n.lastIndexOf(e);-1==s?n.push(e):n[s]=-1}else l[t]=[e]}function p(e,r){if(e>r){var a=e;e=r,r=a}var p=l[e];p&&(-1!=p.indexOf(r)&&(o.flushBuffer(4),o.currentVbb.addSegment(t[2*e],t[2*e+1],t[2*r],t[2*r+1],o.currentLayerId,-.5,i,n,s,h,o.lineStyle)))}if(r){l=new Array(t.length/2);for(var u=0,d=e.length;u<d;u+=3){var c=e[u],f=e[u+1],y=e[u+2];a(c,f),a(f,y),a(y,c)}}if(isNaN(i)&&(!0===i.isPattern||i.imageTransform)){this.flushBuffer(0,!0);var g=i.image,P=t.length/2;this.flushBuffer(P);var m=this.currentVbb,v=m.vcount,C=this.getCurrentTransform();if("no-repeat"!==i.repetition||i.isGradient)if(i.imageTransform)for(let e=0;e<P;++e){var _=t[2*e],I=t[2*e+1];const r=x.applyTransform([_,I],i.imageTransform);m.addVertexImagePolytriangle(_,I,r[0],r[1],4294967295,n,s,h)}else for(let e=0;e<P;++e){const r=t[2*e],o=t[2*e+1];let l,a;if(i.isGradient){const t=this._curPath.bbox.min.x,e=this._curPath.bbox.min.y;l=(r-t)/(this._curPath.bbox.max.x-t),a=(o-e)/(this._curPath.bbox.max.y-e)}else{const t=x.applyTransform([r/this.toPageUnits,o/this.toPageUnits],this.getCurrentInverseTransform());l=t[0]/g.width,a=t[1]/g.height}m.addVertexImagePolytriangle(r,o,l,1-a,4294967295,n,s,h)}else{const t=this.tx(0,0,C),i=this.ty(0,0,C),r=this.tx(g.width,g.height,C),o=this.ty(g.width,g.height,C);m.addVertexImagePolytriangle(t,i,0,0,4294967295,n,s,h),m.addVertexImagePolytriangle(t,o,0,-1,4294967295,n,s,h),m.addVertexImagePolytriangle(r,o,1,-1,4294967295,n,s,h),m.addVertexImagePolytriangle(r,i,1,0,4294967295,n,s,h),e=[0,1,2,0,2,3]}this.currentImage=g,m.addIndices(e,v),this.flushBuffer(0,!0,2)}else if(this.currentVbb.useInstancing){const o=e.length;for(let l=0;l<o;l+=3){let o=e[l],a=e[l+1],u=e[l+2];this.flushBuffer(4),this.currentVbb.addTriangleGeom(t[2*o],t[2*o+1],t[2*a],t[2*a+1],t[2*u],t[2*u+1],i,n,s,h),r&&(p(o,a),p(a,u),p(u,o))}}else{const a=t.length/2;this.flushBuffer(a);const p=this.currentVbb,u=p.vcount;for(let e=0;e<a;++e){const r=t[2*e],o=t[2*e+1];p.addVertexPolytriangle(r,o,i,n,s,h)}p.addIndices(e,u),r&&function(){for(var e=0,r=l.length;e<r;e++){var a=l[e];if(a)for(var p=0;p<a.length;p++){var u=a[p];-1!=u&&(o.flushBuffer(4),o.currentVbb.addSegment(t[2*e],t[2*e+1],t[2*u],t[2*u+1],o.currentLayerId,-.5,i,n,s,h,o.lineStyle))}}}()}}createGradientData(t){return new g(t)}getFillColor(){const t=t=>{const e=t.startPoint.slice(),i=t.endPoint.slice(),n=this.getCurrentTransform(),s=e[0],r=i[0];e[0]=this.tx(s,e[1],n),e[1]=this.ty(s,e[1],n),i[0]=this.tx(r,i[1],n),i[1]=this.ty(r,i[1],n);const o=this.viewport.scale||1;let l=1/this.toPageUnits/o,h=(this._curPath.bbox.max.x-this._curPath.bbox.min.x)*l,a=(this._curPath.bbox.max.y-this._curPath.bbox.min.y)*l;const p=Math.max(h,a,1);p>2048&&(l*=2048/p,h=(this._curPath.bbox.max.x-this._curPath.bbox.min.x)*l,a=(this._curPath.bbox.max.y-this._curPath.bbox.min.y)*l);const u=this._curPath.bbox.min.x,d=this._curPath.bbox.min.y;e[0]-=u,e[1]-=d,i[0]-=u,i[1]-=d,e[0]*=l,e[1]*=l,i[0]*=l,i[1]*=l;const c=document.createElement("canvas");c.width=Math.max(h,1),c.height=Math.max(a,1);const f=c.getContext("2d"),y=t.generateCanvasGradient(f,e,i);f.fillStyle=y,f.fillRect(0,0,c.width,c.height);const x=this.createPattern(c,"no-repeat");return x.isGradient=!0,x},e=this.canvasContext.fillStyle;if(e&&!0===e.isPattern)return e;if(e instanceof CanvasGradient){return t(new g(e))}if("string"!=typeof e)return console.warn("Unsupported fill style."),0;var i=parseInt(e.slice(1),16);return 255*this.canvasContext.globalAlpha<<24|(255&i)<<16|65280&i|i>>16&255}getStrokeColor(){let t=this.canvasContext;if(this.lastStrokeStyle===t.strokeStyle&&t.globalAlpha===this.lastAlpha)return this.lastRgb;{let i;"string"!=typeof t.strokeStyle?(console.warn("Unsupported stroke style."),i=parseInt(0,16)):i=parseInt(t.strokeStyle.slice(1),16);var e=255*t.globalAlpha<<24|(255&i)<<16|65280&i|i>>16&255;return this.lastRgb=e,this.lastStrokeStyle=t.strokeStyle,this.lastAlpha=t.globalAlpha,e}}getCurrentTransform(){let t=this.canvasContext.mozCurrentTransform;if(this.isFontChar){let e=this.invXform,i=t[0],n=t[1],s=t[2],r=t[3],o=t[4],l=t[5];return h[0]=e[0]*i+e[2]*n,h[1]=e[1]*i+e[3]*n,h[2]=e[0]*s+e[2]*r,h[3]=e[1]*s+e[3]*r,h[4]=e[0]*o+e[2]*l+e[4],h[5]=e[1]*o+e[3]*l+e[5],h}return t}getCurrentInverseTransform(){return this.canvasContext.mozCurrentTransformInverse}tx(t,e,i){return(t*(i=i||this.getCurrentTransform())[0]+e*i[2]+i[4])*(this.isFontChar?1:this.toPageUnits)}ty(t,e,i){return(t*(i=i||this.getCurrentTransform())[1]+e*i[3]+i[5])*(this.isFontChar?1:this.toPageUnits)}scaleValue(t,e){return e=e||this.getCurrentTransform(),this.toPageUnits*Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))*t}transformBox(t,e,i){return e=e||this.getCurrentTransform(),p.makeEmpty(),a.set(this.tx(t.min.x,t.min.y,e),this.ty(t.min.x,t.min.y,e)),p.expandByPoint(a),a.set(this.tx(t.max.x,t.min.y,e),this.ty(t.max.x,t.min.y,e)),p.expandByPoint(a),a.set(this.tx(t.max.x,t.max.y,e),this.ty(t.max.x,t.max.y,e)),p.expandByPoint(a),a.set(this.tx(t.min.x,t.max.y,e),this.ty(t.min.x,t.max.y,e)),p.expandByPoint(a),i?(i.copy(p),i):p.clone()}fillRect(t,e,i,n){if(this.inSmallImageRendering){const s=this.snapToPixel(t,e),r=this.snapToPixel(t+i,e+n),o=r[0]-s[0],l=r[1]-s[1];this.canvasContext._originalfillRect(s[0],s[1],o,l)}else this.updateDBId(),this.rect(t,e,i,n),this.dbId=this.first?-1:this.dbId,this.first=!1,this.fill(),this.beginPath()}strokeRect(t,e,i,n){console.log("strokeRect")}clearRect(t,e,i,n){console.log("clearRect")}_beginTextChar(t,e,i,n,s){this.isFontChar=!0,this.invXform=this.canvasContext.mozCurrentTransformInverse,this.hashKey=t.codePointAt(0)+"/"+n.loadedName+"/"+s,this.cachedGlyph=this.glyphCache[this.hashKey],this.cachedGlyph?this.skipPath=!0:this.skipPath=!1}drawMSDFText(t,e,i,s,r){var o=s.name;function l(t,e,i,n,s,r){return Math.abs((r-n)*t-(s-i)*e+s*n-r*i)/Math.sqrt((r-n)*(r-n)+(s-i)*(s-i))}if(this.fontAtlas&&this.fontAtlas.charsMap&&this.fontAtlas.charsMap[o]){var h=this.fontAtlas.charsMap[o][t.charCodeAt(0)];if(null==h)return!1;{this.currentVbb.isFull(4)&&this.flushBuffer(0,!0),this.hasMSDFContent=!0;var a=this.fontAtlas.chars[h];if(a.page>0)return!1;var p=this.fontAtlas.common[a.common],u=r/this.fontAtlas.info[a.info].size,d=a.width*(u+0);let t=a.inverseYAxis?-1:1;var c=a.height*(u+i)*t,f=a.txoffset*(u+0),y=a.tyoffset*(u+i)*-t,x=[f,y,f,y+c,f+d,y+c,f+d,y],g=[];for(let t=0;t<x.length;t+=2)g.push(this.tx(x[t],x[t+1])),g.push(this.ty(x[t],x[t+1]));let e=[];if(e=a.inverseYAxis?[a.x/p.scaleW,1-a.y/p.scaleH,a.x/p.scaleW,1-(a.y+a.height)/p.scaleH,(a.x+a.width)/p.scaleW,1-(a.y+a.height)/p.scaleH,(a.x+a.width)/p.scaleW,1-a.y/p.scaleH]:[a.x/p.scaleW,1-(a.y+a.height)/p.scaleH,a.x/p.scaleW,1-a.y/p.scaleH,(a.x+a.width)/p.scaleW,1-a.y/p.scaleH,(a.x+a.width)/p.scaleW,1-(a.y+a.height)/p.scaleH],this._curClip){var P=new n.Path2D(this.precisionTolerance);let t=0;P.moveTo(g[t++],g[t++]),P.lineTo(g[t++],g[t++]),P.lineTo(g[t++],g[t++]),P.lineTo(g[t++],g[t++]),P.closePath();var m=P.flattened||P.flatten(!0),v=this._curClip.flattened||this._curClip.flatten(!0),C=P.preCheckForClipping(this,v,m,!1,!1);if(C.needClipping){var _=P.msdfClipping(v);let t=g[0],i=g[1],n=g[6],s=g[7],r=g[2],o=g[3],h=Math.sqrt((n-t)*(n-t)+(s-i)*(s-i)),p=Math.sqrt((r-t)*(r-t)+(o-i)*(o-i));for(var I=0;I<_.length;I++){let a=_[I];this.currentVbb.isFull(a.vertices.length)&&this.flushBuffer(0,!0);let u=this.currentVbb.vcount;for(var E=0;E<a.vertices.length;E+=2){let u=a.vertices[E],d=a.vertices[E+1],c=l(u,d,t,i,n,s),f=l(u,d,t,i,r,o),y=e[0]+(e[4]-e[0])*(f/h),x=e[1]+(e[5]-e[1])*(c/p);this.currentVbb.addVertexMSDFPolytriangle(u,d,y,x,this.getFillColor(),this.dbId,this.currentLayerId,0)}this.currentVbb.addIndices(a.indices,u)}return this.currentImage=this.fontAtlas.pages[a.page],!0}if(C.needCancel)return!0}this.currentVbb.isFull(4)&&this.flushBuffer(0,!0);let s=this.currentVbb.vcount;var T=x.length/2;for(let t=0;t<T;t++)this.currentVbb.addVertexMSDFPolytriangle(g[2*t],g[2*t+1],e[2*t],e[2*t+1],this.getFillColor(),this.dbId,this.currentLayerId,0);return this.currentVbb.addIndices([0,2,1,0,2,3],s),this.currentImage=this.fontAtlas.pages[a.page],!0}}return!1}beginPath(t,e,i,s,r){this.inSmallImageRendering?"string"!=typeof t&&this.canvasContext._originalbeginPath():(this.updateDBId(),"string"==typeof t&&s&&r?this.fontAtlas&&this.drawMSDFText(t,e,i,s,r)||!0===this.usingTextLayer?this.skipPath=!0:this._beginTextChar(t,e,i,s,r):(this.skipPath=!1,this.isFontChar=!1,this.cachedGlyph=null),this.skipPath?this._curPath=null:(this._curPath=new n.Path2D(this.isFontChar?1e-4:this.precisionTolerance),this._curPath.setTessParams(this.tessParams)))}setMiterLine(t){this._curPath.isMiterLine=t}closePath(){this.inSmallImageRendering?this.canvasContext._originalclosePath():this.skipPath||(this._curPath.closePath(),this.cachedGlyph=null)}moveTo(t,e){if(this.inSmallImageRendering){const i=this.snapToPixel(t,e);return void this.canvasContext._originalmoveTo(i[0],i[1])}if(this.skipPath)return;this._curPath||this.beginPath();let i=this.getCurrentTransform();this._curPath.moveTo(this.tx(t,e,i),this.ty(t,e,i))}lineTo(t,e){if(this.inSmallImageRendering){const i=this.snapToPixel(t,e);return void this.canvasContext._originallineTo(i[0],i[1])}if(this.skipPath)return;let i=this.getCurrentTransform();this._curPath.lineTo(this.tx(t,e,i),this.ty(t,e,i))}arc(t,e,i,n,s,r){this.inSmallImageRendering?this.canvasContext._originalarc(t,e,i,n,s,r):this.skipPath||this._curPath.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){if(this.inSmallImageRendering)return void this.canvasContext._originalarcTo(t,e,i,n,s);if(this.skipPath)return;let r=this.getCurrentTransform();this._curPath.arcTo(this.tx(t,e,r),this.ty(t,e,r),this.tx(i,n,r),this.ty(i,n,r),this.scaleValue(s,r))}quadraticCurveTo(t,e,i,n){if(this.inSmallImageRendering)return void this.canvasContext._originalquadraticCurveTo(t,e,i,n);if(this.skipPath)return;let s=this.getCurrentTransform();this._curPath.quadraticCurveTo(this.tx(t,e,s),this.ty(t,e,s),this.tx(i,n,s),this.ty(i,n,s))}bezierCurveTo(t,e,i,n,s,r){if(this.inSmallImageRendering)return void this.canvasContext._originalbezierCurveTo(t,e,i,n,s,r);if(this.skipPath)return;let o=this.getCurrentTransform();this._curPath.bezierCurveTo(this.tx(t,e,o),this.ty(t,e,o),this.tx(i,n,o),this.ty(i,n,o),this.tx(s,r,o),this.ty(s,r,o))}ellipse(t,e,i,n,s,r,o,l){if(this.inSmallImageRendering)return void this.canvasContext._originalellipse(t,e,i,n,s,r,o,l);if(this.skipPath)return;let h=this.getCurrentTransform();this._curPath.ellipse(this.tx(t,e,h),this.ty(t,e,h),this.scaleValue(i,h),this.scaleValue(n,h),s,r,o,l)}rect(t,e,i,n){if(this.inSmallImageRendering){const s=this.snapToPixel(t,e),r=this.snapToPixel(t+i,e+n),o=r[0]-s[0],l=r[1]-s[1];return void this.canvasContext._originalrect(s[0],s[1],o,l)}if(this.skipPath)return;let s=this.getCurrentTransform();this._curPath||this.beginPath(),this._curPath.moveTo(this.tx(t,e,s),this.ty(t,e,s)),this._curPath.lineTo(this.tx(t+i,e,s),this.ty(t+i,e,s)),this._curPath.lineTo(this.tx(t+i,e+n,s),this.ty(t+i,e+n,s)),this._curPath.lineTo(this.tx(t,e+n,s),this.ty(t,e+n,s)),this._curPath.closePath()}fill(){if(this.inSmallImageRendering)return void(arguments.length>0&&"string"==typeof(arguments.length<=0?void 0:arguments[0])?this.canvasContext._originalfill(arguments.length<=0?void 0:arguments[0]):this.canvasContext._originalfill());let t=!1;if(arguments.length){var e;let i=(e=arguments.length-1)<0||arguments.length<=e?void 0:arguments[e];"boolean"==typeof i&&(t=i)}this.isFontChar&&!this.cachedGlyph&&(this.glyphCache[this.hashKey]=this._curPath,this.cachedGlyph=this._curPath,this.cachedGlyph.isFontChar=!0),this.isFontChar=!1,this.cachedGlyph?this.cachedGlyph.fill(this,this.getFillColor(),this.dbId,this.currentLayerId,this._curClip,!0):this._curPath&&this._curPath.fill(this,this.getFillColor(),this.dbId,this.currentLayerId,this._curClip,!1,t),this.skipPath=!1}stroke(){if(this.inSmallImageRendering)return void this.canvasContext._originalstroke();this.isFontChar&&!this.cachedGlyph&&(this.glyphCache[this.hashKey]=this._curPath,this.cachedGlyph=this._curPath,this.cachedGlyph.isFontChar=!0),this.updateLineDashStyle(),this.isFontChar=!1;const t=this.isScreenSpace?-1:1;this.cachedGlyph?this.cachedGlyph.stroke(this,t*this.scaleValue(this.canvasContext.lineWidth),this.getStrokeColor(),this.dbId,this.currentLayerId,this._curClip,!0,this.lineStyle,this.canvasContext.lineCap):this._curPath&&this._curPath.stroke(this,t*this.scaleValue(this.canvasContext.lineWidth),this.getStrokeColor(),this.dbId,this.currentLayerId,this._curClip,!1,this.lineStyle,this.canvasContext.lineCap),this.skipPath=!1}clip(t,e){this.inSmallImageRendering?this.canvasContext._originalclip(t):void 0!==e&&void 0!==t?(this._curClip=t,console.log("Probably unsupported use case")):(this._curClip?this._curClip=this._curClip.clip(this._curPath,t):this._curClip=this._curPath,this._curPath=null)}strokeText(t,e,i,n,s,r){let o=this.canvasContext;o.save(),o.translate(e,i),this.fontEngine.drawText(this,t,0,0,s,r),this.stroke(),o.restore()}fillText(t,e,i,n,s,r){let o=this.canvasContext;o.save(),o.translate(e,i),this.fontEngine.drawText(this,t,0,0,s,r),this.fill(),o.restore()}getRotationAndScale(t){y.elements[0]=t[0],y.elements[1]=t[1],y.elements[4]=t[2],y.elements[5]=t[3],y.elements[12]=t[4],y.elements[13]=t[5],y.decompose(u,d,c);let e=Math.sqrt(1-d.w*d.w);f.set(d.x/e,d.y/e,d.z/e);let i=2*Math.acos(Math.max(Math.min(1,d.w),-1));return d.z<0&&(i=-i),i<0&&(i+=2*Math.PI),{angle:i,scale:c}}drawImage(t,e,i,s,r,o,l,h,a){if(this.inSmallImageRendering){let n=!1;void 0===o&&(o=e,l=i,h=s,a=r,n=!0),void 0===h&&(o=e,l=i,h=t.width,a=t.height,n=!0);const p=this.snapToPixel(o,l),u=this.snapToPixel(o+h,l+a),d=u[0]-p[0],c=u[1]-p[1];return void(n?this.canvasContext._originaldrawImage(t,p[0],p[1],d,c):this.canvasContext._originaldrawImage(t,e,i,s,r,p[0],p[1],d,c))}let p=this._curClip;if(0===t.width||0===t.height)return void console.warn("Zero size image, skipping");const u=this.getCurrentTransform(),{angle:d,scale:c}=this.getRotationAndScale(u);if(void 0===o&&(o=e,l=i,h=s,a=r),void 0===h&&(h=t.width,a=t.height),h)if(p){const e=this.tx(o,l),i=this.ty(o,l),s=this.tx(o+h,l),r=this.ty(o+h,l),u=this.tx(o+h,l+a),d=this.ty(o+h,l+a),c=this.tx(o,l+a),f=this.ty(o,l+a),y=[u-c,d-f,e-c,i-f,c,f];let g={image:t,imageTransform:x.inverseTransform(y)},P=new n.Path2D(this.precisionTolerance);P.moveTo(e,i),P.lineTo(s,r),P.lineTo(u,d),P.lineTo(c,f),P.closePath(),p.fill(this,g,this.dbId,this.currentLayerId,P,!1,!1)}else{let e=this.tx(o+h/2,l+a/2),i=this.ty(o+h/2,l+a/2),n=h*c.x*this.toPageUnits,s=-a*c.y*this.toPageUnits;this.flushBuffer(0,!0),this.currentVbb.addTexturedQuad(e,i,n,s,d,4294902015,0,this.currentLayerId,0),this.currentImage=t,this.flushBuffer(0,!0,1)}else console.warn("Zero size image, skipping")}_processProperties(t){x.isRef(t)&&(t=this.pdfRefMap[x.refKey(t)]);for(let e in t)x.isRef(t[e])&&(t[e]=this.pdfRefMap[x.refKey(t[e])]);return t}beginMarkedContent(t){t&&(t=this._processProperties(t));let e=t.name||t.DBID;isNaN(e)?this.taggedId=null:this.taggedId=parseInt(e),null!==this.taggedId&&this.dbId!==this.taggedId&&this.updateDBId(),t.VP&&(this.currentVpId=this.viewportCounter++),this.ocgStack.push({taggedId:this.taggedId,viewPortId:this.currentVpId})}beginMarkedContentProps(t,e){if(e&&(e=this._processProperties(e)),"OC"===t){var i=this.layers[x.getLayerKey(e)];void 0===i&&(i=this.currentLayerId),this.currentLayerId=i,this.ocgStack.push({layerId:this.currentLayerId})}else isNaN(t)||(this.taggedId=parseInt(t),this.dbId!==this.taggedId&&this.updateDBId()),e?(e.VP&&(this.currentVpId=this.viewportCounter++),this.ocgStack.push({viewPortId:this.currentVpId,taggedId:this.taggedId})):this.ocgStack.push({})}endMarkedContent(){this.ocgStack.length>0&&this.ocgStack.pop();const t=t=>{for(let e=this.ocgStack.length-1;e>=0;--e)if(t in this.ocgStack[e])return this.ocgStack[e][t];return null};let e=t("layerId"),i=t("viewPortId"),n=t("taggedId");this.currentLayerId=null!==e?e:this.defaultLayerId,this.currentVpId=null!==i?i:this.defaultVPId;let s=n!==this.taggedId;this.taggedId=n,s&&this.updateDBId()}setLineStyleParam(t){if(!this.lineStyleInitialized){let i=r.LineStyleDefs.length,n=1;for(var e=0;e<r.LineStyleDefs.length;e++)n=Math.max(r.LineStyleDefs[e].def.length,n);let{tex:s,pw:o,lineStyleTex:l}=r.createLinePatternTextureData(Math.max(t.width,n),t.height+i+1);this.lineStyleIndex=0,this.lineStylePw=o,this.lineStyleTexData=s,this.lineStyleTexture=l,this.lineStyleIndexMap={};for(let t=0;t<r.LineStyleDefs.length;t++)this.addNewDashedLineStyle(r.LineStyleDefs[t],96);this.lineStyle=0,this.lineStyleInitialized=!0}}addNewDashedLineStyle(t,e){let i=t.def.join("/");if(null!=this.lineStyleIndexMap[i])return this.lineStyleIndexMap[i];{r.createLinePatternForDef(t,this.lineStyleTexData,this.lineStyleIndex,this.lineStylePw,e);let n=this.lineStyleIndex;return this.lineStyleIndexMap[i]=n,this.lineStyleIndex++,n}}setLineDash(t){this.lineStyleInitialized||this.setLineStyleParam({width:5,height:4}),this.lineDashedDef=t}createPattern(t,e){var i=this.canvasContext._originalcreatePattern(t,e);return i.image=t,i.repetition=e,i.isPattern=!0,i}updateLineDashStyle(){let t=this.lineDashedDef;if(t)if(t.length>0){let i=this.getCurrentTransform(),n=[];for(var e=0;e<t.length;e++){let s=(t[e]*i[0]+t[e]*i[2])*this.toPageUnits;s=parseFloat(s.toFixed(6)),n.push(s)}this.lineStyle=this.addNewDashedLineStyle({def:n},96/72/this.toPageUnits)}else this.lineStyle=0}setCircleInfo(t){this.circleInfo=t}setCurrentOperatorIndex(t){const e=function(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)},i=function(t,i){let n=[1e10,1e10,-1e10,-1e10];return e(n,t[0]*i[0]+t[1]*i[2]+i[4],t[0]*i[1]+t[1]*i[3]+i[5]),e(n,t[0]*i[0]+t[3]*i[2]+i[4],t[0]*i[1]+t[3]*i[3]+i[5]),e(n,t[2]*i[0]+t[1]*i[2]+i[4],t[2]*i[1]+t[1]*i[3]+i[5]),e(n,t[2]*i[0]+t[3]*i[2]+i[4],t[2]*i[1]+t[3]*i[3]+i[5]),n};if(this.currentOpIndex=t,this.circleInfo&&this.circleInfo[t]){let e=this.getCurrentTransform(),i=this.tx(this.circleInfo[t][0],this.circleInfo[t][1],e),n=this.ty(this.circleInfo[t][0],this.circleInfo[t][1],e);const s=33554431;let r=this.currentVbb.addVertexLine(i,n,0,1e-4,0,0,s,this.dbId,this.currentLayerId,this.currentVpId);this.currentVbb.finalizeQuad(r)}if(this.smallImageSequenceToCheck>=0){const e=this.smallImageSequences[this.smallImageSequenceToCheck];if(e.start==t){this.inSmallImageRendering=!0;const t=i(e.bbox,this.viewport.transform),n=Math.floor(t[0])-1,s=Math.floor(t[1])-1,r=Math.ceil(t[2]-t[0])+2,o=Math.ceil(t[3]-t[1])+2;this.canvasContext.save(),this.canvasContext.setTransform(1,0,0,1,0,0),this.canvasContext._originalclearRect(n,s,r,o),this.canvasContext.fillStyle="rgba(255, 255, 255, 0.005)",this.canvasContext._originalfillRect(n,s,r,o),this.canvasContext.restore()}else if(e.end==t){this.inSmallImageRendering=!1;const t=i(e.bbox,this.viewport.transform),n=Math.floor(t[0])-1,s=Math.floor(t[1])-1,r=Math.ceil(t[2]-t[0])+2,o=Math.ceil(t[3]-t[1])+2;let l=document.createElement("canvas");l.width=r,l.height=o;l.getContext("2d").drawImage(this.canvasContext.canvas,n,s,r,o,0,0,r,o),this.canvasContext.save(),this.canvasContext.setTransform(1,0,0,1,0,0),this.canvasContext.drawImage(l,n,s,r,o),this.canvasContext.restore(),this.smallImageSequenceToCheck++,this.smallImageSequenceToCheck>=this.smallImageSequences.length&&(this.smallImageSequenceToCheck=-1)}}}setSmallImageSequences(t){t&&t.length>0&&(this.smallImageSequences=t,this.smallImageSequenceToCheck=0)}setTessParams(t){this.tessParams=t}finish(){this.flushBuffer(0,!0),this.fontAtlas=null}createViewPortData(t,e,i){return{units:e||"feet and inches",transform:t,geom_metrics:this.initGeomMetrics(),precision:i}}isLMVCanvasContext(){return!0}initGeomMetrics(){return{arcs:0,circles:0,circ_arcs:0,viewports:0,clips:0,colors:0,db_ids:0,dots:0,fills:0,layers:0,line_caps:0,line_joins:0,line_patterns:0,line_pat_refs:0,plines:0,pline_points:0,line_weights:0,links:0,miters:0,ptris:0,ptri_indices:0,ptri_points:0,rasters:0,texts:0,strings:[]}}addContextCurrentTransform(){const t=this.canvasContext;t.mozCurrentTransform||(t._originalSave=t.save,t._originalRestore=t.restore,t._originalRotate=t.rotate,t._originalScale=t.scale,t._originalTranslate=t.translate,t._originalTransform=t.transform,t._originalSetTransform=t.setTransform,t._transformMatrix=t._transformMatrix||[1,0,0,1,0,0],t._transformStack=[],Object.defineProperty(t,"mozCurrentTransform",{get:function(){return this._transformMatrix}}),Object.defineProperty(t,"mozCurrentTransformInverse",{get:function(){var t=this._transformMatrix,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],l=e*s-i*n,h=i*n-e*s;return[s/l,i/h,n/h,e/l,(s*r-n*o)/h,(i*r-e*o)/l]}}),t.save=function(){var t=this._transformMatrix;this._transformStack.push(t),this._transformMatrix=t.slice(0,6),this._originalSave()},t.restore=function(){var t=this._transformStack.pop();t&&(this._transformMatrix=t,this._originalRestore())},t.translate=function(t,e){var i=this._transformMatrix;i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this._originalTranslate(t,e)},t.scale=function(t,e){var i=this._transformMatrix;i[0]=i[0]*t,i[1]=i[1]*t,i[2]=i[2]*e,i[3]=i[3]*e,this._originalScale(t,e)},t.transform=function(e,i,n,s,r,o){var l=this._transformMatrix;this._transformMatrix=[l[0]*e+l[2]*i,l[1]*e+l[3]*i,l[0]*n+l[2]*s,l[1]*n+l[3]*s,l[0]*r+l[2]*o+l[4],l[1]*r+l[3]*o+l[5]],t._originalTransform(e,i,n,s,r,o)},t.setTransform=function(e,i,n,s,r,o){this._transformMatrix=[e,i,n,s,r,o],t._originalSetTransform(e,i,n,s,r,o)},t.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this._transformMatrix;this._transformMatrix=[n[0]*e+n[2]*i,n[1]*e+n[3]*i,n[0]*-i+n[2]*e,n[1]*-i+n[3]*e,n[4],n[5]],this._originalRotate(t)})}beginChildGroup(t){return t.smask?(this.inChildGroup=!1,!1):(this.flushBuffer(0,!0),this.overrideCompositeOperation=this.canvasContext.globalCompositeOperation,this.overrideAlpha*=this.canvasContext.globalAlpha,this.inChildGroup=!0,!0)}endChildGroup(t){return!!this.inChildGroup&&(this.flushBuffer(0,!0),!0)}_getModelToViewportMatrix(t,e){let i="string"==typeof t?JSON.parse(t):t;if(e){const t=new Autodesk.Viewing.Private.LmvMatrix4(!0).fromArray(i),e=new Autodesk.Viewing.Private.LmvMatrix4(!0).makeScale(this.viewport.scale,this.viewport.scale,1);e.multiply(t),i=e.elements}return i}}class g{constructor(t){if(Object.prototype.hasOwnProperty.call(t,"rawData")){const e=t.rawData;this.type=e[1],this.colorStops=e[3],this.startPoint=e[4],this.endPoint=e[5],this.startRadius=e[6],this.endRadius=e[7]}else Object.assign(this,t)}isValid(){return!!(this.type&&this.startPoint&&this.endPoint&&this.colorStops)&&("radial"!==this.type||void 0!==this.startRadius&&void 0!==this.endRadius)}getFillStyle(t){if(!this.isValid())return;const e=t.createLinearGradient(0,0,1,1);return Object.assign(e,this),e}generateCanvasGradient(t,e,i){if(!this.isValid())return;const n=this.type,s=this.colorStops,r=e||this.startPoint,o=i||this.endPoint,l=this.startRadius,h=this.endRadius;let a=null;"axial"===n||"linear"===n?a=t.createLinearGradient(r[0],r[1],o[0],o[1]):"radial"===n&&(a=t.createRadialGradient(r[0],r[1],l,o[0],o[1],h));for(let t=0,e=s.length;t<e;++t){const e=s[t];a.addColorStop(e[0],e[1])}return a}}},6435:(t,e,i)=>{var n=i(4813),s=function(t,e){if(this.p=t,this.q=e,t.y>e.y)this.q=t,this.p=e;else if(t.y===e.y)if(t.x>e.x)this.q=t,this.p=e;else if(t.x===e.x)throw new Error("poly2tri Invalid Edge constructor: repeated points!",[t]);this.q._p2t_edge_list||(this.q._p2t_edge_list=[]),this.q._p2t_edge_list.push(this)};n.SweepContext.prototype.initEdges=function(t,e){var i,n=t.length,r=e?t.length-1:t.length;for(i=0;i<r;++i)this.edge_list.push(new s(t[i],t[(i+1)%n]))},t.exports=n},8831:(t,e,i)=>{"use strict";i.r(e),i.d(e,{DefaultTessParams:()=>n,SetTesselationParams:()=>s,TesselateCubic:()=>l,TesselateQuad:()=>h,getCubeBezierPoint:()=>a});const n={numIterations:100,minSegLenFraction:.05};function s(t,e){t&&(n.numIterations=t),e&&(n.minSegLenFraction=e)}function r(t,e,i,n){return Math.sqrt((t-i)*(t-i)+(e-n)*(e-n))}function o(t,e){if(t>4*e&&e>0){var i=Math.sqrt(t/e);t=e*(i=Math.min(4,i))}return t}function l(t,e,i,s,l,h,a,p,u,d,c,f){c=c||n;var y=r(e,i,s,l)+r(s,l,h,a)+r(h,a,p,u);f||(d=o(d,y));for(var x=(d=d||1/c.minSegLenFraction)*c.minSegLenFraction,g=1/c.numIterations,P=g*g*g,m=3*g,v=m*g,C=v+v,_=6*P,I=e-2*s+h,E=i-2*l+a,T=3*(s-h)-e+p,b=3*(l-a)-i+u,L=e,S=i,A=(s-e)*m+I*v+T*P,N=(l-i)*m+E*v+b*P,O=I*C+T*_,w=E*C+b*_,X=T*_,M=b*_,F=0,Y=0|1/g-.5,B=0;B<Y;B++)L+=A,S+=N,A+=O,N+=w,w+=M,O+=X,(F+=Math.sqrt(A*A+N*N))>=x&&(t.lineTo(L,S),F=0);t.lineTo(p,u)}function h(t,e,i,s,l,h,a,p,u,d){u=u||n;var c=r(e,i,s,l)+r(s,l,h,a);d||(p=o(p,c));for(var f=(p=p||1/u.minSegLenFraction)*u.minSegLenFraction,y=1/u.numIterations,x=y*y,g=e-2*s+h,P=i-2*l+a,m=e,v=i,C=2*(s-e)*y+g*x,_=2*(l-i)*y+P*x,I=2*g*x,E=2*P*x,T=0,b=0|1/y-.5,L=0;L<b;L++)m+=C,v+=_,C+=I,_+=E,(T+=Math.sqrt(C*C+_*_))>=f&&(t.lineTo(m,v),T=0);t.lineTo(h,a)}function a(t,e,i,n,s,r,o,l,h,a){var p=a||{x:void 0,y:void 0};let u=1-t,d=u*u*u,c=3*u*u*t,f=3*u*t*t,y=t*t*t;return p.x=d*e+c*n+f*r+y*l,p.y=d*i+c*s+f*o+y*h,p}},8597:(t,e,i)=>{"use strict";i.r(e),i.d(e,{ComplexPolygon:()=>h});var n=i(6435),s=i.n(n),r=i(9318),o=i(1272),l=i(299);class h{constructor(t,e,i){this.pts=t,this.contours=[],this.customInsideChecker=e,this.bbox=i,this._tmpVec=i instanceof THREE.Box3?new THREE.Vector3:new THREE.Vector2}addContour(t){this.contours.push(t)}pointInContour(t,e,i){var n,s,r,o,l,h,a=!1,p=this.pts;r=p[i[i.length-1]].x,n=(o=p[i[i.length-1]].y)>=e;for(var u=0,d=i.length;u<d;++u)l=p[i[u]].x,n!=(s=(h=p[i[u]].y)>=e)&&(h-e)*(r-l)>=(l-t)*(o-h)==s&&(a=!a),n=s,r=l,o=h;return a}pointInPolygon(t,e){for(var i=!1,n=0;n<this.contours.length;n++)this.pointInContour(t,e,this.contours[n])&&(i=!i);return i}triangulate(t){try{this.triangulateInternal(!1,t)}catch(e){if(-1!==e.message.indexOf("Collinear not supported!"))try{this.triangulateInternal(!0,t)}catch(t){this.triangulationFailed=!0}else this.triangulationFailed=!0}}createPointInPolygonChecker(){let t=[];for(let i=0;i<this.contours.length;i++){let n=this.contours[i];var e=n.length;for(let i=0;i<e-1;i++){let e={p1:n[i],p2:n[i+1]};t.push(e)}}let i=new r.IntervalTree(this.pts,t,this.bbox);i.build(),this.customInsideChecker=i}triangulateInternal(t){const e={skipOpenContour:!1,...arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}};if(!this.contours.length)return this.triangulationFailed=!0,void(this.indices=null);this.indices=[];var i=function(t,e){let i=e.getSize(e instanceof THREE.Box3?new THREE.Vector3:new THREE.Vector2),n=e.min.x+.5*i.x,s=e.min.y+.5*i.y,r=2/i.length(),o=[];for(let e=0,i=t.length;e<i;e++)o.push({x:(t[e].x-n)*r,y:(t[e].y-s)*r,_triidx:e+1});return o}(this.pts,this.bbox);t&&function(t){for(let e=0,i=t.length;e<i;e++)t[e].x+=1e-9*(Math.random()-.5),t[e].y+=1e-9*(Math.random()-.5)}(i);var n=new(s().SweepContext)([]);n.points_=i;for(let t=0;t<this.contours.length;t++){let s=this.contours[t];var r=s[0]!==s[s.length-1];if(!r||!e.skipOpenContour){for(var o=r?s.length:s.length-1,l=new Array(o),h=0;h<o;h++)l[h]=i[s[h]];n.initEdges(l,r)}}n.triangulate(),this.processResult(n),this.triangulationFailed=!this.indices||!this.indices.length}processResult(t){this.pts.length>10&&!this.customInsideChecker&&this.createPointInPolygonChecker();let e=t.map_;for(var i=0;i<e.length;i++){var n=e[i].points_,s=n[0],r=n[1],o=n[2],l=s._triidx,h=r._triidx,a=o._triidx;l&&h&&a&&this.filterFace(l-1,h-1,a-1)}}filterFace(t,e,i){var n=this.pts[t],s=this.pts[e],r=this.pts[i],o=(n.x+s.x+r.x)/3,l=(n.y+s.y+r.y)/3;if(this.customInsideChecker?this.customInsideChecker.pointInPolygon(o,l):this.pointInPolygon(o,l)){var h=s.x-n.x,a=s.y-n.y,p=r.x-n.x;h*(r.y-n.y)-p*a>0?this.indices.push(t,e,i):this.indices.push(t,i,e)}}findSegmentIntersections(t,e,i,n){if(!this.cachedEdges){this.cachedEdges=[];for(let t=0;t<this.contours.length;t++){let e=this.contours[t];for(let t=0;t<e.length-1;t++){let i=this.pts[e[t]].x,n=this.pts[e[t]].y,s=this.pts[e[t+1]].x,r=this.pts[e[t+1]].y,o={v1:{x:i,y:n},v2:{x:s,y:r},dx:s-i,dy:r-n,length:Math.sqrt((i-s)**2+(n-r)**2)};this.cachedEdges.push(o)}}}let s={v1:{x:t,y:e},v2:{x:i,y:n},dx:i-t,dy:n-e,length:Math.sqrt((t-i)**2+(e-n)**2)},r=1e-4*this.bbox.getSize(this._tmpVec).length(),l=[];for(let i=0;i<this.cachedEdges.length;i++){let n=this.cachedEdges[i],h=(0,o.segmentsIntersect)(s,n,r);if(h&&h.status===o.ONE_INTERSECTION){let i={x:h.e1[0],y:h.e1[1]};i.d=Math.sqrt((i.x-t)**2+(i.y-e)**2),l.push(i)}}return l.length&&(l.sort(((t,e)=>t.d-e.d)),l[0].d<r&&l.shift(),l.length&&Math.abs(l[l.length-1].d-s.length)<r&&l.pop()),l.length?l:null}toPolygonMesh(t){if(this.polygonMesh)return this.polygonMesh;var e=this.pts,i=new THREE.BufferGeometry,n=new Float32Array(3*e.length);for(let t=0;t<e.length;t++)n[3*t]=e[t].x,n[3*t+1]=e[t].y,n[3*t+2]=0;i.setAttribute("position",new THREE.BufferAttribute(n,3));var s=t?new Uint16Array(2*e.length):new Float32Array(3*e.length);for(let i=0;i<e.length;i++)if(t){var r=.5*(0/Math.PI+1);s[2*i]=65535*r|0,s[2*i+1]=65535}else s[3*i]=0,s[3*i+1]=0,s[3*i+2]=1;i.setAttribute("normal",new THREE.BufferAttribute(s,t?2:3)),t&&(i.attributes.normal.bytesPerItem=2,i.attributes.normal.normalized=!0);var o=new Uint16Array(this.indices.length);return o.set(this.indices),i.setIndex(new THREE.BufferAttribute(o,1)),i.streamingDraw=!0,i.streamingIndex=!0,this.polygonMesh=i,i}toExtrudedMesh(t){if(this.extrudedMesh)return this.extrudedMesh;if(void 0===t&&(t=1),!this.indices)return null;let e=[],i=[],n=[],s=0,r=this.pts;for(let t=0;t<r.length;t++)e.push(r[t].x,r[t].y,0),e.push(0,0,1);let o=this.indices;for(let t=0;t<o.length;t+=3)i.push(o[t],o[t+1],o[t+2]);s+=r.length;for(let i=0;i<r.length;i++)e.push(r[i].x,r[i].y,-t),e.push(0,0,-1);for(let t=0;t<o.length;t+=3)i.push(s+o[t],s+o[t+2],s+o[t+1]);s+=r.length;let l=new THREE.Vector3,h=new THREE.Box3;for(let r=0;r<this.contours.length;r++){let o=this.contours[r];for(let r=0;r<o.length-1;r++){let a=this.pts[o[r]].x,p=this.pts[o[r]].y,u=0;l.set(a,p,u),h.expandByPoint(l);let d=this.pts[o[r+1]].x,c=this.pts[o[r+1]].y,f=0;l.set(d,c,f),h.expandByPoint(l),l.set(a,p,u-t),h.expandByPoint(l),l.set(c-p,a-d,0).normalize(),e.push(a,p,u,l.x,l.y,l.z,d,c,f,l.x,l.y,l.z,a,p,u-t,l.x,l.y,l.z,d,c,f-t,l.x,l.y,l.z),n.push(s,s+1,s,s+2,s+1,s+3,s+2,s+3),i.push(s,s+2,s+3,s,s+3,s+1),s+=4}}let a=new Float32Array(e.length);a.set(e);let p=new Uint16Array(i.length);p.set(i);let u=new Uint16Array(n.length);u.set(n);let d={mesh:{vb:a,indices:p,iblines:u,vbstride:6,vblayout:{position:{offset:0,itemSize:3,bytesPerItem:4},normal:{offset:3,itemSize:3,bytesPerItem:4}},boundingBox:h,boundingSphere:{center:h.getCenter(new THREE.Vector3),radius:.5*h.getSize(new THREE.Vector3).length}}};return this.extrudedMesh=Autodesk.Viewing.Private.BufferGeometryUtils.meshToGeometry(d),this.extrudedMesh.streamingDraw=!0,this.extrudedMesh.streamingIndex=!0,this.extrudedMesh}static FromClipperPaths(t,e,i){let n=new l.UniquePointList(e),s=new h(n.pts,null,e);for(let e of t){let t=[];for(let s=0;s<e.length;s++){let r=n.findOrAddPoint(e[s].X*i,e[s].Y*i);t.push(r.id)}t.push(t[0]),s.addContour(t)}return s}}},7201:(t,e,i)=>{"use strict";i.r(e),i.d(e,{ContourSet:()=>o,polygonArea:()=>s});var n=i(8597);function s(t){if(t.length<3)return 0;let e=!1;t[0]!==t[t.length-1]&&(e=!0);let i=0;for(let e=0,n=t.length-1;e<n;e++){let n=t[e],s=t[e+1];i+=n.x*s.y-s.x*n.y}if(e){let e=t[t.length-1],n=t[0];i+=e.x*n.y-n.x*e.y}return.5*i}let r=new THREE.Vector2;class o{constructor(){this.contours=[],this.areas=[],this.bbox=new THREE.Box2,this.allPoints=this.pts=[],this.allPointsMap={}}addContour(t,e){this.polygon=null,this.perimeterMem=void 0;let i=s(t);i<0&&(t.reverse(),i=Math.abs(i));let n=[];t.forEach(((t,e)=>{let i=t.id;void 0===i&&(i=this.contours.length+":"+e);let s=this.allPointsMap[i];void 0===s&&(s=this.allPoints.length,this.allPoints.push(t),this.allPointsMap[i]=s,r.set(t.x,t.y),this.bbox.expandByPoint(r)),n.push(s)})),0===i&&e||(this.contours.push(n),this.areas.push(i))}addContourSet(t){let e=t.contours[0],i=t.allPoints,n=e.map((t=>i[t]));this.addContour(n)}triangulate(t){if(this.polygon)return;let e=this.allPoints,i=new n.ComplexPolygon(e,t,this.bbox);i.contours=this.contours,i.triangulate(),this.polygon=i,this.triangulationFailed=this.polygon.triangulationFailed}area(){return this.areas[0]}areaNet(){let t=this.areas[0];for(let e=1;e<this.areas.length;e++)t-=this.areas[e];return t}perimeter(){if(this.perimeterMem)return this.perimeterMem;let t=0,e=this.contours[0];for(let i=0,n=e.length-1;i<n;i++){let n=e[i],s=e[i+1];t+=Math.sqrt((n.x-s.x)*(n.x-s.x)+(n.y-s.y)*(n.y-s.y))}return this.perimeterMem=t,t}getThemeColor(){return{r:100*this.areas[0]%17/16,g:this.allPoints.length%23/22,b:100*this.perimeterMem%29/28}}hash(){let t=[];return this.contours.forEach((e=>{let i=e.map((t=>this.allPoints[t].id));i[0]===i[i.length-1]&&i.pop(),i.sort(),t.push(i)})),JSON.stringify(t)}stitchContours(){this.areas=[];let t=[];for(var e=0;e<this.contours.length;e++){let i=this.contours[e];i[0]!==i[i.length-1]&&t.push(i)}if(!t.length)return;let i=!0;for(;i;){i=!1;let t={},e=this.contours;for(let i=0;i<e.length;i++){let n=e[i],s=n[0],r=n[n.length-1];s!==r&&(t[s]?t[s].push(-i-1):t[s]=[-i-1],t[r]?t[r].push(i):t[r]=[i])}for(let n in t){let s=t[n];if(2===s.length){let t;if(s[0]<0&&s[1]<0){let i=-s[0]-1,n=-s[1]-1;e[n].shift(),Array.prototype.push.apply(e[i].reverse(),e[n]),t=n}if(s[0]<0&&s[1]>0){let i=-s[0]-1,n=s[1];e[n].pop(),Array.prototype.push.apply(e[n],e[i]),t=i}if(s[0]>0&&s[1]<0){let i=s[0],n=-s[1]-1;e[i].pop(),Array.prototype.push.apply(e[i],e[n]),t=n}if(s[0]>0&&s[1]>0){let i=s[0],n=s[1];e[i].pop(),Array.prototype.push.apply(e[i],e[n].reverse()),t=n}void 0!==t&&(e.splice(t,1),i=!0);break}}}}containsPointFrom(t){if(!t.polygon.indices||t.polygon.indices.length<3)return!1;let e=t.allPoints[t.polygon.indices[0]],i=t.allPoints[t.polygon.indices[1]],n=t.allPoints[t.polygon.indices[2]],s=(e.x+i.x+n.x)/3,r=(e.y+i.y+n.y)/3;return this.polygon&&this.polygon.pointInPolygon(s,r)}toPolygonMesh(t){return this.polygon.toPolygonMesh(t)}toExtrudedMesh(t){return this.polygon.toExtrudedMesh(t)}}},4136:(t,e,i)=>{"use strict";i.r(e),i.d(e,{DCEL:()=>u});var n=i(1272),s=i(5229),r=i(7201),o=i(5420),l=i(299);const h=Autodesk.Viewing.Private.logger;class a{constructor(t,e){this.x=t,this.y=e,this.edges=[],this.dbIds=[],this.dbIdsChanged=!1}isDegenerate(){return this.edges.length<2}addEdge(t){for(let e=0;e<this.edges.length;e++){let i=this.edges[e];if(i.v1===t.v1&&i.v2===t.v2)return i}return this.edges.push(t),t}removeEdge(t){let e=this.edges.indexOf(t);e>=0?this.edges.splice(e,1):h.warn("Failed to find edge in vertex list")}findEdgeTo(t){for(let e=0;e<this.edges.length;e++){let i=this.edges[e];if(i.getOppositeVertex(this)===t)return i}return null}disconnect(){for(let t=0;t<this.edges.length;t++){let e=this.edges[t];e.getOppositeVertex(this).removeEdge(e)}let t=this.edges;return this.edges=[],t}sortEdges(){this.edges.sort(((t,e)=>{let i=t.angle;t.v1!==this&&(i-=Math.PI);let n=e.angle;return e.v1!==this&&(n-=Math.PI),i-n}))}_canTraverse(t){return t.v1!==this||t.flagFwd?t.v2===this&&!t.flagRev&&(t.flagRev=1,!0):(t.flagFwd=1,!0)}findUntraversedEdge(){for(let t=0;t<this.edges.length;t++){let e=this.edges[t];if(this._canTraverse(e))return e}return null}findNextCCWEdge(t){let e=this.edges.indexOf(t);if(-1===e)return h.error("This edge isn't mine."),null;if(this.isDegenerate())return null;let i=(e+1)%this.edges.length,n=this.edges[i];return this._canTraverse(n)?n:null}}class p{constructor(t,e,i){let n=!1;e.y<t.y?n=!0:e.y===t.y&&(n=e.x<t.x),n?(this.v1=e,this.v2=t):(this.v1=t,this.v2=e),this.dx=this.v2.x-this.v1.x,this.dy=this.v2.y-this.v1.y,this.length2=this.dx*this.dx+this.dy*this.dy,this.length=Math.sqrt(this.length2),this.angle=Math.atan2(this.dy,this.dx),this.angle<0&&((0,s.isZero)(this.angle)?this.angle=0:(0,s.isEqual)(this.angle,-Math.PI)&&(this.angle=Math.PI),this.angle<0&&h.warn("Unexpected edge slope <0 :",this.angle)),this.id=i,this.minx=Math.min(this.v1.x,this.v2.x),this.miny=Math.min(this.v1.y,this.v2.y),this.maxx=Math.max(this.v1.x,this.v2.x),this.maxy=Math.max(this.v1.y,this.v2.y),this.flagFwd=0,this.flagRev=0,this.dbIdsCached=null}paramAlong(t,e){return((t-this.v1.x)*this.dx+(e-this.v1.y)*this.dy)/this.length2}getOppositeVertex(t){return this.v1===t?this.v2:this.v2===t?this.v1:void h.warn("Edge does not own this vertex.")}getDbIds(){if(!this.v1.dbIdsChanged&&!this.v2.dbIdsChanged)return this.dbIdsCached;let t=[],e=this.v1.dbIds,i=this.v2.dbIds;for(let n=0;n<e.length;n++)-1!==i.indexOf(e[n])&&t.push(e[n]);return this.dbIdsCached=t,this.v1.dbIdsChanged=!1,this.v2.dbIdsChanged=!1,t}}class u{constructor(t,e){this.bbox=t,this.boxSize=this.bbox.getSize(new THREE.Vector3).length(),this.precisionTolerance="number"==typeof e?e:s.TOL*this.boxSize,this.edges=[],this.verts=new l.UniquePointList(this.bbox,this.precisionTolerance,a,!0),this.quadTreeEdges=new o.QuadTree(this.bbox.min.x,this.bbox.min.y,this.bbox.max.x,this.bbox.max.y,this.precisionTolerance),this.nextEdgeId=1}_addVertex(t,e,i){return this.verts.findOrAddPoint(t,e,i)}splitEdge(t,e){let i=[];i.push({x:t.v1.x,y:t.v1.y,u:0});let n=t.getDbIds();for(let n=0;n<e.length;n+=2){let r={x:e[n],y:e[n+1],u:t.paramAlong(e[n],e[n+1])};(0,s.isZero)(r.u)||(0,s.isEqual)(r.u,1)||i.push(r)}if(1!==i.length){i.push({x:t.v2.x,y:t.v2.y,u:1}),i.sort(((t,e)=>t.u-e.u)),this.removeDirectedEdge(t);for(let t=1;t<i.length;t++)this.addDirectedEdge(i[t-1].x,i[t-1].y,i[t].x,i[t].y,!0,n)}}_enumNearEdges(t,e){this.quadTreeEdges.enumNearItems(t,e)}addDirectedEdge(t,e,i,s,r,o){let l=this._addVertex(t,e,o),h=this._addVertex(i,s,o);if(l===h)return;if(l.findEdgeTo(h))return;let a=new p(l,h,this.nextEdgeId++),u=a.v1.addEdge(a);if(u!==a)return u;if(a.v2.addEdge(a),a.sourcePts=[t,e,i,s],this.edges[a.id]=a,this.quadTreeEdges.addItem(a),r)return u;let d=[],c={};this._enumNearEdges(a,(t=>{let e=(0,n.segmentsIntersect)(t,a,this.precisionTolerance);e&&(e.e1&&e.e1.length&&(c[t.id]=e.e1),e.e2&&e.e2.length&&d.push.apply(d,e.e2))}));for(let t in c)this.splitEdge(this.edges[parseInt(t)],c[t]);return d.length&&this.splitEdge(a,d),this.dirty=!0,u}removeDirectedEdge(t){t.v1.removeEdge(t),t.v2.removeEdge(t),this.edges[t.id]=void 0,this.quadTreeEdges.deleteItem(t)}removeDanglingPolyline(t){for(;1===t.edges.length;){let e=t.edges[0],i=e.getOppositeVertex(t);this.removeDirectedEdge(e),t=i}}cleanupFlatEdges(){let t=[];this.verts.forEach((e=>{if(!e)return;if(2!==e.edges.length)return;let i=e.edges[0],n=e.edges[1],s=Math.abs(i.angle-n.angle);(s<.002||Math.abs(s-Math.PI)<.002)&&t.push(e);let r=i.getOppositeVertex(e),o=n.getOppositeVertex(e);if(r.findEdgeTo(o)){.5*Math.abs(i.dx*n.dy-n.dx*i.dy)<.001&&t.push(e)}}));for(let e=0;e<t.length;e++){let i=t[e];if(2!==i.edges.length)continue;let n=i.edges[0],s=i.edges[1],r=n.getOppositeVertex(i),o=s.getOppositeVertex(i);this.removeDirectedEdge(n),this.removeDirectedEdge(s),this.verts.delete(i),this.addDirectedEdge(r.x,r.y,o.x,o.y,!0)}if(t.length)return this.cleanupFlatEdges()}_compactLists(){this.verts.compact();let t=[];for(let e=0,i=this.edges.length;e<i;e++){let i=this.edges[e];i&&(i.oldid=i.id,i.flagFwd=0,i.flagRev=0,i.id=t.length,t.push(i))}this.edges=t}_detectHolesNonZero(t){this.holes=[],this.outerPerimeter=this.closedAreas[this.closedAreas.length-1],this.outerPerimeter&&this.outerPerimeter.triangulate();for(let e=0,i=this.closedAreas.length-1;e<i;e++){let i=this.closedAreas[e];for(let t=e-1;t>=0;t--){let e=this.closedAreas[t];if(i.containsPointFrom(e)){if(!e.isHole){i.isHole=!0,this.holes.push(i);break}i.addContourSet(e)}}i.isHole||i.triangulate(t)}for(let e=0,i=this.holes.length;e<i;e++){let i=this.holes[e];i.triangulate(t);for(let t=e-1;t>=0;t--){let e=this.holes[t];e.holeProcessFlag||i.containsPointFrom(e)&&(i.addContourSet(e),i.isHole=!1,e.holeProcessFlag=!0)}i.isHole||i.triangulate(t)}let e=[];for(let t=0;t<this.closedAreas.length-1;t++){let i=this.closedAreas[t];i.isHole||(i.id=e.length,e.push(i))}this.closedAreas=e}_detectHolesEvenOdd(t){let e=this.closedAreas;if(this.openAreas&&this.openAreas.length&&(e=e.concat(this.openAreas)),!e.length)return this.closedAreas=[],void(this.openAreas=null);let i={};for(let t=0;t<e.length;t++){let n=e[t],s=n.hash();i[s]||(i[s]=n)}e=Object.values(i);let n=new r.ContourSet;for(let t=0;t<e.length;t++)n.addContourSet(e[t]);n.triangulate(t||this.quadTreeEdges),n.triangulationFailed?this._detectHolesNonZero(t||this.quadTreeEdges):(this.closedAreas=[n],this.openAreas=[])}finalize(t,e){this.cleanupFlatEdges(),this._compactLists(),this.verts.forEach((t=>t.sortEdges()));let i=[],n=[];this.verts.forEach((t=>{let e=t.findUntraversedEdge();if(!e)return;let s=[t],r=e.getOppositeVertex(t);do{if(s.push(r),e=r.findNextCCWEdge(e),!e)break;r=e.getOppositeVertex(r)}while(r&&r!==t);r===t?(s.push(t),i.push(s)):n.push(s)})),this.closedAreas=[];for(let t=0,e=i.length;t<e;t++){let e=new r.ContourSet;e.addContour(i[t]),this.closedAreas.push(e)}if(this.closedAreas.sort(((t,e)=>t.area()-e.area())),t?this._detectHolesEvenOdd(e):this._detectHolesNonZero(e),this.openAreas=[],n.length){let t=[],e=new r.ContourSet;for(let t=0,i=n.length;t<i;t++)e.addContour(n[t]);e.stitchContours(),e.triangulate(),t.push(e),this.openAreas=t}}deleteEdgesOnLine(t,e,i,s){let r=new a(t,e),o=new a(i,s),l=new p(r,o,-1),h={};this._enumNearEdges(l,(t=>{let e=(0,n.segmentsIntersect)(t,l,this.precisionTolerance);e&&e.e1&&e.e1.length&&(h[t.id]=e.e1)}));for(let t in h){let e=parseInt(t),i=this.edges[e];this.removeDirectedEdge(i),this.removeDanglingPolyline(i.v1),this.removeDanglingPolyline(i.v2)}this.dirty=!0}deleteEdgesInRectangle(t,e,i,n){let s=Math.min(t,i),r=Math.min(e,n),o=Math.max(t,i),l=Math.max(e,n),h={};this.quadTreeEdges.enumInBox(s,r,o,l,(t=>{h[t.id]=t}));for(let t in h){let e=parseInt(t),i=this.edges[e];i&&(this.removeDirectedEdge(i),this.removeDanglingPolyline(i.v1),this.removeDanglingPolyline(i.v2))}this.dirty=!0}findNearestVertex(t,e,i){"number"!=typeof i&&(i=this.precisionTolerance);let n=1/0,s=null;return this.verts.enumInBox(t-i,e-i,t+i,e+i,(i=>{let r=(i.x-t)*(i.x-t)+(i.y-e)*(i.y-e);r<n&&(n=r,s=i)})),n<=i*i?s:null}findNearestPointOnEdge(t,e,i){"number"!=typeof i&&(i=this.precisionTolerance);let s={x:0,y:0,u:0,d:-1},r={x:0,y:0,d:1/0,e:null};return this.quadTreeEdges.enumInBox(t-i,e-i,t+i,e+i,(o=>{(0,n.pointOnLine)(t,e,o,!0,i,s)&&s.d<r.d&&(r.x=s.x,r.y=s.y,r.d=s.d,r.e=o)})),r.d<=i?r:null}}},2302:(t,e,i)=>{"use strict";i.r(e),i.d(e,{EdgeSet:()=>d});var n,s=i(9318),r=i(299),o=i(8597);function l(t){return t[t.LMV_APP_NAMESPACE]=t[t.LMV_APP_NAMESPACE]||{}}function h(){const t="undefined"!=typeof window&&null!==window?window:"undefined"!=typeof self&&null!==self?self:i.g;return t.USE_LMV_APP_NAMESPACES?(t.globalProxy||(t.globalProxy=new Proxy({},{get(e,i){let n=t[i];return"function"==typeof n?function(t,e){return new Proxy(e,{get:(t,e)=>t[e],apply:(e,i,n)=>e.call(t||i,...n)})}(t,n):n},set:(e,i,n)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]!==n&&(t[i]=n):(l(t)[i]=n,Object.defineProperty(t,i,{get:()=>l(t)[i],set:e=>{l(t)[i]=e}})),!0)})),t.globalProxy):t}const a=h(),p=(a&&a.document,"undefined"!=typeof navigator);p&&navigator.userAgent.match(/Edge|Trident\/7\./),p&&navigator.userAgent.match(/Trident\/7\./);p&&(/ip(ad|hone|od)/.test(navigator.userAgent.toLowerCase())||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||/^ip(ad|hone|od)$/.test(null===(n=navigator.platform)||void 0===n?void 0:n.toLowerCase()));p&&navigator.userAgent.toLowerCase().indexOf("android");const u=h();class d{constructor(t,e,i){this.edges=t,this.bbox=e,this.verts=new r.UniquePointList(e,i),this.polygon=null}getPointIndex(t,e){return this.verts.findOrAddPoint(t,e).id}snapEdges(){for(var t=0;t<this.edges.length;t++){var e=this.edges[t];e.p1=this.getPointIndex(e.v1.x,e.v1.y),e.p2=this.getPointIndex(e.v2.x,e.v2.y)}}sanitizeEdges(){for(var t={},e=[],i=0,n=this.edges.length;i<n;i++){var s=this.edges[i];if(s.p1!==s.p2){var r=Math.min(s.p1,s.p2)+":"+Math.max(s.p1,s.p2);!0!==t[r]&&(t[r]=!0,e.push(s))}}this.edges=e}stitchContours(){this.contours=[];for(var t={},e=0;e<this.edges.length;e++){var i=this.edges[e];i.p1!==i.p2&&(void 0!==t[i.p1]?t[i.p1].push(i.p2):t[i.p1]=[i.p2],void 0!==t[i.p2]?t[i.p2].push(i.p1):t[i.p2]=[i.p1])}var n=[];for(var s in t)if(2!==t[s].length){var r;null===(r=u.Autodesk)||void 0===r||r.Viewing.Private.logger.warn("Incomplete edge table");break}for(;;){var o=void 0;for(let e in t)if(t[e].length>1){o=e;break}if(!o)for(let e in t)if(t[e].length>0){o=e;break}if(!o)break;var l=-1,h=parseInt(o),a=t[o];for(n.push(h);a&&a.length;){var p=a.shift();if(p===l&&(p=a.shift()),void 0===p){delete t[h];break}n.push(p),(0==a.length||a[0]===l)&&delete t[h],l=h,h=p,a=t[p]}n.length&&(this.contours.push(n),n=[])}var d=[];for(let t=0;t<this.contours.length;t++){var c=this.contours[t];c[0]!==c[c.length-1]&&d.push(c)}if(d.length)for(var f=!0;f;){f=!1;var y={},x=this.contours;for(let t=0;t<x.length;t++){const e=x[t];var g=e[0],P=e[e.length-1];g!==P&&(y[g]?y[g].push(-t-1):y[g]=[-t-1],y[P]?y[P].push(t):y[P]=[t])}for(let t in y){var m=y[t];if(2==m.length){var v=void 0;if(m[0]<0&&m[1]<0){var C=-m[0]-1,_=-m[1]-1;x[_].shift(),Array.prototype.push.apply(x[C].reverse(),x[_]),v=_}if(m[0]<0&&m[1]>0){const t=-m[0]-1,e=m[1];x[e].pop(),Array.prototype.push.apply(x[e],x[t]),v=t}if(m[0]>0&&m[1]<0){const t=m[0],e=-m[1]-1;x[t].pop(),Array.prototype.push.apply(x[t],x[e]),v=e}if(m[0]>0&&m[1]>0){const t=m[0],e=m[1];x[t].pop(),Array.prototype.push.apply(x[t],x[e].reverse()),v=e}void 0!==v&&(x.splice(v,1),f=!0);break}}}}cleanupFlatEdges(){let t=this.verts.pts,e=this.verts.precisionTolerance;for(let i=0;i<this.contours.length;i++){let n=this.contours[i];for(;;){let i=-1;for(let s=1;s<n.length-1;s++){let r=n[s-1],o=n[s],l=n[s+1],h=t[r],a=t[o],p=t[l],u=a.x-h.x,d=a.y-h.y,c=p.x-a.x,f=p.y-a.y,y=Math.sqrt(u*u+d*d);if(y<e){i=s;break}let x=Math.sqrt(c*c+f*f);if(x<e){i=s;break}u/=y,d/=y,c/=x,f/=x;let g=u*c+d*f;if(Math.abs(g-1)<.01){i=s;break}}if(i<0)break;n.splice(i,1)}}}triangulate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=new s.IntervalTree(this.verts.pts,this.edges,this.bbox);e.build();let i=new o.ComplexPolygon(this.verts.pts,e,this.bbox);return i.contours=this.contours,i.triangulate(t),i}}},2324:(t,e,i)=>{"use strict";i.r(e),i.d(e,{EllipseArc:()=>u,angleInsideArc:()=>h,angleInsideArcCCW:()=>l,getAngleDelta:()=>o,getEllipseArcPoint:()=>s,getEllipsePoint:()=>n,normalizeAngle:()=>r});const n=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const o=(arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)||new THREE.Vector2;let l=e+n*Math.cos(t),h=i+s*Math.sin(t);if(0!==r){const t=Math.cos(r),n=Math.sin(r),s=l-e,o=h-i;l=s*t-o*n+e,h=s*n+o*t+i}return o.set(l,h)},s=function(t,e,i,s,o,l,h){let a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,u=h-l;if(Math.abs(u)<Number.EPSILON)return n(0,e,i,s,o,a,p);u=r(u);u<Number.EPSILON&&(u=2*Math.PI);return n(l+t*u,e,i,s,o,a,p)},r=t=>(t/=2*Math.PI,(t-=Math.trunc(t))<0&&(t+=1),2*t*Math.PI),o=(t,e,i)=>{let n=e-t;return n=r(n),i?n:2*Math.PI-n},l=(t,e,i)=>(t=r(t),(e=r(e))<(i=r(i))?t>=e&&t<=i:t>=e||t<=i),h=function(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=l(t,e,i);return n?s:!s},a=(t,e,i,n)=>{var s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n),o=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(o=-o),o},p=new THREE.Vector2;class u{constructor(t,e,i,n,s,r,o,l){this.set(t,e,i,n,s,r,o,l)}set(t,e,i,n,s,r,o,l){return this.cx=t,this.cy=e,this.rx=i,this.ry=n,this.startAngle=r,this.endAngle=o,this.ccw=l,this.rotation=s,this}setFromSvgArc(t,e,i,n,s,r,o){const l=i*Math.PI/180;if(t=Math.abs(t),e=Math.abs(e),0==t||0==e){const i=.01,n=360*p.copy(r).distanceTo(o)/i/(2*Math.PI);t=n,e=n}const h=(r.x-o.x)/2,u=(r.y-o.y)/2,d=Math.cos(l)*h+Math.sin(l)*u,c=-Math.sin(l)*h+Math.cos(l)*u;let f=t*t,y=e*e;const x=d*d,g=c*c,P=x/f+g/y;if(P>1){const i=Math.sqrt(P);f=(t*=i)*t,y=(e*=i)*e}const m=f*g+y*x,v=(f*y-m)/m;let C=Math.sqrt(Math.max(0,v));n===s&&(C=-C);const _=C*t*c/e,I=-C*e*d/t,E=Math.cos(l)*_-Math.sin(l)*I+(r.x+o.x)/2,T=Math.sin(l)*_+Math.cos(l)*I+(r.y+o.y)/2,b=a(1,0,(d-_)/t,(c-I)/e),L=a((d-_)/t,(c-I)/e,(-d-_)/t,(-c-I)/e)%(2*Math.PI);return this.cx=E,this.cy=T,this.rx=t,this.ry=e,this.rotation=l,this.startAngle=b,this.endAngle=b+L,this.ccw=s,this}getPoint(t,e){let i=this.startAngle,n=this.endAngle;return this.ccw||(i=this.endAngle,n=this.startAngle,t=1-t),s(t,this.cx,this.cy,this.rx,this.ry,i,n,this.rotation,e)}isValid(){return isFinite(this.cx)&&isFinite(this.cy)&&isFinite(this.rx)&&isFinite(this.ry)&&isFinite(this.rotation)&&isFinite(this.startAngle)&&isFinite(this.endAngle)}computeBBox(t){const e=Math.tan(this.rotation),i=-Math.atan(this.ry*e/this.rx),s=Math.PI-Math.atan(this.ry*e/this.rx),r=Math.atan(this.ry/(e*this.rx)),o=Math.PI+Math.atan(this.ry/(e*this.rx)),l=t?t.makeEmpty():new THREE.Box2,a=t=>{const e=n(t,this.cx,this.cy,this.rx,this.ry,this.rotation);l.expandByPoint(e)};return a(this.startAngle),a(this.endAngle),h(i,this.startAngle,this.endAngle,this.ccw)&&a(i),h(s,this.startAngle,this.endAngle,this.ccw)&&a(s),h(r,this.startAngle,this.endAngle,this.ccw)&&a(r),h(o,this.startAngle,this.endAngle,this.ccw)&&a(o),l}tesselate(t,e,i){const n=this.getPoint(0);for(var s=1;s<e;s++){const r=s/e,o=this.getPoint(r,p);o.distanceTo(n)<i||(t.lineTo(o.x,o.y),n.copy(o))}const r=this.getPoint(1,p);t.lineTo(r.x,r.y)}getAngleDelta(){return o(this.startAngle,this.endAngle,this.ccw)}}},5229:(t,e,i)=>{"use strict";i.r(e),i.d(e,{TOL:()=>n,isEqual:()=>r,isZero:()=>s});const n=1e-6;function s(t){return Math.abs(t)<n}function r(t,e){return s(t-e)}},6082:(t,e,i)=>{var n=Autodesk.Viewing,s=AutodeskNamespace("Autodesk.Viewing.Extensions.CompGeom");function r(e,i){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t.exports[n]=e[n],i[n]=e[n])}r(i(7201),s),r(i(2302),s),r(i(4136),s),r(i(5229),s),r(i(5420),s),r(i(2554),s),r(i(3965),s),r(i(2601),s),r(i(1272),s),r(i(6353),s),r(i(8189),s),r(i(908),s),r(i(9318),s),r(i(8597),s),r(i(299),s),r(i(6435),s),r(i(2324),s),r(i(8831),s),r(i(6986),s),r(i(8917),s);class o extends n.Extension{constructor(t,e){super(t,e)}load(){return!0}unload(){return!0}activate(){return!0}deactivate(){return!1}}n.theExtensionManager.registerExtension("Autodesk.CompGeom",o)},9318:(t,e,i)=>{"use strict";function n(){this.bbox=new THREE.Box2,this.left=null,this.right=null,this.node_edges=[]}function s(t,e,i){this.pts=t,this.edges=e,this.bbox=i,this.pipResult=!1}i.r(e),i.d(e,{IntervalTree:()=>s}),s.prototype.splitNode=function(t){if(!(t.bbox.min.y>=t.bbox.max.y||t.node_edges.length<3)){var e=.5*(t.bbox.min.y+t.bbox.max.y);t.left=new n,t.right=new n;for(var i=this.pts,s=t.node_edges,r=[],o=new THREE.Vector2,l=0;l<s.length;l++){var h=this.edges[s[l]],a=i[h.p1].y,p=i[h.p2].y;if(a>p){var u=a;a=p,p=u}var d=null;p<e?(t.left.node_edges.push(s[l]),d=t.left.bbox):a>e?(t.right.node_edges.push(s[l]),d=t.right.bbox):r.push(s[l]),d&&(o.set(i[h.p1].x,i[h.p1].y),d.expandByPoint(o),o.set(i[h.p2].x,i[h.p2].y),d.expandByPoint(o))}t.node_edges=r,t.left.node_edges.length&&this.splitNode(t.left),t.right.node_edges.length&&this.splitNode(t.right)}},s.prototype.build=function(){this.root=new n;for(var t=this.root.node_edges,e=0;e<this.edges.length;e++)t.push(e);this.root.bbox.copy(this.bbox),this.splitNode(this.root)},s.prototype.pointInPolygonRec=function(t,e,i){if(t.bbox.min.y<=i&&t.bbox.max.y>=i)for(var n=this.pts,s=t.node_edges,r=0,o=s.length;r<o;r++){var l=this.edges[s[r]],h=n[l.p1],a=h.x,p=h.y,u=p>=i,d=n[l.p2],c=d.x,f=d.y,y=f>=i;u!=y&&(f-i)*(a-c)>=(c-e)*(p-f)==y&&(this.pipResult=!this.pipResult)}var x=t.left;x&&x.bbox.min.y<=i&&x.bbox.max.y>=i&&this.pointInPolygonRec(x,e,i);var g=t.right;g&&g.bbox.min.y<=i&&g.bbox.max.y>=i&&this.pointInPolygonRec(g,e,i)},s.prototype.pointInPolygon=function(t,e){return this.pipResult=!1,this.pointInPolygonRec(this.root,t,e),this.pipResult}},2641:t=>{!function(){"use strict";var e={version:"6.4.2.2",use_lines:!0,use_xyz:!1},i=!1;if(t.exports?(t.exports=e,i=!0):"undefined"!=typeof document?window.ClipperLib=e:self.ClipperLib=e,i){n="chrome";"Netscape"}else{var n=navigator.userAgent.toString().toLowerCase();navigator.appName}var s={};-1!=n.indexOf("chrome")&&-1==n.indexOf("chromium")?s.chrome=1:s.chrome=0,-1!=n.indexOf("chromium")?s.chromium=1:s.chromium=0,-1!=n.indexOf("safari")&&-1==n.indexOf("chrome")&&-1==n.indexOf("chromium")?s.safari=1:s.safari=0,-1!=n.indexOf("firefox")?s.firefox=1:s.firefox=0,-1!=n.indexOf("firefox/17")?s.firefox17=1:s.firefox17=0,-1!=n.indexOf("firefox/15")?s.firefox15=1:s.firefox15=0,-1!=n.indexOf("firefox/3")?s.firefox3=1:s.firefox3=0,-1!=n.indexOf("opera")?s.opera=1:s.opera=0,-1!=n.indexOf("msie 10")?s.msie10=1:s.msie10=0,-1!=n.indexOf("msie 9")?s.msie9=1:s.msie9=0,-1!=n.indexOf("msie 8")?s.msie8=1:s.msie8=0,-1!=n.indexOf("msie 7")?s.msie7=1:s.msie7=0,-1!=n.indexOf("msie ")?s.msie=1:s.msie=0;var r=function(t,e){var i;if(void 0===Object.getOwnPropertyNames){for(i in e.prototype)void 0!==t.prototype[i]&&t.prototype[i]!==Object.prototype[i]||(t.prototype[i]=e.prototype[i]);for(i in e)void 0===t[i]&&(t[i]=e[i]);t.$baseCtor=e}else{for(var n=Object.getOwnPropertyNames(e.prototype),s=0;s<n.length;s++)void 0===Object.getOwnPropertyDescriptor(t.prototype,n[s])&&Object.defineProperty(t.prototype,n[s],Object.getOwnPropertyDescriptor(e.prototype,n[s]));for(i in e)void 0===t[i]&&(t[i]=e[i]);t.$baseCtor=e}};e.Path=function(){return[]},e.Path.prototype.push=Array.prototype.push,e.Paths=function(){return[]},e.Paths.prototype.push=Array.prototype.push,e.PolyNode=function(){this.m_Parent=null,this.m_polygon=new e.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},e.PolyNode.prototype.IsHoleNode=function(){for(var t=!0,e=this.m_Parent;null!==e;)t=!t,e=e.m_Parent;return t},e.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},e.PolyNode.prototype.Contour=function(){return this.m_polygon},e.PolyNode.prototype.AddChild=function(t){var e=this.m_Childs.length;this.m_Childs.push(t),t.m_Parent=this,t.m_Index=e},e.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},e.PolyNode.prototype.GetNextSiblingUp=function(){return null===this.m_Parent?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},e.PolyNode.prototype.Childs=function(){return this.m_Childs},e.PolyNode.prototype.Parent=function(){return this.m_Parent},e.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},e.PolyTree=function(){this.m_AllPolys=[],e.PolyNode.call(this)},e.PolyTree.prototype.Clear=function(){for(var t=0,e=this.m_AllPolys.length;t<e;t++)this.m_AllPolys[t]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},e.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},e.PolyTree.prototype.Total=function(){var t=this.m_AllPolys.length;return t>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&t--,t},r(e.PolyTree,e.PolyNode),e.Clear=function(t){t.length=0},e.PI=3.141592653589793,e.PI2=6.283185307179586,e.FPoint=function(){var t=arguments,i=t.length;if(this.X=0,this.Y=0,e.use_xyz)if(this.Z=0,3===i)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(2===i)this.X=t[0],this.Y=t[1],this.Z=0;else if(1===i)if(t[0]instanceof e.FPoint){var n=t[0];this.X=n.X,this.Y=n.Y,this.Z=0}else{void 0===(s=t[0]).Z&&(s.Z=0),this.X=s.X,this.Y=s.Y,this.Z=s.Z}else this.X=0,this.Y=0,this.Z=0;else if(2===i)this.X=t[0],this.Y=t[1];else if(1===i)if(t[0]instanceof e.FPoint){n=t[0];this.X=n.X,this.Y=n.Y}else{var s=t[0];this.X=s.X,this.Y=s.Y}else this.X=0,this.Y=0},e.FPoint.op_Equality=function(t,e){return t.X===e.X&&t.Y===e.Y},e.FPoint.op_Inequality=function(t,e){return t.X!==e.X||t.Y!==e.Y},e.FPoint0=function(){this.X=0,this.Y=0,e.use_xyz&&(this.Z=0)},e.FPoint0.prototype=e.FPoint.prototype,e.FPoint1=function(t){this.X=t.X,this.Y=t.Y,e.use_xyz&&(void 0===t.Z?this.Z=0:this.Z=t.Z)},e.FPoint1.prototype=e.FPoint.prototype,e.FPoint1dp=function(t){this.X=t.X,this.Y=t.Y,e.use_xyz&&(this.Z=0)},e.FPoint1dp.prototype=e.FPoint.prototype,e.FPoint2=function(t,i,n){this.X=t,this.Y=i,e.use_xyz&&(this.Z=void 0===n?0:n)},e.FPoint2.prototype=e.FPoint.prototype,e.FRect=function(){var t=arguments,e=t.length;if(4===e)this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3];else if(1===e){var i=t[0];this.left=i.left,this.top=i.top,this.right=i.right,this.bottom=i.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},e.FRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},e.FRect0.prototype=e.FRect.prototype,e.FRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom},e.FRect1.prototype=e.FRect.prototype,e.FRect4=function(t,e,i,n){this.left=t,this.top=e,this.right=i,this.bottom=n},e.FRect4.prototype=e.FRect.prototype,e.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},e.PolyType={ptSubject:0,ptClip:1},e.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},e.JoinType={jtSquare:0,jtRound:1,jtMiter:2},e.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},e.EdgeSide={esLeft:0,esRight:1},e.Direction={dRightToLeft:0,dLeftToRight:1},e.TEdge=function(){this.Bot=new e.FPoint0,this.Curr=new e.FPoint0,this.Top=new e.FPoint0,this.Delta=new e.FPoint0,this.Dx=0,this.PolyTyp=e.PolyType.ptSubject,this.Side=e.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},e.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new e.FPoint0},e.MyIntersectNodeSort=function(){},e.MyIntersectNodeSort.Compare=function(t,e){var i=e.Pt.Y-t.Pt.Y;return i>0?1:i<0?-1:0},e.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},e.Scanbeam=function(){this.Y=0,this.Next=null},e.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},e.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},e.OutPt=function(){this.Idx=0,this.Pt=new e.FPoint0,this.Next=null,this.Prev=null},e.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new e.FPoint0},e.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},e.ClipperBase.horizontal=-34e37,e.ClipperBase.Skip=-2,e.ClipperBase.Unassigned=-1,e.ClipperBase.tolerance=1e-20,e.ClipperBase.maxValue=Math.sqrt(Number.MAX_VALUE),e.ClipperBase.minValue=Math.sqrt(Number.MIN_VALUE),e.ClipperBase.near_zero=function(t){return t>-e.ClipperBase.tolerance&&t<e.ClipperBase.tolerance},e.ClipperBase.IsHorizontal=function(t){return 0===t.Delta.Y},e.ClipperBase.prototype.PointIsVertex=function(t,i){var n=i;do{if(e.FPoint.op_Equality(n.Pt,t))return!0;n=n.Next}while(n!==i);return!1},e.ClipperBase.prototype.PointOnLineSegment=function(t,e,i){return t.X===e.X&&t.Y===e.Y||t.X===i.X&&t.Y===i.Y||t.X>e.X==t.X<i.X&&t.Y>e.Y==t.Y<i.Y&&(t.X-e.X)*(i.Y-e.Y)==(i.X-e.X)*(t.Y-e.Y)},e.ClipperBase.prototype.PointOnPolygon=function(t,e){for(var i=e;;){if(this.PointOnLineSegment(t,i.Pt,i.Next.Pt))return!0;if((i=i.Next)===e)break}return!1},e.ClipperBase.prototype.SlopesEqual=e.ClipperBase.SlopesEqual=function(){var t,e,i,n,s,r,o=arguments,l=o.length;return 2===l?(e=o[1],(t=o[0]).Delta.Y*e.Delta.X==t.Delta.X*e.Delta.Y):3===l?(n=o[1],s=o[2],((i=o[0]).Y-n.Y)*(n.X-s.X)-(i.X-n.X)*(n.Y-s.Y)==0):(n=o[1],s=o[2],r=o[3],((i=o[0]).Y-n.Y)*(s.X-r.X)-(i.X-n.X)*(s.Y-r.Y)==0)},e.ClipperBase.SlopesEqual3=function(t,e){return t.Delta.Y*e.Delta.X==t.Delta.X*e.Delta.Y},e.ClipperBase.SlopesEqual4=function(t,e,i){return(t.Y-e.Y)*(e.X-i.X)-(t.X-e.X)*(e.Y-i.Y)==0},e.ClipperBase.SlopesEqual5=function(t,e,i,n){return(t.Y-e.Y)*(i.X-n.X)-(t.X-e.X)*(i.Y-n.Y)==0},e.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var t=0,i=this.m_edges.length;t<i;++t){for(var n=0,s=this.m_edges[t].length;n<s;++n)this.m_edges[t][n]=null;e.Clear(this.m_edges[t])}e.Clear(this.m_edges),this.m_HasOpenPaths=!1},e.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;null!==this.m_MinimaList;){var t=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=t}this.m_CurrentLM=null},e.ClipperBase.prototype.RangeTest=function(t){(t.X>e.ClipperBase.maxValue||t.X<-e.ClipperBase.maxValue||t.Y>e.ClipperBase.maxValue||t.Y<-e.ClipperBase.maxValue||t.X>0&&t.X<e.ClipperBase.minValue||t.Y>0&&t.Y<e.ClipperBase.minValue||t.X<0&&t.X>-e.ClipperBase.minValue||t.Y<0&&t.Y>-e.ClipperBase.minValue)&&e.Error("Coordinate outside allowed range in RangeTest().")},e.ClipperBase.prototype.InitEdge=function(t,i,n,s){t.Next=i,t.Prev=n,t.Curr.X=s.X,t.Curr.Y=s.Y,e.use_xyz&&(t.Curr.Z=s.Z),t.OutIdx=-1},e.ClipperBase.prototype.InitEdge2=function(t,i){t.Curr.Y>=t.Next.Curr.Y?(t.Bot.X=t.Curr.X,t.Bot.Y=t.Curr.Y,e.use_xyz&&(t.Bot.Z=t.Curr.Z),t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y,e.use_xyz&&(t.Top.Z=t.Next.Curr.Z)):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,e.use_xyz&&(t.Top.Z=t.Curr.Z),t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y,e.use_xyz&&(t.Bot.Z=t.Next.Curr.Z)),this.SetDx(t),t.PolyTyp=i},e.ClipperBase.prototype.FindNextLocMin=function(t){for(var i;;){for(;e.FPoint.op_Inequality(t.Bot,t.Prev.Bot)||e.FPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!==e.ClipperBase.horizontal&&t.Prev.Dx!==e.ClipperBase.horizontal)break;for(;t.Prev.Dx===e.ClipperBase.horizontal;)t=t.Prev;for(i=t;t.Dx===e.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!==t.Prev.Bot.Y){i.Prev.Bot.X<t.Bot.X&&(t=i);break}}return t},e.ClipperBase.prototype.ProcessBound=function(t,i){var n,s,r=t;if(r.OutIdx===e.ClipperBase.Skip){if(t=r,i){for(;t.Top.Y===t.Next.Bot.Y;)t=t.Next;for(;t!==r&&t.Dx===e.ClipperBase.horizontal;)t=t.Prev}else{for(;t.Top.Y===t.Prev.Bot.Y;)t=t.Prev;for(;t!==r&&t.Dx===e.ClipperBase.horizontal;)t=t.Next}if(t===r)r=i?t.Next:t.Prev;else{t=i?r.Next:r.Prev;var o=new e.LocalMinima;o.Next=null,o.Y=t.Bot.Y,o.LeftBound=null,o.RightBound=t,t.WindDelta=0,r=this.ProcessBound(t,i),this.InsertLocalMinima(o)}return r}if(t.Dx===e.ClipperBase.horizontal&&((n=i?t.Prev:t.Next).Dx===e.ClipperBase.horizontal?n.Bot.X!==t.Bot.X&&n.Top.X!==t.Bot.X&&this.ReverseHorizontal(t):n.Bot.X!==t.Bot.X&&this.ReverseHorizontal(t)),n=t,i){for(;r.Top.Y===r.Next.Bot.Y&&r.Next.OutIdx!==e.ClipperBase.Skip;)r=r.Next;if(r.Dx===e.ClipperBase.horizontal&&r.Next.OutIdx!==e.ClipperBase.Skip){for(s=r;s.Prev.Dx===e.ClipperBase.horizontal;)s=s.Prev;s.Prev.Top.X>r.Next.Top.X&&(r=s.Prev)}for(;t!==r;)t.NextInLML=t.Next,t.Dx===e.ClipperBase.horizontal&&t!==n&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),t=t.Next;t.Dx===e.ClipperBase.horizontal&&t!==n&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),r=r.Next}else{for(;r.Top.Y===r.Prev.Bot.Y&&r.Prev.OutIdx!==e.ClipperBase.Skip;)r=r.Prev;if(r.Dx===e.ClipperBase.horizontal&&r.Prev.OutIdx!==e.ClipperBase.Skip){for(s=r;s.Next.Dx===e.ClipperBase.horizontal;)s=s.Next;(s.Next.Top.X===r.Prev.Top.X||s.Next.Top.X>r.Prev.Top.X)&&(r=s.Next)}for(;t!==r;)t.NextInLML=t.Prev,t.Dx===e.ClipperBase.horizontal&&t!==n&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),t=t.Prev;t.Dx===e.ClipperBase.horizontal&&t!==n&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),r=r.Prev}return r},e.ClipperBase.prototype.AddPath=function(t,i,n){e.use_lines?n||i!==e.PolyType.ptClip||e.Error("AddPath: Open paths must be subject."):n||e.Error("AddPath: Open paths have been disabled.");var s=t.length-1;if(n)for(;s>0&&e.FPoint.op_Equality(t[s],t[0]);)--s;for(;s>0&&e.FPoint.op_Equality(t[s],t[s-1]);)--s;if(n&&s<2||!n&&s<1)return!1;for(var r=new Array,o=0;o<=s;o++)r.push(new e.TEdge);var l=!0;r[1].Curr.X=t[1].X,r[1].Curr.Y=t[1].Y,e.use_xyz&&(r[1].Curr.Z=t[1].Z),this.RangeTest(t[0]),this.RangeTest(t[s]),this.InitEdge(r[0],r[1],r[s],t[0]),this.InitEdge(r[s],r[0],r[s-1],t[s]);for(o=s-1;o>=1;--o)this.RangeTest(t[o]),this.InitEdge(r[o],r[o+1],r[o-1],t[o]);for(var h,a=r[0],p=a,u=a;;)if(p.Curr!==p.Next.Curr||!n&&p.Next===a){if(p.Prev===p.Next)break;if(!n||!e.ClipperBase.SlopesEqual4(p.Prev.Curr,p.Curr,p.Next.Curr)||this.PreserveCollinear&&this.Pt2IsBetweenPt1AndPt3(p.Prev.Curr,p.Curr,p.Next.Curr)){if((p=p.Next)===u||!n&&p.Next===a)break}else p===a&&(a=p.Next),u=p=(p=this.RemoveEdge(p)).Prev}else{if(p===p.Next)break;p===a&&(a=p.Next),u=p=this.RemoveEdge(p)}if(!n&&p===p.Next||n&&p.Prev===p.Next)return!1;n||(this.m_HasOpenPaths=!0,a.Prev.OutIdx=e.ClipperBase.Skip),p=a;do{this.InitEdge2(p,i),p=p.Next,l&&p.Curr.Y!==a.Curr.Y&&(l=!1)}while(p!==a);if(l){if(n)return!1;for(p.Prev.OutIdx=e.ClipperBase.Skip,(c=new e.LocalMinima).Next=null,c.Y=p.Bot.Y,c.LeftBound=null,c.RightBound=p,c.RightBound.Side=e.EdgeSide.esRight,c.RightBound.WindDelta=0;p.Bot.X!==p.Prev.Top.X&&this.ReverseHorizontal(p),p.Next.OutIdx!==e.ClipperBase.Skip;)p.NextInLML=p.Next,p=p.Next;return this.InsertLocalMinima(c),this.m_edges.push(r),!0}this.m_edges.push(r);var d=null;for(e.FPoint.op_Equality(p.Prev.Bot,p.Prev.Top)&&(p=p.Next);(p=this.FindNextLocMin(p))!==d;){var c;null===d&&(d=p),(c=new e.LocalMinima).Next=null,c.Y=p.Bot.Y,p.Dx<p.Prev.Dx?(c.LeftBound=p.Prev,c.RightBound=p,h=!1):(c.LeftBound=p,c.RightBound=p.Prev,h=!0),c.LeftBound.Side=e.EdgeSide.esLeft,c.RightBound.Side=e.EdgeSide.esRight,n?c.LeftBound.Next===c.RightBound?c.LeftBound.WindDelta=-1:c.LeftBound.WindDelta=1:c.LeftBound.WindDelta=0,c.RightBound.WindDelta=-c.LeftBound.WindDelta,(p=this.ProcessBound(c.LeftBound,h)).OutIdx===e.ClipperBase.Skip&&(p=this.ProcessBound(p,h));var f=this.ProcessBound(c.RightBound,!h);f.OutIdx===e.ClipperBase.Skip&&(f=this.ProcessBound(f,!h)),c.LeftBound.OutIdx===e.ClipperBase.Skip?c.LeftBound=null:c.RightBound.OutIdx===e.ClipperBase.Skip&&(c.RightBound=null),this.InsertLocalMinima(c),h||(p=f)}return!0},e.ClipperBase.prototype.AddPaths=function(t,e,i){for(var n=!1,s=0,r=t.length;s<r;++s)this.AddPath(t[s],e,i)&&(n=!0);return n},e.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(t,i,n){return!(e.FPoint.op_Equality(t,n)||e.FPoint.op_Equality(t,i)||e.FPoint.op_Equality(n,i))&&(t.X!==n.X?i.X>t.X==i.X<n.X:i.Y>t.Y==i.Y<n.Y)},e.ClipperBase.prototype.RemoveEdge=function(t){t.Prev.Next=t.Next,t.Next.Prev=t.Prev;var e=t.Next;return t.Prev=null,e},e.ClipperBase.prototype.SetDx=function(t){t.Delta.X=t.Top.X-t.Bot.X,t.Delta.Y=t.Top.Y-t.Bot.Y,0===t.Delta.Y?t.Dx=e.ClipperBase.horizontal:t.Dx=t.Delta.X/t.Delta.Y},e.ClipperBase.prototype.InsertLocalMinima=function(t){if(null===this.m_MinimaList)this.m_MinimaList=t;else if(t.Y>=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var e=this.m_MinimaList;null!==e.Next&&t.Y<e.Next.Y;)e=e.Next;t.Next=e.Next,e.Next=t}},e.ClipperBase.prototype.PopLocalMinima=function(t,e){return e.v=this.m_CurrentLM,null!==this.m_CurrentLM&&this.m_CurrentLM.Y===t&&(this.m_CurrentLM=this.m_CurrentLM.Next,!0)},e.ClipperBase.prototype.ReverseHorizontal=function(t){var i=t.Top.X;t.Top.X=t.Bot.X,t.Bot.X=i,e.use_xyz&&(i=t.Top.Z,t.Top.Z=t.Bot.Z,t.Bot.Z=i)},e.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,null!==this.m_CurrentLM){this.m_Scanbeam=null;for(var t=this.m_MinimaList;null!==t;){this.InsertScanbeam(t.Y);var i=t.LeftBound;null!==i&&(i.Curr.X=i.Bot.X,i.Curr.Y=i.Bot.Y,e.use_xyz&&(i.Curr.Z=i.Bot.Z),i.OutIdx=e.ClipperBase.Unassigned),null!==(i=t.RightBound)&&(i.Curr.X=i.Bot.X,i.Curr.Y=i.Bot.Y,e.use_xyz&&(i.Curr.Z=i.Bot.Z),i.OutIdx=e.ClipperBase.Unassigned),t=t.Next}this.m_ActiveEdges=null}},e.ClipperBase.prototype.InsertScanbeam=function(t){if(null===this.m_Scanbeam)this.m_Scanbeam=new e.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=t;else if(t>this.m_Scanbeam.Y){var i=new e.Scanbeam;i.Y=t,i.Next=this.m_Scanbeam,this.m_Scanbeam=i}else{for(var n=this.m_Scanbeam;null!==n.Next&&t<=n.Next.Y;)n=n.Next;if(t===n.Y)return;var s=new e.Scanbeam;s.Y=t,s.Next=n.Next,n.Next=s}},e.ClipperBase.prototype.PopScanbeam=function(t){return null===this.m_Scanbeam?(t.v=0,!1):(t.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},e.ClipperBase.prototype.LocalMinimaPending=function(){return null!==this.m_CurrentLM},e.ClipperBase.prototype.CreateOutRec=function(){var t=new e.OutRec;return t.Idx=e.ClipperBase.Unassigned,t.IsHole=!1,t.IsOpen=!1,t.FirstLeft=null,t.Pts=null,t.BottomPt=null,t.PolyNode=null,this.m_PolyOuts.push(t),t.Idx=this.m_PolyOuts.length-1,t},e.ClipperBase.prototype.DisposeOutRec=function(t){var e=this.m_PolyOuts[t];e.Pts=null,e=null,this.m_PolyOuts[t]=null},e.ClipperBase.prototype.UpdateEdgeIntoAEL=function(t){null===t.NextInLML&&e.Error("UpdateEdgeIntoAEL: invalid call");var i=t.PrevInAEL,n=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,null!==i?i.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,null!==n&&(n.PrevInAEL=t.NextInLML),t.NextInLML.Side=t.Side,t.NextInLML.WindDelta=t.WindDelta,t.NextInLML.WindCnt=t.WindCnt,t.NextInLML.WindCnt2=t.WindCnt2,(t=t.NextInLML).Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=i,t.NextInAEL=n,e.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t},e.ClipperBase.prototype.SwapPositionsInAEL=function(t,e){if(t.NextInAEL!==t.PrevInAEL&&e.NextInAEL!==e.PrevInAEL){if(t.NextInAEL===e){var i=e.NextInAEL;null!==i&&(i.PrevInAEL=t);var n=t.PrevInAEL;null!==n&&(n.NextInAEL=e),e.PrevInAEL=n,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=i}else if(e.NextInAEL===t){var s=t.NextInAEL;null!==s&&(s.PrevInAEL=e);var r=e.PrevInAEL;null!==r&&(r.NextInAEL=t),t.PrevInAEL=r,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=s}else{var o=t.NextInAEL,l=t.PrevInAEL;t.NextInAEL=e.NextInAEL,null!==t.NextInAEL&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=e.PrevInAEL,null!==t.PrevInAEL&&(t.PrevInAEL.NextInAEL=t),e.NextInAEL=o,null!==e.NextInAEL&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=l,null!==e.PrevInAEL&&(e.PrevInAEL.NextInAEL=e)}null===t.PrevInAEL?this.m_ActiveEdges=t:null===e.PrevInAEL&&(this.m_ActiveEdges=e)}},e.ClipperBase.prototype.DeleteFromAEL=function(t){var e=t.PrevInAEL,i=t.NextInAEL;null===e&&null===i&&t!==this.m_ActiveEdges||(null!==e?e.NextInAEL=i:this.m_ActiveEdges=i,null!==i&&(i.PrevInAEL=e),t.NextInAEL=null,t.PrevInAEL=null)},e.Clipper=function(t){void 0===t&&(t=0),this.m_PolyOuts=null,this.m_ClipType=e.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=e.PolyFillType.pftEvenOdd,this.m_SubjFillType=e.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,e.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=e.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=!!(1&t),this.StrictlySimple=!!(2&t),this.PreserveCollinear=!!(4&t),e.use_xyz&&(this.ZFillFunction=null)},e.Clipper.ioReverseSolution=1,e.Clipper.ioStrictlySimple=2,e.Clipper.ioPreserveCollinear=4,e.Clipper.prototype.Clear=function(){0!==this.m_edges.length&&(this.DisposeAllPolyPts(),e.ClipperBase.prototype.Clear.call(this))},e.Clipper.prototype.InsertMaxima=function(t){var i=new e.Maxima;if(i.X=t,null===this.m_Maxima)this.m_Maxima=i,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(t<this.m_Maxima.X)i.Next=this.m_Maxima,i.Prev=null,this.m_Maxima=i;else{for(var n=this.m_Maxima;null!==n.Next&&t>=n.Next.X;)n=n.Next;if(t===n.X)return;i.Next=n.Next,i.Prev=n,null!==n.Next&&(n.Next.Prev=i),n.Next=i}},e.Clipper.prototype.Execute=function(){var t=arguments,i=t.length,n=t[1]instanceof e.PolyTree;if(4===i&&!n){var s=t[0],r=t[1],o=t[2],l=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&e.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,e.Clear(r),this.m_SubjFillType=o,this.m_ClipFillType=l,this.m_ClipType=s,this.m_UsingPolyTree=!1;try{(a=this.ExecuteInternal())&&this.BuildResult(r)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}if(4===i&&n){s=t[0];var h=t[1];o=t[2],l=t[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=l,this.m_ClipType=s,this.m_UsingPolyTree=!0;try{var a;(a=this.ExecuteInternal())&&this.BuildResult2(h)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}if(2===i&&!n){s=t[0],r=t[1];return this.Execute(s,r,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd)}if(2===i&&n){s=t[0],h=t[1];return this.Execute(s,h,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd)}},e.Clipper.prototype.FixHoleLinkage=function(t){if(null!==t.FirstLeft&&(t.IsHole===t.FirstLeft.IsHole||null===t.FirstLeft.Pts)){for(var e=t.FirstLeft;null!==e&&(e.IsHole===t.IsHole||null===e.Pts);)e=e.FirstLeft;t.FirstLeft=e}},e.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var t,e,i,n={},s={};if(!this.PopScanbeam(n))return!1;for(this.InsertLocalMinimaIntoAEL(n.v);this.PopScanbeam(s)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(s.v))return!1;this.ProcessEdgesAtTopOfScanbeam(s.v),n.v=s.v,this.InsertLocalMinimaIntoAEL(n.v)}for(e=0,i=this.m_PolyOuts.length;e<i;e++)null===(t=this.m_PolyOuts[e]).Pts||t.IsOpen||(t.IsHole^this.ReverseSolution)==this.Area$1(t)>0&&this.ReversePolyPtLinks(t.Pts);for(this.JoinCommonEdges(),e=0,i=this.m_PolyOuts.length;e<i;e++)null!==(t=this.m_PolyOuts[e]).Pts&&(t.IsOpen?this.FixupOutPolyline(t):this.FixupOutPolygon(t));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},e.Clipper.prototype.DisposeAllPolyPts=function(){for(var t=0,i=this.m_PolyOuts.length;t<i;++t)this.DisposeOutRec(t);e.Clear(this.m_PolyOuts)},e.Clipper.prototype.AddJoin=function(t,i,n){var s=new e.Join;s.OutPt1=t,s.OutPt2=i,s.OffPt.X=n.X,s.OffPt.Y=n.Y,e.use_xyz&&(s.OffPt.Z=n.Z),this.m_Joins.push(s)},e.Clipper.prototype.AddGhostJoin=function(t,i){var n=new e.Join;n.OutPt1=t,n.OffPt.X=i.X,n.OffPt.Y=i.Y,e.use_xyz&&(n.OffPt.Z=i.Z),this.m_GhostJoins.push(n)},e.Clipper.prototype.SetZ=function(t,i,n){if(null!==this.ZFillFunction){if(0!==t.Z||null===this.ZFillFunction)return;e.FPoint.op_Equality(t,i.Bot)?t.Z=i.Bot.Z:e.FPoint.op_Equality(t,i.Top)?t.Z=i.Top.Z:e.FPoint.op_Equality(t,n.Bot)?t.Z=n.Bot.Z:e.FPoint.op_Equality(t,n.Top)?t.Z=n.Top.Z:this.ZFillFunction(i.Bot,i.Top,n.Bot,n.Top,t)}},e.Clipper.prototype.InsertLocalMinimaIntoAEL=function(t){for(var i,n,s={};this.PopLocalMinima(t,s);){i=s.v.LeftBound,n=s.v.RightBound;var r=null;if(null===i?(this.InsertEdgeIntoAEL(n,null),this.SetWindingCount(n),this.IsContributing(n)&&(r=this.AddOutPt(n,n.Bot))):null===n?(this.InsertEdgeIntoAEL(i,null),this.SetWindingCount(i),this.IsContributing(i)&&(r=this.AddOutPt(i,i.Bot)),this.InsertScanbeam(i.Top.Y)):(this.InsertEdgeIntoAEL(i,null),this.InsertEdgeIntoAEL(n,i),this.SetWindingCount(i),n.WindCnt=i.WindCnt,n.WindCnt2=i.WindCnt2,this.IsContributing(i)&&(r=this.AddLocalMinPoly(i,n,i.Bot)),this.InsertScanbeam(i.Top.Y)),null!==n&&(e.ClipperBase.IsHorizontal(n)?(null!==n.NextInLML&&this.InsertScanbeam(n.NextInLML.Top.Y),this.AddEdgeToSEL(n)):this.InsertScanbeam(n.Top.Y)),null!==i&&null!==n){if(null!==r&&e.ClipperBase.IsHorizontal(n)&&this.m_GhostJoins.length>0&&0!==n.WindDelta)for(var o=0,l=this.m_GhostJoins.length;o<l;o++){var h=this.m_GhostJoins[o];this.HorzSegmentsOverlap(h.OutPt1.Pt.X,h.OffPt.X,n.Bot.X,n.Top.X)&&this.AddJoin(h.OutPt1,r,h.OffPt)}if(i.OutIdx>=0&&null!==i.PrevInAEL&&i.PrevInAEL.Curr.X===i.Bot.X&&i.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(i.PrevInAEL.Curr,i.PrevInAEL.Top,i.Curr,i.Top)&&0!==i.WindDelta&&0!==i.PrevInAEL.WindDelta){var a=this.AddOutPt(i.PrevInAEL,i.Bot);this.AddJoin(r,a,i.Top)}if(i.NextInAEL!==n){if(n.OutIdx>=0&&n.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(n.PrevInAEL.Curr,n.PrevInAEL.Top,n.Curr,n.Top)&&0!==n.WindDelta&&0!==n.PrevInAEL.WindDelta){a=this.AddOutPt(n.PrevInAEL,n.Bot);this.AddJoin(r,a,n.Top)}var p=i.NextInAEL;if(null!==p)for(;p!==n;)this.IntersectEdges(n,p,i.Curr),p=p.NextInAEL}}}},e.Clipper.prototype.InsertEdgeIntoAEL=function(t,e){if(null===this.m_ActiveEdges)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(null===e&&this.E2InsertsBeforeE1(this.m_ActiveEdges,t))t.PrevInAEL=null,t.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=t,this.m_ActiveEdges=t;else{for(null===e&&(e=this.m_ActiveEdges);null!==e.NextInAEL&&!this.E2InsertsBeforeE1(e.NextInAEL,t);)e=e.NextInAEL;t.NextInAEL=e.NextInAEL,null!==e.NextInAEL&&(e.NextInAEL.PrevInAEL=t),t.PrevInAEL=e,e.NextInAEL=t}},e.Clipper.prototype.E2InsertsBeforeE1=function(t,i){return i.Curr.X===t.Curr.X?i.Top.Y>t.Top.Y?i.Top.X<e.Clipper.TopX(t,i.Top.Y):t.Top.X>e.Clipper.TopX(i,t.Top.Y):i.Curr.X<t.Curr.X},e.Clipper.prototype.IsEvenOddFillType=function(t){return t.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType===e.PolyFillType.pftEvenOdd:this.m_ClipFillType===e.PolyFillType.pftEvenOdd},e.Clipper.prototype.IsEvenOddAltFillType=function(t){return t.PolyTyp===e.PolyType.ptSubject?this.m_ClipFillType===e.PolyFillType.pftEvenOdd:this.m_SubjFillType===e.PolyFillType.pftEvenOdd},e.Clipper.prototype.IsContributing=function(t){var i,n;switch(t.PolyTyp===e.PolyType.ptSubject?(i=this.m_SubjFillType,n=this.m_ClipFillType):(i=this.m_ClipFillType,n=this.m_SubjFillType),i){case e.PolyFillType.pftEvenOdd:if(0===t.WindDelta&&1!==t.WindCnt)return!1;break;case e.PolyFillType.pftNonZero:if(1!==Math.abs(t.WindCnt))return!1;break;case e.PolyFillType.pftPositive:if(1!==t.WindCnt)return!1;break;default:if(-1!==t.WindCnt)return!1}switch(this.m_ClipType){case e.ClipType.ctIntersection:switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0!==t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case e.ClipType.ctUnion:switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0===t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case e.ClipType.ctDifference:if(t.PolyTyp===e.PolyType.ptSubject)switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0===t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0!==t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case e.ClipType.ctXor:if(0!==t.WindDelta)return!0;switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0===t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}}return!0},e.Clipper.prototype.SetWindingCount=function(t){for(var i=t.PrevInAEL;null!==i&&(i.PolyTyp!==t.PolyTyp||0===i.WindDelta);)i=i.PrevInAEL;if(null===i){var n=t.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;0===t.WindDelta?t.WindCnt=n===e.PolyFillType.pftNegative?-1:1:t.WindCnt=t.WindDelta,t.WindCnt2=0,i=this.m_ActiveEdges}else if(0===t.WindDelta&&this.m_ClipType!==e.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=i.WindCnt2,i=i.NextInAEL;else if(this.IsEvenOddFillType(t)){if(0===t.WindDelta){for(var s=!0,r=i.PrevInAEL;null!==r;)r.PolyTyp===i.PolyTyp&&0!==r.WindDelta&&(s=!s),r=r.PrevInAEL;t.WindCnt=s?0:1}else t.WindCnt=t.WindDelta;t.WindCnt2=i.WindCnt2,i=i.NextInAEL}else i.WindCnt*i.WindDelta<0?Math.abs(i.WindCnt)>1?i.WindDelta*t.WindDelta<0?t.WindCnt=i.WindCnt:t.WindCnt=i.WindCnt+t.WindDelta:t.WindCnt=0===t.WindDelta?1:t.WindDelta:0===t.WindDelta?t.WindCnt=i.WindCnt<0?i.WindCnt-1:i.WindCnt+1:i.WindDelta*t.WindDelta<0?t.WindCnt=i.WindCnt:t.WindCnt=i.WindCnt+t.WindDelta,t.WindCnt2=i.WindCnt2,i=i.NextInAEL;if(this.IsEvenOddAltFillType(t))for(;i!==t;)0!==i.WindDelta&&(t.WindCnt2=0===t.WindCnt2?1:0),i=i.NextInAEL;else for(;i!==t;)t.WindCnt2+=i.WindDelta,i=i.NextInAEL},e.Clipper.prototype.AddEdgeToSEL=function(t){null===this.m_SortedEdges?(this.m_SortedEdges=t,t.PrevInSEL=null,t.NextInSEL=null):(t.NextInSEL=this.m_SortedEdges,t.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=t,this.m_SortedEdges=t)},e.Clipper.prototype.PopEdgeFromSEL=function(t){if(t.v=this.m_SortedEdges,null===t.v)return!1;var e=t.v;return this.m_SortedEdges=t.v.NextInSEL,null!==this.m_SortedEdges&&(this.m_SortedEdges.PrevInSEL=null),e.NextInSEL=null,e.PrevInSEL=null,!0},e.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;null!==t;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL},e.Clipper.prototype.SwapPositionsInSEL=function(t,e){if(!(null===t.NextInSEL&&null===t.PrevInSEL||null===e.NextInSEL&&null===e.PrevInSEL)){if(t.NextInSEL===e)null!==(i=e.NextInSEL)&&(i.PrevInSEL=t),null!==(n=t.PrevInSEL)&&(n.NextInSEL=e),e.PrevInSEL=n,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=i;else if(e.NextInSEL===t){null!==(i=t.NextInSEL)&&(i.PrevInSEL=e),null!==(n=e.PrevInSEL)&&(n.NextInSEL=t),t.PrevInSEL=n,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=i}else{var i=t.NextInSEL,n=t.PrevInSEL;t.NextInSEL=e.NextInSEL,null!==t.NextInSEL&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=e.PrevInSEL,null!==t.PrevInSEL&&(t.PrevInSEL.NextInSEL=t),e.NextInSEL=i,null!==e.NextInSEL&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=n,null!==e.PrevInSEL&&(e.PrevInSEL.NextInSEL=e)}null===t.PrevInSEL?this.m_SortedEdges=t:null===e.PrevInSEL&&(this.m_SortedEdges=e)}},e.Clipper.prototype.AddLocalMaxPoly=function(t,e,i){this.AddOutPt(t,i),0===e.WindDelta&&this.AddOutPt(e,i),t.OutIdx===e.OutIdx?(t.OutIdx=-1,e.OutIdx=-1):t.OutIdx<e.OutIdx?this.AppendPolygon(t,e):this.AppendPolygon(e,t)},e.Clipper.prototype.AddLocalMinPoly=function(t,i,n){var s,r,o;if(e.ClipperBase.IsHorizontal(i)||t.Dx>i.Dx?(s=this.AddOutPt(t,n),i.OutIdx=t.OutIdx,t.Side=e.EdgeSide.esLeft,i.Side=e.EdgeSide.esRight,o=(r=t).PrevInAEL===i?i.PrevInAEL:r.PrevInAEL):(s=this.AddOutPt(i,n),t.OutIdx=i.OutIdx,t.Side=e.EdgeSide.esRight,i.Side=e.EdgeSide.esLeft,o=(r=i).PrevInAEL===t?t.PrevInAEL:r.PrevInAEL),null!==o&&o.OutIdx>=0&&o.Top.Y<n.Y&&r.Top.Y<n.Y){var l=e.Clipper.TopX(o,n.Y),h=e.Clipper.TopX(r,n.Y);if(l===h&&0!==r.WindDelta&&0!==o.WindDelta&&e.ClipperBase.SlopesEqual5(new e.FPoint2(l,n.Y),o.Top,new e.FPoint2(h,n.Y),r.Top)){var a=this.AddOutPt(o,n);this.AddJoin(s,a,r.Top)}}return s},e.Clipper.prototype.AddOutPt=function(t,i){if(t.OutIdx<0){(s=this.CreateOutRec()).IsOpen=0===t.WindDelta;var n=new e.OutPt;return s.Pts=n,n.Idx=s.Idx,n.Pt.X=i.X,n.Pt.Y=i.Y,e.use_xyz&&(n.Pt.Z=i.Z),n.Next=n,n.Prev=n,s.IsOpen||this.SetHoleState(t,s),t.OutIdx=s.Idx,n}var s,r=(s=this.m_PolyOuts[t.OutIdx]).Pts,o=t.Side===e.EdgeSide.esLeft;return o&&e.FPoint.op_Equality(i,r.Pt)?r:!o&&e.FPoint.op_Equality(i,r.Prev.Pt)?r.Prev:((n=new e.OutPt).Idx=s.Idx,n.Pt.X=i.X,n.Pt.Y=i.Y,e.use_xyz&&(n.Pt.Z=i.Z),n.Next=r,n.Prev=r.Prev,n.Prev.Next=n,r.Prev=n,o&&(s.Pts=n),n)},e.Clipper.prototype.GetLastOutPt=function(t){var i=this.m_PolyOuts[t.OutIdx];return t.Side===e.EdgeSide.esLeft?i.Pts:i.Pts.Prev},e.Clipper.prototype.SwapPoints=function(t,i){var n=new e.FPoint1(t.Value);t.Value.X=i.Value.X,t.Value.Y=i.Value.Y,e.use_xyz&&(t.Value.Z=i.Value.Z),i.Value.X=n.X,i.Value.Y=n.Y,e.use_xyz&&(i.Value.Z=n.Z)},e.Clipper.prototype.HorzSegmentsOverlap=function(t,e,i,n){var s;return t>e&&(s=t,t=e,e=s),i>n&&(s=i,i=n,n=s),t<n&&i<e},e.Clipper.prototype.SetHoleState=function(t,e){for(var i=t.PrevInAEL,n=null;null!==i;)i.OutIdx>=0&&0!==i.WindDelta&&(null===n?n=i:n.OutIdx===i.OutIdx&&(n=null)),i=i.PrevInAEL;null===n?(e.FirstLeft=null,e.IsHole=!1):(e.FirstLeft=this.m_PolyOuts[n.OutIdx],e.IsHole=!e.FirstLeft.IsHole)},e.Clipper.prototype.GetDx=function(t,i){return t.Y===i.Y?e.ClipperBase.horizontal:(i.X-t.X)/(i.Y-t.Y)},e.Clipper.prototype.FirstIsBottomPt=function(t,i){for(var n=t.Prev;e.FPoint.op_Equality(n.Pt,t.Pt)&&n!==t;)n=n.Prev;var s=Math.abs(this.GetDx(t.Pt,n.Pt));for(n=t.Next;e.FPoint.op_Equality(n.Pt,t.Pt)&&n!==t;)n=n.Next;var r=Math.abs(this.GetDx(t.Pt,n.Pt));for(n=i.Prev;e.FPoint.op_Equality(n.Pt,i.Pt)&&n!==i;)n=n.Prev;var o=Math.abs(this.GetDx(i.Pt,n.Pt));for(n=i.Next;e.FPoint.op_Equality(n.Pt,i.Pt)&&n!==i;)n=n.Next;var l=Math.abs(this.GetDx(i.Pt,n.Pt));return Math.max(s,r)===Math.max(o,l)&&Math.min(s,r)===Math.min(o,l)?this.Area(t)>0:s>=o&&s>=l||r>=o&&r>=l},e.Clipper.prototype.GetBottomPt=function(t){for(var i=null,n=t.Next;n!==t;)n.Pt.Y>t.Pt.Y?(t=n,i=null):n.Pt.Y===t.Pt.Y&&n.Pt.X<=t.Pt.X&&(n.Pt.X<t.Pt.X?(i=null,t=n):n.Next!==t&&n.Prev!==t&&(i=n)),n=n.Next;if(null!==i)for(;i!==n;)for(this.FirstIsBottomPt(n,i)||(t=i),i=i.Next;e.FPoint.op_Inequality(i.Pt,t.Pt);)i=i.Next;return t},e.Clipper.prototype.GetLowermostRec=function(t,e){null===t.BottomPt&&(t.BottomPt=this.GetBottomPt(t.Pts)),null===e.BottomPt&&(e.BottomPt=this.GetBottomPt(e.Pts));var i=t.BottomPt,n=e.BottomPt;return i.Pt.Y>n.Pt.Y?t:i.Pt.Y<n.Pt.Y?e:i.Pt.X<n.Pt.X?t:i.Pt.X>n.Pt.X||i.Next===i?e:n.Next===n||this.FirstIsBottomPt(i,n)?t:e},e.Clipper.prototype.OutRec1RightOfOutRec2=function(t,e){do{if((t=t.FirstLeft)===e)return!0}while(null!==t);return!1},e.Clipper.prototype.GetOutRec=function(t){for(var e=this.m_PolyOuts[t];e!==this.m_PolyOuts[e.Idx];)e=this.m_PolyOuts[e.Idx];return e},e.Clipper.prototype.AppendPolygon=function(t,i){var n,s=this.m_PolyOuts[t.OutIdx],r=this.m_PolyOuts[i.OutIdx];n=this.OutRec1RightOfOutRec2(s,r)?r:this.OutRec1RightOfOutRec2(r,s)?s:this.GetLowermostRec(s,r);var o=s.Pts,l=o.Prev,h=r.Pts,a=h.Prev;t.Side===e.EdgeSide.esLeft?i.Side===e.EdgeSide.esLeft?(this.ReversePolyPtLinks(h),h.Next=o,o.Prev=h,l.Next=a,a.Prev=l,s.Pts=a):(a.Next=o,o.Prev=a,h.Prev=l,l.Next=h,s.Pts=h):i.Side===e.EdgeSide.esRight?(this.ReversePolyPtLinks(h),l.Next=a,a.Prev=l,h.Next=o,o.Prev=h):(l.Next=h,h.Prev=l,o.Prev=a,a.Next=o),s.BottomPt=null,n===r&&(r.FirstLeft!==s&&(s.FirstLeft=r.FirstLeft),s.IsHole=r.IsHole),r.Pts=null,r.BottomPt=null,r.FirstLeft=s;var p=t.OutIdx,u=i.OutIdx;t.OutIdx=-1,i.OutIdx=-1;for(var d=this.m_ActiveEdges;null!==d;){if(d.OutIdx===u){d.OutIdx=p,d.Side=t.Side;break}d=d.NextInAEL}r.Idx=s.Idx},e.Clipper.prototype.ReversePolyPtLinks=function(t){if(null!==t){var e,i;e=t;do{i=e.Next,e.Next=e.Prev,e.Prev=i,e=i}while(e!==t)}},e.Clipper.SwapSides=function(t,e){var i=t.Side;t.Side=e.Side,e.Side=i},e.Clipper.SwapPolyIndexes=function(t,e){var i=t.OutIdx;t.OutIdx=e.OutIdx,e.OutIdx=i},e.Clipper.prototype.IntersectEdges=function(t,i,n){var s=t.OutIdx>=0,r=i.OutIdx>=0;if(e.use_xyz&&this.SetZ(n,t,i),!e.use_lines||0!==t.WindDelta&&0!==i.WindDelta){if(t.PolyTyp===i.PolyTyp)if(this.IsEvenOddFillType(t)){var o=t.WindCnt;t.WindCnt=i.WindCnt,i.WindCnt=o}else t.WindCnt+i.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt+=i.WindDelta,i.WindCnt-t.WindDelta==0?i.WindCnt=-i.WindCnt:i.WindCnt-=t.WindDelta;else this.IsEvenOddFillType(i)?t.WindCnt2=0===t.WindCnt2?1:0:t.WindCnt2+=i.WindDelta,this.IsEvenOddFillType(t)?i.WindCnt2=0===i.WindCnt2?1:0:i.WindCnt2-=t.WindDelta;var l,h,a,p,u,d;switch(t.PolyTyp===e.PolyType.ptSubject?(l=this.m_SubjFillType,a=this.m_ClipFillType):(l=this.m_ClipFillType,a=this.m_SubjFillType),i.PolyTyp===e.PolyType.ptSubject?(h=this.m_SubjFillType,p=this.m_ClipFillType):(h=this.m_ClipFillType,p=this.m_SubjFillType),l){case e.PolyFillType.pftPositive:u=t.WindCnt;break;case e.PolyFillType.pftNegative:u=-t.WindCnt;break;default:u=Math.abs(t.WindCnt)}switch(h){case e.PolyFillType.pftPositive:d=i.WindCnt;break;case e.PolyFillType.pftNegative:d=-i.WindCnt;break;default:d=Math.abs(i.WindCnt)}if(s&&r)0!==u&&1!==u||0!==d&&1!==d||t.PolyTyp!==i.PolyTyp&&this.m_ClipType!==e.ClipType.ctXor?this.AddLocalMaxPoly(t,i,n):(this.AddOutPt(t,n),this.AddOutPt(i,n),e.Clipper.SwapSides(t,i),e.Clipper.SwapPolyIndexes(t,i));else if(s)0!==d&&1!==d||(this.AddOutPt(t,n),e.Clipper.SwapSides(t,i),e.Clipper.SwapPolyIndexes(t,i));else if(r)0!==u&&1!==u||(this.AddOutPt(i,n),e.Clipper.SwapSides(t,i),e.Clipper.SwapPolyIndexes(t,i));else if(!(0!==u&&1!==u||0!==d&&1!==d)){var c,f;switch(a){case e.PolyFillType.pftPositive:c=t.WindCnt2;break;case e.PolyFillType.pftNegative:c=-t.WindCnt2;break;default:c=Math.abs(t.WindCnt2)}switch(p){case e.PolyFillType.pftPositive:f=i.WindCnt2;break;case e.PolyFillType.pftNegative:f=-i.WindCnt2;break;default:f=Math.abs(i.WindCnt2)}if(t.PolyTyp!==i.PolyTyp)this.AddLocalMinPoly(t,i,n);else if(1===u&&1===d)switch(this.m_ClipType){case e.ClipType.ctIntersection:c>0&&f>0&&this.AddLocalMinPoly(t,i,n);break;case e.ClipType.ctUnion:c<=0&&f<=0&&this.AddLocalMinPoly(t,i,n);break;case e.ClipType.ctDifference:(t.PolyTyp===e.PolyType.ptClip&&c>0&&f>0||t.PolyTyp===e.PolyType.ptSubject&&c<=0&&f<=0)&&this.AddLocalMinPoly(t,i,n);break;case e.ClipType.ctXor:this.AddLocalMinPoly(t,i,n)}else e.Clipper.SwapSides(t,i)}}else{if(0===t.WindDelta&&0===i.WindDelta)return;t.PolyTyp===i.PolyTyp&&t.WindDelta!==i.WindDelta&&this.m_ClipType===e.ClipType.ctUnion?0===t.WindDelta?r&&(this.AddOutPt(t,n),s&&(t.OutIdx=-1)):s&&(this.AddOutPt(i,n),r&&(i.OutIdx=-1)):t.PolyTyp!==i.PolyTyp&&(0!==t.WindDelta||1!==Math.abs(i.WindCnt)||this.m_ClipType===e.ClipType.ctUnion&&0!==i.WindCnt2?0!==i.WindDelta||1!==Math.abs(t.WindCnt)||this.m_ClipType===e.ClipType.ctUnion&&0!==t.WindCnt2||(this.AddOutPt(i,n),r&&(i.OutIdx=-1)):(this.AddOutPt(t,n),s&&(t.OutIdx=-1)))}},e.Clipper.prototype.DeleteFromSEL=function(t){var e=t.PrevInSEL,i=t.NextInSEL;null===e&&null===i&&t!==this.m_SortedEdges||(null!==e?e.NextInSEL=i:this.m_SortedEdges=i,null!==i&&(i.PrevInSEL=e),t.NextInSEL=null,t.PrevInSEL=null)},e.Clipper.prototype.ProcessHorizontals=function(){for(var t={};this.PopEdgeFromSEL(t);)this.ProcessHorizontal(t.v)},e.Clipper.prototype.GetHorzDirection=function(t,i){t.Bot.X<t.Top.X?(i.Left=t.Bot.X,i.Right=t.Top.X,i.Dir=e.Direction.dLeftToRight):(i.Left=t.Top.X,i.Right=t.Bot.X,i.Dir=e.Direction.dRightToLeft)},e.Clipper.prototype.ProcessHorizontal=function(t){var i={Dir:null,Left:null,Right:null};this.GetHorzDirection(t,i);for(var n=i.Dir,s=i.Left,r=i.Right,o=0===t.WindDelta,l=t,h=null;null!==l.NextInLML&&e.ClipperBase.IsHorizontal(l.NextInLML);)l=l.NextInLML;null===l.NextInLML&&(h=this.GetMaximaPair(l));var a=this.m_Maxima;if(null!==a)if(n===e.Direction.dLeftToRight){for(;null!==a&&a.X<=t.Bot.X;)a=a.Next;null!==a&&a.X>=l.Top.X&&(a=null)}else{for(;null!==a.Next&&a.Next.X<t.Bot.X;)a=a.Next;a.X<=l.Top.X&&(a=null)}for(var p=null;;){for(var u=t===l,d=this.GetNextInAEL(t,n);null!==d;){if(null!==a)if(n===e.Direction.dLeftToRight)for(;null!==a&&a.X<d.Curr.X;)t.OutIdx>=0&&!o&&this.AddOutPt(t,new e.FPoint2(a.X,t.Bot.Y)),a=a.Next;else for(;null!==a&&a.X>d.Curr.X;)t.OutIdx>=0&&!o&&this.AddOutPt(t,new e.FPoint2(a.X,t.Bot.Y)),a=a.Prev;if(n===e.Direction.dLeftToRight&&d.Curr.X>r||n===e.Direction.dRightToLeft&&d.Curr.X<s)break;if(d.Curr.X===t.Top.X&&null!==t.NextInLML&&d.Dx<t.NextInLML.Dx)break;if(t.OutIdx>=0&&!o){e.use_xyz&&(n===e.Direction.dLeftToRight?this.SetZ(d.Curr,t,d):this.SetZ(d.Curr,d,t)),p=this.AddOutPt(t,d.Curr);for(var c=this.m_SortedEdges;null!==c;){if(c.OutIdx>=0&&this.HorzSegmentsOverlap(t.Bot.X,t.Top.X,c.Bot.X,c.Top.X)){var f=this.GetLastOutPt(c);this.AddJoin(f,p,c.Top)}c=c.NextInSEL}this.AddGhostJoin(p,t.Bot)}if(d===h&&u)return t.OutIdx>=0&&this.AddLocalMaxPoly(t,h,t.Top),this.DeleteFromAEL(t),void this.DeleteFromAEL(h);if(n===e.Direction.dLeftToRight){var y=new e.FPoint2(d.Curr.X,t.Curr.Y);this.IntersectEdges(t,d,y)}else{y=new e.FPoint2(d.Curr.X,t.Curr.Y);this.IntersectEdges(d,t,y)}var x=this.GetNextInAEL(d,n);this.SwapPositionsInAEL(t,d),d=x}if(null===t.NextInLML||!e.ClipperBase.IsHorizontal(t.NextInLML))break;(t=this.UpdateEdgeIntoAEL(t)).OutIdx>=0&&this.AddOutPt(t,t.Bot),i={Dir:n,Left:s,Right:r},this.GetHorzDirection(t,i),n=i.Dir,s=i.Left,r=i.Right}if(t.OutIdx>=0&&null===p){p=this.GetLastOutPt(t);for(c=this.m_SortedEdges;null!==c;){if(c.OutIdx>=0&&this.HorzSegmentsOverlap(t.Bot.X,t.Top.X,c.Bot.X,c.Top.X)){f=this.GetLastOutPt(c);this.AddJoin(f,p,c.Top)}c=c.NextInSEL}this.AddGhostJoin(p,t.Top)}if(null!==t.NextInLML)if(t.OutIdx>=0){if(p=this.AddOutPt(t,t.Top),0===(t=this.UpdateEdgeIntoAEL(t)).WindDelta)return;var g=t.PrevInAEL;x=t.NextInAEL;if(null!==g&&g.Curr.X===t.Bot.X&&g.Curr.Y===t.Bot.Y&&0===g.WindDelta&&g.OutIdx>=0&&g.Curr.Y>g.Top.Y&&e.ClipperBase.SlopesEqual3(t,g)){f=this.AddOutPt(g,t.Bot);this.AddJoin(p,f,t.Top)}else if(null!==x&&x.Curr.X===t.Bot.X&&x.Curr.Y===t.Bot.Y&&0!==x.WindDelta&&x.OutIdx>=0&&x.Curr.Y>x.Top.Y&&e.ClipperBase.SlopesEqual3(t,x)){f=this.AddOutPt(x,t.Bot);this.AddJoin(p,f,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t)},e.Clipper.prototype.GetNextInAEL=function(t,i){return i===e.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL},e.Clipper.prototype.IsMinima=function(t){return null!==t&&t.Prev.NextInLML!==t&&t.Next.NextInLML!==t},e.Clipper.prototype.IsMaxima=function(t,e){return null!==t&&t.Top.Y===e&&null===t.NextInLML},e.Clipper.prototype.IsIntermediate=function(t,e){return t.Top.Y===e&&null!==t.NextInLML},e.Clipper.prototype.GetMaximaPair=function(t){return e.FPoint.op_Equality(t.Next.Top,t.Top)&&null===t.Next.NextInLML?t.Next:e.FPoint.op_Equality(t.Prev.Top,t.Top)&&null===t.Prev.NextInLML?t.Prev:null},e.Clipper.prototype.GetMaximaPairEx=function(t){var i=this.GetMaximaPair(t);return null===i||i.OutIdx===e.ClipperBase.Skip||i.NextInAEL===i.PrevInAEL&&!e.ClipperBase.IsHorizontal(i)?null:i},e.Clipper.prototype.ProcessIntersections=function(t){if(null===this.m_ActiveEdges)return!0;try{if(this.BuildIntersectList(t),0===this.m_IntersectList.length)return!0;if(1!==this.m_IntersectList.length&&!this.FixupIntersectionOrder())return!1;this.ProcessIntersectList()}catch(t){this.m_SortedEdges=null,this.m_IntersectList.length=0,e.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},e.Clipper.prototype.BuildIntersectList=function(t){if(null!==this.m_ActiveEdges){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;null!==i;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i.Curr.X=e.Clipper.TopX(i,t),i=i.NextInAEL;for(var n=!0;n&&null!==this.m_SortedEdges;){for(n=!1,i=this.m_SortedEdges;null!==i.NextInSEL;){var s=i.NextInSEL,r=new e.FPoint0;if(i.Curr.X>s.Curr.X){this.IntersectPoint(i,s,r),r.Y<t&&(r=new e.FPoint2(e.Clipper.TopX(i,t),t));var o=new e.IntersectNode;o.Edge1=i,o.Edge2=s,o.Pt.X=r.X,o.Pt.Y=r.Y,e.use_xyz&&(o.Pt.Z=r.Z),this.m_IntersectList.push(o),this.SwapPositionsInSEL(i,s),n=!0}else i=s}if(null===i.PrevInSEL)break;i.PrevInSEL.NextInSEL=null}this.m_SortedEdges=null}},e.Clipper.prototype.EdgesAdjacent=function(t){return t.Edge1.NextInSEL===t.Edge2||t.Edge1.PrevInSEL===t.Edge2},e.Clipper.IntersectNodeSort=function(t,e){return e.Pt.Y-t.Pt.Y},e.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var t=this.m_IntersectList.length,e=0;e<t;e++){if(!this.EdgesAdjacent(this.m_IntersectList[e])){for(var i=e+1;i<t&&!this.EdgesAdjacent(this.m_IntersectList[i]);)i++;if(i===t)return!1;var n=this.m_IntersectList[e];this.m_IntersectList[e]=this.m_IntersectList[i],this.m_IntersectList[i]=n}this.SwapPositionsInSEL(this.m_IntersectList[e].Edge1,this.m_IntersectList[e].Edge2)}return!0},e.Clipper.prototype.ProcessIntersectList=function(){for(var t=0,e=this.m_IntersectList.length;t<e;t++){var i=this.m_IntersectList[t];this.IntersectEdges(i.Edge1,i.Edge2,i.Pt),this.SwapPositionsInAEL(i.Edge1,i.Edge2)}this.m_IntersectList.length=0},e.Clipper.TopX=function(t,e){return e===t.Top.Y?t.Top.X:t.Bot.X+t.Dx*(e-t.Bot.Y)},e.Clipper.prototype.IntersectPoint=function(t,i,n){var s,r;if(n.X=0,n.Y=0,t.Dx===i.Dx)return n.Y=t.Curr.Y,void(n.X=e.Clipper.TopX(t,n.Y));if(0===t.Delta.X)n.X=t.Bot.X,e.ClipperBase.IsHorizontal(i)?n.Y=i.Bot.Y:(r=i.Bot.Y-i.Bot.X/i.Dx,n.Y=n.X/i.Dx+r);else if(0===i.Delta.X)n.X=i.Bot.X,e.ClipperBase.IsHorizontal(t)?n.Y=t.Bot.Y:(s=t.Bot.Y-t.Bot.X/t.Dx,n.Y=n.X/t.Dx+s);else{s=t.Bot.X-t.Bot.Y*t.Dx;var o=((r=i.Bot.X-i.Bot.Y*i.Dx)-s)/(t.Dx-i.Dx);n.Y=o,Math.abs(t.Dx)<Math.abs(i.Dx)?n.X=t.Dx*o+s:n.X=i.Dx*o+r}if(n.Y<t.Top.Y||n.Y<i.Top.Y){if(t.Top.Y>i.Top.Y)return n.Y=t.Top.Y,n.X=e.Clipper.TopX(i,t.Top.Y),n.X<t.Top.X;n.Y=i.Top.Y,Math.abs(t.Dx)<Math.abs(i.Dx)?n.X=e.Clipper.TopX(t,n.Y):n.X=e.Clipper.TopX(i,n.Y)}n.Y>t.Curr.Y&&(n.Y=t.Curr.Y,Math.abs(t.Dx)>Math.abs(i.Dx)?n.X=e.Clipper.TopX(i,n.Y):n.X=e.Clipper.TopX(t,n.Y))},e.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var i=this.m_ActiveEdges;null!==i;){var n=this.IsMaxima(i,t);if(n){var s=this.GetMaximaPairEx(i);n=null===s||!e.ClipperBase.IsHorizontal(s)}if(n){this.StrictlySimple&&this.InsertMaxima(i.Top.X);var r=i.PrevInAEL;this.DoMaxima(i),i=null===r?this.m_ActiveEdges:r.NextInAEL}else{if(this.IsIntermediate(i,t)&&e.ClipperBase.IsHorizontal(i.NextInLML)?((i=this.UpdateEdgeIntoAEL(i)).OutIdx>=0&&this.AddOutPt(i,i.Bot),this.AddEdgeToSEL(i)):(i.Curr.X=e.Clipper.TopX(i,t),i.Curr.Y=t),e.use_xyz&&(i.Top.Y===t?i.Curr.Z=i.Top.Z:i.Bot.Y===t?i.Curr.Z=i.Bot.Z:i.Curr.Z=0),this.StrictlySimple){r=i.PrevInAEL;if(i.OutIdx>=0&&0!==i.WindDelta&&null!==r&&r.OutIdx>=0&&r.Curr.X===i.Curr.X&&0!==r.WindDelta){var o=new e.FPoint1(i.Curr);e.use_xyz&&this.SetZ(o,r,i);var l=this.AddOutPt(r,o),h=this.AddOutPt(i,o);this.AddJoin(l,h,o)}}i=i.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,i=this.m_ActiveEdges;null!==i;){if(this.IsIntermediate(i,t)){l=null;i.OutIdx>=0&&(l=this.AddOutPt(i,i.Top));r=(i=this.UpdateEdgeIntoAEL(i)).PrevInAEL;var a=i.NextInAEL;if(null!==r&&r.Curr.X===i.Bot.X&&r.Curr.Y===i.Bot.Y&&null!==l&&r.OutIdx>=0&&r.Curr.Y===r.Top.Y&&e.ClipperBase.SlopesEqual5(i.Curr,i.Top,r.Curr,r.Top)&&0!==i.WindDelta&&0!==r.WindDelta){h=this.AddOutPt(ePrev2,i.Bot);this.AddJoin(l,h,i.Top)}else if(null!==a&&a.Curr.X===i.Bot.X&&a.Curr.Y===i.Bot.Y&&null!==l&&a.OutIdx>=0&&a.Curr.Y===a.Top.Y&&e.ClipperBase.SlopesEqual5(i.Curr,i.Top,a.Curr,a.Top)&&0!==i.WindDelta&&0!==a.WindDelta){h=this.AddOutPt(a,i.Bot);this.AddJoin(l,h,i.Top)}}i=i.NextInAEL}},e.Clipper.prototype.DoMaxima=function(t){var i=this.GetMaximaPairEx(t);if(null===i)return t.OutIdx>=0&&this.AddOutPt(t,t.Top),void this.DeleteFromAEL(t);for(var n=t.NextInAEL;null!==n&&n!==i;)this.IntersectEdges(t,n,t.Top),this.SwapPositionsInAEL(t,n),n=t.NextInAEL;-1===t.OutIdx&&-1===i.OutIdx?(this.DeleteFromAEL(t),this.DeleteFromAEL(i)):t.OutIdx>=0&&i.OutIdx>=0?(t.OutIdx>=0&&this.AddLocalMaxPoly(t,i,t.Top),this.DeleteFromAEL(t),this.DeleteFromAEL(i)):e.use_lines&&0===t.WindDelta?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(t),i.OutIdx>=0&&(this.AddOutPt(i,t.Top),i.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(i)):e.Error("DoMaxima error")},e.Clipper.ReversePaths=function(t){for(var e=0,i=t.length;e<i;e++)t[e].reverse()},e.Clipper.Orientation=function(t){return e.Clipper.Area(t)>=0},e.Clipper.prototype.PointCount=function(t){if(null===t)return 0;var e=0,i=t;do{e++,i=i.Next}while(i!==t);return e},e.Clipper.prototype.BuildResult=function(t){e.Clear(t);for(var i=0,n=this.m_PolyOuts.length;i<n;i++){var s=this.m_PolyOuts[i];if(null!==s.Pts){var r=s.Pts.Prev,o=this.PointCount(r);if(!(o<2)){for(var l=new Array(o),h=0;h<o;h++)l[h]=r.Pt,r=r.Prev;t.push(l)}}}},e.Clipper.prototype.BuildResult2=function(t){t.Clear();for(var i=0,n=this.m_PolyOuts.length;i<n;i++){var s=this.m_PolyOuts[i],r=this.PointCount(s.Pts);if(!(s.IsOpen&&r<2||!s.IsOpen&&r<3)){this.FixHoleLinkage(s);var o=new e.PolyNode;t.m_AllPolys.push(o),s.PolyNode=o,o.m_polygon.length=r;for(var l=s.Pts.Prev,h=0;h<r;h++)o.m_polygon[h]=l.Pt,l=l.Prev}}for(i=0,n=this.m_PolyOuts.length;i<n;i++){null!==(s=this.m_PolyOuts[i]).PolyNode&&(s.IsOpen?(s.PolyNode.IsOpen=!0,t.AddChild(s.PolyNode)):null!==s.FirstLeft&&null!==s.FirstLeft.PolyNode?s.FirstLeft.PolyNode.AddChild(s.PolyNode):t.AddChild(s.PolyNode))}},e.Clipper.prototype.FixupOutPolyline=function(t){for(var i=t.Pts,n=i.Prev;i!==n;)if(i=i.Next,e.FPoint.op_Equality(i.Pt,i.Prev.Pt)){i===n&&(n=i.Prev);var s=i.Prev;s.Next=i.Next,i.Next.Prev=s,i=s}i===i.Prev&&(t.Pts=null)},e.Clipper.prototype.FixupOutPolygon=function(t){var i=null;t.BottomPt=null;for(var n=t.Pts,s=this.PreserveCollinear||this.StrictlySimple;;){if(n.Prev===n||n.Prev===n.Next)return void(t.Pts=null);if(e.FPoint.op_Equality(n.Pt,n.Next.Pt)||e.FPoint.op_Equality(n.Pt,n.Prev.Pt)||e.ClipperBase.SlopesEqual4(n.Prev.Pt,n.Pt,n.Next.Pt)&&(!s||!this.Pt2IsBetweenPt1AndPt3(n.Prev.Pt,n.Pt,n.Next.Pt)))i=null,n.Prev.Next=n.Next,n.Next.Prev=n.Prev,n=n.Prev;else{if(n===i)break;null===i&&(i=n),n=n.Next}}t.Pts=n},e.Clipper.prototype.DupOutPt=function(t,i){var n=new e.OutPt;return n.Pt.X=t.Pt.X,n.Pt.Y=t.Pt.Y,e.use_xyz&&(n.Pt.Z=t.Pt.Z),n.Idx=t.Idx,i?(n.Next=t.Next,n.Prev=t,t.Next.Prev=n,t.Next=n):(n.Prev=t.Prev,n.Next=t,t.Prev.Next=n,t.Prev=n),n},e.Clipper.prototype.GetOverlap=function(t,e,i,n,s){return t<e?i<n?(s.Left=Math.max(t,i),s.Right=Math.min(e,n)):(s.Left=Math.max(t,n),s.Right=Math.min(e,i)):i<n?(s.Left=Math.max(e,i),s.Right=Math.min(t,n)):(s.Left=Math.max(e,n),s.Right=Math.min(t,i)),s.Left<s.Right},e.Clipper.prototype.JoinHorz=function(t,i,n,s,r,o){var l=t.Pt.X>i.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight,h=n.Pt.X>s.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight;if(l===h)return!1;if(l===e.Direction.dLeftToRight){for(;t.Next.Pt.X<=r.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y===r.Y;)t=t.Next;o&&t.Pt.X!==r.X&&(t=t.Next),i=this.DupOutPt(t,!o),e.FPoint.op_Inequality(i.Pt,r)&&((t=i).Pt.X=r.X,t.Pt.Y=r.Y,e.use_xyz&&(t.Pt.Z=r.Z),i=this.DupOutPt(t,!o))}else{for(;t.Next.Pt.X>=r.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y===r.Y;)t=t.Next;o||t.Pt.X===r.X||(t=t.Next),i=this.DupOutPt(t,o),e.FPoint.op_Inequality(i.Pt,r)&&((t=i).Pt.X=r.X,t.Pt.Y=r.Y,e.use_xyz&&(t.Pt.Z=r.Z),i=this.DupOutPt(t,o))}if(h===e.Direction.dLeftToRight){for(;n.Next.Pt.X<=r.X&&n.Next.Pt.X>=n.Pt.X&&n.Next.Pt.Y===r.Y;)n=n.Next;o&&n.Pt.X!==r.X&&(n=n.Next),s=this.DupOutPt(n,!o),e.FPoint.op_Inequality(s.Pt,r)&&((n=s).Pt.X=r.X,n.Pt.Y=r.Y,e.use_xyz&&(n.Pt.Z=r.Z),s=this.DupOutPt(n,!o))}else{for(;n.Next.Pt.X>=r.X&&n.Next.Pt.X<=n.Pt.X&&n.Next.Pt.Y===r.Y;)n=n.Next;o||n.Pt.X===r.X||(n=n.Next),s=this.DupOutPt(n,o),e.FPoint.op_Inequality(s.Pt,r)&&((n=s).Pt.X=r.X,n.Pt.Y=r.Y,e.use_xyz&&(n.Pt.Z=r.Z),s=this.DupOutPt(n,o))}return l===e.Direction.dLeftToRight===o?(t.Prev=n,n.Next=t,i.Next=s,s.Prev=i):(t.Next=n,n.Prev=t,i.Prev=s,s.Next=i),!0},e.Clipper.prototype.JoinPoints=function(t,i,n){var s=t.OutPt1,r=new e.OutPt,o=t.OutPt2,l=new e.OutPt,h=t.OutPt1.Pt.Y===t.OffPt.Y;if(h&&e.FPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&e.FPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){if(i!==n)return!1;for(r=t.OutPt1.Next;r!==s&&e.FPoint.op_Equality(r.Pt,t.OffPt);)r=r.Next;var a=r.Pt.Y>t.OffPt.Y;for(l=t.OutPt2.Next;l!==o&&e.FPoint.op_Equality(l.Pt,t.OffPt);)l=l.Next;return a!==l.Pt.Y>t.OffPt.Y&&(a?(r=this.DupOutPt(s,!1),l=this.DupOutPt(o,!0),s.Prev=o,o.Next=s,r.Next=l,l.Prev=r,t.OutPt1=s,t.OutPt2=r,!0):(r=this.DupOutPt(s,!0),l=this.DupOutPt(o,!1),s.Next=o,o.Prev=s,r.Prev=l,l.Next=r,t.OutPt1=s,t.OutPt2=r,!0))}if(h){for(r=s;s.Prev.Pt.Y===s.Pt.Y&&s.Prev!==r&&s.Prev!==o;)s=s.Prev;for(;r.Next.Pt.Y===r.Pt.Y&&r.Next!==s&&r.Next!==o;)r=r.Next;if(r.Next===s||r.Next===o)return!1;for(l=o;o.Prev.Pt.Y===o.Pt.Y&&o.Prev!==l&&o.Prev!==r;)o=o.Prev;for(;l.Next.Pt.Y===l.Pt.Y&&l.Next!==o&&l.Next!==s;)l=l.Next;if(l.Next===o||l.Next===s)return!1;var p={Left:null,Right:null};if(!this.GetOverlap(s.Pt.X,r.Pt.X,o.Pt.X,l.Pt.X,p))return!1;var u,d=p.Left,c=p.Right,f=new e.FPoint0;return s.Pt.X>=d&&s.Pt.X<=c?(f.X=s.Pt.X,f.Y=s.Pt.Y,e.use_xyz&&(f.Z=s.Pt.Z),u=s.Pt.X>r.Pt.X):o.Pt.X>=d&&o.Pt.X<=c?(f.X=o.Pt.X,f.Y=o.Pt.Y,e.use_xyz&&(f.Z=o.Pt.Z),u=o.Pt.X>l.Pt.X):r.Pt.X>=d&&r.Pt.X<=c?(f.X=r.Pt.X,f.Y=r.Pt.Y,e.use_xyz&&(f.Z=r.Pt.Z),u=r.Pt.X>s.Pt.X):(f.X=l.Pt.X,f.Y=l.Pt.Y,e.use_xyz&&(f.Z=l.Pt.Z),u=l.Pt.X>o.Pt.X),t.OutPt1=s,t.OutPt2=o,this.JoinHorz(s,r,o,l,f,u)}for(r=s.Next;e.FPoint.op_Equality(r.Pt,s.Pt)&&r!==s;)r=r.Next;var y=r.Pt.Y>s.Pt.Y||!e.ClipperBase.SlopesEqual4(s.Pt,r.Pt,t.OffPt);if(y){for(r=s.Prev;e.FPoint.op_Equality(r.Pt,s.Pt)&&r!==s;)r=r.Prev;if(r.Pt.Y>s.Pt.Y||!e.ClipperBase.SlopesEqual4(s.Pt,r.Pt,t.OffPt))return!1}for(l=o.Next;e.FPoint.op_Equality(l.Pt,o.Pt)&&l!==o;)l=l.Next;var x=l.Pt.Y>o.Pt.Y||!e.ClipperBase.SlopesEqual4(o.Pt,l.Pt,t.OffPt);if(x){for(l=o.Prev;e.FPoint.op_Equality(l.Pt,o.Pt)&&l!==o;)l=l.Prev;if(l.Pt.Y>o.Pt.Y||!e.ClipperBase.SlopesEqual4(o.Pt,l.Pt,t.OffPt))return!1}return r!==s&&l!==o&&r!==l&&(i!==n||y!==x)&&(y?(r=this.DupOutPt(s,!1),l=this.DupOutPt(o,!0),s.Prev=o,o.Next=s,r.Next=l,l.Prev=r,t.OutPt1=s,t.OutPt2=r,!0):(r=this.DupOutPt(s,!0),l=this.DupOutPt(o,!1),s.Next=o,o.Prev=s,r.Prev=l,l.Next=r,t.OutPt1=s,t.OutPt2=r,!0))},e.Clipper.GetBounds=function(t){for(var i=0,n=t.length;i<n&&0===t[i].length;)i++;if(i===n)return new e.FRect(0,0,0,0);var s=new e.FRect;for(s.left=t[i][0].X,s.right=s.left,s.top=t[i][0].Y,s.bottom=s.top;i<n;i++)for(var r=0,o=t[i].length;r<o;r++)t[i][r].X<s.left?s.left=t[i][r].X:t[i][r].X>s.right&&(s.right=t[i][r].X),t[i][r].Y<s.top?s.top=t[i][r].Y:t[i][r].Y>s.bottom&&(s.bottom=t[i][r].Y);return s},e.Clipper.prototype.GetBounds2=function(t){var i=t,n=new e.FRect;for(n.left=t.Pt.X,n.right=t.Pt.X,n.top=t.Pt.Y,n.bottom=t.Pt.Y,t=t.Next;t!==i;)t.Pt.X<n.left&&(n.left=t.Pt.X),t.Pt.X>n.right&&(n.right=t.Pt.X),t.Pt.Y<n.top&&(n.top=t.Pt.Y),t.Pt.Y>n.bottom&&(n.bottom=t.Pt.Y),t=t.Next;return n},e.Clipper.PointInPolygon=function(t,e){var i=0,n=e.length;if(n<3)return 0;for(var s=e[0],r=1;r<=n;++r){var o=r===n?e[0]:e[r];if(o.Y===t.Y&&(o.X===t.X||s.Y===t.Y&&o.X>t.X==s.X<t.X))return-1;if(s.Y<t.Y!=o.Y<t.Y)if(s.X>=t.X)if(o.X>t.X)i=1-i;else{if(0===(l=(s.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(s.Y-t.Y)))return-1;l>0==o.Y>s.Y&&(i=1-i)}else if(o.X>t.X){var l;if(0===(l=(s.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(s.Y-t.Y)))return-1;l>0==o.Y>s.Y&&(i=1-i)}s=o}return i},e.Clipper.prototype.PointInPolygon=function(t,e){var i=0,n=e,s=t.X,r=t.Y,o=e.Pt.X,l=e.Pt.Y;do{var h=(e=e.Next).Pt.X,a=e.Pt.Y;if(a===r&&(h===s||l===r&&h>s==o<s))return-1;if(l<r!=a<r)if(o>=s)if(h>s)i=1-i;else{if(0===(p=(o-s)*(a-r)-(h-s)*(l-r)))return-1;p>0==a>l&&(i=1-i)}else if(h>s){var p;if(0===(p=(o-s)*(a-r)-(h-s)*(l-r)))return-1;p>0==a>l&&(i=1-i)}o=h,l=a}while(n!==e);return i},e.Clipper.prototype.Poly2ContainsPoly1=function(t,e){var i=t;do{var n=this.PointInPolygon(i.Pt,e);if(n>=0)return n>0;i=i.Next}while(i!==t);return!0},e.Clipper.prototype.FixupFirstLefts1=function(t,i){for(var n,s,r=0,o=this.m_PolyOuts.length;r<o;r++)n=this.m_PolyOuts[r],s=e.Clipper.ParseFirstLeft(n.FirstLeft),null!==n.Pts&&s===t&&this.Poly2ContainsPoly1(n.Pts,i.Pts)&&(n.FirstLeft=i)},e.Clipper.prototype.FixupFirstLefts2=function(t,i){for(var n,s,r=i.FirstLeft,o=0,l=this.m_PolyOuts.length;o<l;o++)null!==(n=this.m_PolyOuts[o]).Pts&&n!==i&&n!==t&&((s=e.Clipper.ParseFirstLeft(n.FirstLeft))!==r&&s!==t&&s!==i||(this.Poly2ContainsPoly1(n.Pts,t.Pts)?n.FirstLeft=t:this.Poly2ContainsPoly1(n.Pts,i.Pts)?n.FirstLeft=i:n.FirstLeft!==t&&n.FirstLeft!==i||(n.FirstLeft=r)))},e.Clipper.prototype.FixupFirstLefts3=function(t,i){for(var n,s,r=0,o=this.m_PolyOuts.length;r<o;r++)n=this.m_PolyOuts[r],s=e.Clipper.ParseFirstLeft(n.FirstLeft),null!==n.Pts&&s===t&&(n.FirstLeft=i)},e.Clipper.ParseFirstLeft=function(t){for(;null!==t&&null===t.Pts;)t=t.FirstLeft;return t},e.Clipper.prototype.JoinCommonEdges=function(){for(var t=0,e=this.m_Joins.length;t<e;t++){var i,n=this.m_Joins[t],s=this.GetOutRec(n.OutPt1.Idx),r=this.GetOutRec(n.OutPt2.Idx);if(null!==s.Pts&&null!==r.Pts)if(!s.IsOpen&&!r.IsOpen)i=s===r?s:this.OutRec1RightOfOutRec2(s,r)?r:this.OutRec1RightOfOutRec2(r,s)?s:this.GetLowermostRec(s,r),this.JoinPoints(n,s,r)&&(s===r?(s.Pts=n.OutPt1,s.BottomPt=null,(r=this.CreateOutRec()).Pts=n.OutPt2,this.UpdateOutPtIdxs(r),this.Poly2ContainsPoly1(r.Pts,s.Pts)?(r.IsHole=!s.IsHole,r.FirstLeft=s,this.m_UsingPolyTree&&this.FixupFirstLefts2(r,s),(r.IsHole^this.ReverseSolution)==this.Area$1(r)>0&&this.ReversePolyPtLinks(r.Pts)):this.Poly2ContainsPoly1(s.Pts,r.Pts)?(r.IsHole=s.IsHole,s.IsHole=!r.IsHole,r.FirstLeft=s.FirstLeft,s.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(s,r),(s.IsHole^this.ReverseSolution)==this.Area$1(s)>0&&this.ReversePolyPtLinks(s.Pts)):(r.IsHole=s.IsHole,r.FirstLeft=s.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(s,r))):(r.Pts=null,r.BottomPt=null,r.Idx=s.Idx,s.IsHole=i.IsHole,i===r&&(s.FirstLeft=r.FirstLeft),r.FirstLeft=s,this.m_UsingPolyTree&&this.FixupFirstLefts3(r,s)))}},e.Clipper.prototype.UpdateOutPtIdxs=function(t){var e=t.Pts;do{e.Idx=t.Idx,e=e.Prev}while(e!==t.Pts)},e.Clipper.prototype.DoSimplePolygons=function(){for(var t=0;t<this.m_PolyOuts.length;){var i=this.m_PolyOuts[t++],n=i.Pts;if(null!==n&&!i.IsOpen)do{for(var s=n.Next;s!==i.Pts;){if(e.FPoint.op_Equality(n.Pt,s.Pt)&&s.Next!==n&&s.Prev!==n){var r=n.Prev,o=s.Prev;n.Prev=o,o.Next=n,s.Prev=r,r.Next=s,i.Pts=n;var l=this.CreateOutRec();l.Pts=s,this.UpdateOutPtIdxs(l),this.Poly2ContainsPoly1(l.Pts,i.Pts)?(l.IsHole=!i.IsHole,l.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(l,i)):this.Poly2ContainsPoly1(i.Pts,l.Pts)?(l.IsHole=i.IsHole,i.IsHole=!l.IsHole,l.FirstLeft=i.FirstLeft,i.FirstLeft=l,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,l)):(l.IsHole=i.IsHole,l.FirstLeft=i.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(i,l)),s=n}s=s.Next}n=n.Next}while(n!==i.Pts)}},e.Clipper.Area=function(t){if(!Array.isArray(t))return 0;var e=t.length;if(e<3)return 0;for(var i=0,n=0,s=e-1;n<e;++n)i+=(t[s].X+t[n].X)*(t[s].Y-t[n].Y),s=n;return.5*-i},e.Clipper.prototype.Area=function(t){var e=t;if(null===t)return 0;var i=0;do{i+=(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next}while(t!==e);return.5*i},e.Clipper.prototype.Area$1=function(t){return this.Area(t.Pts)},e.Clipper.SimplifyPolygon=function(t,i){var n=new Array,s=new e.Clipper(0);return s.StrictlySimple=!0,s.AddPath(t,e.PolyType.ptSubject,!0),s.Execute(e.ClipType.ctUnion,n,i,i),n},e.Clipper.SimplifyPolygons=function(t,i){void 0===i&&(i=e.PolyFillType.pftEvenOdd);var n=new Array,s=new e.Clipper(0);return s.StrictlySimple=!0,s.AddPaths(t,e.PolyType.ptSubject,!0),s.Execute(e.ClipType.ctUnion,n,i,i),n},e.Clipper.DistanceSqrd=function(t,e){var i=t.X-e.X,n=t.Y-e.Y;return i*i+n*n},e.Clipper.DistanceFromLineSqrd=function(t,e,i){var n=e.Y-i.Y,s=i.X-e.X,r=n*e.X+s*e.Y;return(r=n*t.X+s*t.Y-r)*r/(n*n+s*s)},e.Clipper.SlopesNearCollinear=function(t,i,n,s){return Math.abs(t.X-i.X)>Math.abs(t.Y-i.Y)?t.X>i.X==t.X<n.X?e.Clipper.DistanceFromLineSqrd(t,i,n)<s:i.X>t.X==i.X<n.X?e.Clipper.DistanceFromLineSqrd(i,t,n)<s:e.Clipper.DistanceFromLineSqrd(n,t,i)<s:t.Y>i.Y==t.Y<n.Y?e.Clipper.DistanceFromLineSqrd(t,i,n)<s:i.Y>t.Y==i.Y<n.Y?e.Clipper.DistanceFromLineSqrd(i,t,n)<s:e.Clipper.DistanceFromLineSqrd(n,t,i)<s},e.Clipper.PointsAreClose=function(t,e,i){var n=t.X-e.X,s=t.Y-e.Y;return n*n+s*s<=i},e.Clipper.ExcludeOp=function(t){var e=t.Prev;return e.Next=t.Next,t.Next.Prev=e,e.Idx=0,e},e.Clipper.CleanPolygon=function(t,i){void 0===i&&(i=1.415);var n=t.length;if(0===n)return new Array;for(var s=new Array(n),r=0;r<n;++r)s[r]=new e.OutPt;for(r=0;r<n;++r)s[r].Pt=t[r],s[r].Next=s[(r+1)%n],s[r].Next.Prev=s[r],s[r].Idx=0;for(var o=i*i,l=s[0];0===l.Idx&&l.Next!==l.Prev;)e.Clipper.PointsAreClose(l.Pt,l.Prev.Pt,o)?(l=e.Clipper.ExcludeOp(l),n--):e.Clipper.PointsAreClose(l.Prev.Pt,l.Next.Pt,o)?(e.Clipper.ExcludeOp(l.Next),l=e.Clipper.ExcludeOp(l),n-=2):e.Clipper.SlopesNearCollinear(l.Prev.Pt,l.Pt,l.Next.Pt,o)?(l=e.Clipper.ExcludeOp(l),n--):(l.Idx=1,l=l.Next);n<3&&(n=0);var h=new Array(n);for(r=0;r<n;++r)h[r]=new e.FPoint1(l.Pt),l=l.Next;return s=null,h},e.Clipper.CleanPolygons=function(t,i){for(var n=new Array(t.length),s=0,r=t.length;s<r;s++)n[s]=e.Clipper.CleanPolygon(t[s],i);return n},e.Clipper.Minkowski=function(t,i,n,s){var r=s?1:0,o=t.length,l=i.length,h=new Array;if(n)for(var a=0;a<l;a++){for(var p=new Array(o),u=0,d=t.length,c=t[u];u<d;c=t[++u])p[u]=new e.FPoint2(i[a].X+c.X,i[a].Y+c.Y);h.push(p)}else for(a=0;a<l;a++){for(p=new Array(o),u=0,d=t.length,c=t[u];u<d;c=t[++u])p[u]=new e.FPoint2(i[a].X-c.X,i[a].Y-c.Y);h.push(p)}var f=new Array;for(a=0;a<l-1+r;a++)for(u=0;u<o;u++){var y=new Array;y.push(h[a%l][u%o]),y.push(h[(a+1)%l][u%o]),y.push(h[(a+1)%l][(u+1)%o]),y.push(h[a%l][(u+1)%o]),e.Clipper.Orientation(y)||y.reverse(),f.push(y)}return f},e.Clipper.MinkowskiSum=function(t,i,n){if(i[0]instanceof Array){a=i;for(var s=new e.Paths,r=(l=new e.Clipper,0);r<a.length;++r){var o=e.Clipper.Minkowski(t,a[r],!0,n);if(l.AddPaths(o,e.PolyType.ptSubject,!0),n){h=e.Clipper.TranslatePath(a[r],t[0]);l.AddPath(h,e.PolyType.ptClip,!0)}}return l.Execute(e.ClipType.ctUnion,s,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),s}var l,h=i,a=e.Clipper.Minkowski(t,h,!0,n);return(l=new e.Clipper).AddPaths(a,e.PolyType.ptSubject,!0),l.Execute(e.ClipType.ctUnion,a,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),a},e.Clipper.TranslatePath=function(t,i){for(var n=new e.Path,s=0;s<t.length;s++)n.push(new e.FPoint2(t[s].X+i.X,t[s].Y+i.Y));return n},e.Clipper.MinkowskiDiff=function(t,i){var n=e.Clipper.Minkowski(t,i,!1,!0),s=new e.Clipper;return s.AddPaths(n,e.PolyType.ptSubject,!0),s.Execute(e.ClipType.ctUnion,n,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),n},e.Clipper.PolyTreeToPaths=function(t){var i=new Array;return e.Clipper.AddPolyNodeToPaths(t,e.Clipper.NodeType.ntAny,i),i},e.Clipper.AddPolyNodeToPaths=function(t,i,n){var s=!0;switch(i){case e.Clipper.NodeType.ntOpen:return;case e.Clipper.NodeType.ntClosed:s=!t.IsOpen}t.m_polygon.length>0&&s&&n.push(t.m_polygon);for(var r=0,o=t.Childs(),l=o.length,h=o[r];r<l;h=o[++r])e.Clipper.AddPolyNodeToPaths(h,i,n)},e.Clipper.OpenPathsFromPolyTree=function(t){for(var i=new e.Paths,n=0,s=t.ChildCount();n<s;n++)t.Childs()[n].IsOpen&&i.push(t.Childs()[n].m_polygon);return i},e.Clipper.ClosedPathsFromPolyTree=function(t){var i=new e.Paths;return e.Clipper.AddPolyNodeToPaths(t,e.Clipper.NodeType.ntClosed,i),i},r(e.Clipper,e.ClipperBase),e.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},e.ClipperOffset=function(t,i){void 0===t&&(t=2),void 0===i&&(i=e.ClipperOffset.def_arc_tolerance),this.m_destPolys=new e.Paths,this.m_srcPoly=new e.Path,this.m_destPoly=new e.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new e.FPoint0,this.m_polyNodes=new e.PolyNode,this.MiterLimit=t,this.ArcTolerance=i,this.m_lowest.X=-1},e.ClipperOffset.two_pi=6.28318530717959,e.ClipperOffset.def_arc_tolerance=.25,e.ClipperOffset.prototype.Clear=function(){e.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},e.ClipperOffset.prototype.AddPath=function(t,i,n){var s=t.length-1;if(!(s<0)){var r=new e.PolyNode;if(r.m_jointype=i,r.m_endtype=n,n===e.EndType.etClosedLine||n===e.EndType.etClosedPolygon)for(;s>0&&e.FPoint.op_Equality(t[0],t[s]);)s--;r.m_polygon.push(t[0]);for(var o=0,l=0,h=1;h<=s;h++)e.FPoint.op_Inequality(r.m_polygon[o],t[h])&&(o++,r.m_polygon.push(t[h]),(t[h].Y>r.m_polygon[l].Y||t[h].Y===r.m_polygon[l].Y&&t[h].X<r.m_polygon[l].X)&&(l=o));if(!(n===e.EndType.etClosedPolygon&&o<2)&&(this.m_polyNodes.AddChild(r),n===e.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new e.FPoint2(this.m_polyNodes.ChildCount()-1,l);else{var a=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(r.m_polygon[l].Y>a.Y||r.m_polygon[l].Y===a.Y&&r.m_polygon[l].X<a.X)&&(this.m_lowest=new e.FPoint2(this.m_polyNodes.ChildCount()-1,l))}}},e.ClipperOffset.prototype.AddPaths=function(t,e,i){for(var n=0,s=t.length;n<s;n++)this.AddPath(t[n],e,i)},e.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!e.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var t=0;t<this.m_polyNodes.ChildCount();t++){((i=this.m_polyNodes.Childs()[t]).m_endtype===e.EndType.etClosedPolygon||i.m_endtype===e.EndType.etClosedLine&&e.Clipper.Orientation(i.m_polygon))&&i.m_polygon.reverse()}else for(t=0;t<this.m_polyNodes.ChildCount();t++){var i;(i=this.m_polyNodes.Childs()[t]).m_endtype!==e.EndType.etClosedLine||e.Clipper.Orientation(i.m_polygon)||i.m_polygon.reverse()}},e.ClipperOffset.GetUnitNormal=function(t,i){var n=i.X-t.X,s=i.Y-t.Y;if(0===n&&0===s)return new e.FPoint2(0,0);var r=1/Math.sqrt(n*n+s*s);return n*=r,s*=r,new e.FPoint2(s,-n)},e.ClipperOffset.prototype.DoOffset=function(t){if(this.m_destPolys=new Array,this.m_delta=t,e.ClipperBase.near_zero(t))for(var i=0;i<this.m_polyNodes.ChildCount();i++){(r=this.m_polyNodes.Childs()[i]).m_endtype===e.EndType.etClosedPolygon&&this.m_destPolys.push(r.m_polygon)}else{var n;this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5,n=this.ArcTolerance<=0?e.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*e.ClipperOffset.def_arc_tolerance?Math.abs(t)*e.ClipperOffset.def_arc_tolerance:this.ArcTolerance;var s=3.14159265358979/Math.acos(1-n/Math.abs(t));this.m_sin=Math.sin(e.ClipperOffset.two_pi/s),this.m_cos=Math.cos(e.ClipperOffset.two_pi/s),this.m_StepsPerRad=s/e.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(i=0;i<this.m_polyNodes.ChildCount();i++){var r=this.m_polyNodes.Childs()[i];this.m_srcPoly=r.m_polygon;var o=this.m_srcPoly.length;if(!(0===o||t<=0&&(o<3||r.m_endtype!==e.EndType.etClosedPolygon)))if(this.m_destPoly=new Array,1!==o){this.m_normals.length=0;for(d=0;d<o-1;d++)this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[d],this.m_srcPoly[d+1]));if(r.m_endtype===e.EndType.etClosedLine||r.m_endtype===e.EndType.etClosedPolygon?this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new e.FPoint1(this.m_normals[o-2])),r.m_endtype===e.EndType.etClosedPolygon){var l=o-1;for(d=0;d<o;d++)l=this.OffsetPoint(d,l,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(r.m_endtype===e.EndType.etClosedLine){for(l=o-1,d=0;d<o;d++)l=this.OffsetPoint(d,l,r.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;var h=this.m_normals[o-1];for(d=o-1;d>0;d--)this.m_normals[d]=new e.FPoint2(-this.m_normals[d-1].X,-this.m_normals[d-1].Y);this.m_normals[0]=new e.FPoint2(-h.X,-h.Y),l=0;for(d=o-1;d>=0;d--)l=this.OffsetPoint(d,l,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{var a;for(l=0,d=1;d<o-1;++d)l=this.OffsetPoint(d,l,r.m_jointype);if(r.m_endtype===e.EndType.etOpenButt){d=o-1;a=new e.FPoint2(this.m_srcPoly[d].X+this.m_normals[d].X*t,this.m_srcPoly[d].Y+this.m_normals[d].Y*t),this.m_destPoly.push(a),a=new e.FPoint2(this.m_srcPoly[d].X-this.m_normals[d].X*t,this.m_srcPoly[d].Y-this.m_normals[d].Y*t),this.m_destPoly.push(a)}else{d=o-1;l=o-2,this.m_sinA=0,this.m_normals[d]=new e.FPoint2(-this.m_normals[d].X,-this.m_normals[d].Y),r.m_endtype===e.EndType.etOpenSquare?this.DoSquare(d,l):this.DoRound(d,l)}for(d=o-1;d>0;d--)this.m_normals[d]=new e.FPoint2(-this.m_normals[d-1].X,-this.m_normals[d-1].Y);this.m_normals[0]=new e.FPoint2(-this.m_normals[1].X,-this.m_normals[1].Y);for(d=(l=o-1)-1;d>0;--d)l=this.OffsetPoint(d,l,r.m_jointype);r.m_endtype===e.EndType.etOpenButt?(a=new e.FPoint2(this.m_srcPoly[0].X-this.m_normals[0].X*t,this.m_srcPoly[0].Y-this.m_normals[0].Y*t),this.m_destPoly.push(a),a=new e.FPoint2(this.m_srcPoly[0].X+this.m_normals[0].X*t,this.m_srcPoly[0].Y+this.m_normals[0].Y*t),this.m_destPoly.push(a)):(l=1,this.m_sinA=0,r.m_endtype===e.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}else{if(r.m_jointype===e.JoinType.jtRound)for(var p=1,u=0,d=1;d<=s;d++){this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[0].X+p*t,this.m_srcPoly[0].Y+u*t));var c=p;p=p*this.m_cos-this.m_sin*u,u=c*this.m_sin+u*this.m_cos}else{p=-1,u=-1;for(var d=0;d<4;++d)this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[0].X+p*t,this.m_srcPoly[0].Y+u*t)),p<0?p=1:u<0?u=1:p=-1}this.m_destPolys.push(this.m_destPoly)}}}},e.ClipperOffset.prototype.Execute=function(){var t=arguments;if(t[0]instanceof e.PolyTree){o=t[1];if((r=t[0]).Clear(),this.FixOrientations(),this.DoOffset(o),(s=new e.Clipper(0)).AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),o>0)s.Execute(e.ClipType.ctUnion,r,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{h=e.Clipper.GetBounds(this.m_destPolys);if((l=new e.Path).push(new e.FPoint2(h.left-10,h.bottom+10)),l.push(new e.FPoint2(h.right+10,h.bottom+10)),l.push(new e.FPoint2(h.right+10,h.top-10)),l.push(new e.FPoint2(h.left-10,h.top-10)),s.AddPath(l,e.PolyType.ptSubject,!0),s.ReverseSolution=!0,s.Execute(e.ClipType.ctUnion,r,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),1===r.ChildCount()&&r.Childs()[0].ChildCount()>0){var i=r.Childs()[0];r.Childs()[0]=i.Childs()[0],r.Childs()[0].m_Parent=r;for(var n=1;n<i.ChildCount();n++)r.AddChild(i.Childs()[n])}else r.Clear()}}else{var s,r=t[0],o=t[1];if(e.Clear(r),this.FixOrientations(),this.DoOffset(o),(s=new e.Clipper(0)).AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),o>0)s.Execute(e.ClipType.ctUnion,r,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var l,h=e.Clipper.GetBounds(this.m_destPolys);(l=new e.Path).push(new e.FPoint2(h.left-10,h.bottom+10)),l.push(new e.FPoint2(h.right+10,h.bottom+10)),l.push(new e.FPoint2(h.right+10,h.top-10)),l.push(new e.FPoint2(h.left-10,h.top-10)),s.AddPath(l,e.PolyType.ptSubject,!0),s.ReverseSolution=!0,s.Execute(e.ClipType.ctUnion,r,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}},e.ClipperOffset.prototype.OffsetPoint=function(t,i,n){if(this.m_sinA=this.m_normals[i].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[i].Y,0===this.m_sinA)return i;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_normals[i].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[i].Y*this.m_delta)),this.m_destPoly.push(new e.FPoint1(this.m_srcPoly[t])),this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta));else switch(n){case e.JoinType.jtMiter:var s=this.m_normals[t].X*this.m_normals[i].X+this.m_normals[t].Y*this.m_normals[i].Y+1;s>=this.m_miterLim?this.DoMiter(t,i,s):this.DoSquare(t,i);break;case e.JoinType.jtSquare:this.DoSquare(t,i);break;case e.JoinType.jtRound:this.DoRound(t,i)}return i=t},e.ClipperOffset.prototype.DoSquare=function(t,i){var n=Math.tan(Math.atan2(this.m_sinA,this.m_normals[i].X*this.m_normals[t].X+this.m_normals[i].Y*this.m_normals[t].Y)/4);this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[i].X-this.m_normals[i].Y*n),this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[i].Y+this.m_normals[i].X*n))),this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*n),this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*n)))},e.ClipperOffset.prototype.DoMiter=function(t,i,n){var s=this.m_delta/n;this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+(this.m_normals[i].X+this.m_normals[t].X)*s,this.m_srcPoly[t].Y+(this.m_normals[i].Y+this.m_normals[t].Y)*s))},e.ClipperOffset.prototype.DoRound=function(t,i){for(var n,s=Math.atan2(this.m_sinA,this.m_normals[i].X*this.m_normals[t].X+this.m_normals[i].Y*this.m_normals[t].Y),r=Math.max(Math.round(this.m_StepsPerRad*Math.abs(s)),1),o=this.m_normals[i].X,l=this.m_normals[i].Y,h=0;h<r;++h)this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+o*this.m_delta,this.m_srcPoly[t].Y+l*this.m_delta)),n=o,o=o*this.m_cos-this.m_sin*l,l=n*this.m_sin+l*this.m_cos;this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta))},e.Error=function(t){try{throw new Error(t)}catch(t){alert(t.message)}},e.JS={},e.JS.AreaOfPolygon=function(t){return e.Clipper.Area(t)},e.JS.AreaOfPolygons=function(t){for(var i=0,n=0;n<t.length;n++)i+=e.Clipper.Area(t[n]);return i},e.JS.BoundsOfPath=function(t){return e.JS.BoundsOfPaths([t])},e.JS.BoundsOfPaths=function(t){return e.Clipper.GetBounds(t)},e.JS.Clean=function(t,i){if(!(t instanceof Array))return[];var n=t[0]instanceof Array;t=e.JS.Clone(t);if("number"!=typeof i||null===i)return e.Error("Delta is not a number in Clean()."),t;if(0===t.length||1===t.length&&0===t[0].length||i<0)return t;n||(t=[t]);for(var s,r,o,l,h,a,p,u=t.length,d=[],c=0;c<u;c++)if(0!==(s=(r=t[c]).length))if(s<3)o=r,d.push(o);else{for(o=r,l=i*i,h=r[0],a=1,p=1;p<s;p++)(r[p].X-h.X)*(r[p].X-h.X)+(r[p].Y-h.Y)*(r[p].Y-h.Y)<=l||(o[a]=r[p],h=r[p],a++);h=r[a-1],(r[0].X-h.X)*(r[0].X-h.X)+(r[0].Y-h.Y)*(r[0].Y-h.Y)<=l&&a--,a<s&&o.splice(a,s-a),o.length&&d.push(o)}return!n&&d.length?d=d[0]:n||0!==d.length?n&&0===d.length&&(d=[[]]):d=[],d},e.JS.Clone=function(t){if(!(t instanceof Array))return[];if(0===t.length)return[];if(1===t.length&&0===t[0].length)return[[]];var e=t[0]instanceof Array;e||(t=[t]);var i,n,s,r,o=t.length,l=new Array(o);for(n=0;n<o;n++){for(i=t[n].length,r=new Array(i),s=0;s<i;s++)r[s]={X:t[n][s].X,Y:t[n][s].Y};l[n]=r}return e||(l=l[0]),l},e.JS.Lighten=function(t,i){if(!(t instanceof Array))return[];if("number"!=typeof i||null===i)return e.Error("Tolerance is not a number in Lighten()."),e.JS.Clone(t);if(0===t.length||1===t.length&&0===t[0].length||i<0)return e.JS.Clone(t);var n,s,r,o,l,h,a,p,u,d,c,f,y,x,g,P,m=t[0]instanceof Array;m||(t=[t]);var v=t.length,C=i*i,_=[];for(n=0;n<v;n++)if(0!==(h=(r=t[n]).length)){for(o=0;o<1e6;o++){for(l=[],r[(h=r.length)-1].X!==r[0].X||r[h-1].Y!==r[0].Y?(c=1,r.push({X:r[0].X,Y:r[0].Y}),h=r.length):c=0,d=[],s=0;s<h-2;s++)a=r[s],u=r[s+1],p=r[s+2],g=a.X,P=a.Y,f=p.X-g,y=p.Y-P,0===f&&0===y||((x=((u.X-g)*f+(u.Y-P)*y)/(f*f+y*y))>1?(g=p.X,P=p.Y):x>0&&(g+=f*x,P+=y*x)),(f=u.X-g)*f+(y=u.Y-P)*y<=C&&(d[s+1]=1,s++);for(l.push({X:r[0].X,Y:r[0].Y}),s=1;s<h-1;s++)d[s]||l.push({X:r[s].X,Y:r[s].Y});if(l.push({X:r[h-1].X,Y:r[h-1].Y}),c&&r.pop(),!d.length)break;r=l}l[(h=l.length)-1].X===l[0].X&&l[h-1].Y===l[0].Y&&l.pop(),l.length>2&&_.push(l)}return m||(_=_[0]),void 0===_&&(_=[]),_},e.JS.PerimeterOfPath=function(t,e){if(void 0===t)return 0;var i,n,s=Math.sqrt,r=0,o=0,l=0,h=0,a=0,p=t.length;if(p<2)return 0;for(e&&(t[p]=t[0],p++);--p;)o=(i=t[p]).X,l=i.Y,r+=s((o-(h=(n=t[p-1]).X))*(o-h)+(l-(a=n.Y))*(l-a));return e&&t.pop(),r},e.JS.PerimeterOfPaths=function(t,i){for(var n=0,s=0;s<t.length;s++)n+=e.JS.PerimeterOfPath(t[s],i);return n},e.ExPolygons=function(){return[]},e.ExPolygon=function(){this.outer=null,this.holes=null},e.JS.AddOuterPolyNodeToExPolygons=function(t,i){var n=new e.ExPolygon;n.outer=t.Contour();var s,r,o,l,h,a,p=t.Childs(),u=p.length;for(n.holes=new Array(u),o=0;o<u;o++)for(s=p[o],n.holes[o]=s.Contour(),l=0,a=(h=s.Childs()).length;l<a;l++)r=h[l],e.JS.AddOuterPolyNodeToExPolygons(r,i);i.push(n)},e.JS.ExPolygonsToPaths=function(t){var i,n,s,r,o=new e.Paths;for(i=0,s=t.length;i<s;i++)for(o.push(t[i].outer),n=0,r=t[i].holes.length;n<r;n++)o.push(t[i].holes[n]);return o},e.JS.PolyTreeToExPolygons=function(t){var i,n,s,r,o=new e.ExPolygons;for(n=0,r=(s=t.Childs()).length;n<r;n++)i=s[n],e.JS.AddOuterPolyNodeToExPolygons(i,o);return o}}()},1791:t=>{"use strict";function e(t,e,r){r=r||2;var o,l,h,u,d,f,y,x=e&&e.length,g=x?e[0]*r:t.length,P=i(t,0,g,r,!0),m=[];if(!P||P.next===P.prev)return m;if(x&&(P=function(t,e,s,r){var o,l,h,u=[];for(o=0,l=e.length;o<l;o++)(h=i(t,e[o]*r,o<l-1?e[o+1]*r:t.length,r,!1))===h.next&&(h.steiner=!0),u.push(c(h));for(u.sort(a),o=0;o<u.length;o++)s=n(s=p(u[o],s),s.next);return s}(t,e,P,r)),t.length>80*r){o=h=t[0],l=u=t[1];for(var v=r;v<g;v+=r)(d=t[v])<o&&(o=d),(f=t[v+1])<l&&(l=f),d>h&&(h=d),f>u&&(u=f);y=0!==(y=Math.max(h-o,u-l))?1/y:0}return s(P,m,r,o,l,y),m}function i(t,e,i,n,s){var r,o;if(s===b(t,e,i,n)>0)for(r=e;r<i;r+=n)o=I(r,t[r],t[r+1],o);else for(r=i-n;r>=e;r-=n)o=I(r,t[r],t[r+1],o);return o&&g(o,o.next)&&(E(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!g(n,n.next)&&0!==x(n.prev,n,n.next))n=n.next;else{if(E(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function s(t,e,i,a,p,u,c){if(t){!c&&u&&function(t,e,i,n){var s=t;do{null===s.z&&(s.z=d(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,l,h,a=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,l=0,e=0;e<a&&(l++,n=n.nextZ);e++);for(h=a;l>0||h>0&&n;)0!==l&&(0===h||!n||i.z<=n.z)?(s=i,i=i.nextZ,l--):(s=n,n=n.nextZ,h--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,a*=2}while(o>1)}(s)}(t,a,p,u);for(var f,y,x=t;t.prev!==t.next;)if(f=t.prev,y=t.next,u?o(t,a,p,u):r(t))e.push(f.i/i),e.push(t.i/i),e.push(y.i/i),E(t),t=y.next,x=y.next;else if((t=y)===x){c?1===c?s(t=l(n(t),e,i),e,i,a,p,u,2):2===c&&h(t,e,i,a,p,u):s(n(t),e,i,a,p,u,1);break}}}function r(t){var e=t.prev,i=t,n=t.next;if(x(e,i,n)>=0)return!1;for(var s=t.next.next;s!==t.prev;){if(f(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&x(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function o(t,e,i,n){var s=t.prev,r=t,o=t.next;if(x(s,r,o)>=0)return!1;for(var l=s.x<r.x?s.x<o.x?s.x:o.x:r.x<o.x?r.x:o.x,h=s.y<r.y?s.y<o.y?s.y:o.y:r.y<o.y?r.y:o.y,a=s.x>r.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,p=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,u=d(l,h,e,i,n),c=d(a,p,e,i,n),y=t.prevZ,g=t.nextZ;y&&y.z>=u&&g&&g.z<=c;){if(y!==t.prev&&y!==t.next&&f(s.x,s.y,r.x,r.y,o.x,o.y,y.x,y.y)&&x(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,g!==t.prev&&g!==t.next&&f(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&x(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;y&&y.z>=u;){if(y!==t.prev&&y!==t.next&&f(s.x,s.y,r.x,r.y,o.x,o.y,y.x,y.y)&&x(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;g&&g.z<=c;){if(g!==t.prev&&g!==t.next&&f(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&x(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function l(t,e,i){var s=t;do{var r=s.prev,o=s.next.next;!g(r,o)&&P(r,s,s.next,o)&&C(r,o)&&C(o,r)&&(e.push(r.i/i),e.push(s.i/i),e.push(o.i/i),E(s),E(s.next),s=t=o),s=s.next}while(s!==t);return n(s)}function h(t,e,i,r,o,l){var h=t;do{for(var a=h.next.next;a!==h.prev;){if(h.i!==a.i&&y(h,a)){var p=_(h,a);return h=n(h,h.next),p=n(p,p.next),s(h,e,i,r,o,l),void s(p,e,i,r,o,l)}a=a.next}h=h.next}while(h!==t)}function a(t,e){return t.x-e.x}function p(t,e){var i=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var l=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(l<=s&&l>o){if(o=l,l===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!i)return null;if(s===o)return i;var h,a=i,p=i.x,d=i.y,c=1/0;n=i;do{s>=n.x&&n.x>=p&&s!==n.x&&f(r<d?s:o,r,p,d,r<d?o:s,r,n.x,n.y)&&(h=Math.abs(r-n.y)/(s-n.x),C(n,t)&&(h<c||h===c&&(n.x>i.x||n.x===i.x&&u(i,n)))&&(i=n,c=h)),n=n.next}while(n!==a);return i}(t,e);if(!i)return e;var s=_(i,t),r=n(i,i.next);return n(s,s.next),e===i?r:e}function u(t,e){return x(t.prev,t,e.prev)<0&&x(e.next,t,t.next)<0}function d(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function c(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function f(t,e,i,n,s,r,o,l){return(s-o)*(e-l)-(t-o)*(r-l)>=0&&(t-o)*(n-l)-(i-o)*(e-l)>=0&&(i-o)*(r-l)-(s-o)*(n-l)>=0}function y(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&P(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(C(t,e)&&C(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(x(t.prev,t,e.prev)||x(t,e.prev,e))||g(t,e)&&x(t.prev,t,t.next)>0&&x(e.prev,e,e.next)>0)}function x(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function g(t,e){return t.x===e.x&&t.y===e.y}function P(t,e,i,n){var s=v(x(t,e,i)),r=v(x(t,e,n)),o=v(x(i,n,t)),l=v(x(i,n,e));return s!==r&&o!==l||(!(0!==s||!m(t,i,e))||(!(0!==r||!m(t,n,e))||(!(0!==o||!m(i,t,n))||!(0!==l||!m(i,e,n)))))}function m(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function v(t){return t>0?1:t<0?-1:0}function C(t,e){return x(t.prev,t,t.next)<0?x(t,e,t.next)>=0&&x(t,t.prev,e)>=0:x(t,e,t.prev)<0||x(t,t.next,e)<0}function _(t,e){var i=new T(t.i,t.x,t.y),n=new T(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function I(t,e,i,n){var s=new T(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function E(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function T(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function b(t,e,i,n){for(var s=0,r=e,o=i-n;r<i;r+=n)s+=(t[o]-t[r])*(t[r+1]+t[o+1]),o=r;return s}t.exports=e,t.exports.default=e,e.deviation=function(t,e,i,n){var s=e&&e.length,r=s?e[0]*i:t.length,o=Math.abs(b(t,0,r,i));if(s)for(var l=0,h=e.length;l<h;l++){var a=e[l]*i,p=l<h-1?e[l+1]*i:t.length;o-=Math.abs(b(t,a,p,i))}var u=0;for(l=0;l<n.length;l+=3){var d=n[l]*i,c=n[l+1]*i,f=n[l+2]*i;u+=Math.abs((t[d]-t[f])*(t[c+1]-t[d+1])-(t[d]-t[c])*(t[f+1]-t[d+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},e.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,s=0;s<t.length;s++){for(var r=0;r<t[s].length;r++)for(var o=0;o<e;o++)i.vertices.push(t[s][r][o]);s>0&&(n+=t[s-1].length,i.holes.push(n))}return i}},2752:t=>{"use strict";var e=function(t,e){this.head_=t,this.tail_=e,this.search_node_=t};e.prototype.head=function(){return this.head_},e.prototype.setHead=function(t){this.head_=t},e.prototype.tail=function(){return this.tail_},e.prototype.setTail=function(t){this.tail_=t},e.prototype.search=function(){return this.search_node_},e.prototype.setSearch=function(t){this.search_node_=t},e.prototype.findSearchNode=function(){return this.search_node_},e.prototype.locateNode=function(t){var e=this.search_node_;if(t<e.value){for(;e=e.prev;)if(t>=e.value)return this.search_node_=e,e}else for(;e=e.next;)if(t<e.value)return this.search_node_=e.prev,e.prev;return null},e.prototype.locatePoint=function(t){var e=t.x,i=this.findSearchNode(e),n=i.point.x;if(e===n){if(t!==i.point)if(t===i.prev.point)i=i.prev;else{if(t!==i.next.point)throw new Error("poly2tri Invalid AdvancingFront.locatePoint() call");i=i.next}}else if(e<n)for(;(i=i.prev)&&t!==i.point;);else for(;(i=i.next)&&t!==i.point;);return i&&(this.search_node_=i),i},t.exports=e,t.exports.Node=function(t,e){this.point=t,this.triangle=e||null,this.next=null,this.prev=null,this.value=t.x}},2014:t=>{"use strict";t.exports=function(t,e){if(!t)throw new Error(e||"Assert Failed")}},1688:(t,e,i)=>{"use strict";var n=i(9071),s=function(t,e){this.x=+t||0,this.y=+e||0,this._p2t_edge_list=null};s.prototype.toString=function(){return n.toStringBase(this)},s.prototype.toJSON=function(){return{x:this.x,y:this.y}},s.prototype.clone=function(){return new s(this.x,this.y)},s.prototype.set_zero=function(){return this.x=0,this.y=0,this},s.prototype.set=function(t,e){return this.x=+t||0,this.y=+e||0,this},s.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},s.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},s.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},s.prototype.mul=function(t){return this.x*=t,this.y*=t,this},s.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},s.prototype.normalize=function(){var t=this.length();return this.x/=t,this.y/=t,t},s.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},s.negate=function(t){return new s(-t.x,-t.y)},s.add=function(t,e){return new s(t.x+e.x,t.y+e.y)},s.sub=function(t,e){return new s(t.x-e.x,t.y-e.y)},s.mul=function(t,e){return new s(t*e.x,t*e.y)},s.cross=function(t,e){return"number"==typeof t?"number"==typeof e?t*e:new s(-t*e.y,t*e.x):"number"==typeof e?new s(e*t.y,-e*t.x):t.x*e.y-t.y*e.x},s.toString=n.toString,s.compare=n.compare,s.cmp=n.compare,s.equals=n.equals,s.dot=function(t,e){return t.x*e.x+t.y*e.y},t.exports=s},3704:(t,e,i)=>{"use strict";var n=i(9071),s=function(t,e){this.name="PointError",this.points=e=e||[],this.message=t||"Invalid Points!";for(var i=0;i<e.length;i++)this.message+=" "+n.toString(e[i])};(s.prototype=new Error).constructor=s,t.exports=s},4813:(t,e,i)=>{"use strict";var n=i.g.poly2tri;e.noConflict=function(){return i.g.poly2tri=n,e},e.VERSION=i(3095).version,e.PointError=i(3704),e.Point=i(1688),e.Triangle=i(1580),e.SweepContext=i(2115);var s=i(1110);e.triangulate=s.triangulate,e.sweep={Triangulate:s.triangulate}},1110:(t,e,i)=>{"use strict";var n=i(2014),s=i(3704),r=i(1580),o=i(2752).Node,l=i(4555),h=l.EPSILON,a=l.Orientation,p=l.orient2d,u=l.inScanArea,d=l.isAngleObtuse;function c(t,e){var i=t.locateNode(e),s=function(t,e,i){var n=new r(e,i.point,i.next.point);n.markNeighbor(i.triangle),t.addToMap(n);var s=new o(e);s.next=i.next,s.prev=i,i.next.prev=s,i.next=s,P(t,n)||t.mapTriangleToNodes(n);return s}(t,e,i);return e.x<=i.point.x+h&&g(t,i),function(t,e){var i=e.next;for(;i.next&&!d(i.point,i.next.point,i.prev.point);)g(t,i),i=i.next;i=e.prev;for(;i.prev&&!d(i.point,i.next.point,i.prev.point);)g(t,i),i=i.prev;e.next&&e.next.next&&function(t){var e=t.point.x-t.next.next.point.x,i=t.point.y-t.next.next.point.y;return n(i>=0,"unordered y"),e>=0||Math.abs(e)<i}(e)&&function(t,e){p(e.point,e.next.point,e.next.next.point)===a.CCW?t.basin.left_node=e.next.next:t.basin.left_node=e.next;t.basin.bottom_node=t.basin.left_node;for(;t.basin.bottom_node.next&&t.basin.bottom_node.point.y>=t.basin.bottom_node.next.point.y;)t.basin.bottom_node=t.basin.bottom_node.next;if(t.basin.bottom_node===t.basin.left_node)return;t.basin.right_node=t.basin.bottom_node;for(;t.basin.right_node.next&&t.basin.right_node.point.y<t.basin.right_node.next.point.y;)t.basin.right_node=t.basin.right_node.next;if(t.basin.right_node===t.basin.bottom_node)return;t.basin.width=t.basin.right_node.point.x-t.basin.left_node.point.x,t.basin.left_highest=t.basin.left_node.point.y>t.basin.right_node.point.y,C(t,t.basin.bottom_node)}(t,e)}(t,s),s}function f(t,e,i){t.edge_event.constrained_edge=e,t.edge_event.right=e.p.x>e.q.x,x(i.triangle,e.p,e.q)||(!function(t,e,i){t.edge_event.right?function(t,e,i){for(;i.next.point.x<e.p.x;)p(e.q,i.next.point,e.p)===a.CCW?_(t,e,i):i=i.next}(t,e,i):function(t,e,i){for(;i.prev.point.x>e.p.x;)p(e.q,i.prev.point,e.p)===a.CW?T(t,e,i):i=i.prev}(t,e,i)}(t,e,i),y(t,e.p,e.q,i.triangle,e.q))}function y(t,e,i,n,r){if(!x(n,e,i)){var o=n.pointCCW(r),l=p(i,o,e);if(l===a.COLLINEAR)throw new s("poly2tri EdgeEvent: Collinear not supported!",[i,o,e]);var h=n.pointCW(r),u=p(i,h,e);if(u===a.COLLINEAR)throw new s("poly2tri EdgeEvent: Collinear not supported!",[i,h,e]);l===u?y(t,e,i,n=l===a.CW?n.neighborCCW(r):n.neighborCW(r),r):S(t,e,i,n,r)}}function x(t,e,i){var n=t.edgeIndex(e,i);if(-1!==n){t.markConstrainedEdgeByIndex(n);var s=t.getNeighbor(n);return s&&s.markConstrainedEdgeByPoints(e,i),!0}return!1}function g(t,e){var i=new r(e.prev.point,e.point,e.next.point);i.markNeighbor(e.prev.triangle),i.markNeighbor(e.triangle),t.addToMap(i),e.prev.next=e.next,e.next.prev=e.prev,P(t,i)||t.mapTriangleToNodes(i)}function P(t,e){for(var i=0;i<3;++i)if(!e.delaunay_edge[i]){var n=e.getNeighbor(i);if(n){var s=e.getPoint(i),r=n.oppositePoint(e,s),o=n.index(r);if(n.constrained_edge[o]||n.delaunay_edge[o]){e.constrained_edge[i]=n.constrained_edge[o];continue}if(m(s,e.pointCCW(s),e.pointCW(s),r)){e.delaunay_edge[i]=!0,n.delaunay_edge[o]=!0,v(e,s,n,r);var l=!P(t,e);return l&&t.mapTriangleToNodes(e),(l=!P(t,n))&&t.mapTriangleToNodes(n),e.delaunay_edge[i]=!1,n.delaunay_edge[o]=!1,!0}}}return!1}function m(t,e,i,n){var s=t.x-n.x,r=t.y-n.y,o=e.x-n.x,l=e.y-n.y,h=s*l-o*r;if(h<=0)return!1;var a=i.x-n.x,p=i.y-n.y,u=a*r-s*p;return!(u<=0)&&(s*s+r*r)*(o*p-a*l)+(o*o+l*l)*u+(a*a+p*p)*h>0}function v(t,e,i,n){var s,r,o,l,h,a,p,u,d,c,f,y;s=t.neighborCCW(e),r=t.neighborCW(e),o=i.neighborCCW(n),l=i.neighborCW(n),h=t.getConstrainedEdgeCCW(e),a=t.getConstrainedEdgeCW(e),p=i.getConstrainedEdgeCCW(n),u=i.getConstrainedEdgeCW(n),d=t.getDelaunayEdgeCCW(e),c=t.getDelaunayEdgeCW(e),f=i.getDelaunayEdgeCCW(n),y=i.getDelaunayEdgeCW(n),t.legalize(e,n),i.legalize(n,e),i.setDelaunayEdgeCCW(e,d),t.setDelaunayEdgeCW(e,c),t.setDelaunayEdgeCCW(n,f),i.setDelaunayEdgeCW(n,y),i.setConstrainedEdgeCCW(e,h),t.setConstrainedEdgeCW(e,a),t.setConstrainedEdgeCCW(n,p),i.setConstrainedEdgeCW(n,u),t.clearNeighbors(),i.clearNeighbors(),s&&i.markNeighbor(s),r&&t.markNeighbor(r),o&&t.markNeighbor(o),l&&i.markNeighbor(l),t.markNeighbor(i)}function C(t,e){if(!function(t,e){var i;i=t.basin.left_highest?t.basin.left_node.point.y-e.point.y:t.basin.right_node.point.y-e.point.y;if(t.basin.width>i)return!0;return!1}(t,e)&&(g(t,e),e.prev!==t.basin.left_node||e.next!==t.basin.right_node)){if(e.prev===t.basin.left_node){if(p(e.point,e.next.point,e.next.next.point)===a.CW)return;e=e.next}else if(e.next===t.basin.right_node){if(p(e.point,e.prev.point,e.prev.prev.point)===a.CCW)return;e=e.prev}else e=e.prev.point.y<e.next.point.y?e.prev:e.next;C(t,e)}}function _(t,e,i){i.point.x<e.p.x&&(p(i.point,i.next.point,i.next.next.point)===a.CCW?I(t,e,i):(E(t,e,i),_(t,e,i)))}function I(t,e,i){g(t,i.next),i.next.point!==e.p&&p(e.q,i.next.point,e.p)===a.CCW&&p(i.point,i.next.point,i.next.next.point)===a.CCW&&I(t,e,i)}function E(t,e,i){p(i.next.point,i.next.next.point,i.next.next.next.point)===a.CCW?I(t,e,i.next):p(e.q,i.next.next.point,e.p)===a.CCW&&E(t,e,i.next)}function T(t,e,i){i.point.x>e.p.x&&(p(i.point,i.prev.point,i.prev.prev.point)===a.CW?L(t,e,i):(b(t,e,i),T(t,e,i)))}function b(t,e,i){p(i.prev.point,i.prev.prev.point,i.prev.prev.prev.point)===a.CW?L(t,e,i.prev):p(e.q,i.prev.prev.point,e.p)===a.CW&&b(t,e,i.prev)}function L(t,e,i){g(t,i.prev),i.prev.point!==e.p&&p(e.q,i.prev.point,e.p)===a.CW&&p(i.point,i.prev.point,i.prev.prev.point)===a.CW&&L(t,e,i)}function S(t,e,i,r,o){var l=r.neighborAcross(o);n(l,"FLIP failed due to missing triangle!");var h=l.oppositePoint(r,o);if(r.getConstrainedEdgeAcross(o)){var d=r.index(o);throw new s("poly2tri Intersecting Constraints",[o,h,r.getPoint((d+1)%3),r.getPoint((d+2)%3)])}u(o,r.pointCCW(o),r.pointCW(o),h)?(v(r,o,l,h),t.mapTriangleToNodes(r),t.mapTriangleToNodes(l),o===i&&h===e?i===t.edge_event.constrained_edge.q&&e===t.edge_event.constrained_edge.p&&(r.markConstrainedEdgeByPoints(e,i),l.markConstrainedEdgeByPoints(e,i),P(t,r),P(t,l)):(r=function(t,e,i,n,s,r){var o;if(e===a.CCW)return o=n.edgeIndex(s,r),n.delaunay_edge[o]=!0,P(t,n),n.clearDelaunayEdges(),i;return o=i.edgeIndex(s,r),i.delaunay_edge[o]=!0,P(t,i),i.clearDelaunayEdges(),n}(t,p(i,h,e),r,l,o,h),S(t,e,i,r,o))):(N(t,e,i,r,l,A(e,i,l,h)),y(t,e,i,r,o))}function A(t,e,i,n){var r=p(e,n,t);if(r===a.CW)return i.pointCCW(n);if(r===a.CCW)return i.pointCW(n);throw new s("poly2tri [Unsupported] nextFlipPoint: opposing point on constrained edge!",[e,n,t])}function N(t,e,i,s,r,o){var l=r.neighborAcross(o);n(l,"FLIP failed due to missing triangle");var h=l.oppositePoint(r,o);u(i,s.pointCCW(i),s.pointCW(i),h)?S(t,i,h,l,h):N(t,e,i,s,l,A(e,i,l,h))}e.triangulate=function(t){t.initTriangulation(),t.createAdvancingFront(),function(t){var e,i=t.pointCount();for(e=1;e<i;++e)for(var n=t.getPoint(e),s=c(t,n),r=n._p2t_edge_list,o=0;r&&o<r.length;++o)f(t,r[o],s)}(t),function(t){var e=t.front().head().next.triangle,i=t.front().head().next.point;for(;!e.getConstrainedEdgeCW(i);)e=e.neighborCCW(i);t.meshClean(e)}(t)}},2115:(t,e,i)=>{"use strict";var n=i(3704),s=i(1688),r=i(1580),o=i(1110),l=i(2752),h=l.Node,a=function(t,e){if(this.p=t,this.q=e,t.y>e.y)this.q=t,this.p=e;else if(t.y===e.y)if(t.x>e.x)this.q=t,this.p=e;else if(t.x===e.x)throw new n("poly2tri Invalid Edge constructor: repeated points!",[t]);this.q._p2t_edge_list||(this.q._p2t_edge_list=[]),this.q._p2t_edge_list.push(this)},p=function(){this.left_node=null,this.bottom_node=null,this.right_node=null,this.width=0,this.left_highest=!1};p.prototype.clear=function(){this.left_node=null,this.bottom_node=null,this.right_node=null,this.width=0,this.left_highest=!1};var u=function(){this.constrained_edge=null,this.right=!1},d=function(t,e){e=e||{},this.triangles_=[],this.map_=[],this.points_=e.cloneArrays?t.slice(0):t,this.edge_list=[],this.pmin_=this.pmax_=null,this.front_=null,this.head_=null,this.tail_=null,this.af_head_=null,this.af_middle_=null,this.af_tail_=null,this.basin=new p,this.edge_event=new u,this.initEdges(this.points_)};d.prototype.addHole=function(t){this.initEdges(t);var e,i=t.length;for(e=0;e<i;e++)this.points_.push(t[e]);return this},d.prototype.AddHole=d.prototype.addHole,d.prototype.addHoles=function(t){var e,i=t.length;for(e=0;e<i;e++)this.initEdges(t[e]);return this.points_=this.points_.concat.apply(this.points_,t),this},d.prototype.addPoint=function(t){return this.points_.push(t),this},d.prototype.AddPoint=d.prototype.addPoint,d.prototype.addPoints=function(t){return this.points_=this.points_.concat(t),this},d.prototype.triangulate=function(){return o.triangulate(this),this},d.prototype.getBoundingBox=function(){return{min:this.pmin_,max:this.pmax_}},d.prototype.getTriangles=function(){return this.triangles_},d.prototype.GetTriangles=d.prototype.getTriangles,d.prototype.front=function(){return this.front_},d.prototype.pointCount=function(){return this.points_.length},d.prototype.head=function(){return this.head_},d.prototype.setHead=function(t){this.head_=t},d.prototype.tail=function(){return this.tail_},d.prototype.setTail=function(t){this.tail_=t},d.prototype.getMap=function(){return this.map_},d.prototype.initTriangulation=function(){var t,e=this.points_[0].x,i=this.points_[0].x,n=this.points_[0].y,r=this.points_[0].y,o=this.points_.length;for(t=1;t<o;t++){var l=this.points_[t];l.x>e&&(e=l.x),l.x<i&&(i=l.x),l.y>n&&(n=l.y),l.y<r&&(r=l.y)}this.pmin_=new s(i,r),this.pmax_=new s(e,n);var h=.3*(e-i),a=.3*(n-r);this.head_=new s(e+h,r-a),this.tail_=new s(i-h,r-a),this.points_.sort(s.compare)},d.prototype.initEdges=function(t){var e,i=t.length;for(e=0;e<i;++e)this.edge_list.push(new a(t[e],t[(e+1)%i]))},d.prototype.getPoint=function(t){return this.points_[t]},d.prototype.addToMap=function(t){this.map_.push(t)},d.prototype.locateNode=function(t){return this.front_.locateNode(t.x)},d.prototype.createAdvancingFront=function(){var t,e,i,n=new r(this.points_[0],this.tail_,this.head_);this.map_.push(n),t=new h(n.getPoint(1),n),e=new h(n.getPoint(0),n),i=new h(n.getPoint(2)),this.front_=new l(t,i),t.next=e,e.next=i,e.prev=t,i.prev=e},d.prototype.removeNode=function(t){},d.prototype.mapTriangleToNodes=function(t){for(var e=0;e<3;++e)if(!t.getNeighbor(e)){var i=this.front_.locatePoint(t.pointCW(t.getPoint(e)));i&&(i.triangle=t)}},d.prototype.removeFromMap=function(t){var e,i=this.map_,n=i.length;for(e=0;e<n;e++)if(i[e]===t){i.splice(e,1);break}},d.prototype.meshClean=function(t){for(var e,i,n=[t];e=n.pop();)if(!e.isInterior())for(e.setInterior(!0),this.triangles_.push(e),i=0;i<3;i++)e.constrained_edge[i]||n.push(e.getNeighbor(i))},t.exports=d},1580:(t,e,i)=>{"use strict";var n=function(t,e,i){this.points_=[t,e,i],this.neighbors_=[null,null,null],this.interior_=!1,this.constrained_edge=[!1,!1,!1],this.delaunay_edge=[!1,!1,!1]},s=i(9071).toString;n.prototype.toString=function(){return"["+s(this.points_[0])+s(this.points_[1])+s(this.points_[2])+"]"},n.prototype.getPoint=function(t){return this.points_[t]},n.prototype.GetPoint=n.prototype.getPoint,n.prototype.getPoints=function(){return this.points_},n.prototype.getNeighbor=function(t){return this.neighbors_[t]},n.prototype.containsPoint=function(t){var e=this.points_;return t===e[0]||t===e[1]||t===e[2]},n.prototype.containsEdge=function(t){return this.containsPoint(t.p)&&this.containsPoint(t.q)},n.prototype.containsPoints=function(t,e){return this.containsPoint(t)&&this.containsPoint(e)},n.prototype.isInterior=function(){return this.interior_},n.prototype.setInterior=function(t){return this.interior_=t,this},n.prototype.markNeighborPointers=function(t,e,i){var n=this.points_;if(t===n[2]&&e===n[1]||t===n[1]&&e===n[2])this.neighbors_[0]=i;else if(t===n[0]&&e===n[2]||t===n[2]&&e===n[0])this.neighbors_[1]=i;else{if(!(t===n[0]&&e===n[1]||t===n[1]&&e===n[0]))throw new Error("poly2tri Invalid Triangle.markNeighborPointers() call");this.neighbors_[2]=i}},n.prototype.markNeighbor=function(t){var e=this.points_;t.containsPoints(e[1],e[2])?(this.neighbors_[0]=t,t.markNeighborPointers(e[1],e[2],this)):t.containsPoints(e[0],e[2])?(this.neighbors_[1]=t,t.markNeighborPointers(e[0],e[2],this)):t.containsPoints(e[0],e[1])&&(this.neighbors_[2]=t,t.markNeighborPointers(e[0],e[1],this))},n.prototype.clearNeighbors=function(){this.neighbors_[0]=null,this.neighbors_[1]=null,this.neighbors_[2]=null},n.prototype.clearDelaunayEdges=function(){this.delaunay_edge[0]=!1,this.delaunay_edge[1]=!1,this.delaunay_edge[2]=!1},n.prototype.pointCW=function(t){var e=this.points_;return t===e[0]?e[2]:t===e[1]?e[0]:t===e[2]?e[1]:null},n.prototype.pointCCW=function(t){var e=this.points_;return t===e[0]?e[1]:t===e[1]?e[2]:t===e[2]?e[0]:null},n.prototype.neighborCW=function(t){return t===this.points_[0]?this.neighbors_[1]:t===this.points_[1]?this.neighbors_[2]:this.neighbors_[0]},n.prototype.neighborCCW=function(t){return t===this.points_[0]?this.neighbors_[2]:t===this.points_[1]?this.neighbors_[0]:this.neighbors_[1]},n.prototype.getConstrainedEdgeCW=function(t){return t===this.points_[0]?this.constrained_edge[1]:t===this.points_[1]?this.constrained_edge[2]:this.constrained_edge[0]},n.prototype.getConstrainedEdgeCCW=function(t){return t===this.points_[0]?this.constrained_edge[2]:t===this.points_[1]?this.constrained_edge[0]:this.constrained_edge[1]},n.prototype.getConstrainedEdgeAcross=function(t){return t===this.points_[0]?this.constrained_edge[0]:t===this.points_[1]?this.constrained_edge[1]:this.constrained_edge[2]},n.prototype.setConstrainedEdgeCW=function(t,e){t===this.points_[0]?this.constrained_edge[1]=e:t===this.points_[1]?this.constrained_edge[2]=e:this.constrained_edge[0]=e},n.prototype.setConstrainedEdgeCCW=function(t,e){t===this.points_[0]?this.constrained_edge[2]=e:t===this.points_[1]?this.constrained_edge[0]=e:this.constrained_edge[1]=e},n.prototype.getDelaunayEdgeCW=function(t){return t===this.points_[0]?this.delaunay_edge[1]:t===this.points_[1]?this.delaunay_edge[2]:this.delaunay_edge[0]},n.prototype.getDelaunayEdgeCCW=function(t){return t===this.points_[0]?this.delaunay_edge[2]:t===this.points_[1]?this.delaunay_edge[0]:this.delaunay_edge[1]},n.prototype.setDelaunayEdgeCW=function(t,e){t===this.points_[0]?this.delaunay_edge[1]=e:t===this.points_[1]?this.delaunay_edge[2]=e:this.delaunay_edge[0]=e},n.prototype.setDelaunayEdgeCCW=function(t,e){t===this.points_[0]?this.delaunay_edge[2]=e:t===this.points_[1]?this.delaunay_edge[0]=e:this.delaunay_edge[1]=e},n.prototype.neighborAcross=function(t){return t===this.points_[0]?this.neighbors_[0]:t===this.points_[1]?this.neighbors_[1]:this.neighbors_[2]},n.prototype.oppositePoint=function(t,e){var i=t.pointCW(e);return this.pointCW(i)},n.prototype.legalize=function(t,e){var i=this.points_;if(t===i[0])i[1]=i[0],i[0]=i[2],i[2]=e;else if(t===i[1])i[2]=i[1],i[1]=i[0],i[0]=e;else{if(t!==i[2])throw new Error("poly2tri Invalid Triangle.legalize() call");i[0]=i[2],i[2]=i[1],i[1]=e}},n.prototype.index=function(t){var e=this.points_;if(t===e[0])return 0;if(t===e[1])return 1;if(t===e[2])return 2;throw new Error("poly2tri Invalid Triangle.index() call")},n.prototype.edgeIndex=function(t,e){var i=this.points_;if(t===i[0]){if(e===i[1])return 2;if(e===i[2])return 1}else if(t===i[1]){if(e===i[2])return 0;if(e===i[0])return 2}else if(t===i[2]){if(e===i[0])return 1;if(e===i[1])return 0}return-1},n.prototype.markConstrainedEdgeByIndex=function(t){this.constrained_edge[t]=!0},n.prototype.markConstrainedEdgeByEdge=function(t){this.markConstrainedEdgeByPoints(t.p,t.q)},n.prototype.markConstrainedEdgeByPoints=function(t,e){var i=this.points_;e===i[0]&&t===i[1]||e===i[1]&&t===i[0]?this.constrained_edge[2]=!0:e===i[0]&&t===i[2]||e===i[2]&&t===i[0]?this.constrained_edge[1]=!0:(e===i[1]&&t===i[2]||e===i[2]&&t===i[1])&&(this.constrained_edge[0]=!0)},t.exports=n},4555:(t,e)=>{"use strict";var i=1e-12;e.EPSILON=i;var n={CW:1,CCW:-1,COLLINEAR:0};e.Orientation=n,e.orient2d=function(t,e,s){var r=(t.x-s.x)*(e.y-s.y)-(t.y-s.y)*(e.x-s.x);return r>-1e-12&&r<i?n.COLLINEAR:r>0?n.CCW:n.CW},e.inScanArea=function(t,e,n,s){return!((t.x-e.x)*(s.y-e.y)-(s.x-e.x)*(t.y-e.y)>=-1e-12)&&!((t.x-n.x)*(s.y-n.y)-(s.x-n.x)*(t.y-n.y)<=i)},e.isAngleObtuse=function(t,e,i){var n=e.x-t.x,s=e.y-t.y;return n*(i.x-t.x)+s*(i.y-t.y)<0}},9071:t=>{"use strict";function e(t){return"("+t.x+";"+t.y+")"}t.exports={toString:function(t){var i=t.toString();return"[object Object]"===i?e(t):i},toStringBase:e,compare:function(t,e){return t.y===e.y?t.x-e.x:t.y-e.y},equals:function(t,e){return t.x===e.x&&t.y===e.y}}},8917:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Path2D:()=>c});var n=i(2641),s=i.n(n),r=i(1791),o=i.n(r),l=i(8831);let h=new THREE.Vector2,a=new THREE.Vector2,p=new THREE.Box2,u=null,d=()=>(u=u||new Autodesk.Extensions.CompGeom.EllipseArc,u);function c(t){this.segTypes=[],this.segData=[],this.hasCurves=!1,this.bbox=new THREE.Box2,this.precisionTolerance=t}c.FORCE_MITER_LINES_FOR_TESTING=!1,c.prototype.setTessParams=function(t){this.tessParams=t},c.prototype.isClosedPath=function(){return this.segTypes.length&&7===this.segTypes[this.segTypes.length-1]},c.prototype.isPoint=function(){return 2==this.segTypes.length&&0===this.segTypes[0]&&1===this.segTypes[1]&&this.segData[0]==this.segData[2]&&this.segData[1]==this.segData[3]},c.prototype.closePath=function(){this.isClosedPath()||this.segTypes.push(7)},c.prototype.moveTo=function(t,e){this.segTypes.push(0),this.segData.push(t,e),this.bbox.expandByPoint(h.set(t,e))},c.prototype.lineTo=function(t,e){this.segTypes.push(1),this.segData.push(t,e),this.bbox.expandByPoint(h.set(t,e))},c.prototype.arc=function(t,e,i,n,s,r){this.hasCurves=!0,this.segTypes.push(2),this.segData.push(t,e,i,n,s,r),this.bbox.expandByPoint(h.set(t,e))},c.prototype.arcTo=function(t,e,i,n,s){this.hasCurves=!0,this.segTypes.push(3),this.segData.push(t,e,i,n,s),this.bbox.expandByPoint(h.set(t,e)),this.bbox.expandByPoint(h.set(i,n))},c.prototype.quadraticCurveTo=function(t,e,i,n){this.hasCurves=!0,this.segTypes.push(4),this.segData.push(t,e,i,n),this.bbox.expandByPoint(h.set(t,e)),this.bbox.expandByPoint(h.set(i,n))},c.prototype.bezierCurveTo=function(t,e,i,n,s,r){this.hasCurves=!0,this.segTypes.push(5),this.segData.push(t,e,i,n,s,r),this.bbox.expandByPoint(h.set(t,e)),this.bbox.expandByPoint(h.set(i,n)),this.bbox.expandByPoint(h.set(s,r))},c.prototype.ellipse=function(t,e,i,n,s,r,o,l){this.hasCurves=!0,this.segTypes.push(6),this.segData.push(t,e,i,n,s,r,o,l);const h=d().set(t,e,i,n,s,r,o,l).computeBBox(p);this.bbox.union(h)},c.prototype.flatten=function(t){var e=new c(this.precisionTolerance),i=0,n=0,s=0,r=n,o=s,h=this.segTypes,p=this.segData;let u=this.bbox.getSize(a).length();for(var f=0;f<h.length;f++){switch(h[f]){case 0:t&&(n===r&&s===o||e.closePath()),r=n=p[i++],o=s=p[i++],e.moveTo(n,s);break;case 7:e.closePath();break;case 1:var y=p[i++],x=p[i++];y===n&&x===s||(e.lineTo(y,x),n=y,s=x);break;case 4:{const t=p[i++],r=p[i++],o=p[i++],h=p[i++];(0,l.TesselateQuad)(e,n,s,t,r,o,h,u,this.tessParams,!!this.isFontChar),n=o,s=h}break;case 5:{const t=p[i++],r=p[i++],o=p[i++],h=p[i++],a=p[i++],d=p[i++];(0,l.TesselateCubic)(e,n,s,t,r,o,h,a,d,u,this.tessParams,!!this.isFontChar),n=a,s=d}break;case 2:console.warn("not implemented: arc"),i+=6;break;case 3:console.warn("not implemented: arcto"),i+=4;break;case 6:{var g=p[i++],P=p[i++],m=p[i++],v=p[i++],C=p[i++],_=p[i++],I=p[i++],E=p[i++];const t=this.tessParams||l.DefaultTessParams,r=t.numIterations,o=t.minSegLenFraction*u;d().set(g,P,m,v,C,_,I,E).tesselate(e,r,o),n=e.segData[e.segData.length-2],s=e.segData[e.segData.length-1]}}}return t&&(n===r&&s===o||e.closePath()),e},c.prototype.applyTransform=function(t,e){for(let i=0;i<this.segData.length;i+=2){let n=this.segData[i],s=this.segData[i+1];this.segData[i]=t.tx(n,s,e),this.segData[i+1]=t.ty(n,s,e)}},c.prototype.stroke=function(t,e,i,n,r,o,l,h,a){var p=null!=o;let u=this;(l||this.hasCurves)&&(u=this.flatten(!1));var d=this;if(p){for(var f,y=[],x=0,g=0;g<u.segTypes.length;g++)if(0==u.segTypes[g])f=new c(this.precisionTolerance),y.push(f),f.moveTo(u.segData[x++],u.segData[x++]);else if(1==u.segTypes[g]){var P;null===(P=f)||void 0===P||P.lineTo(u.segData[x++],u.segData[x++])}else if(7==u.segTypes[g]){var m;null===(m=f)||void 0===m||m.closePath()}const p=function(t){const e=Math.pow(2,-32);for(let i=1;i<t.length;i++){const n=t[i].X-t[i-1].X,s=t[i].Y-t[i-1].Y;Math.abs(n)>Math.abs(s)?n>0?t[i].X-=i*e:t[i].X+=i*e:s>0?t[i].Y-=i*e:t[i].Y+=i*e}};var v=o.flattened||o.flatten(!0),C=v.toClipperPath(t,!1);y.map((o=>{var u=d.preCheckForClipping(t,v,o,l,!0);if(!u.needCancel)if(u.needClipping&&!o.isPoint()){var c=o.toClipperPath(t,l)[0];if(!c)return;s().Clipper.Orientation(c)&&c.reverse();var f=new(s().PolyTree),y=new(s().Clipper);p(c),y.AddPath(c,s().PolyType.ptSubject,!1),y.AddPaths(C,s().PolyType.ptClip,!0),y.Execute(s().ClipType.ctIntersection,f,s().PolyFillType.pftEvenOdd,s().PolyFillType.pftEvenOdd),function(s){var o=s.GetFirst();for(;o;)d.strokeClipperContour(t,o.Contour(),o.IsOpen,i,e,n,r,t.currentVpId,h,!1,a),o=o.GetNext()}(f)}else(!u.needClipping||1==C.length&&s().Clipper.PointInPolygon({X:o.segData[0],Y:o.segData[1]},C[0]))&&this.strokeFlattedPath(t,o,e,i,n,r,l,h,a)}))}else this.strokeFlattedPath(t,u,e,i,n,r,l,h,a)},c.prototype.strokeFlattedPath=function(t,e,i,n,s,r,o,l,h){let a,p=e.segData,u=e.segTypes;o&&(a=t.getCurrentTransform());const d="butt"===h;for(var f=0,y=0,x=0,g=0,P=0,m=0,v=0,C=0;C<u.length;C++){var _=u[C];switch(_){case 0:{let e=p[f++],i=p[f++];o?(m=t.tx(e,i,a),v=t.ty(e,i,a)):(m=e,v=i),g=y=m,P=x=v}break;case 7:case 1:{let e,h;if(7===_)e=m,h=v;else{let i=p[f++],n=p[f++];o?(e=t.tx(i,n,a),h=t.ty(i,n,a)):(e=i,h=n)}const I=C>0&&0===u[C-1];if(e!==g||h!==P||I){const m=d&&I,v=C<u.length-1,E=d&&(!v&&1===_||v&&0===u[C+1]);if(t.flushBuffer(4),this.isMiterLine||c.FORCE_MITER_LINES_FOR_TESTING){let d=e,c=h;const I=v&&(1===u[C+1]||7===u[C+1]);if(7!==_&&I){let e=p[f+0],i=p[f+1];o?(d=t.tx(e,i,a),c=t.ty(e,i,a)):(d=e,c=i)}t.currentVbb.addMiterSegment(y,x,g,P,e,h,d,c,0,i,n,s,r,t.currentVpId||0,l,m,E)}else t.currentVbb.addSegment(g,P,e,h,0,i,n,s,r,t.currentVpId||0,l,m,E);y=g,x=P,g=e,P=h}}break;default:console.error("Path must be flattened before rendering")}}},c.prototype.strokeClipperContour=function(t,e,i,n,s,r,o,l,h,a,p){let u,d=e.length,c=i?0:d-1,f=i?1:0;a&&(u=t.getCurrentTransform());const y="butt"===p;let x=a?t.tx(e[c].X,e[c].Y,u):e[c].X,g=a?t.ty(e[c].X,e[c].Y,u):e[c].Y;for(var P=f;P<d;P++){let p=a?t.tx(e[P].X,e[P].Y,u):e[P].X,c=a?t.ty(e[P].X,e[P].Y,u):e[P].Y;const f=y&&0===P,m=y&&P===d-1&&i;t.flushBuffer(4),t.currentVbb.addSegment(x,g,p,c,0,s,n,r,o,l,h,f,m),x=p,g=c}},c.prototype.isAABB=function(){const t=1e-10,e=.001;let i=this.segTypes;if(6!==i.length&&5!==i.length)return!1;if(0!==i[0])return!1;if(6===i.length&&7!==i[5])return!1;if(5===i.length&&7!==i[4]&&1!==i[4])return!1;for(let t=1;t<i.length-1;t++)if(1!==i[t])return!1;let n=this.segData,s=n[2]-n[0],r=n[3]-n[1],o=n[6]-n[4],l=n[7]-n[5],h=Math.sqrt(s*s+r*r),a=Math.sqrt(o*o+l*l);if(Math.abs(h-a)>t)return!1;s/=h,r/=h,o/=a,l/=a;let p=s*o+r*l;if(Math.abs(1+p)>e)return!1;let u=n[4]-n[2],d=n[5]-n[3],c=n[8]-n[6],f=n[9]-n[7],y=Math.sqrt(u*u+d*d),x=Math.sqrt(c*c+f*f);return!(Math.abs(y-x)>t)&&(u/=y,d/=y,c/=x,f/=x,p=u*c+d*f,!(Math.abs(1+p)>e)&&(p=s*u+r*d,!(Math.abs(p)>e)&&!(Math.abs(s)>t&&Math.abs(r))))};c.prototype.isAABBContain=function(t){return this.isAABB()?function(t,e,i){if(t.containsBox(e))return 1;let n=i;return void 0===n&&(n=.001/t.size().length()),e.min.x-t.max.x>n||e.min.y-t.min.y>n||e.max.x-t.max.x<-n||e.max.y-t.max.y<-n?2:e.min.x-t.min.x<-n||e.min.y-t.min.y<-n||e.max.x-t.max.x>n||e.max.y-t.max.y>n?4:1}(this.bbox,t,this.precisionTolerance):4},c.prototype.clip=function(t,e){var i=t.flattened||t.flatten(!0),n=this.flattened||this.flatten(!0),r=this.preCheckForClipping(null,i,n,!1,!1);if(r.needCancel)return console.warn("No overlap between nested clip regions."),new c;if(0==r.needClipping)return r.needSwapSubject?t:this;{var o=i.toClipperPath(null,!1),l=n.toClipperPath(null,!1),h=new(s().PolyTree),a=new(s().Clipper);a.AddPaths(l,s().PolyType.ptSubject,!0),a.AddPaths(o,s().PolyType.ptClip,!0),a.Execute(s().ClipType.ctIntersection,h,s().PolyFillType.pftEvenOdd,s().PolyFillType.pftEvenOdd);let t=new c(this.precisionTolerance);for(var p=h.GetFirst();p;){for(var u=p.Contour(),d=0;d<u.length;d++)0==d?t.moveTo(u[d].X,u[d].Y):t.lineTo(u[d].X,u[d].Y);u[u.length-1].X==u[0].X&&u[u.length-1].Y==u[0].Y||t.lineTo(u[0].X,u[0].Y),p=p.GetNext()}return t}},c.prototype.isFillable=function(){let t=this.flattened||this.flatten(!0);if(t.segTypes.length<3)return!1;if(3===t.segTypes.length){return!(7===t.segTypes[2]&&1===t.segTypes[1]&&0===t.segTypes[0])}for(var e=!1,i=0;i<t.segTypes.length;i+=2)if(0!=t.segTypes[i]||1!=t.segTypes[i+1]){e=!0;break}return e},c.prototype.fill=function(t,e,i,n,r,o,l){if(!this.isFillable())return;let h=this.flattened||this.flatten(!0);var a=this;var p=function(){var e=null!=r,i=!1;if(e){var n=r.flattened||r.flatten(!0),l=a.preCheckForClipping(t,n,h,o,!1);if(l.needCancel)return;e=l.needClipping,i=l.needSwapSubject}if(e){var p=(r.flattened||r.flatten(!0)).toClipperPath(t,!1),u=h.toClipperPath(t,o),d=new(s().PolyTree),c=new(s().Clipper);return c.AddPaths(u,s().PolyType.ptSubject,!0),c.AddPaths(p,s().PolyType.ptClip,!0),c.Execute(s().ClipType.ctIntersection,d,s().PolyFillType.pftEvenOdd,s().PolyFillType.pftEvenOdd),{polygons:a.getPolygonFromClipperSolution(d),appliedTransform:o,needClipping:e}}if(h=i?n:h,a.cached)return{polygons:a.cached,appliedTransform:!1,needClipping:e,subjFlatted:h};{const n=h.toClipperPath(t,!1),r=new(s().PolyTree),o=new(s().Clipper);o.AddPaths(n,s().PolyType.ptSubject,!0),o.Execute(s().ClipType.ctUnion,r,s().PolyFillType.pftEvenOdd,s().PolyFillType.pftEvenOdd);const l=a.getPolygonFromClipperSolution(r);return i||(a.cached=l),{polygons:l,appliedTransform:i,needClipping:e,subjFlatted:h}}}();p&&p.polygons.map((s=>{!function(s,r,o){var h=s.vertices;if(r){for(var u=t.getCurrentTransform(),d=[],c=0;c<h.length;c+=2){let e=t.tx(h[c],h[c+1],u),i=t.ty(h[c],h[c+1],u);d.push(e,i)}h=d}if(t.addPolyTriangle(h,s.indices,e,i,n,!1),!l)if(o||!a.isFontChar)for(var f in s.contours)a.strokeClipperContour(t,s.contours[f],!0,e,-.5,i,n,t.currentVpId,0,r);else a.strokeFlattedPath(t,p.subjFlatted,-.5,e,i,n,r,0)}(s,o&&!p.appliedTransform,p.needClipping)}))},c.prototype.toClipperPath=function(t,e){var i,n=[],s=[],r=this.segTypes,o=this.segData,l=0;function h(n,s){if(e){let e=t.tx(s.X,s.Y,i),n=t.ty(s.X,s.Y,i);s.X=e,s.Y=n}(n.length>0&&(n[n.length-1].X!=s.X||n[n.length-1].Y!=s.Y)||0==n.length)&&n.push(s)}e&&(i=t.getCurrentTransform());for(var a=0;a<r.length;a++)0==r[a]?(s&&s.length>1&&n.push(s),h(s=[],{X:o[l++],Y:o[l++]})):1==r[a]?h(s,{X:o[l++],Y:o[l++]}):7==r[a]&&(s.push({X:s[0].X,Y:s[0].Y}),n.push(s),s=[]);return s&&s.length>1&&n.push(s),n},c.prototype.hasIntersection=function(t,e,i){return!(t.max.x-e.min.x<=-i||t.max.y-e.min.y<=-i||t.min.x-e.max.x>=i||t.min.y-e.max.y>=i)},c.prototype.preCheckForClipping=function(t,e,i,n,s){var r=e.bbox,o=i.bbox;if(n){let e=t.getCurrentTransform();o=t.transformBox(o,e,p)}return this.hasIntersection(r,o,this.precisionTolerance)?e.isAABB()&&r.containsBox(o)?{needClipping:!1}:i.isAABB()&&o.containsBox(r)?s?{needCancel:!0}:{needClipping:!1,needSwapSubject:!0}:{needClipping:!0}:{needCancel:!0}},c.prototype.getPolygonFromClipperSolution=function(t){function e(t,e,i){for(var n=0;n<i.length;n++)e.push(i[n].X,i[n].Y);t.push(i)}return s().JS.PolyTreeToExPolygons(t).map((t=>{var i=[],n=[],r=[];if(1==t.holes.length&&Math.abs(s().JS.AreaOfPolygons(t.holes))>Math.abs(s().JS.AreaOfPolygon(t.outer))){let e=t.holes[0];t.holes[0]=t.outer,t.outer=e}e(r,i,t.outer),t.holes.map((t=>{n.push(i.length/2),e(r,i,t)}));var l=o()(i,n);return{vertices:i,indices:l,holeIndices:n,contours:r}}))},c.prototype.msdfClipping=function(t){var e=(this.flattened||this.flatten(!0)).toClipperPath(null,!1),i=t.toClipperPath(null,!1),n=new(s().PolyTree),r=new(s().Clipper);return r.AddPaths(e,s().PolyType.ptSubject,!0),r.AddPaths(i,s().PolyType.ptClip,!0),r.Execute(s().ClipType.ctIntersection,n,s().PolyFillType.pftEvenOdd,s().PolyFillType.pftEvenOdd),this.getPolygonFromClipperSolution(n)}},299:(t,e,i)=>{"use strict";i.r(e),i.d(e,{UniquePointList:()=>c});var n=i(5229),s=i(5420),r=i(6435),o=i.n(r);let l=function(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0};var h,a,p,u;l.prototype={constructor:l,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*n,this.y=s[1]*e+s[4]*i+s[7]*n,this.z=s[2]*e+s[5]*i+s[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12],this.y=s[1]*e+s[5]*i+s[9]*n+s[13],this.z=s[2]*e+s[6]*i+s[10]*n+s[14],this},applyProjection:function(t){var e=this.x,i=this.y,n=this.z,s=t.elements,r=1/(s[3]*e+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*e+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*e+s[6]*i+s[10]*n+s[14])*r,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,l=t.w,h=l*e+r*n-o*i,a=l*i+o*e-s*n,p=l*n+s*i-r*e,u=-s*e-r*i-o*n;return this.x=h*l+u*-s+a*-o-p*-r,this.y=a*l+u*-r+p*-s-h*-o,this.z=p*l+u*-o+h*-r-a*-s,this},transformDirection:function(t){var e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n,this.y=s[1]*e+s[5]*i+s[9]*n,this.z=s[2]*e+s[6]*i+s[10]*n,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e}else this.x=0,this.y=0,this.z=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.z),this},clampScalar:function(t,e){return void 0===p&&(p=new l,u=new l),p.set(t,t,t),u.set(e,e,e),this.clamp(p,u)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t),this},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var i=this.x,n=this.y,s=this.z;return this.x=n*t.z-s*t.y,this.y=s*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,o=e.y,l=e.z;return this.x=n*l-s*o,this.y=s*r-i*l,this.z=i*o-n*r,this},projectOnVector:function(t){return void 0===h&&(h=new l),h.copy(t).normalize(),a=this.dot(h),this.copy(h).multiplyScalar(a)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new l),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new l),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},setEulerFromRotationMatrix:function(t,e){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(t,e){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),i=this.set(t.elements[4],t.elements[5],t.elements[6]).length(),n=this.set(t.elements[8],t.elements[9],t.elements[10]).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){var i=4*t,n=e.elements;return this.x=n[i],this.y=n[i+1],this.z=n[i+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}};const d=new l;class c{constructor(t,e,i,r){this.bbox=t,this.boxSize=this.bbox.getSize(d).length(),"number"==typeof e?(this.precisionTolerance=e,this.scale=1/this.precisionTolerance):(this.precisionTolerance=n.TOL*this.boxSize,this.scale=1/this.precisionTolerance),this.precisionToleranceSq=this.precisionTolerance*this.precisionTolerance,this.snapBaseX=this.bbox.min.x,this.snapBaseY=this.bbox.min.y,this.pts=[],this.xymap=new Map,r&&(this.quadTreeVerts=new s.QuadTree(t.min.x,t.min.y,t.max.x,t.max.y,e)),this.vertexConstructor=i}findOrAddPoint(t,e,i){let n,s=0|(t-this.snapBaseX)*this.scale,r=0|(e-this.snapBaseY)*this.scale,l=1/0;for(let i=s-1;i<=s+1;i++){let s=this.xymap.get(i);if(s)for(let i=r-1;i<=r+1;i++){let r=s.get(i);if(!r)continue;let o=(r.x-t)*(r.x-t)+(r.y-e)*(r.y-e);o<l&&(n=r,l=o)}}if(l>this.precisionToleranceSq&&(n=void 0),void 0===n){let i=this.xymap.get(s);i||(i=new Map,this.xymap.set(s,i)),n=this.vertexConstructor?new this.vertexConstructor(t,e):new(o().Point)(t,e),i.set(r,n),n.id=this.pts.length,this.pts.push(n),this.quadTreeVerts&&this.quadTreeVerts.addItem(n)}if(void 0!==i){if("number"==typeof i)-1===n.dbIds.indexOf(i)&&n.dbIds.push(i);else if(i)for(let t=0;t<i.length;t++){let e=i[t];-1===n.dbIds.indexOf(e)&&n.dbIds.push(e)}n.dbIdsChanged=!0}return n}forEach(t){this.pts.forEach(t)}delete(t){this.pts[t.id]=void 0,this.quadTreeVerts&&this.quadTreeVerts.deleteItem(t)}compact(){let t=[];for(let e=0,i=this.pts.length;e<i;e++){let i=this.pts[e];i&&(i.oldid=i.id,i.id=t.length,t.push(i))}this.pts=t}enumInBox(t,e,i,n,s){this.quadTreeVerts.enumInBox(t,e,i,n,s)}}},5420:(t,e,i)=>{"use strict";i.r(e),i.d(e,{QuadTree:()=>l});var n=i(2601),s=i(2554);let r;const o={x:0,y:0};class l{constructor(t,e,i,n,s,o){this.items=[],this.children=null,this.itemCount=0,this.extraDistance=s,this.minx=t,this.miny=e,this.maxx=i,this.maxy=n,this.itemHandler=o,r=Autodesk.Viewing.Private.logger}addItem(t){if(this.itemCount++,this.children){let e=0,i=null;for(let n=0;n<4;n++)this.children[n].intersectsItem(t)&&(i=this.children[n],e++);1===e?i.addItem(t):0!==e&&this.items.push(t)}else this.items.push(t),this.items.length>16&&this.subdivide();return this.itemCount}deleteItem(t){if(!this.intersectsItem(t))return 0;if(this.items){let e=this.items.indexOf(t);if(e>=0)return this.items.splice(e,1),this.itemCount--,1}if(this.children){let e=0,i=0;for(let n=0;n<4;n++)e+=this.children[n].deleteItem(t),i+=this.children[n].itemCount;return 1===e?(this.itemCount--,1):(r.warn("Did not find item to delete. Something is wrong.",e),0)}return 0}intersectsBox(t,e,i,n){let r=this.extraDistance;return(0,s.xBoxBox)(t,e,i,n,this.minx-r,this.miny-r,this.maxx+r,this.maxy+r)}intersectsItem(t){return this.itemHandler?this.itemHandler.intersectsBox(t,this.minx-this.extraDistance,this.miny-this.extraDistance,this.maxx+this.extraDistance,this.maxy+this.extraDistance):t.v1?(0,n.xLineBox)(t.v1.x,t.v1.y,t.v2.x,t.v2.y,this.minx-this.extraDistance,this.miny-this.extraDistance,this.maxx+this.extraDistance,this.maxy+this.extraDistance):this.intersectsBox(t.x,t.y,t.x,t.y)}findSplitPoint(){let t=[],e=[];if(this.itemHandler)for(let i=0;i<this.items.length;i++)this.itemHandler.getPoint(this.items[i],o),t.push(o.x),e.push(o.y);else if(this.items[0].v1)for(let i=0;i<this.items.length;i++)t.push(this.items[i].v1.x),e.push(this.items[i].v1.y);else for(let i=0;i<this.items.length;i++)t.push(this.items[i].x),e.push(this.items[i].y);t.sort(((t,e)=>t-e)),e.sort(((t,e)=>t-e));let i=t[0|(t.length+1)/2]-this.extraDistance-1e-20,n=e[0|(e.length+1)/2]-this.extraDistance-1e-20;return i<=this.minx||i>=this.maxx||n<=this.miny||n>=this.maxy?null:{midx:i,midy:n}}subdivide(){if(this.children)return void r.error("Attempt to subdivide already split node");if(!this.items.length)return void r.error("Attempt to subdivide empty node");let t=this.minx,e=this.miny,i=this.maxx,n=this.maxy,s=this.findSplitPoint();if(!s)return;let{midx:o,midy:h}=s;this.children=new Array(4),this.children[0]=new l(t,e,o,h,this.extraDistance,this.itemHandler),this.children[1]=new l(o,e,i,h,this.extraDistance,this.itemHandler),this.children[2]=new l(o,h,i,n,this.extraDistance,this.itemHandler),this.children[3]=new l(t,h,o,n,this.extraDistance,this.itemHandler);let a=[];for(let t=0,e=this.items.length;t<e;t++){let e=0,i=null;for(let n=0;n<4;n++)this.children[n].intersectsItem(this.items[t])&&(i=this.children[n],e++);0===e?r.error("Expected at least one overlap"):1===e?i.addItem(this.items[t]):a.push(this.items[t])}this.items=a}enumNearItems(t,e){if(this.intersectsItem(t)){if(this.items)for(let t=0;t<this.items.length;t++)e(this.items[t]);if(this.children)for(let i=0;i<4;i++)this.children[i].enumNearItems(t,e)}}enumInBox(t,e,i,r,o){if(this.intersectsBox(t,e,i,r)){if(this.items)for(let l=0;l<this.items.length;l++){let h=this.items[l];this.itemHandler?this.itemHandler.intersectsBox(h,t,e,i,r)&&o(h):h.v1?(0,n.xLineBox)(h.v1.x,h.v1.y,h.v2.x,h.v2.y,t,e,i,r)&&o(h):(0,s.xBoxBox)(h.x,h.y,h.x,h.y,t,e,i,r)&&o(h)}if(this.children)for(let n=0;n<4;n++)this.children[n].enumInBox(t,e,i,r,o)}}pointInPolygonRec(t,e,i){var n=t.v1.x,s=t.v1.y,r=s>=i,o=t.v2.x,l=t.v2.y,h=l>=i;r!=h&&(l-i)*(n-o)>=(o-e)*(s-l)==h&&(this.pipResult=!this.pipResult)}pointInPolygon(t,e){return this.pipResult=!1,this.enumInBox(-1/0,e,1/0,e,(i=>{this.pointInPolygonRec(i,t,e)})),this.pipResult}}},2554:(t,e,i)=>{"use strict";function n(t,e,i,n,s,r,o,l){return t<=o&&e<=l&&i>=s&&n>=r}i.r(e),i.d(e,{xBoxBox:()=>n})},3965:(t,e,i)=>{"use strict";i.r(e),i.d(e,{xBoxPlane:()=>s});var n=new THREE.Vector3;function s(t,e){n.set(e.min.x,e.min.y,e.min.z);var i=t.distanceToPoint(n),s=Math.sign(i);n.set(e.min.x,e.min.y,e.max.z);var r=t.distanceToPoint(n);return Math.sign(r)!==s||(n.set(e.min.x,e.max.y,e.min.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.min.x,e.max.y,e.max.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.max.x,e.min.y,e.min.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.max.x,e.min.y,e.max.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.max.x,e.max.y,e.min.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.max.x,e.max.y,e.max.z),r=t.distanceToPoint(n),Math.sign(r)!==s))))))}},2601:(t,e,i)=>{"use strict";i.r(e),i.d(e,{xLineBox:()=>a});const n=0,s=1,r=2,o=4,l=8;function h(t,e,i,h,a,p){let u;return u=n,t<i?u|=s:t>a&&(u|=r),e<h?u|=o:e>p&&(u|=l),u}function a(t,e,i,n,a,p,u,d){let c=h(t,e,a,p,u,d),f=h(i,n,a,p,u,d),y=!1;for(;;){if(!(c|f)){y=!0;break}if(c&f)break;{let y,x,g=c||f;g&l?(y=t+(i-t)*(d-e)/(n-e),x=d):g&o?(y=t+(i-t)*(p-e)/(n-e),x=p):g&r?(x=e+(n-e)*(u-t)/(i-t),y=u):g&s&&(x=e+(n-e)*(a-t)/(i-t),y=a),g===c?c=h(t=y,e=x,a,p,u,d):f=h(i=y,n=x,a,p,u,d)}}return y}},1272:(t,e,i)=>{"use strict";function n(t){return Math.abs(t)}i.r(e),i.d(e,{ONE_INTERSECTION:()=>r,OVERLAP:()=>o,pointOnLine:()=>l,segmentsIntersect:()=>h});const s=i(5229).TOL,r=4,o=5;function l(t,e,i,n,r,o){if(i.length<s)return!1;let l=(t-i.v1.x)*i.dx+(e-i.v1.y)*i.dy;r||(r=s*i.length);let h=l/i.length2;if(n&&(h*i.length<-r||h*i.length>i.length+r))return!1;let a=i.v1.x+h*i.dx,p=i.v1.y+h*i.dy,u=(a-t)*(a-t)+(p-e)*(p-e);return o&&(o.x=a,o.y=p,o.d=Math.sqrt(u),o.u=h),u<r*r}function h(t,e,i){let h=e.dy*t.dx-e.dx*t.dy,a=e.dx*(t.v1.y-e.v1.y)-e.dy*(t.v1.x-e.v1.x),p=t.dx*(t.v1.y-e.v1.y)-t.dy*(t.v1.x-e.v1.x);if(n(a)<s&&n(p)<s&&n(h)<s)return null;if(n(h)<s)return function(t,e,i){if(!l(e.v1.x,e.v1.y,t,!1,i))return null;let n={status:o,e1:[],e2:[]},s=l(e.v1.x,e.v1.y,t,!0,i),r=l(e.v2.x,e.v2.y,t,!0,i);if(s&&r)return n.e1.push(e.v1.x,e.v1.y,e.v2.x,e.v2.y),n;let h=l(t.v1.x,t.v1.y,e,!0,i),a=l(t.v2.x,t.v2.y,e,!0,i);return s&&n.e1.push(e.v1.x,e.v1.y),r&&n.e1.push(e.v2.x,e.v2.y),h&&n.e2.push(t.v1.x,t.v1.y),a&&n.e2.push(t.v2.x,t.v2.y),n}(t,e,i);let u=a/h,d=u*t.length;if(d<-i||d>t.length+i)return null;let c=p/h*e.length;if(c<-i||c>e.length+i)return null;let f=t.v1.x+u*t.dx,y=t.v1.y+u*t.dy;return{status:r,e1:[f,y],e2:[f,y]}}},6353:(t,e,i)=>{"use strict";i.r(e),i.d(e,{convertToPlaneCoords:()=>p,makePlaneBasis:()=>a,xMeshPlane:()=>h});var n=i(5229),s=i(908);const r=Autodesk.Viewing.Private.VertexEnumerator;var o=new THREE.Matrix4,l=new THREE.Plane;function h(t,e,i){let{geometry:n,matrixWorld:h,fragId:a}=e;if(!n)return;let p=i.length;o.copy(h).invert(),l.copy(t).applyMatrix4(o),r.enumMeshTriangles(n,(function(t,e,n,r,o,h){(0,s.xTrianglePlane)(l,t,e,n,r,o,h,i,a)}));for(let t=p,e=i.length;t<e;t++)i[t].v1.applyMatrix4(h),i[t].v2.applyMatrix4(h)}function a(t){let e=new THREE.Vector3(0,0,1),i=t.normal.clone().cross(e);i=i.normalize();let s=e.dot(t.normal),r=new THREE.Matrix4;return(0,n.isZero)(i.x)&&(0,n.isZero)(i.y)&&(0,n.isZero)(i.z)?r.elements[14]=s*t.constant:(!function(t,e,i){let n=e,s=Math.sqrt(1-n*n),r=1-n,o=t.x,l=t.y,h=t.z,a=r*o,p=r*l;i.set(a*o+n,a*l-s*h,a*h+s*l,0,a*l+s*h,p*l+n,p*h-s*o,0,a*h-s*l,p*h+s*o,r*h*h+n,0,0,0,0,1)}(i,s,r),r.elements[14]=t.constant),r}function p(t,e,i){for(let n=0;n<e.length;n++){let s=e[n];s.v1.applyMatrix4(t),s.v2.applyMatrix4(t),i.expandByPoint(s.v1),i.expandByPoint(s.v2)}}},8189:(t,e,i)=>{"use strict";i.r(e),i.d(e,{xPlaneSegment:()=>r});var n=i(5229);let s=new THREE.Vector3;function r(t,e,i,r,o){let l=s.subVectors(i,e),h=t.normal.dot(l);if((0,n.isZero)(h))return r.copy(e),o.copy(i),2;h=1/h;let a=-(e.dot(t.normal)*h+t.constant*h);if(a<-n.TOL||a>1+n.TOL)return 0;let p=l.multiplyScalar(a).add(e);return r.copy(p),1}},908:(t,e,i)=>{"use strict";i.r(e),i.d(e,{xTrianglePlane:()=>a});var n=i(5229),s=i(8189);const r=Autodesk.Viewing.Private.logger;function o(t,e,i,n,s,r,o){this.v1=t.clone(),this.v2=e.clone()}let l=new THREE.Vector3,h=new THREE.Vector3;function a(t,e,i,a,p,u,d,c,f){let y=t.distanceToPoint(e),x=t.distanceToPoint(i),g=t.distanceToPoint(a);if(y<-n.TOL&&x<-n.TOL&&g<-n.TOL)return null;if(y>n.TOL&&x>n.TOL&&g>n.TOL)return null;let P,m,v,C,_,I,E=Math.sign(y),T=Math.sign(x),b=Math.sign(g);if(0===E&&0===T&&0===b)return null;if(E!==T){let n=(0,s.xPlaneSegment)(t,e,i,l,h);if(2===n)return void c.push(new o(e,i,p,p,u,u,f));1===n?(v=p,C=u,P=l.clone()):r.warn("Unexpected zero intersections where at least one was expected")}if(T!==b){let e=(0,s.xPlaneSegment)(t,i,a,l,h);if(2===e)return void c.push(new o(i,a,u,u,d,d,f));1===e?P?l.distanceTo(P)>n.TOL&&(_=u,I=d,m=l.clone()):(v=u,C=d,P=l.clone()):r.warn("Unexpected zero intersections where at least one was expected")}if(b!==E){let i=(0,s.xPlaneSegment)(t,a,e,l,h);if(2===i)return void c.push(new o(a,e,d,d,p,p,f));1===i?P?l.distanceTo(P)>n.TOL&&(_=d,I=p,m=l.clone()):r.warn("Unexpected single intersection point"):r.warn("Unexpected zero intersections where at least one was expected")}P&&m&&c.push(new o(P,m,v,C,_,I,f))}},3095:t=>{"use strict";t.exports={version:"1.5.0"}}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n=i(6082);Autodesk.Extensions.CompGeom=n})();
//# sourceMappingURL=CompGeom.min.js.map