forked from LaserWeb/lw.comm-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8456ed5965fc36cb7c68.worker.js.map
1 lines (1 loc) · 758 KB
/
8456ed5965fc36cb7c68.worker.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap 8456ed5965fc36cb7c68","webpack:///../~/poly2tri/src/xy.js","webpack:///../~/snapsvg/dist/snap.svg.js","webpack:///../~/poly2tri/src/advancingfront.js","webpack:///../~/poly2tri/src/pointerror.js","webpack:///../~/poly2tri/src/triangle.js","webpack:///./lib/mesh.js","webpack:///./lib/workers/cam-preflight.js","webpack:///../~/clipper-lib/clipper.js","webpack:///../~/poly2tri/src/assert.js","webpack:///../~/poly2tri/src/point.js","webpack:///../~/poly2tri/src/sweep.js","webpack:///../~/poly2tri/src/sweepcontext.js","webpack:///../~/poly2tri/src/utils.js"],"names":["elementToRawPaths","pathStrToRawPaths","flipY","hasClosedRawPaths","filterClosedRawPaths","rawPathsToClipperPaths","triangulateRawPaths","clipperPathsToCPaths","cPathsToClipperPaths","cPathsToCamPaths","clipperBounds","clip","union","diff","xor","offset","inchToClipperScale","mmToClipperScale","clipperToCppScale","cleanPolyDist","arcTolerance","linearizeCubicBezier","p1x","p1y","c1x","c1y","c2x","c2y","p2x","p2y","minNumSegments","minSegmentLength","bez","p0","p1","p2","p3","t","numSegments","x","y","result","i","nextX","nextY","push","linearizeSnapPath","path","alertFn","length","subpath","elementToLinearSnapPaths","element","Snap","require","snapElement","type","attr","Number","w","h","map","transform","globalMatrix","parsePathString","snapPathToRawPaths","snapPath","pxPerInch","factor","currentPath","j","str","toCubic","allRawPaths","deltaY","rawPaths","rawPath","p","X","Y","ClipperLib","Clipper","CleanPolygons","SimplifyPolygons","PolyFillType","pftEvenOdd","clipperPathsToPolyTree","paths","c","AddPaths","PolyType","ptSubject","polyTree","PolyTree","Execute","ClipType","ctUnion","triangulatePolyTree","pointToVertex","point","contourToVertexes","nodesToVertexes","nodes","node","Contour","processNode","vertexes","holes","Childs","context","SweepContext","addHoles","triangulate","triangles","getTriangles","getPoints","hole","next","memoryBlocks","clipperPaths","doubleSize","cPaths","Module","_malloc","cPathsBase","cPathSizes","cPathSizesBase","clipperPath","cPath","pathArray","Float64Array","HEAPU32","buffer","byteOffset","cPathsRef","cNumPathsRef","cPathSizesRef","cNumPaths","pathSize","convertedPaths","convertedPath","safeToClose","Z","minX","MAX_VALUE","minY","maxX","maxY","pt","Math","min","max","paths1","paths2","clipType","clipper","ptClip","ctDifference","ctXor","amount","joinType","endType","undefined","JoinType","jtRound","EndType","etClosedPolygon","jtSquare","jtMiter","co","ClipperOffset","offsetted","self","onmessage","event","jobs","data","settings","opIndex","op","geometry","openGeometry","tabGeometry","documents","filteredDocIds","Set","docsWithImages","matchColor","filterColor","color","examineDocTree","isTab","id","doc","find","d","cb","transform2d","filterFillColor","fillColor","filterStrokeColor","strokeColor","add","includes","isClosed","concat","child","children","tabDocuments","chunk","percent","job","shift","postMessage","parseInt","error","console","message","level","toString","close"],"mappings":";QAAA;QACA;QACA,2DAA2D;QAC3D;QACA;QACA,GAAG;;QAEH,4CAA4C;QAC5C;QACA;;QAEA,0CAA0C;QAC1C;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA,MAAM;QACN;QACA;QACA,MAAM;QACN;QACA;QACA,MAAM;QACN;QACA;QACA;QACA,OAAO;QACP;QACA;QACA;QACA;QACA;QACA;QACA,IAAI;QACJ;;QAEA,qCAAqC;QACrC;QACA;;;;QAIA;QACA,8CAA8C;QAC9C;QACA,4BAA4B;QAC5B,6BAA6B;QAC7B,iCAAiC;;QAEjC,uCAAuC;QACvC;QACA;QACA;QACA;QACA;QACA;QACA;QACA,MAAM;QACN;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,MAAM;QACN;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;;QAEL;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA,sCAAsC;QACtC;QACA;QACA,6BAA6B;QAC7B,6BAA6B;QAC7B;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,oBAAoB,gBAAgB;QACpC;QACA;QACA;QACA,KAAK;QACL;QACA;QACA;QACA;QACA,oBAAoB,gBAAgB;QACpC;QACA;QACA;QACA,KAAK;QACL;QACA;QACA,KAAK;QACL;QACA;QACA,KAAK;QACL;QACA;QACA;QACA,KAAK;;QAEL;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;QACA,KAAK;QACL;QACA;QACA;QACA,KAAK;;QAEL;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;QACA,iBAAiB,8BAA8B;QAC/C;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;QACA,KAAK;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA,IAAI;QACJ;;QAEA,oDAAoD;QACpD;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA,IAAI;QACJ;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA,KAAK;QACL,IAAI;QACJ;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,mBAAmB,2BAA2B;QAC9C;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,OAAO;QACP;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA,kBAAkB,cAAc;QAChC;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA,MAAM;QACN;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA,aAAa,4BAA4B;QACzC;QACA;QACA;QACA;QACA;QACA,MAAM;QACN;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA,IAAI;;QAEJ;QACA;QACA;QACA;QACA;QACA;;QAEA;;QAEA;QACA;QACA,cAAc,4BAA4B;QAC1C;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA,cAAc,4BAA4B;QAC1C;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,gBAAgB,uCAAuC;QACvD;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;;QAEA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,eAAe,uCAAuC;QACtD;QACA;QACA;QACA;QACA;QACA,eAAe,sBAAsB;QACrC;QACA;QACA;QACA,OAAO;QACP;QACA;QACA;QACA;QACA;QACA;QACA,SAAS;QACT;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA,aAAa,wCAAwC;QACrD;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;QACA;QACA,OAAO;QACP;QACA;QACA;QACA;QACA;QACA;QACA,SAAS;QACT;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,MAAM;QACN;QACA;QACA;QACA;QACA;QACA,QAAQ;QACR;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA,IAAI;QACJ;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,eAAe;QACf;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA,2CAA2C,cAAc;;QAEzD;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA,sCAAsC,uBAAuB;;QAE7D;QACA;;;;;;;;AC/rBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA,+EAA+E,IAAI;AACnF,sBAAsB,SAAS;AAC/B,kBAAkB,+CAA+C;AACjE;AACA;AACA;;AAEA;AACA,6DAA6D,gBAAgB;AAC7E,uCAAuC,KAAK;AAC5C;AACA,kBAAkB,+CAA+C;AACjE;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,aAAa,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa;AACrF;AACA;AACA,aAAa,OAAO;AACpB,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB;;;AAGA;AACA;AACA;AACA,yBAAyB,UAAU;AACnC,iBAAiB;AACjB;AACA,WAAW,IAAI,wBAAwB;AACvC,aAAa,OAAO,WAAW;AAC/B;AACA;AACA,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,UAAU;AAC/B,iBAAiB;AACjB;AACA,qBAAqB,8BAA8B,2BAA2B;AAC9E;AACA,WAAW,IAAI,wBAAwB;AACvC,aAAa,OAAO,WAAW;AAC/B;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,YAAY,OAAO,WAAW,yBAAyB;AACvD,qBAAqB,yBAAyB;AAC9C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC1GA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA,SAAS;AACT;AACA;AACA,kBAAkB,MAAM;AACxB;AACA,6CAA6C,QAAQ;AACrD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,QAAQ;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,QAAQ;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA,kDAAkD,QAAQ;AAC1D;AACA,qFAAqF,MAAM;AAC3F;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,oCAAoC,QAAQ;AAC5C;AACA;AACA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,QAAQ;AAC9D;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF,KAA0C,IAAI,iCAAc,EAAE,gCAAE,YAAY,YAAY,EAAE,+CAAC;AAC5K,CAAC;;AAED;AACA;AACA,QAAQ,IAAyC;AACjD;AACA,QAAQ,iCAAO,CAAC,0BAAK,CAAC,kCAAE;AACxB;AACA,SAAS;AAAA,oGAAC;AACV,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,4CAA4C;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,EAAE,YAAY,EAAE;AACnD;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,sBAAsB;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,wBAAwB,KAAK,KAAK;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,0BAA0B;AAC1E;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0FAA0F,UAAU;AACpG;AACA,kFAAkF,WAAW;AAC7F;AACA,4FAA4F,WAAW;AACvG;AACA;AACA;AACA,4FAA4F,WAAW;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA,YAAY;AACZ,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,6EAA6E;AACpG;AACA,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,gBAAgB,4EAA4E;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,qCAAqC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,QAAQ;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,eAAe;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb,6CAA6C,EAAE;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,8BAA8B,+BAA+B;AAC7D,aAAa;AACb,8BAA8B,8BAA8B;AAC5D,aAAa;AACb,8BAA8B,uBAAuB;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,UAAU;AACtC;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,oCAAoC,QAAQ;AAC5C;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,QAAQ;AACzD;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,QAAQ;AACrD;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4IAA4I,MAAM,WAAW,OAAO,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS;AACnN;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ,QAAQ;AACR;AACA,qBAAqB,MAAM;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,SAAS;AAC/B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,mBAAmB,SAAS;AAC5B,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,uBAAuB;AACpD,iBAAiB;AACjB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kBAAkB;AACzD;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,aAAa;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,6CAA6C,QAAQ;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,aAAa;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,kBAAkB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,uBAAuB;AAC1D,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B;AAC3C;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,kCAAkC,iBAAiB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oCAAoC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,sCAAsC,WAAW;AACjD;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA,6CAA6C,QAAQ;AACrD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,oBAAoB,aAAa;AACjC,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA,uBAAuB,YAAY;AACnC;AACA,wBAAwB,0BAA0B;AAClD;AACA,mBAAmB,YAAY;AAC/B;AACA,wBAAwB,0BAA0B;AAClD;AACA,mBAAmB,QAAQ;AAC3B,2BAA2B,QAAQ;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,kDAAkD,QAAQ;AAC1D;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,6DAA6D,QAAQ;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,QAAQ;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,QAAQ;AAC/D;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,QAAQ;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,QAAQ;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,QAAQ;AAC3D;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA,gBAAgB,yDAAyD;AACzE,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,yDAAyD;AAC9E,sBAAsB,yDAAyD;AAC/E;AACA;AACA;AACA;AACA;AACA,8BAA8B,WAAW;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD,gDAAgD;AAChD,gDAAgD;AAChD;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD,kDAAkD;AAClD,kDAAkD;AAClD;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,sBAAsB;AACtB,kEAAkE,QAAQ;AAC1E,uCAAuC;;AAEvC;AACA;AACA,mCAAmC;AACnC,6CAA6C;AAC7C;AACA,kDAAkD;;AAElD,mEAAmE;AACnE;AACA;;AAEA,yBAAyB;;AAEzB,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,QAAQ;AAC7C;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C,mBAAmB;AAC7D;AACA,yBAAyB,+BAA+B;AACxD,yBAAyB,+BAA+B;AACxD,yBAAyB,+BAA+B;AACxD,yBAAyB;AACzB;AACA;AACA;AACA,4BAA4B;AAC5B,iBAAiB;AACjB,4BAA4B;AAC5B,iBAAiB;AACjB,4BAA4B;AAC5B,4BAA4B;AAC5B;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,MAAM;AAC1B;AACA;AACA,qBAAqB,MAAM,uBAAuB,MAAM;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA,mBAAmB,WAAW;AAC9B;AACA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,KAAK;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,QAAQ;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,QAAQ;AACjD,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,EAAE;AACzC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF,QAAQ;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,KAAK;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB,4DAA4D,QAAQ;AACpE;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+EAA+E;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iCAAiC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,IAAI;AAChE;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E,KAAK,kBAAkB,GAAG,OAAO,GAAG,8CAA8C,MAAM,oGAAoG,QAAQ;AAChR;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,OAAO;AAC3E;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,MAAM;AAC3E;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qFAAqF,OAAO,EAAE,QAAQ,uCAAuC,OAAO,EAAE,QAAQ,uCAAuC,OAAO,EAAE,QAAQ;AACtN;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF,OAAO,kCAAkC,OAAO,kCAAkC,OAAO;AACzK;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF,OAAO,cAAc,QAAQ,kCAAkC,OAAO,cAAc,QAAQ,kCAAkC,OAAO,cAAc,QAAQ;AAC3O;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,WAAW;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,uDAAuD;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,qDAAqD;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,qCAAqC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,CAAC;AACD,CAAC,e;;;;;;;AC17QD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEa;;;AAGb;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,IAAI;AACf,WAAW,UAAU;AACrB;AACA;AACA,eAAe,GAAG;AAClB;;AAEA,eAAe,cAAc;AAC7B;;AAEA,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB;;AAEA,eAAe,OAAO;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB;AACA;AACA,eAAe,KAAK;AACpB;AACA,eAAe,KAAK;AACpB;AACA,eAAe,KAAK;AACpB;AACA;;AAEA,aAAa,KAAK;AAClB;AACA;AACA;;AAEA,YAAY,KAAK;AACjB;AACA;AACA;;AAEA,aAAa,KAAK;AAClB;AACA;AACA;;AAEA,YAAY,KAAK;AACjB;AACA;AACA;;AAEA,aAAa,KAAK;AAClB;AACA;AACA;;AAEA,YAAY,KAAK;AACjB;AACA;AACA;;AAEA,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,IAAI;AACf,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;;;;;;;ACjLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;;AAEA,SAAS,mBAAO,CAAC,CAAM;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;;;AAGA;;;;;;;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEa;;;AAGb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,mBAAO,CAAC,CAAM;;;AAGvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,OAAO,OAAO;AACpD;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB;AACvF;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,4BAA4B;AAChD;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,GAAG,4BAA4B;AAC1C,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG,yBAAyB;AACvC,WAAW,GAAG,yBAAyB;AACvC,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG,yBAAyB;AACvC,WAAW,GAAG,yBAAyB;AACvC,WAAW,SAAS;AACpB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG,wBAAwB;AACtC,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,GAAG,wBAAwB;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG,6BAA6B;AAC3C,WAAW,GAAG,6BAA6B;AAC3C,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,GAAG,wBAAwB;AACtC,aAAa,OAAO;AACpB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG,yBAAyB;AACvC,WAAW,GAAG,yBAAyB;AACvC,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG,wBAAwB;AACtC,WAAW,GAAG,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;;AAGA;;AAEA;;;;;;;;AChjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEa;;;;;;QAiJGA,iB,GAAAA,iB;QAUAC,iB,GAAAA,iB;QAWAC,K,GAAAA,K;QAOAC,iB,GAAAA,iB;QAOAC,oB,GAAAA,oB;QAQAC,sB,GAAAA,sB;QAyDAC,mB,GAAAA,mB;QAKAC,oB,GAAAA,oB;QAoCAC,oB,GAAAA,oB;QAmCAC,gB,GAAAA,gB;QAoCAC,a,GAAAA,a;QAiBAC,I,GAAAA,I;QAUAC,K,GAAAA,K;QAKAC,I,GAAAA,I;QAKAC,G,GAAAA,G;QAKAC,M,GAAAA,M;;AA7YhB;;;;AACA;;;;;;AAEO,MAAMC,kDAAqB,UAA3B;AACA,MAAMC,8CAAmBD,qBAAqB,IAA9C,C,CAAoD;AACpD,MAAME,gDAAoB,IAAI,GAA9B,C,CAAmC;AACnC,MAAMC,wCAAgB,GAAtB;AACA,MAAMC,sCAAe,KAArB;;AAEP;AACA;AACA,SAASC,oBAAT,CAA8BC,GAA9B,EAAmCC,GAAnC,EAAwCC,GAAxC,EAA6CC,GAA7C,EAAkDC,GAAlD,EAAuDC,GAAvD,EAA4DC,GAA5D,EAAiEC,GAAjE,EAAsEC,cAAtE,EAAsFC,gBAAtF,EAAwG;AACpG,aAASC,GAAT,CAAaC,EAAb,EAAiBC,EAAjB,EAAqBC,EAArB,EAAyBC,EAAzB,EAA6BC,CAA7B,EAAgC;AAC5B,eAAO,CAAC,IAAIA,CAAL,KAAW,IAAIA,CAAf,KAAqB,IAAIA,CAAzB,IAA8BJ,EAA9B,GAAmC,KAAK,IAAII,CAAT,KAAe,IAAIA,CAAnB,IAAwBA,CAAxB,GAA4BH,EAA/D,GAAoE,KAAK,IAAIG,CAAT,IAAcA,CAAd,GAAkBA,CAAlB,GAAsBF,EAA1F,GAA+FE,IAAIA,CAAJ,GAAQA,CAAR,GAAYD,EAAlH;AACH;;AAED,QAAId,OAAOE,GAAP,IAAcD,OAAOE,GAArB,IAA4BG,OAAOF,GAAnC,IAA0CG,OAAOF,GAArD,EACI,OAAO,CAAC,GAAD,EAAMC,GAAN,EAAWC,GAAX,CAAP;;AAEJ,QAAIS,cAAcR,cAAlB;AACA,WAAO,IAAP,EAAa;AACT,YAAIS,IAAIjB,GAAR;AACA,YAAIkB,IAAIjB,GAAR;AACA,YAAIkB,SAAS,CAAC,GAAD,CAAb;AACA,aAAK,IAAIC,IAAI,CAAb,EAAgBA,KAAKJ,WAArB,EAAkC,EAAEI,CAApC,EAAuC;AACnC,gBAAIL,IAAI,MAAMK,CAAN,GAAUJ,WAAlB;AACA,gBAAIK,QAAQX,IAAIV,GAAJ,EAASE,GAAT,EAAcE,GAAd,EAAmBE,GAAnB,EAAwBS,CAAxB,CAAZ;AACA,gBAAIO,QAAQZ,IAAIT,GAAJ,EAASE,GAAT,EAAcE,GAAd,EAAmBE,GAAnB,EAAwBQ,CAAxB,CAAZ;AACA,gBAAI,CAACM,QAAQJ,CAAT,KAAeI,QAAQJ,CAAvB,IAA4B,CAACK,QAAQJ,CAAT,KAAeI,QAAQJ,CAAvB,CAA5B,GAAwDT,mBAAmBA,gBAA/E,EAAiG;AAC7FO,+BAAe,CAAf;AACAG,yBAAS,IAAT;AACA;AACH;AACDA,mBAAOI,IAAP,CAAYF,KAAZ,EAAmBC,KAAnB;AACAL,gBAAII,KAAJ;AACAH,gBAAII,KAAJ;AACH;AACD,YAAIH,MAAJ,EACI,OAAOA,MAAP;AACP;AACJ;;AAED;AACA;AACA,SAASK,iBAAT,CAA2BC,IAA3B,EAAiCjB,cAAjC,EAAiDC,gBAAjD,EAAmEiB,OAAnE,EAA4E;AACxE,QAAID,KAAKE,MAAL,GAAc,CAAd,IAAmBF,KAAK,CAAL,EAAQE,MAAR,IAAkB,CAArC,IAA0CF,KAAK,CAAL,EAAQ,CAAR,KAAc,GAA5D,EAAiE;AAC7DC,gBAAQ,4BAAR;AACA,eAAO,IAAP;AACH;AACD,QAAIT,IAAIQ,KAAK,CAAL,EAAQ,CAAR,CAAR;AACA,QAAIP,IAAIO,KAAK,CAAL,EAAQ,CAAR,CAAR;AACA,QAAIN,SAAS,CAACM,KAAK,CAAL,CAAD,CAAb;AACA,SAAK,IAAIL,IAAI,CAAb,EAAgBA,IAAIK,KAAKE,MAAzB,EAAiC,EAAEP,CAAnC,EAAsC;AAClC,YAAIQ,UAAUH,KAAKL,CAAL,CAAd;AACA,YAAIQ,QAAQ,CAAR,KAAc,GAAd,IAAqBA,QAAQD,MAAR,IAAkB,CAA3C,EAA8C;AAC1CR,mBAAOI,IAAP,CAAYxB,qBACRkB,CADQ,EACLC,CADK,EACFU,QAAQ,CAAR,CADE,EACUA,QAAQ,CAAR,CADV,EACsBA,QAAQ,CAAR,CADtB,EACkCA,QAAQ,CAAR,CADlC,EAC8CA,QAAQ,CAAR,CAD9C,EAC0DA,QAAQ,CAAR,CAD1D,EACsEpB,cADtE,EACsFC,gBADtF,CAAZ;AAEAQ,gBAAIW,QAAQ,CAAR,CAAJ;AACAV,gBAAIU,QAAQ,CAAR,CAAJ;AACH,SALD,MAKO,IAAIA,QAAQ,CAAR,KAAc,GAAd,IAAqBA,QAAQD,MAAR,IAAkB,CAA3C,EAA8C;AACjDR,mBAAOI,IAAP,CAAYK,OAAZ;AACAX,gBAAIW,QAAQ,CAAR,CAAJ;AACAV,gBAAIU,QAAQ,CAAR,CAAJ;AACH,SAJM,MAIA;AACHF,oBAAQ,oCAAoCE,QAAQ,CAAR,CAA5C;AACA,mBAAO,IAAP;AACH;AACJ;AACD,WAAOT,MAAP;AACH;;AAED;AACA;AACA,SAASU,wBAAT,CAAkCC,OAAlC,EAA2CtB,cAA3C,EAA2DC,gBAA3D,EAA6EiB,OAA7E,EAAsF;AAClF,QAAID,OAAO,IAAX;AACA,QAAIM,OAAOC,mBAAOA,CAAC,CAAR,CAAX;AACA,QAAIC,cAAcF,KAAKD,OAAL,CAAlB;;AAEA,QAAIG,YAAYC,IAAZ,IAAoB,MAAxB,EACIT,OAAOQ,YAAYE,IAAZ,CAAiB,GAAjB,CAAP,CADJ,KAEK,IAAIF,YAAYC,IAAZ,IAAoB,MAAxB,EAAgC;AACjC,YAAIjB,IAAImB,OAAOH,YAAYE,IAAZ,CAAiB,GAAjB,CAAP,CAAR;AACA,YAAIjB,IAAIkB,OAAOH,YAAYE,IAAZ,CAAiB,GAAjB,CAAP,CAAR;AACA,YAAIE,IAAID,OAAOH,YAAYE,IAAZ,CAAiB,OAAjB,CAAP,CAAR;AACA,YAAIG,IAAIF,OAAOH,YAAYE,IAAZ,CAAiB,QAAjB,CAAP,CAAR;AACAV,eAAO,MAAMR,CAAN,GAAU,GAAV,GAAgBC,CAAhB,GAAoB,GAApB,GAA0BmB,CAA1B,GAA8B,GAA9B,GAAoC,CAApC,GAAwC,GAAxC,GAA8C,CAA9C,GAAkD,GAAlD,GAAwDC,CAAxD,GAA4D,GAA5D,GAAmE,CAACD,CAApE,GAAyE,GAAzE,GAA+E,CAA/E,GAAmF,GAAnF,GAAyF,CAAzF,GAA6F,GAA7F,GAAoG,CAACC,CAArG,GAA0G,GAAjH;AACH,KANI,MAOA;AACDZ,gBAAQ,QAAQO,YAAYC,IAApB,GAA2B,+EAAnC;AACA,eAAO,IAAP;AACH;;AAED,QAAID,YAAYE,IAAZ,CAAiB,WAAjB,KAAiC,EAArC,EAAyC;AACrCT,gBAAQ,4BAAR;AACA,eAAO,IAAP;AACH;;AAED,QAAIO,YAAYE,IAAZ,CAAiB,MAAjB,KAA4B,EAAhC,EAAoC;AAChCT,gBAAQ,uBAAR;AACA,eAAO,IAAP;AACH;;AAED,QAAID,QAAQ,IAAZ,EAAkB;AACdC,gBAAQ,iBAAR;AACA;AACH;;AAEDD,WAAOM,KAAKN,IAAL,CAAUc,GAAV,CAAcd,IAAd,EAAoBQ,YAAYO,SAAZ,GAAwBC,YAA5C,CAAP;AACAhB,WAAOM,KAAKW,eAAL,CAAqBjB,IAArB,CAAP;AACAA,WAAOD,kBAAkBC,IAAlB,EAAwBjB,cAAxB,EAAwCC,gBAAxC,EAA0DiB,OAA1D,CAAP;AACA,WAAOD,IAAP;AACH;;AAED;AACA;AACA;AACA,SAASkB,kBAAT,CAA4BC,QAA5B,EAAsCC,SAAtC,EAAiDnB,OAAjD,EAA0D;AACtD,QAAIoB,SAAS,QAAQD,YAAY,GAApB,CAAb;AACA,QAAID,SAASjB,MAAT,GAAkB,CAAlB,IAAuBiB,SAAS,CAAT,EAAYjB,MAAZ,IAAsB,CAA7C,IAAkDiB,SAAS,CAAT,EAAY,CAAZ,KAAkB,GAAxE,EAA6E;AACzElB,gBAAQ,4BAAR;AACA,eAAO,IAAP;AACH;AACD,QAAIqB,cAAc,CAACH,SAAS,CAAT,EAAY,CAAZ,IAAiBE,MAAlB,EAA0BF,SAAS,CAAT,EAAY,CAAZ,IAAiBE,MAA3C,CAAlB;AACA,QAAI3B,SAAS,CAAC4B,WAAD,CAAb;AACA,SAAK,IAAI3B,IAAI,CAAb,EAAgBA,IAAIwB,SAASjB,MAA7B,EAAqC,EAAEP,CAAvC,EAA0C;AACtC,YAAIQ,UAAUgB,SAASxB,CAAT,CAAd;AACA,YAAIQ,QAAQ,CAAR,KAAc,GAAd,IAAqBA,QAAQD,MAAR,IAAkB,CAA3C,EAA8C;AAC1CoB,0BAAc,CAACnB,QAAQ,CAAR,IAAakB,MAAd,EAAsBlB,QAAQ,CAAR,IAAakB,MAAnC,CAAd;AACA3B,mBAAOI,IAAP,CAAYwB,WAAZ;AACH,SAHD,MAGO,IAAInB,QAAQ,CAAR,KAAc,GAAlB,EAAuB;AAC1B,iBAAK,IAAIoB,IAAI,CAAb,EAAgBA,IAAI,CAACpB,QAAQD,MAAR,GAAiB,CAAlB,IAAuB,CAA3C,EAA8C,EAAEqB,CAAhD,EACID,YAAYxB,IAAZ,CAAiBK,QAAQ,IAAIoB,IAAI,CAAhB,IAAqBF,MAAtC,EAA8ClB,QAAQ,IAAIoB,IAAI,CAAhB,IAAqBF,MAAnE;AACP,SAHM,MAGA;AACHpB,oBAAQ,sCAAsCE,QAAQ,CAAR,CAA9C;AACA,mBAAO,IAAP;AACH;AACJ;AACD,WAAOT,MAAP;AACH;;AAED;AACA;AACA;AACO,SAASzC,iBAAT,CAA2BoD,OAA3B,EAAoCe,SAApC,EAA+CrC,cAA/C,EAA+DC,gBAA/D,EAAiFiB,OAAjF,EAA0F;AAC7F,QAAID,OAAOI,yBAAyBC,OAAzB,EAAkCtB,cAAlC,EAAkDC,gBAAlD,EAAoEiB,OAApE,CAAX;AACA,QAAID,SAAS,IAAb,EACI,OAAOkB,mBAAmBlB,IAAnB,EAAyBoB,SAAzB,EAAoCnB,OAApC,CAAP;AACJ,WAAO,IAAP;AACH;;AAED;AACA;AACA;AACO,SAAS/C,iBAAT,CAA2BsE,GAA3B,EAAgCJ,SAAhC,EAA2CrC,cAA3C,EAA2DC,gBAA3D,EAA6EiB,OAA7E,EAAsF;AACzF,QAAIK,OAAOC,mBAAOA,CAAC,CAAR,CAAX;AACA,QAAIP,OAAOM,KAAKW,eAAL,CAAqBO,GAArB,CAAX;AACAxB,WAAOM,KAAKN,IAAL,CAAUyB,OAAV,CAAkBzB,IAAlB,CAAP;AACAA,WAAOD,kBAAkBC,IAAlB,EAAwBjB,cAAxB,EAAwCC,gBAAxC,EAA0DiB,OAA1D,CAAP;AACA,QAAID,SAAS,IAAb,EACI,OAAOkB,mBAAmBlB,IAAnB,EAAyBoB,SAAzB,EAAoCnB,OAApC,CAAP;AACJ,WAAO,IAAP;AACH;;AAED;AACO,SAAS9C,KAAT,CAAeuE,WAAf,EAA4BC,MAA5B,EAAoC;AACvC,SAAK,IAAIC,QAAT,IAAqBF,WAArB,EACI,KAAK,IAAIG,OAAT,IAAoBD,QAApB,EACI,KAAK,IAAIjC,IAAI,CAAb,EAAgBA,IAAIkC,QAAQ3B,MAA5B,EAAoCP,KAAK,CAAzC,EACIkC,QAAQlC,IAAI,CAAZ,IAAiBgC,SAASE,QAAQlC,IAAI,CAAZ,CAA1B;AACf;;AAEM,SAASvC,iBAAT,CAA2BwE,QAA3B,EAAqC;AACxC,SAAK,IAAI5B,IAAT,IAAiB4B,QAAjB,EACI,IAAI5B,KAAKE,MAAL,IAAe,CAAf,IAAoBF,KAAK,CAAL,KAAWA,KAAKA,KAAKE,MAAL,GAAc,CAAnB,CAA/B,IAAwDF,KAAK,CAAL,KAAWA,KAAKA,KAAKE,MAAL,GAAc,CAAnB,CAAvE,EACI,OAAO,IAAP;AACR,WAAO,KAAP;AACH;;AAEM,SAAS7C,oBAAT,CAA8BuE,QAA9B,EAAwC;AAC3C,QAAIlC,SAAS,EAAb;AACA,SAAK,IAAIM,IAAT,IAAiB4B,QAAjB,EACI,IAAI5B,KAAKE,MAAL,IAAe,CAAf,IAAoBF,KAAK,CAAL,KAAWA,KAAKA,KAAKE,MAAL,GAAc,CAAnB,CAA/B,IAAwDF,KAAK,CAAL,KAAWA,KAAKA,KAAKE,MAAL,GAAc,CAAnB,CAAvE,EACIR,OAAOI,IAAP,CAAYE,IAAZ;AACR,WAAON,MAAP;AACH;;AAEM,SAASpC,sBAAT,CAAgCsE,QAAhC,EAA0Cb,SAA1C,EAAqD;AACxD,QAAIrB,SAASkC,SAASd,GAAT,CAAagB,KAAK;AAC3B,YAAIpC,SAAS,EAAb;AACA,aAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAImC,EAAE5B,MAAtB,EAA8BP,KAAK,CAAnC,EAAsC;AAClCD,mBAAOI,IAAP,CAAY;AACRiC,mBAAG,CAAChB,UAAU,CAAV,IAAee,EAAEnC,CAAF,CAAf,GAAsBoB,UAAU,CAAV,IAAee,EAAEnC,IAAI,CAAN,CAArC,GAAgDoB,UAAU,CAAV,CAAjD,IAAiE7C,gBAD5D;AAER8D,mBAAG,CAACjB,UAAU,CAAV,IAAee,EAAEnC,CAAF,CAAf,GAAsBoB,UAAU,CAAV,IAAee,EAAEnC,IAAI,CAAN,CAArC,GAAgDoB,UAAU,CAAV,CAAjD,IAAiE7C;AAF5D,aAAZ;AAIH;AACD,eAAOwB,MAAP;AACH,KATY,CAAb;AAUA,QAAItC,kBAAkBwE,QAAlB,CAAJ,EAAiC;AAC7BlC,iBAASuC,qBAAWC,OAAX,CAAmBC,aAAnB,CAAiCzC,MAAjC,EAAyCtB,aAAzC,CAAT;AACAsB,iBAASuC,qBAAWC,OAAX,CAAmBE,gBAAnB,CAAoC1C,MAApC,EAA4CuC,qBAAWI,YAAX,CAAwBC,UAApE,CAAT;AACH;AACD,WAAO5C,MAAP;AACH;;AAED,SAAS6C,sBAAT,CAAgCC,KAAhC,EAAuC;AACnC,QAAIC,IAAI,IAAIR,qBAAWC,OAAf,EAAR;AACAO,MAAEC,QAAF,CAAWF,KAAX,EAAkBP,qBAAWU,QAAX,CAAoBC,SAAtC,EAAiD,IAAjD;AACA,QAAIC,WAAW,IAAIZ,qBAAWa,QAAf,EAAf;AACAL,MAAEM,OAAF,CAAUd,qBAAWe,QAAX,CAAoBC,OAA9B,EAAuCJ,QAAvC,EAAiDZ,qBAAWI,YAAX,CAAwBC,UAAzE,EAAqFL,qBAAWI,YAAX,CAAwBC,UAA7G;AACA,WAAOO,QAAP;AACH;;AAED,SAASK,mBAAT,CAA6BL,QAA7B,EAAuC;AACnC,QAAInD,SAAS,EAAb;AACA,QAAIyD,gBAAgBC,UAAU,EAAE5D,GAAG4D,MAAMrB,CAAN,GAAU7D,gBAAf,EAAiCuB,GAAG2D,MAAMpB,CAAN,GAAU9D,gBAA9C,EAAV,CAApB;AACA,QAAImF,oBAAoBrD,QAAQA,KAAKc,GAAL,CAASqC,aAAT,CAAhC;AACA,QAAIG,kBAAkBC,SAASA,MAAMzC,GAAN,CAAU0C,QAAQH,kBAAkBG,KAAKC,OAAL,EAAlB,CAAlB,CAA/B;AACA,QAAIC,cAAcF,QAAQ;AACtB,YAAIG,WAAWN,kBAAkBG,KAAKC,OAAL,EAAlB,CAAf;AACA,YAAIG,QAAQN,gBAAgBE,KAAKK,MAAL,EAAhB,CAAZ;AACA,YAAIC,UAAU,IAAIC,sBAAJ,CAAiBJ,QAAjB,CAAd;AACAG,gBAAQE,QAAR,CAAiBJ,KAAjB;AACAE,gBAAQG,WAAR;AACA,YAAIC,YAAYJ,QAAQK,YAAR,EAAhB;AACA,aAAK,IAAI7E,CAAT,IAAc4E,SAAd,EAAyB;AACrB,gBAAIpC,IAAIxC,EAAE8E,SAAF,EAAR;AACA1E,mBAAOI,IAAP,CACIgC,EAAE,CAAF,EAAKtC,CADT,EACYsC,EAAE,CAAF,EAAKrC,CADjB,EAEIqC,EAAE,CAAF,EAAKtC,CAFT,EAEYsC,EAAE,CAAF,EAAKrC,CAFjB,EAGIqC,EAAE,CAAF,EAAKtC,CAHT,EAGYsC,EAAE,CAAF,EAAKrC,CAHjB;AAIH;AACD,aAAK,IAAI4E,IAAT,IAAiBb,KAAKK,MAAL,EAAjB,EAAgC;AAC5B,iBAAK,IAAIS,IAAT,IAAiBD,KAAKR,MAAL,EAAjB,EAAgC;AAC5BH,4BAAYY,IAAZ;AACH;AACJ;AACJ,KAnBD;AAoBA,SAAK,IAAId,IAAT,IAAiBX,SAASgB,MAAT,EAAjB,EAAoC;AAChCH,oBAAYF,IAAZ;AACH;AACD,WAAO9D,MAAP;AACH;;AAEM,SAASnC,mBAAT,CAA6BqE,QAA7B,EAAuC;AAC1C,WAAOsB,oBAAoBX,uBAAuBjF,uBAAuBsE,QAAvB,EAAiC,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,CAAjC,CAAvB,CAApB,CAAP;AACH;;AAED;AACO,SAASpE,oBAAT,CAA8B+G,YAA9B,EAA4CC,YAA5C,EAA0D;AAC7D,QAAIC,aAAa,CAAjB;;AAEA,QAAIC,SAASC,OAAOC,OAAP,CAAeJ,aAAatE,MAAb,GAAsB,CAArC,CAAb;AACAqE,iBAAazE,IAAb,CAAkB4E,MAAlB;AACA,QAAIG,aAAaH,UAAU,CAA3B;;AAEA,QAAII,aAAaH,OAAOC,OAAP,CAAeJ,aAAatE,MAAb,GAAsB,CAArC,CAAjB;AACAqE,iBAAazE,IAAb,CAAkBgF,UAAlB;AACA,QAAIC,iBAAiBD,cAAc,CAAnC;;AAEA,SAAK,IAAInF,IAAI,CAAb,EAAgBA,IAAI6E,aAAatE,MAAjC,EAAyC,EAAEP,CAA3C,EAA8C;AAC1C,YAAIqF,cAAcR,aAAa7E,CAAb,CAAlB;;AAEA,YAAIsF,QAAQN,OAAOC,OAAP,CAAeI,YAAY9E,MAAZ,GAAqB,CAArB,GAAyBuE,UAAzB,GAAsC,CAArD,CAAZ;AACAF,qBAAazE,IAAb,CAAkBmF,KAAlB;AACA,YAAIA,QAAQ,CAAZ,EACIA,SAAS,CAAT;AACJ;AACA,YAAIC,YAAY,IAAIC,YAAJ,CAAiBR,OAAOS,OAAP,CAAeC,MAAhC,EAAwCV,OAAOS,OAAP,CAAeE,UAAf,GAA4BL,KAApE,CAAhB;;AAEA,aAAK,IAAI1D,IAAI,CAAb,EAAgBA,IAAIyD,YAAY9E,MAAhC,EAAwC,EAAEqB,CAA1C,EAA6C;AACzC,gBAAI6B,QAAQ4B,YAAYzD,CAAZ,CAAZ;AACA2D,sBAAU3D,IAAI,CAAd,IAAmB6B,MAAMrB,CAAN,GAAU5D,iBAA7B;AACA+G,sBAAU3D,IAAI,CAAJ,GAAQ,CAAlB,IAAuB6B,MAAMpB,CAAN,GAAU7D,iBAAjC;AACH;;AAEDwG,eAAOS,OAAP,CAAeP,aAAalF,CAA5B,IAAiCsF,KAAjC;AACAN,eAAOS,OAAP,CAAeL,iBAAiBpF,CAAhC,IAAqCqF,YAAY9E,MAAjD;AACH;;AAED,WAAO,CAACwE,MAAD,EAASF,aAAatE,MAAtB,EAA8B4E,UAA9B,CAAP;AACH;;AAED;AACA;AACO,SAASrH,oBAAT,CAA8B8G,YAA9B,EAA4CgB,SAA5C,EAAuDC,YAAvD,EAAqEC,aAArE,EAAoF;AACvF,QAAIf,SAASC,OAAOS,OAAP,CAAeG,aAAa,CAA5B,CAAb;AACAhB,iBAAazE,IAAb,CAAkB4E,MAAlB;AACA,QAAIG,aAAaH,UAAU,CAA3B;;AAEA,QAAIgB,YAAYf,OAAOS,OAAP,CAAeI,gBAAgB,CAA/B,CAAhB;;AAEA,QAAIV,aAAaH,OAAOS,OAAP,CAAeK,iBAAiB,CAAhC,CAAjB;AACAlB,iBAAazE,IAAb,CAAkBgF,UAAlB;AACA,QAAIC,iBAAiBD,cAAc,CAAnC;;AAEA,QAAIN,eAAe,EAAnB;AACA,SAAK,IAAI7E,IAAI,CAAb,EAAgBA,IAAI+F,SAApB,EAA+B,EAAE/F,CAAjC,EAAoC;AAChC,YAAIgG,WAAWhB,OAAOS,OAAP,CAAeL,iBAAiBpF,CAAhC,CAAf;AACA,YAAIsF,QAAQN,OAAOS,OAAP,CAAeP,aAAalF,CAA5B,CAAZ;AACA;AACA4E,qBAAazE,IAAb,CAAkBmF,KAAlB;AACA,YAAIA,QAAQ,CAAZ,EACIA,SAAS,CAAT;AACJ,YAAIC,YAAY,IAAIC,YAAJ,CAAiBR,OAAOS,OAAP,CAAeC,MAAhC,EAAwCV,OAAOS,OAAP,CAAeE,UAAf,GAA4BL,KAApE,CAAhB;;AAEA,YAAID,cAAc,EAAlB;AACAR,qBAAa1E,IAAb,CAAkBkF,WAAlB;AACA,aAAK,IAAIzD,IAAI,CAAb,EAAgBA,IAAIoE,QAApB,EAA8B,EAAEpE,CAAhC,EACIyD,YAAYlF,IAAZ,CAAiB;AACbiC,eAAGmD,UAAU3D,IAAI,CAAd,IAAmBpD,iBADT;AAEb6D,eAAGkD,UAAU3D,IAAI,CAAJ,GAAQ,CAAlB,IAAuBpD;AAFb,SAAjB;AAIP;;AAED,WAAOqG,YAAP;AACH;;AAED;AACA;AACO,SAAS9G,gBAAT,CAA0B6G,YAA1B,EAAwCgB,SAAxC,EAAmDC,YAAnD,EAAiEC,aAAjE,EAAgF;AACnF,QAAIf,SAASC,OAAOS,OAAP,CAAeG,aAAa,CAA5B,CAAb;AACAhB,iBAAazE,IAAb,CAAkB4E,MAAlB;AACA,QAAIG,aAAaH,UAAU,CAA3B;;AAEA,QAAIgB,YAAYf,OAAOS,OAAP,CAAeI,gBAAgB,CAA/B,CAAhB;;AAEA,QAAIV,aAAaH,OAAOS,OAAP,CAAeK,iBAAiB,CAAhC,CAAjB;AACAlB,iBAAazE,IAAb,CAAkBgF,UAAlB;AACA,QAAIC,iBAAiBD,cAAc,CAAnC;;AAEA,QAAIc,iBAAiB,EAArB;AACA,SAAK,IAAIjG,IAAI,CAAb,EAAgBA,IAAI+F,SAApB,EAA+B,EAAE/F,CAAjC,EAAoC;AAChC,YAAIgG,WAAWhB,OAAOS,OAAP,CAAeL,iBAAiBpF,CAAhC,CAAf;AACA,YAAIsF,QAAQN,OAAOS,OAAP,CAAeP,aAAalF,CAA5B,CAAZ;AACA;AACA4E,qBAAazE,IAAb,CAAkBmF,KAAlB;AACA,YAAIA,QAAQ,CAAZ,EACIA,SAAS,CAAT;AACJ,YAAIC,YAAY,IAAIC,YAAJ,CAAiBR,OAAOS,OAAP,CAAeC,MAAhC,EAAwCV,OAAOS,OAAP,CAAeE,UAAf,GAA4BL,KAApE,CAAhB;;AAEA,YAAIY,gBAAgB,EAApB;AACAD,uBAAe9F,IAAf,CAAoB,EAAEE,MAAM6F,aAAR,EAAuBC,aAAa,KAApC,EAApB;AACA,aAAK,IAAIvE,IAAI,CAAb,EAAgBA,IAAIoE,QAApB,EAA8B,EAAEpE,CAAhC,EACIsE,cAAc/F,IAAd,CAAmB;AACfiC,eAAGmD,UAAU3D,IAAI,CAAd,IAAmBpD,iBADP;AAEf6D,eAAGkD,UAAU3D,IAAI,CAAJ,GAAQ,CAAlB,IAAuBpD,iBAFX;AAGf4H,eAAGb,UAAU3D,IAAI,CAAJ,GAAQ,CAAlB,IAAuBpD;AAHX,SAAnB;;AAMJ;AACH;;AAED,WAAOyH,cAAP;AACH;;AAEM,SAASjI,aAAT,CAAuB6E,KAAvB,EAA8B;AACjC,QAAIwD,OAAOrF,OAAOsF,SAAlB;AACA,QAAIC,OAAOvF,OAAOsF,SAAlB;AACA,QAAIE,OAAO,CAACxF,OAAOsF,SAAnB;AACA,QAAIG,OAAO,CAACzF,OAAOsF,SAAnB;AACA,SAAK,IAAIjG,IAAT,IAAiBwC,KAAjB,EAAwB;AACpB,aAAK,IAAI6D,EAAT,IAAerG,IAAf,EAAqB;AACjBgG,mBAAOM,KAAKC,GAAL,CAASP,IAAT,EAAeK,GAAGtE,CAAlB,CAAP;AACAoE,mBAAOG,KAAKE,GAAL,CAASL,IAAT,EAAeE,GAAGtE,CAAlB,CAAP;AACAmE,mBAAOI,KAAKC,GAAL,CAASL,IAAT,EAAeG,GAAGrE,CAAlB,CAAP;AACAoE,mBAAOE,KAAKE,GAAL,CAASJ,IAAT,EAAeC,GAAGrE,CAAlB,CAAP;AACH;AACJ;AACD,WAAO,EAAEgE,IAAF,EAAQE,IAAR,EAAcC,IAAd,EAAoBC,IAApB,EAAP;AACH;;AAED;AACO,SAASxI,IAAT,CAAc6I,MAAd,EAAsBC,MAAtB,EAA8BC,QAA9B,EAAwC;AAC3C,QAAIC,UAAU,IAAI3E,qBAAWC,OAAf,EAAd;AACA0E,YAAQlE,QAAR,CAAiB+D,MAAjB,EAAyBxE,qBAAWU,QAAX,CAAoBC,SAA7C,EAAwD,IAAxD;AACAgE,YAAQlE,QAAR,CAAiBgE,MAAjB,EAAyBzE,qBAAWU,QAAX,CAAoBkE,MAA7C,EAAqD,IAArD;AACA,QAAInH,SAAS,EAAb;AACAkH,YAAQ7D,OAAR,CAAgB4D,QAAhB,EAA0BjH,MAA1B,EAAkCuC,qBAAWI,YAAX,CAAwBC,UAA1D,EAAsEL,qBAAWI,YAAX,CAAwBC,UAA9F;AACA,WAAO5C,MAAP;AACH;;AAED;AACO,SAAS7B,KAAT,CAAe4I,MAAf,EAAuBC,MAAvB,EAA+B;AAClC,WAAO9I,KAAK6I,MAAL,EAAaC,MAAb,EAAqBzE,qBAAWe,QAAX,CAAoBC,OAAzC,CAAP;AACH;;AAED;AACO,SAASnF,IAAT,CAAc2I,MAAd,EAAsBC,MAAtB,EAA8B;AACjC,WAAO9I,KAAK6I,MAAL,EAAaC,MAAb,EAAqBzE,qBAAWe,QAAX,CAAoB8D,YAAzC,CAAP;AACH;;AAED;AACO,SAAS/I,GAAT,CAAa0I,MAAb,EAAqBC,MAArB,EAA6B;AAChC,WAAO9I,KAAK6I,MAAL,EAAaC,MAAb,EAAqBzE,qBAAWe,QAAX,CAAoB+D,KAAzC,CAAP;AACH;;AAED;AACO,SAAS/I,MAAT,CAAgBwE,KAAhB,EAAuBwE,MAAvB,EAA+BC,QAA/B,EAAyCC,OAAzC,EAAkD;AACrD,QAAID,aAAaE,SAAjB,EACIF,WAAWhF,qBAAWmF,QAAX,CAAoBC,OAA/B;AACJ,QAAIH,YAAYC,SAAhB,EACID,UAAUjF,qBAAWqF,OAAX,CAAmBC,eAA7B;;AAEJ;AACA,QAAIN,aAAahF,qBAAWmF,QAAX,CAAoBI,QAArC,EACIP,WAAWhF,qBAAWmF,QAAX,CAAoBK,OAA/B,CADJ,KAEK,IAAIR,aAAahF,qBAAWmF,QAAX,CAAoBK,OAArC,EACDR,WAAWhF,qBAAWmF,QAAX,CAAoBI,QAA/B;;AAEJ,QAAIE,KAAK,IAAIzF,qBAAW0F,aAAf,CAA6B,CAA7B,EAAgCtJ,YAAhC,CAAT;AACAqJ,OAAGhF,QAAH,CAAYF,KAAZ,EAAmByE,QAAnB,EAA6BC,OAA7B;AACA,QAAIU,YAAY,EAAhB;AACAF,OAAG3E,OAAH,CAAW6E,SAAX,EAAsBZ,MAAtB;AACA,WAAOY,SAAP;AACH;;;;;;;;kCA3ZY3J,kB;;kCACAC,gB;;kCACAC,iB;;kCACAC,a;;kCACAC,Y;;kCAIJC,oB;;kCAiCAyB,iB;;kCA6BAK,wB;;kCA2CAc,kB;;kCA2BOjE,iB;;kCAUAC,iB;;kCAWAC,K;;kCAOAC,iB;;kCAOAC,oB;;kCAQAC,sB;;kCAkBPiF,sB;;kCAQAW,mB;;kCA+BO3F,mB;;kCAKAC,oB;;kCAoCAC,oB;;kCAmCAC,gB;;kCAoCAC,a;;kCAiBAC,I;;kCAUAC,K;;kCAKAC,I;;kCAKAC,G;;kCAKAC,M;;;;;;;;;;;;AChahB;;AAGA6J,KAAKC,SAAL,GAAkBC,KAAD,IAAW;;AAExB,UAAMC,OAAO,EAAb;;AAFwB,sBAIwDD,MAAME,IAJ9D;AAAA,QAIlBC,QAJkB,eAIlBA,QAJkB;AAAA,QAIRC,OAJQ,eAIRA,OAJQ;AAAA,QAICC,EAJD,eAICA,EAJD;AAAA,QAIKC,QAJL,eAIKA,QAJL;AAAA,QAIeC,YAJf,eAIeA,YAJf;AAAA,QAI6BC,WAJ7B,eAI6BA,WAJ7B;AAAA,QAI0CC,SAJ1C,eAI0CA,SAJ1C;;;AAMxB,UAAMC,iBAAiB,IAAIC,GAAJ,EAAvB;AACA,UAAMC,iBAAiB,EAAvB;;AAEA,aAASC,UAAT,CAAoBC,WAApB,EAAiCC,KAAjC,EAAwC;AACpC,YAAI,CAACD,WAAL,EACI,OAAO,IAAP;AACJ,YAAI,CAACC,KAAL,EACI,OAAO,KAAP;AACJ,eAAOD,YAAY,CAAZ,KAAkBC,MAAM,CAAN,CAAlB,IAA8BD,YAAY,CAAZ,KAAkBC,MAAM,CAAN,CAAhD,IAA4DD,YAAY,CAAZ,KAAkBC,MAAM,CAAN,CAA9E,IAA0FD,YAAY,CAAZ,KAAkBC,MAAM,CAAN,CAAnH;AACH;;AAED,aAASC,cAAT,CAAwBC,KAAxB,EAA+BC,EAA/B,EAAmC;AAC/B,YAAIC,MAAMV,UAAUW,IAAV,CAAeC,KAAKA,EAAEH,EAAF,KAASA,EAA7B,CAAV;AACA,YAAIC,IAAItH,QAAR,EAAkB;AACdoG,iBAAKlI,IAAL,CAAWuJ,EAAD,IAAQ;AACd,oBAAIL,KAAJ,EAAW;AACPT,kCAAc,iBAAMA,WAAN,EAAmB,kCAAuBW,IAAItH,QAA3B,EAAqCsH,IAAII,WAAzC,CAAnB,CAAd;AACH,iBAFD,MAEO,IAAIV,WAAWR,GAAGmB,eAAd,EAA+BL,IAAIM,SAAnC,KAAiDZ,WAAWR,GAAGqB,iBAAd,EAAiCP,IAAIQ,WAArC,CAArD,EAAwG;AAC3GjB,mCAAekB,GAAf,CAAmBT,IAAID,EAAvB;AACA,wBAAI,CAACb,GAAG3H,IAAH,CAAQmJ,QAAR,CAAiB,QAAjB,CAAL,EAAiC;AAC7B,4BAAIC,WAAW,KAAf;AACA,6BAAK,IAAIhI,OAAT,IAAoBqH,IAAItH,QAAxB,EACI,IAAIC,QAAQ3B,MAAR,IAAkB,CAAlB,IAAuB2B,QAAQ,CAAR,KAAcA,QAAQA,QAAQ3B,MAAR,GAAiB,CAAzB,CAArC,IAAoE2B,QAAQ,CAAR,KAAcA,QAAQA,QAAQ3B,MAAR,GAAiB,CAAzB,CAAtF,EACI2J,WAAW,IAAX;AACR,4BAAIrF,eAAe,kCAAuB0E,IAAItH,QAA3B,EAAqCsH,IAAII,WAAzC,CAAnB;AACA,4BAAIO,QAAJ,EACIxB,WAAW,eAAIA,QAAJ,EAAc7D,YAAd,CAAX,CADJ,KAEK,IAAI,CAAC4D,GAAGmB,eAAR,EACDjB,eAAeA,aAAawB,MAAb,CAAoBtF,YAApB,CAAf;AACP;AACJ;AACD6E;AACH,aAlBD;AAmBH;AACD,YAAIH,IAAIzI,IAAJ,KAAa,OAAb,IAAwB,CAACuI,KAA7B,EAAoC;AAChCP,2BAAekB,GAAf,CAAmBT,IAAID,EAAvB;AACAN,2BAAe7I,IAAf,CAAoBoJ,GAApB;AACH;AACD,aAAK,IAAIa,KAAT,IAAkBb,IAAIc,QAAtB,EACIjB,eAAeC,KAAf,EAAsBe,KAAtB;AACP;AACD,SAAK,IAAId,EAAT,IAAeb,GAAGI,SAAlB,EACIO,eAAe,KAAf,EAAsBE,EAAtB;AACJ,SAAK,IAAIA,EAAT,IAAeb,GAAG6B,YAAlB,EACIlB,eAAe,IAAf,EAAqBE,EAArB;;AAEJ,QAAIiB,QAAQ,MAAMlC,KAAK9H,MAAvB;AACA,QAAIiK,UAAU,CAAd;;AAEA,WAAOnC,KAAK9H,MAAZ,EAAoB;AAChB,YAAI;AACA,gBAAIkK,MAAMpC,KAAKqC,KAAL,EAAV;AACA,gBAAID,GAAJ,EAASA,IAAI,MAAM;AACfD,0BAAUA,UAAUD,KAApB;AACAI,4BAAY,EAAEvC,OAAO,YAAT,EAAuBoC,SAASI,SAASJ,OAAT,CAAhC,EAAZ;AACH,aAHQ;AAIZ,SAND,CAME,OAAOK,KAAP,EAAc;AACZC,oBAAQD,KAAR,CAAcA,KAAd;AACAF,wBAAY,EAAEvC,OAAO,SAAT,EAAoB2C,SAAS,sCAA7B,EAAqEC,OAAO,OAA5E,EAAqFH,OAAOA,MAAMI,QAAN,EAA5F,EAAZ;AACH;AACJ;;AAEDN,gBAAY,EAAEvC,OAAO,QAAT,EAAmBG,QAAnB,EAA6BC,OAA7B,EAAsCC,EAAtC,EAA0CC,QAA1C,EAAoDC,YAApD,EAAkEC,WAAlE,EAA+EE,cAA/E,EAA+FE,cAA/F,EAAZ;AACAd,SAAKgD,KAAL;AACH,CAtED;;;;;;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAA0C;AAChD,GAAG,oCAAO,UAAU;AAAA;AAAA;AAAA;AAAA,oGAAC;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iCAAiC;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA,cAAc,SAAS;AACvB;AACA,cAAc,SAAS;;AAEvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,QAAQ;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,YAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,sCAAsC;AACtC,wCAAwC;AACxC,yDAAyD;AACzD;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,4BAA4B,OAAO;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,mCAAmC,SAAS;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,QAAQ;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA,yCAAyC;AACzC,qBAAqB;AACrB;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA6C;AAC7C,sDAAsD;AACtD;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA,2CAA2C;AAC3C,mDAAmD;;AAEnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6CAA6C,UAAU;AACvD;AACA,iDAAiD,UAAU;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oCAAoC,UAAU;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6CAA6C,UAAU;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,6CAA6C,UAAU;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,UAAU;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,GAAG,cAAc;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qDAAqD,UAAU;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,SAAS;AACjB,0CAA0C,UAAU;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,UAAU;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA6C,UAAU;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,SAAS;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,wBAAwB;AAC3B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,UAAU;AAChD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,aAAa;AAC/B;AACA;AACA,2DAA2D,UAAU;AACrE;AACA;AACA;AACA;AACA,kBAAkB,aAAa;AAC/B;AACA;AACA,2DAA2D,UAAU;AACrE;AACA;AACA;AACA;AACA,iBAAiB,yBAAyB;AAC1C,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,WAAW;AACxF;AACA;;AAEA;AACA;AACA;AACA;AACA,+CAA+C,UAAU;AACzD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,UAAU;AAChD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mCAAmC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mCAAmC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mCAAmC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,mCAAmC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA,yBAAyB,OAAO;AAChC;AACA;AACA;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,OAAO;AAChC;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,4BAA4B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,aAAa;AACb,eAAe,cAAc;AAC7B;AACA,iBAAiB;AACjB,qBAAqB;AACrB,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,UAAU;AACvB;AACA;AACA;AACA;AACA,8DAA8D,UAAU;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuC,UAAU;AACjD;AACA;AACA,iDAAiD,UAAU;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,UAAU;AACzE;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;;;;;;AC58OD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;;AAGb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,mBAAO,CAAC,CAAM;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,aAAa,OAAO,WAAW;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA,kDAAkD;AAClD,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,IAAI,mCAAmC;AAClD,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA,WAAW,IAAI,mCAAmC;AAClD,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,IAAI,mCAAmC;AAClD,WAAW,IAAI,mCAAmC;AAClD,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,IAAI,mCAAmC;AAClD,WAAW,IAAI,mCAAmC;AAClD,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,IAAI,mCAAmC;AAClD,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,SAAS,IAAI;AACb;;AAEA;AACA;AACA,uBAAuB;AACvB;;AAEA;AACA;AACA;AACA,WAAW,IAAI,mCAAmC;AAClD,WAAW,IAAI,mCAAmC;AAClD,YAAY,OAAO;AACnB;AACA;AACA;AACA;;;AAGA;;AAEA;;;;;;;;AClRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEa;;AAEb;AACA;AACA;AACA,kDAAkD,2CAA2C;AAC7F;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa,mBAAO,CAAC,CAAU;AAC/B,iBAAiB,mBAAO,CAAC,CAAc;AACvC,eAAe,mBAAO,CAAC,CAAY;AACnC,WAAW,mBAAO,CAAC,CAAkB;;;AAGrC;;AAEA,YAAY,mBAAO,CAAC,EAAS;;AAE7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;;AAEA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,IAAI;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB,YAAY;AACZ;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA,WAAW,UAAU;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;;AAGA;;AAEA;;;;;;;;ACj0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEa;;;AAGb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,mBAAO,CAAC,CAAc;AACvC,YAAY,mBAAO,CAAC,CAAS;AAC7B,eAAe,mBAAO,CAAC,CAAY;AACnC,YAAY,mBAAO,CAAC,EAAS;AAC7B,qBAAqB,mBAAO,CAAC,CAAkB;AAC/C;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA,eAAe,KAAK;AACpB;AACA,eAAe,KAAK;AACpB;AACA,eAAe,OAAO;AACtB;AACA,eAAe,QAAQ;AACvB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA,eAAe,QAAQ;AACvB;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;AACpB,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,kBAAkB;AAC9E;AACA,4BAA4B,aAAa,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa;AACzF,4DAA4D,kBAAkB;AAC9E;AACA;AACA;AACA,WAAW,WAAW,6DAA6D,gBAAgB;AACnG,yDAAyD,KAAK;AAC9D,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,aAAa,GAAG,aAAa,GAAG,aAAa;AACrE;AACA,WAAW,WAAW,gDAAgD;AACtE;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA,oBAAoB,+BAA+B;AACnD;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa,GAAG,aAAa,GAAG,aAAa;AAC3D,cAAc,aAAa,GAAG,aAAa,GAAG,aAAa;AAC3D;AACA;AACA;AACA,WAAW,mBAAmB,sDAAsD;AACpF;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,aAAa;AACrC;AACA,WAAW,GAAG,uCAAuC;AACrD;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA,oBAAoB,gCAAgC;AACpD;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,aAAa,GAAG,aAAa,GAAG,aAAa;AACvE;AACA,WAAW,WAAW,6CAA6C;AACnE;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;;AAGA;AACA;AACA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB;AACvF;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,gBAAgB;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,oCAAoC;AACxD;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;;;;;;;AC5hBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,WAAW,IAAI,wBAAwB;AACvC,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"8456ed5965fc36cb7c68.worker.js","sourcesContent":[" \tvar parentHotUpdateCallback = this[\"webpackHotUpdate\"];\n \tthis[\"webpackHotUpdate\"] = \r\n \tfunction webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars\r\n \t\thotAddUpdateChunk(chunkId, moreModules);\r\n \t\tif(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);\r\n \t} ;\r\n \t\r\n \tfunction hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars\r\n \t\timportScripts(__webpack_require__.p + \"\" + chunkId + \".\" + hotCurrentHash + \".hot-update.js\");\r\n \t}\r\n \t\r\n \tfunction hotDownloadManifest(callback) { // eslint-disable-line no-unused-vars\r\n \t\treturn new Promise(function(resolve, reject) {\r\n \t\t\tif(typeof XMLHttpRequest === \"undefined\")\r\n \t\t\t\treturn reject(new Error(\"No browser support\"));\r\n \t\t\ttry {\r\n \t\t\t\tvar request = new XMLHttpRequest();\r\n \t\t\t\tvar requestPath = __webpack_require__.p + \"\" + hotCurrentHash + \".hot-update.json\";\r\n \t\t\t\trequest.open(\"GET\", requestPath, true);\r\n \t\t\t\trequest.timeout = 10000;\r\n \t\t\t\trequest.send(null);\r\n \t\t\t} catch(err) {\r\n \t\t\t\treturn reject(err);\r\n \t\t\t}\r\n \t\t\trequest.onreadystatechange = function() {\r\n \t\t\t\tif(request.readyState !== 4) return;\r\n \t\t\t\tif(request.status === 0) {\r\n \t\t\t\t\t// timeout\r\n \t\t\t\t\treject(new Error(\"Manifest request to \" + requestPath + \" timed out.\"));\r\n \t\t\t\t} else if(request.status === 404) {\r\n \t\t\t\t\t// no update available\r\n \t\t\t\t\tresolve();\r\n \t\t\t\t} else if(request.status !== 200 && request.status !== 304) {\r\n \t\t\t\t\t// other failure\r\n \t\t\t\t\treject(new Error(\"Manifest request to \" + requestPath + \" failed.\"));\r\n \t\t\t\t} else {\r\n \t\t\t\t\t// success\r\n \t\t\t\t\ttry {\r\n \t\t\t\t\t\tvar update = JSON.parse(request.responseText);\r\n \t\t\t\t\t} catch(e) {\r\n \t\t\t\t\t\treject(e);\r\n \t\t\t\t\t\treturn;\r\n \t\t\t\t\t}\r\n \t\t\t\t\tresolve(update);\r\n \t\t\t\t}\r\n \t\t\t};\r\n \t\t});\r\n \t}\r\n \t\r\n \tfunction hotDisposeChunk(chunkId) { //eslint-disable-line no-unused-vars\r\n \t\tdelete installedChunks[chunkId];\r\n \t}\r\n\n \t\r\n \t\r\n \tvar hotApplyOnUpdate = true;\r\n \tvar hotCurrentHash = \"8456ed5965fc36cb7c68\"; // eslint-disable-line no-unused-vars\r\n \tvar hotCurrentModuleData = {};\r\n \tvar hotCurrentChildModule; // eslint-disable-line no-unused-vars\r\n \tvar hotCurrentParents = []; // eslint-disable-line no-unused-vars\r\n \tvar hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars\r\n \t\r\n \tfunction hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars\r\n \t\tvar me = installedModules[moduleId];\r\n \t\tif(!me) return __webpack_require__;\r\n \t\tvar fn = function(request) {\r\n \t\t\tif(me.hot.active) {\r\n \t\t\t\tif(installedModules[request]) {\r\n \t\t\t\t\tif(installedModules[request].parents.indexOf(moduleId) < 0)\r\n \t\t\t\t\t\tinstalledModules[request].parents.push(moduleId);\r\n \t\t\t\t} else {\r\n \t\t\t\t\thotCurrentParents = [moduleId];\r\n \t\t\t\t\thotCurrentChildModule = request;\r\n \t\t\t\t}\r\n \t\t\t\tif(me.children.indexOf(request) < 0)\r\n \t\t\t\t\tme.children.push(request);\r\n \t\t\t} else {\r\n \t\t\t\tconsole.warn(\"[HMR] unexpected require(\" + request + \") from disposed module \" + moduleId);\r\n \t\t\t\thotCurrentParents = [];\r\n \t\t\t}\r\n \t\t\treturn __webpack_require__(request);\r\n \t\t};\r\n \t\tvar ObjectFactory = function ObjectFactory(name) {\r\n \t\t\treturn {\r\n \t\t\t\tconfigurable: true,\r\n \t\t\t\tenumerable: true,\r\n \t\t\t\tget: function() {\r\n \t\t\t\t\treturn __webpack_require__[name];\r\n \t\t\t\t},\r\n \t\t\t\tset: function(value) {\r\n \t\t\t\t\t__webpack_require__[name] = value;\r\n \t\t\t\t}\r\n \t\t\t};\r\n \t\t};\r\n \t\tfor(var name in __webpack_require__) {\r\n \t\t\tif(Object.prototype.hasOwnProperty.call(__webpack_require__, name) && name !== \"e\") {\r\n \t\t\t\tObject.defineProperty(fn, name, ObjectFactory(name));\r\n \t\t\t}\r\n \t\t}\r\n \t\tfn.e = function(chunkId) {\r\n \t\t\tif(hotStatus === \"ready\")\r\n \t\t\t\thotSetStatus(\"prepare\");\r\n \t\t\thotChunksLoading++;\r\n \t\t\treturn __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) {\r\n \t\t\t\tfinishChunkLoading();\r\n \t\t\t\tthrow err;\r\n \t\t\t});\r\n \t\r\n \t\t\tfunction finishChunkLoading() {\r\n \t\t\t\thotChunksLoading--;\r\n \t\t\t\tif(hotStatus === \"prepare\") {\r\n \t\t\t\t\tif(!hotWaitingFilesMap[chunkId]) {\r\n \t\t\t\t\t\thotEnsureUpdateChunk(chunkId);\r\n \t\t\t\t\t}\r\n \t\t\t\t\tif(hotChunksLoading === 0 && hotWaitingFiles === 0) {\r\n \t\t\t\t\t\thotUpdateDownloaded();\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t};\r\n \t\treturn fn;\r\n \t}\r\n \t\r\n \tfunction hotCreateModule(moduleId) { // eslint-disable-line no-unused-vars\r\n \t\tvar hot = {\r\n \t\t\t// private stuff\r\n \t\t\t_acceptedDependencies: {},\r\n \t\t\t_declinedDependencies: {},\r\n \t\t\t_selfAccepted: false,\r\n \t\t\t_selfDeclined: false,\r\n \t\t\t_disposeHandlers: [],\r\n \t\t\t_main: hotCurrentChildModule !== moduleId,\r\n \t\r\n \t\t\t// Module API\r\n \t\t\tactive: true,\r\n \t\t\taccept: function(dep, callback) {\r\n \t\t\t\tif(typeof dep === \"undefined\")\r\n \t\t\t\t\thot._selfAccepted = true;\r\n \t\t\t\telse if(typeof dep === \"function\")\r\n \t\t\t\t\thot._selfAccepted = dep;\r\n \t\t\t\telse if(typeof dep === \"object\")\r\n \t\t\t\t\tfor(var i = 0; i < dep.length; i++)\r\n \t\t\t\t\t\thot._acceptedDependencies[dep[i]] = callback || function() {};\r\n \t\t\t\telse\r\n \t\t\t\t\thot._acceptedDependencies[dep] = callback || function() {};\r\n \t\t\t},\r\n \t\t\tdecline: function(dep) {\r\n \t\t\t\tif(typeof dep === \"undefined\")\r\n \t\t\t\t\thot._selfDeclined = true;\r\n \t\t\t\telse if(typeof dep === \"object\")\r\n \t\t\t\t\tfor(var i = 0; i < dep.length; i++)\r\n \t\t\t\t\t\thot._declinedDependencies[dep[i]] = true;\r\n \t\t\t\telse\r\n \t\t\t\t\thot._declinedDependencies[dep] = true;\r\n \t\t\t},\r\n \t\t\tdispose: function(callback) {\r\n \t\t\t\thot._disposeHandlers.push(callback);\r\n \t\t\t},\r\n \t\t\taddDisposeHandler: function(callback) {\r\n \t\t\t\thot._disposeHandlers.push(callback);\r\n \t\t\t},\r\n \t\t\tremoveDisposeHandler: function(callback) {\r\n \t\t\t\tvar idx = hot._disposeHandlers.indexOf(callback);\r\n \t\t\t\tif(idx >= 0) hot._disposeHandlers.splice(idx, 1);\r\n \t\t\t},\r\n \t\r\n \t\t\t// Management API\r\n \t\t\tcheck: hotCheck,\r\n \t\t\tapply: hotApply,\r\n \t\t\tstatus: function(l) {\r\n \t\t\t\tif(!l) return hotStatus;\r\n \t\t\t\thotStatusHandlers.push(l);\r\n \t\t\t},\r\n \t\t\taddStatusHandler: function(l) {\r\n \t\t\t\thotStatusHandlers.push(l);\r\n \t\t\t},\r\n \t\t\tremoveStatusHandler: function(l) {\r\n \t\t\t\tvar idx = hotStatusHandlers.indexOf(l);\r\n \t\t\t\tif(idx >= 0) hotStatusHandlers.splice(idx, 1);\r\n \t\t\t},\r\n \t\r\n \t\t\t//inherit from previous dispose call\r\n \t\t\tdata: hotCurrentModuleData[moduleId]\r\n \t\t};\r\n \t\thotCurrentChildModule = undefined;\r\n \t\treturn hot;\r\n \t}\r\n \t\r\n \tvar hotStatusHandlers = [];\r\n \tvar hotStatus = \"idle\";\r\n \t\r\n \tfunction hotSetStatus(newStatus) {\r\n \t\thotStatus = newStatus;\r\n \t\tfor(var i = 0; i < hotStatusHandlers.length; i++)\r\n \t\t\thotStatusHandlers[i].call(null, newStatus);\r\n \t}\r\n \t\r\n \t// while downloading\r\n \tvar hotWaitingFiles = 0;\r\n \tvar hotChunksLoading = 0;\r\n \tvar hotWaitingFilesMap = {};\r\n \tvar hotRequestedFilesMap = {};\r\n \tvar hotAvailableFilesMap = {};\r\n \tvar hotDeferred;\r\n \t\r\n \t// The update info\r\n \tvar hotUpdate, hotUpdateNewHash;\r\n \t\r\n \tfunction toModuleId(id) {\r\n \t\tvar isNumber = (+id) + \"\" === id;\r\n \t\treturn isNumber ? +id : id;\r\n \t}\r\n \t\r\n \tfunction hotCheck(apply) {\r\n \t\tif(hotStatus !== \"idle\") throw new Error(\"check() is only allowed in idle status\");\r\n \t\thotApplyOnUpdate = apply;\r\n \t\thotSetStatus(\"check\");\r\n \t\treturn hotDownloadManifest().then(function(update) {\r\n \t\t\tif(!update) {\r\n \t\t\t\thotSetStatus(\"idle\");\r\n \t\t\t\treturn null;\r\n \t\t\t}\r\n \t\t\thotRequestedFilesMap = {};\r\n \t\t\thotWaitingFilesMap = {};\r\n \t\t\thotAvailableFilesMap = update.c;\r\n \t\t\thotUpdateNewHash = update.h;\r\n \t\r\n \t\t\thotSetStatus(\"prepare\");\r\n \t\t\tvar promise = new Promise(function(resolve, reject) {\r\n \t\t\t\thotDeferred = {\r\n \t\t\t\t\tresolve: resolve,\r\n \t\t\t\t\treject: reject\r\n \t\t\t\t};\r\n \t\t\t});\r\n \t\t\thotUpdate = {};\r\n \t\t\tvar chunkId = 0;\r\n \t\t\t{ // eslint-disable-line no-lone-blocks\r\n \t\t\t\t/*globals chunkId */\r\n \t\t\t\thotEnsureUpdateChunk(chunkId);\r\n \t\t\t}\r\n \t\t\tif(hotStatus === \"prepare\" && hotChunksLoading === 0 && hotWaitingFiles === 0) {\r\n \t\t\t\thotUpdateDownloaded();\r\n \t\t\t}\r\n \t\t\treturn promise;\r\n \t\t});\r\n \t}\r\n \t\r\n \tfunction hotAddUpdateChunk(chunkId, moreModules) { // eslint-disable-line no-unused-vars\r\n \t\tif(!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId])\r\n \t\t\treturn;\r\n \t\thotRequestedFilesMap[chunkId] = false;\r\n \t\tfor(var moduleId in moreModules) {\r\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\r\n \t\t\t\thotUpdate[moduleId] = moreModules[moduleId];\r\n \t\t\t}\r\n \t\t}\r\n \t\tif(--hotWaitingFiles === 0 && hotChunksLoading === 0) {\r\n \t\t\thotUpdateDownloaded();\r\n \t\t}\r\n \t}\r\n \t\r\n \tfunction hotEnsureUpdateChunk(chunkId) {\r\n \t\tif(!hotAvailableFilesMap[chunkId]) {\r\n \t\t\thotWaitingFilesMap[chunkId] = true;\r\n \t\t} else {\r\n \t\t\thotRequestedFilesMap[chunkId] = true;\r\n \t\t\thotWaitingFiles++;\r\n \t\t\thotDownloadUpdateChunk(chunkId);\r\n \t\t}\r\n \t}\r\n \t\r\n \tfunction hotUpdateDownloaded() {\r\n \t\thotSetStatus(\"ready\");\r\n \t\tvar deferred = hotDeferred;\r\n \t\thotDeferred = null;\r\n \t\tif(!deferred) return;\r\n \t\tif(hotApplyOnUpdate) {\r\n \t\t\thotApply(hotApplyOnUpdate).then(function(result) {\r\n \t\t\t\tdeferred.resolve(result);\r\n \t\t\t}, function(err) {\r\n \t\t\t\tdeferred.reject(err);\r\n \t\t\t});\r\n \t\t} else {\r\n \t\t\tvar outdatedModules = [];\r\n \t\t\tfor(var id in hotUpdate) {\r\n \t\t\t\tif(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {\r\n \t\t\t\t\toutdatedModules.push(toModuleId(id));\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t\tdeferred.resolve(outdatedModules);\r\n \t\t}\r\n \t}\r\n \t\r\n \tfunction hotApply(options) {\r\n \t\tif(hotStatus !== \"ready\") throw new Error(\"apply() is only allowed in ready status\");\r\n \t\toptions = options || {};\r\n \t\r\n \t\tvar cb;\r\n \t\tvar i;\r\n \t\tvar j;\r\n \t\tvar module;\r\n \t\tvar moduleId;\r\n \t\r\n \t\tfunction getAffectedStuff(updateModuleId) {\r\n \t\t\tvar outdatedModules = [updateModuleId];\r\n \t\t\tvar outdatedDependencies = {};\r\n \t\r\n \t\t\tvar queue = outdatedModules.slice().map(function(id) {\r\n \t\t\t\treturn {\r\n \t\t\t\t\tchain: [id],\r\n \t\t\t\t\tid: id\r\n \t\t\t\t};\r\n \t\t\t});\r\n \t\t\twhile(queue.length > 0) {\r\n \t\t\t\tvar queueItem = queue.pop();\r\n \t\t\t\tvar moduleId = queueItem.id;\r\n \t\t\t\tvar chain = queueItem.chain;\r\n \t\t\t\tmodule = installedModules[moduleId];\r\n \t\t\t\tif(!module || module.hot._selfAccepted)\r\n \t\t\t\t\tcontinue;\r\n \t\t\t\tif(module.hot._selfDeclined) {\r\n \t\t\t\t\treturn {\r\n \t\t\t\t\t\ttype: \"self-declined\",\r\n \t\t\t\t\t\tchain: chain,\r\n \t\t\t\t\t\tmoduleId: moduleId\r\n \t\t\t\t\t};\r\n \t\t\t\t}\r\n \t\t\t\tif(module.hot._main) {\r\n \t\t\t\t\treturn {\r\n \t\t\t\t\t\ttype: \"unaccepted\",\r\n \t\t\t\t\t\tchain: chain,\r\n \t\t\t\t\t\tmoduleId: moduleId\r\n \t\t\t\t\t};\r\n \t\t\t\t}\r\n \t\t\t\tfor(var i = 0; i < module.parents.length; i++) {\r\n \t\t\t\t\tvar parentId = module.parents[i];\r\n \t\t\t\t\tvar parent = installedModules[parentId];\r\n \t\t\t\t\tif(!parent) continue;\r\n \t\t\t\t\tif(parent.hot._declinedDependencies[moduleId]) {\r\n \t\t\t\t\t\treturn {\r\n \t\t\t\t\t\t\ttype: \"declined\",\r\n \t\t\t\t\t\t\tchain: chain.concat([parentId]),\r\n \t\t\t\t\t\t\tmoduleId: moduleId,\r\n \t\t\t\t\t\t\tparentId: parentId\r\n \t\t\t\t\t\t};\r\n \t\t\t\t\t}\r\n \t\t\t\t\tif(outdatedModules.indexOf(parentId) >= 0) continue;\r\n \t\t\t\t\tif(parent.hot._acceptedDependencies[moduleId]) {\r\n \t\t\t\t\t\tif(!outdatedDependencies[parentId])\r\n \t\t\t\t\t\t\toutdatedDependencies[parentId] = [];\r\n \t\t\t\t\t\taddAllToSet(outdatedDependencies[parentId], [moduleId]);\r\n \t\t\t\t\t\tcontinue;\r\n \t\t\t\t\t}\r\n \t\t\t\t\tdelete outdatedDependencies[parentId];\r\n \t\t\t\t\toutdatedModules.push(parentId);\r\n \t\t\t\t\tqueue.push({\r\n \t\t\t\t\t\tchain: chain.concat([parentId]),\r\n \t\t\t\t\t\tid: parentId\r\n \t\t\t\t\t});\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\r\n \t\t\treturn {\r\n \t\t\t\ttype: \"accepted\",\r\n \t\t\t\tmoduleId: updateModuleId,\r\n \t\t\t\toutdatedModules: outdatedModules,\r\n \t\t\t\toutdatedDependencies: outdatedDependencies\r\n \t\t\t};\r\n \t\t}\r\n \t\r\n \t\tfunction addAllToSet(a, b) {\r\n \t\t\tfor(var i = 0; i < b.length; i++) {\r\n \t\t\t\tvar item = b[i];\r\n \t\t\t\tif(a.indexOf(item) < 0)\r\n \t\t\t\t\ta.push(item);\r\n \t\t\t}\r\n \t\t}\r\n \t\r\n \t\t// at begin all updates modules are outdated\r\n \t\t// the \"outdated\" status can propagate to parents if they don't accept the children\r\n \t\tvar outdatedDependencies = {};\r\n \t\tvar outdatedModules = [];\r\n \t\tvar appliedUpdate = {};\r\n \t\r\n \t\tvar warnUnexpectedRequire = function warnUnexpectedRequire() {\r\n \t\t\tconsole.warn(\"[HMR] unexpected require(\" + result.moduleId + \") to disposed module\");\r\n \t\t};\r\n \t\r\n \t\tfor(var id in hotUpdate) {\r\n \t\t\tif(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {\r\n \t\t\t\tmoduleId = toModuleId(id);\r\n \t\t\t\tvar result;\r\n \t\t\t\tif(hotUpdate[id]) {\r\n \t\t\t\t\tresult = getAffectedStuff(moduleId);\r\n \t\t\t\t} else {\r\n \t\t\t\t\tresult = {\r\n \t\t\t\t\t\ttype: \"disposed\",\r\n \t\t\t\t\t\tmoduleId: id\r\n \t\t\t\t\t};\r\n \t\t\t\t}\r\n \t\t\t\tvar abortError = false;\r\n \t\t\t\tvar doApply = false;\r\n \t\t\t\tvar doDispose = false;\r\n \t\t\t\tvar chainInfo = \"\";\r\n \t\t\t\tif(result.chain) {\r\n \t\t\t\t\tchainInfo = \"\\nUpdate propagation: \" + result.chain.join(\" -> \");\r\n \t\t\t\t}\r\n \t\t\t\tswitch(result.type) {\r\n \t\t\t\t\tcase \"self-declined\":\r\n \t\t\t\t\t\tif(options.onDeclined)\r\n \t\t\t\t\t\t\toptions.onDeclined(result);\r\n \t\t\t\t\t\tif(!options.ignoreDeclined)\r\n \t\t\t\t\t\t\tabortError = new Error(\"Aborted because of self decline: \" + result.moduleId + chainInfo);\r\n \t\t\t\t\t\tbreak;\r\n \t\t\t\t\tcase \"declined\":\r\n \t\t\t\t\t\tif(options.onDeclined)\r\n \t\t\t\t\t\t\toptions.onDeclined(result);\r\n \t\t\t\t\t\tif(!options.ignoreDeclined)\r\n \t\t\t\t\t\t\tabortError = new Error(\"Aborted because of declined dependency: \" + result.moduleId + \" in \" + result.parentId + chainInfo);\r\n \t\t\t\t\t\tbreak;\r\n \t\t\t\t\tcase \"unaccepted\":\r\n \t\t\t\t\t\tif(options.onUnaccepted)\r\n \t\t\t\t\t\t\toptions.onUnaccepted(result);\r\n \t\t\t\t\t\tif(!options.ignoreUnaccepted)\r\n \t\t\t\t\t\t\tabortError = new Error(\"Aborted because \" + moduleId + \" is not accepted\" + chainInfo);\r\n \t\t\t\t\t\tbreak;\r\n \t\t\t\t\tcase \"accepted\":\r\n \t\t\t\t\t\tif(options.onAccepted)\r\n \t\t\t\t\t\t\toptions.onAccepted(result);\r\n \t\t\t\t\t\tdoApply = true;\r\n \t\t\t\t\t\tbreak;\r\n \t\t\t\t\tcase \"disposed\":\r\n \t\t\t\t\t\tif(options.onDisposed)\r\n \t\t\t\t\t\t\toptions.onDisposed(result);\r\n \t\t\t\t\t\tdoDispose = true;\r\n \t\t\t\t\t\tbreak;\r\n \t\t\t\t\tdefault:\r\n \t\t\t\t\t\tthrow new Error(\"Unexception type \" + result.type);\r\n \t\t\t\t}\r\n \t\t\t\tif(abortError) {\r\n \t\t\t\t\thotSetStatus(\"abort\");\r\n \t\t\t\t\treturn Promise.reject(abortError);\r\n \t\t\t\t}\r\n \t\t\t\tif(doApply) {\r\n \t\t\t\t\tappliedUpdate[moduleId] = hotUpdate[moduleId];\r\n \t\t\t\t\taddAllToSet(outdatedModules, result.outdatedModules);\r\n \t\t\t\t\tfor(moduleId in result.outdatedDependencies) {\r\n \t\t\t\t\t\tif(Object.prototype.hasOwnProperty.call(result.outdatedDependencies, moduleId)) {\r\n \t\t\t\t\t\t\tif(!outdatedDependencies[moduleId])\r\n \t\t\t\t\t\t\t\toutdatedDependencies[moduleId] = [];\r\n \t\t\t\t\t\t\taddAllToSet(outdatedDependencies[moduleId], result.outdatedDependencies[moduleId]);\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n \t\t\t\tif(doDispose) {\r\n \t\t\t\t\taddAllToSet(outdatedModules, [result.moduleId]);\r\n \t\t\t\t\tappliedUpdate[moduleId] = warnUnexpectedRequire;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\r\n \t\t// Store self accepted outdated modules to require them later by the module system\r\n \t\tvar outdatedSelfAcceptedModules = [];\r\n \t\tfor(i = 0; i < outdatedModules.length; i++) {\r\n \t\t\tmoduleId = outdatedModules[i];\r\n \t\t\tif(installedModules[moduleId] && installedModules[moduleId].hot._selfAccepted)\r\n \t\t\t\toutdatedSelfAcceptedModules.push({\r\n \t\t\t\t\tmodule: moduleId,\r\n \t\t\t\t\terrorHandler: installedModules[moduleId].hot._selfAccepted\r\n \t\t\t\t});\r\n \t\t}\r\n \t\r\n \t\t// Now in \"dispose\" phase\r\n \t\thotSetStatus(\"dispose\");\r\n \t\tObject.keys(hotAvailableFilesMap).forEach(function(chunkId) {\r\n \t\t\tif(hotAvailableFilesMap[chunkId] === false) {\r\n \t\t\t\thotDisposeChunk(chunkId);\r\n \t\t\t}\r\n \t\t});\r\n \t\r\n \t\tvar idx;\r\n \t\tvar queue = outdatedModules.slice();\r\n \t\twhile(queue.length > 0) {\r\n \t\t\tmoduleId = queue.pop();\r\n \t\t\tmodule = installedModules[moduleId];\r\n \t\t\tif(!module) continue;\r\n \t\r\n \t\t\tvar data = {};\r\n \t\r\n \t\t\t// Call dispose handlers\r\n \t\t\tvar disposeHandlers = module.hot._disposeHandlers;\r\n \t\t\tfor(j = 0; j < disposeHandlers.length; j++) {\r\n \t\t\t\tcb = disposeHandlers[j];\r\n \t\t\t\tcb(data);\r\n \t\t\t}\r\n \t\t\thotCurrentModuleData[moduleId] = data;\r\n \t\r\n \t\t\t// disable module (this disables requires from this module)\r\n \t\t\tmodule.hot.active = false;\r\n \t\r\n \t\t\t// remove module from cache\r\n \t\t\tdelete installedModules[moduleId];\r\n \t\r\n \t\t\t// remove \"parents\" references from all children\r\n \t\t\tfor(j = 0; j < module.children.length; j++) {\r\n \t\t\t\tvar child = installedModules[module.children[j]];\r\n \t\t\t\tif(!child) continue;\r\n \t\t\t\tidx = child.parents.indexOf(moduleId);\r\n \t\t\t\tif(idx >= 0) {\r\n \t\t\t\t\tchild.parents.splice(idx, 1);\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\r\n \t\t// remove outdated dependency from module children\r\n \t\tvar dependency;\r\n \t\tvar moduleOutdatedDependencies;\r\n \t\tfor(moduleId in outdatedDependencies) {\r\n \t\t\tif(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {\r\n \t\t\t\tmodule = installedModules[moduleId];\r\n \t\t\t\tif(module) {\r\n \t\t\t\t\tmoduleOutdatedDependencies = outdatedDependencies[moduleId];\r\n \t\t\t\t\tfor(j = 0; j < moduleOutdatedDependencies.length; j++) {\r\n \t\t\t\t\t\tdependency = moduleOutdatedDependencies[j];\r\n \t\t\t\t\t\tidx = module.children.indexOf(dependency);\r\n \t\t\t\t\t\tif(idx >= 0) module.children.splice(idx, 1);\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\r\n \t\t// Not in \"apply\" phase\r\n \t\thotSetStatus(\"apply\");\r\n \t\r\n \t\thotCurrentHash = hotUpdateNewHash;\r\n \t\r\n \t\t// insert new code\r\n \t\tfor(moduleId in appliedUpdate) {\r\n \t\t\tif(Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) {\r\n \t\t\t\tmodules[moduleId] = appliedUpdate[moduleId];\r\n \t\t\t}\r\n \t\t}\r\n \t\r\n \t\t// call accept handlers\r\n \t\tvar error = null;\r\n \t\tfor(moduleId in outdatedDependencies) {\r\n \t\t\tif(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {\r\n \t\t\t\tmodule = installedModules[moduleId];\r\n \t\t\t\tmoduleOutdatedDependencies = outdatedDependencies[moduleId];\r\n \t\t\t\tvar callbacks = [];\r\n \t\t\t\tfor(i = 0; i < moduleOutdatedDependencies.length; i++) {\r\n \t\t\t\t\tdependency = moduleOutdatedDependencies[i];\r\n \t\t\t\t\tcb = module.hot._acceptedDependencies[dependency];\r\n \t\t\t\t\tif(callbacks.indexOf(cb) >= 0) continue;\r\n \t\t\t\t\tcallbacks.push(cb);\r\n \t\t\t\t}\r\n \t\t\t\tfor(i = 0; i < callbacks.length; i++) {\r\n \t\t\t\t\tcb = callbacks[i];\r\n \t\t\t\t\ttry {\r\n \t\t\t\t\t\tcb(moduleOutdatedDependencies);\r\n \t\t\t\t\t} catch(err) {\r\n \t\t\t\t\t\tif(options.onErrored) {\r\n \t\t\t\t\t\t\toptions.onErrored({\r\n \t\t\t\t\t\t\t\ttype: \"accept-errored\",\r\n \t\t\t\t\t\t\t\tmoduleId: moduleId,\r\n \t\t\t\t\t\t\t\tdependencyId: moduleOutdatedDependencies[i],\r\n \t\t\t\t\t\t\t\terror: err\r\n \t\t\t\t\t\t\t});\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t\tif(!options.ignoreErrored) {\r\n \t\t\t\t\t\t\tif(!error)\r\n \t\t\t\t\t\t\t\terror = err;\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\r\n \t\t// Load self accepted modules\r\n \t\tfor(i = 0; i < outdatedSelfAcceptedModules.length; i++) {\r\n \t\t\tvar item = outdatedSelfAcceptedModules[i];\r\n \t\t\tmoduleId = item.module;\r\n \t\t\thotCurrentParents = [moduleId];\r\n \t\t\ttry {\r\n \t\t\t\t__webpack_require__(moduleId);\r\n \t\t\t} catch(err) {\r\n \t\t\t\tif(typeof item.errorHandler === \"function\") {\r\n \t\t\t\t\ttry {\r\n \t\t\t\t\t\titem.errorHandler(err);\r\n \t\t\t\t\t} catch(err2) {\r\n \t\t\t\t\t\tif(options.onErrored) {\r\n \t\t\t\t\t\t\toptions.onErrored({\r\n \t\t\t\t\t\t\t\ttype: \"self-accept-error-handler-errored\",\r\n \t\t\t\t\t\t\t\tmoduleId: moduleId,\r\n \t\t\t\t\t\t\t\terror: err2,\r\n \t\t\t\t\t\t\t\torginalError: err\r\n \t\t\t\t\t\t\t});\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t\tif(!options.ignoreErrored) {\r\n \t\t\t\t\t\t\tif(!error)\r\n \t\t\t\t\t\t\t\terror = err2;\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t\tif(!error)\r\n \t\t\t\t\t\t\terror = err;\r\n \t\t\t\t\t}\r\n \t\t\t\t} else {\r\n \t\t\t\t\tif(options.onErrored) {\r\n \t\t\t\t\t\toptions.onErrored({\r\n \t\t\t\t\t\t\ttype: \"self-accept-errored\",\r\n \t\t\t\t\t\t\tmoduleId: moduleId,\r\n \t\t\t\t\t\t\terror: err\r\n \t\t\t\t\t\t});\r\n \t\t\t\t\t}\r\n \t\t\t\t\tif(!options.ignoreErrored) {\r\n \t\t\t\t\t\tif(!error)\r\n \t\t\t\t\t\t\terror = err;\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\r\n \t\t// handle errors in accept handlers and self accepted module load\r\n \t\tif(error) {\r\n \t\t\thotSetStatus(\"fail\");\r\n \t\t\treturn Promise.reject(error);\r\n \t\t}\r\n \t\r\n \t\thotSetStatus(\"idle\");\r\n \t\treturn new Promise(function(resolve) {\r\n \t\t\tresolve(outdatedModules);\r\n \t\t});\r\n \t}\r\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {},\n \t\t\thot: hotCreateModule(moduleId),\n \t\t\tparents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp),\n \t\t\tchildren: []\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// __webpack_hash__\n \t__webpack_require__.h = function() { return hotCurrentHash; };\n\n \t// Load entry module and return exports\n \treturn hotCreateRequire(6)(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 8456ed5965fc36cb7c68","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n * \n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n * \n * All rights reserved.\n * \n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n\"use strict\";\n\n/**\n * The following functions operate on \"Point\" or any \"Point like\" object with {x,y},\n * as defined by the {@link XY} type\n * ([duck typing]{@link http://en.wikipedia.org/wiki/Duck_typing}).\n * @module\n * @private\n */\n\n/**\n * poly2tri.js supports using custom point class instead of {@linkcode Point}.\n * Any \"Point like\" object with <code>{x, y}</code> attributes is supported\n * to initialize the SweepContext polylines and points\n * ([duck typing]{@link http://en.wikipedia.org/wiki/Duck_typing}).\n *\n * poly2tri.js might add extra fields to the point objects when computing the\n * triangulation : they are prefixed with <code>_p2t_</code> to avoid collisions\n * with fields in the custom class.\n *\n * @example\n * var contour = [{x:100, y:100}, {x:100, y:300}, {x:300, y:300}, {x:300, y:100}];\n * var swctx = new poly2tri.SweepContext(contour);\n *\n * @typedef {Object} XY\n * @property {number} x - x coordinate\n * @property {number} y - y coordinate\n */\n\n\n/**\n * Point pretty printing : prints x and y coordinates.\n * @example\n * xy.toStringBase({x:5, y:42})\n * // → \"(5;42)\"\n * @protected\n * @param {!XY} p - point object with {x,y}\n * @returns {string} <code>\"(x;y)\"</code>\n */\nfunction toStringBase(p) {\n return (\"(\" + p.x + \";\" + p.y + \")\");\n}\n\n/**\n * Point pretty printing. Delegates to the point's custom \"toString()\" method if exists,\n * else simply prints x and y coordinates.\n * @example\n * xy.toString({x:5, y:42})\n * // → \"(5;42)\"\n * @example\n * xy.toString({x:5,y:42,toString:function() {return this.x+\":\"+this.y;}})\n * // → \"5:42\"\n * @param {!XY} p - point object with {x,y}\n * @returns {string} <code>\"(x;y)\"</code>\n */\nfunction toString(p) {\n // Try a custom toString first, and fallback to own implementation if none\n var s = p.toString();\n return (s === '[object Object]' ? toStringBase(p) : s);\n}\n\n\n/**\n * Compare two points component-wise. Ordered by y axis first, then x axis.\n * @param {!XY} a - point object with {x,y}\n * @param {!XY} b - point object with {x,y}\n * @return {number} <code>< 0</code> if <code>a < b</code>,\n * <code>> 0</code> if <code>a > b</code>, \n * <code>0</code> otherwise.\n */\nfunction compare(a, b) {\n if (a.y === b.y) {\n return a.x - b.x;\n } else {\n return a.y - b.y;\n }\n}\n\n/**\n * Test two Point objects for equality.\n * @param {!XY} a - point object with {x,y}\n * @param {!XY} b - point object with {x,y}\n * @return {boolean} <code>True</code> if <code>a == b</code>, <code>false</code> otherwise.\n */\nfunction equals(a, b) {\n return a.x === b.x && a.y === b.y;\n}\n\n\nmodule.exports = {\n toString: toString,\n toStringBase: toStringBase,\n compare: compare,\n equals: equals\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/xy.js\n// module id = 0\n// module chunks = 0","/*** IMPORTS FROM imports-loader ***/\n(function() {\nvar fix = module.exports=0;\n\n// Snap.svg 0.5.0\n//\n// Copyright (c) 2013 – 2017 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n// build: 2017-02-06\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ┌────────────────────────────────────────────────────────────┐ \\\\\n// │ Eve 0.5.0 - JavaScript Events Library │ \\\\\n// ├────────────────────────────────────────────────────────────┤ \\\\\n// │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\\\\n// └────────────────────────────────────────────────────────────┘ \\\\\n\n(function (glob) {\n var version = \"0.5.0\",\n has = \"hasOwnProperty\",\n separator = /[\\.\\/]/,\n comaseparator = /\\s*,\\s*/,\n wildcard = \"*\",\n fun = function () {},\n numsort = function (a, b) {\n return a - b;\n },\n current_event,\n stop,\n events = {n: {}},\n firstDefined = function () {\n for (var i = 0, ii = this.length; i < ii; i++) {\n if (typeof this[i] != \"undefined\") {\n return this[i];\n }\n }\n },\n lastDefined = function () {\n var i = this.length;\n while (--i) {\n if (typeof this[i] != \"undefined\") {\n return this[i];\n }\n }\n },\n objtos = Object.prototype.toString,\n Str = String,\n isArray = Array.isArray || function (ar) {\n return ar instanceof Array || objtos.call(ar) == \"[object Array]\";\n };\n /*\\\n * eve\n [ method ]\n\n * Fires event with given `name`, given scope and other parameters.\n\n > Arguments\n\n - name (string) name of the *event*, dot (`.`) or slash (`/`) separated\n - scope (object) context for the event handlers\n - varargs (...) the rest of arguments will be sent to event handlers\n\n = (object) array of returned values from the listeners. Array has two methods `.firstDefined()` and `.lastDefined()` to get first or last not `undefined` value.\n \\*/\n eve = function (name, scope) {\n var e = events,\n oldstop = stop,\n args = Array.prototype.slice.call(arguments, 2),\n listeners = eve.listeners(name),\n z = 0,\n f = false,\n l,\n indexed = [],\n queue = {},\n out = [],\n ce = current_event,\n errors = [];\n out.firstDefined = firstDefined;\n out.lastDefined = lastDefined;\n current_event = name;\n stop = 0;\n for (var i = 0, ii = listeners.length; i < ii; i++) if (\"zIndex\" in listeners[i]) {\n indexed.push(listeners[i].zIndex);\n if (listeners[i].zIndex < 0) {\n queue[listeners[i].zIndex] = listeners[i];\n }\n }\n indexed.sort(numsort);\n while (indexed[z] < 0) {\n l = queue[indexed[z++]];\n out.push(l.apply(scope, args));\n if (stop) {\n stop = oldstop;\n return out;\n }\n }\n for (i = 0; i < ii; i++) {\n l = listeners[i];\n if (\"zIndex\" in l) {\n if (l.zIndex == indexed[z]) {\n out.push(l.apply(scope, args));\n if (stop) {\n break;\n }\n do {\n z++;\n l = queue[indexed[z]];\n l && out.push(l.apply(scope, args));\n if (stop) {\n break;\n }\n } while (l)\n } else {\n queue[l.zIndex] = l;\n }\n } else {\n out.push(l.apply(scope, args));\n if (stop) {\n break;\n }\n }\n }\n stop = oldstop;\n current_event = ce;\n return out;\n };\n // Undocumented. Debug only.\n eve._events = events;\n /*\\\n * eve.listeners\n [ method ]\n\n * Internal method which gives you array of all event handlers that will be triggered by the given `name`.\n\n > Arguments\n\n - name (string) name of the event, dot (`.`) or slash (`/`) separated\n\n = (array) array of event handlers\n \\*/\n eve.listeners = function (name) {\n var names = isArray(name) ? name : name.split(separator),\n e = events,\n item,\n items,\n k,\n i,\n ii,\n j,\n jj,\n nes,\n es = [e],\n out = [];\n for (i = 0, ii = names.length; i < ii; i++) {\n nes = [];\n for (j = 0, jj = es.length; j < jj; j++) {\n e = es[j].n;\n items = [e[names[i]], e[wildcard]];\n k = 2;\n while (k--) {\n item = items[k];\n if (item) {\n nes.push(item);\n out = out.concat(item.f || []);\n }\n }\n }\n es = nes;\n }\n return out;\n };\n /*\\\n * eve.separator\n [ method ]\n\n * If for some reasons you don’t like default separators (`.` or `/`) you can specify yours\n * here. Be aware that if you pass a string longer than one character it will be treated as\n * a list of characters.\n\n - separator (string) new separator. Empty string resets to default: `.` or `/`.\n \\*/\n eve.separator = function (sep) {\n if (sep) {\n sep = Str(sep).replace(/(?=[\\.\\^\\]\\[\\-])/g, \"\\\\\");\n sep = \"[\" + sep + \"]\";\n separator = new RegExp(sep);\n } else {\n separator = /[\\.\\/]/;\n }\n };\n /*\\\n * eve.on\n [ method ]\n **\n * Binds given event handler with a given name. You can use wildcards “`*`” for the names:\n | eve.on(\"*.under.*\", f);\n | eve(\"mouse.under.floor\"); // triggers f\n * Use @eve to trigger the listener.\n **\n - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards\n - f (function) event handler function\n **\n - name (array) if you don’t want to use separators, you can use array of strings\n - f (function) event handler function\n **\n = (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment. \n > Example:\n | eve.on(\"mouse\", eatIt)(2);\n | eve.on(\"mouse\", scream);\n | eve.on(\"mouse\", catchIt)(1);\n * This will ensure that `catchIt` function will be called before `eatIt`.\n *\n * If you want to put your handler before non-indexed handlers, specify a negative value.\n * Note: I assume most of the time you don’t need to worry about z-index, but it’s nice to have this feature “just in case”.\n \\*/\n eve.on = function (name, f) {\n if (typeof f != \"function\") {\n return function () {};\n }\n var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator);\n for (var i = 0, ii = names.length; i < ii; i++) {\n (function (name) {\n var names = isArray(name) ? name : Str(name).split(separator),\n e = events,\n exist;\n for (var i = 0, ii = names.length; i < ii; i++) {\n e = e.n;\n e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {n: {}});\n }\n e.f = e.f || [];\n for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {\n exist = true;\n break;\n }\n !exist && e.f.push(f);\n }(names[i]));\n }\n return function (zIndex) {\n if (+zIndex == +zIndex) {\n f.zIndex = +zIndex;\n }\n };\n };\n /*\\\n * eve.f\n [ method ]\n **\n * Returns function that will fire given event with optional arguments.\n * Arguments that will be passed to the result function will be also\n * concated to the list of final arguments.\n | el.onclick = eve.f(\"click\", 1, 2);\n | eve.on(\"click\", function (a, b, c) {\n | console.log(a, b, c); // 1, 2, [event object]\n | });\n > Arguments\n - event (string) event name\n - varargs (…) and any other arguments\n = (function) possible event handler function\n \\*/\n eve.f = function (event) {\n var attrs = [].slice.call(arguments, 1);\n return function () {\n eve.apply(null, [event, null].concat(attrs).concat([].slice.call(arguments, 0)));\n };\n };\n /*\\\n * eve.stop\n [ method ]\n **\n * Is used inside an event handler to stop the event, preventing any subsequent listeners from firing.\n \\*/\n eve.stop = function () {\n stop = 1;\n };\n /*\\\n * eve.nt\n [ method ]\n **\n * Could be used inside event handler to figure out actual name of the event.\n **\n > Arguments\n **\n - subname (string) #optional subname of the event\n **\n = (string) name of the event, if `subname` is not specified\n * or\n = (boolean) `true`, if current event’s name contains `subname`\n \\*/\n eve.nt = function (subname) {\n var cur = isArray(current_event) ? current_event.join(\".\") : current_event;\n if (subname) {\n return new RegExp(\"(?:\\\\.|\\\\/|^)\" + subname + \"(?:\\\\.|\\\\/|$)\").test(cur);\n }\n return cur;\n };\n /*\\\n * eve.nts\n [ method ]\n **\n * Could be used inside event handler to figure out actual name of the event.\n **\n **\n = (array) names of the event\n \\*/\n eve.nts = function () {\n return isArray(current_event) ? current_event : current_event.split(separator);\n };\n /*\\\n * eve.off\n [ method ]\n **\n * Removes given function from the list of event listeners assigned to given name.\n * If no arguments specified all the events will be cleared.\n **\n > Arguments\n **\n - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards\n - f (function) event handler function\n \\*/\n /*\\\n * eve.unbind\n [ method ]\n **\n * See @eve.off\n \\*/\n eve.off = eve.unbind = function (name, f) {\n if (!name) {\n eve._events = events = {n: {}};\n return;\n }\n var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator);\n if (names.length > 1) {\n for (var i = 0, ii = names.length; i < ii; i++) {\n eve.off(names[i], f);\n }\n return;\n }\n names = isArray(name) ? name : Str(name).split(separator);\n var e,\n key,\n splice,\n i, ii, j, jj,\n cur = [events],\n inodes = [];\n for (i = 0, ii = names.length; i < ii; i++) {\n for (j = 0; j < cur.length; j += splice.length - 2) {\n splice = [j, 1];\n e = cur[j].n;\n if (names[i] != wildcard) {\n if (e[names[i]]) {\n splice.push(e[names[i]]);\n inodes.unshift({\n n: e,\n name: names[i]\n });\n }\n } else {\n for (key in e) if (e[has](key)) {\n splice.push(e[key]);\n inodes.unshift({\n n: e,\n name: key\n });\n }\n }\n cur.splice.apply(cur, splice);\n }\n }\n for (i = 0, ii = cur.length; i < ii; i++) {\n e = cur[i];\n while (e.n) {\n if (f) {\n if (e.f) {\n for (j = 0, jj = e.f.length; j < jj; j++) if (e.f[j] == f) {\n e.f.splice(j, 1);\n break;\n }\n !e.f.length && delete e.f;\n }\n for (key in e.n) if (e.n[has](key) && e.n[key].f) {\n var funcs = e.n[key].f;\n for (j = 0, jj = funcs.length; j < jj; j++) if (funcs[j] == f) {\n funcs.splice(j, 1);\n break;\n }\n !funcs.length && delete e.n[key].f;\n }\n } else {\n delete e.f;\n for (key in e.n) if (e.n[has](key) && e.n[key].f) {\n delete e.n[key].f;\n }\n }\n e = e.n;\n }\n }\n // prune inner nodes in path\n prune: for (i = 0, ii = inodes.length; i < ii; i++) {\n e = inodes[i];\n for (key in e.n[e.name].f) {\n // not empty (has listeners)\n continue prune;\n }\n for (key in e.n[e.name].n) {\n // not empty (has children)\n continue prune;\n }\n // is empty\n delete e.n[e.name];\n }\n };\n /*\\\n * eve.once\n [ method ]\n **\n * Binds given event handler with a given name to only run once then unbind itself.\n | eve.once(\"login\", f);\n | eve(\"login\"); // triggers f\n | eve(\"login\"); // no listeners\n * Use @eve to trigger the listener.\n **\n > Arguments\n **\n - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards\n - f (function) event handler function\n **\n = (function) same return function as @eve.on\n \\*/\n eve.once = function (name, f) {\n var f2 = function () {\n eve.off(name, f2);\n return f.apply(this, arguments);\n };\n return eve.on(name, f2);\n };\n /*\\\n * eve.version\n [ property (string) ]\n **\n * Current version of the library.\n \\*/\n eve.version = version;\n eve.toString = function () {\n return \"You are running Eve \" + version;\n };\n (typeof module != \"undefined\" && module.exports) ? (module.exports = eve) : (typeof define === \"function\" && define.amd ? (define(\"eve\", [], function() { return eve; })) : (glob.eve = eve));\n})(this);\n\n(function (glob, factory) {\n // AMD support\n if (typeof define == \"function\" && define.amd) {\n // Define as an anonymous module\n define([\"eve\"], function (eve) {\n return factory(glob, eve);\n });\n } else if (typeof exports != \"undefined\") {\n // Next for Node.js or CommonJS\n var eve = require(\"eve\");\n module.exports = factory(glob, eve);\n } else {\n // Browser globals (glob is window)\n // Snap adds itself to window\n factory(glob, glob.eve);\n }\n}(window || this, function (window, eve) {\n\n// Copyright (c) 2017 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nvar mina = (function (eve) {\n var animations = {},\n requestAnimFrame = window.requestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.oRequestAnimationFrame ||\n window.msRequestAnimationFrame ||\n function (callback) {\n setTimeout(callback, 16, new Date().getTime());\n return true;\n },\n requestID,\n isArray = Array.isArray || function (a) {\n return a instanceof Array ||\n Object.prototype.toString.call(a) == \"[object Array]\";\n },\n idgen = 0,\n idprefix = \"M\" + (+new Date).toString(36),\n ID = function () {\n return idprefix + (idgen++).toString(36);\n },\n diff = function (a, b, A, B) {\n if (isArray(a)) {\n res = [];\n for (var i = 0, ii = a.length; i < ii; i++) {\n res[i] = diff(a[i], b, A[i], B);\n }\n return res;\n }\n var dif = (A - a) / (B - b);\n return function (bb) {\n return a + dif * (bb - b);\n };\n },\n timer = Date.now || function () {\n return +new Date;\n },\n sta = function (val) {\n var a = this;\n if (val == null) {\n return a.s;\n }\n var ds = a.s - val;\n a.b += a.dur * ds;\n a.B += a.dur * ds;\n a.s = val;\n },\n speed = function (val) {\n var a = this;\n if (val == null) {\n return a.spd;\n }\n a.spd = val;\n },\n duration = function (val) {\n var a = this;\n if (val == null) {\n return a.dur;\n }\n a.s = a.s * val / a.dur;\n a.dur = val;\n },\n stopit = function () {\n var a = this;\n delete animations[a.id];\n a.update();\n eve(\"mina.stop.\" + a.id, a);\n },\n pause = function () {\n var a = this;\n if (a.pdif) {\n return;\n }\n delete animations[a.id];\n a.update();\n a.pdif = a.get() - a.b;\n },\n resume = function () {\n var a = this;\n if (!a.pdif) {\n return;\n }\n a.b = a.get() - a.pdif;\n delete a.pdif;\n animations[a.id] = a;\n frame();\n },\n update = function () {\n var a = this,\n res;\n if (isArray(a.start)) {\n res = [];\n for (var j = 0, jj = a.start.length; j < jj; j++) {\n res[j] = +a.start[j] +\n (a.end[j] - a.start[j]) * a.easing(a.s);\n }\n } else {\n res = +a.start + (a.end - a.start) * a.easing(a.s);\n }\n a.set(res);\n },\n frame = function (timeStamp) {\n // Manual invokation?\n if (!timeStamp) {\n // Frame loop stopped?\n if (!requestID) {\n // Start frame loop...\n requestID = requestAnimFrame(frame);\n }\n return;\n }\n var len = 0;\n for (var i in animations) if (animations.hasOwnProperty(i)) {\n var a = animations[i],\n b = a.get(),\n res;\n len++;\n a.s = (b - a.b) / (a.dur / a.spd);\n if (a.s >= 1) {\n delete animations[i];\n a.s = 1;\n len--;\n (function (a) {\n setTimeout(function () {\n eve(\"mina.finish.\" + a.id, a);\n });\n }(a));\n }\n a.update();\n }\n requestID = len ? requestAnimFrame(frame) : false;\n },\n /*\\\n * mina\n [ method ]\n **\n * Generic animation of numbers\n **\n - a (number) start _slave_ number\n - A (number) end _slave_ number\n - b (number) start _master_ number (start time in general case)\n - B (number) end _master_ number (end time in general case)\n - get (function) getter of _master_ number (see @mina.time)\n - set (function) setter of _slave_ number\n - easing (function) #optional easing function, default is @mina.linear\n = (object) animation descriptor\n o {\n o id (string) animation id,\n o start (number) start _slave_ number,\n o end (number) end _slave_ number,\n o b (number) start _master_ number,\n o s (number) animation status (0..1),\n o dur (number) animation duration,\n o spd (number) animation speed,\n o get (function) getter of _master_ number (see @mina.time),\n o set (function) setter of _slave_ number,\n o easing (function) easing function, default is @mina.linear,\n o status (function) status getter/setter,\n o speed (function) speed getter/setter,\n o duration (function) duration getter/setter,\n o stop (function) animation stopper\n o pause (function) pauses the animation\n o resume (function) resumes the animation\n o update (function) calles setter with the right value of the animation\n o }\n \\*/\n mina = function (a, A, b, B, get, set, easing) {\n var anim = {\n id: ID(),\n start: a,\n end: A,\n b: b,\n s: 0,\n dur: B - b,\n spd: 1,\n get: get,\n set: set,\n easing: easing || mina.linear,\n status: sta,\n speed: speed,\n duration: duration,\n stop: stopit,\n pause: pause,\n resume: resume,\n update: update\n };\n animations[anim.id] = anim;\n var len = 0, i;\n for (i in animations) if (animations.hasOwnProperty(i)) {\n len++;\n if (len == 2) {\n break;\n }\n }\n len == 1 && frame();\n return anim;\n };\n /*\\\n * mina.time\n [ method ]\n **\n * Returns the current time. Equivalent to:\n | function () {\n | return (new Date).getTime();\n | }\n \\*/\n mina.time = timer;\n /*\\\n * mina.getById\n [ method ]\n **\n * Returns an animation by its id\n - id (string) animation's id\n = (object) See @mina\n \\*/\n mina.getById = function (id) {\n return animations[id] || null;\n };\n\n /*\\\n * mina.linear\n [ method ]\n **\n * Default linear easing\n - n (number) input 0..1\n = (number) output 0..1\n \\*/\n mina.linear = function (n) {\n return n;\n };\n /*\\\n * mina.easeout\n [ method ]\n **\n * Easeout easing\n - n (number) input 0..1\n = (number) output 0..1\n \\*/\n mina.easeout = function (n) {\n return Math.pow(n, 1.7);\n };\n /*\\\n * mina.easein\n [ method ]\n **\n * Easein easing\n - n (number) input 0..1\n = (number) output 0..1\n \\*/\n mina.easein = function (n) {\n return Math.pow(n, .48);\n };\n /*\\\n * mina.easeinout\n [ method ]\n **\n * Easeinout easing\n - n (number) input 0..1\n = (number) output 0..1\n \\*/\n mina.easeinout = function (n) {\n if (n == 1) {\n return 1;\n }\n if (n == 0) {\n return 0;\n }\n var q = .48 - n / 1.04,\n Q = Math.sqrt(.1734 + q * q),\n x = Q - q,\n X = Math.pow(Math.abs(x), 1 / 3) * (x < 0 ? -1 : 1),\n y = -Q - q,\n Y = Math.pow(Math.abs(y), 1 / 3) * (y < 0 ? -1 : 1),\n t = X + Y + .5;\n return (1 - t) * 3 * t * t + t * t * t;\n };\n /*\\\n * mina.backin\n [ method ]\n **\n * Backin easing\n - n (number) input 0..1\n = (number) output 0..1\n \\*/\n mina.backin = function (n) {\n if (n == 1) {\n return 1;\n }\n var s = 1.70158;\n return n * n * ((s + 1) * n - s);\n };\n /*\\\n * mina.backout\n [ method ]\n **\n * Backout easing\n - n (number) input 0..1\n = (number) output 0..1\n \\*/\n mina.backout = function (n) {\n if (n == 0) {\n return 0;\n }\n n = n - 1;\n var s = 1.70158;\n return n * n * ((s + 1) * n + s) + 1;\n };\n /*\\\n * mina.elastic\n [ method ]\n **\n * Elastic easing\n - n (number) input 0..1\n = (number) output 0..1\n \\*/\n mina.elastic = function (n) {\n if (n == !!n) {\n return n;\n }\n return Math.pow(2, -10 * n) * Math.sin((n - .075) *\n (2 * Math.PI) / .3) + 1;\n };\n /*\\\n * mina.bounce\n [ method ]\n **\n * Bounce easing\n - n (number) input 0..1\n = (number) output 0..1\n \\*/\n mina.bounce = function (n) {\n var s = 7.5625,\n p = 2.75,\n l;\n if (n < 1 / p) {\n l = s * n * n;\n } else {\n if (n < 2 / p) {\n n -= 1.5 / p;\n l = s * n * n + .75;\n } else {\n if (n < 2.5 / p) {\n n -= 2.25 / p;\n l = s * n * n + .9375;\n } else {\n n -= 2.625 / p;\n l = s * n * n + .984375;\n }\n }\n }\n return l;\n };\n window.mina = mina;\n return mina;\n})(typeof eve == \"undefined\" ? function () {} : eve);\n\n// Copyright (c) 2013 - 2017 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar Snap = (function(root) {\nSnap.version = \"0.5.1\";\n/*\\\n * Snap\n [ method ]\n **\n * Creates a drawing surface or wraps existing SVG element.\n **\n - width (number|string) width of surface\n - height (number|string) height of surface\n * or\n - DOM (SVGElement) element to be wrapped into Snap structure\n * or\n - array (array) array of elements (will return set of elements)\n * or\n - query (string) CSS query selector\n = (object) @Element\n\\*/\nfunction Snap(w, h) {\n if (w) {\n if (w.nodeType) {\n return wrap(w);\n }\n if (is(w, \"array\") && Snap.set) {\n return Snap.set.apply(Snap, w);\n }\n if (w instanceof Element) {\n return w;\n }\n if (h == null) {\n // try {\n w = glob.doc.querySelector(String(w));\n return wrap(w);\n // } catch (e) {\n // return null;\n // }\n }\n }\n w = w == null ? \"100%\" : w;\n h = h == null ? \"100%\" : h;\n return new Paper(w, h);\n}\nSnap.toString = function () {\n return \"Snap v\" + this.version;\n};\nSnap._ = {};\nvar glob = {\n win: root.window,\n doc: root.window.document\n};\nSnap._.glob = glob;\nvar has = \"hasOwnProperty\",\n Str = String,\n toFloat = parseFloat,\n toInt = parseInt,\n math = Math,\n mmax = math.max,\n mmin = math.min,\n abs = math.abs,\n pow = math.pow,\n PI = math.PI,\n round = math.round,\n E = \"\",\n S = \" \",\n objectToString = Object.prototype.toString,\n ISURL = /^url\\(['\"]?([^\\)]+?)['\"]?\\)$/i,\n colourRegExp = /^\\s*((#[a-f\\d]{6})|(#[a-f\\d]{3})|rgba?\\(\\s*([\\d\\.]+%?\\s*,\\s*[\\d\\.]+%?\\s*,\\s*[\\d\\.]+%?(?:\\s*,\\s*[\\d\\.]+%?)?)\\s*\\)|hsba?\\(\\s*([\\d\\.]+(?:deg|\\xb0|%)?\\s*,\\s*[\\d\\.]+%?\\s*,\\s*[\\d\\.]+(?:%?\\s*,\\s*[\\d\\.]+)?%?)\\s*\\)|hsla?\\(\\s*([\\d\\.]+(?:deg|\\xb0|%)?\\s*,\\s*[\\d\\.]+%?\\s*,\\s*[\\d\\.]+(?:%?\\s*,\\s*[\\d\\.]+)?%?)\\s*\\))\\s*$/i,\n bezierrg = /^(?:cubic-)?bezier\\(([^,]+),([^,]+),([^,]+),([^\\)]+)\\)/,\n separator = Snap._.separator = /[,\\s]+/,\n whitespace = /[\\s]/g,\n commaSpaces = /[\\s]*,[\\s]*/,\n hsrg = {hs: 1, rg: 1},\n pathCommand = /([a-z])[\\s,]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[\\s]*,?[\\s]*)+)/ig,\n tCommand = /([rstm])[\\s,]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[\\s]*,?[\\s]*)+)/ig,\n pathValues = /(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[\\s]*,?[\\s]*/ig,\n idgen = 0,\n idprefix = \"S\" + (+new Date).toString(36),\n ID = function (el) {\n return (el && el.type ? el.type : E) + idprefix + (idgen++).toString(36);\n },\n xlink = \"http://www.w3.org/1999/xlink\",\n xmlns = \"http://www.w3.org/2000/svg\",\n hub = {},\n /*\\\n * Snap.url\n [ method ]\n **\n * Wraps path into `\"url('<path>')\"`.\n - value (string) path\n = (string) wrapped path\n \\*/\n URL = Snap.url = function (url) {\n return \"url('#\" + url + \"')\";\n };\n\nfunction $(el, attr) {\n if (attr) {\n if (el == \"#text\") {\n el = glob.doc.createTextNode(attr.text || attr[\"#text\"] || \"\");\n }\n if (el == \"#comment\") {\n el = glob.doc.createComment(attr.text || attr[\"#text\"] || \"\");\n }\n if (typeof el == \"string\") {\n el = $(el);\n }\n if (typeof attr == \"string\") {\n if (el.nodeType == 1) {\n if (attr.substring(0, 6) == \"xlink:\") {\n return el.getAttributeNS(xlink, attr.substring(6));\n }\n if (attr.substring(0, 4) == \"xml:\") {\n return el.getAttributeNS(xmlns, attr.substring(4));\n }\n return el.getAttribute(attr);\n } else if (attr == \"text\") {\n return el.nodeValue;\n } else {\n return null;\n }\n }\n if (el.nodeType == 1) {\n for (var key in attr) if (attr[has](key)) {\n var val = Str(attr[key]);\n if (val) {\n if (key.substring(0, 6) == \"xlink:\") {\n el.setAttributeNS(xlink, key.substring(6), val);\n } else if (key.substring(0, 4) == \"xml:\") {\n el.setAttributeNS(xmlns, key.substring(4), val);\n } else {\n el.setAttribute(key, val);\n }\n } else {\n el.removeAttribute(key);\n }\n }\n } else if (\"text\" in attr) {\n el.nodeValue = attr.text;\n }\n } else {\n el = glob.doc.createElementNS(xmlns, el);\n }\n return el;\n}\nSnap._.$ = $;\nSnap._.id = ID;\nfunction getAttrs(el) {\n var attrs = el.attributes,\n name,\n out = {};\n for (var i = 0; i < attrs.length; i++) {\n if (attrs[i].namespaceURI == xlink) {\n name = \"xlink:\";\n } else {\n name = \"\";\n }\n name += attrs[i].name;\n out[name] = attrs[i].textContent;\n }\n return out;\n}\nfunction is(o, type) {\n type = Str.prototype.toLowerCase.call(type);\n if (type == \"finite\") {\n return isFinite(o);\n }\n if (type == \"array\" &&\n (o instanceof Array || Array.isArray && Array.isArray(o))) {\n return true;\n }\n return type == \"null\" && o === null ||\n type == typeof o && o !== null ||\n type == \"object\" && o === Object(o) ||\n objectToString.call(o).slice(8, -1).toLowerCase() == type;\n}\n/*\\\n * Snap.format\n [ method ]\n **\n * Replaces construction of type `{<name>}` to the corresponding argument\n **\n - token (string) string to format\n - json (object) object which properties are used as a replacement\n = (string) formatted string\n > Usage\n | // this draws a rectangular shape equivalent to \"M10,20h40v50h-40z\"\n | paper.path(Snap.format(\"M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']}z\", {\n | x: 10,\n | y: 20,\n | dim: {\n | width: 40,\n | height: 50,\n | \"negative width\": -40\n | }\n | }));\n\\*/\nSnap.format = (function () {\n var tokenRegex = /\\{([^\\}]+)\\}/g,\n objNotationRegex = /(?:(?:^|\\.)(.+?)(?=\\[|\\.|$|\\()|\\[('|\")(.+?)\\2\\])(\\(\\))?/g, // matches .xxxxx or [\"xxxxx\"] to run over object properties\n replacer = function (all, key, obj) {\n var res = obj;\n key.replace(objNotationRegex, function (all, name, quote, quotedName, isFunc) {\n name = name || quotedName;\n if (res) {\n if (name in res) {\n res = res[name];\n }\n typeof res == \"function\" && isFunc && (res = res());\n }\n });\n res = (res == null || res == obj ? all : res) + \"\";\n return res;\n };\n return function (str, obj) {\n return Str(str).replace(tokenRegex, function (all, key) {\n return replacer(all, key, obj);\n });\n };\n})();\nfunction clone(obj) {\n if (typeof obj == \"function\" || Object(obj) !== obj) {\n return obj;\n }\n var res = new obj.constructor;\n for (var key in obj) if (obj[has](key)) {\n res[key] = clone(obj[key]);\n }\n return res;\n}\nSnap._.clone = clone;\nfunction repush(array, item) {\n for (var i = 0, ii = array.length; i < ii; i++) if (array[i] === item) {\n return array.push(array.splice(i, 1)[0]);\n }\n}\nfunction cacher(f, scope, postprocessor) {\n function newf() {\n var arg = Array.prototype.slice.call(arguments, 0),\n args = arg.join(\"\\u2400\"),\n cache = newf.cache = newf.cache || {},\n count = newf.count = newf.count || [];\n if (cache[has](args)) {\n repush(count, args);\n return postprocessor ? postprocessor(cache[args]) : cache[args];\n }\n count.length >= 1e3 && delete cache[count.shift()];\n count.push(args);\n cache[args] = f.apply(scope, arg);\n return postprocessor ? postprocessor(cache[args]) : cache[args];\n }\n return newf;\n}\nSnap._.cacher = cacher;\nfunction angle(x1, y1, x2, y2, x3, y3) {\n if (x3 == null) {\n var x = x1 - x2,\n y = y1 - y2;\n if (!x && !y) {\n return 0;\n }\n return (180 + math.atan2(-y, -x) * 180 / PI + 360) % 360;\n } else {\n return angle(x1, y1, x3, y3) - angle(x2, y2, x3, y3);\n }\n}\nfunction rad(deg) {\n return deg % 360 * PI / 180;\n}\nfunction deg(rad) {\n return rad * 180 / PI % 360;\n}\nfunction x_y() {\n return this.x + S + this.y;\n}\nfunction x_y_w_h() {\n return this.x + S + this.y + S + this.width + \" \\xd7 \" + this.height;\n}\n\n/*\\\n * Snap.rad\n [ method ]\n **\n * Transform angle to radians\n - deg (number) angle in degrees\n = (number) angle in radians\n\\*/\nSnap.rad = rad;\n/*\\\n * Snap.deg\n [ method ]\n **\n * Transform angle to degrees\n - rad (number) angle in radians\n = (number) angle in degrees\n\\*/\nSnap.deg = deg;\n/*\\\n * Snap.sin\n [ method ]\n **\n * Equivalent to `Math.sin()` only works with degrees, not radians.\n - angle (number) angle in degrees\n = (number) sin\n\\*/\nSnap.sin = function (angle) {\n return math.sin(Snap.rad(angle));\n};\n/*\\\n * Snap.tan\n [ method ]\n **\n * Equivalent to `Math.tan()` only works with degrees, not radians.\n - angle (number) angle in degrees\n = (number) tan\n\\*/\nSnap.tan = function (angle) {\n return math.tan(Snap.rad(angle));\n};\n/*\\\n * Snap.cos\n [ method ]\n **\n * Equivalent to `Math.cos()` only works with degrees, not radians.\n - angle (number) angle in degrees\n = (number) cos\n\\*/\nSnap.cos = function (angle) {\n return math.cos(Snap.rad(angle));\n};\n/*\\\n * Snap.asin\n [ method ]\n **\n * Equivalent to `Math.asin()` only works with degrees, not radians.\n - num (number) value\n = (number) asin in degrees\n\\*/\nSnap.asin = function (num) {\n return Snap.deg(math.asin(num));\n};\n/*\\\n * Snap.acos\n [ method ]\n **\n * Equivalent to `Math.acos()` only works with degrees, not radians.\n - num (number) value\n = (number) acos in degrees\n\\*/\nSnap.acos = function (num) {\n return Snap.deg(math.acos(num));\n};\n/*\\\n * Snap.atan\n [ method ]\n **\n * Equivalent to `Math.atan()` only works with degrees, not radians.\n - num (number) value\n = (number) atan in degrees\n\\*/\nSnap.atan = function (num) {\n return Snap.deg(math.atan(num));\n};\n/*\\\n * Snap.atan2\n [ method ]\n **\n * Equivalent to `Math.atan2()` only works with degrees, not radians.\n - num (number) value\n = (number) atan2 in degrees\n\\*/\nSnap.atan2 = function (num) {\n return Snap.deg(math.atan2(num));\n};\n/*\\\n * Snap.angle\n [ method ]\n **\n * Returns an angle between two or three points\n - x1 (number) x coord of first point\n - y1 (number) y coord of first point\n - x2 (number) x coord of second point\n - y2 (number) y coord of second point\n - x3 (number) #optional x coord of third point\n - y3 (number) #optional y coord of third point\n = (number) angle in degrees\n\\*/\nSnap.angle = angle;\n/*\\\n * Snap.len\n [ method ]\n **\n * Returns distance between two points\n - x1 (number) x coord of first point\n - y1 (number) y coord of first point\n - x2 (number) x coord of second point\n - y2 (number) y coord of second point\n = (number) distance\n\\*/\nSnap.len = function (x1, y1, x2, y2) {\n return Math.sqrt(Snap.len2(x1, y1, x2, y2));\n};\n/*\\\n * Snap.len2\n [ method ]\n **\n * Returns squared distance between two points\n - x1 (number) x coord of first point\n - y1 (number) y coord of first point\n - x2 (number) x coord of second point\n - y2 (number) y coord of second point\n = (number) distance\n\\*/\nSnap.len2 = function (x1, y1, x2, y2) {\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n};\n/*\\\n * Snap.closestPoint\n [ method ]\n **\n * Returns closest point to a given one on a given path.\n - path (Element) path element\n - x (number) x coord of a point\n - y (number) y coord of a point\n = (object) in format\n {\n x (number) x coord of the point on the path\n y (number) y coord of the point on the path\n length (number) length of the path to the point\n distance (number) distance from the given point to the path\n }\n\\*/\n// Copied from http://bl.ocks.org/mbostock/8027637\nSnap.closestPoint = function (path, x, y) {\n function distance2(p) {\n var dx = p.x - x,\n dy = p.y - y;\n return dx * dx + dy * dy;\n }\n var pathNode = path.node,\n pathLength = pathNode.getTotalLength(),\n precision = pathLength / pathNode.pathSegList.numberOfItems * .125,\n best,\n bestLength,\n bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (var scan, scanLength = 0, scanDistance; scanLength <= pathLength; scanLength += precision) {\n if ((scanDistance = distance2(scan = pathNode.getPointAtLength(scanLength))) < bestDistance) {\n best = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision *= .5;\n while (precision > .5) {\n var before,\n after,\n beforeLength,\n afterLength,\n beforeDistance,\n afterDistance;\n if ((beforeLength = bestLength - precision) >= 0 && (beforeDistance = distance2(before = pathNode.getPointAtLength(beforeLength))) < bestDistance) {\n best = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if ((afterLength = bestLength + precision) <= pathLength && (afterDistance = distance2(after = pathNode.getPointAtLength(afterLength))) < bestDistance) {\n best = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision *= .5;\n }\n }\n\n best = {\n x: best.x,\n y: best.y,\n length: bestLength,\n distance: Math.sqrt(bestDistance)\n };\n return best;\n}\n/*\\\n * Snap.is\n [ method ]\n **\n * Handy replacement for the `typeof` operator\n - o (…) any object or primitive\n - type (string) name of the type, e.g., `string`, `function`, `number`, etc.\n = (boolean) `true` if given value is of given type\n\\*/\nSnap.is = is;\n/*\\\n * Snap.snapTo\n [ method ]\n **\n * Snaps given value to given grid\n - values (array|number) given array of values or step of the grid\n - value (number) value to adjust\n - tolerance (number) #optional maximum distance to the target value that would trigger the snap. Default is `10`.\n = (number) adjusted value\n\\*/\nSnap.snapTo = function (values, value, tolerance) {\n tolerance = is(tolerance, \"finite\") ? tolerance : 10;\n if (is(values, \"array\")) {\n var i = values.length;\n while (i--) if (abs(values[i] - value) <= tolerance) {\n return values[i];\n }\n } else {\n values = +values;\n var rem = value % values;\n if (rem < tolerance) {\n return value - rem;\n }\n if (rem > values - tolerance) {\n return value - rem + values;\n }\n }\n return value;\n};\n// Colour\n/*\\\n * Snap.getRGB\n [ method ]\n **\n * Parses color string as RGB object\n - color (string) color string in one of the following formats:\n # <ul>\n # <li>Color name (<code>red</code>, <code>green</code>, <code>cornflowerblue</code>, etc)</li>\n # <li>#••• — shortened HTML color: (<code>#000</code>, <code>#fc0</code>, etc.)</li>\n # <li>#•••••• — full length HTML color: (<code>#000000</code>, <code>#bd2300</code>)</li>\n # <li>rgb(•••, •••, •••) — red, green and blue channels values: (<code>rgb(200, 100, 0)</code>)</li>\n # <li>rgba(•••, •••, •••, •••) — also with opacity</li>\n # <li>rgb(•••%, •••%, •••%) — same as above, but in %: (<code>rgb(100%, 175%, 0%)</code>)</li>\n # <li>rgba(•••%, •••%, •••%, •••%) — also with opacity</li>\n # <li>hsb(•••, •••, •••) — hue, saturation and brightness values: (<code>hsb(0.5, 0.25, 1)</code>)</li>\n # <li>hsba(•••, •••, •••, •••) — also with opacity</li>\n # <li>hsb(•••%, •••%, •••%) — same as above, but in %</li>\n # <li>hsba(•••%, •••%, •••%, •••%) — also with opacity</li>\n # <li>hsl(•••, •••, •••) — hue, saturation and luminosity values: (<code>hsb(0.5, 0.25, 0.5)</code>)</li>\n # <li>hsla(•••, •••, •••, •••) — also with opacity</li>\n # <li>hsl(•••%, •••%, •••%) — same as above, but in %</li>\n # <li>hsla(•••%, •••%, •••%, •••%) — also with opacity</li>\n # </ul>\n * Note that `%` can be used any time: `rgb(20%, 255, 50%)`.\n = (object) RGB object in the following format:\n o {\n o r (number) red,\n o g (number) green,\n o b (number) blue,\n o hex (string) color in HTML/CSS format: #••••••,\n o error (boolean) true if string can't be parsed\n o }\n\\*/\nSnap.getRGB = cacher(function (colour) {\n if (!colour || !!((colour = Str(colour)).indexOf(\"-\") + 1)) {\n return {r: -1, g: -1, b: -1, hex: \"none\", error: 1, toString: rgbtoString};\n }\n if (colour == \"none\") {\n return {r: -1, g: -1, b: -1, hex: \"none\", toString: rgbtoString};\n }\n !(hsrg[has](colour.toLowerCase().substring(0, 2)) || colour.charAt() == \"#\") && (colour = toHex(colour));\n if (!colour) {\n return {r: -1, g: -1, b: -1, hex: \"none\", error: 1, toString: rgbtoString};\n }\n var res,\n red,\n green,\n blue,\n opacity,\n t,\n values,\n rgb = colour.match(colourRegExp);\n if (rgb) {\n if (rgb[2]) {\n blue = toInt(rgb[2].substring(5), 16);\n green = toInt(rgb[2].substring(3, 5), 16);\n red = toInt(rgb[2].substring(1, 3), 16);\n }\n if (rgb[3]) {\n blue = toInt((t = rgb[3].charAt(3)) + t, 16);\n green = toInt((t = rgb[3].charAt(2)) + t, 16);\n red = toInt((t = rgb[3].charAt(1)) + t, 16);\n }\n if (rgb[4]) {\n values = rgb[4].split(commaSpaces);\n red = toFloat(values[0]);\n values[0].slice(-1) == \"%\" && (red *= 2.55);\n green = toFloat(values[1]);\n values[1].slice(-1) == \"%\" && (green *= 2.55);\n blue = toFloat(values[2]);\n values[2].slice(-1) == \"%\" && (blue *= 2.55);\n rgb[1].toLowerCase().slice(0, 4) == \"rgba\" && (opacity = toFloat(values[3]));\n values[3] && values[3].slice(-1) == \"%\" && (opacity /= 100);\n }\n if (rgb[5]) {\n values = rgb[5].split(commaSpaces);\n red = toFloat(values[0]);\n values[0].slice(-1) == \"%\" && (red /= 100);\n green = toFloat(values[1]);\n values[1].slice(-1) == \"%\" && (green /= 100);\n blue = toFloat(values[2]);\n values[2].slice(-1) == \"%\" && (blue /= 100);\n (values[0].slice(-3) == \"deg\" || values[0].slice(-1) == \"\\xb0\") && (red /= 360);\n rgb[1].toLowerCase().slice(0, 4) == \"hsba\" && (opacity = toFloat(values[3]));\n values[3] && values[3].slice(-1) == \"%\" && (opacity /= 100);\n return Snap.hsb2rgb(red, green, blue, opacity);\n }\n if (rgb[6]) {\n values = rgb[6].split(commaSpaces);\n red = toFloat(values[0]);\n values[0].slice(-1) == \"%\" && (red /= 100);\n green = toFloat(values[1]);\n values[1].slice(-1) == \"%\" && (green /= 100);\n blue = toFloat(values[2]);\n values[2].slice(-1) == \"%\" && (blue /= 100);\n (values[0].slice(-3) == \"deg\" || values[0].slice(-1) == \"\\xb0\") && (red /= 360);\n rgb[1].toLowerCase().slice(0, 4) == \"hsla\" && (opacity = toFloat(values[3]));\n values[3] && values[3].slice(-1) == \"%\" && (opacity /= 100);\n return Snap.hsl2rgb(red, green, blue, opacity);\n }\n red = mmin(math.round(red), 255);\n green = mmin(math.round(green), 255);\n blue = mmin(math.round(blue), 255);\n opacity = mmin(mmax(opacity, 0), 1);\n rgb = {r: red, g: green, b: blue, toString: rgbtoString};\n rgb.hex = \"#\" + (16777216 | blue | green << 8 | red << 16).toString(16).slice(1);\n rgb.opacity = is(opacity, \"finite\") ? opacity : 1;\n return rgb;\n }\n return {r: -1, g: -1, b: -1, hex: \"none\", error: 1, toString: rgbtoString};\n}, Snap);\n/*\\\n * Snap.hsb\n [ method ]\n **\n * Converts HSB values to a hex representation of the color\n - h (number) hue\n - s (number) saturation\n - b (number) value or brightness\n = (string) hex representation of the color\n\\*/\nSnap.hsb = cacher(function (h, s, b) {\n return Snap.hsb2rgb(h, s, b).hex;\n});\n/*\\\n * Snap.hsl\n [ method ]\n **\n * Converts HSL values to a hex representation of the color\n - h (number) hue\n - s (number) saturation\n - l (number) luminosity\n = (string) hex representation of the color\n\\*/\nSnap.hsl = cacher(function (h, s, l) {\n return Snap.hsl2rgb(h, s, l).hex;\n});\n/*\\\n * Snap.rgb\n [ method ]\n **\n * Converts RGB values to a hex representation of the color\n - r (number) red\n - g (number) green\n - b (number) blue\n = (string) hex representation of the color\n\\*/\nSnap.rgb = cacher(function (r, g, b, o) {\n if (is(o, \"finite\")) {\n var round = math.round;\n return \"rgba(\" + [round(r), round(g), round(b), +o.toFixed(2)] + \")\";\n }\n return \"#\" + (16777216 | b | g << 8 | r << 16).toString(16).slice(1);\n});\nvar toHex = function (color) {\n var i = glob.doc.getElementsByTagName(\"head\")[0] || glob.doc.getElementsByTagName(\"svg\")[0],\n red = \"rgb(255, 0, 0)\";\n toHex = cacher(function (color) {\n if (color.toLowerCase() == \"red\") {\n return red;\n }\n i.style.color = red;\n i.style.color = color;\n var out = glob.doc.defaultView.getComputedStyle(i, E).getPropertyValue(\"color\");\n return out == red ? null : out;\n });\n return toHex(color);\n},\nhsbtoString = function () {\n return \"hsb(\" + [this.h, this.s, this.b] + \")\";\n},\nhsltoString = function () {\n return \"hsl(\" + [this.h, this.s, this.l] + \")\";\n},\nrgbtoString = function () {\n return this.opacity == 1 || this.opacity == null ?\n this.hex :\n \"rgba(\" + [this.r, this.g, this.b, this.opacity] + \")\";\n},\nprepareRGB = function (r, g, b) {\n if (g == null && is(r, \"object\") && \"r\" in r && \"g\" in r && \"b\" in r) {\n b = r.b;\n g = r.g;\n r = r.r;\n }\n if (g == null && is(r, string)) {\n var clr = Snap.getRGB(r);\n r = clr.r;\n g = clr.g;\n b = clr.b;\n }\n if (r > 1 || g > 1 || b > 1) {\n r /= 255;\n g /= 255;\n b /= 255;\n }\n\n return [r, g, b];\n},\npackageRGB = function (r, g, b, o) {\n r = math.round(r * 255);\n g = math.round(g * 255);\n b = math.round(b * 255);\n var rgb = {\n r: r,\n g: g,\n b: b,\n opacity: is(o, \"finite\") ? o : 1,\n hex: Snap.rgb(r, g, b),\n toString: rgbtoString\n };\n is(o, \"finite\") && (rgb.opacity = o);\n return rgb;\n};\n/*\\\n * Snap.color\n [ method ]\n **\n * Parses the color string and returns an object featuring the color's component values\n - clr (string) color string in one of the supported formats (see @Snap.getRGB)\n = (object) Combined RGB/HSB object in the following format:\n o {\n o r (number) red,\n o g (number) green,\n o b (number) blue,\n o hex (string) color in HTML/CSS format: #••••••,\n o error (boolean) `true` if string can't be parsed,\n o h (number) hue,\n o s (number) saturation,\n o v (number) value (brightness),\n o l (number) lightness\n o }\n\\*/\nSnap.color = function (clr) {\n var rgb;\n if (is(clr, \"object\") && \"h\" in clr && \"s\" in clr && \"b\" in clr) {\n rgb = Snap.hsb2rgb(clr);\n clr.r = rgb.r;\n clr.g = rgb.g;\n clr.b = rgb.b;\n clr.opacity = 1;\n clr.hex = rgb.hex;\n } else if (is(clr, \"object\") && \"h\" in clr && \"s\" in clr && \"l\" in clr) {\n rgb = Snap.hsl2rgb(clr);\n clr.r = rgb.r;\n clr.g = rgb.g;\n clr.b = rgb.b;\n clr.opacity = 1;\n clr.hex = rgb.hex;\n } else {\n if (is(clr, \"string\")) {\n clr = Snap.getRGB(clr);\n }\n if (is(clr, \"object\") && \"r\" in clr && \"g\" in clr && \"b\" in clr && !(\"error\" in clr)) {\n rgb = Snap.rgb2hsl(clr);\n clr.h = rgb.h;\n clr.s = rgb.s;\n clr.l = rgb.l;\n rgb = Snap.rgb2hsb(clr);\n clr.v = rgb.b;\n } else {\n clr = {hex: \"none\"};\n clr.r = clr.g = clr.b = clr.h = clr.s = clr.v = clr.l = -1;\n clr.error = 1;\n }\n }\n clr.toString = rgbtoString;\n return clr;\n};\n/*\\\n * Snap.hsb2rgb\n [ method ]\n **\n * Converts HSB values to an RGB object\n - h (number) hue\n - s (number) saturation\n - v (number) value or brightness\n = (object) RGB object in the following format:\n o {\n o r (number) red,\n o g (number) green,\n o b (number) blue,\n o hex (string) color in HTML/CSS format: #••••••\n o }\n\\*/\nSnap.hsb2rgb = function (h, s, v, o) {\n if (is(h, \"object\") && \"h\" in h && \"s\" in h && \"b\" in h) {\n v = h.b;\n s = h.s;\n o = h.o;\n h = h.h;\n }\n h *= 360;\n var R, G, B, X, C;\n h = h % 360 / 60;\n C = v * s;\n X = C * (1 - abs(h % 2 - 1));\n R = G = B = v - C;\n\n h = ~~h;\n R += [C, X, 0, 0, X, C][h];\n G += [X, C, C, X, 0, 0][h];\n B += [0, 0, X, C, C, X][h];\n return packageRGB(R, G, B, o);\n};\n/*\\\n * Snap.hsl2rgb\n [ method ]\n **\n * Converts HSL values to an RGB object\n - h (number) hue\n - s (number) saturation\n - l (number) luminosity\n = (object) RGB object in the following format:\n o {\n o r (number) red,\n o g (number) green,\n o b (number) blue,\n o hex (string) color in HTML/CSS format: #••••••\n o }\n\\*/\nSnap.hsl2rgb = function (h, s, l, o) {\n if (is(h, \"object\") && \"h\" in h && \"s\" in h && \"l\" in h) {\n l = h.l;\n s = h.s;\n h = h.h;\n }\n if (h > 1 || s > 1 || l > 1) {\n h /= 360;\n s /= 100;\n l /= 100;\n }\n h *= 360;\n var R, G, B, X, C;\n h = h % 360 / 60;\n C = 2 * s * (l < .5 ? l : 1 - l);\n X = C * (1 - abs(h % 2 - 1));\n R = G = B = l - C / 2;\n\n h = ~~h;\n R += [C, X, 0, 0, X, C][h];\n G += [X, C, C, X, 0, 0][h];\n B += [0, 0, X, C, C, X][h];\n return packageRGB(R, G, B, o);\n};\n/*\\\n * Snap.rgb2hsb\n [ method ]\n **\n * Converts RGB values to an HSB object\n - r (number) red\n - g (number) green\n - b (number) blue\n = (object) HSB object in the following format:\n o {\n o h (number) hue,\n o s (number) saturation,\n o b (number) brightness\n o }\n\\*/\nSnap.rgb2hsb = function (r, g, b) {\n b = prepareRGB(r, g, b);\n r = b[0];\n g = b[1];\n b = b[2];\n\n var H, S, V, C;\n V = mmax(r, g, b);\n C = V - mmin(r, g, b);\n H = C == 0 ? null :\n V == r ? (g - b) / C :\n V == g ? (b - r) / C + 2 :\n (r - g) / C + 4;\n H = (H + 360) % 6 * 60 / 360;\n S = C == 0 ? 0 : C / V;\n return {h: H, s: S, b: V, toString: hsbtoString};\n};\n/*\\\n * Snap.rgb2hsl\n [ method ]\n **\n * Converts RGB values to an HSL object\n - r (number) red\n - g (number) green\n - b (number) blue\n = (object) HSL object in the following format:\n o {\n o h (number) hue,\n o s (number) saturation,\n o l (number) luminosity\n o }\n\\*/\nSnap.rgb2hsl = function (r, g, b) {\n b = prepareRGB(r, g, b);\n r = b[0];\n g = b[1];\n b = b[2];\n\n var H, S, L, M, m, C;\n M = mmax(r, g, b);\n m = mmin(r, g, b);\n C = M - m;\n H = C == 0 ? null :\n M == r ? (g - b) / C :\n M == g ? (b - r) / C + 2 :\n (r - g) / C + 4;\n H = (H + 360) % 6 * 60 / 360;\n L = (M + m) / 2;\n S = C == 0 ? 0 :\n L < .5 ? C / (2 * L) :\n C / (2 - 2 * L);\n return {h: H, s: S, l: L, toString: hsltoString};\n};\n\n// Transformations\n/*\\\n * Snap.parsePathString\n [ method ]\n **\n * Utility method\n **\n * Parses given path string into an array of arrays of path segments\n - pathString (string|array) path string or array of segments (in the last case it is returned straight away)\n = (array) array of segments\n\\*/\nSnap.parsePathString = function (pathString) {\n if (!pathString) {\n return null;\n }\n var pth = Snap.path(pathString);\n if (pth.arr) {\n return Snap.path.clone(pth.arr);\n }\n\n var paramCounts = {a: 7, c: 6, o: 2, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, u: 3, z: 0},\n data = [];\n if (is(pathString, \"array\") && is(pathString[0], \"array\")) { // rough assumption\n data = Snap.path.clone(pathString);\n }\n if (!data.length) {\n Str(pathString).replace(pathCommand, function (a, b, c) {\n var params = [],\n name = b.toLowerCase();\n c.replace(pathValues, function (a, b) {\n b && params.push(+b);\n });\n if (name == \"m\" && params.length > 2) {\n data.push([b].concat(params.splice(0, 2)));\n name = \"l\";\n b = b == \"m\" ? \"l\" : \"L\";\n }\n if (name == \"o\" && params.length == 1) {\n data.push([b, params[0]]);\n }\n if (name == \"r\") {\n data.push([b].concat(params));\n } else while (params.length >= paramCounts[name]) {\n data.push([b].concat(params.splice(0, paramCounts[name])));\n if (!paramCounts[name]) {\n break;\n }\n }\n });\n }\n data.toString = Snap.path.toString;\n pth.arr = Snap.path.clone(data);\n return data;\n};\n/*\\\n * Snap.parseTransformString\n [ method ]\n **\n * Utility method\n **\n * Parses given transform string into an array of transformations\n - TString (string|array) transform string or array of transformations (in the last case it is returned straight away)\n = (array) array of transformations\n\\*/\nvar parseTransformString = Snap.parseTransformString = function (TString) {\n if (!TString) {\n return null;\n }\n var paramCounts = {r: 3, s: 4, t: 2, m: 6},\n data = [];\n if (is(TString, \"array\") && is(TString[0], \"array\")) { // rough assumption\n data = Snap.path.clone(TString);\n }\n if (!data.length) {\n Str(TString).replace(tCommand, function (a, b, c) {\n var params = [],\n name = b.toLowerCase();\n c.replace(pathValues, function (a, b) {\n b && params.push(+b);\n });\n data.push([b].concat(params));\n });\n }\n data.toString = Snap.path.toString;\n return data;\n};\nfunction svgTransform2string(tstr) {\n var res = [];\n tstr = tstr.replace(/(?:^|\\s)(\\w+)\\(([^)]+)\\)/g, function (all, name, params) {\n params = params.split(/\\s*,\\s*|\\s+/);\n if (name == \"rotate\" && params.length == 1) {\n params.push(0, 0);\n }\n if (name == \"scale\") {\n if (params.length > 2) {\n params = params.slice(0, 2);\n } else if (params.length == 2) {\n params.push(0, 0);\n }\n if (params.length == 1) {\n params.push(params[0], 0, 0);\n }\n }\n if (name == \"skewX\") {\n res.push([\"m\", 1, 0, math.tan(rad(params[0])), 1, 0, 0]);\n } else if (name == \"skewY\") {\n res.push([\"m\", 1, math.tan(rad(params[0])), 0, 1, 0, 0]);\n } else {\n res.push([name.charAt(0)].concat(params));\n }\n return all;\n });\n return res;\n}\nSnap._.svgTransform2string = svgTransform2string;\nSnap._.rgTransform = /^[a-z][\\s]*-?\\.?\\d/i;\nfunction transform2matrix(tstr, bbox) {\n var tdata = parseTransformString(tstr),\n m = new Snap.Matrix;\n if (tdata) {\n for (var i = 0, ii = tdata.length; i < ii; i++) {\n var t = tdata[i],\n tlen = t.length,\n command = Str(t[0]).toLowerCase(),\n absolute = t[0] != command,\n inver = absolute ? m.invert() : 0,\n x1,\n y1,\n x2,\n y2,\n bb;\n if (command == \"t\" && tlen == 2){\n m.translate(t[1], 0);\n } else if (command == \"t\" && tlen == 3) {\n if (absolute) {\n x1 = inver.x(0, 0);\n y1 = inver.y(0, 0);\n x2 = inver.x(t[1], t[2]);\n y2 = inver.y(t[1], t[2]);\n m.translate(x2 - x1, y2 - y1);\n } else {\n m.translate(t[1], t[2]);\n }\n } else if (command == \"r\") {\n if (tlen == 2) {\n bb = bb || bbox;\n m.rotate(t[1], bb.x + bb.width / 2, bb.y + bb.height / 2);\n } else if (tlen == 4) {\n if (absolute) {\n x2 = inver.x(t[2], t[3]);\n y2 = inver.y(t[2], t[3]);\n m.rotate(t[1], x2, y2);\n } else {\n m.rotate(t[1], t[2], t[3]);\n }\n }\n } else if (command == \"s\") {\n if (tlen == 2 || tlen == 3) {\n bb = bb || bbox;\n m.scale(t[1], t[tlen - 1], bb.x + bb.width / 2, bb.y + bb.height / 2);\n } else if (tlen == 4) {\n if (absolute) {\n x2 = inver.x(t[2], t[3]);\n y2 = inver.y(t[2], t[3]);\n m.scale(t[1], t[1], x2, y2);\n } else {\n m.scale(t[1], t[1], t[2], t[3]);\n }\n } else if (tlen == 5) {\n if (absolute) {\n x2 = inver.x(t[3], t[4]);\n y2 = inver.y(t[3], t[4]);\n m.scale(t[1], t[2], x2, y2);\n } else {\n m.scale(t[1], t[2], t[3], t[4]);\n }\n }\n } else if (command == \"m\" && tlen == 7) {\n m.add(t[1], t[2], t[3], t[4], t[5], t[6]);\n }\n }\n }\n return m;\n}\nSnap._.transform2matrix = transform2matrix;\nSnap._unit2px = unit2px;\nvar contains = glob.doc.contains || glob.doc.compareDocumentPosition ?\n function (a, b) {\n var adown = a.nodeType == 9 ? a.documentElement : a,\n bup = b && b.parentNode;\n return a == bup || !!(bup && bup.nodeType == 1 && (\n adown.contains ?\n adown.contains(bup) :\n a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16\n ));\n } :\n function (a, b) {\n if (b) {\n while (b) {\n b = b.parentNode;\n if (b == a) {\n return true;\n }\n }\n }\n return false;\n };\nfunction getSomeDefs(el) {\n var p = el.node.ownerSVGElement && wrap(el.node.ownerSVGElement) ||\n el.node.parentNode && wrap(el.node.parentNode) ||\n Snap.select(\"svg\") ||\n Snap(0, 0),\n pdefs = p.select(\"defs\"),\n defs = pdefs == null ? false : pdefs.node;\n if (!defs) {\n defs = make(\"defs\", p.node).node;\n }\n return defs;\n}\nfunction getSomeSVG(el) {\n return el.node.ownerSVGElement && wrap(el.node.ownerSVGElement) || Snap.select(\"svg\");\n}\nSnap._.getSomeDefs = getSomeDefs;\nSnap._.getSomeSVG = getSomeSVG;\nfunction unit2px(el, name, value) {\n var svg = getSomeSVG(el).node,\n out = {},\n mgr = svg.querySelector(\".svg---mgr\");\n if (!mgr) {\n mgr = $(\"rect\");\n $(mgr, {x: -9e9, y: -9e9, width: 10, height: 10, \"class\": \"svg---mgr\", fill: \"none\"});\n svg.appendChild(mgr);\n }\n function getW(val) {\n if (val == null) {\n return E;\n }\n if (val == +val) {\n return val;\n }\n $(mgr, {width: val});\n try {\n return mgr.getBBox().width;\n } catch (e) {\n return 0;\n }\n }\n function getH(val) {\n if (val == null) {\n return E;\n }\n if (val == +val) {\n return val;\n }\n $(mgr, {height: val});\n try {\n return mgr.getBBox().height;\n } catch (e) {\n return 0;\n }\n }\n function set(nam, f) {\n if (name == null) {\n out[nam] = f(el.attr(nam) || 0);\n } else if (nam == name) {\n out = f(value == null ? el.attr(nam) || 0 : value);\n }\n }\n switch (el.type) {\n case \"rect\":\n set(\"rx\", getW);\n set(\"ry\", getH);\n case \"image\":\n set(\"width\", getW);\n set(\"height\", getH);\n case \"text\":\n set(\"x\", getW);\n set(\"y\", getH);\n break;\n case \"circle\":\n set(\"cx\", getW);\n set(\"cy\", getH);\n set(\"r\", getW);\n break;\n case \"ellipse\":\n set(\"cx\", getW);\n set(\"cy\", getH);\n set(\"rx\", getW);\n set(\"ry\", getH);\n break;\n case \"line\":\n set(\"x1\", getW);\n set(\"x2\", getW);\n set(\"y1\", getH);\n set(\"y2\", getH);\n break;\n case \"marker\":\n set(\"refX\", getW);\n set(\"markerWidth\", getW);\n set(\"refY\", getH);\n set(\"markerHeight\", getH);\n break;\n case \"radialGradient\":\n set(\"fx\", getW);\n set(\"fy\", getH);\n break;\n case \"tspan\":\n set(\"dx\", getW);\n set(\"dy\", getH);\n break;\n default:\n set(name, getW);\n }\n svg.removeChild(mgr);\n return out;\n}\n/*\\\n * Snap.select\n [ method ]\n **\n * Wraps a DOM element specified by CSS selector as @Element\n - query (string) CSS selector of the element\n = (Element) the current element\n\\*/\nSnap.select = function (query) {\n query = Str(query).replace(/([^\\\\]):/g, \"$1\\\\:\");\n return wrap(glob.doc.querySelector(query));\n};\n/*\\\n * Snap.selectAll\n [ method ]\n **\n * Wraps DOM elements specified by CSS selector as set or array of @Element\n - query (string) CSS selector of the element\n = (Element) the current element\n\\*/\nSnap.selectAll = function (query) {\n var nodelist = glob.doc.querySelectorAll(query),\n set = (Snap.set || Array)();\n for (var i = 0; i < nodelist.length; i++) {\n set.push(wrap(nodelist[i]));\n }\n return set;\n};\n\nfunction add2group(list) {\n if (!is(list, \"array\")) {\n list = Array.prototype.slice.call(arguments, 0);\n }\n var i = 0,\n j = 0,\n node = this.node;\n while (this[i]) delete this[i++];\n for (i = 0; i < list.length; i++) {\n if (list[i].type == \"set\") {\n list[i].forEach(function (el) {\n node.appendChild(el.node);\n });\n } else {\n node.appendChild(list[i].node);\n }\n }\n var children = node.childNodes;\n for (i = 0; i < children.length; i++) {\n this[j++] = wrap(children[i]);\n }\n return this;\n}\n// Hub garbage collector every 10s\nsetInterval(function () {\n for (var key in hub) if (hub[has](key)) {\n var el = hub[key],\n node = el.node;\n if (el.type != \"svg\" && !node.ownerSVGElement || el.type == \"svg\" && (!node.parentNode || \"ownerSVGElement\" in node.parentNode && !node.ownerSVGElement)) {\n delete hub[key];\n }\n }\n}, 1e4);\nfunction Element(el) {\n if (el.snap in hub) {\n return hub[el.snap];\n }\n var svg;\n try {\n svg = el.ownerSVGElement;\n } catch(e) {}\n /*\\\n * Element.node\n [ property (object) ]\n **\n * Gives you a reference to the DOM object, so you can assign event handlers or just mess around.\n > Usage\n | // draw a circle at coordinate 10,10 with radius of 10\n | var c = paper.circle(10, 10, 10);\n | c.node.onclick = function () {\n | c.attr(\"fill\", \"red\");\n | };\n \\*/\n this.node = el;\n if (svg) {\n this.paper = new Paper(svg);\n }\n /*\\\n * Element.type\n [ property (string) ]\n **\n * SVG tag name of the given element.\n \\*/\n this.type = el.tagName || el.nodeName;\n var id = this.id = ID(this);\n this.anims = {};\n this._ = {\n transform: []\n };\n el.snap = id;\n hub[id] = this;\n if (this.type == \"g\") {\n this.add = add2group;\n }\n if (this.type in {g: 1, mask: 1, pattern: 1, symbol: 1}) {\n for (var method in Paper.prototype) if (Paper.prototype[has](method)) {\n this[method] = Paper.prototype[method];\n }\n }\n}\n /*\\\n * Element.attr\n [ method ]\n **\n * Gets or sets given attributes of the element.\n **\n - params (object) contains key-value pairs of attributes you want to set\n * or\n - param (string) name of the attribute\n = (Element) the current element\n * or\n = (string) value of attribute\n > Usage\n | el.attr({\n | fill: \"#fc0\",\n | stroke: \"#000\",\n | strokeWidth: 2, // CamelCase...\n | \"fill-opacity\": 0.5, // or dash-separated names\n | width: \"*=2\" // prefixed values\n | });\n | console.log(el.attr(\"fill\")); // #fc0\n * Prefixed values in format `\"+=10\"` supported. All four operations\n * (`+`, `-`, `*` and `/`) could be used. Optionally you can use units for `+`\n * and `-`: `\"+=2em\"`.\n \\*/\n Element.prototype.attr = function (params, value) {\n var el = this,\n node = el.node;\n if (!params) {\n if (node.nodeType != 1) {\n return {\n text: node.nodeValue\n };\n }\n var attr = node.attributes,\n out = {};\n for (var i = 0, ii = attr.length; i < ii; i++) {\n out[attr[i].nodeName] = attr[i].nodeValue;\n }\n return out;\n }\n if (is(params, \"string\")) {\n if (arguments.length > 1) {\n var json = {};\n json[params] = value;\n params = json;\n } else {\n return eve(\"snap.util.getattr.\" + params, el).firstDefined();\n }\n }\n for (var att in params) {\n if (params[has](att)) {\n eve(\"snap.util.attr.\" + att, el, params[att]);\n }\n }\n return el;\n };\n/*\\\n * Snap.parse\n [ method ]\n **\n * Parses SVG fragment and converts it into a @Fragment\n **\n - svg (string) SVG string\n = (Fragment) the @Fragment\n\\*/\nSnap.parse = function (svg) {\n var f = glob.doc.createDocumentFragment(),\n full = true,\n div = glob.doc.createElement(\"div\");\n svg = Str(svg);\n if (!svg.match(/^\\s*<\\s*svg(?:\\s|>)/)) {\n svg = \"<svg>\" + svg + \"</svg>\";\n full = false;\n }\n div.innerHTML = svg;\n svg = div.getElementsByTagName(\"svg\")[0];\n if (svg) {\n if (full) {\n f = svg;\n } else {\n while (svg.firstChild) {\n f.appendChild(svg.firstChild);\n }\n }\n }\n return new Fragment(f);\n};\nfunction Fragment(frag) {\n this.node = frag;\n}\n/*\\\n * Snap.fragment\n [ method ]\n **\n * Creates a DOM fragment from a given list of elements or strings\n **\n - varargs (…) SVG string\n = (Fragment) the @Fragment\n\\*/\nSnap.fragment = function () {\n var args = Array.prototype.slice.call(arguments, 0),\n f = glob.doc.createDocumentFragment();\n for (var i = 0, ii = args.length; i < ii; i++) {\n var item = args[i];\n if (item.node && item.node.nodeType) {\n f.appendChild(item.node);\n }\n if (item.nodeType) {\n f.appendChild(item);\n }\n if (typeof item == \"string\") {\n f.appendChild(Snap.parse(item).node);\n }\n }\n return new Fragment(f);\n};\n\nfunction make(name, parent) {\n var res = $(name);\n parent.appendChild(res);\n var el = wrap(res);\n return el;\n}\nfunction Paper(w, h) {\n var res,\n desc,\n defs,\n proto = Paper.prototype;\n if (w && w.tagName && w.tagName.toLowerCase() == \"svg\") {\n if (w.snap in hub) {\n return hub[w.snap];\n }\n var doc = w.ownerDocument;\n res = new Element(w);\n desc = w.getElementsByTagName(\"desc\")[0];\n defs = w.getElementsByTagName(\"defs\")[0];\n if (!desc) {\n desc = $(\"desc\");\n desc.appendChild(doc.createTextNode(\"Created with Snap\"));\n res.node.appendChild(desc);\n }\n if (!defs) {\n defs = $(\"defs\");\n res.node.appendChild(defs);\n }\n res.defs = defs;\n for (var key in proto) if (proto[has](key)) {\n res[key] = proto[key];\n }\n res.paper = res.root = res;\n } else {\n res = make(\"svg\", glob.doc.body);\n $(res.node, {\n height: h,\n version: 1.1,\n width: w,\n xmlns: xmlns\n });\n }\n return res;\n}\nfunction wrap(dom) {\n if (!dom) {\n return dom;\n }\n if (dom instanceof Element || dom instanceof Fragment) {\n return dom;\n }\n if (dom.tagName && dom.tagName.toLowerCase() == \"svg\") {\n return new Paper(dom);\n }\n if (dom.tagName && dom.tagName.toLowerCase() == \"object\" && dom.type == \"image/svg+xml\") {\n return new Paper(dom.contentDocument.getElementsByTagName(\"svg\")[0]);\n }\n return new Element(dom);\n}\n\nSnap._.make = make;\nSnap._.wrap = wrap;\n/*\\\n * Paper.el\n [ method ]\n **\n * Creates an element on paper with a given name and no attributes\n **\n - name (string) tag name\n - attr (object) attributes\n = (Element) the current element\n > Usage\n | var c = paper.circle(10, 10, 10); // is the same as...\n | var c = paper.el(\"circle\").attr({\n | cx: 10,\n | cy: 10,\n | r: 10\n | });\n | // and the same as\n | var c = paper.el(\"circle\", {\n | cx: 10,\n | cy: 10,\n | r: 10\n | });\n\\*/\nPaper.prototype.el = function (name, attr) {\n var el = make(name, this.node);\n attr && el.attr(attr);\n return el;\n};\n/*\\\n * Element.children\n [ method ]\n **\n * Returns array of all the children of the element.\n = (array) array of Elements\n\\*/\nElement.prototype.children = function () {\n var out = [],\n ch = this.node.childNodes;\n for (var i = 0, ii = ch.length; i < ii; i++) {\n out[i] = Snap(ch[i]);\n }\n return out;\n};\nfunction jsonFiller(root, o) {\n for (var i = 0, ii = root.length; i < ii; i++) {\n var item = {\n type: root[i].type,\n attr: root[i].attr()\n },\n children = root[i].children();\n o.push(item);\n if (children.length) {\n jsonFiller(children, item.childNodes = []);\n }\n }\n}\n/*\\\n * Element.toJSON\n [ method ]\n **\n * Returns object representation of the given element and all its children.\n = (object) in format\n o {\n o type (string) this.type,\n o attr (object) attributes map,\n o childNodes (array) optional array of children in the same format\n o }\n\\*/\nElement.prototype.toJSON = function () {\n var out = [];\n jsonFiller([this], out);\n return out[0];\n};\n// default\neve.on(\"snap.util.getattr\", function () {\n var att = eve.nt();\n att = att.substring(att.lastIndexOf(\".\") + 1);\n var css = att.replace(/[A-Z]/g, function (letter) {\n return \"-\" + letter.toLowerCase();\n });\n if (cssAttr[has](css)) {\n return this.node.ownerDocument.defaultView.getComputedStyle(this.node, null).getPropertyValue(css);\n } else {\n return $(this.node, att);\n }\n});\nvar cssAttr = {\n \"alignment-baseline\": 0,\n \"baseline-shift\": 0,\n \"clip\": 0,\n \"clip-path\": 0,\n \"clip-rule\": 0,\n \"color\": 0,\n \"color-interpolation\": 0,\n \"color-interpolation-filters\": 0,\n \"color-profile\": 0,\n \"color-rendering\": 0,\n \"cursor\": 0,\n \"direction\": 0,\n \"display\": 0,\n \"dominant-baseline\": 0,\n \"enable-background\": 0,\n \"fill\": 0,\n \"fill-opacity\": 0,\n \"fill-rule\": 0,\n \"filter\": 0,\n \"flood-color\": 0,\n \"flood-opacity\": 0,\n \"font\": 0,\n \"font-family\": 0,\n \"font-size\": 0,\n \"font-size-adjust\": 0,\n \"font-stretch\": 0,\n \"font-style\": 0,\n \"font-variant\": 0,\n \"font-weight\": 0,\n \"glyph-orientation-horizontal\": 0,\n \"glyph-orientation-vertical\": 0,\n \"image-rendering\": 0,\n \"kerning\": 0,\n \"letter-spacing\": 0,\n \"lighting-color\": 0,\n \"marker\": 0,\n \"marker-end\": 0,\n \"marker-mid\": 0,\n \"marker-start\": 0,\n \"mask\": 0,\n \"opacity\": 0,\n \"overflow\": 0,\n \"pointer-events\": 0,\n \"shape-rendering\": 0,\n \"stop-color\": 0,\n \"stop-opacity\": 0,\n \"stroke\": 0,\n \"stroke-dasharray\": 0,\n \"stroke-dashoffset\": 0,\n \"stroke-linecap\": 0,\n \"stroke-linejoin\": 0,\n \"stroke-miterlimit\": 0,\n \"stroke-opacity\": 0,\n \"stroke-width\": 0,\n \"text-anchor\": 0,\n \"text-decoration\": 0,\n \"text-rendering\": 0,\n \"unicode-bidi\": 0,\n \"visibility\": 0,\n \"word-spacing\": 0,\n \"writing-mode\": 0\n};\n\neve.on(\"snap.util.attr\", function (value) {\n var att = eve.nt(),\n attr = {};\n att = att.substring(att.lastIndexOf(\".\") + 1);\n attr[att] = value;\n var style = att.replace(/-(\\w)/gi, function (all, letter) {\n return letter.toUpperCase();\n }),\n css = att.replace(/[A-Z]/g, function (letter) {\n return \"-\" + letter.toLowerCase();\n });\n if (cssAttr[has](css)) {\n this.node.style[style] = value == null ? E : value;\n } else {\n $(this.node, attr);\n }\n});\n(function (proto) {}(Paper.prototype));\n\n// simple ajax\n/*\\\n * Snap.ajax\n [ method ]\n **\n * Simple implementation of Ajax\n **\n - url (string) URL\n - postData (object|string) data for post request\n - callback (function) callback\n - scope (object) #optional scope of callback\n * or\n - url (string) URL\n - callback (function) callback\n - scope (object) #optional scope of callback\n = (XMLHttpRequest) the XMLHttpRequest object, just in case\n\\*/\nSnap.ajax = function (url, postData, callback, scope){\n var req = new XMLHttpRequest,\n id = ID();\n if (req) {\n if (is(postData, \"function\")) {\n scope = callback;\n callback = postData;\n postData = null;\n } else if (is(postData, \"object\")) {\n var pd = [];\n for (var key in postData) if (postData.hasOwnProperty(key)) {\n pd.push(encodeURIComponent(key) + \"=\" + encodeURIComponent(postData[key]));\n }\n postData = pd.join(\"&\");\n }\n req.open(postData ? \"POST\" : \"GET\", url, true);\n if (postData) {\n req.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n req.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n }\n if (callback) {\n eve.once(\"snap.ajax.\" + id + \".0\", callback);\n eve.once(\"snap.ajax.\" + id + \".200\", callback);\n eve.once(\"snap.ajax.\" + id + \".304\", callback);\n }\n req.onreadystatechange = function() {\n if (req.readyState != 4) return;\n eve(\"snap.ajax.\" + id + \".\" + req.status, scope, req);\n };\n if (req.readyState == 4) {\n return req;\n }\n req.send(postData);\n return req;\n }\n};\n/*\\\n * Snap.load\n [ method ]\n **\n * Loads external SVG file as a @Fragment (see @Snap.ajax for more advanced AJAX)\n **\n - url (string) URL\n - callback (function) callback\n - scope (object) #optional scope of callback\n\\*/\nSnap.load = function (url, callback, scope) {\n Snap.ajax(url, function (req) {\n var f = Snap.parse(req.responseText);\n scope ? callback.call(scope, f) : callback(f);\n });\n};\nvar getOffset = function (elem) {\n var box = elem.getBoundingClientRect(),\n doc = elem.ownerDocument,\n body = doc.body,\n docElem = doc.documentElement,\n clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,\n top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop ) - clientTop,\n left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft;\n return {\n y: top,\n x: left\n };\n};\n/*\\\n * Snap.getElementByPoint\n [ method ]\n **\n * Returns you topmost element under given point.\n **\n = (object) Snap element object\n - x (number) x coordinate from the top left corner of the window\n - y (number) y coordinate from the top left corner of the window\n > Usage\n | Snap.getElementByPoint(mouseX, mouseY).attr({stroke: \"#f00\"});\n\\*/\nSnap.getElementByPoint = function (x, y) {\n var paper = this,\n svg = paper.canvas,\n target = glob.doc.elementFromPoint(x, y);\n if (glob.win.opera && target.tagName == \"svg\") {\n var so = getOffset(target),\n sr = target.createSVGRect();\n sr.x = x - so.x;\n sr.y = y - so.y;\n sr.width = sr.height = 1;\n var hits = target.getIntersectionList(sr, null);\n if (hits.length) {\n target = hits[hits.length - 1];\n }\n }\n if (!target) {\n return null;\n }\n return wrap(target);\n};\n/*\\\n * Snap.plugin\n [ method ]\n **\n * Let you write plugins. You pass in a function with five arguments, like this:\n | Snap.plugin(function (Snap, Element, Paper, global, Fragment) {\n | Snap.newmethod = function () {};\n | Element.prototype.newmethod = function () {};\n | Paper.prototype.newmethod = function () {};\n | });\n * Inside the function you have access to all main objects (and their\n * prototypes). This allow you to extend anything you want.\n **\n - f (function) your plugin body\n\\*/\nSnap.plugin = function (f) {\n f(Snap, Element, Paper, glob, Fragment);\n};\nglob.win.Snap = Snap;\nreturn Snap;\n}(window || this));\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob, Fragment) {\n var elproto = Element.prototype,\n is = Snap.is,\n Str = String,\n unit2px = Snap._unit2px,\n $ = Snap._.$,\n make = Snap._.make,\n getSomeDefs = Snap._.getSomeDefs,\n has = \"hasOwnProperty\",\n wrap = Snap._.wrap;\n /*\\\n * Element.getBBox\n [ method ]\n **\n * Returns the bounding box descriptor for the given element\n **\n = (object) bounding box descriptor:\n o {\n o cx: (number) x of the center,\n o cy: (number) x of the center,\n o h: (number) height,\n o height: (number) height,\n o path: (string) path command for the box,\n o r0: (number) radius of a circle that fully encloses the box,\n o r1: (number) radius of the smallest circle that can be enclosed,\n o r2: (number) radius of the largest circle that can be enclosed,\n o vb: (string) box as a viewbox command,\n o w: (number) width,\n o width: (number) width,\n o x2: (number) x of the right side,\n o x: (number) x of the left side,\n o y2: (number) y of the bottom edge,\n o y: (number) y of the top edge\n o }\n \\*/\n elproto.getBBox = function (isWithoutTransform) {\n if (this.type == \"tspan\") {\n return Snap._.box(this.node.getClientRects().item(0));\n }\n if (!Snap.Matrix || !Snap.path) {\n return this.node.getBBox();\n }\n var el = this,\n m = new Snap.Matrix;\n if (el.removed) {\n return Snap._.box();\n }\n while (el.type == \"use\") {\n if (!isWithoutTransform) {\n m = m.add(el.transform().localMatrix.translate(el.attr(\"x\") || 0, el.attr(\"y\") || 0));\n }\n if (el.original) {\n el = el.original;\n } else {\n var href = el.attr(\"xlink:href\");\n el = el.original = el.node.ownerDocument.getElementById(href.substring(href.indexOf(\"#\") + 1));\n }\n }\n var _ = el._,\n pathfinder = Snap.path.get[el.type] || Snap.path.get.deflt;\n try {\n if (isWithoutTransform) {\n _.bboxwt = pathfinder ? Snap.path.getBBox(el.realPath = pathfinder(el)) : Snap._.box(el.node.getBBox());\n return Snap._.box(_.bboxwt);\n } else {\n el.realPath = pathfinder(el);\n el.matrix = el.transform().localMatrix;\n _.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));\n return Snap._.box(_.bbox);\n }\n } catch (e) {\n // Firefox doesn’t give you bbox of hidden element\n return Snap._.box();\n }\n };\n var propString = function () {\n return this.string;\n };\n function extractTransform(el, tstr) {\n if (tstr == null) {\n var doReturn = true;\n if (el.type == \"linearGradient\" || el.type == \"radialGradient\") {\n tstr = el.node.getAttribute(\"gradientTransform\");\n } else if (el.type == \"pattern\") {\n tstr = el.node.getAttribute(\"patternTransform\");\n } else {\n tstr = el.node.getAttribute(\"transform\");\n }\n if (!tstr) {\n return new Snap.Matrix;\n }\n tstr = Snap._.svgTransform2string(tstr);\n } else {\n if (!Snap._.rgTransform.test(tstr)) {\n tstr = Snap._.svgTransform2string(tstr);\n } else {\n tstr = Str(tstr).replace(/\\.{3}|\\u2026/g, el._.transform || \"\");\n }\n if (is(tstr, \"array\")) {\n tstr = Snap.path ? Snap.path.toString.call(tstr) : Str(tstr);\n }\n el._.transform = tstr;\n }\n var m = Snap._.transform2matrix(tstr, el.getBBox(1));\n if (doReturn) {\n return m;\n } else {\n el.matrix = m;\n }\n }\n /*\\\n * Element.transform\n [ method ]\n **\n * Gets or sets transformation of the element\n **\n - tstr (string) transform string in Snap or SVG format\n = (Element) the current element\n * or\n = (object) transformation descriptor:\n o {\n o string (string) transform string,\n o globalMatrix (Matrix) matrix of all transformations applied to element or its parents,\n o localMatrix (Matrix) matrix of transformations applied only to the element,\n o diffMatrix (Matrix) matrix of difference between global and local transformations,\n o global (string) global transformation as string,\n o local (string) local transformation as string,\n o toString (function) returns `string` property\n o }\n \\*/\n elproto.transform = function (tstr) {\n var _ = this._;\n if (tstr == null) {\n var papa = this,\n global = new Snap.Matrix(this.node.getCTM()),\n local = extractTransform(this),\n ms = [local],\n m = new Snap.Matrix,\n i,\n localString = local.toTransformString(),\n string = Str(local) == Str(this.matrix) ?\n Str(_.transform) : localString;\n while (papa.type != \"svg\" && (papa = papa.parent())) {\n ms.push(extractTransform(papa));\n }\n i = ms.length;\n while (i--) {\n m.add(ms[i]);\n }\n return {\n string: string,\n globalMatrix: global,\n totalMatrix: m,\n localMatrix: local,\n diffMatrix: global.clone().add(local.invert()),\n global: global.toTransformString(),\n total: m.toTransformString(),\n local: localString,\n toString: propString\n };\n }\n if (tstr instanceof Snap.Matrix) {\n this.matrix = tstr;\n this._.transform = tstr.toTransformString();\n } else {\n extractTransform(this, tstr);\n }\n\n if (this.node) {\n if (this.type == \"linearGradient\" || this.type == \"radialGradient\") {\n $(this.node, {gradientTransform: this.matrix});\n } else if (this.type == \"pattern\") {\n $(this.node, {patternTransform: this.matrix});\n } else {\n $(this.node, {transform: this.matrix});\n }\n }\n\n return this;\n };\n /*\\\n * Element.parent\n [ method ]\n **\n * Returns the element's parent\n **\n = (Element) the parent element\n \\*/\n elproto.parent = function () {\n return wrap(this.node.parentNode);\n };\n /*\\\n * Element.append\n [ method ]\n **\n * Appends the given element to current one\n **\n - el (Element|Set) element to append\n = (Element) the parent element\n \\*/\n /*\\\n * Element.add\n [ method ]\n **\n * See @Element.append\n \\*/\n elproto.append = elproto.add = function (el) {\n if (el) {\n if (el.type == \"set\") {\n var it = this;\n el.forEach(function (el) {\n it.add(el);\n });\n return this;\n }\n el = wrap(el);\n this.node.appendChild(el.node);\n el.paper = this.paper;\n }\n return this;\n };\n /*\\\n * Element.appendTo\n [ method ]\n **\n * Appends the current element to the given one\n **\n - el (Element) parent element to append to\n = (Element) the child element\n \\*/\n elproto.appendTo = function (el) {\n if (el) {\n el = wrap(el);\n el.append(this);\n }\n return this;\n };\n /*\\\n * Element.prepend\n [ method ]\n **\n * Prepends the given element to the current one\n **\n - el (Element) element to prepend\n = (Element) the parent element\n \\*/\n elproto.prepend = function (el) {\n if (el) {\n if (el.type == \"set\") {\n var it = this,\n first;\n el.forEach(function (el) {\n if (first) {\n first.after(el);\n } else {\n it.prepend(el);\n }\n first = el;\n });\n return this;\n }\n el = wrap(el);\n var parent = el.parent();\n this.node.insertBefore(el.node, this.node.firstChild);\n this.add && this.add();\n el.paper = this.paper;\n this.parent() && this.parent().add();\n parent && parent.add();\n }\n return this;\n };\n /*\\\n * Element.prependTo\n [ method ]\n **\n * Prepends the current element to the given one\n **\n - el (Element) parent element to prepend to\n = (Element) the child element\n \\*/\n elproto.prependTo = function (el) {\n el = wrap(el);\n el.prepend(this);\n return this;\n };\n /*\\\n * Element.before\n [ method ]\n **\n * Inserts given element before the current one\n **\n - el (Element) element to insert\n = (Element) the parent element\n \\*/\n elproto.before = function (el) {\n if (el.type == \"set\") {\n var it = this;\n el.forEach(function (el) {\n var parent = el.parent();\n it.node.parentNode.insertBefore(el.node, it.node);\n parent && parent.add();\n });\n this.parent().add();\n return this;\n }\n el = wrap(el);\n var parent = el.parent();\n this.node.parentNode.insertBefore(el.node, this.node);\n this.parent() && this.parent().add();\n parent && parent.add();\n el.paper = this.paper;\n return this;\n };\n /*\\\n * Element.after\n [ method ]\n **\n * Inserts given element after the current one\n **\n - el (Element) element to insert\n = (Element) the parent element\n \\*/\n elproto.after = function (el) {\n el = wrap(el);\n var parent = el.parent();\n if (this.node.nextSibling) {\n this.node.parentNode.insertBefore(el.node, this.node.nextSibling);\n } else {\n this.node.parentNode.appendChild(el.node);\n }\n this.parent() && this.parent().add();\n parent && parent.add();\n el.paper = this.paper;\n return this;\n };\n /*\\\n * Element.insertBefore\n [ method ]\n **\n * Inserts the element after the given one\n **\n - el (Element) element next to whom insert to\n = (Element) the parent element\n \\*/\n elproto.insertBefore = function (el) {\n el = wrap(el);\n var parent = this.parent();\n el.node.parentNode.insertBefore(this.node, el.node);\n this.paper = el.paper;\n parent && parent.add();\n el.parent() && el.parent().add();\n return this;\n };\n /*\\\n * Element.insertAfter\n [ method ]\n **\n * Inserts the element after the given one\n **\n - el (Element) element next to whom insert to\n = (Element) the parent element\n \\*/\n elproto.insertAfter = function (el) {\n el = wrap(el);\n var parent = this.parent();\n el.node.parentNode.insertBefore(this.node, el.node.nextSibling);\n this.paper = el.paper;\n parent && parent.add();\n el.parent() && el.parent().add();\n return this;\n };\n /*\\\n * Element.remove\n [ method ]\n **\n * Removes element from the DOM\n = (Element) the detached element\n \\*/\n elproto.remove = function () {\n var parent = this.parent();\n this.node.parentNode && this.node.parentNode.removeChild(this.node);\n delete this.paper;\n this.removed = true;\n parent && parent.add();\n return this;\n };\n /*\\\n * Element.select\n [ method ]\n **\n * Gathers the nested @Element matching the given set of CSS selectors\n **\n - query (string) CSS selector\n = (Element) result of query selection\n \\*/\n elproto.select = function (query) {\n return wrap(this.node.querySelector(query));\n };\n /*\\\n * Element.selectAll\n [ method ]\n **\n * Gathers nested @Element objects matching the given set of CSS selectors\n **\n - query (string) CSS selector\n = (Set|array) result of query selection\n \\*/\n elproto.selectAll = function (query) {\n var nodelist = this.node.querySelectorAll(query),\n set = (Snap.set || Array)();\n for (var i = 0; i < nodelist.length; i++) {\n set.push(wrap(nodelist[i]));\n }\n return set;\n };\n /*\\\n * Element.asPX\n [ method ]\n **\n * Returns given attribute of the element as a `px` value (not %, em, etc.)\n **\n - attr (string) attribute name\n - value (string) #optional attribute value\n = (Element) result of query selection\n \\*/\n elproto.asPX = function (attr, value) {\n if (value == null) {\n value = this.attr(attr);\n }\n return +unit2px(this, attr, value);\n };\n // SIERRA Element.use(): I suggest adding a note about how to access the original element the returned <use> instantiates. It's a part of SVG with which ordinary web developers may be least familiar.\n /*\\\n * Element.use\n [ method ]\n **\n * Creates a `<use>` element linked to the current element\n **\n = (Element) the `<use>` element\n \\*/\n elproto.use = function () {\n var use,\n id = this.node.id;\n if (!id) {\n id = this.id;\n $(this.node, {\n id: id\n });\n }\n if (this.type == \"linearGradient\" || this.type == \"radialGradient\" ||\n this.type == \"pattern\") {\n use = make(this.type, this.node.parentNode);\n } else {\n use = make(\"use\", this.node.parentNode);\n }\n $(use.node, {\n \"xlink:href\": \"#\" + id\n });\n use.original = this;\n return use;\n };\n function fixids(el) {\n var els = el.selectAll(\"*\"),\n it,\n url = /^\\s*url\\((\"|'|)(.*)\\1\\)\\s*$/,\n ids = [],\n uses = {};\n function urltest(it, name) {\n var val = $(it.node, name);\n val = val && val.match(url);\n val = val && val[2];\n if (val && val.charAt() == \"#\") {\n val = val.substring(1);\n } else {\n return;\n }\n if (val) {\n uses[val] = (uses[val] || []).concat(function (id) {\n var attr = {};\n attr[name] = Snap.url(id);\n $(it.node, attr);\n });\n }\n }\n function linktest(it) {\n var val = $(it.node, \"xlink:href\");\n if (val && val.charAt() == \"#\") {\n val = val.substring(1);\n } else {\n return;\n }\n if (val) {\n uses[val] = (uses[val] || []).concat(function (id) {\n it.attr(\"xlink:href\", \"#\" + id);\n });\n }\n }\n for (var i = 0, ii = els.length; i < ii; i++) {\n it = els[i];\n urltest(it, \"fill\");\n urltest(it, \"stroke\");\n urltest(it, \"filter\");\n urltest(it, \"mask\");\n urltest(it, \"clip-path\");\n linktest(it);\n var oldid = $(it.node, \"id\");\n if (oldid) {\n $(it.node, {id: it.id});\n ids.push({\n old: oldid,\n id: it.id\n });\n }\n }\n for (i = 0, ii = ids.length; i < ii; i++) {\n var fs = uses[ids[i].old];\n if (fs) {\n for (var j = 0, jj = fs.length; j < jj; j++) {\n fs[j](ids[i].id);\n }\n }\n }\n }\n /*\\\n * Element.clone\n [ method ]\n **\n * Creates a clone of the element and inserts it after the element\n **\n = (Element) the clone\n \\*/\n elproto.clone = function () {\n var clone = wrap(this.node.cloneNode(true));\n if ($(clone.node, \"id\")) {\n $(clone.node, {id: clone.id});\n }\n fixids(clone);\n clone.insertAfter(this);\n return clone;\n };\n /*\\\n * Element.toDefs\n [ method ]\n **\n * Moves element to the shared `<defs>` area\n **\n = (Element) the element\n \\*/\n elproto.toDefs = function () {\n var defs = getSomeDefs(this);\n defs.appendChild(this.node);\n return this;\n };\n /*\\\n * Element.toPattern\n [ method ]\n **\n * Creates a `<pattern>` element from the current element\n **\n * To create a pattern you have to specify the pattern rect:\n - x (string|number)\n - y (string|number)\n - width (string|number)\n - height (string|number)\n = (Element) the `<pattern>` element\n * You can use pattern later on as an argument for `fill` attribute:\n | var p = paper.path(\"M10-5-10,15M15,0,0,15M0-5-20,15\").attr({\n | fill: \"none\",\n | stroke: \"#bada55\",\n | strokeWidth: 5\n | }).pattern(0, 0, 10, 10),\n | c = paper.circle(200, 200, 100);\n | c.attr({\n | fill: p\n | });\n \\*/\n elproto.pattern = elproto.toPattern = function (x, y, width, height) {\n var p = make(\"pattern\", getSomeDefs(this));\n if (x == null) {\n x = this.getBBox();\n }\n if (is(x, \"object\") && \"x\" in x) {\n y = x.y;\n width = x.width;\n height = x.height;\n x = x.x;\n }\n $(p.node, {\n x: x,\n y: y,\n width: width,\n height: height,\n patternUnits: \"userSpaceOnUse\",\n id: p.id,\n viewBox: [x, y, width, height].join(\" \")\n });\n p.node.appendChild(this.node);\n return p;\n };\n// SIERRA Element.marker(): clarify what a reference point is. E.g., helps you offset the object from its edge such as when centering it over a path.\n// SIERRA Element.marker(): I suggest the method should accept default reference point values. Perhaps centered with (refX = width/2) and (refY = height/2)? Also, couldn't it assume the element's current _width_ and _height_? And please specify what _x_ and _y_ mean: offsets? If so, from where? Couldn't they also be assigned default values?\n /*\\\n * Element.marker\n [ method ]\n **\n * Creates a `<marker>` element from the current element\n **\n * To create a marker you have to specify the bounding rect and reference point:\n - x (number)\n - y (number)\n - width (number)\n - height (number)\n - refX (number)\n - refY (number)\n = (Element) the `<marker>` element\n * You can specify the marker later as an argument for `marker-start`, `marker-end`, `marker-mid`, and `marker` attributes. The `marker` attribute places the marker at every point along the path, and `marker-mid` places them at every point except the start and end.\n \\*/\n // TODO add usage for markers\n elproto.marker = function (x, y, width, height, refX, refY) {\n var p = make(\"marker\", getSomeDefs(this));\n if (x == null) {\n x = this.getBBox();\n }\n if (is(x, \"object\") && \"x\" in x) {\n y = x.y;\n width = x.width;\n height = x.height;\n refX = x.refX || x.cx;\n refY = x.refY || x.cy;\n x = x.x;\n }\n $(p.node, {\n viewBox: [x, y, width, height].join(\" \"),\n markerWidth: width,\n markerHeight: height,\n orient: \"auto\",\n refX: refX || 0,\n refY: refY || 0,\n id: p.id\n });\n p.node.appendChild(this.node);\n return p;\n };\n var eldata = {};\n /*\\\n * Element.data\n [ method ]\n **\n * Adds or retrieves given value associated with given key. (Don’t confuse\n * with `data-` attributes)\n *\n * See also @Element.removeData\n - key (string) key to store data\n - value (any) #optional value to store\n = (object) @Element\n * or, if value is not specified:\n = (any) value\n > Usage\n | for (var i = 0, i < 5, i++) {\n | paper.circle(10 + 15 * i, 10, 10)\n | .attr({fill: \"#000\"})\n | .data(\"i\", i)\n | .click(function () {\n | alert(this.data(\"i\"));\n | });\n | }\n \\*/\n elproto.data = function (key, value) {\n var data = eldata[this.id] = eldata[this.id] || {};\n if (arguments.length == 0){\n eve(\"snap.data.get.\" + this.id, this, data, null);\n return data;\n }\n if (arguments.length == 1) {\n if (Snap.is(key, \"object\")) {\n for (var i in key) if (key[has](i)) {\n this.data(i, key[i]);\n }\n return this;\n }\n eve(\"snap.data.get.\" + this.id, this, data[key], key);\n return data[key];\n }\n data[key] = value;\n eve(\"snap.data.set.\" + this.id, this, value, key);\n return this;\n };\n /*\\\n * Element.removeData\n [ method ]\n **\n * Removes value associated with an element by given key.\n * If key is not provided, removes all the data of the element.\n - key (string) #optional key\n = (object) @Element\n \\*/\n elproto.removeData = function (key) {\n if (key == null) {\n eldata[this.id] = {};\n } else {\n eldata[this.id] && delete eldata[this.id][key];\n }\n return this;\n };\n /*\\\n * Element.outerSVG\n [ method ]\n **\n * Returns SVG code for the element, equivalent to HTML's `outerHTML`.\n *\n * See also @Element.innerSVG\n = (string) SVG code for the element\n \\*/\n /*\\\n * Element.toString\n [ method ]\n **\n * See @Element.outerSVG\n \\*/\n elproto.outerSVG = elproto.toString = toString(1);\n /*\\\n * Element.innerSVG\n [ method ]\n **\n * Returns SVG code for the element's contents, equivalent to HTML's `innerHTML`\n = (string) SVG code for the element\n \\*/\n elproto.innerSVG = toString();\n function toString(type) {\n return function () {\n var res = type ? \"<\" + this.type : \"\",\n attr = this.node.attributes,\n chld = this.node.childNodes;\n if (type) {\n for (var i = 0, ii = attr.length; i < ii; i++) {\n res += \" \" + attr[i].name + '=\"' +\n attr[i].value.replace(/\"/g, '\\\\\"') + '\"';\n }\n }\n if (chld.length) {\n type && (res += \">\");\n for (i = 0, ii = chld.length; i < ii; i++) {\n if (chld[i].nodeType == 3) {\n res += chld[i].nodeValue;\n } else if (chld[i].nodeType == 1) {\n res += wrap(chld[i]).toString();\n }\n }\n type && (res += \"</\" + this.type + \">\");\n } else {\n type && (res += \"/>\");\n }\n return res;\n };\n }\n elproto.toDataURL = function () {\n if (window && window.btoa) {\n var bb = this.getBBox(),\n svg = Snap.format('<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"{width}\" height=\"{height}\" viewBox=\"{x} {y} {width} {height}\">{contents}</svg>', {\n x: +bb.x.toFixed(3),\n y: +bb.y.toFixed(3),\n width: +bb.width.toFixed(3),\n height: +bb.height.toFixed(3),\n contents: this.outerSVG()\n });\n return \"data:image/svg+xml;base64,\" + btoa(unescape(encodeURIComponent(svg)));\n }\n };\n /*\\\n * Fragment.select\n [ method ]\n **\n * See @Element.select\n \\*/\n Fragment.prototype.select = elproto.select;\n /*\\\n * Fragment.selectAll\n [ method ]\n **\n * See @Element.selectAll\n \\*/\n Fragment.prototype.selectAll = elproto.selectAll;\n});\n\n// Copyright (c) 2016 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob, Fragment) {\n var elproto = Element.prototype,\n is = Snap.is,\n Str = String,\n has = \"hasOwnProperty\";\n function slice(from, to, f) {\n return function (arr) {\n var res = arr.slice(from, to);\n if (res.length == 1) {\n res = res[0];\n }\n return f ? f(res) : res;\n };\n }\n var Animation = function (attr, ms, easing, callback) {\n if (typeof easing == \"function\" && !easing.length) {\n callback = easing;\n easing = mina.linear;\n }\n this.attr = attr;\n this.dur = ms;\n easing && (this.easing = easing);\n callback && (this.callback = callback);\n };\n Snap._.Animation = Animation;\n /*\\\n * Snap.animation\n [ method ]\n **\n * Creates an animation object\n **\n - attr (object) attributes of final destination\n - duration (number) duration of the animation, in milliseconds\n - easing (function) #optional one of easing functions of @mina or custom one\n - callback (function) #optional callback function that fires when animation ends\n = (object) animation object\n \\*/\n Snap.animation = function (attr, ms, easing, callback) {\n return new Animation(attr, ms, easing, callback);\n };\n /*\\\n * Element.inAnim\n [ method ]\n **\n * Returns a set of animations that may be able to manipulate the current element\n **\n = (object) in format:\n o {\n o anim (object) animation object,\n o mina (object) @mina object,\n o curStatus (number) 0..1 — status of the animation: 0 — just started, 1 — just finished,\n o status (function) gets or sets the status of the animation,\n o stop (function) stops the animation\n o }\n \\*/\n elproto.inAnim = function () {\n var el = this,\n res = [];\n for (var id in el.anims) if (el.anims[has](id)) {\n (function (a) {\n res.push({\n anim: new Animation(a._attrs, a.dur, a.easing, a._callback),\n mina: a,\n curStatus: a.status(),\n status: function (val) {\n return a.status(val);\n },\n stop: function () {\n a.stop();\n }\n });\n }(el.anims[id]));\n }\n return res;\n };\n /*\\\n * Snap.animate\n [ method ]\n **\n * Runs generic animation of one number into another with a caring function\n **\n - from (number|array) number or array of numbers\n - to (number|array) number or array of numbers\n - setter (function) caring function that accepts one number argument\n - duration (number) duration, in milliseconds\n - easing (function) #optional easing function from @mina or custom\n - callback (function) #optional callback function to execute when animation ends\n = (object) animation object in @mina format\n o {\n o id (string) animation id, consider it read-only,\n o duration (function) gets or sets the duration of the animation,\n o easing (function) easing,\n o speed (function) gets or sets the speed of the animation,\n o status (function) gets or sets the status of the animation,\n o stop (function) stops the animation\n o }\n | var rect = Snap().rect(0, 0, 10, 10);\n | Snap.animate(0, 10, function (val) {\n | rect.attr({\n | x: val\n | });\n | }, 1000);\n | // in given context is equivalent to\n | rect.animate({x: 10}, 1000);\n \\*/\n Snap.animate = function (from, to, setter, ms, easing, callback) {\n if (typeof easing == \"function\" && !easing.length) {\n callback = easing;\n easing = mina.linear;\n }\n var now = mina.time(),\n anim = mina(from, to, now, now + ms, mina.time, setter, easing);\n callback && eve.once(\"mina.finish.\" + anim.id, callback);\n return anim;\n };\n /*\\\n * Element.stop\n [ method ]\n **\n * Stops all the animations for the current element\n **\n = (Element) the current element\n \\*/\n elproto.stop = function () {\n var anims = this.inAnim();\n for (var i = 0, ii = anims.length; i < ii; i++) {\n anims[i].stop();\n }\n return this;\n };\n /*\\\n * Element.animate\n [ method ]\n **\n * Animates the given attributes of the element\n **\n - attrs (object) key-value pairs of destination attributes\n - duration (number) duration of the animation in milliseconds\n - easing (function) #optional easing function from @mina or custom\n - callback (function) #optional callback function that executes when the animation ends\n = (Element) the current element\n \\*/\n elproto.animate = function (attrs, ms, easing, callback) {\n if (typeof easing == \"function\" && !easing.length) {\n callback = easing;\n easing = mina.linear;\n }\n if (attrs instanceof Animation) {\n callback = attrs.callback;\n easing = attrs.easing;\n ms = attrs.dur;\n attrs = attrs.attr;\n }\n var fkeys = [], tkeys = [], keys = {}, from, to, f, eq,\n el = this;\n for (var key in attrs) if (attrs[has](key)) {\n if (el.equal) {\n eq = el.equal(key, Str(attrs[key]));\n from = eq.from;\n to = eq.to;\n f = eq.f;\n } else {\n from = +el.attr(key);\n to = +attrs[key];\n }\n var len = is(from, \"array\") ? from.length : 1;\n keys[key] = slice(fkeys.length, fkeys.length + len, f);\n fkeys = fkeys.concat(from);\n tkeys = tkeys.concat(to);\n }\n var now = mina.time(),\n anim = mina(fkeys, tkeys, now, now + ms, mina.time, function (val) {\n var attr = {};\n for (var key in keys) if (keys[has](key)) {\n attr[key] = keys[key](val);\n }\n el.attr(attr);\n }, easing);\n el.anims[anim.id] = anim;\n anim._attrs = attrs;\n anim._callback = callback;\n eve(\"snap.animcreated.\" + el.id, anim);\n eve.once(\"mina.finish.\" + anim.id, function () {\n eve.off(\"mina.*.\" + anim.id);\n delete el.anims[anim.id];\n callback && callback.call(el);\n });\n eve.once(\"mina.stop.\" + anim.id, function () {\n eve.off(\"mina.*.\" + anim.id);\n delete el.anims[anim.id];\n });\n return el;\n };\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob, Fragment) {\n var objectToString = Object.prototype.toString,\n Str = String,\n math = Math,\n E = \"\";\n function Matrix(a, b, c, d, e, f) {\n if (b == null && objectToString.call(a) == \"[object SVGMatrix]\") {\n this.a = a.a;\n this.b = a.b;\n this.c = a.c;\n this.d = a.d;\n this.e = a.e;\n this.f = a.f;\n return;\n }\n if (a != null) {\n this.a = +a;\n this.b = +b;\n this.c = +c;\n this.d = +d;\n this.e = +e;\n this.f = +f;\n } else {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.e = 0;\n this.f = 0;\n }\n }\n (function (matrixproto) {\n /*\\\n * Matrix.add\n [ method ]\n **\n * Adds the given matrix to existing one\n - a (number)\n - b (number)\n - c (number)\n - d (number)\n - e (number)\n - f (number)\n * or\n - matrix (object) @Matrix\n \\*/\n matrixproto.add = function (a, b, c, d, e, f) {\n if (a && a instanceof Matrix) {\n return this.add(a.a, a.b, a.c, a.d, a.e, a.f);\n }\n var aNew = a * this.a + b * this.c,\n bNew = a * this.b + b * this.d;\n this.e += e * this.a + f * this.c;\n this.f += e * this.b + f * this.d;\n this.c = c * this.a + d * this.c;\n this.d = c * this.b + d * this.d;\n\n this.a = aNew;\n this.b = bNew;\n return this;\n };\n /*\\\n * Matrix.multLeft\n [ method ]\n **\n * Multiplies a passed affine transform to the left: M * this.\n - a (number)\n - b (number)\n - c (number)\n - d (number)\n - e (number)\n - f (number)\n * or\n - matrix (object) @Matrix\n \\*/\n Matrix.prototype.multLeft = function (a, b, c, d, e, f) {\n if (a && a instanceof Matrix) {\n return this.multLeft(a.a, a.b, a.c, a.d, a.e, a.f);\n }\n var aNew = a * this.a + c * this.b,\n cNew = a * this.c + c * this.d,\n eNew = a * this.e + c * this.f + e;\n this.b = b * this.a + d * this.b;\n this.d = b * this.c + d * this.d;\n this.f = b * this.e + d * this.f + f;\n\n this.a = aNew;\n this.c = cNew;\n this.e = eNew;\n return this;\n };\n /*\\\n * Matrix.invert\n [ method ]\n **\n * Returns an inverted version of the matrix\n = (object) @Matrix\n \\*/\n matrixproto.invert = function () {\n var me = this,\n x = me.a * me.d - me.b * me.c;\n return new Matrix(me.d / x, -me.b / x, -me.c / x, me.a / x, (me.c * me.f - me.d * me.e) / x, (me.b * me.e - me.a * me.f) / x);\n };\n /*\\\n * Matrix.clone\n [ method ]\n **\n * Returns a copy of the matrix\n = (object) @Matrix\n \\*/\n matrixproto.clone = function () {\n return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);\n };\n /*\\\n * Matrix.translate\n [ method ]\n **\n * Translate the matrix\n - x (number) horizontal offset distance\n - y (number) vertical offset distance\n \\*/\n matrixproto.translate = function (x, y) {\n this.e += x * this.a + y * this.c;\n this.f += x * this.b + y * this.d;\n return this;\n };\n /*\\\n * Matrix.scale\n [ method ]\n **\n * Scales the matrix\n - x (number) amount to be scaled, with `1` resulting in no change\n - y (number) #optional amount to scale along the vertical axis. (Otherwise `x` applies to both axes.)\n - cx (number) #optional horizontal origin point from which to scale\n - cy (number) #optional vertical origin point from which to scale\n * Default cx, cy is the middle point of the element.\n \\*/\n matrixproto.scale = function (x, y, cx, cy) {\n y == null && (y = x);\n (cx || cy) && this.translate(cx, cy);\n this.a *= x;\n this.b *= x;\n this.c *= y;\n this.d *= y;\n (cx || cy) && this.translate(-cx, -cy);\n return this;\n };\n /*\\\n * Matrix.rotate\n [ method ]\n **\n * Rotates the matrix\n - a (number) angle of rotation, in degrees\n - x (number) horizontal origin point from which to rotate\n - y (number) vertical origin point from which to rotate\n \\*/\n matrixproto.rotate = function (a, x, y) {\n a = Snap.rad(a);\n x = x || 0;\n y = y || 0;\n var cos = +math.cos(a).toFixed(9),\n sin = +math.sin(a).toFixed(9);\n this.add(cos, sin, -sin, cos, x, y);\n return this.add(1, 0, 0, 1, -x, -y);\n };\n /*\\\n * Matrix.skewX\n [ method ]\n **\n * Skews the matrix along the x-axis\n - x (number) Angle to skew along the x-axis (in degrees).\n \\*/\n matrixproto.skewX = function (x) {\n return this.skew(x, 0);\n };\n /*\\\n * Matrix.skewY\n [ method ]\n **\n * Skews the matrix along the y-axis\n - y (number) Angle to skew along the y-axis (in degrees).\n \\*/\n matrixproto.skewY = function (y) {\n return this.skew(0, y);\n };\n /*\\\n * Matrix.skew\n [ method ]\n **\n * Skews the matrix\n - y (number) Angle to skew along the y-axis (in degrees).\n - x (number) Angle to skew along the x-axis (in degrees).\n \\*/\n matrixproto.skew = function (x, y) {\n x = x || 0;\n y = y || 0;\n x = Snap.rad(x);\n y = Snap.rad(y);\n var c = math.tan(x).toFixed(9);\n var b = math.tan(y).toFixed(9);\n return this.add(1, b, c, 1, 0, 0);\n };\n /*\\\n * Matrix.x\n [ method ]\n **\n * Returns x coordinate for given point after transformation described by the matrix. See also @Matrix.y\n - x (number)\n - y (number)\n = (number) x\n \\*/\n matrixproto.x = function (x, y) {\n return x * this.a + y * this.c + this.e;\n };\n /*\\\n * Matrix.y\n [ method ]\n **\n * Returns y coordinate for given point after transformation described by the matrix. See also @Matrix.x\n - x (number)\n - y (number)\n = (number) y\n \\*/\n matrixproto.y = function (x, y) {\n return x * this.b + y * this.d + this.f;\n };\n matrixproto.get = function (i) {\n return +this[Str.fromCharCode(97 + i)].toFixed(4);\n };\n matrixproto.toString = function () {\n return \"matrix(\" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)].join() + \")\";\n };\n matrixproto.offset = function () {\n return [this.e.toFixed(4), this.f.toFixed(4)];\n };\n function norm(a) {\n return a[0] * a[0] + a[1] * a[1];\n }\n function normalize(a) {\n var mag = math.sqrt(norm(a));\n a[0] && (a[0] /= mag);\n a[1] && (a[1] /= mag);\n }\n /*\\\n * Matrix.determinant\n [ method ]\n **\n * Finds determinant of the given matrix.\n = (number) determinant\n \\*/\n matrixproto.determinant = function () {\n return this.a * this.d - this.b * this.c;\n };\n /*\\\n * Matrix.split\n [ method ]\n **\n * Splits matrix into primitive transformations\n = (object) in format:\n o dx (number) translation by x\n o dy (number) translation by y\n o scalex (number) scale by x\n o scaley (number) scale by y\n o shear (number) shear\n o rotate (number) rotation in deg\n o isSimple (boolean) could it be represented via simple transformations\n \\*/\n matrixproto.split = function () {\n var out = {};\n // translation\n out.dx = this.e;\n out.dy = this.f;\n\n // scale and shear\n var row = [[this.a, this.b], [this.c, this.d]];\n out.scalex = math.sqrt(norm(row[0]));\n normalize(row[0]);\n\n out.shear = row[0][0] * row[1][0] + row[0][1] * row[1][1];\n row[1] = [row[1][0] - row[0][0] * out.shear, row[1][1] - row[0][1] * out.shear];\n\n out.scaley = math.sqrt(norm(row[1]));\n normalize(row[1]);\n out.shear /= out.scaley;\n\n if (this.determinant() < 0) {\n out.scalex = -out.scalex;\n }\n\n // rotation\n var sin = row[0][1],\n cos = row[1][1];\n if (cos < 0) {\n out.rotate = Snap.deg(math.acos(cos));\n if (sin < 0) {\n out.rotate = 360 - out.rotate;\n }\n } else {\n out.rotate = Snap.deg(math.asin(sin));\n }\n\n out.isSimple = !+out.shear.toFixed(9) && (out.scalex.toFixed(9) == out.scaley.toFixed(9) || !out.rotate);\n out.isSuperSimple = !+out.shear.toFixed(9) && out.scalex.toFixed(9) == out.scaley.toFixed(9) && !out.rotate;\n out.noRotation = !+out.shear.toFixed(9) && !out.rotate;\n return out;\n };\n /*\\\n * Matrix.toTransformString\n [ method ]\n **\n * Returns transform string that represents given matrix\n = (string) transform string\n \\*/\n matrixproto.toTransformString = function (shorter) {\n var s = shorter || this.split();\n if (!+s.shear.toFixed(9)) {\n s.scalex = +s.scalex.toFixed(4);\n s.scaley = +s.scaley.toFixed(4);\n s.rotate = +s.rotate.toFixed(4);\n return (s.dx || s.dy ? \"t\" + [+s.dx.toFixed(4), +s.dy.toFixed(4)] : E) +\n (s.rotate ? \"r\" + [+s.rotate.toFixed(4), 0, 0] : E) +\n (s.scalex != 1 || s.scaley != 1 ? \"s\" + [s.scalex, s.scaley, 0, 0] : E);\n } else {\n return \"m\" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)];\n }\n };\n })(Matrix.prototype);\n /*\\\n * Snap.Matrix\n [ method ]\n **\n * Matrix constructor, extend on your own risk.\n * To create matrices use @Snap.matrix.\n \\*/\n Snap.Matrix = Matrix;\n /*\\\n * Snap.matrix\n [ method ]\n **\n * Utility method\n **\n * Returns a matrix based on the given parameters\n - a (number)\n - b (number)\n - c (number)\n - d (number)\n - e (number)\n - f (number)\n * or\n - svgMatrix (SVGMatrix)\n = (object) @Matrix\n \\*/\n Snap.matrix = function (a, b, c, d, e, f) {\n return new Matrix(a, b, c, d, e, f);\n };\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob, Fragment) {\n var has = \"hasOwnProperty\",\n make = Snap._.make,\n wrap = Snap._.wrap,\n is = Snap.is,\n getSomeDefs = Snap._.getSomeDefs,\n reURLValue = /^url\\((['\"]?)([^)]+)\\1\\)$/,\n $ = Snap._.$,\n URL = Snap.url,\n Str = String,\n separator = Snap._.separator,\n E = \"\";\n /*\\\n * Snap.deurl\n [ method ]\n **\n * Unwraps path from `\"url(<path>)\"`.\n - value (string) url path\n = (string) unwrapped path\n \\*/\n Snap.deurl = function (value) {\n var res = String(value).match(reURLValue);\n return res ? res[2] : value;\n }\n // Attributes event handlers\n eve.on(\"snap.util.attr.mask\", function (value) {\n if (value instanceof Element || value instanceof Fragment) {\n eve.stop();\n if (value instanceof Fragment && value.node.childNodes.length == 1) {\n value = value.node.firstChild;\n getSomeDefs(this).appendChild(value);\n value = wrap(value);\n }\n if (value.type == \"mask\") {\n var mask = value;\n } else {\n mask = make(\"mask\", getSomeDefs(this));\n mask.node.appendChild(value.node);\n }\n !mask.node.id && $(mask.node, {\n id: mask.id\n });\n $(this.node, {\n mask: URL(mask.id)\n });\n }\n });\n (function (clipIt) {\n eve.on(\"snap.util.attr.clip\", clipIt);\n eve.on(\"snap.util.attr.clip-path\", clipIt);\n eve.on(\"snap.util.attr.clipPath\", clipIt);\n }(function (value) {\n if (value instanceof Element || value instanceof Fragment) {\n eve.stop();\n var clip,\n node = value.node;\n while (node) {\n if (node.nodeName === \"clipPath\") {\n clip = new Element(node);\n break;\n }\n if (node.nodeName === \"svg\") {\n clip = undefined;\n break;\n }\n node = node.parentNode;\n }\n if (!clip) {\n clip = make(\"clipPath\", getSomeDefs(this));\n clip.node.appendChild(value.node);\n !clip.node.id && $(clip.node, {\n id: clip.id\n });\n }\n $(this.node, {\n \"clip-path\": URL(clip.node.id || clip.id)\n });\n }\n }));\n function fillStroke(name) {\n return function (value) {\n eve.stop();\n if (value instanceof Fragment && value.node.childNodes.length == 1 &&\n (value.node.firstChild.tagName == \"radialGradient\" ||\n value.node.firstChild.tagName == \"linearGradient\" ||\n value.node.firstChild.tagName == \"pattern\")) {\n value = value.node.firstChild;\n getSomeDefs(this).appendChild(value);\n value = wrap(value);\n }\n if (value instanceof Element) {\n if (value.type == \"radialGradient\" || value.type == \"linearGradient\"\n || value.type == \"pattern\") {\n if (!value.node.id) {\n $(value.node, {\n id: value.id\n });\n }\n var fill = URL(value.node.id);\n } else {\n fill = value.attr(name);\n }\n } else {\n fill = Snap.color(value);\n if (fill.error) {\n var grad = Snap(getSomeDefs(this).ownerSVGElement).gradient(value);\n if (grad) {\n if (!grad.node.id) {\n $(grad.node, {\n id: grad.id\n });\n }\n fill = URL(grad.node.id);\n } else {\n fill = value;\n }\n } else {\n fill = Str(fill);\n }\n }\n var attrs = {};\n attrs[name] = fill;\n $(this.node, attrs);\n this.node.style[name] = E;\n };\n }\n eve.on(\"snap.util.attr.fill\", fillStroke(\"fill\"));\n eve.on(\"snap.util.attr.stroke\", fillStroke(\"stroke\"));\n var gradrg = /^([lr])(?:\\(([^)]*)\\))?(.*)$/i;\n eve.on(\"snap.util.grad.parse\", function parseGrad(string) {\n string = Str(string);\n var tokens = string.match(gradrg);\n if (!tokens) {\n return null;\n }\n var type = tokens[1],\n params = tokens[2],\n stops = tokens[3];\n params = params.split(/\\s*,\\s*/).map(function (el) {\n return +el == el ? +el : el;\n });\n if (params.length == 1 && params[0] == 0) {\n params = [];\n }\n stops = stops.split(\"-\");\n stops = stops.map(function (el) {\n el = el.split(\":\");\n var out = {\n color: el[0]\n };\n if (el[1]) {\n out.offset = parseFloat(el[1]);\n }\n return out;\n });\n var len = stops.length,\n start = 0,\n j = 0;\n function seed(i, end) {\n var step = (end - start) / (i - j);\n for (var k = j; k < i; k++) {\n stops[k].offset = +(+start + step * (k - j)).toFixed(2);\n }\n j = i;\n start = end;\n }\n len--;\n for (var i = 0; i < len; i++) if (\"offset\" in stops[i]) {\n seed(i, stops[i].offset);\n }\n stops[len].offset = stops[len].offset || 100;\n seed(len, stops[len].offset);\n return {\n type: type,\n params: params,\n stops: stops\n };\n });\n\n eve.on(\"snap.util.attr.d\", function (value) {\n eve.stop();\n if (is(value, \"array\") && is(value[0], \"array\")) {\n value = Snap.path.toString.call(value);\n }\n value = Str(value);\n if (value.match(/[ruo]/i)) {\n value = Snap.path.toAbsolute(value);\n }\n $(this.node, {d: value});\n })(-1);\n eve.on(\"snap.util.attr.#text\", function (value) {\n eve.stop();\n value = Str(value);\n var txt = glob.doc.createTextNode(value);\n while (this.node.firstChild) {\n this.node.removeChild(this.node.firstChild);\n }\n this.node.appendChild(txt);\n })(-1);\n eve.on(\"snap.util.attr.path\", function (value) {\n eve.stop();\n this.attr({d: value});\n })(-1);\n eve.on(\"snap.util.attr.class\", function (value) {\n eve.stop();\n this.node.className.baseVal = value;\n })(-1);\n eve.on(\"snap.util.attr.viewBox\", function (value) {\n var vb;\n if (is(value, \"object\") && \"x\" in value) {\n vb = [value.x, value.y, value.width, value.height].join(\" \");\n } else if (is(value, \"array\")) {\n vb = value.join(\" \");\n } else {\n vb = value;\n }\n $(this.node, {\n viewBox: vb\n });\n eve.stop();\n })(-1);\n eve.on(\"snap.util.attr.transform\", function (value) {\n this.transform(value);\n eve.stop();\n })(-1);\n eve.on(\"snap.util.attr.r\", function (value) {\n if (this.type == \"rect\") {\n eve.stop();\n $(this.node, {\n rx: value,\n ry: value\n });\n }\n })(-1);\n eve.on(\"snap.util.attr.textpath\", function (value) {\n eve.stop();\n if (this.type == \"text\") {\n var id, tp, node;\n if (!value && this.textPath) {\n tp = this.textPath;\n while (tp.node.firstChild) {\n this.node.appendChild(tp.node.firstChild);\n }\n tp.remove();\n delete this.textPath;\n return;\n }\n if (is(value, \"string\")) {\n var defs = getSomeDefs(this),\n path = wrap(defs.parentNode).path(value);\n defs.appendChild(path.node);\n id = path.id;\n path.attr({id: id});\n } else {\n value = wrap(value);\n if (value instanceof Element) {\n id = value.attr(\"id\");\n if (!id) {\n id = value.id;\n value.attr({id: id});\n }\n }\n }\n if (id) {\n tp = this.textPath;\n node = this.node;\n if (tp) {\n tp.attr({\"xlink:href\": \"#\" + id});\n } else {\n tp = $(\"textPath\", {\n \"xlink:href\": \"#\" + id\n });\n while (node.firstChild) {\n tp.appendChild(node.firstChild);\n }\n node.appendChild(tp);\n this.textPath = wrap(tp);\n }\n }\n }\n })(-1);\n eve.on(\"snap.util.attr.text\", function (value) {\n if (this.type == \"text\") {\n var i = 0,\n node = this.node,\n tuner = function (chunk) {\n var out = $(\"tspan\");\n if (is(chunk, \"array\")) {\n for (var i = 0; i < chunk.length; i++) {\n out.appendChild(tuner(chunk[i]));\n }\n } else {\n out.appendChild(glob.doc.createTextNode(chunk));\n }\n out.normalize && out.normalize();\n return out;\n };\n while (node.firstChild) {\n node.removeChild(node.firstChild);\n }\n var tuned = tuner(value);\n while (tuned.firstChild) {\n node.appendChild(tuned.firstChild);\n }\n }\n eve.stop();\n })(-1);\n function setFontSize(value) {\n eve.stop();\n if (value == +value) {\n value += \"px\";\n }\n this.node.style.fontSize = value;\n }\n eve.on(\"snap.util.attr.fontSize\", setFontSize)(-1);\n eve.on(\"snap.util.attr.font-size\", setFontSize)(-1);\n\n\n eve.on(\"snap.util.getattr.transform\", function () {\n eve.stop();\n return this.transform();\n })(-1);\n eve.on(\"snap.util.getattr.textpath\", function () {\n eve.stop();\n return this.textPath;\n })(-1);\n // Markers\n (function () {\n function getter(end) {\n return function () {\n eve.stop();\n var style = glob.doc.defaultView.getComputedStyle(this.node, null).getPropertyValue(\"marker-\" + end);\n if (style == \"none\") {\n return style;\n } else {\n return Snap(glob.doc.getElementById(style.match(reURLValue)[1]));\n }\n };\n }\n function setter(end) {\n return function (value) {\n eve.stop();\n var name = \"marker\" + end.charAt(0).toUpperCase() + end.substring(1);\n if (value == \"\" || !value) {\n this.node.style[name] = \"none\";\n return;\n }\n if (value.type == \"marker\") {\n var id = value.node.id;\n if (!id) {\n $(value.node, {id: value.id});\n }\n this.node.style[name] = URL(id);\n return;\n }\n };\n }\n eve.on(\"snap.util.getattr.marker-end\", getter(\"end\"))(-1);\n eve.on(\"snap.util.getattr.markerEnd\", getter(\"end\"))(-1);\n eve.on(\"snap.util.getattr.marker-start\", getter(\"start\"))(-1);\n eve.on(\"snap.util.getattr.markerStart\", getter(\"start\"))(-1);\n eve.on(\"snap.util.getattr.marker-mid\", getter(\"mid\"))(-1);\n eve.on(\"snap.util.getattr.markerMid\", getter(\"mid\"))(-1);\n eve.on(\"snap.util.attr.marker-end\", setter(\"end\"))(-1);\n eve.on(\"snap.util.attr.markerEnd\", setter(\"end\"))(-1);\n eve.on(\"snap.util.attr.marker-start\", setter(\"start\"))(-1);\n eve.on(\"snap.util.attr.markerStart\", setter(\"start\"))(-1);\n eve.on(\"snap.util.attr.marker-mid\", setter(\"mid\"))(-1);\n eve.on(\"snap.util.attr.markerMid\", setter(\"mid\"))(-1);\n }());\n eve.on(\"snap.util.getattr.r\", function () {\n if (this.type == \"rect\" && $(this.node, \"rx\") == $(this.node, \"ry\")) {\n eve.stop();\n return $(this.node, \"rx\");\n }\n })(-1);\n function textExtract(node) {\n var out = [];\n var children = node.childNodes;\n for (var i = 0, ii = children.length; i < ii; i++) {\n var chi = children[i];\n if (chi.nodeType == 3) {\n out.push(chi.nodeValue);\n }\n if (chi.tagName == \"tspan\") {\n if (chi.childNodes.length == 1 && chi.firstChild.nodeType == 3) {\n out.push(chi.firstChild.nodeValue);\n } else {\n out.push(textExtract(chi));\n }\n }\n }\n return out;\n }\n eve.on(\"snap.util.getattr.text\", function () {\n if (this.type == \"text\" || this.type == \"tspan\") {\n eve.stop();\n var out = textExtract(this.node);\n return out.length == 1 ? out[0] : out;\n }\n })(-1);\n eve.on(\"snap.util.getattr.#text\", function () {\n return this.node.textContent;\n })(-1);\n eve.on(\"snap.util.getattr.fill\", function (internal) {\n if (internal) {\n return;\n }\n eve.stop();\n var value = eve(\"snap.util.getattr.fill\", this, true).firstDefined();\n return Snap(Snap.deurl(value)) || value;\n })(-1);\n eve.on(\"snap.util.getattr.stroke\", function (internal) {\n if (internal) {\n return;\n }\n eve.stop();\n var value = eve(\"snap.util.getattr.stroke\", this, true).firstDefined();\n return Snap(Snap.deurl(value)) || value;\n })(-1);\n eve.on(\"snap.util.getattr.viewBox\", function () {\n eve.stop();\n var vb = $(this.node, \"viewBox\");\n if (vb) {\n vb = vb.split(separator);\n return Snap._.box(+vb[0], +vb[1], +vb[2], +vb[3]);\n } else {\n return;\n }\n })(-1);\n eve.on(\"snap.util.getattr.points\", function () {\n var p = $(this.node, \"points\");\n eve.stop();\n if (p) {\n return p.split(separator);\n } else {\n return;\n }\n })(-1);\n eve.on(\"snap.util.getattr.path\", function () {\n var p = $(this.node, \"d\");\n eve.stop();\n return p;\n })(-1);\n eve.on(\"snap.util.getattr.class\", function () {\n return this.node.className.baseVal;\n })(-1);\n function getFontSize() {\n eve.stop();\n return this.node.style.fontSize;\n }\n eve.on(\"snap.util.getattr.fontSize\", getFontSize)(-1);\n eve.on(\"snap.util.getattr.font-size\", getFontSize)(-1);\n});\n\n// Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob, Fragment) {\n var rgNotSpace = /\\S+/g,\n rgBadSpace = /[\\t\\r\\n\\f]/g,\n rgTrim = /(^\\s+|\\s+$)/g,\n Str = String,\n elproto = Element.prototype;\n /*\\\n * Element.addClass\n [ method ]\n **\n * Adds given class name or list of class names to the element.\n - value (string) class name or space separated list of class names\n **\n = (Element) original element.\n \\*/\n elproto.addClass = function (value) {\n var classes = Str(value || \"\").match(rgNotSpace) || [],\n elem = this.node,\n className = elem.className.baseVal,\n curClasses = className.match(rgNotSpace) || [],\n j,\n pos,\n clazz,\n finalValue;\n\n if (classes.length) {\n j = 0;\n while (clazz = classes[j++]) {\n pos = curClasses.indexOf(clazz);\n if (!~pos) {\n curClasses.push(clazz);\n }\n }\n\n finalValue = curClasses.join(\" \");\n if (className != finalValue) {\n elem.className.baseVal = finalValue;\n }\n }\n return this;\n };\n /*\\\n * Element.removeClass\n [ method ]\n **\n * Removes given class name or list of class names from the element.\n - value (string) class name or space separated list of class names\n **\n = (Element) original element.\n \\*/\n elproto.removeClass = function (value) {\n var classes = Str(value || \"\").match(rgNotSpace) || [],\n elem = this.node,\n className = elem.className.baseVal,\n curClasses = className.match(rgNotSpace) || [],\n j,\n pos,\n clazz,\n finalValue;\n if (curClasses.length) {\n j = 0;\n while (clazz = classes[j++]) {\n pos = curClasses.indexOf(clazz);\n if (~pos) {\n curClasses.splice(pos, 1);\n }\n }\n\n finalValue = curClasses.join(\" \");\n if (className != finalValue) {\n elem.className.baseVal = finalValue;\n }\n }\n return this;\n };\n /*\\\n * Element.hasClass\n [ method ]\n **\n * Checks if the element has a given class name in the list of class names applied to it.\n - value (string) class name\n **\n = (boolean) `true` if the element has given class\n \\*/\n elproto.hasClass = function (value) {\n var elem = this.node,\n className = elem.className.baseVal,\n curClasses = className.match(rgNotSpace) || [];\n return !!~curClasses.indexOf(value);\n };\n /*\\\n * Element.toggleClass\n [ method ]\n **\n * Add or remove one or more classes from the element, depending on either\n * the class’s presence or the value of the `flag` argument.\n - value (string) class name or space separated list of class names\n - flag (boolean) value to determine whether the class should be added or removed\n **\n = (Element) original element.\n \\*/\n elproto.toggleClass = function (value, flag) {\n if (flag != null) {\n if (flag) {\n return this.addClass(value);\n } else {\n return this.removeClass(value);\n }\n }\n var classes = (value || \"\").match(rgNotSpace) || [],\n elem = this.node,\n className = elem.className.baseVal,\n curClasses = className.match(rgNotSpace) || [],\n j,\n pos,\n clazz,\n finalValue;\n j = 0;\n while (clazz = classes[j++]) {\n pos = curClasses.indexOf(clazz);\n if (~pos) {\n curClasses.splice(pos, 1);\n } else {\n curClasses.push(clazz);\n }\n }\n\n finalValue = curClasses.join(\" \");\n if (className != finalValue) {\n elem.className.baseVal = finalValue;\n }\n return this;\n };\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob, Fragment) {\n var operators = {\n \"+\": function (x, y) {\n return x + y;\n },\n \"-\": function (x, y) {\n return x - y;\n },\n \"/\": function (x, y) {\n return x / y;\n },\n \"*\": function (x, y) {\n return x * y;\n }\n },\n Str = String,\n reUnit = /[a-z]+$/i,\n reAddon = /^\\s*([+\\-\\/*])\\s*=\\s*([\\d.eE+\\-]+)\\s*([^\\d\\s]+)?\\s*$/;\n function getNumber(val) {\n return val;\n }\n function getUnit(unit) {\n return function (val) {\n return +val.toFixed(3) + unit;\n };\n }\n eve.on(\"snap.util.attr\", function (val) {\n var plus = Str(val).match(reAddon);\n if (plus) {\n var evnt = eve.nt(),\n name = evnt.substring(evnt.lastIndexOf(\".\") + 1),\n a = this.attr(name),\n atr = {};\n eve.stop();\n var unit = plus[3] || \"\",\n aUnit = a.match(reUnit),\n op = operators[plus[1]];\n if (aUnit && aUnit == unit) {\n val = op(parseFloat(a), +plus[2]);\n } else {\n a = this.asPX(name);\n val = op(this.asPX(name), this.asPX(name, plus[2] + unit));\n }\n if (isNaN(a) || isNaN(val)) {\n return;\n }\n atr[name] = val;\n this.attr(atr);\n }\n })(-10);\n eve.on(\"snap.util.equal\", function (name, b) {\n var A, B, a = Str(this.attr(name) || \"\"),\n el = this,\n bplus = Str(b).match(reAddon);\n if (bplus) {\n eve.stop();\n var unit = bplus[3] || \"\",\n aUnit = a.match(reUnit),\n op = operators[bplus[1]];\n if (aUnit && aUnit == unit) {\n return {\n from: parseFloat(a),\n to: op(parseFloat(a), +bplus[2]),\n f: getUnit(aUnit)\n };\n } else {\n a = this.asPX(name);\n return {\n from: a,\n to: op(a, this.asPX(name, bplus[2] + unit)),\n f: getNumber\n };\n }\n }\n })(-10);\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob, Fragment) {\n var proto = Paper.prototype,\n is = Snap.is;\n /*\\\n * Paper.rect\n [ method ]\n *\n * Draws a rectangle\n **\n - x (number) x coordinate of the top left corner\n - y (number) y coordinate of the top left corner\n - width (number) width\n - height (number) height\n - rx (number) #optional horizontal radius for rounded corners, default is 0\n - ry (number) #optional vertical radius for rounded corners, default is rx or 0\n = (object) the `rect` element\n **\n > Usage\n | // regular rectangle\n | var c = paper.rect(10, 10, 50, 50);\n | // rectangle with rounded corners\n | var c = paper.rect(40, 40, 50, 50, 10);\n \\*/\n proto.rect = function (x, y, w, h, rx, ry) {\n var attr;\n if (ry == null) {\n ry = rx;\n }\n if (is(x, \"object\") && x == \"[object Object]\") {\n attr = x;\n } else if (x != null) {\n attr = {\n x: x,\n y: y,\n width: w,\n height: h\n };\n if (rx != null) {\n attr.rx = rx;\n attr.ry = ry;\n }\n }\n return this.el(\"rect\", attr);\n };\n /*\\\n * Paper.circle\n [ method ]\n **\n * Draws a circle\n **\n - x (number) x coordinate of the centre\n - y (number) y coordinate of the centre\n - r (number) radius\n = (object) the `circle` element\n **\n > Usage\n | var c = paper.circle(50, 50, 40);\n \\*/\n proto.circle = function (cx, cy, r) {\n var attr;\n if (is(cx, \"object\") && cx == \"[object Object]\") {\n attr = cx;\n } else if (cx != null) {\n attr = {\n cx: cx,\n cy: cy,\n r: r\n };\n }\n return this.el(\"circle\", attr);\n };\n\n var preload = (function () {\n function onerror() {\n this.parentNode.removeChild(this);\n }\n return function (src, f) {\n var img = glob.doc.createElement(\"img\"),\n body = glob.doc.body;\n img.style.cssText = \"position:absolute;left:-9999em;top:-9999em\";\n img.onload = function () {\n f.call(img);\n img.onload = img.onerror = null;\n body.removeChild(img);\n };\n img.onerror = onerror;\n body.appendChild(img);\n img.src = src;\n };\n }());\n\n /*\\\n * Paper.image\n [ method ]\n **\n * Places an image on the surface\n **\n - src (string) URI of the source image\n - x (number) x offset position\n - y (number) y offset position\n - width (number) width of the image\n - height (number) height of the image\n = (object) the `image` element\n * or\n = (object) Snap element object with type `image`\n **\n > Usage\n | var c = paper.image(\"apple.png\", 10, 10, 80, 80);\n \\*/\n proto.image = function (src, x, y, width, height) {\n var el = this.el(\"image\");\n if (is(src, \"object\") && \"src\" in src) {\n el.attr(src);\n } else if (src != null) {\n var set = {\n \"xlink:href\": src,\n preserveAspectRatio: \"none\"\n };\n if (x != null && y != null) {\n set.x = x;\n set.y = y;\n }\n if (width != null && height != null) {\n set.width = width;\n set.height = height;\n } else {\n preload(src, function () {\n Snap._.$(el.node, {\n width: this.offsetWidth,\n height: this.offsetHeight\n });\n });\n }\n Snap._.$(el.node, set);\n }\n return el;\n };\n /*\\\n * Paper.ellipse\n [ method ]\n **\n * Draws an ellipse\n **\n - x (number) x coordinate of the centre\n - y (number) y coordinate of the centre\n - rx (number) horizontal radius\n - ry (number) vertical radius\n = (object) the `ellipse` element\n **\n > Usage\n | var c = paper.ellipse(50, 50, 40, 20);\n \\*/\n proto.ellipse = function (cx, cy, rx, ry) {\n var attr;\n if (is(cx, \"object\") && cx == \"[object Object]\") {\n attr = cx;\n } else if (cx != null) {\n attr ={\n cx: cx,\n cy: cy,\n rx: rx,\n ry: ry\n };\n }\n return this.el(\"ellipse\", attr);\n };\n // SIERRA Paper.path(): Unclear from the link what a Catmull-Rom curveto is, and why it would make life any easier.\n /*\\\n * Paper.path\n [ method ]\n **\n * Creates a `<path>` element using the given string as the path's definition\n - pathString (string) #optional path string in SVG format\n * Path string consists of one-letter commands, followed by comma seprarated arguments in numerical form. Example:\n | \"M10,20L30,40\"\n * This example features two commands: `M`, with arguments `(10, 20)` and `L` with arguments `(30, 40)`. Uppercase letter commands express coordinates in absolute terms, while lowercase commands express them in relative terms from the most recently declared coordinates.\n *\n # <p>Here is short list of commands available, for more details see <a href=\"http://www.w3.org/TR/SVG/paths.html#PathData\" title=\"Details of a path's data attribute's format are described in the SVG specification.\">SVG path string format</a> or <a href=\"https://developer.mozilla.org/en/SVG/Tutorial/Paths\">article about path strings at MDN</a>.</p>\n # <table><thead><tr><th>Command</th><th>Name</th><th>Parameters</th></tr></thead><tbody>\n # <tr><td>M</td><td>moveto</td><td>(x y)+</td></tr>\n # <tr><td>Z</td><td>closepath</td><td>(none)</td></tr>\n # <tr><td>L</td><td>lineto</td><td>(x y)+</td></tr>\n # <tr><td>H</td><td>horizontal lineto</td><td>x+</td></tr>\n # <tr><td>V</td><td>vertical lineto</td><td>y+</td></tr>\n # <tr><td>C</td><td>curveto</td><td>(x1 y1 x2 y2 x y)+</td></tr>\n # <tr><td>S</td><td>smooth curveto</td><td>(x2 y2 x y)+</td></tr>\n # <tr><td>Q</td><td>quadratic Bézier curveto</td><td>(x1 y1 x y)+</td></tr>\n # <tr><td>T</td><td>smooth quadratic Bézier curveto</td><td>(x y)+</td></tr>\n # <tr><td>A</td><td>elliptical arc</td><td>(rx ry x-axis-rotation large-arc-flag sweep-flag x y)+</td></tr>\n # <tr><td>R</td><td><a href=\"http://en.wikipedia.org/wiki/Catmull–Rom_spline#Catmull.E2.80.93Rom_spline\">Catmull-Rom curveto</a>*</td><td>x1 y1 (x y)+</td></tr></tbody></table>\n * * _Catmull-Rom curveto_ is a not standard SVG command and added to make life easier.\n * Note: there is a special case when a path consists of only three commands: `M10,10R…z`. In this case the path connects back to its starting point.\n > Usage\n | var c = paper.path(\"M10 10L90 90\");\n | // draw a diagonal line:\n | // move to 10,10, line to 90,90\n \\*/\n proto.path = function (d) {\n var attr;\n if (is(d, \"object\") && !is(d, \"array\")) {\n attr = d;\n } else if (d) {\n attr = {d: d};\n }\n return this.el(\"path\", attr);\n };\n /*\\\n * Paper.g\n [ method ]\n **\n * Creates a group element\n **\n - varargs (…) #optional elements to nest within the group\n = (object) the `g` element\n **\n > Usage\n | var c1 = paper.circle(),\n | c2 = paper.rect(),\n | g = paper.g(c2, c1); // note that the order of elements is different\n * or\n | var c1 = paper.circle(),\n | c2 = paper.rect(),\n | g = paper.g();\n | g.add(c2, c1);\n \\*/\n /*\\\n * Paper.group\n [ method ]\n **\n * See @Paper.g\n \\*/\n proto.group = proto.g = function (first) {\n var attr,\n el = this.el(\"g\");\n if (arguments.length == 1 && first && !first.type) {\n el.attr(first);\n } else if (arguments.length) {\n el.add(Array.prototype.slice.call(arguments, 0));\n }\n return el;\n };\n /*\\\n * Paper.svg\n [ method ]\n **\n * Creates a nested SVG element.\n - x (number) @optional X of the element\n - y (number) @optional Y of the element\n - width (number) @optional width of the element\n - height (number) @optional height of the element\n - vbx (number) @optional viewbox X\n - vby (number) @optional viewbox Y\n - vbw (number) @optional viewbox width\n - vbh (number) @optional viewbox height\n **\n = (object) the `svg` element\n **\n \\*/\n proto.svg = function (x, y, width, height, vbx, vby, vbw, vbh) {\n var attrs = {};\n if (is(x, \"object\") && y == null) {\n attrs = x;\n } else {\n if (x != null) {\n attrs.x = x;\n }\n if (y != null) {\n attrs.y = y;\n }\n if (width != null) {\n attrs.width = width;\n }\n if (height != null) {\n attrs.height = height;\n }\n if (vbx != null && vby != null && vbw != null && vbh != null) {\n attrs.viewBox = [vbx, vby, vbw, vbh];\n }\n }\n return this.el(\"svg\", attrs);\n };\n /*\\\n * Paper.mask\n [ method ]\n **\n * Equivalent in behaviour to @Paper.g, except it’s a mask.\n **\n = (object) the `mask` element\n **\n \\*/\n proto.mask = function (first) {\n var attr,\n el = this.el(\"mask\");\n if (arguments.length == 1 && first && !first.type) {\n el.attr(first);\n } else if (arguments.length) {\n el.add(Array.prototype.slice.call(arguments, 0));\n }\n return el;\n };\n /*\\\n * Paper.ptrn\n [ method ]\n **\n * Equivalent in behaviour to @Paper.g, except it’s a pattern.\n - x (number) @optional X of the element\n - y (number) @optional Y of the element\n - width (number) @optional width of the element\n - height (number) @optional height of the element\n - vbx (number) @optional viewbox X\n - vby (number) @optional viewbox Y\n - vbw (number) @optional viewbox width\n - vbh (number) @optional viewbox height\n **\n = (object) the `pattern` element\n **\n \\*/\n proto.ptrn = function (x, y, width, height, vx, vy, vw, vh) {\n if (is(x, \"object\")) {\n var attr = x;\n } else {\n attr = {patternUnits: \"userSpaceOnUse\"};\n if (x) {\n attr.x = x;\n }\n if (y) {\n attr.y = y;\n }\n if (width != null) {\n attr.width = width;\n }\n if (height != null) {\n attr.height = height;\n }\n if (vx != null && vy != null && vw != null && vh != null) {\n attr.viewBox = [vx, vy, vw, vh];\n } else {\n attr.viewBox = [x || 0, y || 0, width || 0, height || 0];\n }\n }\n return this.el(\"pattern\", attr);\n };\n /*\\\n * Paper.use\n [ method ]\n **\n * Creates a <use> element.\n - id (string) @optional id of element to link\n * or\n - id (Element) @optional element to link\n **\n = (object) the `use` element\n **\n \\*/\n proto.use = function (id) {\n if (id != null) {\n if (id instanceof Element) {\n if (!id.attr(\"id\")) {\n id.attr({id: Snap._.id(id)});\n }\n id = id.attr(\"id\");\n }\n if (String(id).charAt() == \"#\") {\n id = id.substring(1);\n }\n return this.el(\"use\", {\"xlink:href\": \"#\" + id});\n } else {\n return Element.prototype.use.call(this);\n }\n };\n /*\\\n * Paper.symbol\n [ method ]\n **\n * Creates a <symbol> element.\n - vbx (number) @optional viewbox X\n - vby (number) @optional viewbox Y\n - vbw (number) @optional viewbox width\n - vbh (number) @optional viewbox height\n = (object) the `symbol` element\n **\n \\*/\n proto.symbol = function (vx, vy, vw, vh) {\n var attr = {};\n if (vx != null && vy != null && vw != null && vh != null) {\n attr.viewBox = [vx, vy, vw, vh];\n }\n\n return this.el(\"symbol\", attr);\n };\n /*\\\n * Paper.text\n [ method ]\n **\n * Draws a text string\n **\n - x (number) x coordinate position\n - y (number) y coordinate position\n - text (string|array) The text string to draw or array of strings to nest within separate `<tspan>` elements\n = (object) the `text` element\n **\n > Usage\n | var t1 = paper.text(50, 50, \"Snap\");\n | var t2 = paper.text(50, 50, [\"S\",\"n\",\"a\",\"p\"]);\n | // Text path usage\n | t1.attr({textpath: \"M10,10L100,100\"});\n | // or\n | var pth = paper.path(\"M10,10L100,100\");\n | t1.attr({textpath: pth});\n \\*/\n proto.text = function (x, y, text) {\n var attr = {};\n if (is(x, \"object\")) {\n attr = x;\n } else if (x != null) {\n attr = {\n x: x,\n y: y,\n text: text || \"\"\n };\n }\n return this.el(\"text\", attr);\n };\n /*\\\n * Paper.line\n [ method ]\n **\n * Draws a line\n **\n - x1 (number) x coordinate position of the start\n - y1 (number) y coordinate position of the start\n - x2 (number) x coordinate position of the end\n - y2 (number) y coordinate position of the end\n = (object) the `line` element\n **\n > Usage\n | var t1 = paper.line(50, 50, 100, 100);\n \\*/\n proto.line = function (x1, y1, x2, y2) {\n var attr = {};\n if (is(x1, \"object\")) {\n attr = x1;\n } else if (x1 != null) {\n attr = {\n x1: x1,\n x2: x2,\n y1: y1,\n y2: y2\n };\n }\n return this.el(\"line\", attr);\n };\n /*\\\n * Paper.polyline\n [ method ]\n **\n * Draws a polyline\n **\n - points (array) array of points\n * or\n - varargs (…) points\n = (object) the `polyline` element\n **\n > Usage\n | var p1 = paper.polyline([10, 10, 100, 100]);\n | var p2 = paper.polyline(10, 10, 100, 100);\n \\*/\n proto.polyline = function (points) {\n if (arguments.length > 1) {\n points = Array.prototype.slice.call(arguments, 0);\n }\n var attr = {};\n if (is(points, \"object\") && !is(points, \"array\")) {\n attr = points;\n } else if (points != null) {\n attr = {points: points};\n }\n return this.el(\"polyline\", attr);\n };\n /*\\\n * Paper.polygon\n [ method ]\n **\n * Draws a polygon. See @Paper.polyline\n \\*/\n proto.polygon = function (points) {\n if (arguments.length > 1) {\n points = Array.prototype.slice.call(arguments, 0);\n }\n var attr = {};\n if (is(points, \"object\") && !is(points, \"array\")) {\n attr = points;\n } else if (points != null) {\n attr = {points: points};\n }\n return this.el(\"polygon\", attr);\n };\n // gradients\n (function () {\n var $ = Snap._.$;\n // gradients' helpers\n /*\\\n * Element.stops\n [ method ]\n **\n * Only for gradients!\n * Returns array of gradient stops elements.\n = (array) the stops array.\n \\*/\n function Gstops() {\n return this.selectAll(\"stop\");\n }\n /*\\\n * Element.addStop\n [ method ]\n **\n * Only for gradients!\n * Adds another stop to the gradient.\n - color (string) stops color\n - offset (number) stops offset 0..100\n = (object) gradient element\n \\*/\n function GaddStop(color, offset) {\n var stop = $(\"stop\"),\n attr = {\n offset: +offset + \"%\"\n };\n color = Snap.color(color);\n attr[\"stop-color\"] = color.hex;\n if (color.opacity < 1) {\n attr[\"stop-opacity\"] = color.opacity;\n }\n $(stop, attr);\n var stops = this.stops(),\n inserted;\n for (var i = 0; i < stops.length; i++) {\n var stopOffset = parseFloat(stops[i].attr(\"offset\"));\n if (stopOffset > offset) {\n this.node.insertBefore(stop, stops[i].node);\n inserted = true;\n break;\n }\n }\n if (!inserted) {\n this.node.appendChild(stop);\n }\n return this;\n }\n function GgetBBox() {\n if (this.type == \"linearGradient\") {\n var x1 = $(this.node, \"x1\") || 0,\n x2 = $(this.node, \"x2\") || 1,\n y1 = $(this.node, \"y1\") || 0,\n y2 = $(this.node, \"y2\") || 0;\n return Snap._.box(x1, y1, math.abs(x2 - x1), math.abs(y2 - y1));\n } else {\n var cx = this.node.cx || .5,\n cy = this.node.cy || .5,\n r = this.node.r || 0;\n return Snap._.box(cx - r, cy - r, r * 2, r * 2);\n }\n }\n /*\\\n * Element.setStops\n [ method ]\n **\n * Only for gradients!\n * Updates stops of the gradient based on passed gradient descriptor. See @Ppaer.gradient\n - str (string) gradient descriptor part after `()`.\n = (object) gradient element\n | var g = paper.gradient(\"l(0, 0, 1, 1)#000-#f00-#fff\");\n | g.setStops(\"#fff-#000-#f00-#fc0\");\n \\*/\n function GsetStops(str) {\n var grad = str,\n stops = this.stops();\n if (typeof str == \"string\") {\n grad = eve(\"snap.util.grad.parse\", null, \"l(0,0,0,1)\" + str).firstDefined().stops;\n }\n if (!Snap.is(grad, \"array\")) {\n return;\n }\n for (var i = 0; i < stops.length; i++) {\n if (grad[i]) {\n var color = Snap.color(grad[i].color),\n attr = {\"offset\": grad[i].offset + \"%\"};\n attr[\"stop-color\"] = color.hex;\n if (color.opacity < 1) {\n attr[\"stop-opacity\"] = color.opacity;\n }\n stops[i].attr(attr);\n } else {\n stops[i].remove();\n }\n }\n for (i = stops.length; i < grad.length; i++) {\n this.addStop(grad[i].color, grad[i].offset);\n }\n return this;\n }\n function gradient(defs, str) {\n var grad = eve(\"snap.util.grad.parse\", null, str).firstDefined(),\n el;\n if (!grad) {\n return null;\n }\n grad.params.unshift(defs);\n if (grad.type.toLowerCase() == \"l\") {\n el = gradientLinear.apply(0, grad.params);\n } else {\n el = gradientRadial.apply(0, grad.params);\n }\n if (grad.type != grad.type.toLowerCase()) {\n $(el.node, {\n gradientUnits: \"userSpaceOnUse\"\n });\n }\n var stops = grad.stops,\n len = stops.length;\n for (var i = 0; i < len; i++) {\n var stop = stops[i];\n el.addStop(stop.color, stop.offset);\n }\n return el;\n }\n function gradientLinear(defs, x1, y1, x2, y2) {\n var el = Snap._.make(\"linearGradient\", defs);\n el.stops = Gstops;\n el.addStop = GaddStop;\n el.getBBox = GgetBBox;\n el.setStops = GsetStops;\n if (x1 != null) {\n $(el.node, {\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2\n });\n }\n return el;\n }\n function gradientRadial(defs, cx, cy, r, fx, fy) {\n var el = Snap._.make(\"radialGradient\", defs);\n el.stops = Gstops;\n el.addStop = GaddStop;\n el.getBBox = GgetBBox;\n if (cx != null) {\n $(el.node, {\n cx: cx,\n cy: cy,\n r: r\n });\n }\n if (fx != null && fy != null) {\n $(el.node, {\n fx: fx,\n fy: fy\n });\n }\n return el;\n }\n /*\\\n * Paper.gradient\n [ method ]\n **\n * Creates a gradient element\n **\n - gradient (string) gradient descriptor\n > Gradient Descriptor\n * The gradient descriptor is an expression formatted as\n * follows: `<type>(<coords>)<colors>`. The `<type>` can be\n * either linear or radial. The uppercase `L` or `R` letters\n * indicate absolute coordinates offset from the SVG surface.\n * Lowercase `l` or `r` letters indicate coordinates\n * calculated relative to the element to which the gradient is\n * applied. Coordinates specify a linear gradient vector as\n * `x1`, `y1`, `x2`, `y2`, or a radial gradient as `cx`, `cy`,\n * `r` and optional `fx`, `fy` specifying a focal point away\n * from the center of the circle. Specify `<colors>` as a list\n * of dash-separated CSS color values. Each color may be\n * followed by a custom offset value, separated with a colon\n * character.\n > Examples\n * Linear gradient, relative from top-left corner to bottom-right\n * corner, from black through red to white:\n | var g = paper.gradient(\"l(0, 0, 1, 1)#000-#f00-#fff\");\n * Linear gradient, absolute from (0, 0) to (100, 100), from black\n * through red at 25% to white:\n | var g = paper.gradient(\"L(0, 0, 100, 100)#000-#f00:25-#fff\");\n * Radial gradient, relative from the center of the element with radius\n * half the width, from black to white:\n | var g = paper.gradient(\"r(0.5, 0.5, 0.5)#000-#fff\");\n * To apply the gradient:\n | paper.circle(50, 50, 40).attr({\n | fill: g\n | });\n = (object) the `gradient` element\n \\*/\n proto.gradient = function (str) {\n return gradient(this.defs, str);\n };\n proto.gradientLinear = function (x1, y1, x2, y2) {\n return gradientLinear(this.defs, x1, y1, x2, y2);\n };\n proto.gradientRadial = function (cx, cy, r, fx, fy) {\n return gradientRadial(this.defs, cx, cy, r, fx, fy);\n };\n /*\\\n * Paper.toString\n [ method ]\n **\n * Returns SVG code for the @Paper\n = (string) SVG code for the @Paper\n \\*/\n proto.toString = function () {\n var doc = this.node.ownerDocument,\n f = doc.createDocumentFragment(),\n d = doc.createElement(\"div\"),\n svg = this.node.cloneNode(true),\n res;\n f.appendChild(d);\n d.appendChild(svg);\n Snap._.$(svg, {xmlns: \"http://www.w3.org/2000/svg\"});\n res = d.innerHTML;\n f.removeChild(f.firstChild);\n return res;\n };\n /*\\\n * Paper.toDataURL\n [ method ]\n **\n * Returns SVG code for the @Paper as Data URI string.\n = (string) Data URI string\n \\*/\n proto.toDataURL = function () {\n if (window && window.btoa) {\n return \"data:image/svg+xml;base64,\" + btoa(unescape(encodeURIComponent(this)));\n }\n };\n /*\\\n * Paper.clear\n [ method ]\n **\n * Removes all child nodes of the paper, except <defs>.\n \\*/\n proto.clear = function () {\n var node = this.node.firstChild,\n next;\n while (node) {\n next = node.nextSibling;\n if (node.tagName != \"defs\") {\n node.parentNode.removeChild(node);\n } else {\n proto.clear.call({node: node});\n }\n node = next;\n }\n };\n }());\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob) {\n var elproto = Element.prototype,\n is = Snap.is,\n clone = Snap._.clone,\n has = \"hasOwnProperty\",\n p2s = /,?([a-z]),?/gi,\n toFloat = parseFloat,\n math = Math,\n PI = math.PI,\n mmin = math.min,\n mmax = math.max,\n pow = math.pow,\n abs = math.abs;\n function paths(ps) {\n var p = paths.ps = paths.ps || {};\n if (p[ps]) {\n p[ps].sleep = 100;\n } else {\n p[ps] = {\n sleep: 100\n };\n }\n setTimeout(function () {\n for (var key in p) if (p[has](key) && key != ps) {\n p[key].sleep--;\n !p[key].sleep && delete p[key];\n }\n });\n return p[ps];\n }\n function box(x, y, width, height) {\n if (x == null) {\n x = y = width = height = 0;\n }\n if (y == null) {\n y = x.y;\n width = x.width;\n height = x.height;\n x = x.x;\n }\n return {\n x: x,\n y: y,\n width: width,\n w: width,\n height: height,\n h: height,\n x2: x + width,\n y2: y + height,\n cx: x + width / 2,\n cy: y + height / 2,\n r1: math.min(width, height) / 2,\n r2: math.max(width, height) / 2,\n r0: math.sqrt(width * width + height * height) / 2,\n path: rectPath(x, y, width, height),\n vb: [x, y, width, height].join(\" \")\n };\n }\n function toString() {\n return this.join(\",\").replace(p2s, \"$1\");\n }\n function pathClone(pathArray) {\n var res = clone(pathArray);\n res.toString = toString;\n return res;\n }\n function getPointAtSegmentLength(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {\n if (length == null) {\n return bezlen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y);\n } else {\n return findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y,\n getTotLen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length));\n }\n }\n function getLengthFactory(istotal, subpath) {\n function O(val) {\n return +(+val).toFixed(3);\n }\n return Snap._.cacher(function (path, length, onlystart) {\n if (path instanceof Element) {\n path = path.attr(\"d\");\n }\n path = path2curve(path);\n var x, y, p, l, sp = \"\", subpaths = {}, point,\n len = 0;\n for (var i = 0, ii = path.length; i < ii; i++) {\n p = path[i];\n if (p[0] == \"M\") {\n x = +p[1];\n y = +p[2];\n } else {\n l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);\n if (len + l > length) {\n if (subpath && !subpaths.start) {\n point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);\n sp += [\n \"C\" + O(point.start.x),\n O(point.start.y),\n O(point.m.x),\n O(point.m.y),\n O(point.x),\n O(point.y)\n ];\n if (onlystart) {return sp;}\n subpaths.start = sp;\n sp = [\n \"M\" + O(point.x),\n O(point.y) + \"C\" + O(point.n.x),\n O(point.n.y),\n O(point.end.x),\n O(point.end.y),\n O(p[5]),\n O(p[6])\n ].join();\n len += l;\n x = +p[5];\n y = +p[6];\n continue;\n }\n if (!istotal && !subpath) {\n point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);\n return point;\n }\n }\n len += l;\n x = +p[5];\n y = +p[6];\n }\n sp += p.shift() + p;\n }\n subpaths.end = sp;\n point = istotal ? len : subpath ? subpaths : findDotsAtSegment(x, y, p[0], p[1], p[2], p[3], p[4], p[5], 1);\n return point;\n }, null, Snap._.clone);\n }\n var getTotalLength = getLengthFactory(1),\n getPointAtLength = getLengthFactory(),\n getSubpathsAtLength = getLengthFactory(0, 1);\n function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {\n var t1 = 1 - t,\n t13 = pow(t1, 3),\n t12 = pow(t1, 2),\n t2 = t * t,\n t3 = t2 * t,\n x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x,\n y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y,\n mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x),\n my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y),\n nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x),\n ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y),\n ax = t1 * p1x + t * c1x,\n ay = t1 * p1y + t * c1y,\n cx = t1 * c2x + t * p2x,\n cy = t1 * c2y + t * p2y,\n alpha = 90 - math.atan2(mx - nx, my - ny) * 180 / PI;\n // (mx > nx || my < ny) && (alpha += 180);\n return {\n x: x,\n y: y,\n m: {x: mx, y: my},\n n: {x: nx, y: ny},\n start: {x: ax, y: ay},\n end: {x: cx, y: cy},\n alpha: alpha\n };\n }\n function bezierBBox(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {\n if (!Snap.is(p1x, \"array\")) {\n p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];\n }\n var bbox = curveDim.apply(null, p1x);\n return box(\n bbox.min.x,\n bbox.min.y,\n bbox.max.x - bbox.min.x,\n bbox.max.y - bbox.min.y\n );\n }\n function isPointInsideBBox(bbox, x, y) {\n return x >= bbox.x &&\n x <= bbox.x + bbox.width &&\n y >= bbox.y &&\n y <= bbox.y + bbox.height;\n }\n function isBBoxIntersect(bbox1, bbox2) {\n bbox1 = box(bbox1);\n bbox2 = box(bbox2);\n return isPointInsideBBox(bbox2, bbox1.x, bbox1.y)\n || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y)\n || isPointInsideBBox(bbox2, bbox1.x, bbox1.y2)\n || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2)\n || isPointInsideBBox(bbox1, bbox2.x, bbox2.y)\n || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y)\n || isPointInsideBBox(bbox1, bbox2.x, bbox2.y2)\n || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2)\n || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x\n || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x)\n && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y\n || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y);\n }\n function base3(t, p1, p2, p3, p4) {\n var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4,\n t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;\n return t * t2 - 3 * p1 + 3 * p2;\n }\n function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) {\n if (z == null) {\n z = 1;\n }\n z = z > 1 ? 1 : z < 0 ? 0 : z;\n var z2 = z / 2,\n n = 12,\n Tvalues = [-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],\n Cvalues = [0.2491,0.2491,0.2335,0.2335,0.2032,0.2032,0.1601,0.1601,0.1069,0.1069,0.0472,0.0472],\n sum = 0;\n for (var i = 0; i < n; i++) {\n var ct = z2 * Tvalues[i] + z2,\n xbase = base3(ct, x1, x2, x3, x4),\n ybase = base3(ct, y1, y2, y3, y4),\n comb = xbase * xbase + ybase * ybase;\n sum += Cvalues[i] * math.sqrt(comb);\n }\n return z2 * sum;\n }\n function getTotLen(x1, y1, x2, y2, x3, y3, x4, y4, ll) {\n if (ll < 0 || bezlen(x1, y1, x2, y2, x3, y3, x4, y4) < ll) {\n return;\n }\n var t = 1,\n step = t / 2,\n t2 = t - step,\n l,\n e = .01;\n l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);\n while (abs(l - ll) > e) {\n step /= 2;\n t2 += (l < ll ? 1 : -1) * step;\n l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);\n }\n return t2;\n }\n function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {\n if (\n mmax(x1, x2) < mmin(x3, x4) ||\n mmin(x1, x2) > mmax(x3, x4) ||\n mmax(y1, y2) < mmin(y3, y4) ||\n mmin(y1, y2) > mmax(y3, y4)\n ) {\n return;\n }\n var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4),\n ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4),\n denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\n\n if (!denominator) {\n return;\n }\n var px = nx / denominator,\n py = ny / denominator,\n px2 = +px.toFixed(2),\n py2 = +py.toFixed(2);\n if (\n px2 < +mmin(x1, x2).toFixed(2) ||\n px2 > +mmax(x1, x2).toFixed(2) ||\n px2 < +mmin(x3, x4).toFixed(2) ||\n px2 > +mmax(x3, x4).toFixed(2) ||\n py2 < +mmin(y1, y2).toFixed(2) ||\n py2 > +mmax(y1, y2).toFixed(2) ||\n py2 < +mmin(y3, y4).toFixed(2) ||\n py2 > +mmax(y3, y4).toFixed(2)\n ) {\n return;\n }\n return {x: px, y: py};\n }\n function inter(bez1, bez2) {\n return interHelper(bez1, bez2);\n }\n function interCount(bez1, bez2) {\n return interHelper(bez1, bez2, 1);\n }\n function interHelper(bez1, bez2, justCount) {\n var bbox1 = bezierBBox(bez1),\n bbox2 = bezierBBox(bez2);\n if (!isBBoxIntersect(bbox1, bbox2)) {\n return justCount ? 0 : [];\n }\n var l1 = bezlen.apply(0, bez1),\n l2 = bezlen.apply(0, bez2),\n n1 = ~~(l1 / 8),\n n2 = ~~(l2 / 8),\n dots1 = [],\n dots2 = [],\n xy = {},\n res = justCount ? 0 : [];\n for (var i = 0; i < n1 + 1; i++) {\n var p = findDotsAtSegment.apply(0, bez1.concat(i / n1));\n dots1.push({x: p.x, y: p.y, t: i / n1});\n }\n for (i = 0; i < n2 + 1; i++) {\n p = findDotsAtSegment.apply(0, bez2.concat(i / n2));\n dots2.push({x: p.x, y: p.y, t: i / n2});\n }\n for (i = 0; i < n1; i++) {\n for (var j = 0; j < n2; j++) {\n var di = dots1[i],\n di1 = dots1[i + 1],\n dj = dots2[j],\n dj1 = dots2[j + 1],\n ci = abs(di1.x - di.x) < .001 ? \"y\" : \"x\",\n cj = abs(dj1.x - dj.x) < .001 ? \"y\" : \"x\",\n is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);\n if (is) {\n if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) {\n continue;\n }\n xy[is.x.toFixed(4)] = is.y.toFixed(4);\n var t1 = di.t + abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t),\n t2 = dj.t + abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);\n if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {\n if (justCount) {\n res++;\n } else {\n res.push({\n x: is.x,\n y: is.y,\n t1: t1,\n t2: t2\n });\n }\n }\n }\n }\n }\n return res;\n }\n function pathIntersection(path1, path2) {\n return interPathHelper(path1, path2);\n }\n function pathIntersectionNumber(path1, path2) {\n return interPathHelper(path1, path2, 1);\n }\n function interPathHelper(path1, path2, justCount) {\n path1 = path2curve(path1);\n path2 = path2curve(path2);\n var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2,\n res = justCount ? 0 : [];\n for (var i = 0, ii = path1.length; i < ii; i++) {\n var pi = path1[i];\n if (pi[0] == \"M\") {\n x1 = x1m = pi[1];\n y1 = y1m = pi[2];\n } else {\n if (pi[0] == \"C\") {\n bez1 = [x1, y1].concat(pi.slice(1));\n x1 = bez1[6];\n y1 = bez1[7];\n } else {\n bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];\n x1 = x1m;\n y1 = y1m;\n }\n for (var j = 0, jj = path2.length; j < jj; j++) {\n var pj = path2[j];\n if (pj[0] == \"M\") {\n x2 = x2m = pj[1];\n y2 = y2m = pj[2];\n } else {\n if (pj[0] == \"C\") {\n bez2 = [x2, y2].concat(pj.slice(1));\n x2 = bez2[6];\n y2 = bez2[7];\n } else {\n bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];\n x2 = x2m;\n y2 = y2m;\n }\n var intr = interHelper(bez1, bez2, justCount);\n if (justCount) {\n res += intr;\n } else {\n for (var k = 0, kk = intr.length; k < kk; k++) {\n intr[k].segment1 = i;\n intr[k].segment2 = j;\n intr[k].bez1 = bez1;\n intr[k].bez2 = bez2;\n }\n res = res.concat(intr);\n }\n }\n }\n }\n }\n return res;\n }\n function isPointInsidePath(path, x, y) {\n var bbox = pathBBox(path);\n return isPointInsideBBox(bbox, x, y) &&\n interPathHelper(path, [[\"M\", x, y], [\"H\", bbox.x2 + 10]], 1) % 2 == 1;\n }\n function pathBBox(path) {\n var pth = paths(path);\n if (pth.bbox) {\n return clone(pth.bbox);\n }\n if (!path) {\n return box();\n }\n path = path2curve(path);\n var x = 0,\n y = 0,\n X = [],\n Y = [],\n p;\n for (var i = 0, ii = path.length; i < ii; i++) {\n p = path[i];\n if (p[0] == \"M\") {\n x = p[1];\n y = p[2];\n X.push(x);\n Y.push(y);\n } else {\n var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);\n X = X.concat(dim.min.x, dim.max.x);\n Y = Y.concat(dim.min.y, dim.max.y);\n x = p[5];\n y = p[6];\n }\n }\n var xmin = mmin.apply(0, X),\n ymin = mmin.apply(0, Y),\n xmax = mmax.apply(0, X),\n ymax = mmax.apply(0, Y),\n bb = box(xmin, ymin, xmax - xmin, ymax - ymin);\n pth.bbox = clone(bb);\n return bb;\n }\n function rectPath(x, y, w, h, r) {\n if (r) {\n return [\n [\"M\", +x + +r, y],\n [\"l\", w - r * 2, 0],\n [\"a\", r, r, 0, 0, 1, r, r],\n [\"l\", 0, h - r * 2],\n [\"a\", r, r, 0, 0, 1, -r, r],\n [\"l\", r * 2 - w, 0],\n [\"a\", r, r, 0, 0, 1, -r, -r],\n [\"l\", 0, r * 2 - h],\n [\"a\", r, r, 0, 0, 1, r, -r],\n [\"z\"]\n ];\n }\n var res = [[\"M\", x, y], [\"l\", w, 0], [\"l\", 0, h], [\"l\", -w, 0], [\"z\"]];\n res.toString = toString;\n return res;\n }\n function ellipsePath(x, y, rx, ry, a) {\n if (a == null && ry == null) {\n ry = rx;\n }\n x = +x;\n y = +y;\n rx = +rx;\n ry = +ry;\n if (a != null) {\n var rad = Math.PI / 180,\n x1 = x + rx * Math.cos(-ry * rad),\n x2 = x + rx * Math.cos(-a * rad),\n y1 = y + rx * Math.sin(-ry * rad),\n y2 = y + rx * Math.sin(-a * rad),\n res = [[\"M\", x1, y1], [\"A\", rx, rx, 0, +(a - ry > 180), 0, x2, y2]];\n } else {\n res = [\n [\"M\", x, y],\n [\"m\", 0, -ry],\n [\"a\", rx, ry, 0, 1, 1, 0, 2 * ry],\n [\"a\", rx, ry, 0, 1, 1, 0, -2 * ry],\n [\"z\"]\n ];\n }\n res.toString = toString;\n return res;\n }\n var unit2px = Snap._unit2px,\n getPath = {\n path: function (el) {\n return el.attr(\"path\");\n },\n circle: function (el) {\n var attr = unit2px(el);\n return ellipsePath(attr.cx, attr.cy, attr.r);\n },\n ellipse: function (el) {\n var attr = unit2px(el);\n return ellipsePath(attr.cx || 0, attr.cy || 0, attr.rx, attr.ry);\n },\n rect: function (el) {\n var attr = unit2px(el);\n return rectPath(attr.x || 0, attr.y || 0, attr.width, attr.height, attr.rx, attr.ry);\n },\n image: function (el) {\n var attr = unit2px(el);\n return rectPath(attr.x || 0, attr.y || 0, attr.width, attr.height);\n },\n line: function (el) {\n return \"M\" + [el.attr(\"x1\") || 0, el.attr(\"y1\") || 0, el.attr(\"x2\"), el.attr(\"y2\")];\n },\n polyline: function (el) {\n return \"M\" + el.attr(\"points\");\n },\n polygon: function (el) {\n return \"M\" + el.attr(\"points\") + \"z\";\n },\n deflt: function (el) {\n var bbox = el.node.getBBox();\n return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);\n }\n };\n function pathToRelative(pathArray) {\n var pth = paths(pathArray),\n lowerCase = String.prototype.toLowerCase;\n if (pth.rel) {\n return pathClone(pth.rel);\n }\n if (!Snap.is(pathArray, \"array\") || !Snap.is(pathArray && pathArray[0], \"array\")) {\n pathArray = Snap.parsePathString(pathArray);\n }\n var res = [],\n x = 0,\n y = 0,\n mx = 0,\n my = 0,\n start = 0;\n if (pathArray[0][0] == \"M\") {\n x = pathArray[0][1];\n y = pathArray[0][2];\n mx = x;\n my = y;\n start++;\n res.push([\"M\", x, y]);\n }\n for (var i = start, ii = pathArray.length; i < ii; i++) {\n var r = res[i] = [],\n pa = pathArray[i];\n if (pa[0] != lowerCase.call(pa[0])) {\n r[0] = lowerCase.call(pa[0]);\n switch (r[0]) {\n case \"a\":\n r[1] = pa[1];\n r[2] = pa[2];\n r[3] = pa[3];\n r[4] = pa[4];\n r[5] = pa[5];\n r[6] = +(pa[6] - x).toFixed(3);\n r[7] = +(pa[7] - y).toFixed(3);\n break;\n case \"v\":\n r[1] = +(pa[1] - y).toFixed(3);\n break;\n case \"m\":\n mx = pa[1];\n my = pa[2];\n default:\n for (var j = 1, jj = pa.length; j < jj; j++) {\n r[j] = +(pa[j] - (j % 2 ? x : y)).toFixed(3);\n }\n }\n } else {\n r = res[i] = [];\n if (pa[0] == \"m\") {\n mx = pa[1] + x;\n my = pa[2] + y;\n }\n for (var k = 0, kk = pa.length; k < kk; k++) {\n res[i][k] = pa[k];\n }\n }\n var len = res[i].length;\n switch (res[i][0]) {\n case \"z\":\n x = mx;\n y = my;\n break;\n case \"h\":\n x += +res[i][len - 1];\n break;\n case \"v\":\n y += +res[i][len - 1];\n break;\n default:\n x += +res[i][len - 2];\n y += +res[i][len - 1];\n }\n }\n res.toString = toString;\n pth.rel = pathClone(res);\n return res;\n }\n function pathToAbsolute(pathArray) {\n var pth = paths(pathArray);\n if (pth.abs) {\n return pathClone(pth.abs);\n }\n if (!is(pathArray, \"array\") || !is(pathArray && pathArray[0], \"array\")) { // rough assumption\n pathArray = Snap.parsePathString(pathArray);\n }\n if (!pathArray || !pathArray.length) {\n return [[\"M\", 0, 0]];\n }\n var res = [],\n x = 0,\n y = 0,\n mx = 0,\n my = 0,\n start = 0,\n pa0;\n if (pathArray[0][0] == \"M\") {\n x = +pathArray[0][1];\n y = +pathArray[0][2];\n mx = x;\n my = y;\n start++;\n res[0] = [\"M\", x, y];\n }\n var crz = pathArray.length == 3 &&\n pathArray[0][0] == \"M\" &&\n pathArray[1][0].toUpperCase() == \"R\" &&\n pathArray[2][0].toUpperCase() == \"Z\";\n for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) {\n res.push(r = []);\n pa = pathArray[i];\n pa0 = pa[0];\n if (pa0 != pa0.toUpperCase()) {\n r[0] = pa0.toUpperCase();\n switch (r[0]) {\n case \"A\":\n r[1] = pa[1];\n r[2] = pa[2];\n r[3] = pa[3];\n r[4] = pa[4];\n r[5] = pa[5];\n r[6] = +pa[6] + x;\n r[7] = +pa[7] + y;\n break;\n case \"V\":\n r[1] = +pa[1] + y;\n break;\n case \"H\":\n r[1] = +pa[1] + x;\n break;\n case \"R\":\n var dots = [x, y].concat(pa.slice(1));\n for (var j = 2, jj = dots.length; j < jj; j++) {\n dots[j] = +dots[j] + x;\n dots[++j] = +dots[j] + y;\n }\n res.pop();\n res = res.concat(catmullRom2bezier(dots, crz));\n break;\n case \"O\":\n res.pop();\n dots = ellipsePath(x, y, pa[1], pa[2]);\n dots.push(dots[0]);\n res = res.concat(dots);\n break;\n case \"U\":\n res.pop();\n res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));\n r = [\"U\"].concat(res[res.length - 1].slice(-2));\n break;\n case \"M\":\n mx = +pa[1] + x;\n my = +pa[2] + y;\n default:\n for (j = 1, jj = pa.length; j < jj; j++) {\n r[j] = +pa[j] + (j % 2 ? x : y);\n }\n }\n } else if (pa0 == \"R\") {\n dots = [x, y].concat(pa.slice(1));\n res.pop();\n res = res.concat(catmullRom2bezier(dots, crz));\n r = [\"R\"].concat(pa.slice(-2));\n } else if (pa0 == \"O\") {\n res.pop();\n dots = ellipsePath(x, y, pa[1], pa[2]);\n dots.push(dots[0]);\n res = res.concat(dots);\n } else if (pa0 == \"U\") {\n res.pop();\n res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));\n r = [\"U\"].concat(res[res.length - 1].slice(-2));\n } else {\n for (var k = 0, kk = pa.length; k < kk; k++) {\n r[k] = pa[k];\n }\n }\n pa0 = pa0.toUpperCase();\n if (pa0 != \"O\") {\n switch (r[0]) {\n case \"Z\":\n x = +mx;\n y = +my;\n break;\n case \"H\":\n x = r[1];\n break;\n case \"V\":\n y = r[1];\n break;\n case \"M\":\n mx = r[r.length - 2];\n my = r[r.length - 1];\n default:\n x = r[r.length - 2];\n y = r[r.length - 1];\n }\n }\n }\n res.toString = toString;\n pth.abs = pathClone(res);\n return res;\n }\n function l2c(x1, y1, x2, y2) {\n return [x1, y1, x2, y2, x2, y2];\n }\n function q2c(x1, y1, ax, ay, x2, y2) {\n var _13 = 1 / 3,\n _23 = 2 / 3;\n return [\n _13 * x1 + _23 * ax,\n _13 * y1 + _23 * ay,\n _13 * x2 + _23 * ax,\n _13 * y2 + _23 * ay,\n x2,\n y2\n ];\n }\n function a2c(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {\n // for more information of where this math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n var _120 = PI * 120 / 180,\n rad = PI / 180 * (+angle || 0),\n res = [],\n xy,\n rotate = Snap._.cacher(function (x, y, rad) {\n var X = x * math.cos(rad) - y * math.sin(rad),\n Y = x * math.sin(rad) + y * math.cos(rad);\n return {x: X, y: Y};\n });\n if (!rx || !ry) {\n return [x1, y1, x2, y2, x2, y2];\n }\n if (!recursive) {\n xy = rotate(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotate(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n var cos = math.cos(PI / 180 * angle),\n sin = math.sin(PI / 180 * angle),\n x = (x1 - x2) / 2,\n y = (y1 - y2) / 2;\n var h = x * x / (rx * rx) + y * y / (ry * ry);\n if (h > 1) {\n h = math.sqrt(h);\n rx = h * rx;\n ry = h * ry;\n }\n var rx2 = rx * rx,\n ry2 = ry * ry,\n k = (large_arc_flag == sweep_flag ? -1 : 1) *\n math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),\n cx = k * rx * y / ry + (x1 + x2) / 2,\n cy = k * -ry * x / rx + (y1 + y2) / 2,\n f1 = math.asin(((y1 - cy) / ry).toFixed(9)),\n f2 = math.asin(((y2 - cy) / ry).toFixed(9));\n\n f1 = x1 < cx ? PI - f1 : f1;\n f2 = x2 < cx ? PI - f2 : f2;\n f1 < 0 && (f1 = PI * 2 + f1);\n f2 < 0 && (f2 = PI * 2 + f2);\n if (sweep_flag && f1 > f2) {\n f1 = f1 - PI * 2;\n }\n if (!sweep_flag && f2 > f1) {\n f2 = f2 - PI * 2;\n }\n } else {\n f1 = recursive[0];\n f2 = recursive[1];\n cx = recursive[2];\n cy = recursive[3];\n }\n var df = f2 - f1;\n if (abs(df) > _120) {\n var f2old = f2,\n x2old = x2,\n y2old = y2;\n f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);\n x2 = cx + rx * math.cos(f2);\n y2 = cy + ry * math.sin(f2);\n res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n var c1 = math.cos(f1),\n s1 = math.sin(f1),\n c2 = math.cos(f2),\n s2 = math.sin(f2),\n t = math.tan(df / 4),\n hx = 4 / 3 * rx * t,\n hy = 4 / 3 * ry * t,\n m1 = [x1, y1],\n m2 = [x1 + hx * s1, y1 - hy * c1],\n m3 = [x2 + hx * s2, y2 - hy * c2],\n m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [m2, m3, m4].concat(res);\n } else {\n res = [m2, m3, m4].concat(res).join().split(\",\");\n var newres = [];\n for (var i = 0, ii = res.length; i < ii; i++) {\n newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;\n }\n return newres;\n }\n }\n function findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {\n var t1 = 1 - t;\n return {\n x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,\n y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y\n };\n }\n\n // Returns bounding box of cubic bezier curve.\n // Source: http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html\n // Original version: NISHIO Hirokazu\n // Modifications: https://github.com/timo22345\n function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {\n var tvalues = [],\n bounds = [[], []],\n a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n for (var i = 0; i < 2; ++i) {\n if (i == 0) {\n b = 6 * x0 - 12 * x1 + 6 * x2;\n a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n c = 3 * x1 - 3 * x0;\n } else {\n b = 6 * y0 - 12 * y1 + 6 * y2;\n a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n c = 3 * y1 - 3 * y0;\n }\n if (abs(a) < 1e-12) {\n if (abs(b) < 1e-12) {\n continue;\n }\n t = -c / b;\n if (0 < t && t < 1) {\n tvalues.push(t);\n }\n continue;\n }\n b2ac = b * b - 4 * c * a;\n sqrtb2ac = math.sqrt(b2ac);\n if (b2ac < 0) {\n continue;\n }\n t1 = (-b + sqrtb2ac) / (2 * a);\n if (0 < t1 && t1 < 1) {\n tvalues.push(t1);\n }\n t2 = (-b - sqrtb2ac) / (2 * a);\n if (0 < t2 && t2 < 1) {\n tvalues.push(t2);\n }\n }\n\n var x, y, j = tvalues.length,\n jlen = j,\n mt;\n while (j--) {\n t = tvalues[j];\n mt = 1 - t;\n bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;\n bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;\n }\n\n bounds[0][jlen] = x0;\n bounds[1][jlen] = y0;\n bounds[0][jlen + 1] = x3;\n bounds[1][jlen + 1] = y3;\n bounds[0].length = bounds[1].length = jlen + 2;\n\n\n return {\n min: {x: mmin.apply(0, bounds[0]), y: mmin.apply(0, bounds[1])},\n max: {x: mmax.apply(0, bounds[0]), y: mmax.apply(0, bounds[1])}\n };\n }\n\n function path2curve(path, path2) {\n var pth = !path2 && paths(path);\n if (!path2 && pth.curve) {\n return pathClone(pth.curve);\n }\n var p = pathToAbsolute(path),\n p2 = path2 && pathToAbsolute(path2),\n attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},\n attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},\n processPath = function (path, d, pcom) {\n var nx, ny;\n if (!path) {\n return [\"C\", d.x, d.y, d.x, d.y, d.x, d.y];\n }\n !(path[0] in {T: 1, Q: 1}) && (d.qx = d.qy = null);\n switch (path[0]) {\n case \"M\":\n d.X = path[1];\n d.Y = path[2];\n break;\n case \"A\":\n path = [\"C\"].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1))));\n break;\n case \"S\":\n if (pcom == \"C\" || pcom == \"S\") { // In \"S\" case we have to take into account, if the previous command is C/S.\n nx = d.x * 2 - d.bx; // And reflect the previous\n ny = d.y * 2 - d.by; // command's control point relative to the current point.\n }\n else { // or some else or nothing\n nx = d.x;\n ny = d.y;\n }\n path = [\"C\", nx, ny].concat(path.slice(1));\n break;\n case \"T\":\n if (pcom == \"Q\" || pcom == \"T\") { // In \"T\" case we have to take into account, if the previous command is Q/T.\n d.qx = d.x * 2 - d.qx; // And make a reflection similar\n d.qy = d.y * 2 - d.qy; // to case \"S\".\n }\n else { // or something else or nothing\n d.qx = d.x;\n d.qy = d.y;\n }\n path = [\"C\"].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));\n break;\n case \"Q\":\n d.qx = path[1];\n d.qy = path[2];\n path = [\"C\"].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4]));\n break;\n case \"L\":\n path = [\"C\"].concat(l2c(d.x, d.y, path[1], path[2]));\n break;\n case \"H\":\n path = [\"C\"].concat(l2c(d.x, d.y, path[1], d.y));\n break;\n case \"V\":\n path = [\"C\"].concat(l2c(d.x, d.y, d.x, path[1]));\n break;\n case \"Z\":\n path = [\"C\"].concat(l2c(d.x, d.y, d.X, d.Y));\n break;\n }\n return path;\n },\n fixArc = function (pp, i) {\n if (pp[i].length > 7) {\n pp[i].shift();\n var pi = pp[i];\n while (pi.length) {\n pcoms1[i] = \"A\"; // if created multiple C:s, their original seg is saved\n p2 && (pcoms2[i] = \"A\"); // the same as above\n pp.splice(i++, 0, [\"C\"].concat(pi.splice(0, 6)));\n }\n pp.splice(i, 1);\n ii = mmax(p.length, p2 && p2.length || 0);\n }\n },\n fixM = function (path1, path2, a1, a2, i) {\n if (path1 && path2 && path1[i][0] == \"M\" && path2[i][0] != \"M\") {\n path2.splice(i, 0, [\"M\", a2.x, a2.y]);\n a1.bx = 0;\n a1.by = 0;\n a1.x = path1[i][1];\n a1.y = path1[i][2];\n ii = mmax(p.length, p2 && p2.length || 0);\n }\n },\n pcoms1 = [], // path commands of original path p\n pcoms2 = [], // path commands of original path p2\n pfirst = \"\", // temporary holder for original path command\n pcom = \"\"; // holder for previous path command of original path\n for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) {\n p[i] && (pfirst = p[i][0]); // save current path command\n\n if (pfirst != \"C\") // C is not saved yet, because it may be result of conversion\n {\n pcoms1[i] = pfirst; // Save current path command\n i && ( pcom = pcoms1[i - 1]); // Get previous path command pcom\n }\n p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath\n\n if (pcoms1[i] != \"A\" && pfirst == \"C\") pcoms1[i] = \"C\"; // A is the only command\n // which may produce multiple C:s\n // so we have to make sure that C is also C in original path\n\n fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1\n\n if (p2) { // the same procedures is done to p2\n p2[i] && (pfirst = p2[i][0]);\n if (pfirst != \"C\") {\n pcoms2[i] = pfirst;\n i && (pcom = pcoms2[i - 1]);\n }\n p2[i] = processPath(p2[i], attrs2, pcom);\n\n if (pcoms2[i] != \"A\" && pfirst == \"C\") {\n pcoms2[i] = \"C\";\n }\n\n fixArc(p2, i);\n }\n fixM(p, p2, attrs, attrs2, i);\n fixM(p2, p, attrs2, attrs, i);\n var seg = p[i],\n seg2 = p2 && p2[i],\n seglen = seg.length,\n seg2len = p2 && seg2.length;\n attrs.x = seg[seglen - 2];\n attrs.y = seg[seglen - 1];\n attrs.bx = toFloat(seg[seglen - 4]) || attrs.x;\n attrs.by = toFloat(seg[seglen - 3]) || attrs.y;\n attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x);\n attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y);\n attrs2.x = p2 && seg2[seg2len - 2];\n attrs2.y = p2 && seg2[seg2len - 1];\n }\n if (!p2) {\n pth.curve = pathClone(p);\n }\n return p2 ? [p, p2] : p;\n }\n function mapPath(path, matrix) {\n if (!matrix) {\n return path;\n }\n var x, y, i, j, ii, jj, pathi;\n path = path2curve(path);\n for (i = 0, ii = path.length; i < ii; i++) {\n pathi = path[i];\n for (j = 1, jj = pathi.length; j < jj; j += 2) {\n x = matrix.x(pathi[j], pathi[j + 1]);\n y = matrix.y(pathi[j], pathi[j + 1]);\n pathi[j] = x;\n pathi[j + 1] = y;\n }\n }\n return path;\n }\n\n // http://schepers.cc/getting-to-the-point\n function catmullRom2bezier(crp, z) {\n var d = [];\n for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {\n var p = [\n {x: +crp[i - 2], y: +crp[i - 1]},\n {x: +crp[i], y: +crp[i + 1]},\n {x: +crp[i + 2], y: +crp[i + 3]},\n {x: +crp[i + 4], y: +crp[i + 5]}\n ];\n if (z) {\n if (!i) {\n p[0] = {x: +crp[iLen - 2], y: +crp[iLen - 1]};\n } else if (iLen - 4 == i) {\n p[3] = {x: +crp[0], y: +crp[1]};\n } else if (iLen - 2 == i) {\n p[2] = {x: +crp[0], y: +crp[1]};\n p[3] = {x: +crp[2], y: +crp[3]};\n }\n } else {\n if (iLen - 4 == i) {\n p[3] = p[2];\n } else if (!i) {\n p[0] = {x: +crp[i], y: +crp[i + 1]};\n }\n }\n d.push([\"C\",\n (-p[0].x + 6 * p[1].x + p[2].x) / 6,\n (-p[0].y + 6 * p[1].y + p[2].y) / 6,\n (p[1].x + 6 * p[2].x - p[3].x) / 6,\n (p[1].y + 6*p[2].y - p[3].y) / 6,\n p[2].x,\n p[2].y\n ]);\n }\n\n return d;\n }\n\n // export\n Snap.path = paths;\n\n /*\\\n * Snap.path.getTotalLength\n [ method ]\n **\n * Returns the length of the given path in pixels\n **\n - path (string) SVG path string\n **\n = (number) length\n \\*/\n Snap.path.getTotalLength = getTotalLength;\n /*\\\n * Snap.path.getPointAtLength\n [ method ]\n **\n * Returns the coordinates of the point located at the given length along the given path\n **\n - path (string) SVG path string\n - length (number) length, in pixels, from the start of the path, excluding non-rendering jumps\n **\n = (object) representation of the point:\n o {\n o x: (number) x coordinate,\n o y: (number) y coordinate,\n o alpha: (number) angle of derivative\n o }\n \\*/\n Snap.path.getPointAtLength = getPointAtLength;\n /*\\\n * Snap.path.getSubpath\n [ method ]\n **\n * Returns the subpath of a given path between given start and end lengths\n **\n - path (string) SVG path string\n - from (number) length, in pixels, from the start of the path to the start of the segment\n - to (number) length, in pixels, from the start of the path to the end of the segment\n **\n = (string) path string definition for the segment\n \\*/\n Snap.path.getSubpath = function (path, from, to) {\n if (this.getTotalLength(path) - to < 1e-6) {\n return getSubpathsAtLength(path, from).end;\n }\n var a = getSubpathsAtLength(path, to, 1);\n return from ? getSubpathsAtLength(a, from).end : a;\n };\n /*\\\n * Element.getTotalLength\n [ method ]\n **\n * Returns the length of the path in pixels (only works for `path` elements)\n = (number) length\n \\*/\n elproto.getTotalLength = function () {\n if (this.node.getTotalLength) {\n return this.node.getTotalLength();\n }\n };\n // SIERRA Element.getPointAtLength()/Element.getTotalLength(): If a <path> is broken into different segments, is the jump distance to the new coordinates set by the _M_ or _m_ commands calculated as part of the path's total length?\n /*\\\n * Element.getPointAtLength\n [ method ]\n **\n * Returns coordinates of the point located at the given length on the given path (only works for `path` elements)\n **\n - length (number) length, in pixels, from the start of the path, excluding non-rendering jumps\n **\n = (object) representation of the point:\n o {\n o x: (number) x coordinate,\n o y: (number) y coordinate,\n o alpha: (number) angle of derivative\n o }\n \\*/\n elproto.getPointAtLength = function (length) {\n return getPointAtLength(this.attr(\"d\"), length);\n };\n // SIERRA Element.getSubpath(): Similar to the problem for Element.getPointAtLength(). Unclear how this would work for a segmented path. Overall, the concept of _subpath_ and what I'm calling a _segment_ (series of non-_M_ or _Z_ commands) is unclear.\n /*\\\n * Element.getSubpath\n [ method ]\n **\n * Returns subpath of a given element from given start and end lengths (only works for `path` elements)\n **\n - from (number) length, in pixels, from the start of the path to the start of the segment\n - to (number) length, in pixels, from the start of the path to the end of the segment\n **\n = (string) path string definition for the segment\n \\*/\n elproto.getSubpath = function (from, to) {\n return Snap.path.getSubpath(this.attr(\"d\"), from, to);\n };\n Snap._.box = box;\n /*\\\n * Snap.path.findDotsAtSegment\n [ method ]\n **\n * Utility method\n **\n * Finds dot coordinates on the given cubic beziér curve at the given t\n - p1x (number) x of the first point of the curve\n - p1y (number) y of the first point of the curve\n - c1x (number) x of the first anchor of the curve\n - c1y (number) y of the first anchor of the curve\n - c2x (number) x of the second anchor of the curve\n - c2y (number) y of the second anchor of the curve\n - p2x (number) x of the second point of the curve\n - p2y (number) y of the second point of the curve\n - t (number) position on the curve (0..1)\n = (object) point information in format:\n o {\n o x: (number) x coordinate of the point,\n o y: (number) y coordinate of the point,\n o m: {\n o x: (number) x coordinate of the left anchor,\n o y: (number) y coordinate of the left anchor\n o },\n o n: {\n o x: (number) x coordinate of the right anchor,\n o y: (number) y coordinate of the right anchor\n o },\n o start: {\n o x: (number) x coordinate of the start of the curve,\n o y: (number) y coordinate of the start of the curve\n o },\n o end: {\n o x: (number) x coordinate of the end of the curve,\n o y: (number) y coordinate of the end of the curve\n o },\n o alpha: (number) angle of the curve derivative at the point\n o }\n \\*/\n Snap.path.findDotsAtSegment = findDotsAtSegment;\n /*\\\n * Snap.path.bezierBBox\n [ method ]\n **\n * Utility method\n **\n * Returns the bounding box of a given cubic beziér curve\n - p1x (number) x of the first point of the curve\n - p1y (number) y of the first point of the curve\n - c1x (number) x of the first anchor of the curve\n - c1y (number) y of the first anchor of the curve\n - c2x (number) x of the second anchor of the curve\n - c2y (number) y of the second anchor of the curve\n - p2x (number) x of the second point of the curve\n - p2y (number) y of the second point of the curve\n * or\n - bez (array) array of six points for beziér curve\n = (object) bounding box\n o {\n o x: (number) x coordinate of the left top point of the box,\n o y: (number) y coordinate of the left top point of the box,\n o x2: (number) x coordinate of the right bottom point of the box,\n o y2: (number) y coordinate of the right bottom point of the box,\n o width: (number) width of the box,\n o height: (number) height of the box\n o }\n \\*/\n Snap.path.bezierBBox = bezierBBox;\n /*\\\n * Snap.path.isPointInsideBBox\n [ method ]\n **\n * Utility method\n **\n * Returns `true` if given point is inside bounding box\n - bbox (string) bounding box\n - x (string) x coordinate of the point\n - y (string) y coordinate of the point\n = (boolean) `true` if point is inside\n \\*/\n Snap.path.isPointInsideBBox = isPointInsideBBox;\n Snap.closest = function (x, y, X, Y) {\n var r = 100,\n b = box(x - r / 2, y - r / 2, r, r),\n inside = [],\n getter = X[0].hasOwnProperty(\"x\") ? function (i) {\n return {\n x: X[i].x,\n y: X[i].y\n };\n } : function (i) {\n return {\n x: X[i],\n y: Y[i]\n };\n },\n found = 0;\n while (r <= 1e6 && !found) {\n for (var i = 0, ii = X.length; i < ii; i++) {\n var xy = getter(i);\n if (isPointInsideBBox(b, xy.x, xy.y)) {\n found++;\n inside.push(xy);\n break;\n }\n }\n if (!found) {\n r *= 2;\n b = box(x - r / 2, y - r / 2, r, r)\n }\n }\n if (r == 1e6) {\n return;\n }\n var len = Infinity,\n res;\n for (i = 0, ii = inside.length; i < ii; i++) {\n var l = Snap.len(x, y, inside[i].x, inside[i].y);\n if (len > l) {\n len = l;\n inside[i].len = l;\n res = inside[i];\n }\n }\n return res;\n };\n /*\\\n * Snap.path.isBBoxIntersect\n [ method ]\n **\n * Utility method\n **\n * Returns `true` if two bounding boxes intersect\n - bbox1 (string) first bounding box\n - bbox2 (string) second bounding box\n = (boolean) `true` if bounding boxes intersect\n \\*/\n Snap.path.isBBoxIntersect = isBBoxIntersect;\n /*\\\n * Snap.path.intersection\n [ method ]\n **\n * Utility method\n **\n * Finds intersections of two paths\n - path1 (string) path string\n - path2 (string) path string\n = (array) dots of intersection\n o [\n o {\n o x: (number) x coordinate of the point,\n o y: (number) y coordinate of the point,\n o t1: (number) t value for segment of path1,\n o t2: (number) t value for segment of path2,\n o segment1: (number) order number for segment of path1,\n o segment2: (number) order number for segment of path2,\n o bez1: (array) eight coordinates representing beziér curve for the segment of path1,\n o bez2: (array) eight coordinates representing beziér curve for the segment of path2\n o }\n o ]\n \\*/\n Snap.path.intersection = pathIntersection;\n Snap.path.intersectionNumber = pathIntersectionNumber;\n /*\\\n * Snap.path.isPointInside\n [ method ]\n **\n * Utility method\n **\n * Returns `true` if given point is inside a given closed path.\n *\n * Note: fill mode doesn’t affect the result of this method.\n - path (string) path string\n - x (number) x of the point\n - y (number) y of the point\n = (boolean) `true` if point is inside the path\n \\*/\n Snap.path.isPointInside = isPointInsidePath;\n /*\\\n * Snap.path.getBBox\n [ method ]\n **\n * Utility method\n **\n * Returns the bounding box of a given path\n - path (string) path string\n = (object) bounding box\n o {\n o x: (number) x coordinate of the left top point of the box,\n o y: (number) y coordinate of the left top point of the box,\n o x2: (number) x coordinate of the right bottom point of the box,\n o y2: (number) y coordinate of the right bottom point of the box,\n o width: (number) width of the box,\n o height: (number) height of the box\n o }\n \\*/\n Snap.path.getBBox = pathBBox;\n Snap.path.get = getPath;\n /*\\\n * Snap.path.toRelative\n [ method ]\n **\n * Utility method\n **\n * Converts path coordinates into relative values\n - path (string) path string\n = (array) path string\n \\*/\n Snap.path.toRelative = pathToRelative;\n /*\\\n * Snap.path.toAbsolute\n [ method ]\n **\n * Utility method\n **\n * Converts path coordinates into absolute values\n - path (string) path string\n = (array) path string\n \\*/\n Snap.path.toAbsolute = pathToAbsolute;\n /*\\\n * Snap.path.toCubic\n [ method ]\n **\n * Utility method\n **\n * Converts path to a new path where all segments are cubic beziér curves\n - pathString (string|array) path string or array of segments\n = (array) array of segments\n \\*/\n Snap.path.toCubic = path2curve;\n /*\\\n * Snap.path.map\n [ method ]\n **\n * Transform the path string with the given matrix\n - path (string) path string\n - matrix (object) see @Matrix\n = (string) transformed path string\n \\*/\n Snap.path.map = mapPath;\n Snap.path.toString = toString;\n Snap.path.clone = pathClone;\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob) {\n var mmax = Math.max,\n mmin = Math.min;\n\n // Set\n var Set = function (items) {\n this.items = [];\n\tthis.bindings = {};\n this.length = 0;\n this.type = \"set\";\n if (items) {\n for (var i = 0, ii = items.length; i < ii; i++) {\n if (items[i]) {\n this[this.items.length] = this.items[this.items.length] = items[i];\n this.length++;\n }\n }\n }\n },\n setproto = Set.prototype;\n /*\\\n * Set.push\n [ method ]\n **\n * Adds each argument to the current set\n = (object) original element\n \\*/\n setproto.push = function () {\n var item,\n len;\n for (var i = 0, ii = arguments.length; i < ii; i++) {\n item = arguments[i];\n if (item) {\n len = this.items.length;\n this[len] = this.items[len] = item;\n this.length++;\n }\n }\n return this;\n };\n /*\\\n * Set.pop\n [ method ]\n **\n * Removes last element and returns it\n = (object) element\n \\*/\n setproto.pop = function () {\n this.length && delete this[this.length--];\n return this.items.pop();\n };\n /*\\\n * Set.forEach\n [ method ]\n **\n * Executes given function for each element in the set\n *\n * If the function returns `false`, the loop stops running.\n **\n - callback (function) function to run\n - thisArg (object) context object for the callback\n = (object) Set object\n \\*/\n setproto.forEach = function (callback, thisArg) {\n for (var i = 0, ii = this.items.length; i < ii; i++) {\n if (callback.call(thisArg, this.items[i], i) === false) {\n return this;\n }\n }\n return this;\n };\n /*\\\n * Set.animate\n [ method ]\n **\n * Animates each element in set in sync.\n *\n **\n - attrs (object) key-value pairs of destination attributes\n - duration (number) duration of the animation in milliseconds\n - easing (function) #optional easing function from @mina or custom\n - callback (function) #optional callback function that executes when the animation ends\n * or\n - animation (array) array of animation parameter for each element in set in format `[attrs, duration, easing, callback]`\n > Usage\n | // animate all elements in set to radius 10\n | set.animate({r: 10}, 500, mina.easein);\n | // or\n | // animate first element to radius 10, but second to radius 20 and in different time\n | set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);\n = (Element) the current element\n \\*/\n setproto.animate = function (attrs, ms, easing, callback) {\n if (typeof easing == \"function\" && !easing.length) {\n callback = easing;\n easing = mina.linear;\n }\n if (attrs instanceof Snap._.Animation) {\n callback = attrs.callback;\n easing = attrs.easing;\n ms = easing.dur;\n attrs = attrs.attr;\n }\n var args = arguments;\n if (Snap.is(attrs, \"array\") && Snap.is(args[args.length - 1], \"array\")) {\n var each = true;\n }\n var begin,\n handler = function () {\n if (begin) {\n this.b = begin;\n } else {\n begin = this.b;\n }\n },\n cb = 0,\n set = this,\n callbacker = callback && function () {\n if (++cb == set.length) {\n callback.call(this);\n }\n };\n return this.forEach(function (el, i) {\n eve.once(\"snap.animcreated.\" + el.id, handler);\n if (each) {\n args[i] && el.animate.apply(el, args[i]);\n } else {\n el.animate(attrs, ms, easing, callbacker);\n }\n });\n };\n /*\\\n * Set.remove\n [ method ]\n **\n * Removes all children of the set.\n *\n = (object) Set object\n \\*/\n setproto.remove = function () {\n while (this.length) {\n this.pop().remove();\n }\n return this;\n };\n /*\\\n * Set.bind\n [ method ]\n **\n * Specifies how to handle a specific attribute when applied\n * to a set.\n *\n **\n - attr (string) attribute name\n - callback (function) function to run\n * or\n - attr (string) attribute name\n - element (Element) specific element in the set to apply the attribute to\n * or\n - attr (string) attribute name\n - element (Element) specific element in the set to apply the attribute to\n - eattr (string) attribute on the element to bind the attribute to\n = (object) Set object\n \\*/\n setproto.bind = function (attr, a, b) {\n var data = {};\n if (typeof a == \"function\") {\n this.bindings[attr] = a;\n } else {\n var aname = b || attr;\n this.bindings[attr] = function (v) {\n data[aname] = v;\n a.attr(data);\n };\n }\n return this;\n };\n /*\\\n * Set.attr\n [ method ]\n **\n * Equivalent of @Element.attr.\n = (object) Set object\n \\*/\n setproto.attr = function (value) {\n var unbound = {};\n for (var k in value) {\n if (this.bindings[k]) {\n this.bindings[k](value[k]);\n } else {\n unbound[k] = value[k];\n }\n }\n for (var i = 0, ii = this.items.length; i < ii; i++) {\n this.items[i].attr(unbound);\n }\n return this;\n };\n /*\\\n * Set.clear\n [ method ]\n **\n * Removes all elements from the set\n \\*/\n setproto.clear = function () {\n while (this.length) {\n this.pop();\n }\n };\n /*\\\n * Set.splice\n [ method ]\n **\n * Removes range of elements from the set\n **\n - index (number) position of the deletion\n - count (number) number of element to remove\n - insertion… (object) #optional elements to insert\n = (object) set elements that were deleted\n \\*/\n setproto.splice = function (index, count, insertion) {\n index = index < 0 ? mmax(this.length + index, 0) : index;\n count = mmax(0, mmin(this.length - index, count));\n var tail = [],\n todel = [],\n args = [],\n i;\n for (i = 2; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n for (i = 0; i < count; i++) {\n todel.push(this[index + i]);\n }\n for (; i < this.length - index; i++) {\n tail.push(this[index + i]);\n }\n var arglen = args.length;\n for (i = 0; i < arglen + tail.length; i++) {\n this.items[index + i] = this[index + i] = i < arglen ? args[i] : tail[i - arglen];\n }\n i = this.items.length = this.length -= count - arglen;\n while (this[i]) {\n delete this[i++];\n }\n return new Set(todel);\n };\n /*\\\n * Set.exclude\n [ method ]\n **\n * Removes given element from the set\n **\n - element (object) element to remove\n = (boolean) `true` if object was found and removed from the set\n \\*/\n setproto.exclude = function (el) {\n for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) {\n this.splice(i, 1);\n return true;\n }\n return false;\n };\n /*\\\n * Set.insertAfter\n [ method ]\n **\n * Inserts set elements after given element.\n **\n - element (object) set will be inserted after this element\n = (object) Set object\n \\*/\n setproto.insertAfter = function (el) {\n var i = this.items.length;\n while (i--) {\n this.items[i].insertAfter(el);\n }\n return this;\n };\n /*\\\n * Set.getBBox\n [ method ]\n **\n * Union of all bboxes of the set. See @Element.getBBox.\n = (object) bounding box descriptor. See @Element.getBBox.\n \\*/\n setproto.getBBox = function () {\n var x = [],\n y = [],\n x2 = [],\n y2 = [];\n for (var i = this.items.length; i--;) if (!this.items[i].removed) {\n var box = this.items[i].getBBox();\n x.push(box.x);\n y.push(box.y);\n x2.push(box.x + box.width);\n y2.push(box.y + box.height);\n }\n x = mmin.apply(0, x);\n y = mmin.apply(0, y);\n x2 = mmax.apply(0, x2);\n y2 = mmax.apply(0, y2);\n return {\n x: x,\n y: y,\n x2: x2,\n y2: y2,\n width: x2 - x,\n height: y2 - y,\n cx: x + (x2 - x) / 2,\n cy: y + (y2 - y) / 2\n };\n };\n /*\\\n * Set.insertAfter\n [ method ]\n **\n * Creates a clone of the set.\n **\n = (object) New Set object\n \\*/\n setproto.clone = function (s) {\n s = new Set;\n for (var i = 0, ii = this.items.length; i < ii; i++) {\n s.push(this.items[i].clone());\n }\n return s;\n };\n setproto.toString = function () {\n return \"Snap\\u2018s set\";\n };\n setproto.type = \"set\";\n // export\n /*\\\n * Snap.Set\n [ property ]\n **\n * Set constructor.\n \\*/\n Snap.Set = Set;\n /*\\\n * Snap.set\n [ method ]\n **\n * Creates a set and fills it with list of arguments.\n **\n = (object) New Set object\n | var r = paper.rect(0, 0, 10, 10),\n | s1 = Snap.set(), // empty set\n | s2 = Snap.set(r, paper.circle(100, 100, 20)); // prefilled set\n \\*/\n Snap.set = function () {\n var set = new Set;\n if (arguments.length) {\n set.push.apply(set, Array.prototype.slice.call(arguments, 0));\n }\n return set;\n };\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob) {\n var names = {},\n reUnit = /[%a-z]+$/i,\n Str = String;\n names.stroke = names.fill = \"colour\";\n function getEmpty(item) {\n var l = item[0];\n switch (l.toLowerCase()) {\n case \"t\": return [l, 0, 0];\n case \"m\": return [l, 1, 0, 0, 1, 0, 0];\n case \"r\": if (item.length == 4) {\n return [l, 0, item[2], item[3]];\n } else {\n return [l, 0];\n }\n case \"s\": if (item.length == 5) {\n return [l, 1, 1, item[3], item[4]];\n } else if (item.length == 3) {\n return [l, 1, 1];\n } else {\n return [l, 1];\n }\n }\n }\n function equaliseTransform(t1, t2, getBBox) {\n t1 = t1 || new Snap.Matrix;\n t2 = t2 || new Snap.Matrix;\n t1 = Snap.parseTransformString(t1.toTransformString()) || [];\n t2 = Snap.parseTransformString(t2.toTransformString()) || [];\n var maxlength = Math.max(t1.length, t2.length),\n from = [],\n to = [],\n i = 0, j, jj,\n tt1, tt2;\n for (; i < maxlength; i++) {\n tt1 = t1[i] || getEmpty(t2[i]);\n tt2 = t2[i] || getEmpty(tt1);\n if (tt1[0] != tt2[0] ||\n tt1[0].toLowerCase() == \"r\" && (tt1[2] != tt2[2] || tt1[3] != tt2[3]) ||\n tt1[0].toLowerCase() == \"s\" && (tt1[3] != tt2[3] || tt1[4] != tt2[4])\n ) {\n t1 = Snap._.transform2matrix(t1, getBBox());\n t2 = Snap._.transform2matrix(t2, getBBox());\n from = [[\"m\", t1.a, t1.b, t1.c, t1.d, t1.e, t1.f]];\n to = [[\"m\", t2.a, t2.b, t2.c, t2.d, t2.e, t2.f]];\n break;\n }\n from[i] = [];\n to[i] = [];\n for (j = 0, jj = Math.max(tt1.length, tt2.length); j < jj; j++) {\n j in tt1 && (from[i][j] = tt1[j]);\n j in tt2 && (to[i][j] = tt2[j]);\n }\n }\n return {\n from: path2array(from),\n to: path2array(to),\n f: getPath(from)\n };\n }\n function getNumber(val) {\n return val;\n }\n function getUnit(unit) {\n return function (val) {\n return +val.toFixed(3) + unit;\n };\n }\n function getViewBox(val) {\n return val.join(\" \");\n }\n function getColour(clr) {\n return Snap.rgb(clr[0], clr[1], clr[2], clr[3]);\n }\n function getPath(path) {\n var k = 0, i, ii, j, jj, out, a, b = [];\n for (i = 0, ii = path.length; i < ii; i++) {\n out = \"[\";\n a = ['\"' + path[i][0] + '\"'];\n for (j = 1, jj = path[i].length; j < jj; j++) {\n a[j] = \"val[\" + k++ + \"]\";\n }\n out += a + \"]\";\n b[i] = out;\n }\n return Function(\"val\", \"return Snap.path.toString.call([\" + b + \"])\");\n }\n function path2array(path) {\n var out = [];\n for (var i = 0, ii = path.length; i < ii; i++) {\n for (var j = 1, jj = path[i].length; j < jj; j++) {\n out.push(path[i][j]);\n }\n }\n return out;\n }\n function isNumeric(obj) {\n return isFinite(obj);\n }\n function arrayEqual(arr1, arr2) {\n if (!Snap.is(arr1, \"array\") || !Snap.is(arr2, \"array\")) {\n return false;\n }\n return arr1.toString() == arr2.toString();\n }\n Element.prototype.equal = function (name, b) {\n return eve(\"snap.util.equal\", this, name, b).firstDefined();\n };\n eve.on(\"snap.util.equal\", function (name, b) {\n var A, B, a = Str(this.attr(name) || \"\"),\n el = this;\n if (names[name] == \"colour\") {\n A = Snap.color(a);\n B = Snap.color(b);\n return {\n from: [A.r, A.g, A.b, A.opacity],\n to: [B.r, B.g, B.b, B.opacity],\n f: getColour\n };\n }\n if (name == \"viewBox\") {\n A = this.attr(name).vb.split(\" \").map(Number);\n B = b.split(\" \").map(Number);\n return {\n from: A,\n to: B,\n f: getViewBox\n };\n }\n if (name == \"transform\" || name == \"gradientTransform\" || name == \"patternTransform\") {\n if (typeof b == \"string\") {\n b = Str(b).replace(/\\.{3}|\\u2026/g, a);\n }\n a = this.matrix;\n if (!Snap._.rgTransform.test(b)) {\n b = Snap._.transform2matrix(Snap._.svgTransform2string(b), this.getBBox());\n } else {\n b = Snap._.transform2matrix(b, this.getBBox());\n }\n return equaliseTransform(a, b, function () {\n return el.getBBox(1);\n });\n }\n if (name == \"d\" || name == \"path\") {\n A = Snap.path.toCubic(a, b);\n return {\n from: path2array(A[0]),\n to: path2array(A[1]),\n f: getPath(A[0])\n };\n }\n if (name == \"points\") {\n A = Str(a).split(Snap._.separator);\n B = Str(b).split(Snap._.separator);\n return {\n from: A,\n to: B,\n f: function (val) { return val; }\n };\n }\n if (isNumeric(a) && isNumeric(b)) {\n return {\n from: parseFloat(a),\n to: parseFloat(b),\n f: getNumber\n };\n }\n var aUnit = a.match(reUnit),\n bUnit = Str(b).match(reUnit);\n if (aUnit && arrayEqual(aUnit, bUnit)) {\n return {\n from: parseFloat(a),\n to: parseFloat(b),\n f: getUnit(aUnit)\n };\n } else {\n return {\n from: this.asPX(name),\n to: this.asPX(name, b),\n f: getNumber\n };\n }\n });\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob) {\n var elproto = Element.prototype,\n has = \"hasOwnProperty\",\n supportsTouch = \"createTouch\" in glob.doc,\n events = [\n \"click\", \"dblclick\", \"mousedown\", \"mousemove\", \"mouseout\",\n \"mouseover\", \"mouseup\", \"touchstart\", \"touchmove\", \"touchend\",\n \"touchcancel\"\n ],\n touchMap = {\n mousedown: \"touchstart\",\n mousemove: \"touchmove\",\n mouseup: \"touchend\"\n },\n getScroll = function (xy, el) {\n var name = xy == \"y\" ? \"scrollTop\" : \"scrollLeft\",\n doc = el && el.node ? el.node.ownerDocument : glob.doc;\n return doc[name in doc.documentElement ? \"documentElement\" : \"body\"][name];\n },\n preventDefault = function () {\n this.returnValue = false;\n },\n preventTouch = function () {\n return this.originalEvent.preventDefault();\n },\n stopPropagation = function () {\n this.cancelBubble = true;\n },\n stopTouch = function () {\n return this.originalEvent.stopPropagation();\n },\n addEvent = function (obj, type, fn, element) {\n var realName = supportsTouch && touchMap[type] ? touchMap[type] : type,\n f = function (e) {\n var scrollY = getScroll(\"y\", element),\n scrollX = getScroll(\"x\", element);\n if (supportsTouch && touchMap[has](type)) {\n for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) {\n if (e.targetTouches[i].target == obj || obj.contains(e.targetTouches[i].target)) {\n var olde = e;\n e = e.targetTouches[i];\n e.originalEvent = olde;\n e.preventDefault = preventTouch;\n e.stopPropagation = stopTouch;\n break;\n }\n }\n }\n var x = e.clientX + scrollX,\n y = e.clientY + scrollY;\n return fn.call(element, e, x, y);\n };\n\n if (type !== realName) {\n obj.addEventListener(type, f, false);\n }\n\n obj.addEventListener(realName, f, false);\n\n return function () {\n if (type !== realName) {\n obj.removeEventListener(type, f, false);\n }\n\n obj.removeEventListener(realName, f, false);\n return true;\n };\n },\n drag = [],\n dragMove = function (e) {\n var x = e.clientX,\n y = e.clientY,\n scrollY = getScroll(\"y\"),\n scrollX = getScroll(\"x\"),\n dragi,\n j = drag.length;\n while (j--) {\n dragi = drag[j];\n if (supportsTouch) {\n var i = e.touches && e.touches.length,\n touch;\n while (i--) {\n touch = e.touches[i];\n if (touch.identifier == dragi.el._drag.id || dragi.el.node.contains(touch.target)) {\n x = touch.clientX;\n y = touch.clientY;\n (e.originalEvent ? e.originalEvent : e).preventDefault();\n break;\n }\n }\n } else {\n e.preventDefault();\n }\n var node = dragi.el.node,\n o,\n next = node.nextSibling,\n parent = node.parentNode,\n display = node.style.display;\n // glob.win.opera && parent.removeChild(node);\n // node.style.display = \"none\";\n // o = dragi.el.paper.getElementByPoint(x, y);\n // node.style.display = display;\n // glob.win.opera && (next ? parent.insertBefore(node, next) : parent.appendChild(node));\n // o && eve(\"snap.drag.over.\" + dragi.el.id, dragi.el, o);\n x += scrollX;\n y += scrollY;\n eve(\"snap.drag.move.\" + dragi.el.id, dragi.move_scope || dragi.el, x - dragi.el._drag.x, y - dragi.el._drag.y, x, y, e);\n }\n },\n dragUp = function (e) {\n Snap.unmousemove(dragMove).unmouseup(dragUp);\n var i = drag.length,\n dragi;\n while (i--) {\n dragi = drag[i];\n dragi.el._drag = {};\n eve(\"snap.drag.end.\" + dragi.el.id, dragi.end_scope || dragi.start_scope || dragi.move_scope || dragi.el, e);\n eve.off(\"snap.drag.*.\" + dragi.el.id);\n }\n drag = [];\n };\n /*\\\n * Element.click\n [ method ]\n **\n * Adds a click event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.unclick\n [ method ]\n **\n * Removes a click event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.dblclick\n [ method ]\n **\n * Adds a double click event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.undblclick\n [ method ]\n **\n * Removes a double click event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.mousedown\n [ method ]\n **\n * Adds a mousedown event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.unmousedown\n [ method ]\n **\n * Removes a mousedown event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.mousemove\n [ method ]\n **\n * Adds a mousemove event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.unmousemove\n [ method ]\n **\n * Removes a mousemove event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.mouseout\n [ method ]\n **\n * Adds a mouseout event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.unmouseout\n [ method ]\n **\n * Removes a mouseout event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.mouseover\n [ method ]\n **\n * Adds a mouseover event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.unmouseover\n [ method ]\n **\n * Removes a mouseover event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.mouseup\n [ method ]\n **\n * Adds a mouseup event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.unmouseup\n [ method ]\n **\n * Removes a mouseup event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.touchstart\n [ method ]\n **\n * Adds a touchstart event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.untouchstart\n [ method ]\n **\n * Removes a touchstart event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.touchmove\n [ method ]\n **\n * Adds a touchmove event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.untouchmove\n [ method ]\n **\n * Removes a touchmove event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.touchend\n [ method ]\n **\n * Adds a touchend event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.untouchend\n [ method ]\n **\n * Removes a touchend event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n \n /*\\\n * Element.touchcancel\n [ method ]\n **\n * Adds a touchcancel event handler to the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n /*\\\n * Element.untouchcancel\n [ method ]\n **\n * Removes a touchcancel event handler from the element\n - handler (function) handler for the event\n = (object) @Element\n \\*/\n for (var i = events.length; i--;) {\n (function (eventName) {\n Snap[eventName] = elproto[eventName] = function (fn, scope) {\n if (Snap.is(fn, \"function\")) {\n this.events = this.events || [];\n this.events.push({\n name: eventName,\n f: fn,\n unbind: addEvent(this.node || document, eventName, fn, scope || this)\n });\n } else {\n for (var i = 0, ii = this.events.length; i < ii; i++) if (this.events[i].name == eventName) {\n try {\n this.events[i].f.call(this);\n } catch (e) {}\n }\n }\n return this;\n };\n Snap[\"un\" + eventName] =\n elproto[\"un\" + eventName] = function (fn) {\n var events = this.events || [],\n l = events.length;\n while (l--) if (events[l].name == eventName &&\n (events[l].f == fn || !fn)) {\n events[l].unbind();\n events.splice(l, 1);\n !events.length && delete this.events;\n return this;\n }\n return this;\n };\n })(events[i]);\n }\n /*\\\n * Element.hover\n [ method ]\n **\n * Adds hover event handlers to the element\n - f_in (function) handler for hover in\n - f_out (function) handler for hover out\n - icontext (object) #optional context for hover in handler\n - ocontext (object) #optional context for hover out handler\n = (object) @Element\n \\*/\n elproto.hover = function (f_in, f_out, scope_in, scope_out) {\n return this.mouseover(f_in, scope_in).mouseout(f_out, scope_out || scope_in);\n };\n /*\\\n * Element.unhover\n [ method ]\n **\n * Removes hover event handlers from the element\n - f_in (function) handler for hover in\n - f_out (function) handler for hover out\n = (object) @Element\n \\*/\n elproto.unhover = function (f_in, f_out) {\n return this.unmouseover(f_in).unmouseout(f_out);\n };\n var draggable = [];\n // SIERRA unclear what _context_ refers to for starting, ending, moving the drag gesture.\n // SIERRA Element.drag(): _x position of the mouse_: Where are the x/y values offset from?\n // SIERRA Element.drag(): much of this member's doc appears to be duplicated for some reason.\n // SIERRA Unclear about this sentence: _Additionally following drag events will be triggered: drag.start.<id> on start, drag.end.<id> on end and drag.move.<id> on every move._ Is there a global _drag_ object to which you can assign handlers keyed by an element's ID?\n /*\\\n * Element.drag\n [ method ]\n **\n * Adds event handlers for an element's drag gesture\n **\n - onmove (function) handler for moving\n - onstart (function) handler for drag start\n - onend (function) handler for drag end\n - mcontext (object) #optional context for moving handler\n - scontext (object) #optional context for drag start handler\n - econtext (object) #optional context for drag end handler\n * Additionaly following `drag` events are triggered: `drag.start.<id>` on start, \n * `drag.end.<id>` on end and `drag.move.<id>` on every move. When element is dragged over another element \n * `drag.over.<id>` fires as well.\n *\n * Start event and start handler are called in specified context or in context of the element with following parameters:\n o x (number) x position of the mouse\n o y (number) y position of the mouse\n o event (object) DOM event object\n * Move event and move handler are called in specified context or in context of the element with following parameters:\n o dx (number) shift by x from the start point\n o dy (number) shift by y from the start point\n o x (number) x position of the mouse\n o y (number) y position of the mouse\n o event (object) DOM event object\n * End event and end handler are called in specified context or in context of the element with following parameters:\n o event (object) DOM event object\n = (object) @Element\n \\*/\n elproto.drag = function (onmove, onstart, onend, move_scope, start_scope, end_scope) {\n var el = this;\n if (!arguments.length) {\n var origTransform;\n return el.drag(function (dx, dy) {\n this.attr({\n transform: origTransform + (origTransform ? \"T\" : \"t\") + [dx, dy]\n });\n }, function () {\n origTransform = this.transform().local;\n });\n }\n function start(e, x, y) {\n (e.originalEvent || e).preventDefault();\n el._drag.x = x;\n el._drag.y = y;\n el._drag.id = e.identifier;\n !drag.length && Snap.mousemove(dragMove).mouseup(dragUp);\n drag.push({el: el, move_scope: move_scope, start_scope: start_scope, end_scope: end_scope});\n onstart && eve.on(\"snap.drag.start.\" + el.id, onstart);\n onmove && eve.on(\"snap.drag.move.\" + el.id, onmove);\n onend && eve.on(\"snap.drag.end.\" + el.id, onend);\n eve(\"snap.drag.start.\" + el.id, start_scope || move_scope || el, x, y, e);\n }\n function init(e, x, y) {\n eve(\"snap.draginit.\" + el.id, el, e, x, y);\n }\n eve.on(\"snap.draginit.\" + el.id, start);\n el._drag = {};\n draggable.push({el: el, start: start, init: init});\n el.mousedown(init);\n return el;\n };\n /*\n * Element.onDragOver\n [ method ]\n **\n * Shortcut to assign event handler for `drag.over.<id>` event, where `id` is the element's `id` (see @Element.id)\n - f (function) handler for event, first argument would be the element you are dragging over\n \\*/\n // elproto.onDragOver = function (f) {\n // f ? eve.on(\"snap.drag.over.\" + this.id, f) : eve.unbind(\"snap.drag.over.\" + this.id);\n // };\n /*\\\n * Element.undrag\n [ method ]\n **\n * Removes all drag event handlers from the given element\n \\*/\n elproto.undrag = function () {\n var i = draggable.length;\n while (i--) if (draggable[i].el == this) {\n this.unmousedown(draggable[i].init);\n draggable.splice(i, 1);\n eve.unbind(\"snap.drag.*.\" + this.id);\n eve.unbind(\"snap.draginit.\" + this.id);\n }\n !draggable.length && Snap.unmousemove(dragMove).unmouseup(dragUp);\n return this;\n };\n});\n\n// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob) {\n var elproto = Element.prototype,\n pproto = Paper.prototype,\n rgurl = /^\\s*url\\((.+)\\)/,\n Str = String,\n $ = Snap._.$;\n Snap.filter = {};\n /*\\\n * Paper.filter\n [ method ]\n **\n * Creates a `<filter>` element\n **\n - filstr (string) SVG fragment of filter provided as a string\n = (object) @Element\n * Note: It is recommended to use filters embedded into the page inside an empty SVG element.\n > Usage\n | var f = paper.filter('<feGaussianBlur stdDeviation=\"2\"/>'),\n | c = paper.circle(10, 10, 10).attr({\n | filter: f\n | });\n \\*/\n pproto.filter = function (filstr) {\n var paper = this;\n if (paper.type != \"svg\") {\n paper = paper.paper;\n }\n var f = Snap.parse(Str(filstr)),\n id = Snap._.id(),\n width = paper.node.offsetWidth,\n height = paper.node.offsetHeight,\n filter = $(\"filter\");\n $(filter, {\n id: id,\n filterUnits: \"userSpaceOnUse\"\n });\n filter.appendChild(f.node);\n paper.defs.appendChild(filter);\n return new Element(filter);\n };\n\n eve.on(\"snap.util.getattr.filter\", function () {\n eve.stop();\n var p = $(this.node, \"filter\");\n if (p) {\n var match = Str(p).match(rgurl);\n return match && Snap.select(match[1]);\n }\n });\n eve.on(\"snap.util.attr.filter\", function (value) {\n if (value instanceof Element && value.type == \"filter\") {\n eve.stop();\n var id = value.node.id;\n if (!id) {\n $(value.node, {id: value.id});\n id = value.id;\n }\n $(this.node, {\n filter: Snap.url(id)\n });\n }\n if (!value || value == \"none\") {\n eve.stop();\n this.node.removeAttribute(\"filter\");\n }\n });\n /*\\\n * Snap.filter.blur\n [ method ]\n **\n * Returns an SVG markup string for the blur filter\n **\n - x (number) amount of horizontal blur, in pixels\n - y (number) #optional amount of vertical blur, in pixels\n = (string) filter representation\n > Usage\n | var f = paper.filter(Snap.filter.blur(5, 10)),\n | c = paper.circle(10, 10, 10).attr({\n | filter: f\n | });\n \\*/\n Snap.filter.blur = function (x, y) {\n if (x == null) {\n x = 2;\n }\n var def = y == null ? x : [x, y];\n return Snap.format('\\<feGaussianBlur stdDeviation=\"{def}\"/>', {\n def: def\n });\n };\n Snap.filter.blur.toString = function () {\n return this();\n };\n /*\\\n * Snap.filter.shadow\n [ method ]\n **\n * Returns an SVG markup string for the shadow filter\n **\n - dx (number) #optional horizontal shift of the shadow, in pixels\n - dy (number) #optional vertical shift of the shadow, in pixels\n - blur (number) #optional amount of blur\n - color (string) #optional color of the shadow\n - opacity (number) #optional `0..1` opacity of the shadow\n * or\n - dx (number) #optional horizontal shift of the shadow, in pixels\n - dy (number) #optional vertical shift of the shadow, in pixels\n - color (string) #optional color of the shadow\n - opacity (number) #optional `0..1` opacity of the shadow\n * which makes blur default to `4`. Or\n - dx (number) #optional horizontal shift of the shadow, in pixels\n - dy (number) #optional vertical shift of the shadow, in pixels\n - opacity (number) #optional `0..1` opacity of the shadow\n = (string) filter representation\n > Usage\n | var f = paper.filter(Snap.filter.shadow(0, 2, .3)),\n | c = paper.circle(10, 10, 10).attr({\n | filter: f\n | });\n \\*/\n Snap.filter.shadow = function (dx, dy, blur, color, opacity) {\n if (opacity == null) {\n if (color == null) {\n opacity = blur;\n blur = 4;\n color = \"#000\";\n } else {\n opacity = color;\n color = blur;\n blur = 4;\n }\n }\n if (blur == null) {\n blur = 4;\n }\n if (opacity == null) {\n opacity = 1;\n }\n if (dx == null) {\n dx = 0;\n dy = 2;\n }\n if (dy == null) {\n dy = dx;\n }\n color = Snap.color(color);\n return Snap.format('<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"{blur}\"/><feOffset dx=\"{dx}\" dy=\"{dy}\" result=\"offsetblur\"/><feFlood flood-color=\"{color}\"/><feComposite in2=\"offsetblur\" operator=\"in\"/><feComponentTransfer><feFuncA type=\"linear\" slope=\"{opacity}\"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in=\"SourceGraphic\"/></feMerge>', {\n color: color,\n dx: dx,\n dy: dy,\n blur: blur,\n opacity: opacity\n });\n };\n Snap.filter.shadow.toString = function () {\n return this();\n };\n /*\\\n * Snap.filter.grayscale\n [ method ]\n **\n * Returns an SVG markup string for the grayscale filter\n **\n - amount (number) amount of filter (`0..1`)\n = (string) filter representation\n \\*/\n Snap.filter.grayscale = function (amount) {\n if (amount == null) {\n amount = 1;\n }\n return Snap.format('<feColorMatrix type=\"matrix\" values=\"{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {b} {h} 0 0 0 0 0 1 0\"/>', {\n a: 0.2126 + 0.7874 * (1 - amount),\n b: 0.7152 - 0.7152 * (1 - amount),\n c: 0.0722 - 0.0722 * (1 - amount),\n d: 0.2126 - 0.2126 * (1 - amount),\n e: 0.7152 + 0.2848 * (1 - amount),\n f: 0.0722 - 0.0722 * (1 - amount),\n g: 0.2126 - 0.2126 * (1 - amount),\n h: 0.0722 + 0.9278 * (1 - amount)\n });\n };\n Snap.filter.grayscale.toString = function () {\n return this();\n };\n /*\\\n * Snap.filter.sepia\n [ method ]\n **\n * Returns an SVG markup string for the sepia filter\n **\n - amount (number) amount of filter (`0..1`)\n = (string) filter representation\n \\*/\n Snap.filter.sepia = function (amount) {\n if (amount == null) {\n amount = 1;\n }\n return Snap.format('<feColorMatrix type=\"matrix\" values=\"{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {h} {i} 0 0 0 0 0 1 0\"/>', {\n a: 0.393 + 0.607 * (1 - amount),\n b: 0.769 - 0.769 * (1 - amount),\n c: 0.189 - 0.189 * (1 - amount),\n d: 0.349 - 0.349 * (1 - amount),\n e: 0.686 + 0.314 * (1 - amount),\n f: 0.168 - 0.168 * (1 - amount),\n g: 0.272 - 0.272 * (1 - amount),\n h: 0.534 - 0.534 * (1 - amount),\n i: 0.131 + 0.869 * (1 - amount)\n });\n };\n Snap.filter.sepia.toString = function () {\n return this();\n };\n /*\\\n * Snap.filter.saturate\n [ method ]\n **\n * Returns an SVG markup string for the saturate filter\n **\n - amount (number) amount of filter (`0..1`)\n = (string) filter representation\n \\*/\n Snap.filter.saturate = function (amount) {\n if (amount == null) {\n amount = 1;\n }\n return Snap.format('<feColorMatrix type=\"saturate\" values=\"{amount}\"/>', {\n amount: 1 - amount\n });\n };\n Snap.filter.saturate.toString = function () {\n return this();\n };\n /*\\\n * Snap.filter.hueRotate\n [ method ]\n **\n * Returns an SVG markup string for the hue-rotate filter\n **\n - angle (number) angle of rotation\n = (string) filter representation\n \\*/\n Snap.filter.hueRotate = function (angle) {\n angle = angle || 0;\n return Snap.format('<feColorMatrix type=\"hueRotate\" values=\"{angle}\"/>', {\n angle: angle\n });\n };\n Snap.filter.hueRotate.toString = function () {\n return this();\n };\n /*\\\n * Snap.filter.invert\n [ method ]\n **\n * Returns an SVG markup string for the invert filter\n **\n - amount (number) amount of filter (`0..1`)\n = (string) filter representation\n \\*/\n Snap.filter.invert = function (amount) {\n if (amount == null) {\n amount = 1;\n }\n// <feColorMatrix type=\"matrix\" values=\"-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0\" color-interpolation-filters=\"sRGB\"/>\n return Snap.format('<feComponentTransfer><feFuncR type=\"table\" tableValues=\"{amount} {amount2}\"/><feFuncG type=\"table\" tableValues=\"{amount} {amount2}\"/><feFuncB type=\"table\" tableValues=\"{amount} {amount2}\"/></feComponentTransfer>', {\n amount: amount,\n amount2: 1 - amount\n });\n };\n Snap.filter.invert.toString = function () {\n return this();\n };\n /*\\\n * Snap.filter.brightness\n [ method ]\n **\n * Returns an SVG markup string for the brightness filter\n **\n - amount (number) amount of filter (`0..1`)\n = (string) filter representation\n \\*/\n Snap.filter.brightness = function (amount) {\n if (amount == null) {\n amount = 1;\n }\n return Snap.format('<feComponentTransfer><feFuncR type=\"linear\" slope=\"{amount}\"/><feFuncG type=\"linear\" slope=\"{amount}\"/><feFuncB type=\"linear\" slope=\"{amount}\"/></feComponentTransfer>', {\n amount: amount\n });\n };\n Snap.filter.brightness.toString = function () {\n return this();\n };\n /*\\\n * Snap.filter.contrast\n [ method ]\n **\n * Returns an SVG markup string for the contrast filter\n **\n - amount (number) amount of filter (`0..1`)\n = (string) filter representation\n \\*/\n Snap.filter.contrast = function (amount) {\n if (amount == null) {\n amount = 1;\n }\n return Snap.format('<feComponentTransfer><feFuncR type=\"linear\" slope=\"{amount}\" intercept=\"{amount2}\"/><feFuncG type=\"linear\" slope=\"{amount}\" intercept=\"{amount2}\"/><feFuncB type=\"linear\" slope=\"{amount}\" intercept=\"{amount2}\"/></feComponentTransfer>', {\n amount: amount,\n amount2: .5 - amount / 2\n });\n };\n Snap.filter.contrast.toString = function () {\n return this();\n };\n});\n\n// Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob, Fragment) {\n var box = Snap._.box,\n is = Snap.is,\n firstLetter = /^[^a-z]*([tbmlrc])/i,\n toString = function () {\n return \"T\" + this.dx + \",\" + this.dy;\n };\n /*\\\n * Element.getAlign\n [ method ]\n **\n * Returns shift needed to align the element relatively to given element.\n * If no elements specified, parent `<svg>` container will be used.\n - el (object) @optional alignment element\n - way (string) one of six values: `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"left\"`, `\"center\"`, `\"right\"`\n = (object|string) Object in format `{dx: , dy: }` also has a string representation as a transformation string\n > Usage\n | el.transform(el.getAlign(el2, \"top\"));\n * or\n | var dy = el.getAlign(el2, \"top\").dy;\n \\*/\n Element.prototype.getAlign = function (el, way) {\n if (way == null && is(el, \"string\")) {\n way = el;\n el = null;\n }\n el = el || this.paper;\n var bx = el.getBBox ? el.getBBox() : box(el),\n bb = this.getBBox(),\n out = {};\n way = way && way.match(firstLetter);\n way = way ? way[1].toLowerCase() : \"c\";\n switch (way) {\n case \"t\":\n out.dx = 0;\n out.dy = bx.y - bb.y;\n break;\n case \"b\":\n out.dx = 0;\n out.dy = bx.y2 - bb.y2;\n break;\n case \"m\":\n out.dx = 0;\n out.dy = bx.cy - bb.cy;\n break;\n case \"l\":\n out.dx = bx.x - bb.x;\n out.dy = 0;\n break;\n case \"r\":\n out.dx = bx.x2 - bb.x2;\n out.dy = 0;\n break;\n default:\n out.dx = bx.cx - bb.cx;\n out.dy = 0;\n break;\n }\n out.toString = toString;\n return out;\n };\n /*\\\n * Element.align\n [ method ]\n **\n * Aligns the element relatively to given one via transformation.\n * If no elements specified, parent `<svg>` container will be used.\n - el (object) @optional alignment element\n - way (string) one of six values: `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"left\"`, `\"center\"`, `\"right\"`\n = (object) this element\n > Usage\n | el.align(el2, \"top\");\n * or\n | el.align(\"middle\");\n \\*/\n Element.prototype.align = function (el, way) {\n return this.transform(\"...\" + this.getAlign(el, way));\n };\n});\n\n// Copyright (c) 2017 Adobe Systems Incorporated. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nSnap.plugin(function (Snap, Element, Paper, glob) {\n // Colours are from https://www.materialui.co\n var red = \"#ffebee#ffcdd2#ef9a9a#e57373#ef5350#f44336#e53935#d32f2f#c62828#b71c1c#ff8a80#ff5252#ff1744#d50000\",\n pink = \"#FCE4EC#F8BBD0#F48FB1#F06292#EC407A#E91E63#D81B60#C2185B#AD1457#880E4F#FF80AB#FF4081#F50057#C51162\",\n purple = \"#F3E5F5#E1BEE7#CE93D8#BA68C8#AB47BC#9C27B0#8E24AA#7B1FA2#6A1B9A#4A148C#EA80FC#E040FB#D500F9#AA00FF\",\n deeppurple = \"#EDE7F6#D1C4E9#B39DDB#9575CD#7E57C2#673AB7#5E35B1#512DA8#4527A0#311B92#B388FF#7C4DFF#651FFF#6200EA\",\n indigo = \"#E8EAF6#C5CAE9#9FA8DA#7986CB#5C6BC0#3F51B5#3949AB#303F9F#283593#1A237E#8C9EFF#536DFE#3D5AFE#304FFE\",\n blue = \"#E3F2FD#BBDEFB#90CAF9#64B5F6#64B5F6#2196F3#1E88E5#1976D2#1565C0#0D47A1#82B1FF#448AFF#2979FF#2962FF\",\n lightblue = \"#E1F5FE#B3E5FC#81D4FA#4FC3F7#29B6F6#03A9F4#039BE5#0288D1#0277BD#01579B#80D8FF#40C4FF#00B0FF#0091EA\",\n cyan = \"#E0F7FA#B2EBF2#80DEEA#4DD0E1#26C6DA#00BCD4#00ACC1#0097A7#00838F#006064#84FFFF#18FFFF#00E5FF#00B8D4\",\n teal = \"#E0F2F1#B2DFDB#80CBC4#4DB6AC#26A69A#009688#00897B#00796B#00695C#004D40#A7FFEB#64FFDA#1DE9B6#00BFA5\",\n green = \"#E8F5E9#C8E6C9#A5D6A7#81C784#66BB6A#4CAF50#43A047#388E3C#2E7D32#1B5E20#B9F6CA#69F0AE#00E676#00C853\",\n lightgreen = \"#F1F8E9#DCEDC8#C5E1A5#AED581#9CCC65#8BC34A#7CB342#689F38#558B2F#33691E#CCFF90#B2FF59#76FF03#64DD17\",\n lime = \"#F9FBE7#F0F4C3#E6EE9C#DCE775#D4E157#CDDC39#C0CA33#AFB42B#9E9D24#827717#F4FF81#EEFF41#C6FF00#AEEA00\",\n yellow = \"#FFFDE7#FFF9C4#FFF59D#FFF176#FFEE58#FFEB3B#FDD835#FBC02D#F9A825#F57F17#FFFF8D#FFFF00#FFEA00#FFD600\",\n amber = \"#FFF8E1#FFECB3#FFE082#FFD54F#FFCA28#FFC107#FFB300#FFA000#FF8F00#FF6F00#FFE57F#FFD740#FFC400#FFAB00\",\n orange = \"#FFF3E0#FFE0B2#FFCC80#FFB74D#FFA726#FF9800#FB8C00#F57C00#EF6C00#E65100#FFD180#FFAB40#FF9100#FF6D00\",\n deeporange = \"#FBE9E7#FFCCBC#FFAB91#FF8A65#FF7043#FF5722#F4511E#E64A19#D84315#BF360C#FF9E80#FF6E40#FF3D00#DD2C00\",\n brown = \"#EFEBE9#D7CCC8#BCAAA4#A1887F#8D6E63#795548#6D4C41#5D4037#4E342E#3E2723\",\n grey = \"#FAFAFA#F5F5F5#EEEEEE#E0E0E0#BDBDBD#9E9E9E#757575#616161#424242#212121\",\n bluegrey = \"#ECEFF1#CFD8DC#B0BEC5#90A4AE#78909C#607D8B#546E7A#455A64#37474F#263238\";\n /*\\\n * Snap.mui\n [ property ]\n **\n * Contain Material UI colours.\n | Snap().rect(0, 0, 10, 10).attr({fill: Snap.mui.deeppurple, stroke: Snap.mui.amber[600]});\n # For colour reference: <a href=\"https://www.materialui.co\">https://www.materialui.co</a>.\n \\*/\n Snap.mui = {};\n /*\\\n * Snap.flat\n [ property ]\n **\n * Contain Flat UI colours.\n | Snap().rect(0, 0, 10, 10).attr({fill: Snap.flat.carrot, stroke: Snap.flat.wetasphalt});\n # For colour reference: <a href=\"https://www.materialui.co\">https://www.materialui.co</a>.\n \\*/\n Snap.flat = {};\n function saveColor(colors) {\n colors = colors.split(/(?=#)/);\n var color = new String(colors[5]);\n color[50] = colors[0];\n color[100] = colors[1];\n color[200] = colors[2];\n color[300] = colors[3];\n color[400] = colors[4];\n color[500] = colors[5];\n color[600] = colors[6];\n color[700] = colors[7];\n color[800] = colors[8];\n color[900] = colors[9];\n if (colors[10]) {\n color.A100 = colors[10];\n color.A200 = colors[11];\n color.A400 = colors[12];\n color.A700 = colors[13];\n }\n return color;\n }\n Snap.mui.red = saveColor(red);\n Snap.mui.pink = saveColor(pink);\n Snap.mui.purple = saveColor(purple);\n Snap.mui.deeppurple = saveColor(deeppurple);\n Snap.mui.indigo = saveColor(indigo);\n Snap.mui.blue = saveColor(blue);\n Snap.mui.lightblue = saveColor(lightblue);\n Snap.mui.cyan = saveColor(cyan);\n Snap.mui.teal = saveColor(teal);\n Snap.mui.green = saveColor(green);\n Snap.mui.lightgreen = saveColor(lightgreen);\n Snap.mui.lime = saveColor(lime);\n Snap.mui.yellow = saveColor(yellow);\n Snap.mui.amber = saveColor(amber);\n Snap.mui.orange = saveColor(orange);\n Snap.mui.deeporange = saveColor(deeporange);\n Snap.mui.brown = saveColor(brown);\n Snap.mui.grey = saveColor(grey);\n Snap.mui.bluegrey = saveColor(bluegrey);\n Snap.flat.turquoise = \"#1abc9c\";\n Snap.flat.greensea = \"#16a085\";\n Snap.flat.sunflower = \"#f1c40f\";\n Snap.flat.orange = \"#f39c12\";\n Snap.flat.emerland = \"#2ecc71\";\n Snap.flat.nephritis = \"#27ae60\";\n Snap.flat.carrot = \"#e67e22\";\n Snap.flat.pumpkin = \"#d35400\";\n Snap.flat.peterriver = \"#3498db\";\n Snap.flat.belizehole = \"#2980b9\";\n Snap.flat.alizarin = \"#e74c3c\";\n Snap.flat.pomegranate = \"#c0392b\";\n Snap.flat.amethyst = \"#9b59b6\";\n Snap.flat.wisteria = \"#8e44ad\";\n Snap.flat.clouds = \"#ecf0f1\";\n Snap.flat.silver = \"#bdc3c7\";\n Snap.flat.wetasphalt = \"#34495e\";\n Snap.flat.midnightblue = \"#2c3e50\";\n Snap.flat.concrete = \"#95a5a6\";\n Snap.flat.asbestos = \"#7f8c8d\";\n /*\\\n * Snap.importMUIColors\n [ method ]\n **\n * Imports Material UI colours into global object.\n | Snap.importMUIColors();\n | Snap().rect(0, 0, 10, 10).attr({fill: deeppurple, stroke: amber[600]});\n # For colour reference: <a href=\"https://www.materialui.co\">https://www.materialui.co</a>.\n \\*/\n Snap.importMUIColors = function () {\n for (var color in Snap.mui) {\n if (Snap.mui.hasOwnProperty(color)) {\n window[color] = Snap.mui[color];\n }\n }\n };\n});\n\nreturn Snap;\n}));\n}.call(window));\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/snapsvg/dist/snap.svg.js\n// module id = 1\n// module chunks = 0","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n * \n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n * \n * All rights reserved.\n * \n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n/* jshint maxcomplexity:11 */\n\n\"use strict\";\n\n\n/*\n * Note\n * ====\n * the structure of this JavaScript version of poly2tri intentionally follows\n * as closely as possible the structure of the reference C++ version, to make it \n * easier to keep the 2 versions in sync.\n */\n\n\n// -------------------------------------------------------------------------Node\n\n/**\n * Advancing front node\n * @constructor\n * @private\n * @struct\n * @param {!XY} p - Point\n * @param {Triangle=} t triangle (optional)\n */\nvar Node = function(p, t) {\n /** @type {XY} */\n this.point = p;\n\n /** @type {Triangle|null} */\n this.triangle = t || null;\n\n /** @type {Node|null} */\n this.next = null;\n /** @type {Node|null} */\n this.prev = null;\n\n /** @type {number} */\n this.value = p.x;\n};\n\n// ---------------------------------------------------------------AdvancingFront\n/**\n * @constructor\n * @private\n * @struct\n * @param {Node} head\n * @param {Node} tail\n */\nvar AdvancingFront = function(head, tail) {\n /** @type {Node} */\n this.head_ = head;\n /** @type {Node} */\n this.tail_ = tail;\n /** @type {Node} */\n this.search_node_ = head;\n};\n\n/** @return {Node} */\nAdvancingFront.prototype.head = function() {\n return this.head_;\n};\n\n/** @param {Node} node */\nAdvancingFront.prototype.setHead = function(node) {\n this.head_ = node;\n};\n\n/** @return {Node} */\nAdvancingFront.prototype.tail = function() {\n return this.tail_;\n};\n\n/** @param {Node} node */\nAdvancingFront.prototype.setTail = function(node) {\n this.tail_ = node;\n};\n\n/** @return {Node} */\nAdvancingFront.prototype.search = function() {\n return this.search_node_;\n};\n\n/** @param {Node} node */\nAdvancingFront.prototype.setSearch = function(node) {\n this.search_node_ = node;\n};\n\n/** @return {Node} */\nAdvancingFront.prototype.findSearchNode = function(/*x*/) {\n // TODO: implement BST index\n return this.search_node_;\n};\n\n/**\n * @param {number} x value\n * @return {Node}\n */\nAdvancingFront.prototype.locateNode = function(x) {\n var node = this.search_node_;\n\n /* jshint boss:true */\n if (x < node.value) {\n while (node = node.prev) {\n if (x >= node.value) {\n this.search_node_ = node;\n return node;\n }\n }\n } else {\n while (node = node.next) {\n if (x < node.value) {\n this.search_node_ = node.prev;\n return node.prev;\n }\n }\n }\n return null;\n};\n\n/**\n * @param {!XY} point - Point\n * @return {Node}\n */\nAdvancingFront.prototype.locatePoint = function(point) {\n var px = point.x;\n var node = this.findSearchNode(px);\n var nx = node.point.x;\n\n if (px === nx) {\n // Here we are comparing point references, not values\n if (point !== node.point) {\n // We might have two nodes with same x value for a short time\n if (point === node.prev.point) {\n node = node.prev;\n } else if (point === node.next.point) {\n node = node.next;\n } else {\n throw new Error('poly2tri Invalid AdvancingFront.locatePoint() call');\n }\n }\n } else if (px < nx) {\n /* jshint boss:true */\n while (node = node.prev) {\n if (point === node.point) {\n break;\n }\n }\n } else {\n while (node = node.next) {\n if (point === node.point) {\n break;\n }\n }\n }\n\n if (node) {\n this.search_node_ = node;\n }\n return node;\n};\n\n\n// ----------------------------------------------------------------------Exports\n\nmodule.exports = AdvancingFront;\nmodule.exports.Node = Node;\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/advancingfront.js\n// module id = 2\n// module chunks = 0","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n * \n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n * \n * All rights reserved.\n * \n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n\"use strict\";\n\n/*\n * Class added in the JavaScript version (was not present in the c++ version)\n */\n\nvar xy = require('./xy');\n\n/**\n * Custom exception class to indicate invalid Point values\n * @constructor\n * @public\n * @extends Error\n * @struct\n * @param {string=} message - error message\n * @param {Array.<XY>=} points - invalid points\n */\nvar PointError = function(message, points) {\n this.name = \"PointError\";\n /**\n * Invalid points\n * @public\n * @type {Array.<XY>}\n */\n this.points = points = points || [];\n /**\n * Error message\n * @public\n * @type {string}\n */\n this.message = message || \"Invalid Points!\";\n for (var i = 0; i < points.length; i++) {\n this.message += \" \" + xy.toString(points[i]);\n }\n};\nPointError.prototype = new Error();\nPointError.prototype.constructor = PointError;\n\n\nmodule.exports = PointError;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/pointerror.js\n// module id = 3\n// module chunks = 0","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n * \n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n *\n * All rights reserved.\n * \n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n/* jshint maxcomplexity:10 */\n\n\"use strict\";\n\n\n/*\n * Note\n * ====\n * the structure of this JavaScript version of poly2tri intentionally follows\n * as closely as possible the structure of the reference C++ version, to make it \n * easier to keep the 2 versions in sync.\n */\n\nvar xy = require(\"./xy\");\n\n\n// ---------------------------------------------------------------------Triangle\n/**\n * Triangle class.<br>\n * Triangle-based data structures are known to have better performance than\n * quad-edge structures.\n * See: J. Shewchuk, \"Triangle: Engineering a 2D Quality Mesh Generator and\n * Delaunay Triangulator\", \"Triangulations in CGAL\"\n *\n * @constructor\n * @struct\n * @param {!XY} pa point object with {x,y}\n * @param {!XY} pb point object with {x,y}\n * @param {!XY} pc point object with {x,y}\n */\nvar Triangle = function(a, b, c) {\n /**\n * Triangle points\n * @private\n * @type {Array.<XY>}\n */\n this.points_ = [a, b, c];\n\n /**\n * Neighbor list\n * @private\n * @type {Array.<Triangle>}\n */\n this.neighbors_ = [null, null, null];\n\n /**\n * Has this triangle been marked as an interior triangle?\n * @private\n * @type {boolean}\n */\n this.interior_ = false;\n\n /**\n * Flags to determine if an edge is a Constrained edge\n * @private\n * @type {Array.<boolean>}\n */\n this.constrained_edge = [false, false, false];\n\n /**\n * Flags to determine if an edge is a Delauney edge\n * @private\n * @type {Array.<boolean>}\n */\n this.delaunay_edge = [false, false, false];\n};\n\nvar p2s = xy.toString;\n/**\n * For pretty printing ex. <code>\"[(5;42)(10;20)(21;30)]\"</code>.\n * @public\n * @return {string}\n */\nTriangle.prototype.toString = function() {\n return (\"[\" + p2s(this.points_[0]) + p2s(this.points_[1]) + p2s(this.points_[2]) + \"]\");\n};\n\n/**\n * Get one vertice of the triangle.\n * The output triangles of a triangulation have vertices which are references\n * to the initial input points (not copies): any custom fields in the\n * initial points can be retrieved in the output triangles.\n * @example\n * var contour = [{x:100, y:100, id:1}, {x:100, y:300, id:2}, {x:300, y:300, id:3}];\n * var swctx = new poly2tri.SweepContext(contour);\n * swctx.triangulate();\n * var triangles = swctx.getTriangles();\n * typeof triangles[0].getPoint(0).id\n * // → \"number\"\n * @param {number} index - vertice index: 0, 1 or 2\n * @public\n * @returns {XY}\n */\nTriangle.prototype.getPoint = function(index) {\n return this.points_[index];\n};\n\n/**\n * For backward compatibility\n * @function\n * @deprecated use {@linkcode Triangle#getPoint} instead\n */\nTriangle.prototype.GetPoint = Triangle.prototype.getPoint;\n\n/**\n * Get all 3 vertices of the triangle as an array\n * @public\n * @return {Array.<XY>}\n */\n// Method added in the JavaScript version (was not present in the c++ version)\nTriangle.prototype.getPoints = function() {\n return this.points_;\n};\n\n/**\n * @private\n * @param {number} index\n * @returns {?Triangle}\n */\nTriangle.prototype.getNeighbor = function(index) {\n return this.neighbors_[index];\n};\n\n/**\n * Test if this Triangle contains the Point object given as parameter as one of its vertices.\n * Only point references are compared, not values.\n * @public\n * @param {XY} point - point object with {x,y}\n * @return {boolean} <code>True</code> if the Point object is of the Triangle's vertices,\n * <code>false</code> otherwise.\n */\nTriangle.prototype.containsPoint = function(point) {\n var points = this.points_;\n // Here we are comparing point references, not values\n return (point === points[0] || point === points[1] || point === points[2]);\n};\n\n/**\n * Test if this Triangle contains the Edge object given as parameter as its\n * bounding edges. Only point references are compared, not values.\n * @private\n * @param {Edge} edge\n * @return {boolean} <code>True</code> if the Edge object is of the Triangle's bounding\n * edges, <code>false</code> otherwise.\n */\nTriangle.prototype.containsEdge = function(edge) {\n return this.containsPoint(edge.p) && this.containsPoint(edge.q);\n};\n\n/**\n * Test if this Triangle contains the two Point objects given as parameters among its vertices.\n * Only point references are compared, not values.\n * @param {XY} p1 - point object with {x,y}\n * @param {XY} p2 - point object with {x,y}\n * @return {boolean}\n */\nTriangle.prototype.containsPoints = function(p1, p2) {\n return this.containsPoint(p1) && this.containsPoint(p2);\n};\n\n/**\n * Has this triangle been marked as an interior triangle?\n * @returns {boolean}\n */\nTriangle.prototype.isInterior = function() {\n return this.interior_;\n};\n\n/**\n * Mark this triangle as an interior triangle\n * @private\n * @param {boolean} interior\n * @returns {Triangle} this\n */\nTriangle.prototype.setInterior = function(interior) {\n this.interior_ = interior;\n return this;\n};\n\n/**\n * Update neighbor pointers.\n * @private\n * @param {XY} p1 - point object with {x,y}\n * @param {XY} p2 - point object with {x,y}\n * @param {Triangle} t Triangle object.\n * @throws {Error} if can't find objects\n */\nTriangle.prototype.markNeighborPointers = function(p1, p2, t) {\n var points = this.points_;\n // Here we are comparing point references, not values\n if ((p1 === points[2] && p2 === points[1]) || (p1 === points[1] && p2 === points[2])) {\n this.neighbors_[0] = t;\n } else if ((p1 === points[0] && p2 === points[2]) || (p1 === points[2] && p2 === points[0])) {\n this.neighbors_[1] = t;\n } else if ((p1 === points[0] && p2 === points[1]) || (p1 === points[1] && p2 === points[0])) {\n this.neighbors_[2] = t;\n } else {\n throw new Error('poly2tri Invalid Triangle.markNeighborPointers() call');\n }\n};\n\n/**\n * Exhaustive search to update neighbor pointers\n * @private\n * @param {!Triangle} t\n */\nTriangle.prototype.markNeighbor = function(t) {\n var points = this.points_;\n if (t.containsPoints(points[1], points[2])) {\n this.neighbors_[0] = t;\n t.markNeighborPointers(points[1], points[2], this);\n } else if (t.containsPoints(points[0], points[2])) {\n this.neighbors_[1] = t;\n t.markNeighborPointers(points[0], points[2], this);\n } else if (t.containsPoints(points[0], points[1])) {\n this.neighbors_[2] = t;\n t.markNeighborPointers(points[0], points[1], this);\n }\n};\n\n\nTriangle.prototype.clearNeighbors = function() {\n this.neighbors_[0] = null;\n this.neighbors_[1] = null;\n this.neighbors_[2] = null;\n};\n\nTriangle.prototype.clearDelaunayEdges = function() {\n this.delaunay_edge[0] = false;\n this.delaunay_edge[1] = false;\n this.delaunay_edge[2] = false;\n};\n\n/**\n * Returns the point clockwise to the given point.\n * @private\n * @param {XY} p - point object with {x,y}\n */\nTriangle.prototype.pointCW = function(p) {\n var points = this.points_;\n // Here we are comparing point references, not values\n if (p === points[0]) {\n return points[2];\n } else if (p === points[1]) {\n return points[0];\n } else if (p === points[2]) {\n return points[1];\n } else {\n return null;\n }\n};\n\n/**\n * Returns the point counter-clockwise to the given point.\n * @private\n * @param {XY} p - point object with {x,y}\n */\nTriangle.prototype.pointCCW = function(p) {\n var points = this.points_;\n // Here we are comparing point references, not values\n if (p === points[0]) {\n return points[1];\n } else if (p === points[1]) {\n return points[2];\n } else if (p === points[2]) {\n return points[0];\n } else {\n return null;\n }\n};\n\n/**\n * Returns the neighbor clockwise to given point.\n * @private\n * @param {XY} p - point object with {x,y}\n */\nTriangle.prototype.neighborCW = function(p) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n return this.neighbors_[1];\n } else if (p === this.points_[1]) {\n return this.neighbors_[2];\n } else {\n return this.neighbors_[0];\n }\n};\n\n/**\n * Returns the neighbor counter-clockwise to given point.\n * @private\n * @param {XY} p - point object with {x,y}\n */\nTriangle.prototype.neighborCCW = function(p) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n return this.neighbors_[2];\n } else if (p === this.points_[1]) {\n return this.neighbors_[0];\n } else {\n return this.neighbors_[1];\n }\n};\n\nTriangle.prototype.getConstrainedEdgeCW = function(p) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n return this.constrained_edge[1];\n } else if (p === this.points_[1]) {\n return this.constrained_edge[2];\n } else {\n return this.constrained_edge[0];\n }\n};\n\nTriangle.prototype.getConstrainedEdgeCCW = function(p) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n return this.constrained_edge[2];\n } else if (p === this.points_[1]) {\n return this.constrained_edge[0];\n } else {\n return this.constrained_edge[1];\n }\n};\n\n// Additional check from Java version (see issue #88)\nTriangle.prototype.getConstrainedEdgeAcross = function(p) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n return this.constrained_edge[0];\n } else if (p === this.points_[1]) {\n return this.constrained_edge[1];\n } else {\n return this.constrained_edge[2];\n }\n};\n\nTriangle.prototype.setConstrainedEdgeCW = function(p, ce) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n this.constrained_edge[1] = ce;\n } else if (p === this.points_[1]) {\n this.constrained_edge[2] = ce;\n } else {\n this.constrained_edge[0] = ce;\n }\n};\n\nTriangle.prototype.setConstrainedEdgeCCW = function(p, ce) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n this.constrained_edge[2] = ce;\n } else if (p === this.points_[1]) {\n this.constrained_edge[0] = ce;\n } else {\n this.constrained_edge[1] = ce;\n }\n};\n\nTriangle.prototype.getDelaunayEdgeCW = function(p) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n return this.delaunay_edge[1];\n } else if (p === this.points_[1]) {\n return this.delaunay_edge[2];\n } else {\n return this.delaunay_edge[0];\n }\n};\n\nTriangle.prototype.getDelaunayEdgeCCW = function(p) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n return this.delaunay_edge[2];\n } else if (p === this.points_[1]) {\n return this.delaunay_edge[0];\n } else {\n return this.delaunay_edge[1];\n }\n};\n\nTriangle.prototype.setDelaunayEdgeCW = function(p, e) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n this.delaunay_edge[1] = e;\n } else if (p === this.points_[1]) {\n this.delaunay_edge[2] = e;\n } else {\n this.delaunay_edge[0] = e;\n }\n};\n\nTriangle.prototype.setDelaunayEdgeCCW = function(p, e) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n this.delaunay_edge[2] = e;\n } else if (p === this.points_[1]) {\n this.delaunay_edge[0] = e;\n } else {\n this.delaunay_edge[1] = e;\n }\n};\n\n/**\n * The neighbor across to given point.\n * @private\n * @param {XY} p - point object with {x,y}\n * @returns {Triangle}\n */\nTriangle.prototype.neighborAcross = function(p) {\n // Here we are comparing point references, not values\n if (p === this.points_[0]) {\n return this.neighbors_[0];\n } else if (p === this.points_[1]) {\n return this.neighbors_[1];\n } else {\n return this.neighbors_[2];\n }\n};\n\n/**\n * @private\n * @param {!Triangle} t Triangle object.\n * @param {XY} p - point object with {x,y}\n */\nTriangle.prototype.oppositePoint = function(t, p) {\n var cw = t.pointCW(p);\n return this.pointCW(cw);\n};\n\n/**\n * Legalize triangle by rotating clockwise around oPoint\n * @private\n * @param {XY} opoint - point object with {x,y}\n * @param {XY} npoint - point object with {x,y}\n * @throws {Error} if oPoint can not be found\n */\nTriangle.prototype.legalize = function(opoint, npoint) {\n var points = this.points_;\n // Here we are comparing point references, not values\n if (opoint === points[0]) {\n points[1] = points[0];\n points[0] = points[2];\n points[2] = npoint;\n } else if (opoint === points[1]) {\n points[2] = points[1];\n points[1] = points[0];\n points[0] = npoint;\n } else if (opoint === points[2]) {\n points[0] = points[2];\n points[2] = points[1];\n points[1] = npoint;\n } else {\n throw new Error('poly2tri Invalid Triangle.legalize() call');\n }\n};\n\n/**\n * Returns the index of a point in the triangle. \n * The point *must* be a reference to one of the triangle's vertices.\n * @private\n * @param {XY} p - point object with {x,y}\n * @returns {number} index 0, 1 or 2\n * @throws {Error} if p can not be found\n */\nTriangle.prototype.index = function(p) {\n var points = this.points_;\n // Here we are comparing point references, not values\n if (p === points[0]) {\n return 0;\n } else if (p === points[1]) {\n return 1;\n } else if (p === points[2]) {\n return 2;\n } else {\n throw new Error('poly2tri Invalid Triangle.index() call');\n }\n};\n\n/**\n * @private\n * @param {XY} p1 - point object with {x,y}\n * @param {XY} p2 - point object with {x,y}\n * @return {number} index 0, 1 or 2, or -1 if errror\n */\nTriangle.prototype.edgeIndex = function(p1, p2) {\n var points = this.points_;\n // Here we are comparing point references, not values\n if (p1 === points[0]) {\n if (p2 === points[1]) {\n return 2;\n } else if (p2 === points[2]) {\n return 1;\n }\n } else if (p1 === points[1]) {\n if (p2 === points[2]) {\n return 0;\n } else if (p2 === points[0]) {\n return 2;\n }\n } else if (p1 === points[2]) {\n if (p2 === points[0]) {\n return 1;\n } else if (p2 === points[1]) {\n return 0;\n }\n }\n return -1;\n};\n\n/**\n * Mark an edge of this triangle as constrained.\n * @private\n * @param {number} index - edge index\n */\nTriangle.prototype.markConstrainedEdgeByIndex = function(index) {\n this.constrained_edge[index] = true;\n};\n/**\n * Mark an edge of this triangle as constrained.\n * @private\n * @param {Edge} edge instance\n */\nTriangle.prototype.markConstrainedEdgeByEdge = function(edge) {\n this.markConstrainedEdgeByPoints(edge.p, edge.q);\n};\n/**\n * Mark an edge of this triangle as constrained.\n * This method takes two Point instances defining the edge of the triangle.\n * @private\n * @param {XY} p - point object with {x,y}\n * @param {XY} q - point object with {x,y}\n */\nTriangle.prototype.markConstrainedEdgeByPoints = function(p, q) {\n var points = this.points_;\n // Here we are comparing point references, not values \n if ((q === points[0] && p === points[1]) || (q === points[1] && p === points[0])) {\n this.constrained_edge[2] = true;\n } else if ((q === points[0] && p === points[2]) || (q === points[2] && p === points[0])) {\n this.constrained_edge[1] = true;\n } else if ((q === points[1] && p === points[2]) || (q === points[2] && p === points[1])) {\n this.constrained_edge[0] = true;\n }\n};\n\n\n// ---------------------------------------------------------Exports (public API)\n\nmodule.exports = Triangle;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/triangle.js\n// module id = 4\n// module chunks = 0","// Copyright 2014-2016 Todd Fleming\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n// TODO: pass React elements to alertFn\n\n\"use strict\";\n\nimport ClipperLib from 'clipper-lib';\nimport SweepContext from 'poly2tri/src/sweepcontext';\n\nexport const inchToClipperScale = 1270000000;\nexport const mmToClipperScale = inchToClipperScale / 25.4; // 50000000;\nexport const clipperToCppScale = 1 / 128; // Prevent overflow for coordinates up to ~1000 mm\nexport const cleanPolyDist = 100;\nexport const arcTolerance = 10000;\n\n// Linearize a cubic bezier. Returns ['L', x2, y2, x3, y3, ...]. The return value doesn't\n// include (p1x, p1y); it's part of the previous segment.\nfunction linearizeCubicBezier(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, minNumSegments, minSegmentLength) {\n function bez(p0, p1, p2, p3, t) {\n return (1 - t) * (1 - t) * (1 - t) * p0 + 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t * p3;\n }\n\n if (p1x == c1x && p1y == c1y && p2x == c2x && p2y == c2y)\n return ['L', p2x, p2y];\n\n let numSegments = minNumSegments;\n while (true) {\n let x = p1x;\n let y = p1y;\n let result = ['L'];\n for (let i = 1; i <= numSegments; ++i) {\n let t = 1.0 * i / numSegments;\n let nextX = bez(p1x, c1x, c2x, p2x, t);\n let nextY = bez(p1y, c1y, c2y, p2y, t);\n if ((nextX - x) * (nextX - x) + (nextY - y) * (nextY - y) > minSegmentLength * minSegmentLength) {\n numSegments *= 2;\n result = null;\n break;\n }\n result.push(nextX, nextY);\n x = nextX;\n y = nextY;\n }\n if (result)\n return result;\n }\n}\n\n// Linearize a path. Both the input path and the returned path are in snap.svg's format.\n// Calls alertFn with an error message and returns null if there's a problem.\nfunction linearizeSnapPath(path, minNumSegments, minSegmentLength, alertFn) {\n if (path.length < 2 || path[0].length != 3 || path[0][0] != 'M') {\n alertFn('Path does not begin with M')\n return null;\n }\n let x = path[0][1];\n let y = path[0][2];\n let result = [path[0]];\n for (let i = 1; i < path.length; ++i) {\n let subpath = path[i];\n if (subpath[0] == 'C' && subpath.length == 7) {\n result.push(linearizeCubicBezier(\n x, y, subpath[1], subpath[2], subpath[3], subpath[4], subpath[5], subpath[6], minNumSegments, minSegmentLength));\n x = subpath[5];\n y = subpath[6];\n } else if (subpath[0] == 'M' && subpath.length == 3) {\n result.push(subpath);\n x = subpath[1];\n y = subpath[2];\n } else {\n alertFn('Subpath has an unknown prefix: ' + subpath[0]);\n return null;\n }\n }\n return result;\n};\n\n// Get linear paths (snap format) from an SVG element. Calls alertFn with an\n// error message and returns null if there's a problem.\nfunction elementToLinearSnapPaths(element, minNumSegments, minSegmentLength, alertFn) {\n let path = null;\n let Snap = require('snapsvg');\n let snapElement = Snap(element);\n\n if (snapElement.type == 'path')\n path = snapElement.attr('d');\n else if (snapElement.type == 'rect') {\n let x = Number(snapElement.attr('x'));\n let y = Number(snapElement.attr('y'));\n let w = Number(snapElement.attr('width'));\n let h = Number(snapElement.attr('height'));\n path = 'm' + x + ',' + y + ' ' + w + ',' + 0 + ' ' + 0 + ',' + h + ' ' + (-w) + ',' + 0 + ' ' + 0 + ',' + (-h) + ' ';\n }\n else {\n alertFn('<b>' + snapElement.type + \"</b> is not supported; try Inkscape's <strong>Object to Path</strong> command\");\n return null;\n }\n\n if (snapElement.attr('clip-path') != '') {\n alertFn('clip-path is not supported');\n return null;\n }\n\n if (snapElement.attr('mask') != '') {\n alertFn('mask is not supported');\n return null;\n }\n\n if (path == null) {\n alertFn('path is missing');\n return;\n }\n\n path = Snap.path.map(path, snapElement.transform().globalMatrix);\n path = Snap.parsePathString(path);\n path = linearizeSnapPath(path, minNumSegments, minSegmentLength, alertFn);\n return path;\n};\n\n// Convert a path in snap.svg format to [[x0, y0, x1, y1, ...], ...].\n// Result is in mm. Returns multiple paths. Only supports linear paths.\n// Calls alertFn with an error message and returns null if there's a problem.\nfunction snapPathToRawPaths(snapPath, pxPerInch, alertFn) {\n let factor = 2540 / (pxPerInch * 100);\n if (snapPath.length < 2 || snapPath[0].length != 3 || snapPath[0][0] != 'M') {\n alertFn('Path does not begin with M');\n return null;\n }\n let currentPath = [snapPath[0][1] * factor, snapPath[0][2] * factor];\n let result = [currentPath];\n for (let i = 1; i < snapPath.length; ++i) {\n let subpath = snapPath[i];\n if (subpath[0] == 'M' && subpath.length == 3) {\n currentPath = [subpath[1] * factor, subpath[2] * factor];\n result.push(currentPath);\n } else if (subpath[0] == 'L') {\n for (let j = 0; j < (subpath.length - 1) / 2; ++j)\n currentPath.push(subpath[1 + j * 2] * factor, subpath[2 + j * 2] * factor);\n } else {\n alertFn('Subpath has a non-linear prefix: ' + subpath[0]);\n return null;\n }\n }\n return result;\n};\n\n// Convert a path in an SVG element to [[x0, y0, x1, y1, ...], ...].\n// Result is in mm. Returns multiple paths. Converts curves.\n// Calls alertFn with an error message and returns null if there's a problem.\nexport function elementToRawPaths(element, pxPerInch, minNumSegments, minSegmentLength, alertFn) {\n let path = elementToLinearSnapPaths(element, minNumSegments, minSegmentLength, alertFn);\n if (path !== null)\n return snapPathToRawPaths(path, pxPerInch, alertFn);\n return null;\n}\n\n// Convert an SVG path string to [[x0, y0, x1, y1, ...], ...].\n// Result is in mm. Returns multiple paths. Converts curves.\n// Calls alertFn with an error message and returns null if there's a problem.\nexport function pathStrToRawPaths(str, pxPerInch, minNumSegments, minSegmentLength, alertFn) {\n let Snap = require('snapsvg');\n let path = Snap.parsePathString(str);\n path = Snap.path.toCubic(path);\n path = linearizeSnapPath(path, minNumSegments, minSegmentLength, alertFn);\n if (path !== null)\n return snapPathToRawPaths(path, pxPerInch, alertFn);\n return null;\n}\n\n// [[[x0, y0, x1, y1, ...], ...], ...]\nexport function flipY(allRawPaths, deltaY) {\n for (let rawPaths of allRawPaths)\n for (let rawPath of rawPaths)\n for (let i = 0; i < rawPath.length; i += 2)\n rawPath[i + 1] = deltaY - rawPath[i + 1];\n}\n\nexport function hasClosedRawPaths(rawPaths) {\n for (let path of rawPaths)\n if (path.length >= 4 && path[0] == path[path.length - 2] && path[1] == path[path.length - 1])\n return true;\n return false;\n}\n\nexport function filterClosedRawPaths(rawPaths) {\n let result = [];\n for (let path of rawPaths)\n if (path.length >= 4 && path[0] == path[path.length - 2] && path[1] == path[path.length - 1])\n result.push(path);\n return result;\n}\n\nexport function rawPathsToClipperPaths(rawPaths, transform) {\n let result = rawPaths.map(p => {\n let result = [];\n for (let i = 0; i < p.length; i += 2) {\n result.push({\n X: (transform[0] * p[i] + transform[2] * p[i + 1] + transform[4]) * mmToClipperScale,\n Y: (transform[1] * p[i] + transform[3] * p[i + 1] + transform[5]) * mmToClipperScale,\n });\n }\n return result;\n });\n if (hasClosedRawPaths(rawPaths)) {\n result = ClipperLib.Clipper.CleanPolygons(result, cleanPolyDist);\n result = ClipperLib.Clipper.SimplifyPolygons(result, ClipperLib.PolyFillType.pftEvenOdd);\n }\n return result;\n}\n\nfunction clipperPathsToPolyTree(paths) {\n let c = new ClipperLib.Clipper();\n c.AddPaths(paths, ClipperLib.PolyType.ptSubject, true);\n let polyTree = new ClipperLib.PolyTree();\n c.Execute(ClipperLib.ClipType.ctUnion, polyTree, ClipperLib.PolyFillType.pftEvenOdd, ClipperLib.PolyFillType.pftEvenOdd);\n return polyTree;\n}\n\nfunction triangulatePolyTree(polyTree) {\n let result = [];\n let pointToVertex = point => ({ x: point.X / mmToClipperScale, y: point.Y / mmToClipperScale });\n let contourToVertexes = path => path.map(pointToVertex);\n let nodesToVertexes = nodes => nodes.map(node => contourToVertexes(node.Contour()));\n let processNode = node => {\n let vertexes = contourToVertexes(node.Contour());\n let holes = nodesToVertexes(node.Childs());\n let context = new SweepContext(vertexes);\n context.addHoles(holes);\n context.triangulate();\n let triangles = context.getTriangles();\n for (let t of triangles) {\n let p = t.getPoints();\n result.push(\n p[0].x, p[0].y,\n p[1].x, p[1].y,\n p[2].x, p[2].y);\n }\n for (let hole of node.Childs()) {\n for (let next of hole.Childs()) {\n processNode(next);\n }\n }\n };\n for (let node of polyTree.Childs()) {\n processNode(node);\n }\n return result;\n}\n\nexport function triangulateRawPaths(rawPaths) {\n return triangulatePolyTree(clipperPathsToPolyTree(rawPathsToClipperPaths(rawPaths, [1, 0, 0, 1, 0, 0])));\n}\n\n// Convert Clipper paths to C. Returns [double** cPaths, int cNumPaths, int* cPathSizes].\nexport function clipperPathsToCPaths(memoryBlocks, clipperPaths) {\n let doubleSize = 8;\n\n let cPaths = Module._malloc(clipperPaths.length * 4);\n memoryBlocks.push(cPaths);\n let cPathsBase = cPaths >> 2;\n\n let cPathSizes = Module._malloc(clipperPaths.length * 4);\n memoryBlocks.push(cPathSizes);\n let cPathSizesBase = cPathSizes >> 2;\n\n for (let i = 0; i < clipperPaths.length; ++i) {\n let clipperPath = clipperPaths[i];\n\n let cPath = Module._malloc(clipperPath.length * 2 * doubleSize + 4);\n memoryBlocks.push(cPath);\n if (cPath & 4)\n cPath += 4;\n //console.log(\"-> \" + cPath.toString(16));\n let pathArray = new Float64Array(Module.HEAPU32.buffer, Module.HEAPU32.byteOffset + cPath);\n\n for (let j = 0; j < clipperPath.length; ++j) {\n let point = clipperPath[j];\n pathArray[j * 2] = point.X * clipperToCppScale;\n pathArray[j * 2 + 1] = point.Y * clipperToCppScale;\n }\n\n Module.HEAPU32[cPathsBase + i] = cPath;\n Module.HEAPU32[cPathSizesBase + i] = clipperPath.length;\n }\n\n return [cPaths, clipperPaths.length, cPathSizes];\n}\n\n// Convert C paths to Clipper paths. double**& cPathsRef, int& cNumPathsRef, int*& cPathSizesRef\n// Each point has X, Y (stride = 2).\nexport function cPathsToClipperPaths(memoryBlocks, cPathsRef, cNumPathsRef, cPathSizesRef) {\n let cPaths = Module.HEAPU32[cPathsRef >> 2];\n memoryBlocks.push(cPaths);\n let cPathsBase = cPaths >> 2;\n\n let cNumPaths = Module.HEAPU32[cNumPathsRef >> 2];\n\n let cPathSizes = Module.HEAPU32[cPathSizesRef >> 2];\n memoryBlocks.push(cPathSizes);\n let cPathSizesBase = cPathSizes >> 2;\n\n let clipperPaths = [];\n for (let i = 0; i < cNumPaths; ++i) {\n let pathSize = Module.HEAPU32[cPathSizesBase + i];\n let cPath = Module.HEAPU32[cPathsBase + i];\n // cPath contains value to pass to Module._free(). The aligned version contains the actual data.\n memoryBlocks.push(cPath);\n if (cPath & 4)\n cPath += 4;\n let pathArray = new Float64Array(Module.HEAPU32.buffer, Module.HEAPU32.byteOffset + cPath);\n\n let clipperPath = [];\n clipperPaths.push(clipperPath);\n for (let j = 0; j < pathSize; ++j)\n clipperPath.push({\n X: pathArray[j * 2] / clipperToCppScale,\n Y: pathArray[j * 2 + 1] / clipperToCppScale,\n });\n }\n\n return clipperPaths;\n}\n\n// Convert C paths to array of CamPath. double**& cPathsRef, int& cNumPathsRef, int*& cPathSizesRef\n// Each point has X, Y, Z (stride = 3).\nexport function cPathsToCamPaths(memoryBlocks, cPathsRef, cNumPathsRef, cPathSizesRef) {\n let cPaths = Module.HEAPU32[cPathsRef >> 2];\n memoryBlocks.push(cPaths);\n let cPathsBase = cPaths >> 2;\n\n let cNumPaths = Module.HEAPU32[cNumPathsRef >> 2];\n\n let cPathSizes = Module.HEAPU32[cPathSizesRef >> 2];\n memoryBlocks.push(cPathSizes);\n let cPathSizesBase = cPathSizes >> 2;\n\n let convertedPaths = [];\n for (let i = 0; i < cNumPaths; ++i) {\n let pathSize = Module.HEAPU32[cPathSizesBase + i];\n let cPath = Module.HEAPU32[cPathsBase + i];\n // cPath contains value to pass to Module._free(). The aligned version contains the actual data.\n memoryBlocks.push(cPath);\n if (cPath & 4)\n cPath += 4;\n let pathArray = new Float64Array(Module.HEAPU32.buffer, Module.HEAPU32.byteOffset + cPath);\n\n let convertedPath = [];\n convertedPaths.push({ path: convertedPath, safeToClose: false });\n for (let j = 0; j < pathSize; ++j)\n convertedPath.push({\n X: pathArray[j * 3] / clipperToCppScale,\n Y: pathArray[j * 3 + 1] / clipperToCppScale,\n Z: pathArray[j * 3 + 2] / clipperToCppScale,\n });\n\n //console.log('got: path', i, ':', pathArray[0], pathArray[1], pathArray[2]);\n }\n\n return convertedPaths;\n}\n\nexport function clipperBounds(paths) {\n let minX = Number.MAX_VALUE;\n let minY = Number.MAX_VALUE;\n let maxX = -Number.MAX_VALUE;\n let maxY = -Number.MAX_VALUE;\n for (let path of paths) {\n for (let pt of path) {\n minX = Math.min(minX, pt.X);\n maxX = Math.max(maxX, pt.X);\n minY = Math.min(minY, pt.Y);\n maxY = Math.max(maxY, pt.Y);\n }\n }\n return { minX, minY, maxX, maxY };\n}\n\n// Clip Clipper geometry. clipType is a ClipperLib.ClipType constant. Returns new geometry.\nexport function clip(paths1, paths2, clipType) {\n var clipper = new ClipperLib.Clipper();\n clipper.AddPaths(paths1, ClipperLib.PolyType.ptSubject, true);\n clipper.AddPaths(paths2, ClipperLib.PolyType.ptClip, true);\n var result = [];\n clipper.Execute(clipType, result, ClipperLib.PolyFillType.pftEvenOdd, ClipperLib.PolyFillType.pftEvenOdd);\n return result;\n}\n\n// Return union of two Clipper geometries. Returns new geometry.\nexport function union(paths1, paths2) {\n return clip(paths1, paths2, ClipperLib.ClipType.ctUnion);\n}\n\n// Return difference between two Clipper geometries. Returns new geometry.\nexport function diff(paths1, paths2) {\n return clip(paths1, paths2, ClipperLib.ClipType.ctDifference);\n}\n\n// Return xor of two Clipper geometries. Returns new geometry.\nexport function xor(paths1, paths2) {\n return clip(paths1, paths2, ClipperLib.ClipType.ctXor);\n}\n\n// Offset Clipper geometries by amount (positive expands, negative shrinks). Returns new geometry.\nexport function offset(paths, amount, joinType, endType) {\n if (joinType === undefined)\n joinType = ClipperLib.JoinType.jtRound;\n if (endType === undefined)\n endType = ClipperLib.EndType.etClosedPolygon;\n\n // bug workaround: join types are swapped in ClipperLib 6.1.3.2\n if (joinType === ClipperLib.JoinType.jtSquare)\n joinType = ClipperLib.JoinType.jtMiter;\n else if (joinType === ClipperLib.JoinType.jtMiter)\n joinType = ClipperLib.JoinType.jtSquare;\n\n var co = new ClipperLib.ClipperOffset(2, arcTolerance);\n co.AddPaths(paths, joinType, endType);\n var offsetted = [];\n co.Execute(offsetted, amount);\n return offsetted;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/mesh.js","import { rawPathsToClipperPaths, union, xor } from '../mesh';\n\n\nself.onmessage = (event) => {\n\n const jobs = [];\n\n let { settings, opIndex, op, geometry, openGeometry, tabGeometry, documents } = event.data;\n\n const filteredDocIds = new Set();\n const docsWithImages = []\n\n function matchColor(filterColor, color) {\n if (!filterColor)\n return true;\n if (!color)\n return false;\n return filterColor[0] == color[0] && filterColor[1] == color[1] && filterColor[2] == color[2] && filterColor[3] == color[3];\n }\n\n function examineDocTree(isTab, id) {\n let doc = documents.find(d => d.id === id);\n if (doc.rawPaths) {\n jobs.push((cb) => {\n if (isTab) {\n tabGeometry = union(tabGeometry, rawPathsToClipperPaths(doc.rawPaths, doc.transform2d));\n } else if (matchColor(op.filterFillColor, doc.fillColor) && matchColor(op.filterStrokeColor, doc.strokeColor)) {\n filteredDocIds.add(doc.id);\n if (!op.type.includes('Raster')) {\n let isClosed = false;\n for (let rawPath of doc.rawPaths)\n if (rawPath.length >= 4 && rawPath[0] == rawPath[rawPath.length - 2] && rawPath[1] == rawPath[rawPath.length - 1])\n isClosed = true;\n let clipperPaths = rawPathsToClipperPaths(doc.rawPaths, doc.transform2d);\n if (isClosed)\n geometry = xor(geometry, clipperPaths);\n else if (!op.filterFillColor)\n openGeometry = openGeometry.concat(clipperPaths);\n }\n }\n cb()\n })\n }\n if (doc.type === 'image' && !isTab) {\n filteredDocIds.add(doc.id);\n docsWithImages.push(doc)\n }\n for (let child of doc.children)\n examineDocTree(isTab, child);\n }\n for (let id of op.documents)\n examineDocTree(false, id);\n for (let id of op.tabDocuments)\n examineDocTree(true, id);\n\n let chunk = 100 / jobs.length;\n var percent = 0;\n\n while (jobs.length) {\n try {\n let job = jobs.shift()\n if (job) job(() => {\n percent = percent + chunk\n postMessage({ event: \"onProgress\", percent: parseInt(percent) })\n });\n } catch (error) {\n console.error(error)\n postMessage({ event: \"onError\", message: \"Something wrong has happened, sorry.\", level: \"error\", error: error.toString() })\n }\n }\n\n postMessage({ event: \"onDone\", settings, opIndex, op, geometry, openGeometry, tabGeometry, filteredDocIds, docsWithImages })\n self.close();\n}\n\n\n// WEBPACK FOOTER //\n// ./lib/workers/cam-preflight.js","/*******************************************************************************\n * *\n * Author : Angus Johnson *\n * Version : 6.4.2 *\n * Date : 27 February 2017 *\n * Website : http://www.angusj.com *\n * Copyright : Angus Johnson 2010-2017 *\n * *\n * License: *\n * Use, modification & distribution is subject to Boost Software License Ver 1. *\n * http://www.boost.org/LICENSE_1_0.txt *\n * *\n * Attributions: *\n * The code in this library is an extension of Bala Vatti's clipping algorithm: *\n * \"A generic solution to polygon clipping\" *\n * Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. *\n * http://portal.acm.org/citation.cfm?id=129906 *\n * *\n * Computer graphics and geometric modeling: implementation and algorithms *\n * By Max K. Agoston *\n * Springer; 1 edition (January 4, 2005) *\n * http://books.google.com/books?q=vatti+clipping+agoston *\n * *\n * See also: *\n * \"Polygon Offsetting by Computing Winding Numbers\" *\n * Paper no. DETC2005-85513 pp. 565-575 *\n * ASME 2005 International Design Engineering Technical Conferences *\n * and Computers and Information in Engineering Conference (IDETC/CIE2005) *\n * September 24-28, 2005 , Long Beach, California, USA *\n * http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf *\n * *\n *******************************************************************************/\n/*******************************************************************************\n * *\n * Author : Timo *\n * Version : 6.4.2.2 *\n * Date : 8 September 2017 *\n * *\n * This is a translation of the C# Clipper library to Javascript. *\n * Int128 struct of C# is implemented using JSBN of Tom Wu. *\n * Because Javascript lacks support for 64-bit integers, the space *\n * is a little more restricted than in C# version. *\n * *\n * C# version has support for coordinate space: *\n * +-4611686018427387903 ( sqrt(2^127 -1)/2 ) *\n * while Javascript version has support for space: *\n * +-4503599627370495 ( sqrt(2^106 -1)/2 ) *\n * *\n * Tom Wu's JSBN proved to be the fastest big integer library: *\n * http://jsperf.com/big-integer-library-test *\n * *\n * This class can be made simpler when (if ever) 64-bit integer support comes *\n * or floating point Clipper is released. *\n * *\n *******************************************************************************/\n/*******************************************************************************\n * *\n * Basic JavaScript BN library - subset useful for RSA encryption. *\n * http://www-cs-students.stanford.edu/~tjw/jsbn/ *\n * Copyright (c) 2005 Tom Wu *\n * All Rights Reserved. *\n * See \"LICENSE\" for details: *\n * http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE *\n * *\n *******************************************************************************/\n(function ()\n{\n\t\"use strict\";\n\tvar ClipperLib = {};\n\tClipperLib.version = '6.4.2.2';\n\n\t//UseLines: Enables open path clipping. Adds a very minor cost to performance.\n\tClipperLib.use_lines = true;\n\n\t//ClipperLib.use_xyz: adds a Z member to IntPoint. Adds a minor cost to performance.\n\tClipperLib.use_xyz = false;\n\n\tvar isNode = false;\n\tif (typeof module !== 'undefined' && module.exports)\n\t{\n\t\tmodule.exports = ClipperLib;\n\t\tisNode = true;\n\t}\n\telse\n\t{\n\t\tif (typeof define === 'function' && define.amd) {\n\t\t\tdefine(ClipperLib);\n\t\t}\n\t\tif (typeof (document) !== \"undefined\") window.ClipperLib = ClipperLib;\n\t\telse self['ClipperLib'] = ClipperLib;\n\t}\n\tvar navigator_appName;\n\tif (!isNode)\n\t{\n\t\tvar nav = navigator.userAgent.toString().toLowerCase();\n\t\tnavigator_appName = navigator.appName;\n\t}\n\telse\n\t{\n\t\tvar nav = \"chrome\"; // Node.js uses Chrome's V8 engine\n\t\tnavigator_appName = \"Netscape\"; // Firefox, Chrome and Safari returns \"Netscape\", so Node.js should also\n\t}\n\t// Browser test to speedup performance critical functions\n\tvar browser = {};\n\n\tif (nav.indexOf(\"chrome\") != -1 && nav.indexOf(\"chromium\") == -1) browser.chrome = 1;\n\telse browser.chrome = 0;\n\tif (nav.indexOf(\"chromium\") != -1) browser.chromium = 1;\n\telse browser.chromium = 0;\n\tif (nav.indexOf(\"safari\") != -1 && nav.indexOf(\"chrome\") == -1 && nav.indexOf(\"chromium\") == -1) browser.safari = 1;\n\telse browser.safari = 0;\n\tif (nav.indexOf(\"firefox\") != -1) browser.firefox = 1;\n\telse browser.firefox = 0;\n\tif (nav.indexOf(\"firefox/17\") != -1) browser.firefox17 = 1;\n\telse browser.firefox17 = 0;\n\tif (nav.indexOf(\"firefox/15\") != -1) browser.firefox15 = 1;\n\telse browser.firefox15 = 0;\n\tif (nav.indexOf(\"firefox/3\") != -1) browser.firefox3 = 1;\n\telse browser.firefox3 = 0;\n\tif (nav.indexOf(\"opera\") != -1) browser.opera = 1;\n\telse browser.opera = 0;\n\tif (nav.indexOf(\"msie 10\") != -1) browser.msie10 = 1;\n\telse browser.msie10 = 0;\n\tif (nav.indexOf(\"msie 9\") != -1) browser.msie9 = 1;\n\telse browser.msie9 = 0;\n\tif (nav.indexOf(\"msie 8\") != -1) browser.msie8 = 1;\n\telse browser.msie8 = 0;\n\tif (nav.indexOf(\"msie 7\") != -1) browser.msie7 = 1;\n\telse browser.msie7 = 0;\n\tif (nav.indexOf(\"msie \") != -1) browser.msie = 1;\n\telse browser.msie = 0;\n\tClipperLib.biginteger_used = null;\n\n\t// Copyright (c) 2005 Tom Wu\n\t// All Rights Reserved.\n\t// See \"LICENSE\" for details.\n\t// Basic JavaScript BN library - subset useful for RSA encryption.\n\t// Bits per digit\n\tvar dbits;\n\t// JavaScript engine analysis\n\tvar canary = 0xdeadbeefcafe;\n\tvar j_lm = ((canary & 0xffffff) == 0xefcafe);\n\t// (public) Constructor\n\t/**\n\t* @constructor\n\t*/\n\tfunction BigInteger(a, b, c)\n\t{\n\t\t// This test variable can be removed,\n\t\t// but at least for performance tests it is useful piece of knowledge\n\t\t// This is the only ClipperLib related variable in BigInteger library\n\t\tClipperLib.biginteger_used = 1;\n\t\tif (a != null)\n\t\t\tif (\"number\" == typeof a && \"undefined\" == typeof (b)) this.fromInt(a); // faster conversion\n\t\t\telse if (\"number\" == typeof a) this.fromNumber(a, b, c);\n\t\telse if (b == null && \"string\" != typeof a) this.fromString(a, 256);\n\t\telse this.fromString(a, b);\n\t}\n\t// return new, unset BigInteger\n\tfunction nbi()\n\t{\n\t\treturn new BigInteger(null, undefined, undefined);\n\t}\n\t// am: Compute w_j += (x*this_i), propagate carries,\n\t// c is initial carry, returns final carry.\n\t// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n\t// We need to select the fastest one that works in this environment.\n\t// am1: use a single mult and divide to get the high bits,\n\t// max digit bits should be 26 because\n\t// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\n\tfunction am1(i, x, w, j, c, n)\n\t{\n\t\twhile (--n >= 0)\n\t\t{\n\t\t\tvar v = x * this[i++] + w[j] + c;\n\t\t\tc = Math.floor(v / 0x4000000);\n\t\t\tw[j++] = v & 0x3ffffff;\n\t\t}\n\t\treturn c;\n\t}\n\t// am2 avoids a big mult-and-extract completely.\n\t// Max digit bits should be <= 30 because we do bitwise ops\n\t// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\n\tfunction am2(i, x, w, j, c, n)\n\t{\n\t\tvar xl = x & 0x7fff,\n\t\t\txh = x >> 15;\n\t\twhile (--n >= 0)\n\t\t{\n\t\t\tvar l = this[i] & 0x7fff;\n\t\t\tvar h = this[i++] >> 15;\n\t\t\tvar m = xh * l + h * xl;\n\t\t\tl = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n\t\t\tc = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n\t\t\tw[j++] = l & 0x3fffffff;\n\t\t}\n\t\treturn c;\n\t}\n\t// Alternately, set max digit bits to 28 since some\n\t// browsers slow down when dealing with 32-bit numbers.\n\tfunction am3(i, x, w, j, c, n)\n\t{\n\t\tvar xl = x & 0x3fff,\n\t\t\txh = x >> 14;\n\t\twhile (--n >= 0)\n\t\t{\n\t\t\tvar l = this[i] & 0x3fff;\n\t\t\tvar h = this[i++] >> 14;\n\t\t\tvar m = xh * l + h * xl;\n\t\t\tl = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n\t\t\tc = (l >> 28) + (m >> 14) + xh * h;\n\t\t\tw[j++] = l & 0xfffffff;\n\t\t}\n\t\treturn c;\n\t}\n\tif (j_lm && (navigator_appName == \"Microsoft Internet Explorer\"))\n\t{\n\t\tBigInteger.prototype.am = am2;\n\t\tdbits = 30;\n\t}\n\telse if (j_lm && (navigator_appName != \"Netscape\"))\n\t{\n\t\tBigInteger.prototype.am = am1;\n\t\tdbits = 26;\n\t}\n\telse\n\t{ // Mozilla/Netscape seems to prefer am3\n\t\tBigInteger.prototype.am = am3;\n\t\tdbits = 28;\n\t}\n\tBigInteger.prototype.DB = dbits;\n\tBigInteger.prototype.DM = ((1 << dbits) - 1);\n\tBigInteger.prototype.DV = (1 << dbits);\n\tvar BI_FP = 52;\n\tBigInteger.prototype.FV = Math.pow(2, BI_FP);\n\tBigInteger.prototype.F1 = BI_FP - dbits;\n\tBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n\t// Digit conversions\n\tvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\n\tvar BI_RC = new Array();\n\tvar rr, vv;\n\trr = \"0\".charCodeAt(0);\n\tfor (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;\n\trr = \"a\".charCodeAt(0);\n\tfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;\n\trr = \"A\".charCodeAt(0);\n\tfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;\n\n\tfunction int2char(n)\n\t{\n\t\treturn BI_RM.charAt(n);\n\t}\n\n\tfunction intAt(s, i)\n\t{\n\t\tvar c = BI_RC[s.charCodeAt(i)];\n\t\treturn (c == null) ? -1 : c;\n\t}\n\t// (protected) copy this to r\n\tfunction bnpCopyTo(r)\n\t{\n\t\tfor (var i = this.t - 1; i >= 0; --i) r[i] = this[i];\n\t\tr.t = this.t;\n\t\tr.s = this.s;\n\t}\n\t// (protected) set from integer value x, -DV <= x < DV\n\tfunction bnpFromInt(x)\n\t{\n\t\tthis.t = 1;\n\t\tthis.s = (x < 0) ? -1 : 0;\n\t\tif (x > 0) this[0] = x;\n\t\telse if (x < -1) this[0] = x + this.DV;\n\t\telse this.t = 0;\n\t}\n\t// return bigint initialized to value\n\tfunction nbv(i)\n\t{\n\t\tvar r = nbi();\n\t\tr.fromInt(i);\n\t\treturn r;\n\t}\n\t// (protected) set from string and radix\n\tfunction bnpFromString(s, b)\n\t{\n\t\tvar k;\n\t\tif (b == 16) k = 4;\n\t\telse if (b == 8) k = 3;\n\t\telse if (b == 256) k = 8; // byte array\n\t\telse if (b == 2) k = 1;\n\t\telse if (b == 32) k = 5;\n\t\telse if (b == 4) k = 2;\n\t\telse\n\t\t{\n\t\t\tthis.fromRadix(s, b);\n\t\t\treturn;\n\t\t}\n\t\tthis.t = 0;\n\t\tthis.s = 0;\n\t\tvar i = s.length,\n\t\t\tmi = false,\n\t\t\tsh = 0;\n\t\twhile (--i >= 0)\n\t\t{\n\t\t\tvar x = (k == 8) ? s[i] & 0xff : intAt(s, i);\n\t\t\tif (x < 0)\n\t\t\t{\n\t\t\t\tif (s.charAt(i) == \"-\") mi = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmi = false;\n\t\t\tif (sh == 0)\n\t\t\t\tthis[this.t++] = x;\n\t\t\telse if (sh + k > this.DB)\n\t\t\t{\n\t\t\t\tthis[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n\t\t\t\tthis[this.t++] = (x >> (this.DB - sh));\n\t\t\t}\n\t\t\telse\n\t\t\t\tthis[this.t - 1] |= x << sh;\n\t\t\tsh += k;\n\t\t\tif (sh >= this.DB) sh -= this.DB;\n\t\t}\n\t\tif (k == 8 && (s[0] & 0x80) != 0)\n\t\t{\n\t\t\tthis.s = -1;\n\t\t\tif (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n\t\t}\n\t\tthis.clamp();\n\t\tif (mi) BigInteger.ZERO.subTo(this, this);\n\t}\n\t// (protected) clamp off excess high words\n\tfunction bnpClamp()\n\t{\n\t\tvar c = this.s & this.DM;\n\t\twhile (this.t > 0 && this[this.t - 1] == c) --this.t;\n\t}\n\t// (public) return string representation in given radix\n\tfunction bnToString(b)\n\t{\n\t\tif (this.s < 0) return \"-\" + this.negate().toString(b);\n\t\tvar k;\n\t\tif (b == 16) k = 4;\n\t\telse if (b == 8) k = 3;\n\t\telse if (b == 2) k = 1;\n\t\telse if (b == 32) k = 5;\n\t\telse if (b == 4) k = 2;\n\t\telse return this.toRadix(b);\n\t\tvar km = (1 << k) - 1,\n\t\t\td, m = false,\n\t\t\tr = \"\",\n\t\t\ti = this.t;\n\t\tvar p = this.DB - (i * this.DB) % k;\n\t\tif (i-- > 0)\n\t\t{\n\t\t\tif (p < this.DB && (d = this[i] >> p) > 0)\n\t\t\t{\n\t\t\t\tm = true;\n\t\t\t\tr = int2char(d);\n\t\t\t}\n\t\t\twhile (i >= 0)\n\t\t\t{\n\t\t\t\tif (p < k)\n\t\t\t\t{\n\t\t\t\t\td = (this[i] & ((1 << p) - 1)) << (k - p);\n\t\t\t\t\td |= this[--i] >> (p += this.DB - k);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\td = (this[i] >> (p -= k)) & km;\n\t\t\t\t\tif (p <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tp += this.DB;\n\t\t\t\t\t\t--i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (d > 0) m = true;\n\t\t\t\tif (m) r += int2char(d);\n\t\t\t}\n\t\t}\n\t\treturn m ? r : \"0\";\n\t}\n\t// (public) -this\n\tfunction bnNegate()\n\t{\n\t\tvar r = nbi();\n\t\tBigInteger.ZERO.subTo(this, r);\n\t\treturn r;\n\t}\n\t// (public) |this|\n\tfunction bnAbs()\n\t{\n\t\treturn (this.s < 0) ? this.negate() : this;\n\t}\n\t// (public) return + if this > a, - if this < a, 0 if equal\n\tfunction bnCompareTo(a)\n\t{\n\t\tvar r = this.s - a.s;\n\t\tif (r != 0) return r;\n\t\tvar i = this.t;\n\t\tr = i - a.t;\n\t\tif (r != 0) return (this.s < 0) ? -r : r;\n\t\twhile (--i >= 0)\n\t\t\tif ((r = this[i] - a[i]) != 0) return r;\n\t\treturn 0;\n\t}\n\t// returns bit length of the integer x\n\tfunction nbits(x)\n\t{\n\t\tvar r = 1,\n\t\t\tt;\n\t\tif ((t = x >>> 16) != 0)\n\t\t{\n\t\t\tx = t;\n\t\t\tr += 16;\n\t\t}\n\t\tif ((t = x >> 8) != 0)\n\t\t{\n\t\t\tx = t;\n\t\t\tr += 8;\n\t\t}\n\t\tif ((t = x >> 4) != 0)\n\t\t{\n\t\t\tx = t;\n\t\t\tr += 4;\n\t\t}\n\t\tif ((t = x >> 2) != 0)\n\t\t{\n\t\t\tx = t;\n\t\t\tr += 2;\n\t\t}\n\t\tif ((t = x >> 1) != 0)\n\t\t{\n\t\t\tx = t;\n\t\t\tr += 1;\n\t\t}\n\t\treturn r;\n\t}\n\t// (public) return the number of bits in \"this\"\n\tfunction bnBitLength()\n\t{\n\t\tif (this.t <= 0) return 0;\n\t\treturn this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\n\t}\n\t// (protected) r = this << n*DB\n\tfunction bnpDLShiftTo(n, r)\n\t{\n\t\tvar i;\n\t\tfor (i = this.t - 1; i >= 0; --i) r[i + n] = this[i];\n\t\tfor (i = n - 1; i >= 0; --i) r[i] = 0;\n\t\tr.t = this.t + n;\n\t\tr.s = this.s;\n\t}\n\t// (protected) r = this >> n*DB\n\tfunction bnpDRShiftTo(n, r)\n\t{\n\t\tfor (var i = n; i < this.t; ++i) r[i - n] = this[i];\n\t\tr.t = Math.max(this.t - n, 0);\n\t\tr.s = this.s;\n\t}\n\t// (protected) r = this << n\n\tfunction bnpLShiftTo(n, r)\n\t{\n\t\tvar bs = n % this.DB;\n\t\tvar cbs = this.DB - bs;\n\t\tvar bm = (1 << cbs) - 1;\n\t\tvar ds = Math.floor(n / this.DB),\n\t\t\tc = (this.s << bs) & this.DM,\n\t\t\ti;\n\t\tfor (i = this.t - 1; i >= 0; --i)\n\t\t{\n\t\t\tr[i + ds + 1] = (this[i] >> cbs) | c;\n\t\t\tc = (this[i] & bm) << bs;\n\t\t}\n\t\tfor (i = ds - 1; i >= 0; --i) r[i] = 0;\n\t\tr[ds] = c;\n\t\tr.t = this.t + ds + 1;\n\t\tr.s = this.s;\n\t\tr.clamp();\n\t}\n\t// (protected) r = this >> n\n\tfunction bnpRShiftTo(n, r)\n\t{\n\t\tr.s = this.s;\n\t\tvar ds = Math.floor(n / this.DB);\n\t\tif (ds >= this.t)\n\t\t{\n\t\t\tr.t = 0;\n\t\t\treturn;\n\t\t}\n\t\tvar bs = n % this.DB;\n\t\tvar cbs = this.DB - bs;\n\t\tvar bm = (1 << bs) - 1;\n\t\tr[0] = this[ds] >> bs;\n\t\tfor (var i = ds + 1; i < this.t; ++i)\n\t\t{\n\t\t\tr[i - ds - 1] |= (this[i] & bm) << cbs;\n\t\t\tr[i - ds] = this[i] >> bs;\n\t\t}\n\t\tif (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n\t\tr.t = this.t - ds;\n\t\tr.clamp();\n\t}\n\t// (protected) r = this - a\n\tfunction bnpSubTo(a, r)\n\t{\n\t\tvar i = 0,\n\t\t\tc = 0,\n\t\t\tm = Math.min(a.t, this.t);\n\t\twhile (i < m)\n\t\t{\n\t\t\tc += this[i] - a[i];\n\t\t\tr[i++] = c & this.DM;\n\t\t\tc >>= this.DB;\n\t\t}\n\t\tif (a.t < this.t)\n\t\t{\n\t\t\tc -= a.s;\n\t\t\twhile (i < this.t)\n\t\t\t{\n\t\t\t\tc += this[i];\n\t\t\t\tr[i++] = c & this.DM;\n\t\t\t\tc >>= this.DB;\n\t\t\t}\n\t\t\tc += this.s;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc += this.s;\n\t\t\twhile (i < a.t)\n\t\t\t{\n\t\t\t\tc -= a[i];\n\t\t\t\tr[i++] = c & this.DM;\n\t\t\t\tc >>= this.DB;\n\t\t\t}\n\t\t\tc -= a.s;\n\t\t}\n\t\tr.s = (c < 0) ? -1 : 0;\n\t\tif (c < -1) r[i++] = this.DV + c;\n\t\telse if (c > 0) r[i++] = c;\n\t\tr.t = i;\n\t\tr.clamp();\n\t}\n\t// (protected) r = this * a, r != this,a (HAC 14.12)\n\t// \"this\" should be the larger one if appropriate.\n\tfunction bnpMultiplyTo(a, r)\n\t{\n\t\tvar x = this.abs(),\n\t\t\ty = a.abs();\n\t\tvar i = x.t;\n\t\tr.t = i + y.t;\n\t\twhile (--i >= 0) r[i] = 0;\n\t\tfor (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n\t\tr.s = 0;\n\t\tr.clamp();\n\t\tif (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n\t}\n\t// (protected) r = this^2, r != this (HAC 14.16)\n\tfunction bnpSquareTo(r)\n\t{\n\t\tvar x = this.abs();\n\t\tvar i = r.t = 2 * x.t;\n\t\twhile (--i >= 0) r[i] = 0;\n\t\tfor (i = 0; i < x.t - 1; ++i)\n\t\t{\n\t\t\tvar c = x.am(i, x[i], r, 2 * i, 0, 1);\n\t\t\tif ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV)\n\t\t\t{\n\t\t\t\tr[i + x.t] -= x.DV;\n\t\t\t\tr[i + x.t + 1] = 1;\n\t\t\t}\n\t\t}\n\t\tif (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n\t\tr.s = 0;\n\t\tr.clamp();\n\t}\n\t// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n\t// r != q, this != m. q or r may be null.\n\tfunction bnpDivRemTo(m, q, r)\n\t{\n\t\tvar pm = m.abs();\n\t\tif (pm.t <= 0) return;\n\t\tvar pt = this.abs();\n\t\tif (pt.t < pm.t)\n\t\t{\n\t\t\tif (q != null) q.fromInt(0);\n\t\t\tif (r != null) this.copyTo(r);\n\t\t\treturn;\n\t\t}\n\t\tif (r == null) r = nbi();\n\t\tvar y = nbi(),\n\t\t\tts = this.s,\n\t\t\tms = m.s;\n\t\tvar nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\n\t\tif (nsh > 0)\n\t\t{\n\t\t\tpm.lShiftTo(nsh, y);\n\t\t\tpt.lShiftTo(nsh, r);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpm.copyTo(y);\n\t\t\tpt.copyTo(r);\n\t\t}\n\t\tvar ys = y.t;\n\t\tvar y0 = y[ys - 1];\n\t\tif (y0 == 0) return;\n\t\tvar yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\n\t\tvar d1 = this.FV / yt,\n\t\t\td2 = (1 << this.F1) / yt,\n\t\t\te = 1 << this.F2;\n\t\tvar i = r.t,\n\t\t\tj = i - ys,\n\t\t\tt = (q == null) ? nbi() : q;\n\t\ty.dlShiftTo(j, t);\n\t\tif (r.compareTo(t) >= 0)\n\t\t{\n\t\t\tr[r.t++] = 1;\n\t\t\tr.subTo(t, r);\n\t\t}\n\t\tBigInteger.ONE.dlShiftTo(ys, t);\n\t\tt.subTo(y, y); // \"negative\" y so we can replace sub with am later\n\t\twhile (y.t < ys) y[y.t++] = 0;\n\t\twhile (--j >= 0)\n\t\t{\n\t\t\t// Estimate quotient digit\n\t\t\tvar qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n\t\t\tif ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd)\n\t\t\t{ // Try it out\n\t\t\t\ty.dlShiftTo(j, t);\n\t\t\t\tr.subTo(t, r);\n\t\t\t\twhile (r[i] < --qd) r.subTo(t, r);\n\t\t\t}\n\t\t}\n\t\tif (q != null)\n\t\t{\n\t\t\tr.drShiftTo(ys, q);\n\t\t\tif (ts != ms) BigInteger.ZERO.subTo(q, q);\n\t\t}\n\t\tr.t = ys;\n\t\tr.clamp();\n\t\tif (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder\n\t\tif (ts < 0) BigInteger.ZERO.subTo(r, r);\n\t}\n\t// (public) this mod a\n\tfunction bnMod(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.abs().divRemTo(a, null, r);\n\t\tif (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n\t\treturn r;\n\t}\n\t// Modular reduction using \"classic\" algorithm\n\t/**\n\t* @constructor\n\t*/\n\tfunction Classic(m)\n\t{\n\t\tthis.m = m;\n\t}\n\n\tfunction cConvert(x)\n\t{\n\t\tif (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);\n\t\telse return x;\n\t}\n\n\tfunction cRevert(x)\n\t{\n\t\treturn x;\n\t}\n\n\tfunction cReduce(x)\n\t{\n\t\tx.divRemTo(this.m, null, x);\n\t}\n\n\tfunction cMulTo(x, y, r)\n\t{\n\t\tx.multiplyTo(y, r);\n\t\tthis.reduce(r);\n\t}\n\n\tfunction cSqrTo(x, r)\n\t{\n\t\tx.squareTo(r);\n\t\tthis.reduce(r);\n\t}\n\tClassic.prototype.convert = cConvert;\n\tClassic.prototype.revert = cRevert;\n\tClassic.prototype.reduce = cReduce;\n\tClassic.prototype.mulTo = cMulTo;\n\tClassic.prototype.sqrTo = cSqrTo;\n\t// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n\t// justification:\n\t// xy == 1 (mod m)\n\t// xy = 1+km\n\t// xy(2-xy) = (1+km)(1-km)\n\t// x[y(2-xy)] = 1-k^2m^2\n\t// x[y(2-xy)] == 1 (mod m^2)\n\t// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n\t// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n\t// JS multiply \"overflows\" differently from C/C++, so care is needed here.\n\tfunction bnpInvDigit()\n\t{\n\t\tif (this.t < 1) return 0;\n\t\tvar x = this[0];\n\t\tif ((x & 1) == 0) return 0;\n\t\tvar y = x & 3; // y == 1/x mod 2^2\n\t\ty = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\n\t\ty = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\n\t\ty = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\n\t\t// last step - calculate inverse mod DV directly;\n\t\t// assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n\t\ty = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\n\t\t// we really want the negative inverse, and -DV < y < DV\n\t\treturn (y > 0) ? this.DV - y : -y;\n\t}\n\t// Montgomery reduction\n\t/**\n\t* @constructor\n\t*/\n\tfunction Montgomery(m)\n\t{\n\t\tthis.m = m;\n\t\tthis.mp = m.invDigit();\n\t\tthis.mpl = this.mp & 0x7fff;\n\t\tthis.mph = this.mp >> 15;\n\t\tthis.um = (1 << (m.DB - 15)) - 1;\n\t\tthis.mt2 = 2 * m.t;\n\t}\n\t// xR mod m\n\tfunction montConvert(x)\n\t{\n\t\tvar r = nbi();\n\t\tx.abs().dlShiftTo(this.m.t, r);\n\t\tr.divRemTo(this.m, null, r);\n\t\tif (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n\t\treturn r;\n\t}\n\t// x/R mod m\n\tfunction montRevert(x)\n\t{\n\t\tvar r = nbi();\n\t\tx.copyTo(r);\n\t\tthis.reduce(r);\n\t\treturn r;\n\t}\n\t// x = x/R mod m (HAC 14.32)\n\tfunction montReduce(x)\n\t{\n\t\twhile (x.t <= this.mt2) // pad x so am has enough room later\n\t\t\tx[x.t++] = 0;\n\t\tfor (var i = 0; i < this.m.t; ++i)\n\t\t{\n\t\t\t// faster way of calculating u0 = x[i]*mp mod DV\n\t\t\tvar j = x[i] & 0x7fff;\n\t\t\tvar u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\n\t\t\t// use am to combine the multiply-shift-add into one call\n\t\t\tj = i + this.m.t;\n\t\t\tx[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n\t\t\t// propagate carry\n\t\t\twhile (x[j] >= x.DV)\n\t\t\t{\n\t\t\t\tx[j] -= x.DV;\n\t\t\t\tx[++j]++;\n\t\t\t}\n\t\t}\n\t\tx.clamp();\n\t\tx.drShiftTo(this.m.t, x);\n\t\tif (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n\t}\n\t// r = \"x^2/R mod m\"; x != r\n\tfunction montSqrTo(x, r)\n\t{\n\t\tx.squareTo(r);\n\t\tthis.reduce(r);\n\t}\n\t// r = \"xy/R mod m\"; x,y != r\n\tfunction montMulTo(x, y, r)\n\t{\n\t\tx.multiplyTo(y, r);\n\t\tthis.reduce(r);\n\t}\n\tMontgomery.prototype.convert = montConvert;\n\tMontgomery.prototype.revert = montRevert;\n\tMontgomery.prototype.reduce = montReduce;\n\tMontgomery.prototype.mulTo = montMulTo;\n\tMontgomery.prototype.sqrTo = montSqrTo;\n\t// (protected) true iff this is even\n\tfunction bnpIsEven()\n\t{\n\t\treturn ((this.t > 0) ? (this[0] & 1) : this.s) == 0;\n\t}\n\t// (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\n\tfunction bnpExp(e, z)\n\t{\n\t\tif (e > 0xffffffff || e < 1) return BigInteger.ONE;\n\t\tvar r = nbi(),\n\t\t\tr2 = nbi(),\n\t\t\tg = z.convert(this),\n\t\t\ti = nbits(e) - 1;\n\t\tg.copyTo(r);\n\t\twhile (--i >= 0)\n\t\t{\n\t\t\tz.sqrTo(r, r2);\n\t\t\tif ((e & (1 << i)) > 0) z.mulTo(r2, g, r);\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar t = r;\n\t\t\t\tr = r2;\n\t\t\t\tr2 = t;\n\t\t\t}\n\t\t}\n\t\treturn z.revert(r);\n\t}\n\t// (public) this^e % m, 0 <= e < 2^32\n\tfunction bnModPowInt(e, m)\n\t{\n\t\tvar z;\n\t\tif (e < 256 || m.isEven()) z = new Classic(m);\n\t\telse z = new Montgomery(m);\n\t\treturn this.exp(e, z);\n\t}\n\t// protected\n\tBigInteger.prototype.copyTo = bnpCopyTo;\n\tBigInteger.prototype.fromInt = bnpFromInt;\n\tBigInteger.prototype.fromString = bnpFromString;\n\tBigInteger.prototype.clamp = bnpClamp;\n\tBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\n\tBigInteger.prototype.drShiftTo = bnpDRShiftTo;\n\tBigInteger.prototype.lShiftTo = bnpLShiftTo;\n\tBigInteger.prototype.rShiftTo = bnpRShiftTo;\n\tBigInteger.prototype.subTo = bnpSubTo;\n\tBigInteger.prototype.multiplyTo = bnpMultiplyTo;\n\tBigInteger.prototype.squareTo = bnpSquareTo;\n\tBigInteger.prototype.divRemTo = bnpDivRemTo;\n\tBigInteger.prototype.invDigit = bnpInvDigit;\n\tBigInteger.prototype.isEven = bnpIsEven;\n\tBigInteger.prototype.exp = bnpExp;\n\t// public\n\tBigInteger.prototype.toString = bnToString;\n\tBigInteger.prototype.negate = bnNegate;\n\tBigInteger.prototype.abs = bnAbs;\n\tBigInteger.prototype.compareTo = bnCompareTo;\n\tBigInteger.prototype.bitLength = bnBitLength;\n\tBigInteger.prototype.mod = bnMod;\n\tBigInteger.prototype.modPowInt = bnModPowInt;\n\t// \"constants\"\n\tBigInteger.ZERO = nbv(0);\n\tBigInteger.ONE = nbv(1);\n\t// Copyright (c) 2005-2009 Tom Wu\n\t// All Rights Reserved.\n\t// See \"LICENSE\" for details.\n\t// Extended JavaScript BN functions, required for RSA private ops.\n\t// Version 1.1: new BigInteger(\"0\", 10) returns \"proper\" zero\n\t// Version 1.2: square() API, isProbablePrime fix\n\t// (public)\n\tfunction bnClone()\n\t{\n\t\tvar r = nbi();\n\t\tthis.copyTo(r);\n\t\treturn r;\n\t}\n\t// (public) return value as integer\n\tfunction bnIntValue()\n\t{\n\t\tif (this.s < 0)\n\t\t{\n\t\t\tif (this.t == 1) return this[0] - this.DV;\n\t\t\telse if (this.t == 0) return -1;\n\t\t}\n\t\telse if (this.t == 1) return this[0];\n\t\telse if (this.t == 0) return 0;\n\t\t// assumes 16 < DB < 32\n\t\treturn ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n\t}\n\t// (public) return value as byte\n\tfunction bnByteValue()\n\t{\n\t\treturn (this.t == 0) ? this.s : (this[0] << 24) >> 24;\n\t}\n\t// (public) return value as short (assumes DB>=16)\n\tfunction bnShortValue()\n\t{\n\t\treturn (this.t == 0) ? this.s : (this[0] << 16) >> 16;\n\t}\n\t// (protected) return x s.t. r^x < DV\n\tfunction bnpChunkSize(r)\n\t{\n\t\treturn Math.floor(Math.LN2 * this.DB / Math.log(r));\n\t}\n\t// (public) 0 if this == 0, 1 if this > 0\n\tfunction bnSigNum()\n\t{\n\t\tif (this.s < 0) return -1;\n\t\telse if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;\n\t\telse return 1;\n\t}\n\t// (protected) convert to radix string\n\tfunction bnpToRadix(b)\n\t{\n\t\tif (b == null) b = 10;\n\t\tif (this.signum() == 0 || b < 2 || b > 36) return \"0\";\n\t\tvar cs = this.chunkSize(b);\n\t\tvar a = Math.pow(b, cs);\n\t\tvar d = nbv(a),\n\t\t\ty = nbi(),\n\t\t\tz = nbi(),\n\t\t\tr = \"\";\n\t\tthis.divRemTo(d, y, z);\n\t\twhile (y.signum() > 0)\n\t\t{\n\t\t\tr = (a + z.intValue()).toString(b).substr(1) + r;\n\t\t\ty.divRemTo(d, y, z);\n\t\t}\n\t\treturn z.intValue().toString(b) + r;\n\t}\n\t// (protected) convert from radix string\n\tfunction bnpFromRadix(s, b)\n\t{\n\t\tthis.fromInt(0);\n\t\tif (b == null) b = 10;\n\t\tvar cs = this.chunkSize(b);\n\t\tvar d = Math.pow(b, cs),\n\t\t\tmi = false,\n\t\t\tj = 0,\n\t\t\tw = 0;\n\t\tfor (var i = 0; i < s.length; ++i)\n\t\t{\n\t\t\tvar x = intAt(s, i);\n\t\t\tif (x < 0)\n\t\t\t{\n\t\t\t\tif (s.charAt(i) == \"-\" && this.signum() == 0) mi = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tw = b * w + x;\n\t\t\tif (++j >= cs)\n\t\t\t{\n\t\t\t\tthis.dMultiply(d);\n\t\t\t\tthis.dAddOffset(w, 0);\n\t\t\t\tj = 0;\n\t\t\t\tw = 0;\n\t\t\t}\n\t\t}\n\t\tif (j > 0)\n\t\t{\n\t\t\tthis.dMultiply(Math.pow(b, j));\n\t\t\tthis.dAddOffset(w, 0);\n\t\t}\n\t\tif (mi) BigInteger.ZERO.subTo(this, this);\n\t}\n\t// (protected) alternate constructor\n\tfunction bnpFromNumber(a, b, c)\n\t{\n\t\tif (\"number\" == typeof b)\n\t\t{\n\t\t\t// new BigInteger(int,int,RNG)\n\t\t\tif (a < 2) this.fromInt(1);\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.fromNumber(a, c);\n\t\t\t\tif (!this.testBit(a - 1)) // force MSB set\n\t\t\t\t\tthis.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\n\t\t\t\tif (this.isEven()) this.dAddOffset(1, 0); // force odd\n\t\t\t\twhile (!this.isProbablePrime(b))\n\t\t\t\t{\n\t\t\t\t\tthis.dAddOffset(2, 0);\n\t\t\t\t\tif (this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// new BigInteger(int,RNG)\n\t\t\tvar x = new Array(),\n\t\t\t\tt = a & 7;\n\t\t\tx.length = (a >> 3) + 1;\n\t\t\tb.nextBytes(x);\n\t\t\tif (t > 0) x[0] &= ((1 << t) - 1);\n\t\t\telse x[0] = 0;\n\t\t\tthis.fromString(x, 256);\n\t\t}\n\t}\n\t// (public) convert to bigendian byte array\n\tfunction bnToByteArray()\n\t{\n\t\tvar i = this.t,\n\t\t\tr = new Array();\n\t\tr[0] = this.s;\n\t\tvar p = this.DB - (i * this.DB) % 8,\n\t\t\td, k = 0;\n\t\tif (i-- > 0)\n\t\t{\n\t\t\tif (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p)\n\t\t\t\tr[k++] = d | (this.s << (this.DB - p));\n\t\t\twhile (i >= 0)\n\t\t\t{\n\t\t\t\tif (p < 8)\n\t\t\t\t{\n\t\t\t\t\td = (this[i] & ((1 << p) - 1)) << (8 - p);\n\t\t\t\t\td |= this[--i] >> (p += this.DB - 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\td = (this[i] >> (p -= 8)) & 0xff;\n\t\t\t\t\tif (p <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tp += this.DB;\n\t\t\t\t\t\t--i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ((d & 0x80) != 0) d |= -256;\n\t\t\t\tif (k == 0 && (this.s & 0x80) != (d & 0x80)) ++k;\n\t\t\t\tif (k > 0 || d != this.s) r[k++] = d;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tfunction bnEquals(a)\n\t{\n\t\treturn (this.compareTo(a) == 0);\n\t}\n\n\tfunction bnMin(a)\n\t{\n\t\treturn (this.compareTo(a) < 0) ? this : a;\n\t}\n\n\tfunction bnMax(a)\n\t{\n\t\treturn (this.compareTo(a) > 0) ? this : a;\n\t}\n\t// (protected) r = this op a (bitwise)\n\tfunction bnpBitwiseTo(a, op, r)\n\t{\n\t\tvar i, f, m = Math.min(a.t, this.t);\n\t\tfor (i = 0; i < m; ++i) r[i] = op(this[i], a[i]);\n\t\tif (a.t < this.t)\n\t\t{\n\t\t\tf = a.s & this.DM;\n\t\t\tfor (i = m; i < this.t; ++i) r[i] = op(this[i], f);\n\t\t\tr.t = this.t;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tf = this.s & this.DM;\n\t\t\tfor (i = m; i < a.t; ++i) r[i] = op(f, a[i]);\n\t\t\tr.t = a.t;\n\t\t}\n\t\tr.s = op(this.s, a.s);\n\t\tr.clamp();\n\t}\n\t// (public) this & a\n\tfunction op_and(x, y)\n\t{\n\t\treturn x & y;\n\t}\n\n\tfunction bnAnd(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.bitwiseTo(a, op_and, r);\n\t\treturn r;\n\t}\n\t// (public) this | a\n\tfunction op_or(x, y)\n\t{\n\t\treturn x | y;\n\t}\n\n\tfunction bnOr(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.bitwiseTo(a, op_or, r);\n\t\treturn r;\n\t}\n\t// (public) this ^ a\n\tfunction op_xor(x, y)\n\t{\n\t\treturn x ^ y;\n\t}\n\n\tfunction bnXor(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.bitwiseTo(a, op_xor, r);\n\t\treturn r;\n\t}\n\t// (public) this & ~a\n\tfunction op_andnot(x, y)\n\t{\n\t\treturn x & ~y;\n\t}\n\n\tfunction bnAndNot(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.bitwiseTo(a, op_andnot, r);\n\t\treturn r;\n\t}\n\t// (public) ~this\n\tfunction bnNot()\n\t{\n\t\tvar r = nbi();\n\t\tfor (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i];\n\t\tr.t = this.t;\n\t\tr.s = ~this.s;\n\t\treturn r;\n\t}\n\t// (public) this << n\n\tfunction bnShiftLeft(n)\n\t{\n\t\tvar r = nbi();\n\t\tif (n < 0) this.rShiftTo(-n, r);\n\t\telse this.lShiftTo(n, r);\n\t\treturn r;\n\t}\n\t// (public) this >> n\n\tfunction bnShiftRight(n)\n\t{\n\t\tvar r = nbi();\n\t\tif (n < 0) this.lShiftTo(-n, r);\n\t\telse this.rShiftTo(n, r);\n\t\treturn r;\n\t}\n\t// return index of lowest 1-bit in x, x < 2^31\n\tfunction lbit(x)\n\t{\n\t\tif (x == 0) return -1;\n\t\tvar r = 0;\n\t\tif ((x & 0xffff) == 0)\n\t\t{\n\t\t\tx >>= 16;\n\t\t\tr += 16;\n\t\t}\n\t\tif ((x & 0xff) == 0)\n\t\t{\n\t\t\tx >>= 8;\n\t\t\tr += 8;\n\t\t}\n\t\tif ((x & 0xf) == 0)\n\t\t{\n\t\t\tx >>= 4;\n\t\t\tr += 4;\n\t\t}\n\t\tif ((x & 3) == 0)\n\t\t{\n\t\t\tx >>= 2;\n\t\t\tr += 2;\n\t\t}\n\t\tif ((x & 1) == 0) ++r;\n\t\treturn r;\n\t}\n\t// (public) returns index of lowest 1-bit (or -1 if none)\n\tfunction bnGetLowestSetBit()\n\t{\n\t\tfor (var i = 0; i < this.t; ++i)\n\t\t\tif (this[i] != 0) return i * this.DB + lbit(this[i]);\n\t\tif (this.s < 0) return this.t * this.DB;\n\t\treturn -1;\n\t}\n\t// return number of 1 bits in x\n\tfunction cbit(x)\n\t{\n\t\tvar r = 0;\n\t\twhile (x != 0)\n\t\t{\n\t\t\tx &= x - 1;\n\t\t\t++r;\n\t\t}\n\t\treturn r;\n\t}\n\t// (public) return number of set bits\n\tfunction bnBitCount()\n\t{\n\t\tvar r = 0,\n\t\t\tx = this.s & this.DM;\n\t\tfor (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x);\n\t\treturn r;\n\t}\n\t// (public) true iff nth bit is set\n\tfunction bnTestBit(n)\n\t{\n\t\tvar j = Math.floor(n / this.DB);\n\t\tif (j >= this.t) return (this.s != 0);\n\t\treturn ((this[j] & (1 << (n % this.DB))) != 0);\n\t}\n\t// (protected) this op (1<<n)\n\tfunction bnpChangeBit(n, op)\n\t{\n\t\tvar r = BigInteger.ONE.shiftLeft(n);\n\t\tthis.bitwiseTo(r, op, r);\n\t\treturn r;\n\t}\n\t// (public) this | (1<<n)\n\tfunction bnSetBit(n)\n\t{\n\t\treturn this.changeBit(n, op_or);\n\t}\n\t// (public) this & ~(1<<n)\n\tfunction bnClearBit(n)\n\t{\n\t\treturn this.changeBit(n, op_andnot);\n\t}\n\t// (public) this ^ (1<<n)\n\tfunction bnFlipBit(n)\n\t{\n\t\treturn this.changeBit(n, op_xor);\n\t}\n\t// (protected) r = this + a\n\tfunction bnpAddTo(a, r)\n\t{\n\t\tvar i = 0,\n\t\t\tc = 0,\n\t\t\tm = Math.min(a.t, this.t);\n\t\twhile (i < m)\n\t\t{\n\t\t\tc += this[i] + a[i];\n\t\t\tr[i++] = c & this.DM;\n\t\t\tc >>= this.DB;\n\t\t}\n\t\tif (a.t < this.t)\n\t\t{\n\t\t\tc += a.s;\n\t\t\twhile (i < this.t)\n\t\t\t{\n\t\t\t\tc += this[i];\n\t\t\t\tr[i++] = c & this.DM;\n\t\t\t\tc >>= this.DB;\n\t\t\t}\n\t\t\tc += this.s;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc += this.s;\n\t\t\twhile (i < a.t)\n\t\t\t{\n\t\t\t\tc += a[i];\n\t\t\t\tr[i++] = c & this.DM;\n\t\t\t\tc >>= this.DB;\n\t\t\t}\n\t\t\tc += a.s;\n\t\t}\n\t\tr.s = (c < 0) ? -1 : 0;\n\t\tif (c > 0) r[i++] = c;\n\t\telse if (c < -1) r[i++] = this.DV + c;\n\t\tr.t = i;\n\t\tr.clamp();\n\t}\n\t// (public) this + a\n\tfunction bnAdd(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.addTo(a, r);\n\t\treturn r;\n\t}\n\t// (public) this - a\n\tfunction bnSubtract(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.subTo(a, r);\n\t\treturn r;\n\t}\n\t// (public) this * a\n\tfunction bnMultiply(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.multiplyTo(a, r);\n\t\treturn r;\n\t}\n\t// (public) this^2\n\tfunction bnSquare()\n\t{\n\t\tvar r = nbi();\n\t\tthis.squareTo(r);\n\t\treturn r;\n\t}\n\t// (public) this / a\n\tfunction bnDivide(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.divRemTo(a, r, null);\n\t\treturn r;\n\t}\n\t// (public) this % a\n\tfunction bnRemainder(a)\n\t{\n\t\tvar r = nbi();\n\t\tthis.divRemTo(a, null, r);\n\t\treturn r;\n\t}\n\t// (public) [this/a,this%a]\n\tfunction bnDivideAndRemainder(a)\n\t{\n\t\tvar q = nbi(),\n\t\t\tr = nbi();\n\t\tthis.divRemTo(a, q, r);\n\t\treturn new Array(q, r);\n\t}\n\t// (protected) this *= n, this >= 0, 1 < n < DV\n\tfunction bnpDMultiply(n)\n\t{\n\t\tthis[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\n\t\t++this.t;\n\t\tthis.clamp();\n\t}\n\t// (protected) this += n << w words, this >= 0\n\tfunction bnpDAddOffset(n, w)\n\t{\n\t\tif (n == 0) return;\n\t\twhile (this.t <= w) this[this.t++] = 0;\n\t\tthis[w] += n;\n\t\twhile (this[w] >= this.DV)\n\t\t{\n\t\t\tthis[w] -= this.DV;\n\t\t\tif (++w >= this.t) this[this.t++] = 0;\n\t\t\t++this[w];\n\t\t}\n\t}\n\t// A \"null\" reducer\n\t/**\n\t* @constructor\n\t*/\n\tfunction NullExp()\n\t{}\n\n\tfunction nNop(x)\n\t{\n\t\treturn x;\n\t}\n\n\tfunction nMulTo(x, y, r)\n\t{\n\t\tx.multiplyTo(y, r);\n\t}\n\n\tfunction nSqrTo(x, r)\n\t{\n\t\tx.squareTo(r);\n\t}\n\tNullExp.prototype.convert = nNop;\n\tNullExp.prototype.revert = nNop;\n\tNullExp.prototype.mulTo = nMulTo;\n\tNullExp.prototype.sqrTo = nSqrTo;\n\t// (public) this^e\n\tfunction bnPow(e)\n\t{\n\t\treturn this.exp(e, new NullExp());\n\t}\n\t// (protected) r = lower n words of \"this * a\", a.t <= n\n\t// \"this\" should be the larger one if appropriate.\n\tfunction bnpMultiplyLowerTo(a, n, r)\n\t{\n\t\tvar i = Math.min(this.t + a.t, n);\n\t\tr.s = 0; // assumes a,this >= 0\n\t\tr.t = i;\n\t\twhile (i > 0) r[--i] = 0;\n\t\tvar j;\n\t\tfor (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\n\t\tfor (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i);\n\t\tr.clamp();\n\t}\n\t// (protected) r = \"this * a\" without lower n words, n > 0\n\t// \"this\" should be the larger one if appropriate.\n\tfunction bnpMultiplyUpperTo(a, n, r)\n\t{\n\t\t--n;\n\t\tvar i = r.t = this.t + a.t - n;\n\t\tr.s = 0; // assumes a,this >= 0\n\t\twhile (--i >= 0) r[i] = 0;\n\t\tfor (i = Math.max(n - this.t, 0); i < a.t; ++i)\n\t\t\tr[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\n\t\tr.clamp();\n\t\tr.drShiftTo(1, r);\n\t}\n\t// Barrett modular reduction\n\t/**\n\t* @constructor\n\t*/\n\tfunction Barrett(m)\n\t{\n\t\t// setup Barrett\n\t\tthis.r2 = nbi();\n\t\tthis.q3 = nbi();\n\t\tBigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\n\t\tthis.mu = this.r2.divide(m);\n\t\tthis.m = m;\n\t}\n\n\tfunction barrettConvert(x)\n\t{\n\t\tif (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m);\n\t\telse if (x.compareTo(this.m) < 0) return x;\n\t\telse\n\t\t{\n\t\t\tvar r = nbi();\n\t\t\tx.copyTo(r);\n\t\t\tthis.reduce(r);\n\t\t\treturn r;\n\t\t}\n\t}\n\n\tfunction barrettRevert(x)\n\t{\n\t\treturn x;\n\t}\n\t// x = x mod m (HAC 14.42)\n\tfunction barrettReduce(x)\n\t{\n\t\tx.drShiftTo(this.m.t - 1, this.r2);\n\t\tif (x.t > this.m.t + 1)\n\t\t{\n\t\t\tx.t = this.m.t + 1;\n\t\t\tx.clamp();\n\t\t}\n\t\tthis.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\n\t\tthis.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\n\t\twhile (x.compareTo(this.r2) < 0) x.dAddOffset(1, this.m.t + 1);\n\t\tx.subTo(this.r2, x);\n\t\twhile (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n\t}\n\t// r = x^2 mod m; x != r\n\tfunction barrettSqrTo(x, r)\n\t{\n\t\tx.squareTo(r);\n\t\tthis.reduce(r);\n\t}\n\t// r = x*y mod m; x,y != r\n\tfunction barrettMulTo(x, y, r)\n\t{\n\t\tx.multiplyTo(y, r);\n\t\tthis.reduce(r);\n\t}\n\tBarrett.prototype.convert = barrettConvert;\n\tBarrett.prototype.revert = barrettRevert;\n\tBarrett.prototype.reduce = barrettReduce;\n\tBarrett.prototype.mulTo = barrettMulTo;\n\tBarrett.prototype.sqrTo = barrettSqrTo;\n\t// (public) this^e % m (HAC 14.85)\n\tfunction bnModPow(e, m)\n\t{\n\t\tvar i = e.bitLength(),\n\t\t\tk, r = nbv(1),\n\t\t\tz;\n\t\tif (i <= 0) return r;\n\t\telse if (i < 18) k = 1;\n\t\telse if (i < 48) k = 3;\n\t\telse if (i < 144) k = 4;\n\t\telse if (i < 768) k = 5;\n\t\telse k = 6;\n\t\tif (i < 8)\n\t\t\tz = new Classic(m);\n\t\telse if (m.isEven())\n\t\t\tz = new Barrett(m);\n\t\telse\n\t\t\tz = new Montgomery(m);\n\t\t// precomputation\n\t\tvar g = new Array(),\n\t\t\tn = 3,\n\t\t\tk1 = k - 1,\n\t\t\tkm = (1 << k) - 1;\n\t\tg[1] = z.convert(this);\n\t\tif (k > 1)\n\t\t{\n\t\t\tvar g2 = nbi();\n\t\t\tz.sqrTo(g[1], g2);\n\t\t\twhile (n <= km)\n\t\t\t{\n\t\t\t\tg[n] = nbi();\n\t\t\t\tz.mulTo(g2, g[n - 2], g[n]);\n\t\t\t\tn += 2;\n\t\t\t}\n\t\t}\n\t\tvar j = e.t - 1,\n\t\t\tw, is1 = true,\n\t\t\tr2 = nbi(),\n\t\t\tt;\n\t\ti = nbits(e[j]) - 1;\n\t\twhile (j >= 0)\n\t\t{\n\t\t\tif (i >= k1) w = (e[j] >> (i - k1)) & km;\n\t\t\telse\n\t\t\t{\n\t\t\t\tw = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\n\t\t\t\tif (j > 0) w |= e[j - 1] >> (this.DB + i - k1);\n\t\t\t}\n\t\t\tn = k;\n\t\t\twhile ((w & 1) == 0)\n\t\t\t{\n\t\t\t\tw >>= 1;\n\t\t\t\t--n;\n\t\t\t}\n\t\t\tif ((i -= n) < 0)\n\t\t\t{\n\t\t\t\ti += this.DB;\n\t\t\t\t--j;\n\t\t\t}\n\t\t\tif (is1)\n\t\t\t{ // ret == 1, don't bother squaring or multiplying it\n\t\t\t\tg[w].copyTo(r);\n\t\t\t\tis1 = false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile (n > 1)\n\t\t\t\t{\n\t\t\t\t\tz.sqrTo(r, r2);\n\t\t\t\t\tz.sqrTo(r2, r);\n\t\t\t\t\tn -= 2;\n\t\t\t\t}\n\t\t\t\tif (n > 0) z.sqrTo(r, r2);\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tt = r;\n\t\t\t\t\tr = r2;\n\t\t\t\t\tr2 = t;\n\t\t\t\t}\n\t\t\t\tz.mulTo(r2, g[w], r);\n\t\t\t}\n\t\t\twhile (j >= 0 && (e[j] & (1 << i)) == 0)\n\t\t\t{\n\t\t\t\tz.sqrTo(r, r2);\n\t\t\t\tt = r;\n\t\t\t\tr = r2;\n\t\t\t\tr2 = t;\n\t\t\t\tif (--i < 0)\n\t\t\t\t{\n\t\t\t\t\ti = this.DB - 1;\n\t\t\t\t\t--j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn z.revert(r);\n\t}\n\t// (public) gcd(this,a) (HAC 14.54)\n\tfunction bnGCD(a)\n\t{\n\t\tvar x = (this.s < 0) ? this.negate() : this.clone();\n\t\tvar y = (a.s < 0) ? a.negate() : a.clone();\n\t\tif (x.compareTo(y) < 0)\n\t\t{\n\t\t\tvar t = x;\n\t\t\tx = y;\n\t\t\ty = t;\n\t\t}\n\t\tvar i = x.getLowestSetBit(),\n\t\t\tg = y.getLowestSetBit();\n\t\tif (g < 0) return x;\n\t\tif (i < g) g = i;\n\t\tif (g > 0)\n\t\t{\n\t\t\tx.rShiftTo(g, x);\n\t\t\ty.rShiftTo(g, y);\n\t\t}\n\t\twhile (x.signum() > 0)\n\t\t{\n\t\t\tif ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x);\n\t\t\tif ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y);\n\t\t\tif (x.compareTo(y) >= 0)\n\t\t\t{\n\t\t\t\tx.subTo(y, x);\n\t\t\t\tx.rShiftTo(1, x);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty.subTo(x, y);\n\t\t\t\ty.rShiftTo(1, y);\n\t\t\t}\n\t\t}\n\t\tif (g > 0) y.lShiftTo(g, y);\n\t\treturn y;\n\t}\n\t// (protected) this % n, n < 2^26\n\tfunction bnpModInt(n)\n\t{\n\t\tif (n <= 0) return 0;\n\t\tvar d = this.DV % n,\n\t\t\tr = (this.s < 0) ? n - 1 : 0;\n\t\tif (this.t > 0)\n\t\t\tif (d == 0) r = this[0] % n;\n\t\t\telse\n\t\t\t\tfor (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n;\n\t\treturn r;\n\t}\n\t// (public) 1/this % m (HAC 14.61)\n\tfunction bnModInverse(m)\n\t{\n\t\tvar ac = m.isEven();\n\t\tif ((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;\n\t\tvar u = m.clone(),\n\t\t\tv = this.clone();\n\t\tvar a = nbv(1),\n\t\t\tb = nbv(0),\n\t\t\tc = nbv(0),\n\t\t\td = nbv(1);\n\t\twhile (u.signum() != 0)\n\t\t{\n\t\t\twhile (u.isEven())\n\t\t\t{\n\t\t\t\tu.rShiftTo(1, u);\n\t\t\t\tif (ac)\n\t\t\t\t{\n\t\t\t\t\tif (!a.isEven() || !b.isEven())\n\t\t\t\t\t{\n\t\t\t\t\t\ta.addTo(this, a);\n\t\t\t\t\t\tb.subTo(m, b);\n\t\t\t\t\t}\n\t\t\t\t\ta.rShiftTo(1, a);\n\t\t\t\t}\n\t\t\t\telse if (!b.isEven()) b.subTo(m, b);\n\t\t\t\tb.rShiftTo(1, b);\n\t\t\t}\n\t\t\twhile (v.isEven())\n\t\t\t{\n\t\t\t\tv.rShiftTo(1, v);\n\t\t\t\tif (ac)\n\t\t\t\t{\n\t\t\t\t\tif (!c.isEven() || !d.isEven())\n\t\t\t\t\t{\n\t\t\t\t\t\tc.addTo(this, c);\n\t\t\t\t\t\td.subTo(m, d);\n\t\t\t\t\t}\n\t\t\t\t\tc.rShiftTo(1, c);\n\t\t\t\t}\n\t\t\t\telse if (!d.isEven()) d.subTo(m, d);\n\t\t\t\td.rShiftTo(1, d);\n\t\t\t}\n\t\t\tif (u.compareTo(v) >= 0)\n\t\t\t{\n\t\t\t\tu.subTo(v, u);\n\t\t\t\tif (ac) a.subTo(c, a);\n\t\t\t\tb.subTo(d, b);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tv.subTo(u, v);\n\t\t\t\tif (ac) c.subTo(a, c);\n\t\t\t\td.subTo(b, d);\n\t\t\t}\n\t\t}\n\t\tif (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;\n\t\tif (d.compareTo(m) >= 0) return d.subtract(m);\n\t\tif (d.signum() < 0) d.addTo(m, d);\n\t\telse return d;\n\t\tif (d.signum() < 0) return d.add(m);\n\t\telse return d;\n\t}\n\tvar lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];\n\tvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\n\t// (public) test primality with certainty >= 1-.5^t\n\tfunction bnIsProbablePrime(t)\n\t{\n\t\tvar i, x = this.abs();\n\t\tif (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1])\n\t\t{\n\t\t\tfor (i = 0; i < lowprimes.length; ++i)\n\t\t\t\tif (x[0] == lowprimes[i]) return true;\n\t\t\treturn false;\n\t\t}\n\t\tif (x.isEven()) return false;\n\t\ti = 1;\n\t\twhile (i < lowprimes.length)\n\t\t{\n\t\t\tvar m = lowprimes[i],\n\t\t\t\tj = i + 1;\n\t\t\twhile (j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n\t\t\tm = x.modInt(m);\n\t\t\twhile (i < j)\n\t\t\t\tif (m % lowprimes[i++] == 0) return false;\n\t\t}\n\t\treturn x.millerRabin(t);\n\t}\n\t// (protected) true if probably prime (HAC 4.24, Miller-Rabin)\n\tfunction bnpMillerRabin(t)\n\t{\n\t\tvar n1 = this.subtract(BigInteger.ONE);\n\t\tvar k = n1.getLowestSetBit();\n\t\tif (k <= 0) return false;\n\t\tvar r = n1.shiftRight(k);\n\t\tt = (t + 1) >> 1;\n\t\tif (t > lowprimes.length) t = lowprimes.length;\n\t\tvar a = nbi();\n\t\tfor (var i = 0; i < t; ++i)\n\t\t{\n\t\t\t//Pick bases at random, instead of starting at 2\n\t\t\ta.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\n\t\t\tvar y = a.modPow(r, this);\n\t\t\tif (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0)\n\t\t\t{\n\t\t\t\tvar j = 1;\n\t\t\t\twhile (j++ < k && y.compareTo(n1) != 0)\n\t\t\t\t{\n\t\t\t\t\ty = y.modPowInt(2, this);\n\t\t\t\t\tif (y.compareTo(BigInteger.ONE) == 0) return false;\n\t\t\t\t}\n\t\t\t\tif (y.compareTo(n1) != 0) return false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\t// protected\n\tBigInteger.prototype.chunkSize = bnpChunkSize;\n\tBigInteger.prototype.toRadix = bnpToRadix;\n\tBigInteger.prototype.fromRadix = bnpFromRadix;\n\tBigInteger.prototype.fromNumber = bnpFromNumber;\n\tBigInteger.prototype.bitwiseTo = bnpBitwiseTo;\n\tBigInteger.prototype.changeBit = bnpChangeBit;\n\tBigInteger.prototype.addTo = bnpAddTo;\n\tBigInteger.prototype.dMultiply = bnpDMultiply;\n\tBigInteger.prototype.dAddOffset = bnpDAddOffset;\n\tBigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\n\tBigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\n\tBigInteger.prototype.modInt = bnpModInt;\n\tBigInteger.prototype.millerRabin = bnpMillerRabin;\n\t// public\n\tBigInteger.prototype.clone = bnClone;\n\tBigInteger.prototype.intValue = bnIntValue;\n\tBigInteger.prototype.byteValue = bnByteValue;\n\tBigInteger.prototype.shortValue = bnShortValue;\n\tBigInteger.prototype.signum = bnSigNum;\n\tBigInteger.prototype.toByteArray = bnToByteArray;\n\tBigInteger.prototype.equals = bnEquals;\n\tBigInteger.prototype.min = bnMin;\n\tBigInteger.prototype.max = bnMax;\n\tBigInteger.prototype.and = bnAnd;\n\tBigInteger.prototype.or = bnOr;\n\tBigInteger.prototype.xor = bnXor;\n\tBigInteger.prototype.andNot = bnAndNot;\n\tBigInteger.prototype.not = bnNot;\n\tBigInteger.prototype.shiftLeft = bnShiftLeft;\n\tBigInteger.prototype.shiftRight = bnShiftRight;\n\tBigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\n\tBigInteger.prototype.bitCount = bnBitCount;\n\tBigInteger.prototype.testBit = bnTestBit;\n\tBigInteger.prototype.setBit = bnSetBit;\n\tBigInteger.prototype.clearBit = bnClearBit;\n\tBigInteger.prototype.flipBit = bnFlipBit;\n\tBigInteger.prototype.add = bnAdd;\n\tBigInteger.prototype.subtract = bnSubtract;\n\tBigInteger.prototype.multiply = bnMultiply;\n\tBigInteger.prototype.divide = bnDivide;\n\tBigInteger.prototype.remainder = bnRemainder;\n\tBigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;\n\tBigInteger.prototype.modPow = bnModPow;\n\tBigInteger.prototype.modInverse = bnModInverse;\n\tBigInteger.prototype.pow = bnPow;\n\tBigInteger.prototype.gcd = bnGCD;\n\tBigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n\t// JSBN-specific extension\n\tBigInteger.prototype.square = bnSquare;\n\tvar Int128 = BigInteger;\n\t// BigInteger interfaces not implemented in jsbn:\n\t// BigInteger(int signum, byte[] magnitude)\n\t// double doubleValue()\n\t// float floatValue()\n\t// int hashCode()\n\t// long longValue()\n\t// static BigInteger valueOf(long val)\n\t// Helper functions to make BigInteger functions callable with two parameters\n\t// as in original C# Clipper\n\tInt128.prototype.IsNegative = function ()\n\t{\n\t\tif (this.compareTo(Int128.ZERO) == -1) return true;\n\t\telse return false;\n\t};\n\n\tInt128.op_Equality = function (val1, val2)\n\t{\n\t\tif (val1.compareTo(val2) == 0) return true;\n\t\telse return false;\n\t};\n\n\tInt128.op_Inequality = function (val1, val2)\n\t{\n\t\tif (val1.compareTo(val2) != 0) return true;\n\t\telse return false;\n\t};\n\n\tInt128.op_GreaterThan = function (val1, val2)\n\t{\n\t\tif (val1.compareTo(val2) > 0) return true;\n\t\telse return false;\n\t};\n\n\tInt128.op_LessThan = function (val1, val2)\n\t{\n\t\tif (val1.compareTo(val2) < 0) return true;\n\t\telse return false;\n\t};\n\n\tInt128.op_Addition = function (lhs, rhs)\n\t{\n\t\treturn new Int128(lhs, undefined, undefined).add(new Int128(rhs, undefined, undefined));\n\t};\n\n\tInt128.op_Subtraction = function (lhs, rhs)\n\t{\n\t\treturn new Int128(lhs, undefined, undefined).subtract(new Int128(rhs, undefined, undefined));\n\t};\n\n\tInt128.Int128Mul = function (lhs, rhs)\n\t{\n\t\treturn new Int128(lhs, undefined, undefined).multiply(new Int128(rhs, undefined, undefined));\n\t};\n\n\tInt128.op_Division = function (lhs, rhs)\n\t{\n\t\treturn lhs.divide(rhs);\n\t};\n\n\tInt128.prototype.ToDouble = function ()\n\t{\n\t\treturn parseFloat(this.toString()); // This could be something faster\n\t};\n\n\t// end of Int128 section\n\t/*\n\t// Uncomment the following two lines if you want to use Int128 outside ClipperLib\n\tif (typeof(document) !== \"undefined\") window.Int128 = Int128;\n\telse self.Int128 = Int128;\n\t*/\n\n\t// ---------------------------------------------\n\n\t// Here starts the actual Clipper library:\n\t// Helper function to support Inheritance in Javascript\n\tvar Inherit = function (ce, ce2)\n\t{\n\t\tvar p;\n\t\tif (typeof (Object.getOwnPropertyNames) === 'undefined')\n\t\t{\n\t\t\tfor (p in ce2.prototype)\n\t\t\t\tif (typeof (ce.prototype[p]) === 'undefined' || ce.prototype[p] === Object.prototype[p]) ce.prototype[p] = ce2.prototype[p];\n\t\t\tfor (p in ce2)\n\t\t\t\tif (typeof (ce[p]) === 'undefined') ce[p] = ce2[p];\n\t\t\tce.$baseCtor = ce2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar props = Object.getOwnPropertyNames(ce2.prototype);\n\t\t\tfor (var i = 0; i < props.length; i++)\n\t\t\t\tif (typeof (Object.getOwnPropertyDescriptor(ce.prototype, props[i])) === 'undefined') Object.defineProperty(ce.prototype, props[i], Object.getOwnPropertyDescriptor(ce2.prototype, props[i]));\n\t\t\tfor (p in ce2)\n\t\t\t\tif (typeof (ce[p]) === 'undefined') ce[p] = ce2[p];\n\t\t\tce.$baseCtor = ce2;\n\t\t}\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.Path = function ()\n\t{\n\t\treturn [];\n\t};\n\n\tClipperLib.Path.prototype.push = Array.prototype.push;\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.Paths = function ()\n\t{\n\t\treturn []; // Was previously [[]], but caused problems when pushed\n\t};\n\n\tClipperLib.Paths.prototype.push = Array.prototype.push;\n\n\t// Preserves the calling way of original C# Clipper\n\t// Is essential due to compatibility, because DoublePoint is public class in original C# version\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.DoublePoint = function ()\n\t{\n\t\tvar a = arguments;\n\t\tthis.X = 0;\n\t\tthis.Y = 0;\n\t\t// public DoublePoint(DoublePoint dp)\n\t\t// public DoublePoint(IntPoint ip)\n\t\tif (a.length === 1)\n\t\t{\n\t\t\tthis.X = a[0].X;\n\t\t\tthis.Y = a[0].Y;\n\t\t}\n\t\telse if (a.length === 2)\n\t\t{\n\t\t\tthis.X = a[0];\n\t\t\tthis.Y = a[1];\n\t\t}\n\t}; // This is internal faster function when called without arguments\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.DoublePoint0 = function ()\n\t{\n\t\tthis.X = 0;\n\t\tthis.Y = 0;\n\t};\n\n\tClipperLib.DoublePoint0.prototype = ClipperLib.DoublePoint.prototype;\n\n\t// This is internal faster function when called with 1 argument (dp or ip)\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.DoublePoint1 = function (dp)\n\t{\n\t\tthis.X = dp.X;\n\t\tthis.Y = dp.Y;\n\t};\n\n\tClipperLib.DoublePoint1.prototype = ClipperLib.DoublePoint.prototype;\n\n\t// This is internal faster function when called with 2 arguments (x and y)\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.DoublePoint2 = function (x, y)\n\t{\n\t\tthis.X = x;\n\t\tthis.Y = y;\n\t};\n\n\tClipperLib.DoublePoint2.prototype = ClipperLib.DoublePoint.prototype;\n\n\t// PolyTree & PolyNode start\n\t/**\n\t* @suppress {missingProperties}\n\t*/\n\tClipperLib.PolyNode = function ()\n\t{\n\t\tthis.m_Parent = null;\n\t\tthis.m_polygon = new ClipperLib.Path();\n\t\tthis.m_Index = 0;\n\t\tthis.m_jointype = 0;\n\t\tthis.m_endtype = 0;\n\t\tthis.m_Childs = [];\n\t\tthis.IsOpen = false;\n\t};\n\n\tClipperLib.PolyNode.prototype.IsHoleNode = function ()\n\t{\n\t\tvar result = true;\n\t\tvar node = this.m_Parent;\n\t\twhile (node !== null)\n\t\t{\n\t\t\tresult = !result;\n\t\t\tnode = node.m_Parent;\n\t\t}\n\t\treturn result;\n\t};\n\n\tClipperLib.PolyNode.prototype.ChildCount = function ()\n\t{\n\t\treturn this.m_Childs.length;\n\t};\n\n\tClipperLib.PolyNode.prototype.Contour = function ()\n\t{\n\t\treturn this.m_polygon;\n\t};\n\n\tClipperLib.PolyNode.prototype.AddChild = function (Child)\n\t{\n\t\tvar cnt = this.m_Childs.length;\n\t\tthis.m_Childs.push(Child);\n\t\tChild.m_Parent = this;\n\t\tChild.m_Index = cnt;\n\t};\n\n\tClipperLib.PolyNode.prototype.GetNext = function ()\n\t{\n\t\tif (this.m_Childs.length > 0)\n\t\t\treturn this.m_Childs[0];\n\t\telse\n\t\t\treturn this.GetNextSiblingUp();\n\t};\n\n\tClipperLib.PolyNode.prototype.GetNextSiblingUp = function ()\n\t{\n\t\tif (this.m_Parent === null)\n\t\t\treturn null;\n\t\telse if (this.m_Index === this.m_Parent.m_Childs.length - 1)\n\t\t\treturn this.m_Parent.GetNextSiblingUp();\n\t\telse\n\t\t\treturn this.m_Parent.m_Childs[this.m_Index + 1];\n\t};\n\n\tClipperLib.PolyNode.prototype.Childs = function ()\n\t{\n\t\treturn this.m_Childs;\n\t};\n\n\tClipperLib.PolyNode.prototype.Parent = function ()\n\t{\n\t\treturn this.m_Parent;\n\t};\n\n\tClipperLib.PolyNode.prototype.IsHole = function ()\n\t{\n\t\treturn this.IsHoleNode();\n\t};\n\n\t// PolyTree : PolyNode\n\t/**\n\t * @suppress {missingProperties}\n\t * @constructor\n\t */\n\tClipperLib.PolyTree = function ()\n\t{\n\t\tthis.m_AllPolys = [];\n\t\tClipperLib.PolyNode.call(this);\n\t};\n\n\tClipperLib.PolyTree.prototype.Clear = function ()\n\t{\n\t\tfor (var i = 0, ilen = this.m_AllPolys.length; i < ilen; i++)\n\t\t\tthis.m_AllPolys[i] = null;\n\t\tthis.m_AllPolys.length = 0;\n\t\tthis.m_Childs.length = 0;\n\t};\n\n\tClipperLib.PolyTree.prototype.GetFirst = function ()\n\t{\n\t\tif (this.m_Childs.length > 0)\n\t\t\treturn this.m_Childs[0];\n\t\telse\n\t\t\treturn null;\n\t};\n\n\tClipperLib.PolyTree.prototype.Total = function ()\n\t{\n\t\tvar result = this.m_AllPolys.length;\n\t\t//with negative offsets, ignore the hidden outer polygon ...\n\t\tif (result > 0 && this.m_Childs[0] !== this.m_AllPolys[0]) result--;\n\t\treturn result;\n\t};\n\n\tInherit(ClipperLib.PolyTree, ClipperLib.PolyNode);\n\n\t// PolyTree & PolyNode end\n\n\tClipperLib.Math_Abs_Int64 = ClipperLib.Math_Abs_Int32 = ClipperLib.Math_Abs_Double = function (a)\n\t{\n\t\treturn Math.abs(a);\n\t};\n\n\tClipperLib.Math_Max_Int32_Int32 = function (a, b)\n\t{\n\t\treturn Math.max(a, b);\n\t};\n\n\t/*\n\t-----------------------------------\n\tcast_32 speedtest: http://jsperf.com/truncate-float-to-integer/2\n\t-----------------------------------\n\t*/\n\tif (browser.msie || browser.opera || browser.safari) ClipperLib.Cast_Int32 = function (a)\n\t{\n\t\treturn a | 0;\n\t};\n\n\telse ClipperLib.Cast_Int32 = function (a)\n\t{ // eg. browser.chrome || browser.chromium || browser.firefox\n\t\treturn ~~a;\n\t};\n\n\t/*\n\t--------------------------\n\tcast_64 speedtests: http://jsperf.com/truncate-float-to-integer\n\tChrome: bitwise_not_floor\n\tFirefox17: toInteger (typeof test)\n\tIE9: bitwise_or_floor\n\tIE7 and IE8: to_parseint\n\tChromium: to_floor_or_ceil\n\tFirefox3: to_floor_or_ceil\n\tFirefox15: to_floor_or_ceil\n\tOpera: to_floor_or_ceil\n\tSafari: to_floor_or_ceil\n\t--------------------------\n\t*/\n\tif (typeof Number.toInteger === \"undefined\")\n\t\tNumber.toInteger = null;\n\n\tif (browser.chrome) ClipperLib.Cast_Int64 = function (a)\n\t{\n\t\tif (a < -2147483648 || a > 2147483647)\n\t\t\treturn a < 0 ? Math.ceil(a) : Math.floor(a);\n\t\telse return ~~a;\n\t};\n\n\telse if (browser.firefox && typeof (Number.toInteger) === \"function\") ClipperLib.Cast_Int64 = function (a)\n\t{\n\t\treturn Number.toInteger(a);\n\t};\n\n\telse if (browser.msie7 || browser.msie8) ClipperLib.Cast_Int64 = function (a)\n\t{\n\t\treturn parseInt(a, 10);\n\t};\n\n\telse if (browser.msie) ClipperLib.Cast_Int64 = function (a)\n\t{\n\t\tif (a < -2147483648 || a > 2147483647)\n\t\t\treturn a < 0 ? Math.ceil(a) : Math.floor(a);\n\t\treturn a | 0;\n\t};\n\n\t// eg. browser.chromium || browser.firefox || browser.opera || browser.safari\n\telse ClipperLib.Cast_Int64 = function (a)\n\t{\n\t\treturn a < 0 ? Math.ceil(a) : Math.floor(a);\n\t};\n\n\tClipperLib.Clear = function (a)\n\t{\n\t\ta.length = 0;\n\t};\n\n\t//ClipperLib.MaxSteps = 64; // How many steps at maximum in arc in BuildArc() function\n\tClipperLib.PI = 3.141592653589793;\n\tClipperLib.PI2 = 2 * 3.141592653589793;\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntPoint = function ()\n\t{\n\t\tvar a = arguments,\n\t\t\talen = a.length;\n\t\tthis.X = 0;\n\t\tthis.Y = 0;\n\t\tif (ClipperLib.use_xyz)\n\t\t{\n\t\t\tthis.Z = 0;\n\t\t\tif (alen === 3) // public IntPoint(cInt x, cInt y, cInt z = 0)\n\t\t\t{\n\t\t\t\tthis.X = a[0];\n\t\t\t\tthis.Y = a[1];\n\t\t\t\tthis.Z = a[2];\n\t\t\t}\n\t\t\telse if (alen === 2) // public IntPoint(cInt x, cInt y)\n\t\t\t{\n\t\t\t\tthis.X = a[0];\n\t\t\t\tthis.Y = a[1];\n\t\t\t\tthis.Z = 0;\n\t\t\t}\n\t\t\telse if (alen === 1)\n\t\t\t{\n\t\t\t\tif (a[0] instanceof ClipperLib.DoublePoint) // public IntPoint(DoublePoint dp)\n\t\t\t\t{\n\t\t\t\t\tvar dp = a[0];\n\t\t\t\t\tthis.X = ClipperLib.Clipper.Round(dp.X);\n\t\t\t\t\tthis.Y = ClipperLib.Clipper.Round(dp.Y);\n\t\t\t\t\tthis.Z = 0;\n\t\t\t\t}\n\t\t\t\telse // public IntPoint(IntPoint pt)\n\t\t\t\t{\n\t\t\t\t\tvar pt = a[0];\n\t\t\t\t\tif (typeof (pt.Z) === \"undefined\") pt.Z = 0;\n\t\t\t\t\tthis.X = pt.X;\n\t\t\t\t\tthis.Y = pt.Y;\n\t\t\t\t\tthis.Z = pt.Z;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse // public IntPoint()\n\t\t\t{\n\t\t\t\tthis.X = 0;\n\t\t\t\tthis.Y = 0;\n\t\t\t\tthis.Z = 0;\n\t\t\t}\n\t\t}\n\t\telse // if (!ClipperLib.use_xyz)\n\t\t{\n\t\t\tif (alen === 2) // public IntPoint(cInt X, cInt Y)\n\t\t\t{\n\t\t\t\tthis.X = a[0];\n\t\t\t\tthis.Y = a[1];\n\t\t\t}\n\t\t\telse if (alen === 1)\n\t\t\t{\n\t\t\t\tif (a[0] instanceof ClipperLib.DoublePoint) // public IntPoint(DoublePoint dp)\n\t\t\t\t{\n\t\t\t\t\tvar dp = a[0];\n\t\t\t\t\tthis.X = ClipperLib.Clipper.Round(dp.X);\n\t\t\t\t\tthis.Y = ClipperLib.Clipper.Round(dp.Y);\n\t\t\t\t}\n\t\t\t\telse // public IntPoint(IntPoint pt)\n\t\t\t\t{\n\t\t\t\t\tvar pt = a[0];\n\t\t\t\t\tthis.X = pt.X;\n\t\t\t\t\tthis.Y = pt.Y;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse // public IntPoint(IntPoint pt)\n\t\t\t{\n\t\t\t\tthis.X = 0;\n\t\t\t\tthis.Y = 0;\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.IntPoint.op_Equality = function (a, b)\n\t{\n\t\t//return a == b;\n\t\treturn a.X === b.X && a.Y === b.Y;\n\t};\n\n\tClipperLib.IntPoint.op_Inequality = function (a, b)\n\t{\n\t\t//return a !== b;\n\t\treturn a.X !== b.X || a.Y !== b.Y;\n\t};\n\n\t/*\n ClipperLib.IntPoint.prototype.Equals = function (obj)\n {\n\tif (obj === null)\n\t\treturn false;\n\tif (obj instanceof ClipperLib.IntPoint)\n\t{\n\t\tvar a = Cast(obj, ClipperLib.IntPoint);\n\t\treturn (this.X == a.X) && (this.Y == a.Y);\n\t}\n\telse\n\t\treturn false;\n };\n\n\t*/\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntPoint0 = function ()\n\t{\n\t\tthis.X = 0;\n\t\tthis.Y = 0;\n\t\tif (ClipperLib.use_xyz)\n\t\t\tthis.Z = 0;\n\t};\n\n\tClipperLib.IntPoint0.prototype = ClipperLib.IntPoint.prototype;\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntPoint1 = function (pt)\n\t{\n\t\tthis.X = pt.X;\n\t\tthis.Y = pt.Y;\n\t\tif (ClipperLib.use_xyz)\n\t\t{\n\t\t\tif (typeof pt.Z === \"undefined\") this.Z = 0;\n\t\t\telse this.Z = pt.Z;\n\t\t}\n\t};\n\n\tClipperLib.IntPoint1.prototype = ClipperLib.IntPoint.prototype;\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntPoint1dp = function (dp)\n\t{\n\t\tthis.X = ClipperLib.Clipper.Round(dp.X);\n\t\tthis.Y = ClipperLib.Clipper.Round(dp.Y);\n\t\tif (ClipperLib.use_xyz)\n\t\t\tthis.Z = 0;\n\t};\n\n\tClipperLib.IntPoint1dp.prototype = ClipperLib.IntPoint.prototype;\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntPoint2 = function (x, y, z)\n\t{\n\t\tthis.X = x;\n\t\tthis.Y = y;\n\t\tif (ClipperLib.use_xyz)\n\t\t{\n\t\t\tif (typeof z === \"undefined\") this.Z = 0;\n\t\t\telse this.Z = z;\n\t\t}\n\t};\n\n\tClipperLib.IntPoint2.prototype = ClipperLib.IntPoint.prototype;\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntRect = function ()\n\t{\n\t\tvar a = arguments,\n\t\t\talen = a.length;\n\t\tif (alen === 4) // function (l, t, r, b)\n\t\t{\n\t\t\tthis.left = a[0];\n\t\t\tthis.top = a[1];\n\t\t\tthis.right = a[2];\n\t\t\tthis.bottom = a[3];\n\t\t}\n\t\telse if (alen === 1) // function (ir)\n\t\t{\n\t\t\tvar ir = a[0];\n\t\t\tthis.left = ir.left;\n\t\t\tthis.top = ir.top;\n\t\t\tthis.right = ir.right;\n\t\t\tthis.bottom = ir.bottom;\n\t\t}\n\t\telse // function ()\n\t\t{\n\t\t\tthis.left = 0;\n\t\t\tthis.top = 0;\n\t\t\tthis.right = 0;\n\t\t\tthis.bottom = 0;\n\t\t}\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntRect0 = function ()\n\t{\n\t\tthis.left = 0;\n\t\tthis.top = 0;\n\t\tthis.right = 0;\n\t\tthis.bottom = 0;\n\t};\n\n\tClipperLib.IntRect0.prototype = ClipperLib.IntRect.prototype;\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntRect1 = function (ir)\n\t{\n\t\tthis.left = ir.left;\n\t\tthis.top = ir.top;\n\t\tthis.right = ir.right;\n\t\tthis.bottom = ir.bottom;\n\t};\n\n\tClipperLib.IntRect1.prototype = ClipperLib.IntRect.prototype;\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntRect4 = function (l, t, r, b)\n\t{\n\t\tthis.left = l;\n\t\tthis.top = t;\n\t\tthis.right = r;\n\t\tthis.bottom = b;\n\t};\n\n\tClipperLib.IntRect4.prototype = ClipperLib.IntRect.prototype;\n\n\tClipperLib.ClipType = {\n\t\tctIntersection: 0,\n\t\tctUnion: 1,\n\t\tctDifference: 2,\n\t\tctXor: 3\n\t};\n\n\tClipperLib.PolyType = {\n\t\tptSubject: 0,\n\t\tptClip: 1\n\t};\n\n\tClipperLib.PolyFillType = {\n\t\tpftEvenOdd: 0,\n\t\tpftNonZero: 1,\n\t\tpftPositive: 2,\n\t\tpftNegative: 3\n\t};\n\n\tClipperLib.JoinType = {\n\t\tjtSquare: 0,\n\t\tjtRound: 1,\n\t\tjtMiter: 2\n\t};\n\n\tClipperLib.EndType = {\n\t\tetOpenSquare: 0,\n\t\tetOpenRound: 1,\n\t\tetOpenButt: 2,\n\t\tetClosedLine: 3,\n\t\tetClosedPolygon: 4\n\t};\n\n\tClipperLib.EdgeSide = {\n\t\tesLeft: 0,\n\t\tesRight: 1\n\t};\n\n\tClipperLib.Direction = {\n\t\tdRightToLeft: 0,\n\t\tdLeftToRight: 1\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.TEdge = function ()\n\t{\n\t\tthis.Bot = new ClipperLib.IntPoint0();\n\t\tthis.Curr = new ClipperLib.IntPoint0(); //current (updated for every new scanbeam)\n\t\tthis.Top = new ClipperLib.IntPoint0();\n\t\tthis.Delta = new ClipperLib.IntPoint0();\n\t\tthis.Dx = 0;\n\t\tthis.PolyTyp = ClipperLib.PolyType.ptSubject;\n\t\tthis.Side = ClipperLib.EdgeSide.esLeft; //side only refers to current side of solution poly\n\t\tthis.WindDelta = 0; //1 or -1 depending on winding direction\n\t\tthis.WindCnt = 0;\n\t\tthis.WindCnt2 = 0; //winding count of the opposite polytype\n\t\tthis.OutIdx = 0;\n\t\tthis.Next = null;\n\t\tthis.Prev = null;\n\t\tthis.NextInLML = null;\n\t\tthis.NextInAEL = null;\n\t\tthis.PrevInAEL = null;\n\t\tthis.NextInSEL = null;\n\t\tthis.PrevInSEL = null;\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.IntersectNode = function ()\n\t{\n\t\tthis.Edge1 = null;\n\t\tthis.Edge2 = null;\n\t\tthis.Pt = new ClipperLib.IntPoint0();\n\t};\n\n\tClipperLib.MyIntersectNodeSort = function () {};\n\n\tClipperLib.MyIntersectNodeSort.Compare = function (node1, node2)\n\t{\n\t\tvar i = node2.Pt.Y - node1.Pt.Y;\n\t\tif (i > 0) return 1;\n\t\telse if (i < 0) return -1;\n\t\telse return 0;\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.LocalMinima = function ()\n\t{\n\t\tthis.Y = 0;\n\t\tthis.LeftBound = null;\n\t\tthis.RightBound = null;\n\t\tthis.Next = null;\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.Scanbeam = function ()\n\t{\n\t\tthis.Y = 0;\n\t\tthis.Next = null;\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.Maxima = function ()\n\t{\n\t\tthis.X = 0;\n\t\tthis.Next = null;\n\t\tthis.Prev = null;\n\t};\n\n\t//OutRec: contains a path in the clipping solution. Edges in the AEL will\n\t//carry a pointer to an OutRec when they are part of the clipping solution.\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.OutRec = function ()\n\t{\n\t\tthis.Idx = 0;\n\t\tthis.IsHole = false;\n\t\tthis.IsOpen = false;\n\t\tthis.FirstLeft = null; //see comments in clipper.pas\n\t\tthis.Pts = null;\n\t\tthis.BottomPt = null;\n\t\tthis.PolyNode = null;\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.OutPt = function ()\n\t{\n\t\tthis.Idx = 0;\n\t\tthis.Pt = new ClipperLib.IntPoint0();\n\t\tthis.Next = null;\n\t\tthis.Prev = null;\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.Join = function ()\n\t{\n\t\tthis.OutPt1 = null;\n\t\tthis.OutPt2 = null;\n\t\tthis.OffPt = new ClipperLib.IntPoint0();\n\t};\n\n\tClipperLib.ClipperBase = function ()\n\t{\n\t\tthis.m_MinimaList = null;\n\t\tthis.m_CurrentLM = null;\n\t\tthis.m_edges = new Array();\n\t\tthis.m_UseFullRange = false;\n\t\tthis.m_HasOpenPaths = false;\n\t\tthis.PreserveCollinear = false;\n\t\tthis.m_Scanbeam = null;\n\t\tthis.m_PolyOuts = null;\n\t\tthis.m_ActiveEdges = null;\n\t};\n\n\t// Ranges are in original C# too high for Javascript (in current state 2013 september):\n\t// protected const double horizontal = -3.4E+38;\n\t// internal const cInt loRange = 0x3FFFFFFF; // = 1073741823 = sqrt(2^63 -1)/2\n\t// internal const cInt hiRange = 0x3FFFFFFFFFFFFFFFL; // = 4611686018427387903 = sqrt(2^127 -1)/2\n\t// So had to adjust them to more suitable for Javascript.\n\t// If JS some day supports truly 64-bit integers, then these ranges can be as in C#\n\t// and biginteger library can be more simpler (as then 128bit can be represented as two 64bit numbers)\n\tClipperLib.ClipperBase.horizontal = -9007199254740992; //-2^53\n\tClipperLib.ClipperBase.Skip = -2;\n\tClipperLib.ClipperBase.Unassigned = -1;\n\tClipperLib.ClipperBase.tolerance = 1E-20;\n\tClipperLib.ClipperBase.loRange = 47453132; // sqrt(2^53 -1)/2\n\tClipperLib.ClipperBase.hiRange = 4503599627370495; // sqrt(2^106 -1)/2\n\n\tClipperLib.ClipperBase.near_zero = function (val)\n\t{\n\t\treturn (val > -ClipperLib.ClipperBase.tolerance) && (val < ClipperLib.ClipperBase.tolerance);\n\t};\n\n\tClipperLib.ClipperBase.IsHorizontal = function (e)\n\t{\n\t\treturn e.Delta.Y === 0;\n\t};\n\n\tClipperLib.ClipperBase.prototype.PointIsVertex = function (pt, pp)\n\t{\n\t\tvar pp2 = pp;\n\t\tdo {\n\t\t\tif (ClipperLib.IntPoint.op_Equality(pp2.Pt, pt))\n\t\t\t\treturn true;\n\t\t\tpp2 = pp2.Next;\n\t\t}\n\t\twhile (pp2 !== pp)\n\t\treturn false;\n\t};\n\n\tClipperLib.ClipperBase.prototype.PointOnLineSegment = function (pt, linePt1, linePt2, UseFullRange)\n\t{\n\t\tif (UseFullRange)\n\t\t\treturn ((pt.X === linePt1.X) && (pt.Y === linePt1.Y)) ||\n\t\t\t\t((pt.X === linePt2.X) && (pt.Y === linePt2.Y)) ||\n\t\t\t\t(((pt.X > linePt1.X) === (pt.X < linePt2.X)) &&\n\t\t\t\t\t((pt.Y > linePt1.Y) === (pt.Y < linePt2.Y)) &&\n\t\t\t\t\t(Int128.op_Equality(Int128.Int128Mul((pt.X - linePt1.X), (linePt2.Y - linePt1.Y)),\n\t\t\t\t\t\tInt128.Int128Mul((linePt2.X - linePt1.X), (pt.Y - linePt1.Y)))));\n\t\telse\n\t\t\treturn ((pt.X === linePt1.X) && (pt.Y === linePt1.Y)) || ((pt.X === linePt2.X) && (pt.Y === linePt2.Y)) || (((pt.X > linePt1.X) === (pt.X < linePt2.X)) && ((pt.Y > linePt1.Y) === (pt.Y < linePt2.Y)) && ((pt.X - linePt1.X) * (linePt2.Y - linePt1.Y) === (linePt2.X - linePt1.X) * (pt.Y - linePt1.Y)));\n\t};\n\n\tClipperLib.ClipperBase.prototype.PointOnPolygon = function (pt, pp, UseFullRange)\n\t{\n\t\tvar pp2 = pp;\n\t\twhile (true)\n\t\t{\n\t\t\tif (this.PointOnLineSegment(pt, pp2.Pt, pp2.Next.Pt, UseFullRange))\n\t\t\t\treturn true;\n\t\t\tpp2 = pp2.Next;\n\t\t\tif (pp2 === pp)\n\t\t\t\tbreak;\n\t\t}\n\t\treturn false;\n\t};\n\n\tClipperLib.ClipperBase.prototype.SlopesEqual = ClipperLib.ClipperBase.SlopesEqual = function ()\n\t{\n\t\tvar a = arguments,\n\t\t\talen = a.length;\n\t\tvar e1, e2, pt1, pt2, pt3, pt4, UseFullRange;\n\t\tif (alen === 3) // function (e1, e2, UseFullRange)\n\t\t{\n\t\t\te1 = a[0];\n\t\t\te2 = a[1];\n\t\t\tUseFullRange = a[2];\n\t\t\tif (UseFullRange)\n\t\t\t\treturn Int128.op_Equality(Int128.Int128Mul(e1.Delta.Y, e2.Delta.X), Int128.Int128Mul(e1.Delta.X, e2.Delta.Y));\n\t\t\telse\n\t\t\t\treturn ClipperLib.Cast_Int64((e1.Delta.Y) * (e2.Delta.X)) === ClipperLib.Cast_Int64((e1.Delta.X) * (e2.Delta.Y));\n\t\t}\n\t\telse if (alen === 4) // function (pt1, pt2, pt3, UseFullRange)\n\t\t{\n\t\t\tpt1 = a[0];\n\t\t\tpt2 = a[1];\n\t\t\tpt3 = a[2];\n\t\t\tUseFullRange = a[3];\n\t\t\tif (UseFullRange)\n\t\t\t\treturn Int128.op_Equality(Int128.Int128Mul(pt1.Y - pt2.Y, pt2.X - pt3.X), Int128.Int128Mul(pt1.X - pt2.X, pt2.Y - pt3.Y));\n\t\t\telse\n\t\t\t\treturn ClipperLib.Cast_Int64((pt1.Y - pt2.Y) * (pt2.X - pt3.X)) - ClipperLib.Cast_Int64((pt1.X - pt2.X) * (pt2.Y - pt3.Y)) === 0;\n\t\t}\n\t\telse // function (pt1, pt2, pt3, pt4, UseFullRange)\n\t\t{\n\t\t\tpt1 = a[0];\n\t\t\tpt2 = a[1];\n\t\t\tpt3 = a[2];\n\t\t\tpt4 = a[3];\n\t\t\tUseFullRange = a[4];\n\t\t\tif (UseFullRange)\n\t\t\t\treturn Int128.op_Equality(Int128.Int128Mul(pt1.Y - pt2.Y, pt3.X - pt4.X), Int128.Int128Mul(pt1.X - pt2.X, pt3.Y - pt4.Y));\n\t\t\telse\n\t\t\t\treturn ClipperLib.Cast_Int64((pt1.Y - pt2.Y) * (pt3.X - pt4.X)) - ClipperLib.Cast_Int64((pt1.X - pt2.X) * (pt3.Y - pt4.Y)) === 0;\n\t\t}\n\t};\n\n\tClipperLib.ClipperBase.SlopesEqual3 = function (e1, e2, UseFullRange)\n\t{\n\t\tif (UseFullRange)\n\t\t\treturn Int128.op_Equality(Int128.Int128Mul(e1.Delta.Y, e2.Delta.X), Int128.Int128Mul(e1.Delta.X, e2.Delta.Y));\n\t\telse\n\t\t\treturn ClipperLib.Cast_Int64((e1.Delta.Y) * (e2.Delta.X)) === ClipperLib.Cast_Int64((e1.Delta.X) * (e2.Delta.Y));\n\t};\n\n\tClipperLib.ClipperBase.SlopesEqual4 = function (pt1, pt2, pt3, UseFullRange)\n\t{\n\t\tif (UseFullRange)\n\t\t\treturn Int128.op_Equality(Int128.Int128Mul(pt1.Y - pt2.Y, pt2.X - pt3.X), Int128.Int128Mul(pt1.X - pt2.X, pt2.Y - pt3.Y));\n\t\telse\n\t\t\treturn ClipperLib.Cast_Int64((pt1.Y - pt2.Y) * (pt2.X - pt3.X)) - ClipperLib.Cast_Int64((pt1.X - pt2.X) * (pt2.Y - pt3.Y)) === 0;\n\t};\n\n\tClipperLib.ClipperBase.SlopesEqual5 = function (pt1, pt2, pt3, pt4, UseFullRange)\n\t{\n\t\tif (UseFullRange)\n\t\t\treturn Int128.op_Equality(Int128.Int128Mul(pt1.Y - pt2.Y, pt3.X - pt4.X), Int128.Int128Mul(pt1.X - pt2.X, pt3.Y - pt4.Y));\n\t\telse\n\t\t\treturn ClipperLib.Cast_Int64((pt1.Y - pt2.Y) * (pt3.X - pt4.X)) - ClipperLib.Cast_Int64((pt1.X - pt2.X) * (pt3.Y - pt4.Y)) === 0;\n\t};\n\n\tClipperLib.ClipperBase.prototype.Clear = function ()\n\t{\n\t\tthis.DisposeLocalMinimaList();\n\t\tfor (var i = 0, ilen = this.m_edges.length; i < ilen; ++i)\n\t\t{\n\t\t\tfor (var j = 0, jlen = this.m_edges[i].length; j < jlen; ++j)\n\t\t\t\tthis.m_edges[i][j] = null;\n\t\t\tClipperLib.Clear(this.m_edges[i]);\n\t\t}\n\t\tClipperLib.Clear(this.m_edges);\n\t\tthis.m_UseFullRange = false;\n\t\tthis.m_HasOpenPaths = false;\n\t};\n\n\tClipperLib.ClipperBase.prototype.DisposeLocalMinimaList = function ()\n\t{\n\t\twhile (this.m_MinimaList !== null)\n\t\t{\n\t\t\tvar tmpLm = this.m_MinimaList.Next;\n\t\t\tthis.m_MinimaList = null;\n\t\t\tthis.m_MinimaList = tmpLm;\n\t\t}\n\t\tthis.m_CurrentLM = null;\n\t};\n\n\tClipperLib.ClipperBase.prototype.RangeTest = function (Pt, useFullRange)\n\t{\n\t\tif (useFullRange.Value)\n\t\t{\n\t\t\tif (Pt.X > ClipperLib.ClipperBase.hiRange || Pt.Y > ClipperLib.ClipperBase.hiRange || -Pt.X > ClipperLib.ClipperBase.hiRange || -Pt.Y > ClipperLib.ClipperBase.hiRange)\n\t\t\t\tClipperLib.Error(\"Coordinate outside allowed range in RangeTest().\");\n\t\t}\n\t\telse if (Pt.X > ClipperLib.ClipperBase.loRange || Pt.Y > ClipperLib.ClipperBase.loRange || -Pt.X > ClipperLib.ClipperBase.loRange || -Pt.Y > ClipperLib.ClipperBase.loRange)\n\t\t{\n\t\t\tuseFullRange.Value = true;\n\t\t\tthis.RangeTest(Pt, useFullRange);\n\t\t}\n\t};\n\n\tClipperLib.ClipperBase.prototype.InitEdge = function (e, eNext, ePrev, pt)\n\t{\n\t\te.Next = eNext;\n\t\te.Prev = ePrev;\n\t\t//e.Curr = pt;\n\t\te.Curr.X = pt.X;\n\t\te.Curr.Y = pt.Y;\n\t\tif (ClipperLib.use_xyz) e.Curr.Z = pt.Z;\n\t\te.OutIdx = -1;\n\t};\n\n\tClipperLib.ClipperBase.prototype.InitEdge2 = function (e, polyType)\n\t{\n\t\tif (e.Curr.Y >= e.Next.Curr.Y)\n\t\t{\n\t\t\t//e.Bot = e.Curr;\n\t\t\te.Bot.X = e.Curr.X;\n\t\t\te.Bot.Y = e.Curr.Y;\n\t\t\tif (ClipperLib.use_xyz) e.Bot.Z = e.Curr.Z;\n\t\t\t//e.Top = e.Next.Curr;\n\t\t\te.Top.X = e.Next.Curr.X;\n\t\t\te.Top.Y = e.Next.Curr.Y;\n\t\t\tif (ClipperLib.use_xyz) e.Top.Z = e.Next.Curr.Z;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//e.Top = e.Curr;\n\t\t\te.Top.X = e.Curr.X;\n\t\t\te.Top.Y = e.Curr.Y;\n\t\t\tif (ClipperLib.use_xyz) e.Top.Z = e.Curr.Z;\n\t\t\t//e.Bot = e.Next.Curr;\n\t\t\te.Bot.X = e.Next.Curr.X;\n\t\t\te.Bot.Y = e.Next.Curr.Y;\n\t\t\tif (ClipperLib.use_xyz) e.Bot.Z = e.Next.Curr.Z;\n\t\t}\n\t\tthis.SetDx(e);\n\t\te.PolyTyp = polyType;\n\t};\n\n\tClipperLib.ClipperBase.prototype.FindNextLocMin = function (E)\n\t{\n\t\tvar E2;\n\t\tfor (;;)\n\t\t{\n\t\t\twhile (ClipperLib.IntPoint.op_Inequality(E.Bot, E.Prev.Bot) || ClipperLib.IntPoint.op_Equality(E.Curr, E.Top))\n\t\t\t\tE = E.Next;\n\t\t\tif (E.Dx !== ClipperLib.ClipperBase.horizontal && E.Prev.Dx !== ClipperLib.ClipperBase.horizontal)\n\t\t\t\tbreak;\n\t\t\twhile (E.Prev.Dx === ClipperLib.ClipperBase.horizontal)\n\t\t\t\tE = E.Prev;\n\t\t\tE2 = E;\n\t\t\twhile (E.Dx === ClipperLib.ClipperBase.horizontal)\n\t\t\t\tE = E.Next;\n\t\t\tif (E.Top.Y === E.Prev.Bot.Y)\n\t\t\t\tcontinue;\n\t\t\t//ie just an intermediate horz.\n\t\t\tif (E2.Prev.Bot.X < E.Bot.X)\n\t\t\t\tE = E2;\n\t\t\tbreak;\n\t\t}\n\t\treturn E;\n\t};\n\n\tClipperLib.ClipperBase.prototype.ProcessBound = function (E, LeftBoundIsForward)\n\t{\n\t\tvar EStart;\n\t\tvar Result = E;\n\t\tvar Horz;\n\n\t\tif (Result.OutIdx === ClipperLib.ClipperBase.Skip)\n\t\t{\n\t\t\t//check if there are edges beyond the skip edge in the bound and if so\n\t\t\t//create another LocMin and calling ProcessBound once more ...\n\t\t\tE = Result;\n\t\t\tif (LeftBoundIsForward)\n\t\t\t{\n\t\t\t\twhile (E.Top.Y === E.Next.Bot.Y) E = E.Next;\n\t\t\t\twhile (E !== Result && E.Dx === ClipperLib.ClipperBase.horizontal) E = E.Prev;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile (E.Top.Y === E.Prev.Bot.Y) E = E.Prev;\n\t\t\t\twhile (E !== Result && E.Dx === ClipperLib.ClipperBase.horizontal) E = E.Next;\n\t\t\t}\n\t\t\tif (E === Result)\n\t\t\t{\n\t\t\t\tif (LeftBoundIsForward) Result = E.Next;\n\t\t\t\telse Result = E.Prev;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//there are more edges in the bound beyond result starting with E\n\t\t\t\tif (LeftBoundIsForward)\n\t\t\t\t\tE = Result.Next;\n\t\t\t\telse\n\t\t\t\t\tE = Result.Prev;\n\t\t\t\tvar locMin = new ClipperLib.LocalMinima();\n\t\t\t\tlocMin.Next = null;\n\t\t\t\tlocMin.Y = E.Bot.Y;\n\t\t\t\tlocMin.LeftBound = null;\n\t\t\t\tlocMin.RightBound = E;\n\t\t\t\tE.WindDelta = 0;\n\t\t\t\tResult = this.ProcessBound(E, LeftBoundIsForward);\n\t\t\t\tthis.InsertLocalMinima(locMin);\n\t\t\t}\n\t\t\treturn Result;\n\t\t}\n\n\t\tif (E.Dx === ClipperLib.ClipperBase.horizontal)\n\t\t{\n\t\t\t//We need to be careful with open paths because this may not be a\n\t\t\t//true local minima (ie E may be following a skip edge).\n\t\t\t//Also, consecutive horz. edges may start heading left before going right.\n\t\t\tif (LeftBoundIsForward) EStart = E.Prev;\n\t\t\telse EStart = E.Next;\n\n\t\t\tif (EStart.Dx === ClipperLib.ClipperBase.horizontal) //ie an adjoining horizontal skip edge\n\t\t\t{\n\t\t\t\tif (EStart.Bot.X !== E.Bot.X && EStart.Top.X !== E.Bot.X)\n\t\t\t\t\tthis.ReverseHorizontal(E);\n\t\t\t}\n\t\t\telse if (EStart.Bot.X !== E.Bot.X)\n\t\t\t\tthis.ReverseHorizontal(E);\n\t\t}\n\n\t\tEStart = E;\n\t\tif (LeftBoundIsForward)\n\t\t{\n\t\t\twhile (Result.Top.Y === Result.Next.Bot.Y && Result.Next.OutIdx !== ClipperLib.ClipperBase.Skip)\n\t\t\t\tResult = Result.Next;\n\t\t\tif (Result.Dx === ClipperLib.ClipperBase.horizontal && Result.Next.OutIdx !== ClipperLib.ClipperBase.Skip)\n\t\t\t{\n\t\t\t\t//nb: at the top of a bound, horizontals are added to the bound\n\t\t\t\t//only when the preceding edge attaches to the horizontal's left vertex\n\t\t\t\t//unless a Skip edge is encountered when that becomes the top divide\n\t\t\t\tHorz = Result;\n\t\t\t\twhile (Horz.Prev.Dx === ClipperLib.ClipperBase.horizontal)\n\t\t\t\t\tHorz = Horz.Prev;\n\t\t\t\tif (Horz.Prev.Top.X > Result.Next.Top.X)\n\t\t\t\t\tResult = Horz.Prev;\n\t\t\t}\n\t\t\twhile (E !== Result)\n\t\t\t{\n\t\t\t\tE.NextInLML = E.Next;\n\t\t\t\tif (E.Dx === ClipperLib.ClipperBase.horizontal && E !== EStart && E.Bot.X !== E.Prev.Top.X)\n\t\t\t\t\tthis.ReverseHorizontal(E);\n\t\t\t\tE = E.Next;\n\t\t\t}\n\t\t\tif (E.Dx === ClipperLib.ClipperBase.horizontal && E !== EStart && E.Bot.X !== E.Prev.Top.X)\n\t\t\t\tthis.ReverseHorizontal(E);\n\t\t\tResult = Result.Next;\n\t\t\t//move to the edge just beyond current bound\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile (Result.Top.Y === Result.Prev.Bot.Y && Result.Prev.OutIdx !== ClipperLib.ClipperBase.Skip)\n\t\t\t\tResult = Result.Prev;\n\t\t\tif (Result.Dx === ClipperLib.ClipperBase.horizontal && Result.Prev.OutIdx !== ClipperLib.ClipperBase.Skip)\n\t\t\t{\n\t\t\t\tHorz = Result;\n\t\t\t\twhile (Horz.Next.Dx === ClipperLib.ClipperBase.horizontal)\n\t\t\t\t\tHorz = Horz.Next;\n\t\t\t\tif (Horz.Next.Top.X === Result.Prev.Top.X || Horz.Next.Top.X > Result.Prev.Top.X)\n\t\t\t\t{\n\t\t\t\t\tResult = Horz.Next;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (E !== Result)\n\t\t\t{\n\t\t\t\tE.NextInLML = E.Prev;\n\t\t\t\tif (E.Dx === ClipperLib.ClipperBase.horizontal && E !== EStart && E.Bot.X !== E.Next.Top.X)\n\t\t\t\t\tthis.ReverseHorizontal(E);\n\t\t\t\tE = E.Prev;\n\t\t\t}\n\t\t\tif (E.Dx === ClipperLib.ClipperBase.horizontal && E !== EStart && E.Bot.X !== E.Next.Top.X)\n\t\t\t\tthis.ReverseHorizontal(E);\n\t\t\tResult = Result.Prev;\n\t\t\t//move to the edge just beyond current bound\n\t\t}\n\n\t\treturn Result;\n\t};\n\n\tClipperLib.ClipperBase.prototype.AddPath = function (pg, polyType, Closed)\n\t{\n\t\tif (ClipperLib.use_lines)\n\t\t{\n\t\t\tif (!Closed && polyType === ClipperLib.PolyType.ptClip)\n\t\t\t\tClipperLib.Error(\"AddPath: Open paths must be subject.\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (!Closed)\n\t\t\t\tClipperLib.Error(\"AddPath: Open paths have been disabled.\");\n\t\t}\n\t\tvar highI = pg.length - 1;\n\t\tif (Closed)\n\t\t\twhile (highI > 0 && (ClipperLib.IntPoint.op_Equality(pg[highI], pg[0])))\n\t\t\t\t--highI;\n\t\twhile (highI > 0 && (ClipperLib.IntPoint.op_Equality(pg[highI], pg[highI - 1])))\n\t\t\t--highI;\n\t\tif ((Closed && highI < 2) || (!Closed && highI < 1))\n\t\t\treturn false;\n\t\t//create a new edge array ...\n\t\tvar edges = new Array();\n\t\tfor (var i = 0; i <= highI; i++)\n\t\t\tedges.push(new ClipperLib.TEdge());\n\t\tvar IsFlat = true;\n\t\t//1. Basic (first) edge initialization ...\n\n\t\t//edges[1].Curr = pg[1];\n\t\tedges[1].Curr.X = pg[1].X;\n\t\tedges[1].Curr.Y = pg[1].Y;\n\t\tif (ClipperLib.use_xyz) edges[1].Curr.Z = pg[1].Z;\n\n\t\tvar $1 = {\n\t\t\tValue: this.m_UseFullRange\n\t\t};\n\n\t\tthis.RangeTest(pg[0], $1);\n\t\tthis.m_UseFullRange = $1.Value;\n\n\t\t$1.Value = this.m_UseFullRange;\n\t\tthis.RangeTest(pg[highI], $1);\n\t\tthis.m_UseFullRange = $1.Value;\n\n\t\tthis.InitEdge(edges[0], edges[1], edges[highI], pg[0]);\n\t\tthis.InitEdge(edges[highI], edges[0], edges[highI - 1], pg[highI]);\n\t\tfor (var i = highI - 1; i >= 1; --i)\n\t\t{\n\t\t\t$1.Value = this.m_UseFullRange;\n\t\t\tthis.RangeTest(pg[i], $1);\n\t\t\tthis.m_UseFullRange = $1.Value;\n\n\t\t\tthis.InitEdge(edges[i], edges[i + 1], edges[i - 1], pg[i]);\n\t\t}\n\n\t\tvar eStart = edges[0];\n\t\t//2. Remove duplicate vertices, and (when closed) collinear edges ...\n\t\tvar E = eStart,\n\t\t\teLoopStop = eStart;\n\t\tfor (;;)\n\t\t{\n\t\t\t//console.log(E.Next, eStart);\n\t\t\t//nb: allows matching start and end points when not Closed ...\n\t\t\tif (E.Curr === E.Next.Curr && (Closed || E.Next !== eStart))\n\t\t\t{\n\t\t\t\tif (E === E.Next)\n\t\t\t\t\tbreak;\n\t\t\t\tif (E === eStart)\n\t\t\t\t\teStart = E.Next;\n\t\t\t\tE = this.RemoveEdge(E);\n\t\t\t\teLoopStop = E;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (E.Prev === E.Next)\n\t\t\t\tbreak;\n\t\t\telse if (Closed && ClipperLib.ClipperBase.SlopesEqual4(E.Prev.Curr, E.Curr, E.Next.Curr, this.m_UseFullRange) && (!this.PreserveCollinear || !this.Pt2IsBetweenPt1AndPt3(E.Prev.Curr, E.Curr, E.Next.Curr)))\n\t\t\t{\n\t\t\t\t//Collinear edges are allowed for open paths but in closed paths\n\t\t\t\t//the default is to merge adjacent collinear edges into a single edge.\n\t\t\t\t//However, if the PreserveCollinear property is enabled, only overlapping\n\t\t\t\t//collinear edges (ie spikes) will be removed from closed paths.\n\t\t\t\tif (E === eStart)\n\t\t\t\t\teStart = E.Next;\n\t\t\t\tE = this.RemoveEdge(E);\n\t\t\t\tE = E.Prev;\n\t\t\t\teLoopStop = E;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tE = E.Next;\n\t\t\tif ((E === eLoopStop) || (!Closed && E.Next === eStart)) break;\n\t\t}\n\t\tif ((!Closed && (E === E.Next)) || (Closed && (E.Prev === E.Next)))\n\t\t\treturn false;\n\t\tif (!Closed)\n\t\t{\n\t\t\tthis.m_HasOpenPaths = true;\n\t\t\teStart.Prev.OutIdx = ClipperLib.ClipperBase.Skip;\n\t\t}\n\t\t//3. Do second stage of edge initialization ...\n\t\tE = eStart;\n\t\tdo {\n\t\t\tthis.InitEdge2(E, polyType);\n\t\t\tE = E.Next;\n\t\t\tif (IsFlat && E.Curr.Y !== eStart.Curr.Y)\n\t\t\t\tIsFlat = false;\n\t\t}\n\t\twhile (E !== eStart)\n\t\t//4. Finally, add edge bounds to LocalMinima list ...\n\t\t//Totally flat paths must be handled differently when adding them\n\t\t//to LocalMinima list to avoid endless loops etc ...\n\t\tif (IsFlat)\n\t\t{\n\t\t\tif (Closed)\n\t\t\t\treturn false;\n\n\t\t\tE.Prev.OutIdx = ClipperLib.ClipperBase.Skip;\n\n\t\t\tvar locMin = new ClipperLib.LocalMinima();\n\t\t\tlocMin.Next = null;\n\t\t\tlocMin.Y = E.Bot.Y;\n\t\t\tlocMin.LeftBound = null;\n\t\t\tlocMin.RightBound = E;\n\t\t\tlocMin.RightBound.Side = ClipperLib.EdgeSide.esRight;\n\t\t\tlocMin.RightBound.WindDelta = 0;\n\n\t\t\tfor (;;)\n\t\t\t{\n\t\t\t\tif (E.Bot.X !== E.Prev.Top.X) this.ReverseHorizontal(E);\n\t\t\t\tif (E.Next.OutIdx === ClipperLib.ClipperBase.Skip) break;\n\t\t\t\tE.NextInLML = E.Next;\n\t\t\t\tE = E.Next;\n\t\t\t}\n\t\t\tthis.InsertLocalMinima(locMin);\n\t\t\tthis.m_edges.push(edges);\n\t\t\treturn true;\n\t\t}\n\t\tthis.m_edges.push(edges);\n\t\tvar leftBoundIsForward;\n\t\tvar EMin = null;\n\n\t\t//workaround to avoid an endless loop in the while loop below when\n\t\t//open paths have matching start and end points ...\n\t\tif (ClipperLib.IntPoint.op_Equality(E.Prev.Bot, E.Prev.Top))\n\t\t\tE = E.Next;\n\n\t\tfor (;;)\n\t\t{\n\t\t\tE = this.FindNextLocMin(E);\n\t\t\tif (E === EMin)\n\t\t\t\tbreak;\n\t\t\telse if (EMin === null)\n\t\t\t\tEMin = E;\n\t\t\t//E and E.Prev now share a local minima (left aligned if horizontal).\n\t\t\t//Compare their slopes to find which starts which bound ...\n\t\t\tvar locMin = new ClipperLib.LocalMinima();\n\t\t\tlocMin.Next = null;\n\t\t\tlocMin.Y = E.Bot.Y;\n\t\t\tif (E.Dx < E.Prev.Dx)\n\t\t\t{\n\t\t\t\tlocMin.LeftBound = E.Prev;\n\t\t\t\tlocMin.RightBound = E;\n\t\t\t\tleftBoundIsForward = false;\n\t\t\t\t//Q.nextInLML = Q.prev\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlocMin.LeftBound = E;\n\t\t\t\tlocMin.RightBound = E.Prev;\n\t\t\t\tleftBoundIsForward = true;\n\t\t\t\t//Q.nextInLML = Q.next\n\t\t\t}\n\t\t\tlocMin.LeftBound.Side = ClipperLib.EdgeSide.esLeft;\n\t\t\tlocMin.RightBound.Side = ClipperLib.EdgeSide.esRight;\n\t\t\tif (!Closed)\n\t\t\t\tlocMin.LeftBound.WindDelta = 0;\n\t\t\telse if (locMin.LeftBound.Next === locMin.RightBound)\n\t\t\t\tlocMin.LeftBound.WindDelta = -1;\n\t\t\telse\n\t\t\t\tlocMin.LeftBound.WindDelta = 1;\n\t\t\tlocMin.RightBound.WindDelta = -locMin.LeftBound.WindDelta;\n\t\t\tE = this.ProcessBound(locMin.LeftBound, leftBoundIsForward);\n\t\t\tif (E.OutIdx === ClipperLib.ClipperBase.Skip)\n\t\t\t\tE = this.ProcessBound(E, leftBoundIsForward);\n\t\t\tvar E2 = this.ProcessBound(locMin.RightBound, !leftBoundIsForward);\n\t\t\tif (E2.OutIdx === ClipperLib.ClipperBase.Skip) E2 = this.ProcessBound(E2, !leftBoundIsForward);\n\t\t\tif (locMin.LeftBound.OutIdx === ClipperLib.ClipperBase.Skip)\n\t\t\t\tlocMin.LeftBound = null;\n\t\t\telse if (locMin.RightBound.OutIdx === ClipperLib.ClipperBase.Skip)\n\t\t\t\tlocMin.RightBound = null;\n\t\t\tthis.InsertLocalMinima(locMin);\n\t\t\tif (!leftBoundIsForward)\n\t\t\t\tE = E2;\n\t\t}\n\t\treturn true;\n\t};\n\n\tClipperLib.ClipperBase.prototype.AddPaths = function (ppg, polyType, closed)\n\t{\n\t\t// console.log(\"-------------------------------------------\");\n\t\t// console.log(JSON.stringify(ppg));\n\t\tvar result = false;\n\t\tfor (var i = 0, ilen = ppg.length; i < ilen; ++i)\n\t\t\tif (this.AddPath(ppg[i], polyType, closed))\n\t\t\t\tresult = true;\n\t\treturn result;\n\t};\n\n\tClipperLib.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3 = function (pt1, pt2, pt3)\n\t{\n\t\tif ((ClipperLib.IntPoint.op_Equality(pt1, pt3)) || (ClipperLib.IntPoint.op_Equality(pt1, pt2)) || (ClipperLib.IntPoint.op_Equality(pt3, pt2)))\n\n\t\t\t//if ((pt1 == pt3) || (pt1 == pt2) || (pt3 == pt2))\n\t\t\treturn false;\n\n\t\telse if (pt1.X !== pt3.X)\n\t\t\treturn (pt2.X > pt1.X) === (pt2.X < pt3.X);\n\t\telse\n\t\t\treturn (pt2.Y > pt1.Y) === (pt2.Y < pt3.Y);\n\t};\n\n\tClipperLib.ClipperBase.prototype.RemoveEdge = function (e)\n\t{\n\t\t//removes e from double_linked_list (but without removing from memory)\n\t\te.Prev.Next = e.Next;\n\t\te.Next.Prev = e.Prev;\n\t\tvar result = e.Next;\n\t\te.Prev = null; //flag as removed (see ClipperBase.Clear)\n\t\treturn result;\n\t};\n\n\tClipperLib.ClipperBase.prototype.SetDx = function (e)\n\t{\n\t\te.Delta.X = (e.Top.X - e.Bot.X);\n\t\te.Delta.Y = (e.Top.Y - e.Bot.Y);\n\t\tif (e.Delta.Y === 0) e.Dx = ClipperLib.ClipperBase.horizontal;\n\t\telse e.Dx = (e.Delta.X) / (e.Delta.Y);\n\t};\n\n\tClipperLib.ClipperBase.prototype.InsertLocalMinima = function (newLm)\n\t{\n\t\tif (this.m_MinimaList === null)\n\t\t{\n\t\t\tthis.m_MinimaList = newLm;\n\t\t}\n\t\telse if (newLm.Y >= this.m_MinimaList.Y)\n\t\t{\n\t\t\tnewLm.Next = this.m_MinimaList;\n\t\t\tthis.m_MinimaList = newLm;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar tmpLm = this.m_MinimaList;\n\t\t\twhile (tmpLm.Next !== null && (newLm.Y < tmpLm.Next.Y))\n\t\t\t\ttmpLm = tmpLm.Next;\n\t\t\tnewLm.Next = tmpLm.Next;\n\t\t\ttmpLm.Next = newLm;\n\t\t}\n\t};\n\n\tClipperLib.ClipperBase.prototype.PopLocalMinima = function (Y, current)\n\t{\n\t\tcurrent.v = this.m_CurrentLM;\n\t\tif (this.m_CurrentLM !== null && this.m_CurrentLM.Y === Y)\n\t\t{\n\t\t\tthis.m_CurrentLM = this.m_CurrentLM.Next;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n\n\tClipperLib.ClipperBase.prototype.ReverseHorizontal = function (e)\n\t{\n\t\t//swap horizontal edges' top and bottom x's so they follow the natural\n\t\t//progression of the bounds - ie so their xbots will align with the\n\t\t//adjoining lower edge. [Helpful in the ProcessHorizontal() method.]\n\t\tvar tmp = e.Top.X;\n\t\te.Top.X = e.Bot.X;\n\t\te.Bot.X = tmp;\n\t\tif (ClipperLib.use_xyz)\n\t\t{\n\t\t\ttmp = e.Top.Z;\n\t\t\te.Top.Z = e.Bot.Z;\n\t\t\te.Bot.Z = tmp;\n\t\t}\n\t};\n\n\tClipperLib.ClipperBase.prototype.Reset = function ()\n\t{\n\t\tthis.m_CurrentLM = this.m_MinimaList;\n\t\tif (this.m_CurrentLM === null) //ie nothing to process\n\t\t\treturn;\n\t\t//reset all edges ...\n\t\tthis.m_Scanbeam = null;\n\t\tvar lm = this.m_MinimaList;\n\t\twhile (lm !== null)\n\t\t{\n\t\t\tthis.InsertScanbeam(lm.Y);\n\t\t\tvar e = lm.LeftBound;\n\t\t\tif (e !== null)\n\t\t\t{\n\t\t\t\t//e.Curr = e.Bot;\n\t\t\t\te.Curr.X = e.Bot.X;\n\t\t\t\te.Curr.Y = e.Bot.Y;\n\t\t\t\tif (ClipperLib.use_xyz) e.Curr.Z = e.Bot.Z;\n\t\t\t\te.OutIdx = ClipperLib.ClipperBase.Unassigned;\n\t\t\t}\n\t\t\te = lm.RightBound;\n\t\t\tif (e !== null)\n\t\t\t{\n\t\t\t\t//e.Curr = e.Bot;\n\t\t\t\te.Curr.X = e.Bot.X;\n\t\t\t\te.Curr.Y = e.Bot.Y;\n\t\t\t\tif (ClipperLib.use_xyz) e.Curr.Z = e.Bot.Z;\n\t\t\t\te.OutIdx = ClipperLib.ClipperBase.Unassigned;\n\t\t\t}\n\t\t\tlm = lm.Next;\n\t\t}\n\t\tthis.m_ActiveEdges = null;\n\t};\n\n\tClipperLib.ClipperBase.prototype.InsertScanbeam = function (Y)\n\t{\n\t\t//single-linked list: sorted descending, ignoring dups.\n\t\tif (this.m_Scanbeam === null)\n\t\t{\n\t\t\tthis.m_Scanbeam = new ClipperLib.Scanbeam();\n\t\t\tthis.m_Scanbeam.Next = null;\n\t\t\tthis.m_Scanbeam.Y = Y;\n\t\t}\n\t\telse if (Y > this.m_Scanbeam.Y)\n\t\t{\n\t\t\tvar newSb = new ClipperLib.Scanbeam();\n\t\t\tnewSb.Y = Y;\n\t\t\tnewSb.Next = this.m_Scanbeam;\n\t\t\tthis.m_Scanbeam = newSb;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar sb2 = this.m_Scanbeam;\n\t\t\twhile (sb2.Next !== null && Y <= sb2.Next.Y)\n\t\t\t{\n\t\t\t\tsb2 = sb2.Next;\n\t\t\t}\n\t\t\tif (Y === sb2.Y)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t} //ie ignores duplicates\n\t\t\tvar newSb1 = new ClipperLib.Scanbeam();\n\t\t\tnewSb1.Y = Y;\n\t\t\tnewSb1.Next = sb2.Next;\n\t\t\tsb2.Next = newSb1;\n\t\t}\n\t};\n\n\tClipperLib.ClipperBase.prototype.PopScanbeam = function (Y)\n\t{\n\t\tif (this.m_Scanbeam === null)\n\t\t{\n\t\t\tY.v = 0;\n\t\t\treturn false;\n\t\t}\n\t\tY.v = this.m_Scanbeam.Y;\n\t\tthis.m_Scanbeam = this.m_Scanbeam.Next;\n\t\treturn true;\n\t};\n\n\tClipperLib.ClipperBase.prototype.LocalMinimaPending = function ()\n\t{\n\t\treturn (this.m_CurrentLM !== null);\n\t};\n\n\tClipperLib.ClipperBase.prototype.CreateOutRec = function ()\n\t{\n\t\tvar result = new ClipperLib.OutRec();\n\t\tresult.Idx = ClipperLib.ClipperBase.Unassigned;\n\t\tresult.IsHole = false;\n\t\tresult.IsOpen = false;\n\t\tresult.FirstLeft = null;\n\t\tresult.Pts = null;\n\t\tresult.BottomPt = null;\n\t\tresult.PolyNode = null;\n\t\tthis.m_PolyOuts.push(result);\n\t\tresult.Idx = this.m_PolyOuts.length - 1;\n\t\treturn result;\n\t};\n\n\tClipperLib.ClipperBase.prototype.DisposeOutRec = function (index)\n\t{\n\t\tvar outRec = this.m_PolyOuts[index];\n\t\toutRec.Pts = null;\n\t\toutRec = null;\n\t\tthis.m_PolyOuts[index] = null;\n\t};\n\n\tClipperLib.ClipperBase.prototype.UpdateEdgeIntoAEL = function (e)\n\t{\n\t\tif (e.NextInLML === null)\n\t\t{\n\t\t\tClipperLib.Error(\"UpdateEdgeIntoAEL: invalid call\");\n\t\t}\n\t\tvar AelPrev = e.PrevInAEL;\n\t\tvar AelNext = e.NextInAEL;\n\t\te.NextInLML.OutIdx = e.OutIdx;\n\t\tif (AelPrev !== null)\n\t\t{\n\t\t\tAelPrev.NextInAEL = e.NextInLML;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.m_ActiveEdges = e.NextInLML;\n\t\t}\n\t\tif (AelNext !== null)\n\t\t{\n\t\t\tAelNext.PrevInAEL = e.NextInLML;\n\t\t}\n\t\te.NextInLML.Side = e.Side;\n\t\te.NextInLML.WindDelta = e.WindDelta;\n\t\te.NextInLML.WindCnt = e.WindCnt;\n\t\te.NextInLML.WindCnt2 = e.WindCnt2;\n\t\te = e.NextInLML;\n\t\te.Curr.X = e.Bot.X;\n\t\te.Curr.Y = e.Bot.Y;\n\t\te.PrevInAEL = AelPrev;\n\t\te.NextInAEL = AelNext;\n\t\tif (!ClipperLib.ClipperBase.IsHorizontal(e))\n\t\t{\n\t\t\tthis.InsertScanbeam(e.Top.Y);\n\t\t}\n\t\treturn e;\n\t};\n\n\tClipperLib.ClipperBase.prototype.SwapPositionsInAEL = function (edge1, edge2)\n\t{\n\t\t//check that one or other edge hasn't already been removed from AEL ...\n\t\tif (edge1.NextInAEL === edge1.PrevInAEL || edge2.NextInAEL === edge2.PrevInAEL)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tif (edge1.NextInAEL === edge2)\n\t\t{\n\t\t\tvar next = edge2.NextInAEL;\n\t\t\tif (next !== null)\n\t\t\t{\n\t\t\t\tnext.PrevInAEL = edge1;\n\t\t\t}\n\t\t\tvar prev = edge1.PrevInAEL;\n\t\t\tif (prev !== null)\n\t\t\t{\n\t\t\t\tprev.NextInAEL = edge2;\n\t\t\t}\n\t\t\tedge2.PrevInAEL = prev;\n\t\t\tedge2.NextInAEL = edge1;\n\t\t\tedge1.PrevInAEL = edge2;\n\t\t\tedge1.NextInAEL = next;\n\t\t}\n\t\telse if (edge2.NextInAEL === edge1)\n\t\t{\n\t\t\tvar next1 = edge1.NextInAEL;\n\t\t\tif (next1 !== null)\n\t\t\t{\n\t\t\t\tnext1.PrevInAEL = edge2;\n\t\t\t}\n\t\t\tvar prev1 = edge2.PrevInAEL;\n\t\t\tif (prev1 !== null)\n\t\t\t{\n\t\t\t\tprev1.NextInAEL = edge1;\n\t\t\t}\n\t\t\tedge1.PrevInAEL = prev1;\n\t\t\tedge1.NextInAEL = edge2;\n\t\t\tedge2.PrevInAEL = edge1;\n\t\t\tedge2.NextInAEL = next1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar next2 = edge1.NextInAEL;\n\t\t\tvar prev2 = edge1.PrevInAEL;\n\t\t\tedge1.NextInAEL = edge2.NextInAEL;\n\t\t\tif (edge1.NextInAEL !== null)\n\t\t\t{\n\t\t\t\tedge1.NextInAEL.PrevInAEL = edge1;\n\t\t\t}\n\t\t\tedge1.PrevInAEL = edge2.PrevInAEL;\n\t\t\tif (edge1.PrevInAEL !== null)\n\t\t\t{\n\t\t\t\tedge1.PrevInAEL.NextInAEL = edge1;\n\t\t\t}\n\t\t\tedge2.NextInAEL = next2;\n\t\t\tif (edge2.NextInAEL !== null)\n\t\t\t{\n\t\t\t\tedge2.NextInAEL.PrevInAEL = edge2;\n\t\t\t}\n\t\t\tedge2.PrevInAEL = prev2;\n\t\t\tif (edge2.PrevInAEL !== null)\n\t\t\t{\n\t\t\t\tedge2.PrevInAEL.NextInAEL = edge2;\n\t\t\t}\n\t\t}\n\n\t\tif (edge1.PrevInAEL === null)\n\t\t{\n\t\t\tthis.m_ActiveEdges = edge1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (edge2.PrevInAEL === null)\n\t\t\t{\n\t\t\t\tthis.m_ActiveEdges = edge2;\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.ClipperBase.prototype.DeleteFromAEL = function (e)\n\t{\n\t\tvar AelPrev = e.PrevInAEL;\n\t\tvar AelNext = e.NextInAEL;\n\t\tif (AelPrev === null && AelNext === null && e !== this.m_ActiveEdges)\n\t\t{\n\t\t\treturn;\n\t\t} //already deleted\n\t\tif (AelPrev !== null)\n\t\t{\n\t\t\tAelPrev.NextInAEL = AelNext;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.m_ActiveEdges = AelNext;\n\t\t}\n\t\tif (AelNext !== null)\n\t\t{\n\t\t\tAelNext.PrevInAEL = AelPrev;\n\t\t}\n\t\te.NextInAEL = null;\n\t\te.PrevInAEL = null;\n\t}\n\n\t// public Clipper(int InitOptions = 0)\n\t/**\n\t * @suppress {missingProperties}\n\t */\n\tClipperLib.Clipper = function (InitOptions)\n\t{\n\t\tif (typeof (InitOptions) === \"undefined\") InitOptions = 0;\n\t\tthis.m_PolyOuts = null;\n\t\tthis.m_ClipType = ClipperLib.ClipType.ctIntersection;\n\t\tthis.m_Scanbeam = null;\n\t\tthis.m_Maxima = null;\n\t\tthis.m_ActiveEdges = null;\n\t\tthis.m_SortedEdges = null;\n\t\tthis.m_IntersectList = null;\n\t\tthis.m_IntersectNodeComparer = null;\n\t\tthis.m_ExecuteLocked = false;\n\t\tthis.m_ClipFillType = ClipperLib.PolyFillType.pftEvenOdd;\n\t\tthis.m_SubjFillType = ClipperLib.PolyFillType.pftEvenOdd;\n\t\tthis.m_Joins = null;\n\t\tthis.m_GhostJoins = null;\n\t\tthis.m_UsingPolyTree = false;\n\t\tthis.ReverseSolution = false;\n\t\tthis.StrictlySimple = false;\n\n\t\tClipperLib.ClipperBase.call(this);\n\n\t\tthis.m_Scanbeam = null;\n\t\tthis.m_Maxima = null;\n\t\tthis.m_ActiveEdges = null;\n\t\tthis.m_SortedEdges = null;\n\t\tthis.m_IntersectList = new Array();\n\t\tthis.m_IntersectNodeComparer = ClipperLib.MyIntersectNodeSort.Compare;\n\t\tthis.m_ExecuteLocked = false;\n\t\tthis.m_UsingPolyTree = false;\n\t\tthis.m_PolyOuts = new Array();\n\t\tthis.m_Joins = new Array();\n\t\tthis.m_GhostJoins = new Array();\n\t\tthis.ReverseSolution = (1 & InitOptions) !== 0;\n\t\tthis.StrictlySimple = (2 & InitOptions) !== 0;\n\t\tthis.PreserveCollinear = (4 & InitOptions) !== 0;\n\t\tif (ClipperLib.use_xyz)\n\t\t{\n\t\t\tthis.ZFillFunction = null; // function (IntPoint vert1, IntPoint vert2, ref IntPoint intersectPt);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.ioReverseSolution = 1;\n\tClipperLib.Clipper.ioStrictlySimple = 2;\n\tClipperLib.Clipper.ioPreserveCollinear = 4;\n\n\tClipperLib.Clipper.prototype.Clear = function ()\n\t{\n\t\tif (this.m_edges.length === 0)\n\t\t\treturn;\n\t\t//avoids problems with ClipperBase destructor\n\t\tthis.DisposeAllPolyPts();\n\t\tClipperLib.ClipperBase.prototype.Clear.call(this);\n\t};\n\n\tClipperLib.Clipper.prototype.InsertMaxima = function (X)\n\t{\n\t\t//double-linked list: sorted ascending, ignoring dups.\n\t\tvar newMax = new ClipperLib.Maxima();\n\t\tnewMax.X = X;\n\t\tif (this.m_Maxima === null)\n\t\t{\n\t\t\tthis.m_Maxima = newMax;\n\t\t\tthis.m_Maxima.Next = null;\n\t\t\tthis.m_Maxima.Prev = null;\n\t\t}\n\t\telse if (X < this.m_Maxima.X)\n\t\t{\n\t\t\tnewMax.Next = this.m_Maxima;\n\t\t\tnewMax.Prev = null;\n\t\t\tthis.m_Maxima = newMax;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar m = this.m_Maxima;\n\t\t\twhile (m.Next !== null && X >= m.Next.X)\n\t\t\t{\n\t\t\t\tm = m.Next;\n\t\t\t}\n\t\t\tif (X === m.X)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t} //ie ignores duplicates (& CG to clean up newMax)\n\t\t\t//insert newMax between m and m.Next ...\n\t\t\tnewMax.Next = m.Next;\n\t\t\tnewMax.Prev = m;\n\t\t\tif (m.Next !== null)\n\t\t\t{\n\t\t\t\tm.Next.Prev = newMax;\n\t\t\t}\n\t\t\tm.Next = newMax;\n\t\t}\n\t};\n\n\t// ************************************\n\tClipperLib.Clipper.prototype.Execute = function ()\n\t{\n\t\tvar a = arguments,\n\t\t\talen = a.length,\n\t\t\tispolytree = a[1] instanceof ClipperLib.PolyTree;\n\t\tif (alen === 4 && !ispolytree) // function (clipType, solution, subjFillType, clipFillType)\n\t\t{\n\t\t\tvar clipType = a[0],\n\t\t\t\tsolution = a[1],\n\t\t\t\tsubjFillType = a[2],\n\t\t\t\tclipFillType = a[3];\n\t\t\tif (this.m_ExecuteLocked)\n\t\t\t\treturn false;\n\t\t\tif (this.m_HasOpenPaths)\n\t\t\t\tClipperLib.Error(\"Error: PolyTree struct is needed for open path clipping.\");\n\t\t\tthis.m_ExecuteLocked = true;\n\t\t\tClipperLib.Clear(solution);\n\t\t\tthis.m_SubjFillType = subjFillType;\n\t\t\tthis.m_ClipFillType = clipFillType;\n\t\t\tthis.m_ClipType = clipType;\n\t\t\tthis.m_UsingPolyTree = false;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar succeeded = this.ExecuteInternal();\n\t\t\t\t//build the return polygons ...\n\t\t\t\tif (succeeded) this.BuildResult(solution);\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tthis.DisposeAllPolyPts();\n\t\t\t\tthis.m_ExecuteLocked = false;\n\t\t\t}\n\t\t\treturn succeeded;\n\t\t}\n\t\telse if (alen === 4 && ispolytree) // function (clipType, polytree, subjFillType, clipFillType)\n\t\t{\n\t\t\tvar clipType = a[0],\n\t\t\t\tpolytree = a[1],\n\t\t\t\tsubjFillType = a[2],\n\t\t\t\tclipFillType = a[3];\n\t\t\tif (this.m_ExecuteLocked)\n\t\t\t\treturn false;\n\t\t\tthis.m_ExecuteLocked = true;\n\t\t\tthis.m_SubjFillType = subjFillType;\n\t\t\tthis.m_ClipFillType = clipFillType;\n\t\t\tthis.m_ClipType = clipType;\n\t\t\tthis.m_UsingPolyTree = true;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar succeeded = this.ExecuteInternal();\n\t\t\t\t//build the return polygons ...\n\t\t\t\tif (succeeded) this.BuildResult2(polytree);\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tthis.DisposeAllPolyPts();\n\t\t\t\tthis.m_ExecuteLocked = false;\n\t\t\t}\n\t\t\treturn succeeded;\n\t\t}\n\t\telse if (alen === 2 && !ispolytree) // function (clipType, solution)\n\t\t{\n\t\t\tvar clipType = a[0],\n\t\t\t\tsolution = a[1];\n\t\t\treturn this.Execute(clipType, solution, ClipperLib.PolyFillType.pftEvenOdd, ClipperLib.PolyFillType.pftEvenOdd);\n\t\t}\n\t\telse if (alen === 2 && ispolytree) // function (clipType, polytree)\n\t\t{\n\t\t\tvar clipType = a[0],\n\t\t\t\tpolytree = a[1];\n\t\t\treturn this.Execute(clipType, polytree, ClipperLib.PolyFillType.pftEvenOdd, ClipperLib.PolyFillType.pftEvenOdd);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.FixHoleLinkage = function (outRec)\n\t{\n\t\t//skip if an outermost polygon or\n\t\t//already already points to the correct FirstLeft ...\n\t\tif (outRec.FirstLeft === null || (outRec.IsHole !== outRec.FirstLeft.IsHole && outRec.FirstLeft.Pts !== null))\n\t\t\treturn;\n\t\tvar orfl = outRec.FirstLeft;\n\t\twhile (orfl !== null && ((orfl.IsHole === outRec.IsHole) || orfl.Pts === null))\n\t\t\torfl = orfl.FirstLeft;\n\t\toutRec.FirstLeft = orfl;\n\t};\n\n\tClipperLib.Clipper.prototype.ExecuteInternal = function ()\n\t{\n\t\ttry\n\t\t{\n\t\t\tthis.Reset();\n\t\t\tthis.m_SortedEdges = null;\n\t\t\tthis.m_Maxima = null;\n\n\t\t\tvar botY = {},\n\t\t\t\ttopY = {};\n\n\t\t\tif (!this.PopScanbeam(botY))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis.InsertLocalMinimaIntoAEL(botY.v);\n\t\t\twhile (this.PopScanbeam(topY) || this.LocalMinimaPending())\n\t\t\t{\n\t\t\t\tthis.ProcessHorizontals();\n\t\t\t\tthis.m_GhostJoins.length = 0;\n\t\t\t\tif (!this.ProcessIntersections(topY.v))\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tthis.ProcessEdgesAtTopOfScanbeam(topY.v);\n\t\t\t\tbotY.v = topY.v;\n\t\t\t\tthis.InsertLocalMinimaIntoAEL(botY.v);\n\t\t\t}\n\n\t\t\t//fix orientations ...\n\t\t\tvar outRec, i, ilen;\n\t\t\t//fix orientations ...\n\t\t\tfor (i = 0, ilen = this.m_PolyOuts.length; i < ilen; i++)\n\t\t\t{\n\t\t\t\toutRec = this.m_PolyOuts[i];\n\t\t\t\tif (outRec.Pts === null || outRec.IsOpen) continue;\n\t\t\t\tif ((outRec.IsHole ^ this.ReverseSolution) == (this.Area$1(outRec) > 0))\n\t\t\t\t\tthis.ReversePolyPtLinks(outRec.Pts);\n\t\t\t}\n\n\t\t\tthis.JoinCommonEdges();\n\n\t\t\tfor (i = 0, ilen = this.m_PolyOuts.length; i < ilen; i++)\n\t\t\t{\n\t\t\t\toutRec = this.m_PolyOuts[i];\n\t\t\t\tif (outRec.Pts === null)\n\t\t\t\t\tcontinue;\n\t\t\t\telse if (outRec.IsOpen)\n\t\t\t\t\tthis.FixupOutPolyline(outRec);\n\t\t\t\telse\n\t\t\t\t\tthis.FixupOutPolygon(outRec);\n\t\t\t}\n\n\t\t\tif (this.StrictlySimple) this.DoSimplePolygons();\n\t\t\treturn true;\n\t\t}\n\t\t//catch { return false; }\n\t\tfinally\n\t\t{\n\t\t\tthis.m_Joins.length = 0;\n\t\t\tthis.m_GhostJoins.length = 0;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.DisposeAllPolyPts = function ()\n\t{\n\t\tfor (var i = 0, ilen = this.m_PolyOuts.length; i < ilen; ++i)\n\t\t\tthis.DisposeOutRec(i);\n\t\tClipperLib.Clear(this.m_PolyOuts);\n\t};\n\n\tClipperLib.Clipper.prototype.AddJoin = function (Op1, Op2, OffPt)\n\t{\n\t\tvar j = new ClipperLib.Join();\n\t\tj.OutPt1 = Op1;\n\t\tj.OutPt2 = Op2;\n\t\t//j.OffPt = OffPt;\n\t\tj.OffPt.X = OffPt.X;\n\t\tj.OffPt.Y = OffPt.Y;\n\t\tif (ClipperLib.use_xyz) j.OffPt.Z = OffPt.Z;\n\t\tthis.m_Joins.push(j);\n\t};\n\n\tClipperLib.Clipper.prototype.AddGhostJoin = function (Op, OffPt)\n\t{\n\t\tvar j = new ClipperLib.Join();\n\t\tj.OutPt1 = Op;\n\t\t//j.OffPt = OffPt;\n\t\tj.OffPt.X = OffPt.X;\n\t\tj.OffPt.Y = OffPt.Y;\n\t\tif (ClipperLib.use_xyz) j.OffPt.Z = OffPt.Z;\n\t\tthis.m_GhostJoins.push(j);\n\t};\n\n\t//if (ClipperLib.use_xyz)\n\t//{\n\tClipperLib.Clipper.prototype.SetZ = function (pt, e1, e2)\n\t{\n\t\tif (this.ZFillFunction !== null)\n\t\t{\n\t\t\tif (pt.Z !== 0 || this.ZFillFunction === null) return;\n\t\t\telse if (ClipperLib.IntPoint.op_Equality(pt, e1.Bot)) pt.Z = e1.Bot.Z;\n\t\t\telse if (ClipperLib.IntPoint.op_Equality(pt, e1.Top)) pt.Z = e1.Top.Z;\n\t\t\telse if (ClipperLib.IntPoint.op_Equality(pt, e2.Bot)) pt.Z = e2.Bot.Z;\n\t\t\telse if (ClipperLib.IntPoint.op_Equality(pt, e2.Top)) pt.Z = e2.Top.Z;\n\t\t\telse this.ZFillFunction(e1.Bot, e1.Top, e2.Bot, e2.Top, pt);\n\t\t}\n\t};\n\t//}\n\n\tClipperLib.Clipper.prototype.InsertLocalMinimaIntoAEL = function (botY)\n\t{\n\t\tvar lm = {};\n\n\t\tvar lb;\n\t\tvar rb;\n\t\twhile (this.PopLocalMinima(botY, lm))\n\t\t{\n\t\t\tlb = lm.v.LeftBound;\n\t\t\trb = lm.v.RightBound;\n\n\t\t\tvar Op1 = null;\n\t\t\tif (lb === null)\n\t\t\t{\n\t\t\t\tthis.InsertEdgeIntoAEL(rb, null);\n\t\t\t\tthis.SetWindingCount(rb);\n\t\t\t\tif (this.IsContributing(rb))\n\t\t\t\t\tOp1 = this.AddOutPt(rb, rb.Bot);\n\t\t\t}\n\t\t\telse if (rb === null)\n\t\t\t{\n\t\t\t\tthis.InsertEdgeIntoAEL(lb, null);\n\t\t\t\tthis.SetWindingCount(lb);\n\t\t\t\tif (this.IsContributing(lb))\n\t\t\t\t\tOp1 = this.AddOutPt(lb, lb.Bot);\n\t\t\t\tthis.InsertScanbeam(lb.Top.Y);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.InsertEdgeIntoAEL(lb, null);\n\t\t\t\tthis.InsertEdgeIntoAEL(rb, lb);\n\t\t\t\tthis.SetWindingCount(lb);\n\t\t\t\trb.WindCnt = lb.WindCnt;\n\t\t\t\trb.WindCnt2 = lb.WindCnt2;\n\t\t\t\tif (this.IsContributing(lb))\n\t\t\t\t\tOp1 = this.AddLocalMinPoly(lb, rb, lb.Bot);\n\t\t\t\tthis.InsertScanbeam(lb.Top.Y);\n\t\t\t}\n\t\t\tif (rb !== null)\n\t\t\t{\n\t\t\t\tif (ClipperLib.ClipperBase.IsHorizontal(rb))\n\t\t\t\t{\n\t\t\t\t\tif (rb.NextInLML !== null)\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.InsertScanbeam(rb.NextInLML.Top.Y);\n\t\t\t\t\t}\n\t\t\t\t\tthis.AddEdgeToSEL(rb);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tthis.InsertScanbeam(rb.Top.Y);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (lb === null || rb === null) continue;\n\t\t\t//if output polygons share an Edge with a horizontal rb, they'll need joining later ...\n\t\t\tif (Op1 !== null && ClipperLib.ClipperBase.IsHorizontal(rb) && this.m_GhostJoins.length > 0 && rb.WindDelta !== 0)\n\t\t\t{\n\t\t\t\tfor (var i = 0, ilen = this.m_GhostJoins.length; i < ilen; i++)\n\t\t\t\t{\n\t\t\t\t\t//if the horizontal Rb and a 'ghost' horizontal overlap, then convert\n\t\t\t\t\t//the 'ghost' join to a real join ready for later ...\n\t\t\t\t\tvar j = this.m_GhostJoins[i];\n\n\t\t\t\t\tif (this.HorzSegmentsOverlap(j.OutPt1.Pt.X, j.OffPt.X, rb.Bot.X, rb.Top.X))\n\t\t\t\t\t\tthis.AddJoin(j.OutPt1, Op1, j.OffPt);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (lb.OutIdx >= 0 && lb.PrevInAEL !== null &&\n\t\t\t\tlb.PrevInAEL.Curr.X === lb.Bot.X &&\n\t\t\t\tlb.PrevInAEL.OutIdx >= 0 &&\n\t\t\t\tClipperLib.ClipperBase.SlopesEqual5(lb.PrevInAEL.Curr, lb.PrevInAEL.Top, lb.Curr, lb.Top, this.m_UseFullRange) &&\n\t\t\t\tlb.WindDelta !== 0 && lb.PrevInAEL.WindDelta !== 0)\n\t\t\t{\n\t\t\t\tvar Op2 = this.AddOutPt(lb.PrevInAEL, lb.Bot);\n\t\t\t\tthis.AddJoin(Op1, Op2, lb.Top);\n\t\t\t}\n\t\t\tif (lb.NextInAEL !== rb)\n\t\t\t{\n\t\t\t\tif (rb.OutIdx >= 0 && rb.PrevInAEL.OutIdx >= 0 &&\n\t\t\t\t\tClipperLib.ClipperBase.SlopesEqual5(rb.PrevInAEL.Curr, rb.PrevInAEL.Top, rb.Curr, rb.Top, this.m_UseFullRange) &&\n\t\t\t\t\trb.WindDelta !== 0 && rb.PrevInAEL.WindDelta !== 0)\n\t\t\t\t{\n\t\t\t\t\tvar Op2 = this.AddOutPt(rb.PrevInAEL, rb.Bot);\n\t\t\t\t\tthis.AddJoin(Op1, Op2, rb.Top);\n\t\t\t\t}\n\t\t\t\tvar e = lb.NextInAEL;\n\t\t\t\tif (e !== null)\n\t\t\t\t\twhile (e !== rb)\n\t\t\t\t\t{\n\t\t\t\t\t\t//nb: For calculating winding counts etc, IntersectEdges() assumes\n\t\t\t\t\t\t//that param1 will be to the right of param2 ABOVE the intersection ...\n\t\t\t\t\t\tthis.IntersectEdges(rb, e, lb.Curr);\n\t\t\t\t\t\t//order important here\n\t\t\t\t\t\te = e.NextInAEL;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.InsertEdgeIntoAEL = function (edge, startEdge)\n\t{\n\t\tif (this.m_ActiveEdges === null)\n\t\t{\n\t\t\tedge.PrevInAEL = null;\n\t\t\tedge.NextInAEL = null;\n\t\t\tthis.m_ActiveEdges = edge;\n\t\t}\n\t\telse if (startEdge === null && this.E2InsertsBeforeE1(this.m_ActiveEdges, edge))\n\t\t{\n\t\t\tedge.PrevInAEL = null;\n\t\t\tedge.NextInAEL = this.m_ActiveEdges;\n\t\t\tthis.m_ActiveEdges.PrevInAEL = edge;\n\t\t\tthis.m_ActiveEdges = edge;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (startEdge === null)\n\t\t\t\tstartEdge = this.m_ActiveEdges;\n\t\t\twhile (startEdge.NextInAEL !== null && !this.E2InsertsBeforeE1(startEdge.NextInAEL, edge))\n\t\t\t\tstartEdge = startEdge.NextInAEL;\n\t\t\tedge.NextInAEL = startEdge.NextInAEL;\n\t\t\tif (startEdge.NextInAEL !== null)\n\t\t\t\tstartEdge.NextInAEL.PrevInAEL = edge;\n\t\t\tedge.PrevInAEL = startEdge;\n\t\t\tstartEdge.NextInAEL = edge;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.E2InsertsBeforeE1 = function (e1, e2)\n\t{\n\t\tif (e2.Curr.X === e1.Curr.X)\n\t\t{\n\t\t\tif (e2.Top.Y > e1.Top.Y)\n\t\t\t\treturn e2.Top.X < ClipperLib.Clipper.TopX(e1, e2.Top.Y);\n\t\t\telse\n\t\t\t\treturn e1.Top.X > ClipperLib.Clipper.TopX(e2, e1.Top.Y);\n\t\t}\n\t\telse\n\t\t\treturn e2.Curr.X < e1.Curr.X;\n\t};\n\n\tClipperLib.Clipper.prototype.IsEvenOddFillType = function (edge)\n\t{\n\t\tif (edge.PolyTyp === ClipperLib.PolyType.ptSubject)\n\t\t\treturn this.m_SubjFillType === ClipperLib.PolyFillType.pftEvenOdd;\n\t\telse\n\t\t\treturn this.m_ClipFillType === ClipperLib.PolyFillType.pftEvenOdd;\n\t};\n\n\tClipperLib.Clipper.prototype.IsEvenOddAltFillType = function (edge)\n\t{\n\t\tif (edge.PolyTyp === ClipperLib.PolyType.ptSubject)\n\t\t\treturn this.m_ClipFillType === ClipperLib.PolyFillType.pftEvenOdd;\n\t\telse\n\t\t\treturn this.m_SubjFillType === ClipperLib.PolyFillType.pftEvenOdd;\n\t};\n\n\tClipperLib.Clipper.prototype.IsContributing = function (edge)\n\t{\n\t\tvar pft, pft2;\n\t\tif (edge.PolyTyp === ClipperLib.PolyType.ptSubject)\n\t\t{\n\t\t\tpft = this.m_SubjFillType;\n\t\t\tpft2 = this.m_ClipFillType;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpft = this.m_ClipFillType;\n\t\t\tpft2 = this.m_SubjFillType;\n\t\t}\n\t\tswitch (pft)\n\t\t{\n\t\tcase ClipperLib.PolyFillType.pftEvenOdd:\n\t\t\tif (edge.WindDelta === 0 && edge.WindCnt !== 1)\n\t\t\t\treturn false;\n\t\t\tbreak;\n\t\tcase ClipperLib.PolyFillType.pftNonZero:\n\t\t\tif (Math.abs(edge.WindCnt) !== 1)\n\t\t\t\treturn false;\n\t\t\tbreak;\n\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\tif (edge.WindCnt !== 1)\n\t\t\t\treturn false;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (edge.WindCnt !== -1)\n\t\t\t\treturn false;\n\t\t\tbreak;\n\t\t}\n\t\tswitch (this.m_ClipType)\n\t\t{\n\t\tcase ClipperLib.ClipType.ctIntersection:\n\t\t\tswitch (pft2)\n\t\t\t{\n\t\t\tcase ClipperLib.PolyFillType.pftEvenOdd:\n\t\t\tcase ClipperLib.PolyFillType.pftNonZero:\n\t\t\t\treturn (edge.WindCnt2 !== 0);\n\t\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\t\treturn (edge.WindCnt2 > 0);\n\t\t\tdefault:\n\t\t\t\treturn (edge.WindCnt2 < 0);\n\t\t\t}\n\t\tcase ClipperLib.ClipType.ctUnion:\n\t\t\tswitch (pft2)\n\t\t\t{\n\t\t\tcase ClipperLib.PolyFillType.pftEvenOdd:\n\t\t\tcase ClipperLib.PolyFillType.pftNonZero:\n\t\t\t\treturn (edge.WindCnt2 === 0);\n\t\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\t\treturn (edge.WindCnt2 <= 0);\n\t\t\tdefault:\n\t\t\t\treturn (edge.WindCnt2 >= 0);\n\t\t\t}\n\t\tcase ClipperLib.ClipType.ctDifference:\n\t\t\tif (edge.PolyTyp === ClipperLib.PolyType.ptSubject)\n\t\t\t\tswitch (pft2)\n\t\t\t\t{\n\t\t\t\tcase ClipperLib.PolyFillType.pftEvenOdd:\n\t\t\t\tcase ClipperLib.PolyFillType.pftNonZero:\n\t\t\t\t\treturn (edge.WindCnt2 === 0);\n\t\t\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\t\t\treturn (edge.WindCnt2 <= 0);\n\t\t\t\tdefault:\n\t\t\t\t\treturn (edge.WindCnt2 >= 0);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tswitch (pft2)\n\t\t\t\t{\n\t\t\t\tcase ClipperLib.PolyFillType.pftEvenOdd:\n\t\t\t\tcase ClipperLib.PolyFillType.pftNonZero:\n\t\t\t\t\treturn (edge.WindCnt2 !== 0);\n\t\t\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\t\t\treturn (edge.WindCnt2 > 0);\n\t\t\t\tdefault:\n\t\t\t\t\treturn (edge.WindCnt2 < 0);\n\t\t\t\t}\n\t\tcase ClipperLib.ClipType.ctXor:\n\t\t\tif (edge.WindDelta === 0)\n\t\t\t\tswitch (pft2)\n\t\t\t\t{\n\t\t\t\tcase ClipperLib.PolyFillType.pftEvenOdd:\n\t\t\t\tcase ClipperLib.PolyFillType.pftNonZero:\n\t\t\t\t\treturn (edge.WindCnt2 === 0);\n\t\t\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\t\t\treturn (edge.WindCnt2 <= 0);\n\t\t\t\tdefault:\n\t\t\t\t\treturn (edge.WindCnt2 >= 0);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\treturn true;\n\t\t}\n\t\treturn true;\n\t};\n\n\tClipperLib.Clipper.prototype.SetWindingCount = function (edge)\n\t{\n\t\tvar e = edge.PrevInAEL;\n\t\t//find the edge of the same polytype that immediately preceeds 'edge' in AEL\n\t\twhile (e !== null && ((e.PolyTyp !== edge.PolyTyp) || (e.WindDelta === 0)))\n\t\t\te = e.PrevInAEL;\n\t\tif (e === null)\n\t\t{\n\t\t\tvar pft = (edge.PolyTyp === ClipperLib.PolyType.ptSubject ? this.m_SubjFillType : this.m_ClipFillType);\n\t\t\tif (edge.WindDelta === 0)\n\t\t\t{\n\t\t\t\tedge.WindCnt = (pft === ClipperLib.PolyFillType.pftNegative ? -1 : 1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tedge.WindCnt = edge.WindDelta;\n\t\t\t}\n\t\t\tedge.WindCnt2 = 0;\n\t\t\te = this.m_ActiveEdges;\n\t\t\t//ie get ready to calc WindCnt2\n\t\t}\n\t\telse if (edge.WindDelta === 0 && this.m_ClipType !== ClipperLib.ClipType.ctUnion)\n\t\t{\n\t\t\tedge.WindCnt = 1;\n\t\t\tedge.WindCnt2 = e.WindCnt2;\n\t\t\te = e.NextInAEL;\n\t\t\t//ie get ready to calc WindCnt2\n\t\t}\n\t\telse if (this.IsEvenOddFillType(edge))\n\t\t{\n\t\t\t//EvenOdd filling ...\n\t\t\tif (edge.WindDelta === 0)\n\t\t\t{\n\t\t\t\t//are we inside a subj polygon ...\n\t\t\t\tvar Inside = true;\n\t\t\t\tvar e2 = e.PrevInAEL;\n\t\t\t\twhile (e2 !== null)\n\t\t\t\t{\n\t\t\t\t\tif (e2.PolyTyp === e.PolyTyp && e2.WindDelta !== 0)\n\t\t\t\t\t\tInside = !Inside;\n\t\t\t\t\te2 = e2.PrevInAEL;\n\t\t\t\t}\n\t\t\t\tedge.WindCnt = (Inside ? 0 : 1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tedge.WindCnt = edge.WindDelta;\n\t\t\t}\n\t\t\tedge.WindCnt2 = e.WindCnt2;\n\t\t\te = e.NextInAEL;\n\t\t\t//ie get ready to calc WindCnt2\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//nonZero, Positive or Negative filling ...\n\t\t\tif (e.WindCnt * e.WindDelta < 0)\n\t\t\t{\n\t\t\t\t//prev edge is 'decreasing' WindCount (WC) toward zero\n\t\t\t\t//so we're outside the previous polygon ...\n\t\t\t\tif (Math.abs(e.WindCnt) > 1)\n\t\t\t\t{\n\t\t\t\t\t//outside prev poly but still inside another.\n\t\t\t\t\t//when reversing direction of prev poly use the same WC\n\t\t\t\t\tif (e.WindDelta * edge.WindDelta < 0)\n\t\t\t\t\t\tedge.WindCnt = e.WindCnt;\n\t\t\t\t\telse\n\t\t\t\t\t\tedge.WindCnt = e.WindCnt + edge.WindDelta;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tedge.WindCnt = (edge.WindDelta === 0 ? 1 : edge.WindDelta);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//prev edge is 'increasing' WindCount (WC) away from zero\n\t\t\t\t//so we're inside the previous polygon ...\n\t\t\t\tif (edge.WindDelta === 0)\n\t\t\t\t\tedge.WindCnt = (e.WindCnt < 0 ? e.WindCnt - 1 : e.WindCnt + 1);\n\t\t\t\telse if (e.WindDelta * edge.WindDelta < 0)\n\t\t\t\t\tedge.WindCnt = e.WindCnt;\n\t\t\t\telse\n\t\t\t\t\tedge.WindCnt = e.WindCnt + edge.WindDelta;\n\t\t\t}\n\t\t\tedge.WindCnt2 = e.WindCnt2;\n\t\t\te = e.NextInAEL;\n\t\t\t//ie get ready to calc WindCnt2\n\t\t}\n\t\t//update WindCnt2 ...\n\t\tif (this.IsEvenOddAltFillType(edge))\n\t\t{\n\t\t\t//EvenOdd filling ...\n\t\t\twhile (e !== edge)\n\t\t\t{\n\t\t\t\tif (e.WindDelta !== 0)\n\t\t\t\t\tedge.WindCnt2 = (edge.WindCnt2 === 0 ? 1 : 0);\n\t\t\t\te = e.NextInAEL;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//nonZero, Positive or Negative filling ...\n\t\t\twhile (e !== edge)\n\t\t\t{\n\t\t\t\tedge.WindCnt2 += e.WindDelta;\n\t\t\t\te = e.NextInAEL;\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.AddEdgeToSEL = function (edge)\n\t{\n\t\t//SEL pointers in PEdge are use to build transient lists of horizontal edges.\n\t\t//However, since we don't need to worry about processing order, all additions\n\t\t//are made to the front of the list ...\n\t\tif (this.m_SortedEdges === null)\n\t\t{\n\t\t\tthis.m_SortedEdges = edge;\n\t\t\tedge.PrevInSEL = null;\n\t\t\tedge.NextInSEL = null;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tedge.NextInSEL = this.m_SortedEdges;\n\t\t\tedge.PrevInSEL = null;\n\t\t\tthis.m_SortedEdges.PrevInSEL = edge;\n\t\t\tthis.m_SortedEdges = edge;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.PopEdgeFromSEL = function (e)\n\t{\n\t\t//Pop edge from front of SEL (ie SEL is a FILO list)\n\t\te.v = this.m_SortedEdges;\n\t\tif (e.v === null)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tvar oldE = e.v;\n\t\tthis.m_SortedEdges = e.v.NextInSEL;\n\t\tif (this.m_SortedEdges !== null)\n\t\t{\n\t\t\tthis.m_SortedEdges.PrevInSEL = null;\n\t\t}\n\t\toldE.NextInSEL = null;\n\t\toldE.PrevInSEL = null;\n\t\treturn true;\n\t};\n\n\tClipperLib.Clipper.prototype.CopyAELToSEL = function ()\n\t{\n\t\tvar e = this.m_ActiveEdges;\n\t\tthis.m_SortedEdges = e;\n\t\twhile (e !== null)\n\t\t{\n\t\t\te.PrevInSEL = e.PrevInAEL;\n\t\t\te.NextInSEL = e.NextInAEL;\n\t\t\te = e.NextInAEL;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.SwapPositionsInSEL = function (edge1, edge2)\n\t{\n\t\tif (edge1.NextInSEL === null && edge1.PrevInSEL === null)\n\t\t\treturn;\n\t\tif (edge2.NextInSEL === null && edge2.PrevInSEL === null)\n\t\t\treturn;\n\t\tif (edge1.NextInSEL === edge2)\n\t\t{\n\t\t\tvar next = edge2.NextInSEL;\n\t\t\tif (next !== null)\n\t\t\t\tnext.PrevInSEL = edge1;\n\t\t\tvar prev = edge1.PrevInSEL;\n\t\t\tif (prev !== null)\n\t\t\t\tprev.NextInSEL = edge2;\n\t\t\tedge2.PrevInSEL = prev;\n\t\t\tedge2.NextInSEL = edge1;\n\t\t\tedge1.PrevInSEL = edge2;\n\t\t\tedge1.NextInSEL = next;\n\t\t}\n\t\telse if (edge2.NextInSEL === edge1)\n\t\t{\n\t\t\tvar next = edge1.NextInSEL;\n\t\t\tif (next !== null)\n\t\t\t\tnext.PrevInSEL = edge2;\n\t\t\tvar prev = edge2.PrevInSEL;\n\t\t\tif (prev !== null)\n\t\t\t\tprev.NextInSEL = edge1;\n\t\t\tedge1.PrevInSEL = prev;\n\t\t\tedge1.NextInSEL = edge2;\n\t\t\tedge2.PrevInSEL = edge1;\n\t\t\tedge2.NextInSEL = next;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar next = edge1.NextInSEL;\n\t\t\tvar prev = edge1.PrevInSEL;\n\t\t\tedge1.NextInSEL = edge2.NextInSEL;\n\t\t\tif (edge1.NextInSEL !== null)\n\t\t\t\tedge1.NextInSEL.PrevInSEL = edge1;\n\t\t\tedge1.PrevInSEL = edge2.PrevInSEL;\n\t\t\tif (edge1.PrevInSEL !== null)\n\t\t\t\tedge1.PrevInSEL.NextInSEL = edge1;\n\t\t\tedge2.NextInSEL = next;\n\t\t\tif (edge2.NextInSEL !== null)\n\t\t\t\tedge2.NextInSEL.PrevInSEL = edge2;\n\t\t\tedge2.PrevInSEL = prev;\n\t\t\tif (edge2.PrevInSEL !== null)\n\t\t\t\tedge2.PrevInSEL.NextInSEL = edge2;\n\t\t}\n\t\tif (edge1.PrevInSEL === null)\n\t\t\tthis.m_SortedEdges = edge1;\n\t\telse if (edge2.PrevInSEL === null)\n\t\t\tthis.m_SortedEdges = edge2;\n\t};\n\n\tClipperLib.Clipper.prototype.AddLocalMaxPoly = function (e1, e2, pt)\n\t{\n\t\tthis.AddOutPt(e1, pt);\n\t\tif (e2.WindDelta === 0) this.AddOutPt(e2, pt);\n\t\tif (e1.OutIdx === e2.OutIdx)\n\t\t{\n\t\t\te1.OutIdx = -1;\n\t\t\te2.OutIdx = -1;\n\t\t}\n\t\telse if (e1.OutIdx < e2.OutIdx)\n\t\t\tthis.AppendPolygon(e1, e2);\n\t\telse\n\t\t\tthis.AppendPolygon(e2, e1);\n\t};\n\n\tClipperLib.Clipper.prototype.AddLocalMinPoly = function (e1, e2, pt)\n\t{\n\t\tvar result;\n\t\tvar e, prevE;\n\t\tif (ClipperLib.ClipperBase.IsHorizontal(e2) || (e1.Dx > e2.Dx))\n\t\t{\n\t\t\tresult = this.AddOutPt(e1, pt);\n\t\t\te2.OutIdx = e1.OutIdx;\n\t\t\te1.Side = ClipperLib.EdgeSide.esLeft;\n\t\t\te2.Side = ClipperLib.EdgeSide.esRight;\n\t\t\te = e1;\n\t\t\tif (e.PrevInAEL === e2)\n\t\t\t\tprevE = e2.PrevInAEL;\n\t\t\telse\n\t\t\t\tprevE = e.PrevInAEL;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult = this.AddOutPt(e2, pt);\n\t\t\te1.OutIdx = e2.OutIdx;\n\t\t\te1.Side = ClipperLib.EdgeSide.esRight;\n\t\t\te2.Side = ClipperLib.EdgeSide.esLeft;\n\t\t\te = e2;\n\t\t\tif (e.PrevInAEL === e1)\n\t\t\t\tprevE = e1.PrevInAEL;\n\t\t\telse\n\t\t\t\tprevE = e.PrevInAEL;\n\t\t}\n\n\t\tif (prevE !== null && prevE.OutIdx >= 0 && prevE.Top.Y < pt.Y && e.Top.Y < pt.Y)\n\t\t{\n\t\t\tvar xPrev = ClipperLib.Clipper.TopX(prevE, pt.Y);\n\t\t\tvar xE = ClipperLib.Clipper.TopX(e, pt.Y);\n\t\t\tif ((xPrev === xE) && (e.WindDelta !== 0) && (prevE.WindDelta !== 0) && ClipperLib.ClipperBase.SlopesEqual5(new ClipperLib.IntPoint2(xPrev, pt.Y), prevE.Top, new ClipperLib.IntPoint2(xE, pt.Y), e.Top, this.m_UseFullRange))\n\t\t\t{\n\t\t\t\tvar outPt = this.AddOutPt(prevE, pt);\n\t\t\t\tthis.AddJoin(result, outPt, e.Top);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.prototype.AddOutPt = function (e, pt)\n\t{\n\t\tif (e.OutIdx < 0)\n\t\t{\n\t\t\tvar outRec = this.CreateOutRec();\n\t\t\toutRec.IsOpen = (e.WindDelta === 0);\n\t\t\tvar newOp = new ClipperLib.OutPt();\n\t\t\toutRec.Pts = newOp;\n\t\t\tnewOp.Idx = outRec.Idx;\n\t\t\t//newOp.Pt = pt;\n\t\t\tnewOp.Pt.X = pt.X;\n\t\t\tnewOp.Pt.Y = pt.Y;\n\t\t\tif (ClipperLib.use_xyz) newOp.Pt.Z = pt.Z;\n\t\t\tnewOp.Next = newOp;\n\t\t\tnewOp.Prev = newOp;\n\t\t\tif (!outRec.IsOpen)\n\t\t\t\tthis.SetHoleState(e, outRec);\n\t\t\te.OutIdx = outRec.Idx;\n\t\t\t//nb: do this after SetZ !\n\t\t\treturn newOp;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar outRec = this.m_PolyOuts[e.OutIdx];\n\t\t\t//OutRec.Pts is the 'Left-most' point & OutRec.Pts.Prev is the 'Right-most'\n\t\t\tvar op = outRec.Pts;\n\t\t\tvar ToFront = (e.Side === ClipperLib.EdgeSide.esLeft);\n\t\t\tif (ToFront && ClipperLib.IntPoint.op_Equality(pt, op.Pt))\n\t\t\t\treturn op;\n\t\t\telse if (!ToFront && ClipperLib.IntPoint.op_Equality(pt, op.Prev.Pt))\n\t\t\t\treturn op.Prev;\n\t\t\tvar newOp = new ClipperLib.OutPt();\n\t\t\tnewOp.Idx = outRec.Idx;\n\t\t\t//newOp.Pt = pt;\n\t\t\tnewOp.Pt.X = pt.X;\n\t\t\tnewOp.Pt.Y = pt.Y;\n\t\t\tif (ClipperLib.use_xyz) newOp.Pt.Z = pt.Z;\n\t\t\tnewOp.Next = op;\n\t\t\tnewOp.Prev = op.Prev;\n\t\t\tnewOp.Prev.Next = newOp;\n\t\t\top.Prev = newOp;\n\t\t\tif (ToFront)\n\t\t\t\toutRec.Pts = newOp;\n\t\t\treturn newOp;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.GetLastOutPt = function (e)\n\t{\n\t\tvar outRec = this.m_PolyOuts[e.OutIdx];\n\t\tif (e.Side === ClipperLib.EdgeSide.esLeft)\n\t\t{\n\t\t\treturn outRec.Pts;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn outRec.Pts.Prev;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.SwapPoints = function (pt1, pt2)\n\t{\n\t\tvar tmp = new ClipperLib.IntPoint1(pt1.Value);\n\t\t//pt1.Value = pt2.Value;\n\t\tpt1.Value.X = pt2.Value.X;\n\t\tpt1.Value.Y = pt2.Value.Y;\n\t\tif (ClipperLib.use_xyz) pt1.Value.Z = pt2.Value.Z;\n\t\t//pt2.Value = tmp;\n\t\tpt2.Value.X = tmp.X;\n\t\tpt2.Value.Y = tmp.Y;\n\t\tif (ClipperLib.use_xyz) pt2.Value.Z = tmp.Z;\n\t};\n\n\tClipperLib.Clipper.prototype.HorzSegmentsOverlap = function (seg1a, seg1b, seg2a, seg2b)\n\t{\n\t\tvar tmp;\n\t\tif (seg1a > seg1b)\n\t\t{\n\t\t\ttmp = seg1a;\n\t\t\tseg1a = seg1b;\n\t\t\tseg1b = tmp;\n\t\t}\n\t\tif (seg2a > seg2b)\n\t\t{\n\t\t\ttmp = seg2a;\n\t\t\tseg2a = seg2b;\n\t\t\tseg2b = tmp;\n\t\t}\n\t\treturn (seg1a < seg2b) && (seg2a < seg1b);\n\t}\n\n\tClipperLib.Clipper.prototype.SetHoleState = function (e, outRec)\n\t{\n\t\tvar e2 = e.PrevInAEL;\n\t\tvar eTmp = null;\n\t\twhile (e2 !== null)\n\t\t{\n\t\t\tif (e2.OutIdx >= 0 && e2.WindDelta !== 0)\n\t\t\t{\n\t\t\t\tif (eTmp === null)\n\t\t\t\t\teTmp = e2;\n\t\t\t\telse if (eTmp.OutIdx === e2.OutIdx)\n\t\t\t\t\teTmp = null; //paired\n\t\t\t}\n\t\t\te2 = e2.PrevInAEL;\n\t\t}\n\n\t\tif (eTmp === null)\n\t\t{\n\t\t\toutRec.FirstLeft = null;\n\t\t\toutRec.IsHole = false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\toutRec.FirstLeft = this.m_PolyOuts[eTmp.OutIdx];\n\t\t\toutRec.IsHole = !outRec.FirstLeft.IsHole;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.GetDx = function (pt1, pt2)\n\t{\n\t\tif (pt1.Y === pt2.Y)\n\t\t\treturn ClipperLib.ClipperBase.horizontal;\n\t\telse\n\t\t\treturn (pt2.X - pt1.X) / (pt2.Y - pt1.Y);\n\t};\n\n\tClipperLib.Clipper.prototype.FirstIsBottomPt = function (btmPt1, btmPt2)\n\t{\n\t\tvar p = btmPt1.Prev;\n\t\twhile ((ClipperLib.IntPoint.op_Equality(p.Pt, btmPt1.Pt)) && (p !== btmPt1))\n\t\t\tp = p.Prev;\n\t\tvar dx1p = Math.abs(this.GetDx(btmPt1.Pt, p.Pt));\n\t\tp = btmPt1.Next;\n\t\twhile ((ClipperLib.IntPoint.op_Equality(p.Pt, btmPt1.Pt)) && (p !== btmPt1))\n\t\t\tp = p.Next;\n\t\tvar dx1n = Math.abs(this.GetDx(btmPt1.Pt, p.Pt));\n\t\tp = btmPt2.Prev;\n\t\twhile ((ClipperLib.IntPoint.op_Equality(p.Pt, btmPt2.Pt)) && (p !== btmPt2))\n\t\t\tp = p.Prev;\n\t\tvar dx2p = Math.abs(this.GetDx(btmPt2.Pt, p.Pt));\n\t\tp = btmPt2.Next;\n\t\twhile ((ClipperLib.IntPoint.op_Equality(p.Pt, btmPt2.Pt)) && (p !== btmPt2))\n\t\t\tp = p.Next;\n\t\tvar dx2n = Math.abs(this.GetDx(btmPt2.Pt, p.Pt));\n\n\t\tif (Math.max(dx1p, dx1n) === Math.max(dx2p, dx2n) && Math.min(dx1p, dx1n) === Math.min(dx2p, dx2n))\n\t\t{\n\t\t\treturn this.Area(btmPt1) > 0; //if otherwise identical use orientation\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn (dx1p >= dx2p && dx1p >= dx2n) || (dx1n >= dx2p && dx1n >= dx2n);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.GetBottomPt = function (pp)\n\t{\n\t\tvar dups = null;\n\t\tvar p = pp.Next;\n\t\twhile (p !== pp)\n\t\t{\n\t\t\tif (p.Pt.Y > pp.Pt.Y)\n\t\t\t{\n\t\t\t\tpp = p;\n\t\t\t\tdups = null;\n\t\t\t}\n\t\t\telse if (p.Pt.Y === pp.Pt.Y && p.Pt.X <= pp.Pt.X)\n\t\t\t{\n\t\t\t\tif (p.Pt.X < pp.Pt.X)\n\t\t\t\t{\n\t\t\t\t\tdups = null;\n\t\t\t\t\tpp = p;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (p.Next !== pp && p.Prev !== pp)\n\t\t\t\t\t\tdups = p;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp = p.Next;\n\t\t}\n\t\tif (dups !== null)\n\t\t{\n\t\t\t//there appears to be at least 2 vertices at bottomPt so ...\n\t\t\twhile (dups !== p)\n\t\t\t{\n\t\t\t\tif (!this.FirstIsBottomPt(p, dups))\n\t\t\t\t\tpp = dups;\n\t\t\t\tdups = dups.Next;\n\t\t\t\twhile (ClipperLib.IntPoint.op_Inequality(dups.Pt, pp.Pt))\n\t\t\t\t\tdups = dups.Next;\n\t\t\t}\n\t\t}\n\t\treturn pp;\n\t};\n\n\tClipperLib.Clipper.prototype.GetLowermostRec = function (outRec1, outRec2)\n\t{\n\t\t//work out which polygon fragment has the correct hole state ...\n\t\tif (outRec1.BottomPt === null)\n\t\t\toutRec1.BottomPt = this.GetBottomPt(outRec1.Pts);\n\t\tif (outRec2.BottomPt === null)\n\t\t\toutRec2.BottomPt = this.GetBottomPt(outRec2.Pts);\n\t\tvar bPt1 = outRec1.BottomPt;\n\t\tvar bPt2 = outRec2.BottomPt;\n\t\tif (bPt1.Pt.Y > bPt2.Pt.Y)\n\t\t\treturn outRec1;\n\t\telse if (bPt1.Pt.Y < bPt2.Pt.Y)\n\t\t\treturn outRec2;\n\t\telse if (bPt1.Pt.X < bPt2.Pt.X)\n\t\t\treturn outRec1;\n\t\telse if (bPt1.Pt.X > bPt2.Pt.X)\n\t\t\treturn outRec2;\n\t\telse if (bPt1.Next === bPt1)\n\t\t\treturn outRec2;\n\t\telse if (bPt2.Next === bPt2)\n\t\t\treturn outRec1;\n\t\telse if (this.FirstIsBottomPt(bPt1, bPt2))\n\t\t\treturn outRec1;\n\t\telse\n\t\t\treturn outRec2;\n\t};\n\n\tClipperLib.Clipper.prototype.OutRec1RightOfOutRec2 = function (outRec1, outRec2)\n\t{\n\t\tdo {\n\t\t\toutRec1 = outRec1.FirstLeft;\n\t\t\tif (outRec1 === outRec2)\n\t\t\t\treturn true;\n\t\t}\n\t\twhile (outRec1 !== null)\n\t\treturn false;\n\t};\n\n\tClipperLib.Clipper.prototype.GetOutRec = function (idx)\n\t{\n\t\tvar outrec = this.m_PolyOuts[idx];\n\t\twhile (outrec !== this.m_PolyOuts[outrec.Idx])\n\t\t\toutrec = this.m_PolyOuts[outrec.Idx];\n\t\treturn outrec;\n\t};\n\n\tClipperLib.Clipper.prototype.AppendPolygon = function (e1, e2)\n\t{\n\t\t//get the start and ends of both output polygons ...\n\t\tvar outRec1 = this.m_PolyOuts[e1.OutIdx];\n\t\tvar outRec2 = this.m_PolyOuts[e2.OutIdx];\n\t\tvar holeStateRec;\n\t\tif (this.OutRec1RightOfOutRec2(outRec1, outRec2))\n\t\t\tholeStateRec = outRec2;\n\t\telse if (this.OutRec1RightOfOutRec2(outRec2, outRec1))\n\t\t\tholeStateRec = outRec1;\n\t\telse\n\t\t\tholeStateRec = this.GetLowermostRec(outRec1, outRec2);\n\n\t\t//get the start and ends of both output polygons and\n\t\t//join E2 poly onto E1 poly and delete pointers to E2 ...\n\n\t\tvar p1_lft = outRec1.Pts;\n\t\tvar p1_rt = p1_lft.Prev;\n\t\tvar p2_lft = outRec2.Pts;\n\t\tvar p2_rt = p2_lft.Prev;\n\t\t//join e2 poly onto e1 poly and delete pointers to e2 ...\n\t\tif (e1.Side === ClipperLib.EdgeSide.esLeft)\n\t\t{\n\t\t\tif (e2.Side === ClipperLib.EdgeSide.esLeft)\n\t\t\t{\n\t\t\t\t//z y x a b c\n\t\t\t\tthis.ReversePolyPtLinks(p2_lft);\n\t\t\t\tp2_lft.Next = p1_lft;\n\t\t\t\tp1_lft.Prev = p2_lft;\n\t\t\t\tp1_rt.Next = p2_rt;\n\t\t\t\tp2_rt.Prev = p1_rt;\n\t\t\t\toutRec1.Pts = p2_rt;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//x y z a b c\n\t\t\t\tp2_rt.Next = p1_lft;\n\t\t\t\tp1_lft.Prev = p2_rt;\n\t\t\t\tp2_lft.Prev = p1_rt;\n\t\t\t\tp1_rt.Next = p2_lft;\n\t\t\t\toutRec1.Pts = p2_lft;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (e2.Side === ClipperLib.EdgeSide.esRight)\n\t\t\t{\n\t\t\t\t//a b c z y x\n\t\t\t\tthis.ReversePolyPtLinks(p2_lft);\n\t\t\t\tp1_rt.Next = p2_rt;\n\t\t\t\tp2_rt.Prev = p1_rt;\n\t\t\t\tp2_lft.Next = p1_lft;\n\t\t\t\tp1_lft.Prev = p2_lft;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//a b c x y z\n\t\t\t\tp1_rt.Next = p2_lft;\n\t\t\t\tp2_lft.Prev = p1_rt;\n\t\t\t\tp1_lft.Prev = p2_rt;\n\t\t\t\tp2_rt.Next = p1_lft;\n\t\t\t}\n\t\t}\n\t\toutRec1.BottomPt = null;\n\t\tif (holeStateRec === outRec2)\n\t\t{\n\t\t\tif (outRec2.FirstLeft !== outRec1)\n\t\t\t\toutRec1.FirstLeft = outRec2.FirstLeft;\n\t\t\toutRec1.IsHole = outRec2.IsHole;\n\t\t}\n\t\toutRec2.Pts = null;\n\t\toutRec2.BottomPt = null;\n\t\toutRec2.FirstLeft = outRec1;\n\t\tvar OKIdx = e1.OutIdx;\n\t\tvar ObsoleteIdx = e2.OutIdx;\n\t\te1.OutIdx = -1;\n\t\t//nb: safe because we only get here via AddLocalMaxPoly\n\t\te2.OutIdx = -1;\n\t\tvar e = this.m_ActiveEdges;\n\t\twhile (e !== null)\n\t\t{\n\t\t\tif (e.OutIdx === ObsoleteIdx)\n\t\t\t{\n\t\t\t\te.OutIdx = OKIdx;\n\t\t\t\te.Side = e1.Side;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\te = e.NextInAEL;\n\t\t}\n\t\toutRec2.Idx = outRec1.Idx;\n\t};\n\n\tClipperLib.Clipper.prototype.ReversePolyPtLinks = function (pp)\n\t{\n\t\tif (pp === null)\n\t\t\treturn;\n\t\tvar pp1;\n\t\tvar pp2;\n\t\tpp1 = pp;\n\t\tdo {\n\t\t\tpp2 = pp1.Next;\n\t\t\tpp1.Next = pp1.Prev;\n\t\t\tpp1.Prev = pp2;\n\t\t\tpp1 = pp2;\n\t\t}\n\t\twhile (pp1 !== pp)\n\t};\n\n\tClipperLib.Clipper.SwapSides = function (edge1, edge2)\n\t{\n\t\tvar side = edge1.Side;\n\t\tedge1.Side = edge2.Side;\n\t\tedge2.Side = side;\n\t};\n\n\tClipperLib.Clipper.SwapPolyIndexes = function (edge1, edge2)\n\t{\n\t\tvar outIdx = edge1.OutIdx;\n\t\tedge1.OutIdx = edge2.OutIdx;\n\t\tedge2.OutIdx = outIdx;\n\t};\n\n\tClipperLib.Clipper.prototype.IntersectEdges = function (e1, e2, pt)\n\t{\n\t\t//e1 will be to the left of e2 BELOW the intersection. Therefore e1 is before\n\t\t//e2 in AEL except when e1 is being inserted at the intersection point ...\n\t\tvar e1Contributing = (e1.OutIdx >= 0);\n\t\tvar e2Contributing = (e2.OutIdx >= 0);\n\n\t\tif (ClipperLib.use_xyz)\n\t\t\tthis.SetZ(pt, e1, e2);\n\n\t\tif (ClipperLib.use_lines)\n\t\t{\n\t\t\t//if either edge is on an OPEN path ...\n\t\t\tif (e1.WindDelta === 0 || e2.WindDelta === 0)\n\t\t\t{\n\t\t\t\t//ignore subject-subject open path intersections UNLESS they\n\t\t\t\t//are both open paths, AND they are both 'contributing maximas' ...\n\t\t\t\tif (e1.WindDelta === 0 && e2.WindDelta === 0) return;\n\t\t\t\t//if intersecting a subj line with a subj poly ...\n\t\t\t\telse if (e1.PolyTyp === e2.PolyTyp &&\n\t\t\t\t\te1.WindDelta !== e2.WindDelta && this.m_ClipType === ClipperLib.ClipType.ctUnion)\n\t\t\t\t{\n\t\t\t\t\tif (e1.WindDelta === 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (e2Contributing)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.AddOutPt(e1, pt);\n\t\t\t\t\t\t\tif (e1Contributing)\n\t\t\t\t\t\t\t\te1.OutIdx = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (e1Contributing)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.AddOutPt(e2, pt);\n\t\t\t\t\t\t\tif (e2Contributing)\n\t\t\t\t\t\t\t\te2.OutIdx = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (e1.PolyTyp !== e2.PolyTyp)\n\t\t\t\t{\n\t\t\t\t\tif ((e1.WindDelta === 0) && Math.abs(e2.WindCnt) === 1 &&\n\t\t\t\t\t\t(this.m_ClipType !== ClipperLib.ClipType.ctUnion || e2.WindCnt2 === 0))\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.AddOutPt(e1, pt);\n\t\t\t\t\t\tif (e1Contributing)\n\t\t\t\t\t\t\te1.OutIdx = -1;\n\t\t\t\t\t}\n\t\t\t\t\telse if ((e2.WindDelta === 0) && (Math.abs(e1.WindCnt) === 1) &&\n\t\t\t\t\t\t(this.m_ClipType !== ClipperLib.ClipType.ctUnion || e1.WindCnt2 === 0))\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.AddOutPt(e2, pt);\n\t\t\t\t\t\tif (e2Contributing)\n\t\t\t\t\t\t\te2.OutIdx = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t//update winding counts...\n\t\t//assumes that e1 will be to the Right of e2 ABOVE the intersection\n\t\tif (e1.PolyTyp === e2.PolyTyp)\n\t\t{\n\t\t\tif (this.IsEvenOddFillType(e1))\n\t\t\t{\n\t\t\t\tvar oldE1WindCnt = e1.WindCnt;\n\t\t\t\te1.WindCnt = e2.WindCnt;\n\t\t\t\te2.WindCnt = oldE1WindCnt;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (e1.WindCnt + e2.WindDelta === 0)\n\t\t\t\t\te1.WindCnt = -e1.WindCnt;\n\t\t\t\telse\n\t\t\t\t\te1.WindCnt += e2.WindDelta;\n\t\t\t\tif (e2.WindCnt - e1.WindDelta === 0)\n\t\t\t\t\te2.WindCnt = -e2.WindCnt;\n\t\t\t\telse\n\t\t\t\t\te2.WindCnt -= e1.WindDelta;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (!this.IsEvenOddFillType(e2))\n\t\t\t\te1.WindCnt2 += e2.WindDelta;\n\t\t\telse\n\t\t\t\te1.WindCnt2 = (e1.WindCnt2 === 0) ? 1 : 0;\n\t\t\tif (!this.IsEvenOddFillType(e1))\n\t\t\t\te2.WindCnt2 -= e1.WindDelta;\n\t\t\telse\n\t\t\t\te2.WindCnt2 = (e2.WindCnt2 === 0) ? 1 : 0;\n\t\t}\n\t\tvar e1FillType, e2FillType, e1FillType2, e2FillType2;\n\t\tif (e1.PolyTyp === ClipperLib.PolyType.ptSubject)\n\t\t{\n\t\t\te1FillType = this.m_SubjFillType;\n\t\t\te1FillType2 = this.m_ClipFillType;\n\t\t}\n\t\telse\n\t\t{\n\t\t\te1FillType = this.m_ClipFillType;\n\t\t\te1FillType2 = this.m_SubjFillType;\n\t\t}\n\t\tif (e2.PolyTyp === ClipperLib.PolyType.ptSubject)\n\t\t{\n\t\t\te2FillType = this.m_SubjFillType;\n\t\t\te2FillType2 = this.m_ClipFillType;\n\t\t}\n\t\telse\n\t\t{\n\t\t\te2FillType = this.m_ClipFillType;\n\t\t\te2FillType2 = this.m_SubjFillType;\n\t\t}\n\t\tvar e1Wc, e2Wc;\n\t\tswitch (e1FillType)\n\t\t{\n\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\te1Wc = e1.WindCnt;\n\t\t\tbreak;\n\t\tcase ClipperLib.PolyFillType.pftNegative:\n\t\t\te1Wc = -e1.WindCnt;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\te1Wc = Math.abs(e1.WindCnt);\n\t\t\tbreak;\n\t\t}\n\t\tswitch (e2FillType)\n\t\t{\n\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\te2Wc = e2.WindCnt;\n\t\t\tbreak;\n\t\tcase ClipperLib.PolyFillType.pftNegative:\n\t\t\te2Wc = -e2.WindCnt;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\te2Wc = Math.abs(e2.WindCnt);\n\t\t\tbreak;\n\t\t}\n\t\tif (e1Contributing && e2Contributing)\n\t\t{\n\t\t\tif ((e1Wc !== 0 && e1Wc !== 1) || (e2Wc !== 0 && e2Wc !== 1) ||\n\t\t\t\t(e1.PolyTyp !== e2.PolyTyp && this.m_ClipType !== ClipperLib.ClipType.ctXor))\n\t\t\t{\n\t\t\t\tthis.AddLocalMaxPoly(e1, e2, pt);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.AddOutPt(e1, pt);\n\t\t\t\tthis.AddOutPt(e2, pt);\n\t\t\t\tClipperLib.Clipper.SwapSides(e1, e2);\n\t\t\t\tClipperLib.Clipper.SwapPolyIndexes(e1, e2);\n\t\t\t}\n\t\t}\n\t\telse if (e1Contributing)\n\t\t{\n\t\t\tif (e2Wc === 0 || e2Wc === 1)\n\t\t\t{\n\t\t\t\tthis.AddOutPt(e1, pt);\n\t\t\t\tClipperLib.Clipper.SwapSides(e1, e2);\n\t\t\t\tClipperLib.Clipper.SwapPolyIndexes(e1, e2);\n\t\t\t}\n\t\t}\n\t\telse if (e2Contributing)\n\t\t{\n\t\t\tif (e1Wc === 0 || e1Wc === 1)\n\t\t\t{\n\t\t\t\tthis.AddOutPt(e2, pt);\n\t\t\t\tClipperLib.Clipper.SwapSides(e1, e2);\n\t\t\t\tClipperLib.Clipper.SwapPolyIndexes(e1, e2);\n\t\t\t}\n\t\t}\n\t\telse if ((e1Wc === 0 || e1Wc === 1) && (e2Wc === 0 || e2Wc === 1))\n\t\t{\n\t\t\t//neither edge is currently contributing ...\n\t\t\tvar e1Wc2, e2Wc2;\n\t\t\tswitch (e1FillType2)\n\t\t\t{\n\t\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\t\te1Wc2 = e1.WindCnt2;\n\t\t\t\tbreak;\n\t\t\tcase ClipperLib.PolyFillType.pftNegative:\n\t\t\t\te1Wc2 = -e1.WindCnt2;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\te1Wc2 = Math.abs(e1.WindCnt2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tswitch (e2FillType2)\n\t\t\t{\n\t\t\tcase ClipperLib.PolyFillType.pftPositive:\n\t\t\t\te2Wc2 = e2.WindCnt2;\n\t\t\t\tbreak;\n\t\t\tcase ClipperLib.PolyFillType.pftNegative:\n\t\t\t\te2Wc2 = -e2.WindCnt2;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\te2Wc2 = Math.abs(e2.WindCnt2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (e1.PolyTyp !== e2.PolyTyp)\n\t\t\t{\n\t\t\t\tthis.AddLocalMinPoly(e1, e2, pt);\n\t\t\t}\n\t\t\telse if (e1Wc === 1 && e2Wc === 1)\n\t\t\t\tswitch (this.m_ClipType)\n\t\t\t\t{\n\t\t\t\tcase ClipperLib.ClipType.ctIntersection:\n\t\t\t\t\tif (e1Wc2 > 0 && e2Wc2 > 0)\n\t\t\t\t\t\tthis.AddLocalMinPoly(e1, e2, pt);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ClipperLib.ClipType.ctUnion:\n\t\t\t\t\tif (e1Wc2 <= 0 && e2Wc2 <= 0)\n\t\t\t\t\t\tthis.AddLocalMinPoly(e1, e2, pt);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ClipperLib.ClipType.ctDifference:\n\t\t\t\t\tif (((e1.PolyTyp === ClipperLib.PolyType.ptClip) && (e1Wc2 > 0) && (e2Wc2 > 0)) ||\n\t\t\t\t\t\t((e1.PolyTyp === ClipperLib.PolyType.ptSubject) && (e1Wc2 <= 0) && (e2Wc2 <= 0)))\n\t\t\t\t\t\tthis.AddLocalMinPoly(e1, e2, pt);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ClipperLib.ClipType.ctXor:\n\t\t\t\t\tthis.AddLocalMinPoly(e1, e2, pt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tClipperLib.Clipper.SwapSides(e1, e2);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.DeleteFromSEL = function (e)\n\t{\n\t\tvar SelPrev = e.PrevInSEL;\n\t\tvar SelNext = e.NextInSEL;\n\t\tif (SelPrev === null && SelNext === null && (e !== this.m_SortedEdges))\n\t\t\treturn;\n\t\t//already deleted\n\t\tif (SelPrev !== null)\n\t\t\tSelPrev.NextInSEL = SelNext;\n\t\telse\n\t\t\tthis.m_SortedEdges = SelNext;\n\t\tif (SelNext !== null)\n\t\t\tSelNext.PrevInSEL = SelPrev;\n\t\te.NextInSEL = null;\n\t\te.PrevInSEL = null;\n\t};\n\n\tClipperLib.Clipper.prototype.ProcessHorizontals = function ()\n\t{\n\t\tvar horzEdge = {}; //m_SortedEdges;\n\t\twhile (this.PopEdgeFromSEL(horzEdge))\n\t\t{\n\t\t\tthis.ProcessHorizontal(horzEdge.v);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.GetHorzDirection = function (HorzEdge, $var)\n\t{\n\t\tif (HorzEdge.Bot.X < HorzEdge.Top.X)\n\t\t{\n\t\t\t$var.Left = HorzEdge.Bot.X;\n\t\t\t$var.Right = HorzEdge.Top.X;\n\t\t\t$var.Dir = ClipperLib.Direction.dLeftToRight;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$var.Left = HorzEdge.Top.X;\n\t\t\t$var.Right = HorzEdge.Bot.X;\n\t\t\t$var.Dir = ClipperLib.Direction.dRightToLeft;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.ProcessHorizontal = function (horzEdge)\n\t{\n\t\tvar $var = {\n\t\t\tDir: null,\n\t\t\tLeft: null,\n\t\t\tRight: null\n\t\t};\n\n\t\tthis.GetHorzDirection(horzEdge, $var);\n\t\tvar dir = $var.Dir;\n\t\tvar horzLeft = $var.Left;\n\t\tvar horzRight = $var.Right;\n\n\t\tvar IsOpen = horzEdge.WindDelta === 0;\n\n\t\tvar eLastHorz = horzEdge,\n\t\t\teMaxPair = null;\n\t\twhile (eLastHorz.NextInLML !== null && ClipperLib.ClipperBase.IsHorizontal(eLastHorz.NextInLML))\n\t\t\teLastHorz = eLastHorz.NextInLML;\n\t\tif (eLastHorz.NextInLML === null)\n\t\t\teMaxPair = this.GetMaximaPair(eLastHorz);\n\n\t\tvar currMax = this.m_Maxima;\n\t\tif (currMax !== null)\n\t\t{\n\t\t\t//get the first maxima in range (X) ...\n\t\t\tif (dir === ClipperLib.Direction.dLeftToRight)\n\t\t\t{\n\t\t\t\twhile (currMax !== null && currMax.X <= horzEdge.Bot.X)\n\t\t\t\t{\n\t\t\t\t\tcurrMax = currMax.Next;\n\t\t\t\t}\n\t\t\t\tif (currMax !== null && currMax.X >= eLastHorz.Top.X)\n\t\t\t\t{\n\t\t\t\t\tcurrMax = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile (currMax.Next !== null && currMax.Next.X < horzEdge.Bot.X)\n\t\t\t\t{\n\t\t\t\t\tcurrMax = currMax.Next;\n\t\t\t\t}\n\t\t\t\tif (currMax.X <= eLastHorz.Top.X)\n\t\t\t\t{\n\t\t\t\t\tcurrMax = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar op1 = null;\n\t\tfor (;;) //loop through consec. horizontal edges\n\t\t{\n\t\t\tvar IsLastHorz = (horzEdge === eLastHorz);\n\t\t\tvar e = this.GetNextInAEL(horzEdge, dir);\n\t\t\twhile (e !== null)\n\t\t\t{\n\t\t\t\t//this code block inserts extra coords into horizontal edges (in output\n\t\t\t\t//polygons) whereever maxima touch these horizontal edges. This helps\n\t\t\t\t//'simplifying' polygons (ie if the Simplify property is set).\n\t\t\t\tif (currMax !== null)\n\t\t\t\t{\n\t\t\t\t\tif (dir === ClipperLib.Direction.dLeftToRight)\n\t\t\t\t\t{\n\t\t\t\t\t\twhile (currMax !== null && currMax.X < e.Curr.X)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (horzEdge.OutIdx >= 0 && !IsOpen)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tthis.AddOutPt(horzEdge, new ClipperLib.IntPoint2(currMax.X, horzEdge.Bot.Y));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcurrMax = currMax.Next;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\twhile (currMax !== null && currMax.X > e.Curr.X)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (horzEdge.OutIdx >= 0 && !IsOpen)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tthis.AddOutPt(horzEdge, new ClipperLib.IntPoint2(currMax.X, horzEdge.Bot.Y));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcurrMax = currMax.Prev;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ((dir === ClipperLib.Direction.dLeftToRight && e.Curr.X > horzRight) || (dir === ClipperLib.Direction.dRightToLeft && e.Curr.X < horzLeft))\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t//Also break if we've got to the end of an intermediate horizontal edge ...\n\t\t\t\t//nb: Smaller Dx's are to the right of larger Dx's ABOVE the horizontal.\n\t\t\t\tif (e.Curr.X === horzEdge.Top.X && horzEdge.NextInLML !== null && e.Dx < horzEdge.NextInLML.Dx)\n\t\t\t\t\tbreak;\n\n\t\t\t\tif (horzEdge.OutIdx >= 0 && !IsOpen) //note: may be done multiple times\n\t\t\t\t{\n\t\t\t\t\tif (ClipperLib.use_xyz)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (dir === ClipperLib.Direction.dLeftToRight)\n\t\t\t\t\t\t\tthis.SetZ(e.Curr, horzEdge, e);\n\t\t\t\t\t\telse this.SetZ(e.Curr, e, horzEdge);\n\t\t\t\t\t}\n\n\t\t\t\t\top1 = this.AddOutPt(horzEdge, e.Curr);\n\t\t\t\t\tvar eNextHorz = this.m_SortedEdges;\n\t\t\t\t\twhile (eNextHorz !== null)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (eNextHorz.OutIdx >= 0 && this.HorzSegmentsOverlap(horzEdge.Bot.X, horzEdge.Top.X, eNextHorz.Bot.X, eNextHorz.Top.X))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar op2 = this.GetLastOutPt(eNextHorz);\n\t\t\t\t\t\t\tthis.AddJoin(op2, op1, eNextHorz.Top);\n\t\t\t\t\t\t}\n\t\t\t\t\t\teNextHorz = eNextHorz.NextInSEL;\n\t\t\t\t\t}\n\t\t\t\t\tthis.AddGhostJoin(op1, horzEdge.Bot);\n\t\t\t\t}\n\n\t\t\t\t//OK, so far we're still in range of the horizontal Edge but make sure\n\t\t\t\t//we're at the last of consec. horizontals when matching with eMaxPair\n\t\t\t\tif (e === eMaxPair && IsLastHorz)\n\t\t\t\t{\n\t\t\t\t\tif (horzEdge.OutIdx >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.AddLocalMaxPoly(horzEdge, eMaxPair, horzEdge.Top);\n\t\t\t\t\t}\n\t\t\t\t\tthis.DeleteFromAEL(horzEdge);\n\t\t\t\t\tthis.DeleteFromAEL(eMaxPair);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (dir === ClipperLib.Direction.dLeftToRight)\n\t\t\t\t{\n\t\t\t\t\tvar Pt = new ClipperLib.IntPoint2(e.Curr.X, horzEdge.Curr.Y);\n\t\t\t\t\tthis.IntersectEdges(horzEdge, e, Pt);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar Pt = new ClipperLib.IntPoint2(e.Curr.X, horzEdge.Curr.Y);\n\t\t\t\t\tthis.IntersectEdges(e, horzEdge, Pt);\n\t\t\t\t}\n\t\t\t\tvar eNext = this.GetNextInAEL(e, dir);\n\t\t\t\tthis.SwapPositionsInAEL(horzEdge, e);\n\t\t\t\te = eNext;\n\t\t\t} //end while(e !== null)\n\n\t\t\t//Break out of loop if HorzEdge.NextInLML is not also horizontal ...\n\t\t\tif (horzEdge.NextInLML === null || !ClipperLib.ClipperBase.IsHorizontal(horzEdge.NextInLML))\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\thorzEdge = this.UpdateEdgeIntoAEL(horzEdge);\n\t\t\tif (horzEdge.OutIdx >= 0)\n\t\t\t{\n\t\t\t\tthis.AddOutPt(horzEdge, horzEdge.Bot);\n\t\t\t}\n\n\t\t\t$var = {\n\t\t\t\tDir: dir,\n\t\t\t\tLeft: horzLeft,\n\t\t\t\tRight: horzRight\n\t\t\t};\n\n\t\t\tthis.GetHorzDirection(horzEdge, $var);\n\t\t\tdir = $var.Dir;\n\t\t\thorzLeft = $var.Left;\n\t\t\thorzRight = $var.Right;\n\n\t\t} //end for (;;)\n\n\t\tif (horzEdge.OutIdx >= 0 && op1 === null)\n\t\t{\n\t\t\top1 = this.GetLastOutPt(horzEdge);\n\t\t\tvar eNextHorz = this.m_SortedEdges;\n\t\t\twhile (eNextHorz !== null)\n\t\t\t{\n\t\t\t\tif (eNextHorz.OutIdx >= 0 && this.HorzSegmentsOverlap(horzEdge.Bot.X, horzEdge.Top.X, eNextHorz.Bot.X, eNextHorz.Top.X))\n\t\t\t\t{\n\t\t\t\t\tvar op2 = this.GetLastOutPt(eNextHorz);\n\t\t\t\t\tthis.AddJoin(op2, op1, eNextHorz.Top);\n\t\t\t\t}\n\t\t\t\teNextHorz = eNextHorz.NextInSEL;\n\t\t\t}\n\t\t\tthis.AddGhostJoin(op1, horzEdge.Top);\n\t\t}\n\n\t\tif (horzEdge.NextInLML !== null)\n\t\t{\n\t\t\tif (horzEdge.OutIdx >= 0)\n\t\t\t{\n\t\t\t\top1 = this.AddOutPt(horzEdge, horzEdge.Top);\n\n\t\t\t\thorzEdge = this.UpdateEdgeIntoAEL(horzEdge);\n\t\t\t\tif (horzEdge.WindDelta === 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t//nb: HorzEdge is no longer horizontal here\n\t\t\t\tvar ePrev = horzEdge.PrevInAEL;\n\t\t\t\tvar eNext = horzEdge.NextInAEL;\n\t\t\t\tif (ePrev !== null && ePrev.Curr.X === horzEdge.Bot.X && ePrev.Curr.Y === horzEdge.Bot.Y && ePrev.WindDelta === 0 && (ePrev.OutIdx >= 0 && ePrev.Curr.Y > ePrev.Top.Y && ClipperLib.ClipperBase.SlopesEqual3(horzEdge, ePrev, this.m_UseFullRange)))\n\t\t\t\t{\n\t\t\t\t\tvar op2 = this.AddOutPt(ePrev, horzEdge.Bot);\n\t\t\t\t\tthis.AddJoin(op1, op2, horzEdge.Top);\n\t\t\t\t}\n\t\t\t\telse if (eNext !== null && eNext.Curr.X === horzEdge.Bot.X && eNext.Curr.Y === horzEdge.Bot.Y && eNext.WindDelta !== 0 && eNext.OutIdx >= 0 && eNext.Curr.Y > eNext.Top.Y && ClipperLib.ClipperBase.SlopesEqual3(horzEdge, eNext, this.m_UseFullRange))\n\t\t\t\t{\n\t\t\t\t\tvar op2 = this.AddOutPt(eNext, horzEdge.Bot);\n\t\t\t\t\tthis.AddJoin(op1, op2, horzEdge.Top);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\thorzEdge = this.UpdateEdgeIntoAEL(horzEdge);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (horzEdge.OutIdx >= 0)\n\t\t\t{\n\t\t\t\tthis.AddOutPt(horzEdge, horzEdge.Top);\n\t\t\t}\n\t\t\tthis.DeleteFromAEL(horzEdge);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.GetNextInAEL = function (e, Direction)\n\t{\n\t\treturn Direction === ClipperLib.Direction.dLeftToRight ? e.NextInAEL : e.PrevInAEL;\n\t};\n\n\tClipperLib.Clipper.prototype.IsMinima = function (e)\n\t{\n\t\treturn e !== null && (e.Prev.NextInLML !== e) && (e.Next.NextInLML !== e);\n\t};\n\n\tClipperLib.Clipper.prototype.IsMaxima = function (e, Y)\n\t{\n\t\treturn (e !== null && e.Top.Y === Y && e.NextInLML === null);\n\t};\n\n\tClipperLib.Clipper.prototype.IsIntermediate = function (e, Y)\n\t{\n\t\treturn (e.Top.Y === Y && e.NextInLML !== null);\n\t};\n\n\tClipperLib.Clipper.prototype.GetMaximaPair = function (e)\n\t{\n\t\tif ((ClipperLib.IntPoint.op_Equality(e.Next.Top, e.Top)) && e.Next.NextInLML === null)\n\t\t{\n\t\t\treturn e.Next;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ((ClipperLib.IntPoint.op_Equality(e.Prev.Top, e.Top)) && e.Prev.NextInLML === null)\n\t\t\t{\n\t\t\t\treturn e.Prev;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.GetMaximaPairEx = function (e)\n\t{\n\t\t//as above but returns null if MaxPair isn't in AEL (unless it's horizontal)\n\t\tvar result = this.GetMaximaPair(e);\n\t\tif (result === null || result.OutIdx === ClipperLib.ClipperBase.Skip ||\n\t\t\t((result.NextInAEL === result.PrevInAEL) && !ClipperLib.ClipperBase.IsHorizontal(result)))\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.prototype.ProcessIntersections = function (topY)\n\t{\n\t\tif (this.m_ActiveEdges === null)\n\t\t\treturn true;\n\t\ttry\n\t\t{\n\t\t\tthis.BuildIntersectList(topY);\n\t\t\tif (this.m_IntersectList.length === 0)\n\t\t\t\treturn true;\n\t\t\tif (this.m_IntersectList.length === 1 || this.FixupIntersectionOrder())\n\t\t\t\tthis.ProcessIntersectList();\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\tcatch ($$e2)\n\t\t{\n\t\t\tthis.m_SortedEdges = null;\n\t\t\tthis.m_IntersectList.length = 0;\n\t\t\tClipperLib.Error(\"ProcessIntersections error\");\n\t\t}\n\t\tthis.m_SortedEdges = null;\n\t\treturn true;\n\t};\n\n\tClipperLib.Clipper.prototype.BuildIntersectList = function (topY)\n\t{\n\t\tif (this.m_ActiveEdges === null)\n\t\t\treturn;\n\t\t//prepare for sorting ...\n\t\tvar e = this.m_ActiveEdges;\n\t\t//console.log(JSON.stringify(JSON.decycle( e )));\n\t\tthis.m_SortedEdges = e;\n\t\twhile (e !== null)\n\t\t{\n\t\t\te.PrevInSEL = e.PrevInAEL;\n\t\t\te.NextInSEL = e.NextInAEL;\n\t\t\te.Curr.X = ClipperLib.Clipper.TopX(e, topY);\n\t\t\te = e.NextInAEL;\n\t\t}\n\t\t//bubblesort ...\n\t\tvar isModified = true;\n\t\twhile (isModified && this.m_SortedEdges !== null)\n\t\t{\n\t\t\tisModified = false;\n\t\t\te = this.m_SortedEdges;\n\t\t\twhile (e.NextInSEL !== null)\n\t\t\t{\n\t\t\t\tvar eNext = e.NextInSEL;\n\t\t\t\tvar pt = new ClipperLib.IntPoint0();\n\t\t\t\t//console.log(\"e.Curr.X: \" + e.Curr.X + \" eNext.Curr.X\" + eNext.Curr.X);\n\t\t\t\tif (e.Curr.X > eNext.Curr.X)\n\t\t\t\t{\n\t\t\t\t\tthis.IntersectPoint(e, eNext, pt);\n\t\t\t\t\tif (pt.Y < topY)\n\t\t\t\t\t{\n\t\t\t\t\t\tpt = new ClipperLib.IntPoint2(ClipperLib.Clipper.TopX(e, topY), topY);\n\t\t\t\t\t}\n\t\t\t\t\tvar newNode = new ClipperLib.IntersectNode();\n\t\t\t\t\tnewNode.Edge1 = e;\n\t\t\t\t\tnewNode.Edge2 = eNext;\n\t\t\t\t\t//newNode.Pt = pt;\n\t\t\t\t\tnewNode.Pt.X = pt.X;\n\t\t\t\t\tnewNode.Pt.Y = pt.Y;\n\t\t\t\t\tif (ClipperLib.use_xyz) newNode.Pt.Z = pt.Z;\n\t\t\t\t\tthis.m_IntersectList.push(newNode);\n\t\t\t\t\tthis.SwapPositionsInSEL(e, eNext);\n\t\t\t\t\tisModified = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\te = eNext;\n\t\t\t}\n\t\t\tif (e.PrevInSEL !== null)\n\t\t\t\te.PrevInSEL.NextInSEL = null;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.m_SortedEdges = null;\n\t};\n\n\tClipperLib.Clipper.prototype.EdgesAdjacent = function (inode)\n\t{\n\t\treturn (inode.Edge1.NextInSEL === inode.Edge2) || (inode.Edge1.PrevInSEL === inode.Edge2);\n\t};\n\n\tClipperLib.Clipper.IntersectNodeSort = function (node1, node2)\n\t{\n\t\t//the following typecast is safe because the differences in Pt.Y will\n\t\t//be limited to the height of the scanbeam.\n\t\treturn (node2.Pt.Y - node1.Pt.Y);\n\t};\n\n\tClipperLib.Clipper.prototype.FixupIntersectionOrder = function ()\n\t{\n\t\t//pre-condition: intersections are sorted bottom-most first.\n\t\t//Now it's crucial that intersections are made only between adjacent edges,\n\t\t//so to ensure this the order of intersections may need adjusting ...\n\t\tthis.m_IntersectList.sort(this.m_IntersectNodeComparer);\n\t\tthis.CopyAELToSEL();\n\t\tvar cnt = this.m_IntersectList.length;\n\t\tfor (var i = 0; i < cnt; i++)\n\t\t{\n\t\t\tif (!this.EdgesAdjacent(this.m_IntersectList[i]))\n\t\t\t{\n\t\t\t\tvar j = i + 1;\n\t\t\t\twhile (j < cnt && !this.EdgesAdjacent(this.m_IntersectList[j]))\n\t\t\t\t\tj++;\n\t\t\t\tif (j === cnt)\n\t\t\t\t\treturn false;\n\t\t\t\tvar tmp = this.m_IntersectList[i];\n\t\t\t\tthis.m_IntersectList[i] = this.m_IntersectList[j];\n\t\t\t\tthis.m_IntersectList[j] = tmp;\n\t\t\t}\n\t\t\tthis.SwapPositionsInSEL(this.m_IntersectList[i].Edge1, this.m_IntersectList[i].Edge2);\n\t\t}\n\t\treturn true;\n\t};\n\n\tClipperLib.Clipper.prototype.ProcessIntersectList = function ()\n\t{\n\t\tfor (var i = 0, ilen = this.m_IntersectList.length; i < ilen; i++)\n\t\t{\n\t\t\tvar iNode = this.m_IntersectList[i];\n\t\t\tthis.IntersectEdges(iNode.Edge1, iNode.Edge2, iNode.Pt);\n\t\t\tthis.SwapPositionsInAEL(iNode.Edge1, iNode.Edge2);\n\t\t}\n\t\tthis.m_IntersectList.length = 0;\n\t};\n\n\t/*\n\t--------------------------------\n\tRound speedtest: http://jsperf.com/fastest-round\n\t--------------------------------\n\t*/\n\tvar R1 = function (a)\n\t{\n\t\treturn a < 0 ? Math.ceil(a - 0.5) : Math.round(a)\n\t};\n\n\tvar R2 = function (a)\n\t{\n\t\treturn a < 0 ? Math.ceil(a - 0.5) : Math.floor(a + 0.5)\n\t};\n\n\tvar R3 = function (a)\n\t{\n\t\treturn a < 0 ? -Math.round(Math.abs(a)) : Math.round(a)\n\t};\n\n\tvar R4 = function (a)\n\t{\n\t\tif (a < 0)\n\t\t{\n\t\t\ta -= 0.5;\n\t\t\treturn a < -2147483648 ? Math.ceil(a) : a | 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta += 0.5;\n\t\t\treturn a > 2147483647 ? Math.floor(a) : a | 0;\n\t\t}\n\t};\n\n\tif (browser.msie) ClipperLib.Clipper.Round = R1;\n\telse if (browser.chromium) ClipperLib.Clipper.Round = R3;\n\telse if (browser.safari) ClipperLib.Clipper.Round = R4;\n\telse ClipperLib.Clipper.Round = R2; // eg. browser.chrome || browser.firefox || browser.opera\n\tClipperLib.Clipper.TopX = function (edge, currentY)\n\t{\n\t\t//if (edge.Bot == edge.Curr) alert (\"edge.Bot = edge.Curr\");\n\t\t//if (edge.Bot == edge.Top) alert (\"edge.Bot = edge.Top\");\n\t\tif (currentY === edge.Top.Y)\n\t\t\treturn edge.Top.X;\n\t\treturn edge.Bot.X + ClipperLib.Clipper.Round(edge.Dx * (currentY - edge.Bot.Y));\n\t};\n\n\tClipperLib.Clipper.prototype.IntersectPoint = function (edge1, edge2, ip)\n\t{\n\t\tip.X = 0;\n\t\tip.Y = 0;\n\t\tvar b1, b2;\n\t\t//nb: with very large coordinate values, it's possible for SlopesEqual() to\n\t\t//return false but for the edge.Dx value be equal due to double precision rounding.\n\t\tif (edge1.Dx === edge2.Dx)\n\t\t{\n\t\t\tip.Y = edge1.Curr.Y;\n\t\t\tip.X = ClipperLib.Clipper.TopX(edge1, ip.Y);\n\t\t\treturn;\n\t\t}\n\t\tif (edge1.Delta.X === 0)\n\t\t{\n\t\t\tip.X = edge1.Bot.X;\n\t\t\tif (ClipperLib.ClipperBase.IsHorizontal(edge2))\n\t\t\t{\n\t\t\t\tip.Y = edge2.Bot.Y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tb2 = edge2.Bot.Y - (edge2.Bot.X / edge2.Dx);\n\t\t\t\tip.Y = ClipperLib.Clipper.Round(ip.X / edge2.Dx + b2);\n\t\t\t}\n\t\t}\n\t\telse if (edge2.Delta.X === 0)\n\t\t{\n\t\t\tip.X = edge2.Bot.X;\n\t\t\tif (ClipperLib.ClipperBase.IsHorizontal(edge1))\n\t\t\t{\n\t\t\t\tip.Y = edge1.Bot.Y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tb1 = edge1.Bot.Y - (edge1.Bot.X / edge1.Dx);\n\t\t\t\tip.Y = ClipperLib.Clipper.Round(ip.X / edge1.Dx + b1);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tb1 = edge1.Bot.X - edge1.Bot.Y * edge1.Dx;\n\t\t\tb2 = edge2.Bot.X - edge2.Bot.Y * edge2.Dx;\n\t\t\tvar q = (b2 - b1) / (edge1.Dx - edge2.Dx);\n\t\t\tip.Y = ClipperLib.Clipper.Round(q);\n\t\t\tif (Math.abs(edge1.Dx) < Math.abs(edge2.Dx))\n\t\t\t\tip.X = ClipperLib.Clipper.Round(edge1.Dx * q + b1);\n\t\t\telse\n\t\t\t\tip.X = ClipperLib.Clipper.Round(edge2.Dx * q + b2);\n\t\t}\n\t\tif (ip.Y < edge1.Top.Y || ip.Y < edge2.Top.Y)\n\t\t{\n\t\t\tif (edge1.Top.Y > edge2.Top.Y)\n\t\t\t{\n\t\t\t\tip.Y = edge1.Top.Y;\n\t\t\t\tip.X = ClipperLib.Clipper.TopX(edge2, edge1.Top.Y);\n\t\t\t\treturn ip.X < edge1.Top.X;\n\t\t\t}\n\t\t\telse\n\t\t\t\tip.Y = edge2.Top.Y;\n\t\t\tif (Math.abs(edge1.Dx) < Math.abs(edge2.Dx))\n\t\t\t\tip.X = ClipperLib.Clipper.TopX(edge1, ip.Y);\n\t\t\telse\n\t\t\t\tip.X = ClipperLib.Clipper.TopX(edge2, ip.Y);\n\t\t}\n\t\t//finally, don't allow 'ip' to be BELOW curr.Y (ie bottom of scanbeam) ...\n\t\tif (ip.Y > edge1.Curr.Y)\n\t\t{\n\t\t\tip.Y = edge1.Curr.Y;\n\t\t\t//better to use the more vertical edge to derive X ...\n\t\t\tif (Math.abs(edge1.Dx) > Math.abs(edge2.Dx))\n\t\t\t\tip.X = ClipperLib.Clipper.TopX(edge2, ip.Y);\n\t\t\telse\n\t\t\t\tip.X = ClipperLib.Clipper.TopX(edge1, ip.Y);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.ProcessEdgesAtTopOfScanbeam = function (topY)\n\t{\n\t\tvar e = this.m_ActiveEdges;\n\n\t\twhile (e !== null)\n\t\t{\n\t\t\t//1. process maxima, treating them as if they're 'bent' horizontal edges,\n\t\t\t// but exclude maxima with horizontal edges. nb: e can't be a horizontal.\n\t\t\tvar IsMaximaEdge = this.IsMaxima(e, topY);\n\t\t\tif (IsMaximaEdge)\n\t\t\t{\n\t\t\t\tvar eMaxPair = this.GetMaximaPairEx(e);\n\t\t\t\tIsMaximaEdge = (eMaxPair === null || !ClipperLib.ClipperBase.IsHorizontal(eMaxPair));\n\t\t\t}\n\t\t\tif (IsMaximaEdge)\n\t\t\t{\n\t\t\t\tif (this.StrictlySimple)\n\t\t\t\t{\n\t\t\t\t\tthis.InsertMaxima(e.Top.X);\n\t\t\t\t}\n\t\t\t\tvar ePrev = e.PrevInAEL;\n\t\t\t\tthis.DoMaxima(e);\n\t\t\t\tif (ePrev === null)\n\t\t\t\t\te = this.m_ActiveEdges;\n\t\t\t\telse\n\t\t\t\t\te = ePrev.NextInAEL;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//2. promote horizontal edges, otherwise update Curr.X and Curr.Y ...\n\t\t\t\tif (this.IsIntermediate(e, topY) && ClipperLib.ClipperBase.IsHorizontal(e.NextInLML))\n\t\t\t\t{\n\t\t\t\t\te = this.UpdateEdgeIntoAEL(e);\n\t\t\t\t\tif (e.OutIdx >= 0)\n\t\t\t\t\t\tthis.AddOutPt(e, e.Bot);\n\t\t\t\t\tthis.AddEdgeToSEL(e);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\te.Curr.X = ClipperLib.Clipper.TopX(e, topY);\n\t\t\t\t\te.Curr.Y = topY;\n\t\t\t\t}\n\n\t\t\t\tif (ClipperLib.use_xyz)\n\t\t\t\t{\n\t\t\t\t\tif (e.Top.Y === topY) e.Curr.Z = e.Top.Z;\n\t\t\t\t\telse if (e.Bot.Y === topY) e.Curr.Z = e.Bot.Z;\n\t\t\t\t\telse e.Curr.Z = 0;\n\t\t\t\t}\n\n\t\t\t\t//When StrictlySimple and 'e' is being touched by another edge, then\n\t\t\t\t//make sure both edges have a vertex here ...\n\t\t\t\tif (this.StrictlySimple)\n\t\t\t\t{\n\t\t\t\t\tvar ePrev = e.PrevInAEL;\n\t\t\t\t\tif ((e.OutIdx >= 0) && (e.WindDelta !== 0) && ePrev !== null &&\n\t\t\t\t\t\t(ePrev.OutIdx >= 0) && (ePrev.Curr.X === e.Curr.X) &&\n\t\t\t\t\t\t(ePrev.WindDelta !== 0))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar ip = new ClipperLib.IntPoint1(e.Curr);\n\n\t\t\t\t\t\tif (ClipperLib.use_xyz)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.SetZ(ip, ePrev, e);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar op = this.AddOutPt(ePrev, ip);\n\t\t\t\t\t\tvar op2 = this.AddOutPt(e, ip);\n\t\t\t\t\t\tthis.AddJoin(op, op2, ip); //StrictlySimple (type-3) join\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\te = e.NextInAEL;\n\t\t\t}\n\t\t}\n\t\t//3. Process horizontals at the Top of the scanbeam ...\n\t\tthis.ProcessHorizontals();\n\t\tthis.m_Maxima = null;\n\t\t//4. Promote intermediate vertices ...\n\t\te = this.m_ActiveEdges;\n\t\twhile (e !== null)\n\t\t{\n\t\t\tif (this.IsIntermediate(e, topY))\n\t\t\t{\n\t\t\t\tvar op = null;\n\t\t\t\tif (e.OutIdx >= 0)\n\t\t\t\t\top = this.AddOutPt(e, e.Top);\n\t\t\t\te = this.UpdateEdgeIntoAEL(e);\n\t\t\t\t//if output polygons share an edge, they'll need joining later ...\n\t\t\t\tvar ePrev = e.PrevInAEL;\n\t\t\t\tvar eNext = e.NextInAEL;\n\n\t\t\t\tif (ePrev !== null && ePrev.Curr.X === e.Bot.X && ePrev.Curr.Y === e.Bot.Y && op !== null && ePrev.OutIdx >= 0 && ePrev.Curr.Y === ePrev.Top.Y && ClipperLib.ClipperBase.SlopesEqual5(e.Curr, e.Top, ePrev.Curr, ePrev.Top, this.m_UseFullRange) && (e.WindDelta !== 0) && (ePrev.WindDelta !== 0))\n\t\t\t\t{\n\t\t\t\t\tvar op2 = this.AddOutPt(ePrev2, e.Bot);\n\t\t\t\t\tthis.AddJoin(op, op2, e.Top);\n\t\t\t\t}\n\t\t\t\telse if (eNext !== null && eNext.Curr.X === e.Bot.X && eNext.Curr.Y === e.Bot.Y && op !== null && eNext.OutIdx >= 0 && eNext.Curr.Y === eNext.Top.Y && ClipperLib.ClipperBase.SlopesEqual5(e.Curr, e.Top, eNext.Curr, eNext.Top, this.m_UseFullRange) && (e.WindDelta !== 0) && (eNext.WindDelta !== 0))\n\t\t\t\t{\n\t\t\t\t\tvar op2 = this.AddOutPt(eNext, e.Bot);\n\t\t\t\t\tthis.AddJoin(op, op2, e.Top);\n\t\t\t\t}\n\t\t\t}\n\t\t\te = e.NextInAEL;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.DoMaxima = function (e)\n\t{\n\t\tvar eMaxPair = this.GetMaximaPairEx(e);\n\t\tif (eMaxPair === null)\n\t\t{\n\t\t\tif (e.OutIdx >= 0)\n\t\t\t\tthis.AddOutPt(e, e.Top);\n\t\t\tthis.DeleteFromAEL(e);\n\t\t\treturn;\n\t\t}\n\t\tvar eNext = e.NextInAEL;\n\t\twhile (eNext !== null && eNext !== eMaxPair)\n\t\t{\n\t\t\tthis.IntersectEdges(e, eNext, e.Top);\n\t\t\tthis.SwapPositionsInAEL(e, eNext);\n\t\t\teNext = e.NextInAEL;\n\t\t}\n\t\tif (e.OutIdx === -1 && eMaxPair.OutIdx === -1)\n\t\t{\n\t\t\tthis.DeleteFromAEL(e);\n\t\t\tthis.DeleteFromAEL(eMaxPair);\n\t\t}\n\t\telse if (e.OutIdx >= 0 && eMaxPair.OutIdx >= 0)\n\t\t{\n\t\t\tif (e.OutIdx >= 0) this.AddLocalMaxPoly(e, eMaxPair, e.Top);\n\t\t\tthis.DeleteFromAEL(e);\n\t\t\tthis.DeleteFromAEL(eMaxPair);\n\t\t}\n\t\telse if (ClipperLib.use_lines && e.WindDelta === 0)\n\t\t{\n\t\t\tif (e.OutIdx >= 0)\n\t\t\t{\n\t\t\t\tthis.AddOutPt(e, e.Top);\n\t\t\t\te.OutIdx = ClipperLib.ClipperBase.Unassigned;\n\t\t\t}\n\t\t\tthis.DeleteFromAEL(e);\n\t\t\tif (eMaxPair.OutIdx >= 0)\n\t\t\t{\n\t\t\t\tthis.AddOutPt(eMaxPair, e.Top);\n\t\t\t\teMaxPair.OutIdx = ClipperLib.ClipperBase.Unassigned;\n\t\t\t}\n\t\t\tthis.DeleteFromAEL(eMaxPair);\n\t\t}\n\t\telse\n\t\t\tClipperLib.Error(\"DoMaxima error\");\n\t};\n\n\tClipperLib.Clipper.ReversePaths = function (polys)\n\t{\n\t\tfor (var i = 0, len = polys.length; i < len; i++)\n\t\t\tpolys[i].reverse();\n\t};\n\n\tClipperLib.Clipper.Orientation = function (poly)\n\t{\n\t\treturn ClipperLib.Clipper.Area(poly) >= 0;\n\t};\n\n\tClipperLib.Clipper.prototype.PointCount = function (pts)\n\t{\n\t\tif (pts === null)\n\t\t\treturn 0;\n\t\tvar result = 0;\n\t\tvar p = pts;\n\t\tdo {\n\t\t\tresult++;\n\t\t\tp = p.Next;\n\t\t}\n\t\twhile (p !== pts)\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.prototype.BuildResult = function (polyg)\n\t{\n\t\tClipperLib.Clear(polyg);\n\t\tfor (var i = 0, ilen = this.m_PolyOuts.length; i < ilen; i++)\n\t\t{\n\t\t\tvar outRec = this.m_PolyOuts[i];\n\t\t\tif (outRec.Pts === null)\n\t\t\t\tcontinue;\n\t\t\tvar p = outRec.Pts.Prev;\n\t\t\tvar cnt = this.PointCount(p);\n\t\t\tif (cnt < 2)\n\t\t\t\tcontinue;\n\t\t\tvar pg = new Array(cnt);\n\t\t\tfor (var j = 0; j < cnt; j++)\n\t\t\t{\n\t\t\t\tpg[j] = p.Pt;\n\t\t\t\tp = p.Prev;\n\t\t\t}\n\t\t\tpolyg.push(pg);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.BuildResult2 = function (polytree)\n\t{\n\t\tpolytree.Clear();\n\t\t//add each output polygon/contour to polytree ...\n\t\t//polytree.m_AllPolys.set_Capacity(this.m_PolyOuts.length);\n\t\tfor (var i = 0, ilen = this.m_PolyOuts.length; i < ilen; i++)\n\t\t{\n\t\t\tvar outRec = this.m_PolyOuts[i];\n\t\t\tvar cnt = this.PointCount(outRec.Pts);\n\t\t\tif ((outRec.IsOpen && cnt < 2) || (!outRec.IsOpen && cnt < 3))\n\t\t\t\tcontinue;\n\t\t\tthis.FixHoleLinkage(outRec);\n\t\t\tvar pn = new ClipperLib.PolyNode();\n\t\t\tpolytree.m_AllPolys.push(pn);\n\t\t\toutRec.PolyNode = pn;\n\t\t\tpn.m_polygon.length = cnt;\n\t\t\tvar op = outRec.Pts.Prev;\n\t\t\tfor (var j = 0; j < cnt; j++)\n\t\t\t{\n\t\t\t\tpn.m_polygon[j] = op.Pt;\n\t\t\t\top = op.Prev;\n\t\t\t}\n\t\t}\n\t\t//fixup PolyNode links etc ...\n\t\t//polytree.m_Childs.set_Capacity(this.m_PolyOuts.length);\n\t\tfor (var i = 0, ilen = this.m_PolyOuts.length; i < ilen; i++)\n\t\t{\n\t\t\tvar outRec = this.m_PolyOuts[i];\n\t\t\tif (outRec.PolyNode === null)\n\t\t\t\tcontinue;\n\t\t\telse if (outRec.IsOpen)\n\t\t\t{\n\t\t\t\toutRec.PolyNode.IsOpen = true;\n\t\t\t\tpolytree.AddChild(outRec.PolyNode);\n\t\t\t}\n\t\t\telse if (outRec.FirstLeft !== null && outRec.FirstLeft.PolyNode !== null)\n\t\t\t\toutRec.FirstLeft.PolyNode.AddChild(outRec.PolyNode);\n\t\t\telse\n\t\t\t\tpolytree.AddChild(outRec.PolyNode);\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.FixupOutPolyline = function (outRec)\n\t{\n\t\tvar pp = outRec.Pts;\n\t\tvar lastPP = pp.Prev;\n\t\twhile (pp !== lastPP)\n\t\t{\n\t\t\tpp = pp.Next;\n\t\t\tif (ClipperLib.IntPoint.op_Equality(pp.Pt, pp.Prev.Pt))\n\t\t\t{\n\t\t\t\tif (pp === lastPP)\n\t\t\t\t{\n\t\t\t\t\tlastPP = pp.Prev;\n\t\t\t\t}\n\t\t\t\tvar tmpPP = pp.Prev;\n\t\t\t\ttmpPP.Next = pp.Next;\n\t\t\t\tpp.Next.Prev = tmpPP;\n\t\t\t\tpp = tmpPP;\n\t\t\t}\n\t\t}\n\t\tif (pp === pp.Prev)\n\t\t{\n\t\t\toutRec.Pts = null;\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.FixupOutPolygon = function (outRec)\n\t{\n\t\t//FixupOutPolygon() - removes duplicate points and simplifies consecutive\n\t\t//parallel edges by removing the middle vertex.\n\t\tvar lastOK = null;\n\t\toutRec.BottomPt = null;\n\t\tvar pp = outRec.Pts;\n\t\tvar preserveCol = this.PreserveCollinear || this.StrictlySimple;\n\t\tfor (;;)\n\t\t{\n\t\t\tif (pp.Prev === pp || pp.Prev === pp.Next)\n\t\t\t{\n\t\t\t\toutRec.Pts = null;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//test for duplicate points and collinear edges ...\n\t\t\tif ((ClipperLib.IntPoint.op_Equality(pp.Pt, pp.Next.Pt)) || (ClipperLib.IntPoint.op_Equality(pp.Pt, pp.Prev.Pt)) || (ClipperLib.ClipperBase.SlopesEqual4(pp.Prev.Pt, pp.Pt, pp.Next.Pt, this.m_UseFullRange) && (!preserveCol || !this.Pt2IsBetweenPt1AndPt3(pp.Prev.Pt, pp.Pt, pp.Next.Pt))))\n\t\t\t{\n\t\t\t\tlastOK = null;\n\t\t\t\tpp.Prev.Next = pp.Next;\n\t\t\t\tpp.Next.Prev = pp.Prev;\n\t\t\t\tpp = pp.Prev;\n\t\t\t}\n\t\t\telse if (pp === lastOK)\n\t\t\t\tbreak;\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (lastOK === null)\n\t\t\t\t\tlastOK = pp;\n\t\t\t\tpp = pp.Next;\n\t\t\t}\n\t\t}\n\t\toutRec.Pts = pp;\n\t};\n\n\tClipperLib.Clipper.prototype.DupOutPt = function (outPt, InsertAfter)\n\t{\n\t\tvar result = new ClipperLib.OutPt();\n\t\t//result.Pt = outPt.Pt;\n\t\tresult.Pt.X = outPt.Pt.X;\n\t\tresult.Pt.Y = outPt.Pt.Y;\n\t\tif (ClipperLib.use_xyz) result.Pt.Z = outPt.Pt.Z;\n\t\tresult.Idx = outPt.Idx;\n\t\tif (InsertAfter)\n\t\t{\n\t\t\tresult.Next = outPt.Next;\n\t\t\tresult.Prev = outPt;\n\t\t\toutPt.Next.Prev = result;\n\t\t\toutPt.Next = result;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult.Prev = outPt.Prev;\n\t\t\tresult.Next = outPt;\n\t\t\toutPt.Prev.Next = result;\n\t\t\toutPt.Prev = result;\n\t\t}\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.prototype.GetOverlap = function (a1, a2, b1, b2, $val)\n\t{\n\t\tif (a1 < a2)\n\t\t{\n\t\t\tif (b1 < b2)\n\t\t\t{\n\t\t\t\t$val.Left = Math.max(a1, b1);\n\t\t\t\t$val.Right = Math.min(a2, b2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$val.Left = Math.max(a1, b2);\n\t\t\t\t$val.Right = Math.min(a2, b1);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (b1 < b2)\n\t\t\t{\n\t\t\t\t$val.Left = Math.max(a2, b1);\n\t\t\t\t$val.Right = Math.min(a1, b2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$val.Left = Math.max(a2, b2);\n\t\t\t\t$val.Right = Math.min(a1, b1);\n\t\t\t}\n\t\t}\n\t\treturn $val.Left < $val.Right;\n\t};\n\n\tClipperLib.Clipper.prototype.JoinHorz = function (op1, op1b, op2, op2b, Pt, DiscardLeft)\n\t{\n\t\tvar Dir1 = (op1.Pt.X > op1b.Pt.X ? ClipperLib.Direction.dRightToLeft : ClipperLib.Direction.dLeftToRight);\n\t\tvar Dir2 = (op2.Pt.X > op2b.Pt.X ? ClipperLib.Direction.dRightToLeft : ClipperLib.Direction.dLeftToRight);\n\t\tif (Dir1 === Dir2)\n\t\t\treturn false;\n\t\t//When DiscardLeft, we want Op1b to be on the Left of Op1, otherwise we\n\t\t//want Op1b to be on the Right. (And likewise with Op2 and Op2b.)\n\t\t//So, to facilitate this while inserting Op1b and Op2b ...\n\t\t//when DiscardLeft, make sure we're AT or RIGHT of Pt before adding Op1b,\n\t\t//otherwise make sure we're AT or LEFT of Pt. (Likewise with Op2b.)\n\t\tif (Dir1 === ClipperLib.Direction.dLeftToRight)\n\t\t{\n\t\t\twhile (op1.Next.Pt.X <= Pt.X &&\n\t\t\t\top1.Next.Pt.X >= op1.Pt.X && op1.Next.Pt.Y === Pt.Y)\n\t\t\t\top1 = op1.Next;\n\t\t\tif (DiscardLeft && (op1.Pt.X !== Pt.X))\n\t\t\t\top1 = op1.Next;\n\t\t\top1b = this.DupOutPt(op1, !DiscardLeft);\n\t\t\tif (ClipperLib.IntPoint.op_Inequality(op1b.Pt, Pt))\n\t\t\t{\n\t\t\t\top1 = op1b;\n\t\t\t\t//op1.Pt = Pt;\n\t\t\t\top1.Pt.X = Pt.X;\n\t\t\t\top1.Pt.Y = Pt.Y;\n\t\t\t\tif (ClipperLib.use_xyz) op1.Pt.Z = Pt.Z;\n\t\t\t\top1b = this.DupOutPt(op1, !DiscardLeft);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile (op1.Next.Pt.X >= Pt.X &&\n\t\t\t\top1.Next.Pt.X <= op1.Pt.X && op1.Next.Pt.Y === Pt.Y)\n\t\t\t\top1 = op1.Next;\n\t\t\tif (!DiscardLeft && (op1.Pt.X !== Pt.X))\n\t\t\t\top1 = op1.Next;\n\t\t\top1b = this.DupOutPt(op1, DiscardLeft);\n\t\t\tif (ClipperLib.IntPoint.op_Inequality(op1b.Pt, Pt))\n\t\t\t{\n\t\t\t\top1 = op1b;\n\t\t\t\t//op1.Pt = Pt;\n\t\t\t\top1.Pt.X = Pt.X;\n\t\t\t\top1.Pt.Y = Pt.Y;\n\t\t\t\tif (ClipperLib.use_xyz) op1.Pt.Z = Pt.Z;\n\t\t\t\top1b = this.DupOutPt(op1, DiscardLeft);\n\t\t\t}\n\t\t}\n\t\tif (Dir2 === ClipperLib.Direction.dLeftToRight)\n\t\t{\n\t\t\twhile (op2.Next.Pt.X <= Pt.X &&\n\t\t\t\top2.Next.Pt.X >= op2.Pt.X && op2.Next.Pt.Y === Pt.Y)\n\t\t\t\top2 = op2.Next;\n\t\t\tif (DiscardLeft && (op2.Pt.X !== Pt.X))\n\t\t\t\top2 = op2.Next;\n\t\t\top2b = this.DupOutPt(op2, !DiscardLeft);\n\t\t\tif (ClipperLib.IntPoint.op_Inequality(op2b.Pt, Pt))\n\t\t\t{\n\t\t\t\top2 = op2b;\n\t\t\t\t//op2.Pt = Pt;\n\t\t\t\top2.Pt.X = Pt.X;\n\t\t\t\top2.Pt.Y = Pt.Y;\n\t\t\t\tif (ClipperLib.use_xyz) op2.Pt.Z = Pt.Z;\n\t\t\t\top2b = this.DupOutPt(op2, !DiscardLeft);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile (op2.Next.Pt.X >= Pt.X &&\n\t\t\t\top2.Next.Pt.X <= op2.Pt.X && op2.Next.Pt.Y === Pt.Y)\n\t\t\t\top2 = op2.Next;\n\t\t\tif (!DiscardLeft && (op2.Pt.X !== Pt.X))\n\t\t\t\top2 = op2.Next;\n\t\t\top2b = this.DupOutPt(op2, DiscardLeft);\n\t\t\tif (ClipperLib.IntPoint.op_Inequality(op2b.Pt, Pt))\n\t\t\t{\n\t\t\t\top2 = op2b;\n\t\t\t\t//op2.Pt = Pt;\n\t\t\t\top2.Pt.X = Pt.X;\n\t\t\t\top2.Pt.Y = Pt.Y;\n\t\t\t\tif (ClipperLib.use_xyz) op2.Pt.Z = Pt.Z;\n\t\t\t\top2b = this.DupOutPt(op2, DiscardLeft);\n\t\t\t}\n\t\t}\n\t\tif ((Dir1 === ClipperLib.Direction.dLeftToRight) === DiscardLeft)\n\t\t{\n\t\t\top1.Prev = op2;\n\t\t\top2.Next = op1;\n\t\t\top1b.Next = op2b;\n\t\t\top2b.Prev = op1b;\n\t\t}\n\t\telse\n\t\t{\n\t\t\top1.Next = op2;\n\t\t\top2.Prev = op1;\n\t\t\top1b.Prev = op2b;\n\t\t\top2b.Next = op1b;\n\t\t}\n\t\treturn true;\n\t};\n\n\tClipperLib.Clipper.prototype.JoinPoints = function (j, outRec1, outRec2)\n\t{\n\t\tvar op1 = j.OutPt1,\n\t\t\top1b = new ClipperLib.OutPt();\n\t\tvar op2 = j.OutPt2,\n\t\t\top2b = new ClipperLib.OutPt();\n\t\t//There are 3 kinds of joins for output polygons ...\n\t\t//1. Horizontal joins where Join.OutPt1 & Join.OutPt2 are vertices anywhere\n\t\t//along (horizontal) collinear edges (& Join.OffPt is on the same horizontal).\n\t\t//2. Non-horizontal joins where Join.OutPt1 & Join.OutPt2 are at the same\n\t\t//location at the Bottom of the overlapping segment (& Join.OffPt is above).\n\t\t//3. StrictlySimple joins where edges touch but are not collinear and where\n\t\t//Join.OutPt1, Join.OutPt2 & Join.OffPt all share the same point.\n\t\tvar isHorizontal = (j.OutPt1.Pt.Y === j.OffPt.Y);\n\t\tif (isHorizontal && (ClipperLib.IntPoint.op_Equality(j.OffPt, j.OutPt1.Pt)) && (ClipperLib.IntPoint.op_Equality(j.OffPt, j.OutPt2.Pt)))\n\t\t{\n\t\t\t//Strictly Simple join ...\n\t\t\tif (outRec1 !== outRec2) return false;\n\n\t\t\top1b = j.OutPt1.Next;\n\t\t\twhile (op1b !== op1 && (ClipperLib.IntPoint.op_Equality(op1b.Pt, j.OffPt)))\n\t\t\t\top1b = op1b.Next;\n\t\t\tvar reverse1 = (op1b.Pt.Y > j.OffPt.Y);\n\t\t\top2b = j.OutPt2.Next;\n\t\t\twhile (op2b !== op2 && (ClipperLib.IntPoint.op_Equality(op2b.Pt, j.OffPt)))\n\t\t\t\top2b = op2b.Next;\n\t\t\tvar reverse2 = (op2b.Pt.Y > j.OffPt.Y);\n\t\t\tif (reverse1 === reverse2)\n\t\t\t\treturn false;\n\t\t\tif (reverse1)\n\t\t\t{\n\t\t\t\top1b = this.DupOutPt(op1, false);\n\t\t\t\top2b = this.DupOutPt(op2, true);\n\t\t\t\top1.Prev = op2;\n\t\t\t\top2.Next = op1;\n\t\t\t\top1b.Next = op2b;\n\t\t\t\top2b.Prev = op1b;\n\t\t\t\tj.OutPt1 = op1;\n\t\t\t\tj.OutPt2 = op1b;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\top1b = this.DupOutPt(op1, true);\n\t\t\t\top2b = this.DupOutPt(op2, false);\n\t\t\t\top1.Next = op2;\n\t\t\t\top2.Prev = op1;\n\t\t\t\top1b.Prev = op2b;\n\t\t\t\top2b.Next = op1b;\n\t\t\t\tj.OutPt1 = op1;\n\t\t\t\tj.OutPt2 = op1b;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse if (isHorizontal)\n\t\t{\n\t\t\t//treat horizontal joins differently to non-horizontal joins since with\n\t\t\t//them we're not yet sure where the overlapping is. OutPt1.Pt & OutPt2.Pt\n\t\t\t//may be anywhere along the horizontal edge.\n\t\t\top1b = op1;\n\t\t\twhile (op1.Prev.Pt.Y === op1.Pt.Y && op1.Prev !== op1b && op1.Prev !== op2)\n\t\t\t\top1 = op1.Prev;\n\t\t\twhile (op1b.Next.Pt.Y === op1b.Pt.Y && op1b.Next !== op1 && op1b.Next !== op2)\n\t\t\t\top1b = op1b.Next;\n\t\t\tif (op1b.Next === op1 || op1b.Next === op2)\n\t\t\t\treturn false;\n\t\t\t//a flat 'polygon'\n\t\t\top2b = op2;\n\t\t\twhile (op2.Prev.Pt.Y === op2.Pt.Y && op2.Prev !== op2b && op2.Prev !== op1b)\n\t\t\t\top2 = op2.Prev;\n\t\t\twhile (op2b.Next.Pt.Y === op2b.Pt.Y && op2b.Next !== op2 && op2b.Next !== op1)\n\t\t\t\top2b = op2b.Next;\n\t\t\tif (op2b.Next === op2 || op2b.Next === op1)\n\t\t\t\treturn false;\n\t\t\t//a flat 'polygon'\n\t\t\t//Op1 -. Op1b & Op2 -. Op2b are the extremites of the horizontal edges\n\n\t\t\tvar $val = {\n\t\t\t\tLeft: null,\n\t\t\t\tRight: null\n\t\t\t};\n\n\t\t\tif (!this.GetOverlap(op1.Pt.X, op1b.Pt.X, op2.Pt.X, op2b.Pt.X, $val))\n\t\t\t\treturn false;\n\t\t\tvar Left = $val.Left;\n\t\t\tvar Right = $val.Right;\n\n\t\t\t//DiscardLeftSide: when overlapping edges are joined, a spike will created\n\t\t\t//which needs to be cleaned up. However, we don't want Op1 or Op2 caught up\n\t\t\t//on the discard Side as either may still be needed for other joins ...\n\t\t\tvar Pt = new ClipperLib.IntPoint0();\n\t\t\tvar DiscardLeftSide;\n\t\t\tif (op1.Pt.X >= Left && op1.Pt.X <= Right)\n\t\t\t{\n\t\t\t\t//Pt = op1.Pt;\n\t\t\t\tPt.X = op1.Pt.X;\n\t\t\t\tPt.Y = op1.Pt.Y;\n\t\t\t\tif (ClipperLib.use_xyz) Pt.Z = op1.Pt.Z;\n\t\t\t\tDiscardLeftSide = (op1.Pt.X > op1b.Pt.X);\n\t\t\t}\n\t\t\telse if (op2.Pt.X >= Left && op2.Pt.X <= Right)\n\t\t\t{\n\t\t\t\t//Pt = op2.Pt;\n\t\t\t\tPt.X = op2.Pt.X;\n\t\t\t\tPt.Y = op2.Pt.Y;\n\t\t\t\tif (ClipperLib.use_xyz) Pt.Z = op2.Pt.Z;\n\t\t\t\tDiscardLeftSide = (op2.Pt.X > op2b.Pt.X);\n\t\t\t}\n\t\t\telse if (op1b.Pt.X >= Left && op1b.Pt.X <= Right)\n\t\t\t{\n\t\t\t\t//Pt = op1b.Pt;\n\t\t\t\tPt.X = op1b.Pt.X;\n\t\t\t\tPt.Y = op1b.Pt.Y;\n\t\t\t\tif (ClipperLib.use_xyz) Pt.Z = op1b.Pt.Z;\n\t\t\t\tDiscardLeftSide = op1b.Pt.X > op1.Pt.X;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//Pt = op2b.Pt;\n\t\t\t\tPt.X = op2b.Pt.X;\n\t\t\t\tPt.Y = op2b.Pt.Y;\n\t\t\t\tif (ClipperLib.use_xyz) Pt.Z = op2b.Pt.Z;\n\t\t\t\tDiscardLeftSide = (op2b.Pt.X > op2.Pt.X);\n\t\t\t}\n\t\t\tj.OutPt1 = op1;\n\t\t\tj.OutPt2 = op2;\n\t\t\treturn this.JoinHorz(op1, op1b, op2, op2b, Pt, DiscardLeftSide);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//nb: For non-horizontal joins ...\n\t\t\t// 1. Jr.OutPt1.Pt.Y == Jr.OutPt2.Pt.Y\n\t\t\t// 2. Jr.OutPt1.Pt > Jr.OffPt.Y\n\t\t\t//make sure the polygons are correctly oriented ...\n\t\t\top1b = op1.Next;\n\t\t\twhile ((ClipperLib.IntPoint.op_Equality(op1b.Pt, op1.Pt)) && (op1b !== op1))\n\t\t\t\top1b = op1b.Next;\n\t\t\tvar Reverse1 = ((op1b.Pt.Y > op1.Pt.Y) || !ClipperLib.ClipperBase.SlopesEqual4(op1.Pt, op1b.Pt, j.OffPt, this.m_UseFullRange));\n\t\t\tif (Reverse1)\n\t\t\t{\n\t\t\t\top1b = op1.Prev;\n\t\t\t\twhile ((ClipperLib.IntPoint.op_Equality(op1b.Pt, op1.Pt)) && (op1b !== op1))\n\t\t\t\t\top1b = op1b.Prev;\n\n\t\t\t\tif ((op1b.Pt.Y > op1.Pt.Y) || !ClipperLib.ClipperBase.SlopesEqual4(op1.Pt, op1b.Pt, j.OffPt, this.m_UseFullRange))\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\top2b = op2.Next;\n\t\t\twhile ((ClipperLib.IntPoint.op_Equality(op2b.Pt, op2.Pt)) && (op2b !== op2))\n\t\t\t\top2b = op2b.Next;\n\n\t\t\tvar Reverse2 = ((op2b.Pt.Y > op2.Pt.Y) || !ClipperLib.ClipperBase.SlopesEqual4(op2.Pt, op2b.Pt, j.OffPt, this.m_UseFullRange));\n\t\t\tif (Reverse2)\n\t\t\t{\n\t\t\t\top2b = op2.Prev;\n\t\t\t\twhile ((ClipperLib.IntPoint.op_Equality(op2b.Pt, op2.Pt)) && (op2b !== op2))\n\t\t\t\t\top2b = op2b.Prev;\n\n\t\t\t\tif ((op2b.Pt.Y > op2.Pt.Y) || !ClipperLib.ClipperBase.SlopesEqual4(op2.Pt, op2b.Pt, j.OffPt, this.m_UseFullRange))\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif ((op1b === op1) || (op2b === op2) || (op1b === op2b) ||\n\t\t\t\t((outRec1 === outRec2) && (Reverse1 === Reverse2)))\n\t\t\t\treturn false;\n\t\t\tif (Reverse1)\n\t\t\t{\n\t\t\t\top1b = this.DupOutPt(op1, false);\n\t\t\t\top2b = this.DupOutPt(op2, true);\n\t\t\t\top1.Prev = op2;\n\t\t\t\top2.Next = op1;\n\t\t\t\top1b.Next = op2b;\n\t\t\t\top2b.Prev = op1b;\n\t\t\t\tj.OutPt1 = op1;\n\t\t\t\tj.OutPt2 = op1b;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\top1b = this.DupOutPt(op1, true);\n\t\t\t\top2b = this.DupOutPt(op2, false);\n\t\t\t\top1.Next = op2;\n\t\t\t\top2.Prev = op1;\n\t\t\t\top1b.Prev = op2b;\n\t\t\t\top2b.Next = op1b;\n\t\t\t\tj.OutPt1 = op1;\n\t\t\t\tj.OutPt2 = op1b;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.Clipper.GetBounds = function (paths)\n\t{\n\t\tvar i = 0,\n\t\t\tcnt = paths.length;\n\t\twhile (i < cnt && paths[i].length === 0) i++;\n\t\tif (i === cnt) return new ClipperLib.IntRect(0, 0, 0, 0);\n\t\tvar result = new ClipperLib.IntRect();\n\t\tresult.left = paths[i][0].X;\n\t\tresult.right = result.left;\n\t\tresult.top = paths[i][0].Y;\n\t\tresult.bottom = result.top;\n\t\tfor (; i < cnt; i++)\n\t\t\tfor (var j = 0, jlen = paths[i].length; j < jlen; j++)\n\t\t\t{\n\t\t\t\tif (paths[i][j].X < result.left) result.left = paths[i][j].X;\n\t\t\t\telse if (paths[i][j].X > result.right) result.right = paths[i][j].X;\n\t\t\t\tif (paths[i][j].Y < result.top) result.top = paths[i][j].Y;\n\t\t\t\telse if (paths[i][j].Y > result.bottom) result.bottom = paths[i][j].Y;\n\t\t\t}\n\t\treturn result;\n\t}\n\tClipperLib.Clipper.prototype.GetBounds2 = function (ops)\n\t{\n\t\tvar opStart = ops;\n\t\tvar result = new ClipperLib.IntRect();\n\t\tresult.left = ops.Pt.X;\n\t\tresult.right = ops.Pt.X;\n\t\tresult.top = ops.Pt.Y;\n\t\tresult.bottom = ops.Pt.Y;\n\t\tops = ops.Next;\n\t\twhile (ops !== opStart)\n\t\t{\n\t\t\tif (ops.Pt.X < result.left)\n\t\t\t\tresult.left = ops.Pt.X;\n\t\t\tif (ops.Pt.X > result.right)\n\t\t\t\tresult.right = ops.Pt.X;\n\t\t\tif (ops.Pt.Y < result.top)\n\t\t\t\tresult.top = ops.Pt.Y;\n\t\t\tif (ops.Pt.Y > result.bottom)\n\t\t\t\tresult.bottom = ops.Pt.Y;\n\t\t\tops = ops.Next;\n\t\t}\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.PointInPolygon = function (pt, path)\n\t{\n\t\t//returns 0 if false, +1 if true, -1 if pt ON polygon boundary\n\t\t//See \"The Point in Polygon Problem for Arbitrary Polygons\" by Hormann & Agathos\n\t\t//http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.88.5498&rep=rep1&type=pdf\n\t\tvar result = 0,\n\t\t\tcnt = path.length;\n\t\tif (cnt < 3)\n\t\t\treturn 0;\n\t\tvar ip = path[0];\n\t\tfor (var i = 1; i <= cnt; ++i)\n\t\t{\n\t\t\tvar ipNext = (i === cnt ? path[0] : path[i]);\n\t\t\tif (ipNext.Y === pt.Y)\n\t\t\t{\n\t\t\t\tif ((ipNext.X === pt.X) || (ip.Y === pt.Y && ((ipNext.X > pt.X) === (ip.X < pt.X))))\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif ((ip.Y < pt.Y) !== (ipNext.Y < pt.Y))\n\t\t\t{\n\t\t\t\tif (ip.X >= pt.X)\n\t\t\t\t{\n\t\t\t\t\tif (ipNext.X > pt.X)\n\t\t\t\t\t\tresult = 1 - result;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tvar d = (ip.X - pt.X) * (ipNext.Y - pt.Y) - (ipNext.X - pt.X) * (ip.Y - pt.Y);\n\t\t\t\t\t\tif (d === 0)\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\telse if ((d > 0) === (ipNext.Y > ip.Y))\n\t\t\t\t\t\t\tresult = 1 - result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (ipNext.X > pt.X)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar d = (ip.X - pt.X) * (ipNext.Y - pt.Y) - (ipNext.X - pt.X) * (ip.Y - pt.Y);\n\t\t\t\t\t\tif (d === 0)\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\telse if ((d > 0) === (ipNext.Y > ip.Y))\n\t\t\t\t\t\t\tresult = 1 - result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tip = ipNext;\n\t\t}\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.prototype.PointInPolygon = function (pt, op)\n\t{\n\t\t//returns 0 if false, +1 if true, -1 if pt ON polygon boundary\n\t\tvar result = 0;\n\t\tvar startOp = op;\n\t\tvar ptx = pt.X,\n\t\t\tpty = pt.Y;\n\t\tvar poly0x = op.Pt.X,\n\t\t\tpoly0y = op.Pt.Y;\n\t\tdo {\n\t\t\top = op.Next;\n\t\t\tvar poly1x = op.Pt.X,\n\t\t\t\tpoly1y = op.Pt.Y;\n\t\t\tif (poly1y === pty)\n\t\t\t{\n\t\t\t\tif ((poly1x === ptx) || (poly0y === pty && ((poly1x > ptx) === (poly0x < ptx))))\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif ((poly0y < pty) !== (poly1y < pty))\n\t\t\t{\n\t\t\t\tif (poly0x >= ptx)\n\t\t\t\t{\n\t\t\t\t\tif (poly1x > ptx)\n\t\t\t\t\t\tresult = 1 - result;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tvar d = (poly0x - ptx) * (poly1y - pty) - (poly1x - ptx) * (poly0y - pty);\n\t\t\t\t\t\tif (d === 0)\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\tif ((d > 0) === (poly1y > poly0y))\n\t\t\t\t\t\t\tresult = 1 - result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (poly1x > ptx)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar d = (poly0x - ptx) * (poly1y - pty) - (poly1x - ptx) * (poly0y - pty);\n\t\t\t\t\t\tif (d === 0)\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\tif ((d > 0) === (poly1y > poly0y))\n\t\t\t\t\t\t\tresult = 1 - result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tpoly0x = poly1x;\n\t\t\tpoly0y = poly1y;\n\t\t} while (startOp !== op);\n\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.prototype.Poly2ContainsPoly1 = function (outPt1, outPt2)\n\t{\n\t\tvar op = outPt1;\n\t\tdo {\n\t\t\t//nb: PointInPolygon returns 0 if false, +1 if true, -1 if pt on polygon\n\t\t\tvar res = this.PointInPolygon(op.Pt, outPt2);\n\t\t\tif (res >= 0)\n\t\t\t\treturn res > 0;\n\t\t\top = op.Next;\n\t\t}\n\t\twhile (op !== outPt1)\n\t\treturn true;\n\t};\n\n\tClipperLib.Clipper.prototype.FixupFirstLefts1 = function (OldOutRec, NewOutRec)\n\t{\n\t\tvar outRec, firstLeft;\n\t\tfor (var i = 0, ilen = this.m_PolyOuts.length; i < ilen; i++)\n\t\t{\n\t\t\toutRec = this.m_PolyOuts[i];\n\t\t\tfirstLeft = ClipperLib.Clipper.ParseFirstLeft(outRec.FirstLeft);\n\t\t\tif (outRec.Pts !== null && firstLeft === OldOutRec)\n\t\t\t{\n\t\t\t\tif (this.Poly2ContainsPoly1(outRec.Pts, NewOutRec.Pts))\n\t\t\t\t\toutRec.FirstLeft = NewOutRec;\n\t\t\t}\n\t\t}\n\t}\n\n\tClipperLib.Clipper.prototype.FixupFirstLefts2 = function (innerOutRec, outerOutRec)\n\t{\n\t\t//A polygon has split into two such that one is now the inner of the other.\n\t\t//It's possible that these polygons now wrap around other polygons, so check\n\t\t//every polygon that's also contained by OuterOutRec's FirstLeft container\n\t\t//(including nil) to see if they've become inner to the new inner polygon ...\n\t\tvar orfl = outerOutRec.FirstLeft;\n\t\tvar outRec, firstLeft;\n\t\tfor (var i = 0, ilen = this.m_PolyOuts.length; i < ilen; i++)\n\t\t{\n\t\t\toutRec = this.m_PolyOuts[i];\n\t\t\tif (outRec.Pts === null || outRec === outerOutRec || outRec === innerOutRec)\n\t\t\t\tcontinue;\n\t\t\tfirstLeft = ClipperLib.Clipper.ParseFirstLeft(outRec.FirstLeft);\n\t\t\tif (firstLeft !== orfl && firstLeft !== innerOutRec && firstLeft !== outerOutRec)\n\t\t\t\tcontinue;\n\t\t\tif (this.Poly2ContainsPoly1(outRec.Pts, innerOutRec.Pts))\n\t\t\t\toutRec.FirstLeft = innerOutRec;\n\t\t\telse if (this.Poly2ContainsPoly1(outRec.Pts, outerOutRec.Pts))\n\t\t\t\toutRec.FirstLeft = outerOutRec;\n\t\t\telse if (outRec.FirstLeft === innerOutRec || outRec.FirstLeft === outerOutRec)\n\t\t\t\toutRec.FirstLeft = orfl;\n\t\t}\n\t}\n\n\tClipperLib.Clipper.prototype.FixupFirstLefts3 = function (OldOutRec, NewOutRec)\n\t{\n\t\t//same as FixupFirstLefts1 but doesn't call Poly2ContainsPoly1()\n\t\tvar outRec;\n\t\tvar firstLeft;\n\t\tfor (var i = 0, ilen = this.m_PolyOuts.length; i < ilen; i++)\n\t\t{\n\t\t\toutRec = this.m_PolyOuts[i];\n\t\t\tfirstLeft = ClipperLib.Clipper.ParseFirstLeft(outRec.FirstLeft);\n\t\t\tif (outRec.Pts !== null && firstLeft === OldOutRec)\n\t\t\t\toutRec.FirstLeft = NewOutRec;\n\t\t}\n\t}\n\n\tClipperLib.Clipper.ParseFirstLeft = function (FirstLeft)\n\t{\n\t\twhile (FirstLeft !== null && FirstLeft.Pts === null)\n\t\t\tFirstLeft = FirstLeft.FirstLeft;\n\t\treturn FirstLeft;\n\t};\n\n\tClipperLib.Clipper.prototype.JoinCommonEdges = function ()\n\t{\n\t\tfor (var i = 0, ilen = this.m_Joins.length; i < ilen; i++)\n\t\t{\n\t\t\tvar join = this.m_Joins[i];\n\t\t\tvar outRec1 = this.GetOutRec(join.OutPt1.Idx);\n\t\t\tvar outRec2 = this.GetOutRec(join.OutPt2.Idx);\n\t\t\tif (outRec1.Pts === null || outRec2.Pts === null)\n\t\t\t\tcontinue;\n\n\t\t\tif (outRec1.IsOpen || outRec2.IsOpen)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t//get the polygon fragment with the correct hole state (FirstLeft)\n\t\t\t//before calling JoinPoints() ...\n\t\t\tvar holeStateRec;\n\t\t\tif (outRec1 === outRec2)\n\t\t\t\tholeStateRec = outRec1;\n\t\t\telse if (this.OutRec1RightOfOutRec2(outRec1, outRec2))\n\t\t\t\tholeStateRec = outRec2;\n\t\t\telse if (this.OutRec1RightOfOutRec2(outRec2, outRec1))\n\t\t\t\tholeStateRec = outRec1;\n\t\t\telse\n\t\t\t\tholeStateRec = this.GetLowermostRec(outRec1, outRec2);\n\n\t\t\tif (!this.JoinPoints(join, outRec1, outRec2)) continue;\n\n\t\t\tif (outRec1 === outRec2)\n\t\t\t{\n\t\t\t\t//instead of joining two polygons, we've just created a new one by\n\t\t\t\t//splitting one polygon into two.\n\t\t\t\toutRec1.Pts = join.OutPt1;\n\t\t\t\toutRec1.BottomPt = null;\n\t\t\t\toutRec2 = this.CreateOutRec();\n\t\t\t\toutRec2.Pts = join.OutPt2;\n\t\t\t\t//update all OutRec2.Pts Idx's ...\n\t\t\t\tthis.UpdateOutPtIdxs(outRec2);\n\n\t\t\t\tif (this.Poly2ContainsPoly1(outRec2.Pts, outRec1.Pts))\n\t\t\t\t{\n\t\t\t\t\t//outRec1 contains outRec2 ...\n\t\t\t\t\toutRec2.IsHole = !outRec1.IsHole;\n\t\t\t\t\toutRec2.FirstLeft = outRec1;\n\t\t\t\t\tif (this.m_UsingPolyTree)\n\t\t\t\t\t\tthis.FixupFirstLefts2(outRec2, outRec1);\n\t\t\t\t\tif ((outRec2.IsHole ^ this.ReverseSolution) == (this.Area$1(outRec2) > 0))\n\t\t\t\t\t\tthis.ReversePolyPtLinks(outRec2.Pts);\n\t\t\t\t}\n\t\t\t\telse if (this.Poly2ContainsPoly1(outRec1.Pts, outRec2.Pts))\n\t\t\t\t{\n\t\t\t\t\t//outRec2 contains outRec1 ...\n\t\t\t\t\toutRec2.IsHole = outRec1.IsHole;\n\t\t\t\t\toutRec1.IsHole = !outRec2.IsHole;\n\t\t\t\t\toutRec2.FirstLeft = outRec1.FirstLeft;\n\t\t\t\t\toutRec1.FirstLeft = outRec2;\n\t\t\t\t\tif (this.m_UsingPolyTree)\n\t\t\t\t\t\tthis.FixupFirstLefts2(outRec1, outRec2);\n\n\t\t\t\t\tif ((outRec1.IsHole ^ this.ReverseSolution) == (this.Area$1(outRec1) > 0))\n\t\t\t\t\t\tthis.ReversePolyPtLinks(outRec1.Pts);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//the 2 polygons are completely separate ...\n\t\t\t\t\toutRec2.IsHole = outRec1.IsHole;\n\t\t\t\t\toutRec2.FirstLeft = outRec1.FirstLeft;\n\t\t\t\t\t//fixup FirstLeft pointers that may need reassigning to OutRec2\n\t\t\t\t\tif (this.m_UsingPolyTree)\n\t\t\t\t\t\tthis.FixupFirstLefts1(outRec1, outRec2);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//joined 2 polygons together ...\n\t\t\t\toutRec2.Pts = null;\n\t\t\t\toutRec2.BottomPt = null;\n\t\t\t\toutRec2.Idx = outRec1.Idx;\n\t\t\t\toutRec1.IsHole = holeStateRec.IsHole;\n\t\t\t\tif (holeStateRec === outRec2)\n\t\t\t\t\toutRec1.FirstLeft = outRec2.FirstLeft;\n\t\t\t\toutRec2.FirstLeft = outRec1;\n\t\t\t\t//fixup FirstLeft pointers that may need reassigning to OutRec1\n\t\t\t\tif (this.m_UsingPolyTree)\n\t\t\t\t\tthis.FixupFirstLefts3(outRec2, outRec1);\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.Clipper.prototype.UpdateOutPtIdxs = function (outrec)\n\t{\n\t\tvar op = outrec.Pts;\n\t\tdo {\n\t\t\top.Idx = outrec.Idx;\n\t\t\top = op.Prev;\n\t\t}\n\t\twhile (op !== outrec.Pts)\n\t};\n\n\tClipperLib.Clipper.prototype.DoSimplePolygons = function ()\n\t{\n\t\tvar i = 0;\n\t\twhile (i < this.m_PolyOuts.length)\n\t\t{\n\t\t\tvar outrec = this.m_PolyOuts[i++];\n\t\t\tvar op = outrec.Pts;\n\t\t\tif (op === null || outrec.IsOpen)\n\t\t\t\tcontinue;\n\t\t\tdo //for each Pt in Polygon until duplicate found do ...\n\t\t\t{\n\t\t\t\tvar op2 = op.Next;\n\t\t\t\twhile (op2 !== outrec.Pts)\n\t\t\t\t{\n\t\t\t\t\tif ((ClipperLib.IntPoint.op_Equality(op.Pt, op2.Pt)) && op2.Next !== op && op2.Prev !== op)\n\t\t\t\t\t{\n\t\t\t\t\t\t//split the polygon into two ...\n\t\t\t\t\t\tvar op3 = op.Prev;\n\t\t\t\t\t\tvar op4 = op2.Prev;\n\t\t\t\t\t\top.Prev = op4;\n\t\t\t\t\t\top4.Next = op;\n\t\t\t\t\t\top2.Prev = op3;\n\t\t\t\t\t\top3.Next = op2;\n\t\t\t\t\t\toutrec.Pts = op;\n\t\t\t\t\t\tvar outrec2 = this.CreateOutRec();\n\t\t\t\t\t\toutrec2.Pts = op2;\n\t\t\t\t\t\tthis.UpdateOutPtIdxs(outrec2);\n\t\t\t\t\t\tif (this.Poly2ContainsPoly1(outrec2.Pts, outrec.Pts))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//OutRec2 is contained by OutRec1 ...\n\t\t\t\t\t\t\toutrec2.IsHole = !outrec.IsHole;\n\t\t\t\t\t\t\toutrec2.FirstLeft = outrec;\n\t\t\t\t\t\t\tif (this.m_UsingPolyTree) this.FixupFirstLefts2(outrec2, outrec);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (this.Poly2ContainsPoly1(outrec.Pts, outrec2.Pts))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//OutRec1 is contained by OutRec2 ...\n\t\t\t\t\t\t\toutrec2.IsHole = outrec.IsHole;\n\t\t\t\t\t\t\toutrec.IsHole = !outrec2.IsHole;\n\t\t\t\t\t\t\toutrec2.FirstLeft = outrec.FirstLeft;\n\t\t\t\t\t\t\toutrec.FirstLeft = outrec2;\n\t\t\t\t\t\t\tif (this.m_UsingPolyTree) this.FixupFirstLefts2(outrec, outrec2);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//the 2 polygons are separate ...\n\t\t\t\t\t\t\toutrec2.IsHole = outrec.IsHole;\n\t\t\t\t\t\t\toutrec2.FirstLeft = outrec.FirstLeft;\n\t\t\t\t\t\t\tif (this.m_UsingPolyTree) this.FixupFirstLefts1(outrec, outrec2);\n\t\t\t\t\t\t}\n\t\t\t\t\t\top2 = op;\n\t\t\t\t\t\t//ie get ready for the next iteration\n\t\t\t\t\t}\n\t\t\t\t\top2 = op2.Next;\n\t\t\t\t}\n\t\t\t\top = op.Next;\n\t\t\t}\n\t\t\twhile (op !== outrec.Pts)\n\t\t}\n\t};\n\n\tClipperLib.Clipper.Area = function (poly)\n\t{\n\t\tif (!Array.isArray(poly))\n\t\t\treturn 0;\n\t\tvar cnt = poly.length;\n\t\tif (cnt < 3)\n\t\t\treturn 0;\n\t\tvar a = 0;\n\t\tfor (var i = 0, j = cnt - 1; i < cnt; ++i)\n\t\t{\n\t\t\ta += (poly[j].X + poly[i].X) * (poly[j].Y - poly[i].Y);\n\t\t\tj = i;\n\t\t}\n\t\treturn -a * 0.5;\n\t};\n\n\tClipperLib.Clipper.prototype.Area = function (op)\n\t{\n\t\tvar opFirst = op;\n\t\tif (op === null) return 0;\n\t\tvar a = 0;\n\t\tdo {\n\t\t\ta = a + (op.Prev.Pt.X + op.Pt.X) * (op.Prev.Pt.Y - op.Pt.Y);\n\t\t\top = op.Next;\n\t\t} while (op !== opFirst); // && typeof op !== 'undefined');\n\t\treturn a * 0.5;\n\t}\n\n\tClipperLib.Clipper.prototype.Area$1 = function (outRec)\n\t{\n\t\treturn this.Area(outRec.Pts);\n\t};\n\n\tClipperLib.Clipper.SimplifyPolygon = function (poly, fillType)\n\t{\n\t\tvar result = new Array();\n\t\tvar c = new ClipperLib.Clipper(0);\n\t\tc.StrictlySimple = true;\n\t\tc.AddPath(poly, ClipperLib.PolyType.ptSubject, true);\n\t\tc.Execute(ClipperLib.ClipType.ctUnion, result, fillType, fillType);\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.SimplifyPolygons = function (polys, fillType)\n\t{\n\t\tif (typeof (fillType) === \"undefined\") fillType = ClipperLib.PolyFillType.pftEvenOdd;\n\t\tvar result = new Array();\n\t\tvar c = new ClipperLib.Clipper(0);\n\t\tc.StrictlySimple = true;\n\t\tc.AddPaths(polys, ClipperLib.PolyType.ptSubject, true);\n\t\tc.Execute(ClipperLib.ClipType.ctUnion, result, fillType, fillType);\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.DistanceSqrd = function (pt1, pt2)\n\t{\n\t\tvar dx = (pt1.X - pt2.X);\n\t\tvar dy = (pt1.Y - pt2.Y);\n\t\treturn (dx * dx + dy * dy);\n\t};\n\n\tClipperLib.Clipper.DistanceFromLineSqrd = function (pt, ln1, ln2)\n\t{\n\t\t//The equation of a line in general form (Ax + By + C = 0)\n\t\t//given 2 points (x¹,y¹) & (x²,y²) is ...\n\t\t//(y¹ - y²)x + (x² - x¹)y + (y² - y¹)x¹ - (x² - x¹)y¹ = 0\n\t\t//A = (y¹ - y²); B = (x² - x¹); C = (y² - y¹)x¹ - (x² - x¹)y¹\n\t\t//perpendicular distance of point (x³,y³) = (Ax³ + By³ + C)/Sqrt(A² + B²)\n\t\t//see http://en.wikipedia.org/wiki/Perpendicular_distance\n\t\tvar A = ln1.Y - ln2.Y;\n\t\tvar B = ln2.X - ln1.X;\n\t\tvar C = A * ln1.X + B * ln1.Y;\n\t\tC = A * pt.X + B * pt.Y - C;\n\t\treturn (C * C) / (A * A + B * B);\n\t};\n\n\tClipperLib.Clipper.SlopesNearCollinear = function (pt1, pt2, pt3, distSqrd)\n\t{\n\t\t//this function is more accurate when the point that's GEOMETRICALLY\n\t\t//between the other 2 points is the one that's tested for distance.\n\t\t//nb: with 'spikes', either pt1 or pt3 is geometrically between the other pts\n\t\tif (Math.abs(pt1.X - pt2.X) > Math.abs(pt1.Y - pt2.Y))\n\t\t{\n\t\t\tif ((pt1.X > pt2.X) === (pt1.X < pt3.X))\n\t\t\t\treturn ClipperLib.Clipper.DistanceFromLineSqrd(pt1, pt2, pt3) < distSqrd;\n\t\t\telse if ((pt2.X > pt1.X) === (pt2.X < pt3.X))\n\t\t\t\treturn ClipperLib.Clipper.DistanceFromLineSqrd(pt2, pt1, pt3) < distSqrd;\n\t\t\telse\n\t\t\t\treturn ClipperLib.Clipper.DistanceFromLineSqrd(pt3, pt1, pt2) < distSqrd;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ((pt1.Y > pt2.Y) === (pt1.Y < pt3.Y))\n\t\t\t\treturn ClipperLib.Clipper.DistanceFromLineSqrd(pt1, pt2, pt3) < distSqrd;\n\t\t\telse if ((pt2.Y > pt1.Y) === (pt2.Y < pt3.Y))\n\t\t\t\treturn ClipperLib.Clipper.DistanceFromLineSqrd(pt2, pt1, pt3) < distSqrd;\n\t\t\telse\n\t\t\t\treturn ClipperLib.Clipper.DistanceFromLineSqrd(pt3, pt1, pt2) < distSqrd;\n\t\t}\n\t}\n\n\tClipperLib.Clipper.PointsAreClose = function (pt1, pt2, distSqrd)\n\t{\n\t\tvar dx = pt1.X - pt2.X;\n\t\tvar dy = pt1.Y - pt2.Y;\n\t\treturn ((dx * dx) + (dy * dy) <= distSqrd);\n\t};\n\n\tClipperLib.Clipper.ExcludeOp = function (op)\n\t{\n\t\tvar result = op.Prev;\n\t\tresult.Next = op.Next;\n\t\top.Next.Prev = result;\n\t\tresult.Idx = 0;\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.CleanPolygon = function (path, distance)\n\t{\n\t\tif (typeof (distance) === \"undefined\") distance = 1.415;\n\t\t//distance = proximity in units/pixels below which vertices will be stripped.\n\t\t//Default ~= sqrt(2) so when adjacent vertices or semi-adjacent vertices have\n\t\t//both x & y coords within 1 unit, then the second vertex will be stripped.\n\t\tvar cnt = path.length;\n\t\tif (cnt === 0)\n\t\t\treturn new Array();\n\t\tvar outPts = new Array(cnt);\n\t\tfor (var i = 0; i < cnt; ++i)\n\t\t\toutPts[i] = new ClipperLib.OutPt();\n\t\tfor (var i = 0; i < cnt; ++i)\n\t\t{\n\t\t\toutPts[i].Pt = path[i];\n\t\t\toutPts[i].Next = outPts[(i + 1) % cnt];\n\t\t\toutPts[i].Next.Prev = outPts[i];\n\t\t\toutPts[i].Idx = 0;\n\t\t}\n\t\tvar distSqrd = distance * distance;\n\t\tvar op = outPts[0];\n\t\twhile (op.Idx === 0 && op.Next !== op.Prev)\n\t\t{\n\t\t\tif (ClipperLib.Clipper.PointsAreClose(op.Pt, op.Prev.Pt, distSqrd))\n\t\t\t{\n\t\t\t\top = ClipperLib.Clipper.ExcludeOp(op);\n\t\t\t\tcnt--;\n\t\t\t}\n\t\t\telse if (ClipperLib.Clipper.PointsAreClose(op.Prev.Pt, op.Next.Pt, distSqrd))\n\t\t\t{\n\t\t\t\tClipperLib.Clipper.ExcludeOp(op.Next);\n\t\t\t\top = ClipperLib.Clipper.ExcludeOp(op);\n\t\t\t\tcnt -= 2;\n\t\t\t}\n\t\t\telse if (ClipperLib.Clipper.SlopesNearCollinear(op.Prev.Pt, op.Pt, op.Next.Pt, distSqrd))\n\t\t\t{\n\t\t\t\top = ClipperLib.Clipper.ExcludeOp(op);\n\t\t\t\tcnt--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\top.Idx = 1;\n\t\t\t\top = op.Next;\n\t\t\t}\n\t\t}\n\t\tif (cnt < 3)\n\t\t\tcnt = 0;\n\t\tvar result = new Array(cnt);\n\t\tfor (var i = 0; i < cnt; ++i)\n\t\t{\n\t\t\tresult[i] = new ClipperLib.IntPoint1(op.Pt);\n\t\t\top = op.Next;\n\t\t}\n\t\toutPts = null;\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.CleanPolygons = function (polys, distance)\n\t{\n\t\tvar result = new Array(polys.length);\n\t\tfor (var i = 0, ilen = polys.length; i < ilen; i++)\n\t\t\tresult[i] = ClipperLib.Clipper.CleanPolygon(polys[i], distance);\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.Minkowski = function (pattern, path, IsSum, IsClosed)\n\t{\n\t\tvar delta = (IsClosed ? 1 : 0);\n\t\tvar polyCnt = pattern.length;\n\t\tvar pathCnt = path.length;\n\t\tvar result = new Array();\n\t\tif (IsSum)\n\t\t\tfor (var i = 0; i < pathCnt; i++)\n\t\t\t{\n\t\t\t\tvar p = new Array(polyCnt);\n\t\t\t\tfor (var j = 0, jlen = pattern.length, ip = pattern[j]; j < jlen; j++, ip = pattern[j])\n\t\t\t\t\tp[j] = new ClipperLib.IntPoint2(path[i].X + ip.X, path[i].Y + ip.Y);\n\t\t\t\tresult.push(p);\n\t\t\t}\n\t\telse\n\t\t\tfor (var i = 0; i < pathCnt; i++)\n\t\t\t{\n\t\t\t\tvar p = new Array(polyCnt);\n\t\t\t\tfor (var j = 0, jlen = pattern.length, ip = pattern[j]; j < jlen; j++, ip = pattern[j])\n\t\t\t\t\tp[j] = new ClipperLib.IntPoint2(path[i].X - ip.X, path[i].Y - ip.Y);\n\t\t\t\tresult.push(p);\n\t\t\t}\n\t\tvar quads = new Array();\n\t\tfor (var i = 0; i < pathCnt - 1 + delta; i++)\n\t\t\tfor (var j = 0; j < polyCnt; j++)\n\t\t\t{\n\t\t\t\tvar quad = new Array();\n\t\t\t\tquad.push(result[i % pathCnt][j % polyCnt]);\n\t\t\t\tquad.push(result[(i + 1) % pathCnt][j % polyCnt]);\n\t\t\t\tquad.push(result[(i + 1) % pathCnt][(j + 1) % polyCnt]);\n\t\t\t\tquad.push(result[i % pathCnt][(j + 1) % polyCnt]);\n\t\t\t\tif (!ClipperLib.Clipper.Orientation(quad))\n\t\t\t\t\tquad.reverse();\n\t\t\t\tquads.push(quad);\n\t\t\t}\n\t\treturn quads;\n\t};\n\n\tClipperLib.Clipper.MinkowskiSum = function (pattern, path_or_paths, pathIsClosed)\n\t{\n\t\tif (!(path_or_paths[0] instanceof Array))\n\t\t{\n\t\t\tvar path = path_or_paths;\n\t\t\tvar paths = ClipperLib.Clipper.Minkowski(pattern, path, true, pathIsClosed);\n\t\t\tvar c = new ClipperLib.Clipper();\n\t\t\tc.AddPaths(paths, ClipperLib.PolyType.ptSubject, true);\n\t\t\tc.Execute(ClipperLib.ClipType.ctUnion, paths, ClipperLib.PolyFillType.pftNonZero, ClipperLib.PolyFillType.pftNonZero);\n\t\t\treturn paths;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar paths = path_or_paths;\n\t\t\tvar solution = new ClipperLib.Paths();\n\t\t\tvar c = new ClipperLib.Clipper();\n\t\t\tfor (var i = 0; i < paths.length; ++i)\n\t\t\t{\n\t\t\t\tvar tmp = ClipperLib.Clipper.Minkowski(pattern, paths[i], true, pathIsClosed);\n\t\t\t\tc.AddPaths(tmp, ClipperLib.PolyType.ptSubject, true);\n\t\t\t\tif (pathIsClosed)\n\t\t\t\t{\n\t\t\t\t\tvar path = ClipperLib.Clipper.TranslatePath(paths[i], pattern[0]);\n\t\t\t\t\tc.AddPath(path, ClipperLib.PolyType.ptClip, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\tc.Execute(ClipperLib.ClipType.ctUnion, solution,\n\t\t\t\tClipperLib.PolyFillType.pftNonZero, ClipperLib.PolyFillType.pftNonZero);\n\t\t\treturn solution;\n\t\t}\n\t}\n\n\tClipperLib.Clipper.TranslatePath = function (path, delta)\n\t{\n\t\tvar outPath = new ClipperLib.Path();\n\t\tfor (var i = 0; i < path.length; i++)\n\t\t\toutPath.push(new ClipperLib.IntPoint2(path[i].X + delta.X, path[i].Y + delta.Y));\n\t\treturn outPath;\n\t}\n\n\tClipperLib.Clipper.MinkowskiDiff = function (poly1, poly2)\n\t{\n\t\tvar paths = ClipperLib.Clipper.Minkowski(poly1, poly2, false, true);\n\t\tvar c = new ClipperLib.Clipper();\n\t\tc.AddPaths(paths, ClipperLib.PolyType.ptSubject, true);\n\t\tc.Execute(ClipperLib.ClipType.ctUnion, paths, ClipperLib.PolyFillType.pftNonZero, ClipperLib.PolyFillType.pftNonZero);\n\t\treturn paths;\n\t}\n\n\tClipperLib.Clipper.PolyTreeToPaths = function (polytree)\n\t{\n\t\tvar result = new Array();\n\t\t//result.set_Capacity(polytree.get_Total());\n\t\tClipperLib.Clipper.AddPolyNodeToPaths(polytree, ClipperLib.Clipper.NodeType.ntAny, result);\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.AddPolyNodeToPaths = function (polynode, nt, paths)\n\t{\n\t\tvar match = true;\n\t\tswitch (nt)\n\t\t{\n\t\tcase ClipperLib.Clipper.NodeType.ntOpen:\n\t\t\treturn;\n\t\tcase ClipperLib.Clipper.NodeType.ntClosed:\n\t\t\tmatch = !polynode.IsOpen;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\tif (polynode.m_polygon.length > 0 && match)\n\t\t\tpaths.push(polynode.m_polygon);\n\t\tfor (var $i3 = 0, $t3 = polynode.Childs(), $l3 = $t3.length, pn = $t3[$i3]; $i3 < $l3; $i3++, pn = $t3[$i3])\n\t\t\tClipperLib.Clipper.AddPolyNodeToPaths(pn, nt, paths);\n\t};\n\n\tClipperLib.Clipper.OpenPathsFromPolyTree = function (polytree)\n\t{\n\t\tvar result = new ClipperLib.Paths();\n\t\t//result.set_Capacity(polytree.ChildCount());\n\t\tfor (var i = 0, ilen = polytree.ChildCount(); i < ilen; i++)\n\t\t\tif (polytree.Childs()[i].IsOpen)\n\t\t\t\tresult.push(polytree.Childs()[i].m_polygon);\n\t\treturn result;\n\t};\n\n\tClipperLib.Clipper.ClosedPathsFromPolyTree = function (polytree)\n\t{\n\t\tvar result = new ClipperLib.Paths();\n\t\t//result.set_Capacity(polytree.Total());\n\t\tClipperLib.Clipper.AddPolyNodeToPaths(polytree, ClipperLib.Clipper.NodeType.ntClosed, result);\n\t\treturn result;\n\t};\n\n\tInherit(ClipperLib.Clipper, ClipperLib.ClipperBase);\n\tClipperLib.Clipper.NodeType = {\n\t\tntAny: 0,\n\t\tntOpen: 1,\n\t\tntClosed: 2\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.ClipperOffset = function (miterLimit, arcTolerance)\n\t{\n\t\tif (typeof (miterLimit) === \"undefined\") miterLimit = 2;\n\t\tif (typeof (arcTolerance) === \"undefined\") arcTolerance = ClipperLib.ClipperOffset.def_arc_tolerance;\n\t\tthis.m_destPolys = new ClipperLib.Paths();\n\t\tthis.m_srcPoly = new ClipperLib.Path();\n\t\tthis.m_destPoly = new ClipperLib.Path();\n\t\tthis.m_normals = new Array();\n\t\tthis.m_delta = 0;\n\t\tthis.m_sinA = 0;\n\t\tthis.m_sin = 0;\n\t\tthis.m_cos = 0;\n\t\tthis.m_miterLim = 0;\n\t\tthis.m_StepsPerRad = 0;\n\t\tthis.m_lowest = new ClipperLib.IntPoint0();\n\t\tthis.m_polyNodes = new ClipperLib.PolyNode();\n\t\tthis.MiterLimit = miterLimit;\n\t\tthis.ArcTolerance = arcTolerance;\n\t\tthis.m_lowest.X = -1;\n\t};\n\n\tClipperLib.ClipperOffset.two_pi = 6.28318530717959;\n\tClipperLib.ClipperOffset.def_arc_tolerance = 0.25;\n\tClipperLib.ClipperOffset.prototype.Clear = function ()\n\t{\n\t\tClipperLib.Clear(this.m_polyNodes.Childs());\n\t\tthis.m_lowest.X = -1;\n\t};\n\n\tClipperLib.ClipperOffset.Round = ClipperLib.Clipper.Round;\n\tClipperLib.ClipperOffset.prototype.AddPath = function (path, joinType, endType)\n\t{\n\t\tvar highI = path.length - 1;\n\t\tif (highI < 0)\n\t\t\treturn;\n\t\tvar newNode = new ClipperLib.PolyNode();\n\t\tnewNode.m_jointype = joinType;\n\t\tnewNode.m_endtype = endType;\n\t\t//strip duplicate points from path and also get index to the lowest point ...\n\t\tif (endType === ClipperLib.EndType.etClosedLine || endType === ClipperLib.EndType.etClosedPolygon)\n\t\t\twhile (highI > 0 && ClipperLib.IntPoint.op_Equality(path[0], path[highI]))\n\t\t\t\thighI--;\n\t\t//newNode.m_polygon.set_Capacity(highI + 1);\n\t\tnewNode.m_polygon.push(path[0]);\n\t\tvar j = 0,\n\t\t\tk = 0;\n\t\tfor (var i = 1; i <= highI; i++)\n\t\t\tif (ClipperLib.IntPoint.op_Inequality(newNode.m_polygon[j], path[i]))\n\t\t\t{\n\t\t\t\tj++;\n\t\t\t\tnewNode.m_polygon.push(path[i]);\n\t\t\t\tif (path[i].Y > newNode.m_polygon[k].Y || (path[i].Y === newNode.m_polygon[k].Y && path[i].X < newNode.m_polygon[k].X))\n\t\t\t\t\tk = j;\n\t\t\t}\n\t\tif (endType === ClipperLib.EndType.etClosedPolygon && j < 2) return;\n\n\t\tthis.m_polyNodes.AddChild(newNode);\n\t\t//if this path's lowest pt is lower than all the others then update m_lowest\n\t\tif (endType !== ClipperLib.EndType.etClosedPolygon)\n\t\t\treturn;\n\t\tif (this.m_lowest.X < 0)\n\t\t\tthis.m_lowest = new ClipperLib.IntPoint2(this.m_polyNodes.ChildCount() - 1, k);\n\t\telse\n\t\t{\n\t\t\tvar ip = this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];\n\t\t\tif (newNode.m_polygon[k].Y > ip.Y || (newNode.m_polygon[k].Y === ip.Y && newNode.m_polygon[k].X < ip.X))\n\t\t\t\tthis.m_lowest = new ClipperLib.IntPoint2(this.m_polyNodes.ChildCount() - 1, k);\n\t\t}\n\t};\n\n\tClipperLib.ClipperOffset.prototype.AddPaths = function (paths, joinType, endType)\n\t{\n\t\tfor (var i = 0, ilen = paths.length; i < ilen; i++)\n\t\t\tthis.AddPath(paths[i], joinType, endType);\n\t};\n\n\tClipperLib.ClipperOffset.prototype.FixOrientations = function ()\n\t{\n\t\t//fixup orientations of all closed paths if the orientation of the\n\t\t//closed path with the lowermost vertex is wrong ...\n\t\tif (this.m_lowest.X >= 0 && !ClipperLib.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))\n\t\t{\n\t\t\tfor (var i = 0; i < this.m_polyNodes.ChildCount(); i++)\n\t\t\t{\n\t\t\t\tvar node = this.m_polyNodes.Childs()[i];\n\t\t\t\tif (node.m_endtype === ClipperLib.EndType.etClosedPolygon || (node.m_endtype === ClipperLib.EndType.etClosedLine && ClipperLib.Clipper.Orientation(node.m_polygon)))\n\t\t\t\t\tnode.m_polygon.reverse();\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (var i = 0; i < this.m_polyNodes.ChildCount(); i++)\n\t\t\t{\n\t\t\t\tvar node = this.m_polyNodes.Childs()[i];\n\t\t\t\tif (node.m_endtype === ClipperLib.EndType.etClosedLine && !ClipperLib.Clipper.Orientation(node.m_polygon))\n\t\t\t\t\tnode.m_polygon.reverse();\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.ClipperOffset.GetUnitNormal = function (pt1, pt2)\n\t{\n\t\tvar dx = (pt2.X - pt1.X);\n\t\tvar dy = (pt2.Y - pt1.Y);\n\t\tif ((dx === 0) && (dy === 0))\n\t\t\treturn new ClipperLib.DoublePoint2(0, 0);\n\t\tvar f = 1 / Math.sqrt(dx * dx + dy * dy);\n\t\tdx *= f;\n\t\tdy *= f;\n\t\treturn new ClipperLib.DoublePoint2(dy, -dx);\n\t};\n\n\tClipperLib.ClipperOffset.prototype.DoOffset = function (delta)\n\t{\n\t\tthis.m_destPolys = new Array();\n\t\tthis.m_delta = delta;\n\t\t//if Zero offset, just copy any CLOSED polygons to m_p and return ...\n\t\tif (ClipperLib.ClipperBase.near_zero(delta))\n\t\t{\n\t\t\t//this.m_destPolys.set_Capacity(this.m_polyNodes.ChildCount);\n\t\t\tfor (var i = 0; i < this.m_polyNodes.ChildCount(); i++)\n\t\t\t{\n\t\t\t\tvar node = this.m_polyNodes.Childs()[i];\n\t\t\t\tif (node.m_endtype === ClipperLib.EndType.etClosedPolygon)\n\t\t\t\t\tthis.m_destPolys.push(node.m_polygon);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t//see offset_triginometry3.svg in the documentation folder ...\n\t\tif (this.MiterLimit > 2)\n\t\t\tthis.m_miterLim = 2 / (this.MiterLimit * this.MiterLimit);\n\t\telse\n\t\t\tthis.m_miterLim = 0.5;\n\t\tvar y;\n\t\tif (this.ArcTolerance <= 0)\n\t\t\ty = ClipperLib.ClipperOffset.def_arc_tolerance;\n\t\telse if (this.ArcTolerance > Math.abs(delta) * ClipperLib.ClipperOffset.def_arc_tolerance)\n\t\t\ty = Math.abs(delta) * ClipperLib.ClipperOffset.def_arc_tolerance;\n\t\telse\n\t\t\ty = this.ArcTolerance;\n\t\t//see offset_triginometry2.svg in the documentation folder ...\n\t\tvar steps = 3.14159265358979 / Math.acos(1 - y / Math.abs(delta));\n\t\tthis.m_sin = Math.sin(ClipperLib.ClipperOffset.two_pi / steps);\n\t\tthis.m_cos = Math.cos(ClipperLib.ClipperOffset.two_pi / steps);\n\t\tthis.m_StepsPerRad = steps / ClipperLib.ClipperOffset.two_pi;\n\t\tif (delta < 0)\n\t\t\tthis.m_sin = -this.m_sin;\n\t\t//this.m_destPolys.set_Capacity(this.m_polyNodes.ChildCount * 2);\n\t\tfor (var i = 0; i < this.m_polyNodes.ChildCount(); i++)\n\t\t{\n\t\t\tvar node = this.m_polyNodes.Childs()[i];\n\t\t\tthis.m_srcPoly = node.m_polygon;\n\t\t\tvar len = this.m_srcPoly.length;\n\t\t\tif (len === 0 || (delta <= 0 && (len < 3 || node.m_endtype !== ClipperLib.EndType.etClosedPolygon)))\n\t\t\t\tcontinue;\n\t\t\tthis.m_destPoly = new Array();\n\t\t\tif (len === 1)\n\t\t\t{\n\t\t\t\tif (node.m_jointype === ClipperLib.JoinType.jtRound)\n\t\t\t\t{\n\t\t\t\t\tvar X = 1,\n\t\t\t\t\t\tY = 0;\n\t\t\t\t\tfor (var j = 1; j <= steps; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[0].X + X * delta), ClipperLib.ClipperOffset.Round(this.m_srcPoly[0].Y + Y * delta)));\n\t\t\t\t\t\tvar X2 = X;\n\t\t\t\t\t\tX = X * this.m_cos - this.m_sin * Y;\n\t\t\t\t\t\tY = X2 * this.m_sin + Y * this.m_cos;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar X = -1,\n\t\t\t\t\t\tY = -1;\n\t\t\t\t\tfor (var j = 0; j < 4; ++j)\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[0].X + X * delta), ClipperLib.ClipperOffset.Round(this.m_srcPoly[0].Y + Y * delta)));\n\t\t\t\t\t\tif (X < 0)\n\t\t\t\t\t\t\tX = 1;\n\t\t\t\t\t\telse if (Y < 0)\n\t\t\t\t\t\t\tY = 1;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tX = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.m_destPolys.push(this.m_destPoly);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//build m_normals ...\n\t\t\tthis.m_normals.length = 0;\n\t\t\t//this.m_normals.set_Capacity(len);\n\t\t\tfor (var j = 0; j < len - 1; j++)\n\t\t\t\tthis.m_normals.push(ClipperLib.ClipperOffset.GetUnitNormal(this.m_srcPoly[j], this.m_srcPoly[j + 1]));\n\t\t\tif (node.m_endtype === ClipperLib.EndType.etClosedLine || node.m_endtype === ClipperLib.EndType.etClosedPolygon)\n\t\t\t\tthis.m_normals.push(ClipperLib.ClipperOffset.GetUnitNormal(this.m_srcPoly[len - 1], this.m_srcPoly[0]));\n\t\t\telse\n\t\t\t\tthis.m_normals.push(new ClipperLib.DoublePoint1(this.m_normals[len - 2]));\n\t\t\tif (node.m_endtype === ClipperLib.EndType.etClosedPolygon)\n\t\t\t{\n\t\t\t\tvar k = len - 1;\n\t\t\t\tfor (var j = 0; j < len; j++)\n\t\t\t\t\tk = this.OffsetPoint(j, k, node.m_jointype);\n\t\t\t\tthis.m_destPolys.push(this.m_destPoly);\n\t\t\t}\n\t\t\telse if (node.m_endtype === ClipperLib.EndType.etClosedLine)\n\t\t\t{\n\t\t\t\tvar k = len - 1;\n\t\t\t\tfor (var j = 0; j < len; j++)\n\t\t\t\t\tk = this.OffsetPoint(j, k, node.m_jointype);\n\t\t\t\tthis.m_destPolys.push(this.m_destPoly);\n\t\t\t\tthis.m_destPoly = new Array();\n\t\t\t\t//re-build m_normals ...\n\t\t\t\tvar n = this.m_normals[len - 1];\n\t\t\t\tfor (var j = len - 1; j > 0; j--)\n\t\t\t\t\tthis.m_normals[j] = new ClipperLib.DoublePoint2(-this.m_normals[j - 1].X, -this.m_normals[j - 1].Y);\n\t\t\t\tthis.m_normals[0] = new ClipperLib.DoublePoint2(-n.X, -n.Y);\n\t\t\t\tk = 0;\n\t\t\t\tfor (var j = len - 1; j >= 0; j--)\n\t\t\t\t\tk = this.OffsetPoint(j, k, node.m_jointype);\n\t\t\t\tthis.m_destPolys.push(this.m_destPoly);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar k = 0;\n\t\t\t\tfor (var j = 1; j < len - 1; ++j)\n\t\t\t\t\tk = this.OffsetPoint(j, k, node.m_jointype);\n\t\t\t\tvar pt1;\n\t\t\t\tif (node.m_endtype === ClipperLib.EndType.etOpenButt)\n\t\t\t\t{\n\t\t\t\t\tvar j = len - 1;\n\t\t\t\t\tpt1 = new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + this.m_normals[j].X * delta), ClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + this.m_normals[j].Y * delta));\n\t\t\t\t\tthis.m_destPoly.push(pt1);\n\t\t\t\t\tpt1 = new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X - this.m_normals[j].X * delta), ClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y - this.m_normals[j].Y * delta));\n\t\t\t\t\tthis.m_destPoly.push(pt1);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar j = len - 1;\n\t\t\t\t\tk = len - 2;\n\t\t\t\t\tthis.m_sinA = 0;\n\t\t\t\t\tthis.m_normals[j] = new ClipperLib.DoublePoint2(-this.m_normals[j].X, -this.m_normals[j].Y);\n\t\t\t\t\tif (node.m_endtype === ClipperLib.EndType.etOpenSquare)\n\t\t\t\t\t\tthis.DoSquare(j, k);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.DoRound(j, k);\n\t\t\t\t}\n\t\t\t\t//re-build m_normals ...\n\t\t\t\tfor (var j = len - 1; j > 0; j--)\n\t\t\t\t\tthis.m_normals[j] = new ClipperLib.DoublePoint2(-this.m_normals[j - 1].X, -this.m_normals[j - 1].Y);\n\t\t\t\tthis.m_normals[0] = new ClipperLib.DoublePoint2(-this.m_normals[1].X, -this.m_normals[1].Y);\n\t\t\t\tk = len - 1;\n\t\t\t\tfor (var j = k - 1; j > 0; --j)\n\t\t\t\t\tk = this.OffsetPoint(j, k, node.m_jointype);\n\t\t\t\tif (node.m_endtype === ClipperLib.EndType.etOpenButt)\n\t\t\t\t{\n\t\t\t\t\tpt1 = new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[0].X - this.m_normals[0].X * delta), ClipperLib.ClipperOffset.Round(this.m_srcPoly[0].Y - this.m_normals[0].Y * delta));\n\t\t\t\t\tthis.m_destPoly.push(pt1);\n\t\t\t\t\tpt1 = new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[0].X + this.m_normals[0].X * delta), ClipperLib.ClipperOffset.Round(this.m_srcPoly[0].Y + this.m_normals[0].Y * delta));\n\t\t\t\t\tthis.m_destPoly.push(pt1);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tk = 1;\n\t\t\t\t\tthis.m_sinA = 0;\n\t\t\t\t\tif (node.m_endtype === ClipperLib.EndType.etOpenSquare)\n\t\t\t\t\t\tthis.DoSquare(0, 1);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.DoRound(0, 1);\n\t\t\t\t}\n\t\t\t\tthis.m_destPolys.push(this.m_destPoly);\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.ClipperOffset.prototype.Execute = function ()\n\t{\n\t\tvar a = arguments,\n\t\t\tispolytree = a[0] instanceof ClipperLib.PolyTree;\n\t\tif (!ispolytree) // function (solution, delta)\n\t\t{\n\t\t\tvar solution = a[0],\n\t\t\t\tdelta = a[1];\n\t\t\tClipperLib.Clear(solution);\n\t\t\tthis.FixOrientations();\n\t\t\tthis.DoOffset(delta);\n\t\t\t//now clean up 'corners' ...\n\t\t\tvar clpr = new ClipperLib.Clipper(0);\n\t\t\tclpr.AddPaths(this.m_destPolys, ClipperLib.PolyType.ptSubject, true);\n\t\t\tif (delta > 0)\n\t\t\t{\n\t\t\t\tclpr.Execute(ClipperLib.ClipType.ctUnion, solution, ClipperLib.PolyFillType.pftPositive, ClipperLib.PolyFillType.pftPositive);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar r = ClipperLib.Clipper.GetBounds(this.m_destPolys);\n\t\t\t\tvar outer = new ClipperLib.Path();\n\t\t\t\touter.push(new ClipperLib.IntPoint2(r.left - 10, r.bottom + 10));\n\t\t\t\touter.push(new ClipperLib.IntPoint2(r.right + 10, r.bottom + 10));\n\t\t\t\touter.push(new ClipperLib.IntPoint2(r.right + 10, r.top - 10));\n\t\t\t\touter.push(new ClipperLib.IntPoint2(r.left - 10, r.top - 10));\n\t\t\t\tclpr.AddPath(outer, ClipperLib.PolyType.ptSubject, true);\n\t\t\t\tclpr.ReverseSolution = true;\n\t\t\t\tclpr.Execute(ClipperLib.ClipType.ctUnion, solution, ClipperLib.PolyFillType.pftNegative, ClipperLib.PolyFillType.pftNegative);\n\t\t\t\tif (solution.length > 0)\n\t\t\t\t\tsolution.splice(0, 1);\n\t\t\t}\n\t\t\t//console.log(JSON.stringify(solution));\n\t\t}\n\t\telse // function (polytree, delta)\n\t\t{\n\t\t\tvar solution = a[0],\n\t\t\t\tdelta = a[1];\n\t\t\tsolution.Clear();\n\t\t\tthis.FixOrientations();\n\t\t\tthis.DoOffset(delta);\n\t\t\t//now clean up 'corners' ...\n\t\t\tvar clpr = new ClipperLib.Clipper(0);\n\t\t\tclpr.AddPaths(this.m_destPolys, ClipperLib.PolyType.ptSubject, true);\n\t\t\tif (delta > 0)\n\t\t\t{\n\t\t\t\tclpr.Execute(ClipperLib.ClipType.ctUnion, solution, ClipperLib.PolyFillType.pftPositive, ClipperLib.PolyFillType.pftPositive);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar r = ClipperLib.Clipper.GetBounds(this.m_destPolys);\n\t\t\t\tvar outer = new ClipperLib.Path();\n\t\t\t\touter.push(new ClipperLib.IntPoint2(r.left - 10, r.bottom + 10));\n\t\t\t\touter.push(new ClipperLib.IntPoint2(r.right + 10, r.bottom + 10));\n\t\t\t\touter.push(new ClipperLib.IntPoint2(r.right + 10, r.top - 10));\n\t\t\t\touter.push(new ClipperLib.IntPoint2(r.left - 10, r.top - 10));\n\t\t\t\tclpr.AddPath(outer, ClipperLib.PolyType.ptSubject, true);\n\t\t\t\tclpr.ReverseSolution = true;\n\t\t\t\tclpr.Execute(ClipperLib.ClipType.ctUnion, solution, ClipperLib.PolyFillType.pftNegative, ClipperLib.PolyFillType.pftNegative);\n\t\t\t\t//remove the outer PolyNode rectangle ...\n\t\t\t\tif (solution.ChildCount() === 1 && solution.Childs()[0].ChildCount() > 0)\n\t\t\t\t{\n\t\t\t\t\tvar outerNode = solution.Childs()[0];\n\t\t\t\t\t//solution.Childs.set_Capacity(outerNode.ChildCount);\n\t\t\t\t\tsolution.Childs()[0] = outerNode.Childs()[0];\n\t\t\t\t\tsolution.Childs()[0].m_Parent = solution;\n\t\t\t\t\tfor (var i = 1; i < outerNode.ChildCount(); i++)\n\t\t\t\t\t\tsolution.AddChild(outerNode.Childs()[i]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsolution.Clear();\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.ClipperOffset.prototype.OffsetPoint = function (j, k, jointype)\n\t{\n\t\t//cross product ...\n\t\tthis.m_sinA = (this.m_normals[k].X * this.m_normals[j].Y - this.m_normals[j].X * this.m_normals[k].Y);\n\n\t\tif (Math.abs(this.m_sinA * this.m_delta) < 1.0)\n\t\t{\n\t\t\t//dot product ...\n\t\t\tvar cosA = (this.m_normals[k].X * this.m_normals[j].X + this.m_normals[j].Y * this.m_normals[k].Y);\n\t\t\tif (cosA > 0) // angle ==> 0 degrees\n\t\t\t{\n\t\t\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + this.m_normals[k].X * this.m_delta),\n\t\t\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + this.m_normals[k].Y * this.m_delta)));\n\t\t\t\treturn k;\n\t\t\t}\n\t\t\t//else angle ==> 180 degrees\n\t\t}\n\t\telse if (this.m_sinA > 1)\n\t\t\tthis.m_sinA = 1.0;\n\t\telse if (this.m_sinA < -1)\n\t\t\tthis.m_sinA = -1.0;\n\t\tif (this.m_sinA * this.m_delta < 0)\n\t\t{\n\t\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + this.m_normals[k].X * this.m_delta),\n\t\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + this.m_normals[k].Y * this.m_delta)));\n\t\t\tthis.m_destPoly.push(new ClipperLib.IntPoint1(this.m_srcPoly[j]));\n\t\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(ClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + this.m_normals[j].X * this.m_delta),\n\t\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + this.m_normals[j].Y * this.m_delta)));\n\t\t}\n\t\telse\n\t\t\tswitch (jointype)\n\t\t\t{\n\t\t\tcase ClipperLib.JoinType.jtMiter:\n\t\t\t\t{\n\t\t\t\t\tvar r = 1 + (this.m_normals[j].X * this.m_normals[k].X + this.m_normals[j].Y * this.m_normals[k].Y);\n\t\t\t\t\tif (r >= this.m_miterLim)\n\t\t\t\t\t\tthis.DoMiter(j, k, r);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.DoSquare(j, k);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tcase ClipperLib.JoinType.jtSquare:\n\t\t\t\tthis.DoSquare(j, k);\n\t\t\t\tbreak;\n\t\t\tcase ClipperLib.JoinType.jtRound:\n\t\t\t\tthis.DoRound(j, k);\n\t\t\t\tbreak;\n\t\t\t}\n\t\tk = j;\n\t\treturn k;\n\t};\n\n\tClipperLib.ClipperOffset.prototype.DoSquare = function (j, k)\n\t{\n\t\tvar dx = Math.tan(Math.atan2(this.m_sinA,\n\t\t\tthis.m_normals[k].X * this.m_normals[j].X + this.m_normals[k].Y * this.m_normals[j].Y) / 4);\n\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(\n\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + this.m_delta * (this.m_normals[k].X - this.m_normals[k].Y * dx)),\n\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + this.m_delta * (this.m_normals[k].Y + this.m_normals[k].X * dx))));\n\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(\n\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + this.m_delta * (this.m_normals[j].X + this.m_normals[j].Y * dx)),\n\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + this.m_delta * (this.m_normals[j].Y - this.m_normals[j].X * dx))));\n\t};\n\n\tClipperLib.ClipperOffset.prototype.DoMiter = function (j, k, r)\n\t{\n\t\tvar q = this.m_delta / r;\n\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(\n\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + (this.m_normals[k].X + this.m_normals[j].X) * q),\n\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + (this.m_normals[k].Y + this.m_normals[j].Y) * q)));\n\t};\n\n\tClipperLib.ClipperOffset.prototype.DoRound = function (j, k)\n\t{\n\t\tvar a = Math.atan2(this.m_sinA,\n\t\t\tthis.m_normals[k].X * this.m_normals[j].X + this.m_normals[k].Y * this.m_normals[j].Y);\n\n\t\tvar steps = Math.max(ClipperLib.Cast_Int32(ClipperLib.ClipperOffset.Round(this.m_StepsPerRad * Math.abs(a))), 1);\n\n\t\tvar X = this.m_normals[k].X,\n\t\t\tY = this.m_normals[k].Y,\n\t\t\tX2;\n\t\tfor (var i = 0; i < steps; ++i)\n\t\t{\n\t\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(\n\t\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + X * this.m_delta),\n\t\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + Y * this.m_delta)));\n\t\t\tX2 = X;\n\t\t\tX = X * this.m_cos - this.m_sin * Y;\n\t\t\tY = X2 * this.m_sin + Y * this.m_cos;\n\t\t}\n\t\tthis.m_destPoly.push(new ClipperLib.IntPoint2(\n\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].X + this.m_normals[j].X * this.m_delta),\n\t\t\tClipperLib.ClipperOffset.Round(this.m_srcPoly[j].Y + this.m_normals[j].Y * this.m_delta)));\n\t};\n\n\tClipperLib.Error = function (message)\n\t{\n\t\ttry\n\t\t{\n\t\t\tthrow new Error(message);\n\t\t}\n\t\tcatch (err)\n\t\t{\n\t\t\talert(err.message);\n\t\t}\n\t};\n\n\t// ---------------------------------------------\n\n\t// JS extension by Timo 2013\n\tClipperLib.JS = {};\n\n\tClipperLib.JS.AreaOfPolygon = function (poly, scale)\n\t{\n\t\tif (!scale) scale = 1;\n\t\treturn ClipperLib.Clipper.Area(poly) / (scale * scale);\n\t};\n\n\tClipperLib.JS.AreaOfPolygons = function (poly, scale)\n\t{\n\t\tif (!scale) scale = 1;\n\t\tvar area = 0;\n\t\tfor (var i = 0; i < poly.length; i++)\n\t\t{\n\t\t\tarea += ClipperLib.Clipper.Area(poly[i]);\n\t\t}\n\t\treturn area / (scale * scale);\n\t};\n\n\tClipperLib.JS.BoundsOfPath = function (path, scale)\n\t{\n\t\treturn ClipperLib.JS.BoundsOfPaths([path], scale);\n\t};\n\n\tClipperLib.JS.BoundsOfPaths = function (paths, scale)\n\t{\n\t\tif (!scale) scale = 1;\n\t\tvar bounds = ClipperLib.Clipper.GetBounds(paths);\n\t\tbounds.left /= scale;\n\t\tbounds.bottom /= scale;\n\t\tbounds.right /= scale;\n\t\tbounds.top /= scale;\n\t\treturn bounds;\n\t};\n\n\t// Clean() joins vertices that are too near each other\n\t// and causes distortion to offsetted polygons without cleaning\n\tClipperLib.JS.Clean = function (polygon, delta)\n\t{\n\t\tif (!(polygon instanceof Array)) return [];\n\t\tvar isPolygons = polygon[0] instanceof Array;\n\t\tvar polygon = ClipperLib.JS.Clone(polygon);\n\t\tif (typeof delta !== \"number\" || delta === null)\n\t\t{\n\t\t\tClipperLib.Error(\"Delta is not a number in Clean().\");\n\t\t\treturn polygon;\n\t\t}\n\t\tif (polygon.length === 0 || (polygon.length === 1 && polygon[0].length === 0) || delta < 0) return polygon;\n\t\tif (!isPolygons) polygon = [polygon];\n\t\tvar k_length = polygon.length;\n\t\tvar len, poly, result, d, p, j, i;\n\t\tvar results = [];\n\t\tfor (var k = 0; k < k_length; k++)\n\t\t{\n\t\t\tpoly = polygon[k];\n\t\t\tlen = poly.length;\n\t\t\tif (len === 0) continue;\n\t\t\telse if (len < 3)\n\t\t\t{\n\t\t\t\tresult = poly;\n\t\t\t\tresults.push(result);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tresult = poly;\n\t\t\td = delta * delta;\n\t\t\t//d = Math.floor(c_delta * c_delta);\n\t\t\tp = poly[0];\n\t\t\tj = 1;\n\t\t\tfor (i = 1; i < len; i++)\n\t\t\t{\n\t\t\t\tif ((poly[i].X - p.X) * (poly[i].X - p.X) +\n\t\t\t\t\t(poly[i].Y - p.Y) * (poly[i].Y - p.Y) <= d)\n\t\t\t\t\tcontinue;\n\t\t\t\tresult[j] = poly[i];\n\t\t\t\tp = poly[i];\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tp = poly[j - 1];\n\t\t\tif ((poly[0].X - p.X) * (poly[0].X - p.X) +\n\t\t\t\t(poly[0].Y - p.Y) * (poly[0].Y - p.Y) <= d)\n\t\t\t\tj--;\n\t\t\tif (j < len)\n\t\t\t\tresult.splice(j, len - j);\n\t\t\tif (result.length) results.push(result);\n\t\t}\n\t\tif (!isPolygons && results.length) results = results[0];\n\t\telse if (!isPolygons && results.length === 0) results = [];\n\t\telse if (isPolygons && results.length === 0) results = [\n\t\t\t[]\n\t\t];\n\t\treturn results;\n\t}\n\t// Make deep copy of Polygons or Polygon\n\t// so that also IntPoint objects are cloned and not only referenced\n\t// This should be the fastest way\n\tClipperLib.JS.Clone = function (polygon)\n\t{\n\t\tif (!(polygon instanceof Array)) return [];\n\t\tif (polygon.length === 0) return [];\n\t\telse if (polygon.length === 1 && polygon[0].length === 0) return [\n\t\t\t[]\n\t\t];\n\t\tvar isPolygons = polygon[0] instanceof Array;\n\t\tif (!isPolygons) polygon = [polygon];\n\t\tvar len = polygon.length,\n\t\t\tplen, i, j, result;\n\t\tvar results = new Array(len);\n\t\tfor (i = 0; i < len; i++)\n\t\t{\n\t\t\tplen = polygon[i].length;\n\t\t\tresult = new Array(plen);\n\t\t\tfor (j = 0; j < plen; j++)\n\t\t\t{\n\t\t\t\tresult[j] = {\n\t\t\t\t\tX: polygon[i][j].X,\n\t\t\t\t\tY: polygon[i][j].Y\n\t\t\t\t};\n\n\t\t\t}\n\t\t\tresults[i] = result;\n\t\t}\n\t\tif (!isPolygons) results = results[0];\n\t\treturn results;\n\t};\n\n\t// Removes points that doesn't affect much to the visual appearance.\n\t// If middle point is at or under certain distance (tolerance) of the line segment between\n\t// start and end point, the middle point is removed.\n\tClipperLib.JS.Lighten = function (polygon, tolerance)\n\t{\n\t\tif (!(polygon instanceof Array)) return [];\n\t\tif (typeof tolerance !== \"number\" || tolerance === null)\n\t\t{\n\t\t\tClipperLib.Error(\"Tolerance is not a number in Lighten().\")\n\t\t\treturn ClipperLib.JS.Clone(polygon);\n\t\t}\n\t\tif (polygon.length === 0 || (polygon.length === 1 && polygon[0].length === 0) || tolerance < 0)\n\t\t{\n\t\t\treturn ClipperLib.JS.Clone(polygon);\n\t\t}\n\t\tvar isPolygons = polygon[0] instanceof Array;\n\t\tif (!isPolygons) polygon = [polygon];\n\t\tvar i, j, poly, k, poly2, plen, A, B, P, d, rem, addlast;\n\t\tvar bxax, byay, l, ax, ay;\n\t\tvar len = polygon.length;\n\t\tvar toleranceSq = tolerance * tolerance;\n\t\tvar results = [];\n\t\tfor (i = 0; i < len; i++)\n\t\t{\n\t\t\tpoly = polygon[i];\n\t\t\tplen = poly.length;\n\t\t\tif (plen === 0) continue;\n\t\t\tfor (k = 0; k < 1000000; k++) // could be forever loop, but wiser to restrict max repeat count\n\t\t\t{\n\t\t\t\tpoly2 = [];\n\t\t\t\tplen = poly.length;\n\t\t\t\t// the first have to added to the end, if first and last are not the same\n\t\t\t\t// this way we ensure that also the actual last point can be removed if needed\n\t\t\t\tif (poly[plen - 1].X !== poly[0].X || poly[plen - 1].Y !== poly[0].Y)\n\t\t\t\t{\n\t\t\t\t\taddlast = 1;\n\t\t\t\t\tpoly.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tX: poly[0].X,\n\t\t\t\t\t\tY: poly[0].Y\n\t\t\t\t\t});\n\t\t\t\t\tplen = poly.length;\n\t\t\t\t}\n\t\t\t\telse addlast = 0;\n\t\t\t\trem = []; // Indexes of removed points\n\t\t\t\tfor (j = 0; j < plen - 2; j++)\n\t\t\t\t{\n\t\t\t\t\tA = poly[j]; // Start point of line segment\n\t\t\t\t\tP = poly[j + 1]; // Middle point. This is the one to be removed.\n\t\t\t\t\tB = poly[j + 2]; // End point of line segment\n\t\t\t\t\tax = A.X;\n\t\t\t\t\tay = A.Y;\n\t\t\t\t\tbxax = B.X - ax;\n\t\t\t\t\tbyay = B.Y - ay;\n\t\t\t\t\tif (bxax !== 0 || byay !== 0) // To avoid Nan, when A==P && P==B. And to avoid peaks (A==B && A!=P), which have lenght, but not area.\n\t\t\t\t\t{\n\t\t\t\t\t\tl = ((P.X - ax) * bxax + (P.Y - ay) * byay) / (bxax * bxax + byay * byay);\n\t\t\t\t\t\tif (l > 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tax = B.X;\n\t\t\t\t\t\t\tay = B.Y;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (l > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tax += bxax * l;\n\t\t\t\t\t\t\tay += byay * l;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbxax = P.X - ax;\n\t\t\t\t\tbyay = P.Y - ay;\n\t\t\t\t\td = bxax * bxax + byay * byay;\n\t\t\t\t\tif (d <= toleranceSq)\n\t\t\t\t\t{\n\t\t\t\t\t\trem[j + 1] = 1;\n\t\t\t\t\t\tj++; // when removed, transfer the pointer to the next one\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// add all unremoved points to poly2\n\t\t\t\tpoly2.push(\n\t\t\t\t{\n\t\t\t\t\tX: poly[0].X,\n\t\t\t\t\tY: poly[0].Y\n\t\t\t\t});\n\t\t\t\tfor (j = 1; j < plen - 1; j++)\n\t\t\t\t\tif (!rem[j]) poly2.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tX: poly[j].X,\n\t\t\t\t\t\tY: poly[j].Y\n\t\t\t\t\t});\n\t\t\t\tpoly2.push(\n\t\t\t\t{\n\t\t\t\t\tX: poly[plen - 1].X,\n\t\t\t\t\tY: poly[plen - 1].Y\n\t\t\t\t});\n\t\t\t\t// if the first point was added to the end, remove it\n\t\t\t\tif (addlast) poly.pop();\n\t\t\t\t// break, if there was not anymore removed points\n\t\t\t\tif (!rem.length) break;\n\t\t\t\t// else continue looping using poly2, to check if there are points to remove\n\t\t\t\telse poly = poly2;\n\t\t\t}\n\t\t\tplen = poly2.length;\n\t\t\t// remove duplicate from end, if needed\n\t\t\tif (poly2[plen - 1].X === poly2[0].X && poly2[plen - 1].Y === poly2[0].Y)\n\t\t\t{\n\t\t\t\tpoly2.pop();\n\t\t\t}\n\t\t\tif (poly2.length > 2) // to avoid two-point-polygons\n\t\t\t\tresults.push(poly2);\n\t\t}\n\t\tif (!isPolygons)\n\t\t{\n\t\t\tresults = results[0];\n\t\t}\n\t\tif (typeof (results) === \"undefined\")\n\t\t{\n\t\t\tresults = [];\n\t\t}\n\t\treturn results;\n\t}\n\n\tClipperLib.JS.PerimeterOfPath = function (path, closed, scale)\n\t{\n\t\tif (typeof (path) === \"undefined\") return 0;\n\t\tvar sqrt = Math.sqrt;\n\t\tvar perimeter = 0.0;\n\t\tvar p1, p2, p1x = 0.0,\n\t\t\tp1y = 0.0,\n\t\t\tp2x = 0.0,\n\t\t\tp2y = 0.0;\n\t\tvar j = path.length;\n\t\tif (j < 2) return 0;\n\t\tif (closed)\n\t\t{\n\t\t\tpath[j] = path[0];\n\t\t\tj++;\n\t\t}\n\t\twhile (--j)\n\t\t{\n\t\t\tp1 = path[j];\n\t\t\tp1x = p1.X;\n\t\t\tp1y = p1.Y;\n\t\t\tp2 = path[j - 1];\n\t\t\tp2x = p2.X;\n\t\t\tp2y = p2.Y;\n\t\t\tperimeter += sqrt((p1x - p2x) * (p1x - p2x) + (p1y - p2y) * (p1y - p2y));\n\t\t}\n\t\tif (closed) path.pop();\n\t\treturn perimeter / scale;\n\t};\n\n\tClipperLib.JS.PerimeterOfPaths = function (paths, closed, scale)\n\t{\n\t\tif (!scale) scale = 1;\n\t\tvar perimeter = 0;\n\t\tfor (var i = 0; i < paths.length; i++)\n\t\t{\n\t\t\tperimeter += ClipperLib.JS.PerimeterOfPath(paths[i], closed, scale);\n\t\t}\n\t\treturn perimeter;\n\t};\n\n\tClipperLib.JS.ScaleDownPath = function (path, scale)\n\t{\n\t\tvar i, p;\n\t\tif (!scale) scale = 1;\n\t\ti = path.length;\n\t\twhile (i--)\n\t\t{\n\t\t\tp = path[i];\n\t\t\tp.X = p.X / scale;\n\t\t\tp.Y = p.Y / scale;\n\t\t}\n\t};\n\n\tClipperLib.JS.ScaleDownPaths = function (paths, scale)\n\t{\n\t\tvar i, j, p;\n\t\tif (!scale) scale = 1;\n\t\ti = paths.length;\n\t\twhile (i--)\n\t\t{\n\t\t\tj = paths[i].length;\n\t\t\twhile (j--)\n\t\t\t{\n\t\t\t\tp = paths[i][j];\n\t\t\t\tp.X = p.X / scale;\n\t\t\t\tp.Y = p.Y / scale;\n\t\t\t}\n\t\t}\n\t};\n\n\tClipperLib.JS.ScaleUpPath = function (path, scale)\n\t{\n\t\tvar i, p, round = Math.round;\n\t\tif (!scale) scale = 1;\n\t\ti = path.length;\n\t\twhile (i--)\n\t\t{\n\t\t\tp = path[i];\n\t\t\tp.X = round(p.X * scale);\n\t\t\tp.Y = round(p.Y * scale);\n\t\t}\n\t};\n\n\tClipperLib.JS.ScaleUpPaths = function (paths, scale)\n\t{\n\t\tvar i, j, p, round = Math.round;\n\t\tif (!scale) scale = 1;\n\t\ti = paths.length;\n\t\twhile (i--)\n\t\t{\n\t\t\tj = paths[i].length;\n\t\t\twhile (j--)\n\t\t\t{\n\t\t\t\tp = paths[i][j];\n\t\t\t\tp.X = round(p.X * scale);\n\t\t\t\tp.Y = round(p.Y * scale);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.ExPolygons = function ()\n\t{\n\t\treturn [];\n\t}\n\t/**\n\t* @constructor\n\t*/\n\tClipperLib.ExPolygon = function ()\n\t{\n\t\tthis.outer = null;\n\t\tthis.holes = null;\n\t};\n\n\tClipperLib.JS.AddOuterPolyNodeToExPolygons = function (polynode, expolygons)\n\t{\n\t\tvar ep = new ClipperLib.ExPolygon();\n\t\tep.outer = polynode.Contour();\n\t\tvar childs = polynode.Childs();\n\t\tvar ilen = childs.length;\n\t\tep.holes = new Array(ilen);\n\t\tvar node, n, i, j, childs2, jlen;\n\t\tfor (i = 0; i < ilen; i++)\n\t\t{\n\t\t\tnode = childs[i];\n\t\t\tep.holes[i] = node.Contour();\n\t\t\t//Add outer polygons contained by (nested within) holes ...\n\t\t\tfor (j = 0, childs2 = node.Childs(), jlen = childs2.length; j < jlen; j++)\n\t\t\t{\n\t\t\t\tn = childs2[j];\n\t\t\t\tClipperLib.JS.AddOuterPolyNodeToExPolygons(n, expolygons);\n\t\t\t}\n\t\t}\n\t\texpolygons.push(ep);\n\t};\n\n\tClipperLib.JS.ExPolygonsToPaths = function (expolygons)\n\t{\n\t\tvar a, i, alen, ilen;\n\t\tvar paths = new ClipperLib.Paths();\n\t\tfor (a = 0, alen = expolygons.length; a < alen; a++)\n\t\t{\n\t\t\tpaths.push(expolygons[a].outer);\n\t\t\tfor (i = 0, ilen = expolygons[a].holes.length; i < ilen; i++)\n\t\t\t{\n\t\t\t\tpaths.push(expolygons[a].holes[i]);\n\t\t\t}\n\t\t}\n\t\treturn paths;\n\t}\n\tClipperLib.JS.PolyTreeToExPolygons = function (polytree)\n\t{\n\t\tvar expolygons = new ClipperLib.ExPolygons();\n\t\tvar node, i, childs, ilen;\n\t\tfor (i = 0, childs = polytree.Childs(), ilen = childs.length; i < ilen; i++)\n\t\t{\n\t\t\tnode = childs[i];\n\t\t\tClipperLib.JS.AddOuterPolyNodeToExPolygons(node, expolygons);\n\t\t}\n\t\treturn expolygons;\n\t};\n\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/clipper-lib/clipper.js\n// module id = 7\n// module chunks = 0","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n *\n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n *\n * All rights reserved.\n *\n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n\"use strict\";\n\n/*\n * Function added in the JavaScript version (was not present in the c++ version)\n */\n\n/**\n * assert and throw an exception.\n *\n * @private\n * @param {boolean} condition the condition which is asserted\n * @param {string} message the message which is display is condition is falsy\n */\nfunction assert(condition, message) {\n if (!condition) {\n throw new Error(message || \"Assert Failed\");\n }\n}\nmodule.exports = assert;\n\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/assert.js\n// module id = 8\n// module chunks = 0","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n * \n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n * \n * All rights reserved.\n * \n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n\"use strict\";\n\n\n/*\n * Note\n * ====\n * the structure of this JavaScript version of poly2tri intentionally follows\n * as closely as possible the structure of the reference C++ version, to make it \n * easier to keep the 2 versions in sync.\n */\n\nvar xy = require('./xy');\n\n// ------------------------------------------------------------------------Point\n/**\n * Construct a point\n * @example\n * var point = new poly2tri.Point(150, 150);\n * @public\n * @constructor\n * @struct\n * @param {number=} x coordinate (0 if undefined)\n * @param {number=} y coordinate (0 if undefined)\n */\nvar Point = function(x, y) {\n /**\n * @type {number}\n * @expose\n */\n this.x = +x || 0;\n /**\n * @type {number}\n * @expose\n */\n this.y = +y || 0;\n\n // All extra fields added to Point are prefixed with _p2t_\n // to avoid collisions if custom Point class is used.\n\n /**\n * The edges this point constitutes an upper ending point\n * @private\n * @type {Array.<Edge>}\n */\n this._p2t_edge_list = null;\n};\n\n/**\n * For pretty printing\n * @example\n * \"p=\" + new poly2tri.Point(5,42)\n * // → \"p=(5;42)\"\n * @returns {string} <code>\"(x;y)\"</code>\n */\nPoint.prototype.toString = function() {\n return xy.toStringBase(this);\n};\n\n/**\n * JSON output, only coordinates\n * @example\n * JSON.stringify(new poly2tri.Point(1,2))\n * // → '{\"x\":1,\"y\":2}'\n */\nPoint.prototype.toJSON = function() {\n return { x: this.x, y: this.y };\n};\n\n/**\n * Creates a copy of this Point object.\n * @return {Point} new cloned point\n */\nPoint.prototype.clone = function() {\n return new Point(this.x, this.y);\n};\n\n/**\n * Set this Point instance to the origo. <code>(0; 0)</code>\n * @return {Point} this (for chaining)\n */\nPoint.prototype.set_zero = function() {\n this.x = 0.0;\n this.y = 0.0;\n return this; // for chaining\n};\n\n/**\n * Set the coordinates of this instance.\n * @param {number} x coordinate\n * @param {number} y coordinate\n * @return {Point} this (for chaining)\n */\nPoint.prototype.set = function(x, y) {\n this.x = +x || 0;\n this.y = +y || 0;\n return this; // for chaining\n};\n\n/**\n * Negate this Point instance. (component-wise)\n * @return {Point} this (for chaining)\n */\nPoint.prototype.negate = function() {\n this.x = -this.x;\n this.y = -this.y;\n return this; // for chaining\n};\n\n/**\n * Add another Point object to this instance. (component-wise)\n * @param {!Point} n - Point object.\n * @return {Point} this (for chaining)\n */\nPoint.prototype.add = function(n) {\n this.x += n.x;\n this.y += n.y;\n return this; // for chaining\n};\n\n/**\n * Subtract this Point instance with another point given. (component-wise)\n * @param {!Point} n - Point object.\n * @return {Point} this (for chaining)\n */\nPoint.prototype.sub = function(n) {\n this.x -= n.x;\n this.y -= n.y;\n return this; // for chaining\n};\n\n/**\n * Multiply this Point instance by a scalar. (component-wise)\n * @param {number} s scalar.\n * @return {Point} this (for chaining)\n */\nPoint.prototype.mul = function(s) {\n this.x *= s;\n this.y *= s;\n return this; // for chaining\n};\n\n/**\n * Return the distance of this Point instance from the origo.\n * @return {number} distance\n */\nPoint.prototype.length = function() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n};\n\n/**\n * Normalize this Point instance (as a vector).\n * @return {number} The original distance of this instance from the origo.\n */\nPoint.prototype.normalize = function() {\n var len = this.length();\n this.x /= len;\n this.y /= len;\n return len;\n};\n\n/**\n * Test this Point object with another for equality.\n * @param {!XY} p - any \"Point like\" object with {x,y}\n * @return {boolean} <code>true</code> if same x and y coordinates, <code>false</code> otherwise.\n */\nPoint.prototype.equals = function(p) {\n return this.x === p.x && this.y === p.y;\n};\n\n\n// -----------------------------------------------------Point (\"static\" methods)\n\n/**\n * Negate a point component-wise and return the result as a new Point object.\n * @param {!XY} p - any \"Point like\" object with {x,y}\n * @return {Point} the resulting Point object.\n */\nPoint.negate = function(p) {\n return new Point(-p.x, -p.y);\n};\n\n/**\n * Add two points component-wise and return the result as a new Point object.\n * @param {!XY} a - any \"Point like\" object with {x,y}\n * @param {!XY} b - any \"Point like\" object with {x,y}\n * @return {Point} the resulting Point object.\n */\nPoint.add = function(a, b) {\n return new Point(a.x + b.x, a.y + b.y);\n};\n\n/**\n * Subtract two points component-wise and return the result as a new Point object.\n * @param {!XY} a - any \"Point like\" object with {x,y}\n * @param {!XY} b - any \"Point like\" object with {x,y}\n * @return {Point} the resulting Point object.\n */\nPoint.sub = function(a, b) {\n return new Point(a.x - b.x, a.y - b.y);\n};\n\n/**\n * Multiply a point by a scalar and return the result as a new Point object.\n * @param {number} s - the scalar\n * @param {!XY} p - any \"Point like\" object with {x,y}\n * @return {Point} the resulting Point object.\n */\nPoint.mul = function(s, p) {\n return new Point(s * p.x, s * p.y);\n};\n\n/**\n * Perform the cross product on either two points (this produces a scalar)\n * or a point and a scalar (this produces a point).\n * This function requires two parameters, either may be a Point object or a\n * number.\n * @param {XY|number} a - Point object or scalar.\n * @param {XY|number} b - Point object or scalar.\n * @return {Point|number} a Point object or a number, depending on the parameters.\n */\nPoint.cross = function(a, b) {\n if (typeof(a) === 'number') {\n if (typeof(b) === 'number') {\n return a * b;\n } else {\n return new Point(-a * b.y, a * b.x);\n }\n } else {\n if (typeof(b) === 'number') {\n return new Point(b * a.y, -b * a.x);\n } else {\n return a.x * b.y - a.y * b.x;\n }\n }\n};\n\n\n// -----------------------------------------------------------------\"Point-Like\"\n/*\n * The following functions operate on \"Point\" or any \"Point like\" object \n * with {x,y} (duck typing).\n */\n\nPoint.toString = xy.toString;\nPoint.compare = xy.compare;\nPoint.cmp = xy.compare; // backward compatibility\nPoint.equals = xy.equals;\n\n/**\n * Peform the dot product on two vectors.\n * @public\n * @param {!XY} a - any \"Point like\" object with {x,y}\n * @param {!XY} b - any \"Point like\" object with {x,y}\n * @return {number} The dot product\n */\nPoint.dot = function(a, b) {\n return a.x * b.x + a.y * b.y;\n};\n\n\n// ---------------------------------------------------------Exports (public API)\n\nmodule.exports = Point;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/point.js\n// module id = 9\n// module chunks = 0","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n * \n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n * \n * All rights reserved.\n * \n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n/* jshint latedef:nofunc, maxcomplexity:9 */\n\n\"use strict\";\n\n/**\n * This 'Sweep' module is present in order to keep this JavaScript version\n * as close as possible to the reference C++ version, even though almost all\n * functions could be declared as methods on the {@linkcode module:sweepcontext~SweepContext} object.\n * @module\n * @private\n */\n\n/*\n * Note\n * ====\n * the structure of this JavaScript version of poly2tri intentionally follows\n * as closely as possible the structure of the reference C++ version, to make it \n * easier to keep the 2 versions in sync.\n */\n\nvar assert = require('./assert');\nvar PointError = require('./pointerror');\nvar Triangle = require('./triangle');\nvar Node = require('./advancingfront').Node;\n\n\n// ------------------------------------------------------------------------utils\n\nvar utils = require('./utils');\n\n/** @const */\nvar EPSILON = utils.EPSILON;\n\n/** @const */\nvar Orientation = utils.Orientation;\n/** @const */\nvar orient2d = utils.orient2d;\n/** @const */\nvar inScanArea = utils.inScanArea;\n/** @const */\nvar isAngleObtuse = utils.isAngleObtuse;\n\n\n// ------------------------------------------------------------------------Sweep\n\n/**\n * Triangulate the polygon with holes and Steiner points.\n * Do this AFTER you've added the polyline, holes, and Steiner points\n * @private\n * @param {!SweepContext} tcx - SweepContext object\n */\nfunction triangulate(tcx) {\n tcx.initTriangulation();\n tcx.createAdvancingFront();\n // Sweep points; build mesh\n sweepPoints(tcx);\n // Clean up\n finalizationPolygon(tcx);\n}\n\n/**\n * Start sweeping the Y-sorted point set from bottom to top\n * @param {!SweepContext} tcx - SweepContext object\n */\nfunction sweepPoints(tcx) {\n var i, len = tcx.pointCount();\n for (i = 1; i < len; ++i) {\n var point = tcx.getPoint(i);\n var node = pointEvent(tcx, point);\n var edges = point._p2t_edge_list;\n for (var j = 0; edges && j < edges.length; ++j) {\n edgeEventByEdge(tcx, edges[j], node);\n }\n }\n}\n\n/**\n * @param {!SweepContext} tcx - SweepContext object\n */\nfunction finalizationPolygon(tcx) {\n // Get an Internal triangle to start with\n var t = tcx.front().head().next.triangle;\n var p = tcx.front().head().next.point;\n while (!t.getConstrainedEdgeCW(p)) {\n t = t.neighborCCW(p);\n }\n\n // Collect interior triangles constrained by edges\n tcx.meshClean(t);\n}\n\n/**\n * Find closes node to the left of the new point and\n * create a new triangle. If needed new holes and basins\n * will be filled to.\n * @param {!SweepContext} tcx - SweepContext object\n * @param {!XY} point Point\n */\nfunction pointEvent(tcx, point) {\n var node = tcx.locateNode(point);\n var new_node = newFrontTriangle(tcx, point, node);\n\n // Only need to check +epsilon since point never have smaller\n // x value than node due to how we fetch nodes from the front\n if (point.x <= node.point.x + (EPSILON)) {\n fill(tcx, node);\n }\n\n //tcx.AddNode(new_node);\n\n fillAdvancingFront(tcx, new_node);\n return new_node;\n}\n\nfunction edgeEventByEdge(tcx, edge, node) {\n tcx.edge_event.constrained_edge = edge;\n tcx.edge_event.right = (edge.p.x > edge.q.x);\n\n if (isEdgeSideOfTriangle(node.triangle, edge.p, edge.q)) {\n return;\n }\n\n // For now we will do all needed filling\n // TODO: integrate with flip process might give some better performance\n // but for now this avoid the issue with cases that needs both flips and fills\n fillEdgeEvent(tcx, edge, node);\n edgeEventByPoints(tcx, edge.p, edge.q, node.triangle, edge.q);\n}\n\nfunction edgeEventByPoints(tcx, ep, eq, triangle, point) {\n if (isEdgeSideOfTriangle(triangle, ep, eq)) {\n return;\n }\n\n var p1 = triangle.pointCCW(point);\n var o1 = orient2d(eq, p1, ep);\n if (o1 === Orientation.COLLINEAR) {\n // TODO integrate here changes from C++ version\n // (C++ repo revision 09880a869095 dated March 8, 2011)\n throw new PointError('poly2tri EdgeEvent: Collinear not supported!', [eq, p1, ep]);\n }\n\n var p2 = triangle.pointCW(point);\n var o2 = orient2d(eq, p2, ep);\n if (o2 === Orientation.COLLINEAR) {\n // TODO integrate here changes from C++ version\n // (C++ repo revision 09880a869095 dated March 8, 2011)\n throw new PointError('poly2tri EdgeEvent: Collinear not supported!', [eq, p2, ep]);\n }\n\n if (o1 === o2) {\n // Need to decide if we are rotating CW or CCW to get to a triangle\n // that will cross edge\n if (o1 === Orientation.CW) {\n triangle = triangle.neighborCCW(point);\n } else {\n triangle = triangle.neighborCW(point);\n }\n edgeEventByPoints(tcx, ep, eq, triangle, point);\n } else {\n // This triangle crosses constraint so lets flippin start!\n flipEdgeEvent(tcx, ep, eq, triangle, point);\n }\n}\n\nfunction isEdgeSideOfTriangle(triangle, ep, eq) {\n var index = triangle.edgeIndex(ep, eq);\n if (index !== -1) {\n triangle.markConstrainedEdgeByIndex(index);\n var t = triangle.getNeighbor(index);\n if (t) {\n t.markConstrainedEdgeByPoints(ep, eq);\n }\n return true;\n }\n return false;\n}\n\n/**\n * Creates a new front triangle and legalize it\n * @param {!SweepContext} tcx - SweepContext object\n */\nfunction newFrontTriangle(tcx, point, node) {\n var triangle = new Triangle(point, node.point, node.next.point);\n\n triangle.markNeighbor(node.triangle);\n tcx.addToMap(triangle);\n\n var new_node = new Node(point);\n new_node.next = node.next;\n new_node.prev = node;\n node.next.prev = new_node;\n node.next = new_node;\n\n if (!legalize(tcx, triangle)) {\n tcx.mapTriangleToNodes(triangle);\n }\n\n return new_node;\n}\n\n/**\n * Adds a triangle to the advancing front to fill a hole.\n * @param {!SweepContext} tcx - SweepContext object\n * @param node - middle node, that is the bottom of the hole\n */\nfunction fill(tcx, node) {\n var triangle = new Triangle(node.prev.point, node.point, node.next.point);\n\n // TODO: should copy the constrained_edge value from neighbor triangles\n // for now constrained_edge values are copied during the legalize\n triangle.markNeighbor(node.prev.triangle);\n triangle.markNeighbor(node.triangle);\n\n tcx.addToMap(triangle);\n\n // Update the advancing front\n node.prev.next = node.next;\n node.next.prev = node.prev;\n\n\n // If it was legalized the triangle has already been mapped\n if (!legalize(tcx, triangle)) {\n tcx.mapTriangleToNodes(triangle);\n }\n\n //tcx.removeNode(node);\n}\n\n/**\n * Fills holes in the Advancing Front\n * @param {!SweepContext} tcx - SweepContext object\n */\nfunction fillAdvancingFront(tcx, n) {\n // Fill right holes\n var node = n.next;\n while (node.next) {\n // TODO integrate here changes from C++ version\n // (C++ repo revision acf81f1f1764 dated April 7, 2012)\n if (isAngleObtuse(node.point, node.next.point, node.prev.point)) {\n break;\n }\n fill(tcx, node);\n node = node.next;\n }\n\n // Fill left holes\n node = n.prev;\n while (node.prev) {\n // TODO integrate here changes from C++ version\n // (C++ repo revision acf81f1f1764 dated April 7, 2012)\n if (isAngleObtuse(node.point, node.next.point, node.prev.point)) {\n break;\n }\n fill(tcx, node);\n node = node.prev;\n }\n\n // Fill right basins\n if (n.next && n.next.next) {\n if (isBasinAngleRight(n)) {\n fillBasin(tcx, n);\n }\n }\n}\n\n/**\n * The basin angle is decided against the horizontal line [1,0].\n * @param {Node} node\n * @return {boolean} true if angle < 3*π/4\n */\nfunction isBasinAngleRight(node) {\n var ax = node.point.x - node.next.next.point.x;\n var ay = node.point.y - node.next.next.point.y;\n assert(ay >= 0, \"unordered y\");\n return (ax >= 0 || Math.abs(ax) < ay);\n}\n\n/**\n * Returns true if triangle was legalized\n * @param {!SweepContext} tcx - SweepContext object\n * @return {boolean}\n */\nfunction legalize(tcx, t) {\n // To legalize a triangle we start by finding if any of the three edges\n // violate the Delaunay condition\n for (var i = 0; i < 3; ++i) {\n if (t.delaunay_edge[i]) {\n continue;\n }\n var ot = t.getNeighbor(i);\n if (ot) {\n var p = t.getPoint(i);\n var op = ot.oppositePoint(t, p);\n var oi = ot.index(op);\n\n // If this is a Constrained Edge or a Delaunay Edge(only during recursive legalization)\n // then we should not try to legalize\n if (ot.constrained_edge[oi] || ot.delaunay_edge[oi]) {\n t.constrained_edge[i] = ot.constrained_edge[oi];\n continue;\n }\n\n var inside = inCircle(p, t.pointCCW(p), t.pointCW(p), op);\n if (inside) {\n // Lets mark this shared edge as Delaunay\n t.delaunay_edge[i] = true;\n ot.delaunay_edge[oi] = true;\n\n // Lets rotate shared edge one vertex CW to legalize it\n rotateTrianglePair(t, p, ot, op);\n\n // We now got one valid Delaunay Edge shared by two triangles\n // This gives us 4 new edges to check for Delaunay\n\n // Make sure that triangle to node mapping is done only one time for a specific triangle\n var not_legalized = !legalize(tcx, t);\n if (not_legalized) {\n tcx.mapTriangleToNodes(t);\n }\n\n not_legalized = !legalize(tcx, ot);\n if (not_legalized) {\n tcx.mapTriangleToNodes(ot);\n }\n // Reset the Delaunay edges, since they only are valid Delaunay edges\n // until we add a new triangle or point.\n // XXX: need to think about this. Can these edges be tried after we\n // return to previous recursive level?\n t.delaunay_edge[i] = false;\n ot.delaunay_edge[oi] = false;\n\n // If triangle have been legalized no need to check the other edges since\n // the recursive legalization will handles those so we can end here.\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * <b>Requirement</b>:<br>\n * 1. a,b and c form a triangle.<br>\n * 2. a and d is know to be on opposite side of bc<br>\n * <pre>\n * a\n * +\n * / \\\n * / \\\n * b/ \\c\n * +-------+\n * / d \\\n * / \\\n * </pre>\n * <b>Fact</b>: d has to be in area B to have a chance to be inside the circle formed by\n * a,b and c<br>\n * d is outside B if orient2d(a,b,d) or orient2d(c,a,d) is CW<br>\n * This preknowledge gives us a way to optimize the incircle test\n * @param pa - triangle point, opposite d\n * @param pb - triangle point\n * @param pc - triangle point\n * @param pd - point opposite a\n * @return {boolean} true if d is inside circle, false if on circle edge\n */\nfunction inCircle(pa, pb, pc, pd) {\n var adx = pa.x - pd.x;\n var ady = pa.y - pd.y;\n var bdx = pb.x - pd.x;\n var bdy = pb.y - pd.y;\n\n var adxbdy = adx * bdy;\n var bdxady = bdx * ady;\n var oabd = adxbdy - bdxady;\n if (oabd <= 0) {\n return false;\n }\n\n var cdx = pc.x - pd.x;\n var cdy = pc.y - pd.y;\n\n var cdxady = cdx * ady;\n var adxcdy = adx * cdy;\n var ocad = cdxady - adxcdy;\n if (ocad <= 0) {\n return false;\n }\n\n var bdxcdy = bdx * cdy;\n var cdxbdy = cdx * bdy;\n\n var alift = adx * adx + ady * ady;\n var blift = bdx * bdx + bdy * bdy;\n var clift = cdx * cdx + cdy * cdy;\n\n var det = alift * (bdxcdy - cdxbdy) + blift * ocad + clift * oabd;\n return det > 0;\n}\n\n/**\n * Rotates a triangle pair one vertex CW\n *<pre>\n * n2 n2\n * P +-----+ P +-----+\n * | t /| |\\ t |\n * | / | | \\ |\n * n1| / |n3 n1| \\ |n3\n * | / | after CW | \\ |\n * |/ oT | | oT \\|\n * +-----+ oP +-----+\n * n4 n4\n * </pre>\n */\nfunction rotateTrianglePair(t, p, ot, op) {\n var n1, n2, n3, n4;\n n1 = t.neighborCCW(p);\n n2 = t.neighborCW(p);\n n3 = ot.neighborCCW(op);\n n4 = ot.neighborCW(op);\n\n var ce1, ce2, ce3, ce4;\n ce1 = t.getConstrainedEdgeCCW(p);\n ce2 = t.getConstrainedEdgeCW(p);\n ce3 = ot.getConstrainedEdgeCCW(op);\n ce4 = ot.getConstrainedEdgeCW(op);\n\n var de1, de2, de3, de4;\n de1 = t.getDelaunayEdgeCCW(p);\n de2 = t.getDelaunayEdgeCW(p);\n de3 = ot.getDelaunayEdgeCCW(op);\n de4 = ot.getDelaunayEdgeCW(op);\n\n t.legalize(p, op);\n ot.legalize(op, p);\n\n // Remap delaunay_edge\n ot.setDelaunayEdgeCCW(p, de1);\n t.setDelaunayEdgeCW(p, de2);\n t.setDelaunayEdgeCCW(op, de3);\n ot.setDelaunayEdgeCW(op, de4);\n\n // Remap constrained_edge\n ot.setConstrainedEdgeCCW(p, ce1);\n t.setConstrainedEdgeCW(p, ce2);\n t.setConstrainedEdgeCCW(op, ce3);\n ot.setConstrainedEdgeCW(op, ce4);\n\n // Remap neighbors\n // XXX: might optimize the markNeighbor by keeping track of\n // what side should be assigned to what neighbor after the\n // rotation. Now mark neighbor does lots of testing to find\n // the right side.\n t.clearNeighbors();\n ot.clearNeighbors();\n if (n1) {\n ot.markNeighbor(n1);\n }\n if (n2) {\n t.markNeighbor(n2);\n }\n if (n3) {\n t.markNeighbor(n3);\n }\n if (n4) {\n ot.markNeighbor(n4);\n }\n t.markNeighbor(ot);\n}\n\n/**\n * Fills a basin that has formed on the Advancing Front to the right\n * of given node.<br>\n * First we decide a left,bottom and right node that forms the\n * boundaries of the basin. Then we do a reqursive fill.\n *\n * @param {!SweepContext} tcx - SweepContext object\n * @param node - starting node, this or next node will be left node\n */\nfunction fillBasin(tcx, node) {\n if (orient2d(node.point, node.next.point, node.next.next.point) === Orientation.CCW) {\n tcx.basin.left_node = node.next.next;\n } else {\n tcx.basin.left_node = node.next;\n }\n\n // Find the bottom and right node\n tcx.basin.bottom_node = tcx.basin.left_node;\n while (tcx.basin.bottom_node.next && tcx.basin.bottom_node.point.y >= tcx.basin.bottom_node.next.point.y) {\n tcx.basin.bottom_node = tcx.basin.bottom_node.next;\n }\n if (tcx.basin.bottom_node === tcx.basin.left_node) {\n // No valid basin\n return;\n }\n\n tcx.basin.right_node = tcx.basin.bottom_node;\n while (tcx.basin.right_node.next && tcx.basin.right_node.point.y < tcx.basin.right_node.next.point.y) {\n tcx.basin.right_node = tcx.basin.right_node.next;\n }\n if (tcx.basin.right_node === tcx.basin.bottom_node) {\n // No valid basins\n return;\n }\n\n tcx.basin.width = tcx.basin.right_node.point.x - tcx.basin.left_node.point.x;\n tcx.basin.left_highest = tcx.basin.left_node.point.y > tcx.basin.right_node.point.y;\n\n fillBasinReq(tcx, tcx.basin.bottom_node);\n}\n\n/**\n * Recursive algorithm to fill a Basin with triangles\n *\n * @param {!SweepContext} tcx - SweepContext object\n * @param node - bottom_node\n */\nfunction fillBasinReq(tcx, node) {\n // if shallow stop filling\n if (isShallow(tcx, node)) {\n return;\n }\n\n fill(tcx, node);\n\n var o;\n if (node.prev === tcx.basin.left_node && node.next === tcx.basin.right_node) {\n return;\n } else if (node.prev === tcx.basin.left_node) {\n o = orient2d(node.point, node.next.point, node.next.next.point);\n if (o === Orientation.CW) {\n return;\n }\n node = node.next;\n } else if (node.next === tcx.basin.right_node) {\n o = orient2d(node.point, node.prev.point, node.prev.prev.point);\n if (o === Orientation.CCW) {\n return;\n }\n node = node.prev;\n } else {\n // Continue with the neighbor node with lowest Y value\n if (node.prev.point.y < node.next.point.y) {\n node = node.prev;\n } else {\n node = node.next;\n }\n }\n\n fillBasinReq(tcx, node);\n}\n\nfunction isShallow(tcx, node) {\n var height;\n if (tcx.basin.left_highest) {\n height = tcx.basin.left_node.point.y - node.point.y;\n } else {\n height = tcx.basin.right_node.point.y - node.point.y;\n }\n\n // if shallow stop filling\n if (tcx.basin.width > height) {\n return true;\n }\n return false;\n}\n\nfunction fillEdgeEvent(tcx, edge, node) {\n if (tcx.edge_event.right) {\n fillRightAboveEdgeEvent(tcx, edge, node);\n } else {\n fillLeftAboveEdgeEvent(tcx, edge, node);\n }\n}\n\nfunction fillRightAboveEdgeEvent(tcx, edge, node) {\n while (node.next.point.x < edge.p.x) {\n // Check if next node is below the edge\n if (orient2d(edge.q, node.next.point, edge.p) === Orientation.CCW) {\n fillRightBelowEdgeEvent(tcx, edge, node);\n } else {\n node = node.next;\n }\n }\n}\n\nfunction fillRightBelowEdgeEvent(tcx, edge, node) {\n if (node.point.x < edge.p.x) {\n if (orient2d(node.point, node.next.point, node.next.next.point) === Orientation.CCW) {\n // Concave\n fillRightConcaveEdgeEvent(tcx, edge, node);\n } else {\n // Convex\n fillRightConvexEdgeEvent(tcx, edge, node);\n // Retry this one\n fillRightBelowEdgeEvent(tcx, edge, node);\n }\n }\n}\n\nfunction fillRightConcaveEdgeEvent(tcx, edge, node) {\n fill(tcx, node.next);\n if (node.next.point !== edge.p) {\n // Next above or below edge?\n if (orient2d(edge.q, node.next.point, edge.p) === Orientation.CCW) {\n // Below\n if (orient2d(node.point, node.next.point, node.next.next.point) === Orientation.CCW) {\n // Next is concave\n fillRightConcaveEdgeEvent(tcx, edge, node);\n } else {\n // Next is convex\n /* jshint noempty:false */\n }\n }\n }\n}\n\nfunction fillRightConvexEdgeEvent(tcx, edge, node) {\n // Next concave or convex?\n if (orient2d(node.next.point, node.next.next.point, node.next.next.next.point) === Orientation.CCW) {\n // Concave\n fillRightConcaveEdgeEvent(tcx, edge, node.next);\n } else {\n // Convex\n // Next above or below edge?\n if (orient2d(edge.q, node.next.next.point, edge.p) === Orientation.CCW) {\n // Below\n fillRightConvexEdgeEvent(tcx, edge, node.next);\n } else {\n // Above\n /* jshint noempty:false */\n }\n }\n}\n\nfunction fillLeftAboveEdgeEvent(tcx, edge, node) {\n while (node.prev.point.x > edge.p.x) {\n // Check if next node is below the edge\n if (orient2d(edge.q, node.prev.point, edge.p) === Orientation.CW) {\n fillLeftBelowEdgeEvent(tcx, edge, node);\n } else {\n node = node.prev;\n }\n }\n}\n\nfunction fillLeftBelowEdgeEvent(tcx, edge, node) {\n if (node.point.x > edge.p.x) {\n if (orient2d(node.point, node.prev.point, node.prev.prev.point) === Orientation.CW) {\n // Concave\n fillLeftConcaveEdgeEvent(tcx, edge, node);\n } else {\n // Convex\n fillLeftConvexEdgeEvent(tcx, edge, node);\n // Retry this one\n fillLeftBelowEdgeEvent(tcx, edge, node);\n }\n }\n}\n\nfunction fillLeftConvexEdgeEvent(tcx, edge, node) {\n // Next concave or convex?\n if (orient2d(node.prev.point, node.prev.prev.point, node.prev.prev.prev.point) === Orientation.CW) {\n // Concave\n fillLeftConcaveEdgeEvent(tcx, edge, node.prev);\n } else {\n // Convex\n // Next above or below edge?\n if (orient2d(edge.q, node.prev.prev.point, edge.p) === Orientation.CW) {\n // Below\n fillLeftConvexEdgeEvent(tcx, edge, node.prev);\n } else {\n // Above\n /* jshint noempty:false */\n }\n }\n}\n\nfunction fillLeftConcaveEdgeEvent(tcx, edge, node) {\n fill(tcx, node.prev);\n if (node.prev.point !== edge.p) {\n // Next above or below edge?\n if (orient2d(edge.q, node.prev.point, edge.p) === Orientation.CW) {\n // Below\n if (orient2d(node.point, node.prev.point, node.prev.prev.point) === Orientation.CW) {\n // Next is concave\n fillLeftConcaveEdgeEvent(tcx, edge, node);\n } else {\n // Next is convex\n /* jshint noempty:false */\n }\n }\n }\n}\n\nfunction flipEdgeEvent(tcx, ep, eq, t, p) {\n var ot = t.neighborAcross(p);\n assert(ot, \"FLIP failed due to missing triangle!\");\n\n var op = ot.oppositePoint(t, p);\n\n // Additional check from Java version (see issue #88)\n if (t.getConstrainedEdgeAcross(p)) {\n var index = t.index(p);\n throw new PointError(\"poly2tri Intersecting Constraints\",\n [p, op, t.getPoint((index + 1) % 3), t.getPoint((index + 2) % 3)]);\n }\n\n if (inScanArea(p, t.pointCCW(p), t.pointCW(p), op)) {\n // Lets rotate shared edge one vertex CW\n rotateTrianglePair(t, p, ot, op);\n tcx.mapTriangleToNodes(t);\n tcx.mapTriangleToNodes(ot);\n\n // XXX: in the original C++ code for the next 2 lines, we are\n // comparing point values (and not pointers). In this JavaScript\n // code, we are comparing point references (pointers). This works\n // because we can't have 2 different points with the same values.\n // But to be really equivalent, we should use \"Point.equals\" here.\n if (p === eq && op === ep) {\n if (eq === tcx.edge_event.constrained_edge.q && ep === tcx.edge_event.constrained_edge.p) {\n t.markConstrainedEdgeByPoints(ep, eq);\n ot.markConstrainedEdgeByPoints(ep, eq);\n legalize(tcx, t);\n legalize(tcx, ot);\n } else {\n // XXX: I think one of the triangles should be legalized here?\n /* jshint noempty:false */\n }\n } else {\n var o = orient2d(eq, op, ep);\n t = nextFlipTriangle(tcx, o, t, ot, p, op);\n flipEdgeEvent(tcx, ep, eq, t, p);\n }\n } else {\n var newP = nextFlipPoint(ep, eq, ot, op);\n flipScanEdgeEvent(tcx, ep, eq, t, ot, newP);\n edgeEventByPoints(tcx, ep, eq, t, p);\n }\n}\n\n/**\n * After a flip we have two triangles and know that only one will still be\n * intersecting the edge. So decide which to contiune with and legalize the other\n *\n * @param {!SweepContext} tcx - SweepContext object\n * @param o - should be the result of an orient2d( eq, op, ep )\n * @param t - triangle 1\n * @param ot - triangle 2\n * @param p - a point shared by both triangles\n * @param op - another point shared by both triangles\n * @return returns the triangle still intersecting the edge\n */\nfunction nextFlipTriangle(tcx, o, t, ot, p, op) {\n var edge_index;\n if (o === Orientation.CCW) {\n // ot is not crossing edge after flip\n edge_index = ot.edgeIndex(p, op);\n ot.delaunay_edge[edge_index] = true;\n legalize(tcx, ot);\n ot.clearDelaunayEdges();\n return t;\n }\n\n // t is not crossing edge after flip\n edge_index = t.edgeIndex(p, op);\n\n t.delaunay_edge[edge_index] = true;\n legalize(tcx, t);\n t.clearDelaunayEdges();\n return ot;\n}\n\n/**\n * When we need to traverse from one triangle to the next we need\n * the point in current triangle that is the opposite point to the next\n * triangle.\n */\nfunction nextFlipPoint(ep, eq, ot, op) {\n var o2d = orient2d(eq, op, ep);\n if (o2d === Orientation.CW) {\n // Right\n return ot.pointCCW(op);\n } else if (o2d === Orientation.CCW) {\n // Left\n return ot.pointCW(op);\n } else {\n throw new PointError(\"poly2tri [Unsupported] nextFlipPoint: opposing point on constrained edge!\", [eq, op, ep]);\n }\n}\n\n/**\n * Scan part of the FlipScan algorithm<br>\n * When a triangle pair isn't flippable we will scan for the next\n * point that is inside the flip triangle scan area. When found\n * we generate a new flipEdgeEvent\n *\n * @param {!SweepContext} tcx - SweepContext object\n * @param ep - last point on the edge we are traversing\n * @param eq - first point on the edge we are traversing\n * @param {!Triangle} flip_triangle - the current triangle sharing the point eq with edge\n * @param t\n * @param p\n */\nfunction flipScanEdgeEvent(tcx, ep, eq, flip_triangle, t, p) {\n var ot = t.neighborAcross(p);\n assert(ot, \"FLIP failed due to missing triangle\");\n\n var op = ot.oppositePoint(t, p);\n\n if (inScanArea(eq, flip_triangle.pointCCW(eq), flip_triangle.pointCW(eq), op)) {\n // flip with new edge op.eq\n flipEdgeEvent(tcx, eq, op, ot, op);\n } else {\n var newP = nextFlipPoint(ep, eq, ot, op);\n flipScanEdgeEvent(tcx, ep, eq, flip_triangle, ot, newP);\n }\n}\n\n\n// ----------------------------------------------------------------------Exports\n\nexports.triangulate = triangulate;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/sweep.js\n// module id = 10\n// module chunks = 0","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n * \n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n * \n * All rights reserved.\n * \n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n/* jshint maxcomplexity:6 */\n\n\"use strict\";\n\n\n/*\n * Note\n * ====\n * the structure of this JavaScript version of poly2tri intentionally follows\n * as closely as possible the structure of the reference C++ version, to make it \n * easier to keep the 2 versions in sync.\n */\n\nvar PointError = require('./pointerror');\nvar Point = require('./point');\nvar Triangle = require('./triangle');\nvar sweep = require('./sweep');\nvar AdvancingFront = require('./advancingfront');\nvar Node = AdvancingFront.Node;\n\n\n// ------------------------------------------------------------------------utils\n\n/**\n * Initial triangle factor, seed triangle will extend 30% of\n * PointSet width to both left and right.\n * @private\n * @const\n */\nvar kAlpha = 0.3;\n\n\n// -------------------------------------------------------------------------Edge\n/**\n * Represents a simple polygon's edge\n * @constructor\n * @struct\n * @private\n * @param {Point} p1\n * @param {Point} p2\n * @throw {PointError} if p1 is same as p2\n */\nvar Edge = function(p1, p2) {\n this.p = p1;\n this.q = p2;\n\n if (p1.y > p2.y) {\n this.q = p1;\n this.p = p2;\n } else if (p1.y === p2.y) {\n if (p1.x > p2.x) {\n this.q = p1;\n this.p = p2;\n } else if (p1.x === p2.x) {\n throw new PointError('poly2tri Invalid Edge constructor: repeated points!', [p1]);\n }\n }\n\n if (!this.q._p2t_edge_list) {\n this.q._p2t_edge_list = [];\n }\n this.q._p2t_edge_list.push(this);\n};\n\n\n// ------------------------------------------------------------------------Basin\n/**\n * @constructor\n * @struct\n * @private\n */\nvar Basin = function() {\n /** @type {Node} */\n this.left_node = null;\n /** @type {Node} */\n this.bottom_node = null;\n /** @type {Node} */\n this.right_node = null;\n /** @type {number} */\n this.width = 0.0;\n /** @type {boolean} */\n this.left_highest = false;\n};\n\nBasin.prototype.clear = function() {\n this.left_node = null;\n this.bottom_node = null;\n this.right_node = null;\n this.width = 0.0;\n this.left_highest = false;\n};\n\n// --------------------------------------------------------------------EdgeEvent\n/**\n * @constructor\n * @struct\n * @private\n */\nvar EdgeEvent = function() {\n /** @type {Edge} */\n this.constrained_edge = null;\n /** @type {boolean} */\n this.right = false;\n};\n\n// ----------------------------------------------------SweepContext (public API)\n/**\n * SweepContext constructor option\n * @typedef {Object} SweepContextOptions\n * @property {boolean=} cloneArrays - if <code>true</code>, do a shallow copy of the Array parameters\n * (contour, holes). Points inside arrays are never copied.\n * Default is <code>false</code> : keep a reference to the array arguments,\n * who will be modified in place.\n */\n/**\n * Constructor for the triangulation context.\n * It accepts a simple polyline (with non repeating points), \n * which defines the constrained edges.\n *\n * @example\n * var contour = [\n * new poly2tri.Point(100, 100),\n * new poly2tri.Point(100, 300),\n * new poly2tri.Point(300, 300),\n * new poly2tri.Point(300, 100)\n * ];\n * var swctx = new poly2tri.SweepContext(contour, {cloneArrays: true});\n * @example\n * var contour = [{x:100, y:100}, {x:100, y:300}, {x:300, y:300}, {x:300, y:100}];\n * var swctx = new poly2tri.SweepContext(contour, {cloneArrays: true});\n * @constructor\n * @public\n * @struct\n * @param {Array.<XY>} contour - array of point objects. The points can be either {@linkcode Point} instances,\n * or any \"Point like\" custom class with <code>{x, y}</code> attributes.\n * @param {SweepContextOptions=} options - constructor options\n */\nvar SweepContext = function(contour, options) {\n options = options || {};\n this.triangles_ = [];\n this.map_ = [];\n this.points_ = (options.cloneArrays ? contour.slice(0) : contour);\n this.edge_list = [];\n\n // Bounding box of all points. Computed at the start of the triangulation, \n // it is stored in case it is needed by the caller.\n this.pmin_ = this.pmax_ = null;\n\n /**\n * Advancing front\n * @private\n * @type {AdvancingFront}\n */\n this.front_ = null;\n\n /**\n * head point used with advancing front\n * @private\n * @type {Point}\n */\n this.head_ = null;\n\n /**\n * tail point used with advancing front\n * @private\n * @type {Point}\n */\n this.tail_ = null;\n\n /**\n * @private\n * @type {Node}\n */\n this.af_head_ = null;\n /**\n * @private\n * @type {Node}\n */\n this.af_middle_ = null;\n /**\n * @private\n * @type {Node}\n */\n this.af_tail_ = null;\n\n this.basin = new Basin();\n this.edge_event = new EdgeEvent();\n\n this.initEdges(this.points_);\n};\n\n\n/**\n * Add a hole to the constraints\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * var hole = [\n * new poly2tri.Point(200, 200),\n * new poly2tri.Point(200, 250),\n * new poly2tri.Point(250, 250)\n * ];\n * swctx.addHole(hole);\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * swctx.addHole([{x:200, y:200}, {x:200, y:250}, {x:250, y:250}]);\n * @public\n * @param {Array.<XY>} polyline - array of \"Point like\" objects with {x,y}\n */\nSweepContext.prototype.addHole = function(polyline) {\n this.initEdges(polyline);\n var i, len = polyline.length;\n for (i = 0; i < len; i++) {\n this.points_.push(polyline[i]);\n }\n return this; // for chaining\n};\n\n/**\n * For backward compatibility\n * @function\n * @deprecated use {@linkcode SweepContext#addHole} instead\n */\nSweepContext.prototype.AddHole = SweepContext.prototype.addHole;\n\n\n/**\n * Add several holes to the constraints\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * var holes = [\n * [ new poly2tri.Point(200, 200), new poly2tri.Point(200, 250), new poly2tri.Point(250, 250) ],\n * [ new poly2tri.Point(300, 300), new poly2tri.Point(300, 350), new poly2tri.Point(350, 350) ]\n * ];\n * swctx.addHoles(holes);\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * var holes = [\n * [{x:200, y:200}, {x:200, y:250}, {x:250, y:250}],\n * [{x:300, y:300}, {x:300, y:350}, {x:350, y:350}]\n * ];\n * swctx.addHoles(holes);\n * @public\n * @param {Array.<Array.<XY>>} holes - array of array of \"Point like\" objects with {x,y}\n */\n// Method added in the JavaScript version (was not present in the c++ version)\nSweepContext.prototype.addHoles = function(holes) {\n var i, len = holes.length;\n for (i = 0; i < len; i++) {\n this.initEdges(holes[i]);\n }\n this.points_ = this.points_.concat.apply(this.points_, holes);\n return this; // for chaining\n};\n\n\n/**\n * Add a Steiner point to the constraints\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * var point = new poly2tri.Point(150, 150);\n * swctx.addPoint(point);\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * swctx.addPoint({x:150, y:150});\n * @public\n * @param {XY} point - any \"Point like\" object with {x,y}\n */\nSweepContext.prototype.addPoint = function(point) {\n this.points_.push(point);\n return this; // for chaining\n};\n\n/**\n * For backward compatibility\n * @function\n * @deprecated use {@linkcode SweepContext#addPoint} instead\n */\nSweepContext.prototype.AddPoint = SweepContext.prototype.addPoint;\n\n\n/**\n * Add several Steiner points to the constraints\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * var points = [\n * new poly2tri.Point(150, 150),\n * new poly2tri.Point(200, 250),\n * new poly2tri.Point(250, 250)\n * ];\n * swctx.addPoints(points);\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * swctx.addPoints([{x:150, y:150}, {x:200, y:250}, {x:250, y:250}]);\n * @public\n * @param {Array.<XY>} points - array of \"Point like\" object with {x,y}\n */\n// Method added in the JavaScript version (was not present in the c++ version)\nSweepContext.prototype.addPoints = function(points) {\n this.points_ = this.points_.concat(points);\n return this; // for chaining\n};\n\n\n/**\n * Triangulate the polygon with holes and Steiner points.\n * Do this AFTER you've added the polyline, holes, and Steiner points\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * swctx.triangulate();\n * var triangles = swctx.getTriangles();\n * @public\n */\n// Shortcut method for sweep.triangulate(SweepContext).\n// Method added in the JavaScript version (was not present in the c++ version)\nSweepContext.prototype.triangulate = function() {\n sweep.triangulate(this);\n return this; // for chaining\n};\n\n\n/**\n * Get the bounding box of the provided constraints (contour, holes and \n * Steinter points). Warning : these values are not available if the triangulation \n * has not been done yet.\n * @public\n * @returns {{min:Point,max:Point}} object with 'min' and 'max' Point\n */\n// Method added in the JavaScript version (was not present in the c++ version)\nSweepContext.prototype.getBoundingBox = function() {\n return {min: this.pmin_, max: this.pmax_};\n};\n\n/**\n * Get result of triangulation.\n * The output triangles have vertices which are references\n * to the initial input points (not copies): any custom fields in the\n * initial points can be retrieved in the output triangles.\n * @example\n * var swctx = new poly2tri.SweepContext(contour);\n * swctx.triangulate();\n * var triangles = swctx.getTriangles();\n * @example\n * var contour = [{x:100, y:100, id:1}, {x:100, y:300, id:2}, {x:300, y:300, id:3}];\n * var swctx = new poly2tri.SweepContext(contour);\n * swctx.triangulate();\n * var triangles = swctx.getTriangles();\n * typeof triangles[0].getPoint(0).id\n * // → \"number\"\n * @public\n * @returns {array<Triangle>} array of triangles\n */\nSweepContext.prototype.getTriangles = function() {\n return this.triangles_;\n};\n\n/**\n * For backward compatibility\n * @function\n * @deprecated use {@linkcode SweepContext#getTriangles} instead\n */\nSweepContext.prototype.GetTriangles = SweepContext.prototype.getTriangles;\n\n\n// ---------------------------------------------------SweepContext (private API)\n\n/** @private */\nSweepContext.prototype.front = function() {\n return this.front_;\n};\n\n/** @private */\nSweepContext.prototype.pointCount = function() {\n return this.points_.length;\n};\n\n/** @private */\nSweepContext.prototype.head = function() {\n return this.head_;\n};\n\n/** @private */\nSweepContext.prototype.setHead = function(p1) {\n this.head_ = p1;\n};\n\n/** @private */\nSweepContext.prototype.tail = function() {\n return this.tail_;\n};\n\n/** @private */\nSweepContext.prototype.setTail = function(p1) {\n this.tail_ = p1;\n};\n\n/** @private */\nSweepContext.prototype.getMap = function() {\n return this.map_;\n};\n\n/** @private */\nSweepContext.prototype.initTriangulation = function() {\n var xmax = this.points_[0].x;\n var xmin = this.points_[0].x;\n var ymax = this.points_[0].y;\n var ymin = this.points_[0].y;\n\n // Calculate bounds\n var i, len = this.points_.length;\n for (i = 1; i < len; i++) {\n var p = this.points_[i];\n /* jshint expr:true */\n (p.x > xmax) && (xmax = p.x);\n (p.x < xmin) && (xmin = p.x);\n (p.y > ymax) && (ymax = p.y);\n (p.y < ymin) && (ymin = p.y);\n }\n this.pmin_ = new Point(xmin, ymin);\n this.pmax_ = new Point(xmax, ymax);\n\n var dx = kAlpha * (xmax - xmin);\n var dy = kAlpha * (ymax - ymin);\n this.head_ = new Point(xmax + dx, ymin - dy);\n this.tail_ = new Point(xmin - dx, ymin - dy);\n\n // Sort points along y-axis\n this.points_.sort(Point.compare);\n};\n\n/** @private */\nSweepContext.prototype.initEdges = function(polyline) {\n var i, len = polyline.length;\n for (i = 0; i < len; ++i) {\n this.edge_list.push(new Edge(polyline[i], polyline[(i + 1) % len]));\n }\n};\n\n/** @private */\nSweepContext.prototype.getPoint = function(index) {\n return this.points_[index];\n};\n\n/** @private */\nSweepContext.prototype.addToMap = function(triangle) {\n this.map_.push(triangle);\n};\n\n/** @private */\nSweepContext.prototype.locateNode = function(point) {\n return this.front_.locateNode(point.x);\n};\n\n/** @private */\nSweepContext.prototype.createAdvancingFront = function() {\n var head;\n var middle;\n var tail;\n // Initial triangle\n var triangle = new Triangle(this.points_[0], this.tail_, this.head_);\n\n this.map_.push(triangle);\n\n head = new Node(triangle.getPoint(1), triangle);\n middle = new Node(triangle.getPoint(0), triangle);\n tail = new Node(triangle.getPoint(2));\n\n this.front_ = new AdvancingFront(head, tail);\n\n head.next = middle;\n middle.next = tail;\n middle.prev = head;\n tail.prev = middle;\n};\n\n/** @private */\nSweepContext.prototype.removeNode = function(node) {\n // do nothing\n /* jshint unused:false */\n};\n\n/** @private */\nSweepContext.prototype.mapTriangleToNodes = function(t) {\n for (var i = 0; i < 3; ++i) {\n if (!t.getNeighbor(i)) {\n var n = this.front_.locatePoint(t.pointCW(t.getPoint(i)));\n if (n) {\n n.triangle = t;\n }\n }\n }\n};\n\n/** @private */\nSweepContext.prototype.removeFromMap = function(triangle) {\n var i, map = this.map_, len = map.length;\n for (i = 0; i < len; i++) {\n if (map[i] === triangle) {\n map.splice(i, 1);\n break;\n }\n }\n};\n\n/**\n * Do a depth first traversal to collect triangles\n * @private\n * @param {Triangle} triangle start\n */\nSweepContext.prototype.meshClean = function(triangle) {\n // New implementation avoids recursive calls and use a loop instead.\n // Cf. issues # 57, 65 and 69.\n var triangles = [triangle], t, i;\n /* jshint boss:true */\n while (t = triangles.pop()) {\n if (!t.isInterior()) {\n t.setInterior(true);\n this.triangles_.push(t);\n for (i = 0; i < 3; i++) {\n if (!t.constrained_edge[i]) {\n triangles.push(t.getNeighbor(i));\n }\n }\n }\n }\n};\n\n// ----------------------------------------------------------------------Exports\n\nmodule.exports = SweepContext;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/sweepcontext.js\n// module id = 11\n// module chunks = 0","/*\n * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors\n * http://code.google.com/p/poly2tri/\n * \n * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors\n * https://github.com/r3mi/poly2tri.js\n * \n * All rights reserved.\n * \n * Distributed under the 3-clause BSD License, see LICENSE.txt\n */\n\n\"use strict\";\n\n/**\n * Precision to detect repeated or collinear points\n * @private\n * @const {number}\n * @default\n */\nvar EPSILON = 1e-12;\nexports.EPSILON = EPSILON;\n\n/**\n * @private\n * @enum {number}\n * @readonly\n */\nvar Orientation = {\n \"CW\": 1,\n \"CCW\": -1,\n \"COLLINEAR\": 0\n};\nexports.Orientation = Orientation;\n\n\n/**\n * Formula to calculate signed area<br>\n * Positive if CCW<br>\n * Negative if CW<br>\n * 0 if collinear<br>\n * <pre>\n * A[P1,P2,P3] = (x1*y2 - y1*x2) + (x2*y3 - y2*x3) + (x3*y1 - y3*x1)\n * = (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)\n * </pre>\n *\n * @private\n * @param {!XY} pa point object with {x,y}\n * @param {!XY} pb point object with {x,y}\n * @param {!XY} pc point object with {x,y}\n * @return {Orientation}\n */\nfunction orient2d(pa, pb, pc) {\n var detleft = (pa.x - pc.x) * (pb.y - pc.y);\n var detright = (pa.y - pc.y) * (pb.x - pc.x);\n var val = detleft - detright;\n if (val > -(EPSILON) && val < (EPSILON)) {\n return Orientation.COLLINEAR;\n } else if (val > 0) {\n return Orientation.CCW;\n } else {\n return Orientation.CW;\n }\n}\nexports.orient2d = orient2d;\n\n\n/**\n *\n * @private\n * @param {!XY} pa point object with {x,y}\n * @param {!XY} pb point object with {x,y}\n * @param {!XY} pc point object with {x,y}\n * @param {!XY} pd point object with {x,y}\n * @return {boolean}\n */\nfunction inScanArea(pa, pb, pc, pd) {\n var oadb = (pa.x - pb.x) * (pd.y - pb.y) - (pd.x - pb.x) * (pa.y - pb.y);\n if (oadb >= -EPSILON) {\n return false;\n }\n\n var oadc = (pa.x - pc.x) * (pd.y - pc.y) - (pd.x - pc.x) * (pa.y - pc.y);\n if (oadc <= EPSILON) {\n return false;\n }\n return true;\n}\nexports.inScanArea = inScanArea;\n\n\n/**\n * Check if the angle between (pa,pb) and (pa,pc) is obtuse i.e. (angle > π/2 || angle < -π/2)\n *\n * @private\n * @param {!XY} pa point object with {x,y}\n * @param {!XY} pb point object with {x,y}\n * @param {!XY} pc point object with {x,y}\n * @return {boolean} true if angle is obtuse\n */\nfunction isAngleObtuse(pa, pb, pc) {\n var ax = pb.x - pa.x;\n var ay = pb.y - pa.y;\n var bx = pc.x - pa.x;\n var by = pc.y - pa.y;\n return (ax * bx + ay * by) < 0;\n}\nexports.isAngleObtuse = isAngleObtuse;\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../~/poly2tri/src/utils.js\n// module id = 12\n// module chunks = 0"],"sourceRoot":""}