{"version":3,"file":"polyclip-ts-CTG3ayM_.js","sources":["../../node_modules/polyclip-ts/dist/esm/index.js"],"sourcesContent":["// src/geom-in.ts\nimport BigNumber2 from \"bignumber.js\";\n\n// src/constant.ts\nvar constant_default = (x) => {\n return () => {\n return x;\n };\n};\n\n// src/compare.ts\nvar compare_default = (eps) => {\n const almostEqual = eps ? (a, b) => b.minus(a).abs().isLessThanOrEqualTo(eps) : constant_default(false);\n return (a, b) => {\n if (almostEqual(a, b)) return 0;\n return a.comparedTo(b);\n };\n};\n\n// src/orient.ts\nfunction orient_default(eps) {\n const almostCollinear = eps ? (area2, ax, ay, cx, cy) => area2.exponentiatedBy(2).isLessThanOrEqualTo(\n cx.minus(ax).exponentiatedBy(2).plus(cy.minus(ay).exponentiatedBy(2)).times(eps)\n ) : constant_default(false);\n return (a, b, c) => {\n const ax = a.x, ay = a.y, cx = c.x, cy = c.y;\n const area2 = ay.minus(cy).times(b.x.minus(cx)).minus(ax.minus(cx).times(b.y.minus(cy)));\n if (almostCollinear(area2, ax, ay, cx, cy)) return 0;\n return area2.comparedTo(0);\n };\n}\n\n// src/snap.ts\nimport BigNumber from \"bignumber.js\";\nimport { SplayTreeSet } from \"splaytree-ts\";\n\n// src/identity.ts\nvar identity_default = (x) => {\n return x;\n};\n\n// src/snap.ts\nvar snap_default = (eps) => {\n if (eps) {\n const xTree = new SplayTreeSet(compare_default(eps));\n const yTree = new SplayTreeSet(compare_default(eps));\n const snapCoord = (coord, tree) => {\n return tree.addAndReturn(coord);\n };\n const snap = (v) => {\n return {\n x: snapCoord(v.x, xTree),\n y: snapCoord(v.y, yTree)\n };\n };\n snap({ x: new BigNumber(0), y: new BigNumber(0) });\n return snap;\n }\n return identity_default;\n};\n\n// src/precision.ts\nvar set = (eps) => {\n return {\n set: (eps2) => {\n precision = set(eps2);\n },\n reset: () => set(eps),\n compare: compare_default(eps),\n snap: snap_default(eps),\n orient: orient_default(eps)\n };\n};\nvar precision = set();\n\n// src/bbox.ts\nvar isInBbox = (bbox, point) => {\n return bbox.ll.x.isLessThanOrEqualTo(point.x) && point.x.isLessThanOrEqualTo(bbox.ur.x) && bbox.ll.y.isLessThanOrEqualTo(point.y) && point.y.isLessThanOrEqualTo(bbox.ur.y);\n};\nvar getBboxOverlap = (b1, b2) => {\n if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))\n return null;\n const lowerX = b1.ll.x.isLessThan(b2.ll.x) ? b2.ll.x : b1.ll.x;\n const upperX = b1.ur.x.isLessThan(b2.ur.x) ? b1.ur.x : b2.ur.x;\n const lowerY = b1.ll.y.isLessThan(b2.ll.y) ? b2.ll.y : b1.ll.y;\n const upperY = b1.ur.y.isLessThan(b2.ur.y) ? b1.ur.y : b2.ur.y;\n return { ll: { x: lowerX, y: lowerY }, ur: { x: upperX, y: upperY } };\n};\n\n// src/operation.ts\nimport { SplayTreeSet as SplayTreeSet3 } from \"splaytree-ts\";\n\n// src/vector.ts\nvar crossProduct = (a, b) => a.x.times(b.y).minus(a.y.times(b.x));\nvar dotProduct = (a, b) => a.x.times(b.x).plus(a.y.times(b.y));\nvar length = (v) => dotProduct(v, v).sqrt();\nvar sineOfAngle = (pShared, pBase, pAngle) => {\n const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };\n const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };\n return crossProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));\n};\nvar cosineOfAngle = (pShared, pBase, pAngle) => {\n const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };\n const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };\n return dotProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));\n};\nvar horizontalIntersection = (pt, v, y) => {\n if (v.y.isZero()) return null;\n return { x: pt.x.plus(v.x.div(v.y).times(y.minus(pt.y))), y };\n};\nvar verticalIntersection = (pt, v, x) => {\n if (v.x.isZero()) return null;\n return { x, y: pt.y.plus(v.y.div(v.x).times(x.minus(pt.x))) };\n};\nvar intersection = (pt1, v1, pt2, v2) => {\n if (v1.x.isZero()) return verticalIntersection(pt2, v2, pt1.x);\n if (v2.x.isZero()) return verticalIntersection(pt1, v1, pt2.x);\n if (v1.y.isZero()) return horizontalIntersection(pt2, v2, pt1.y);\n if (v2.y.isZero()) return horizontalIntersection(pt1, v1, pt2.y);\n const kross = crossProduct(v1, v2);\n if (kross.isZero()) return null;\n const ve = { x: pt2.x.minus(pt1.x), y: pt2.y.minus(pt1.y) };\n const d1 = crossProduct(ve, v1).div(kross);\n const d2 = crossProduct(ve, v2).div(kross);\n const x1 = pt1.x.plus(d2.times(v1.x)), x2 = pt2.x.plus(d1.times(v2.x));\n const y1 = pt1.y.plus(d2.times(v1.y)), y2 = pt2.y.plus(d1.times(v2.y));\n const x = x1.plus(x2).div(2);\n const y = y1.plus(y2).div(2);\n return { x, y };\n};\n\n// src/sweep-event.ts\nvar SweepEvent = class _SweepEvent {\n point;\n isLeft;\n segment;\n otherSE;\n consumedBy;\n // for ordering sweep events in the sweep event queue\n static compare(a, b) {\n const ptCmp = _SweepEvent.comparePoints(a.point, b.point);\n if (ptCmp !== 0) return ptCmp;\n if (a.point !== b.point) a.link(b);\n if (a.isLeft !== b.isLeft) return a.isLeft ? 1 : -1;\n return Segment.compare(a.segment, b.segment);\n }\n // for ordering points in sweep line order\n static comparePoints(aPt, bPt) {\n if (aPt.x.isLessThan(bPt.x)) return -1;\n if (aPt.x.isGreaterThan(bPt.x)) return 1;\n if (aPt.y.isLessThan(bPt.y)) return -1;\n if (aPt.y.isGreaterThan(bPt.y)) return 1;\n return 0;\n }\n // Warning: 'point' input will be modified and re-used (for performance)\n constructor(point, isLeft) {\n if (point.events === void 0) point.events = [this];\n else point.events.push(this);\n this.point = point;\n this.isLeft = isLeft;\n }\n link(other) {\n if (other.point === this.point) {\n throw new Error(\"Tried to link already linked events\");\n }\n const otherEvents = other.point.events;\n for (let i = 0, iMax = otherEvents.length; i < iMax; i++) {\n const evt = otherEvents[i];\n this.point.events.push(evt);\n evt.point = this.point;\n }\n this.checkForConsuming();\n }\n /* Do a pass over our linked events and check to see if any pair\n * of segments match, and should be consumed. */\n checkForConsuming() {\n const numEvents = this.point.events.length;\n for (let i = 0; i < numEvents; i++) {\n const evt1 = this.point.events[i];\n if (evt1.segment.consumedBy !== void 0) continue;\n for (let j = i + 1; j < numEvents; j++) {\n const evt2 = this.point.events[j];\n if (evt2.consumedBy !== void 0) continue;\n if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;\n evt1.segment.consume(evt2.segment);\n }\n }\n }\n getAvailableLinkedEvents() {\n const events = [];\n for (let i = 0, iMax = this.point.events.length; i < iMax; i++) {\n const evt = this.point.events[i];\n if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {\n events.push(evt);\n }\n }\n return events;\n }\n /**\n * Returns a comparator function for sorting linked events that will\n * favor the event that will give us the smallest left-side angle.\n * All ring construction starts as low as possible heading to the right,\n * so by always turning left as sharp as possible we'll get polygons\n * without uncessary loops & holes.\n *\n * The comparator function has a compute cache such that it avoids\n * re-computing already-computed values.\n */\n getLeftmostComparator(baseEvent) {\n const cache = /* @__PURE__ */ new Map();\n const fillCache = (linkedEvent) => {\n const nextEvent = linkedEvent.otherSE;\n cache.set(linkedEvent, {\n sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),\n cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)\n });\n };\n return (a, b) => {\n if (!cache.has(a)) fillCache(a);\n if (!cache.has(b)) fillCache(b);\n const { sine: asine, cosine: acosine } = cache.get(a);\n const { sine: bsine, cosine: bcosine } = cache.get(b);\n if (asine.isGreaterThanOrEqualTo(0) && bsine.isGreaterThanOrEqualTo(0)) {\n if (acosine.isLessThan(bcosine)) return 1;\n if (acosine.isGreaterThan(bcosine)) return -1;\n return 0;\n }\n if (asine.isLessThan(0) && bsine.isLessThan(0)) {\n if (acosine.isLessThan(bcosine)) return -1;\n if (acosine.isGreaterThan(bcosine)) return 1;\n return 0;\n }\n if (bsine.isLessThan(asine)) return -1;\n if (bsine.isGreaterThan(asine)) return 1;\n return 0;\n };\n }\n};\n\n// src/geom-out.ts\nvar RingOut = class _RingOut {\n events;\n poly;\n _isExteriorRing;\n _enclosingRing;\n /* Given the segments from the sweep line pass, compute & return a series\n * of closed rings from all the segments marked to be part of the result */\n static factory(allSegments) {\n const ringsOut = [];\n for (let i = 0, iMax = allSegments.length; i < iMax; i++) {\n const segment = allSegments[i];\n if (!segment.isInResult() || segment.ringOut) continue;\n let prevEvent = null;\n let event = segment.leftSE;\n let nextEvent = segment.rightSE;\n const events = [event];\n const startingPoint = event.point;\n const intersectionLEs = [];\n while (true) {\n prevEvent = event;\n event = nextEvent;\n events.push(event);\n if (event.point === startingPoint) break;\n while (true) {\n const availableLEs = event.getAvailableLinkedEvents();\n if (availableLEs.length === 0) {\n const firstPt = events[0].point;\n const lastPt = events[events.length - 1].point;\n throw new Error(\n `Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`\n );\n }\n if (availableLEs.length === 1) {\n nextEvent = availableLEs[0].otherSE;\n break;\n }\n let indexLE = null;\n for (let j = 0, jMax = intersectionLEs.length; j < jMax; j++) {\n if (intersectionLEs[j].point === event.point) {\n indexLE = j;\n break;\n }\n }\n if (indexLE !== null) {\n const intersectionLE = intersectionLEs.splice(indexLE)[0];\n const ringEvents = events.splice(intersectionLE.index);\n ringEvents.unshift(ringEvents[0].otherSE);\n ringsOut.push(new _RingOut(ringEvents.reverse()));\n continue;\n }\n intersectionLEs.push({\n index: events.length,\n point: event.point\n });\n const comparator = event.getLeftmostComparator(prevEvent);\n nextEvent = availableLEs.sort(comparator)[0].otherSE;\n break;\n }\n }\n ringsOut.push(new _RingOut(events));\n }\n return ringsOut;\n }\n constructor(events) {\n this.events = events;\n for (let i = 0, iMax = events.length; i < iMax; i++) {\n events[i].segment.ringOut = this;\n }\n this.poly = null;\n }\n getGeom() {\n let prevPt = this.events[0].point;\n const points = [prevPt];\n for (let i = 1, iMax = this.events.length - 1; i < iMax; i++) {\n const pt2 = this.events[i].point;\n const nextPt2 = this.events[i + 1].point;\n if (precision.orient(pt2, prevPt, nextPt2) === 0) continue;\n points.push(pt2);\n prevPt = pt2;\n }\n if (points.length === 1) return null;\n const pt = points[0];\n const nextPt = points[1];\n if (precision.orient(pt, prevPt, nextPt) === 0) points.shift();\n points.push(points[0]);\n const step = this.isExteriorRing() ? 1 : -1;\n const iStart = this.isExteriorRing() ? 0 : points.length - 1;\n const iEnd = this.isExteriorRing() ? points.length : -1;\n const orderedPoints = [];\n for (let i = iStart; i != iEnd; i += step)\n orderedPoints.push([points[i].x.toNumber(), points[i].y.toNumber()]);\n return orderedPoints;\n }\n isExteriorRing() {\n if (this._isExteriorRing === void 0) {\n const enclosing = this.enclosingRing();\n this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;\n }\n return this._isExteriorRing;\n }\n enclosingRing() {\n if (this._enclosingRing === void 0) {\n this._enclosingRing = this._calcEnclosingRing();\n }\n return this._enclosingRing;\n }\n /* Returns the ring that encloses this one, if any */\n _calcEnclosingRing() {\n let leftMostEvt = this.events[0];\n for (let i = 1, iMax = this.events.length; i < iMax; i++) {\n const evt = this.events[i];\n if (SweepEvent.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;\n }\n let prevSeg = leftMostEvt.segment.prevInResult();\n let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;\n while (true) {\n if (!prevSeg) return null;\n if (!prevPrevSeg) return prevSeg.ringOut;\n if (prevPrevSeg.ringOut !== prevSeg.ringOut) {\n if (prevPrevSeg.ringOut?.enclosingRing() !== prevSeg.ringOut) {\n return prevSeg.ringOut;\n } else return prevSeg.ringOut?.enclosingRing();\n }\n prevSeg = prevPrevSeg.prevInResult();\n prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;\n }\n }\n};\nvar PolyOut = class {\n exteriorRing;\n interiorRings;\n constructor(exteriorRing) {\n this.exteriorRing = exteriorRing;\n exteriorRing.poly = this;\n this.interiorRings = [];\n }\n addInterior(ring) {\n this.interiorRings.push(ring);\n ring.poly = this;\n }\n getGeom() {\n const geom0 = this.exteriorRing.getGeom();\n if (geom0 === null) return null;\n const geom = [geom0];\n for (let i = 0, iMax = this.interiorRings.length; i < iMax; i++) {\n const ringGeom = this.interiorRings[i].getGeom();\n if (ringGeom === null) continue;\n geom.push(ringGeom);\n }\n return geom;\n }\n};\nvar MultiPolyOut = class {\n rings;\n polys;\n constructor(rings) {\n this.rings = rings;\n this.polys = this._composePolys(rings);\n }\n getGeom() {\n const geom = [];\n for (let i = 0, iMax = this.polys.length; i < iMax; i++) {\n const polyGeom = this.polys[i].getGeom();\n if (polyGeom === null) continue;\n geom.push(polyGeom);\n }\n return geom;\n }\n _composePolys(rings) {\n const polys = [];\n for (let i = 0, iMax = rings.length; i < iMax; i++) {\n const ring = rings[i];\n if (ring.poly) continue;\n if (ring.isExteriorRing()) polys.push(new PolyOut(ring));\n else {\n const enclosingRing = ring.enclosingRing();\n if (!enclosingRing?.poly) polys.push(new PolyOut(enclosingRing));\n enclosingRing?.poly?.addInterior(ring);\n }\n }\n return polys;\n }\n};\n\n// src/sweep-line.ts\nimport { SplayTreeSet as SplayTreeSet2 } from \"splaytree-ts\";\nvar SweepLine = class {\n queue;\n tree;\n segments;\n constructor(queue, comparator = Segment.compare) {\n this.queue = queue;\n this.tree = new SplayTreeSet2(comparator);\n this.segments = [];\n }\n process(event) {\n const segment = event.segment;\n const newEvents = [];\n if (event.consumedBy) {\n if (event.isLeft) this.queue.delete(event.otherSE);\n else this.tree.delete(segment);\n return newEvents;\n }\n if (event.isLeft) this.tree.add(segment);\n let prevSeg = segment;\n let nextSeg = segment;\n do {\n prevSeg = this.tree.lastBefore(prevSeg);\n } while (prevSeg != null && prevSeg.consumedBy != void 0);\n do {\n nextSeg = this.tree.firstAfter(nextSeg);\n } while (nextSeg != null && nextSeg.consumedBy != void 0);\n if (event.isLeft) {\n let prevMySplitter = null;\n if (prevSeg) {\n const prevInter = prevSeg.getIntersection(segment);\n if (prevInter !== null) {\n if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;\n if (!prevSeg.isAnEndpoint(prevInter)) {\n const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);\n for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {\n newEvents.push(newEventsFromSplit[i]);\n }\n }\n }\n }\n let nextMySplitter = null;\n if (nextSeg) {\n const nextInter = nextSeg.getIntersection(segment);\n if (nextInter !== null) {\n if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;\n if (!nextSeg.isAnEndpoint(nextInter)) {\n const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);\n for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {\n newEvents.push(newEventsFromSplit[i]);\n }\n }\n }\n }\n if (prevMySplitter !== null || nextMySplitter !== null) {\n let mySplitter = null;\n if (prevMySplitter === null) mySplitter = nextMySplitter;\n else if (nextMySplitter === null) mySplitter = prevMySplitter;\n else {\n const cmpSplitters = SweepEvent.comparePoints(\n prevMySplitter,\n nextMySplitter\n );\n mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;\n }\n this.queue.delete(segment.rightSE);\n newEvents.push(segment.rightSE);\n const newEventsFromSplit = segment.split(mySplitter);\n for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {\n newEvents.push(newEventsFromSplit[i]);\n }\n }\n if (newEvents.length > 0) {\n this.tree.delete(segment);\n newEvents.push(event);\n } else {\n this.segments.push(segment);\n segment.prev = prevSeg;\n }\n } else {\n if (prevSeg && nextSeg) {\n const inter = prevSeg.getIntersection(nextSeg);\n if (inter !== null) {\n if (!prevSeg.isAnEndpoint(inter)) {\n const newEventsFromSplit = this._splitSafely(prevSeg, inter);\n for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {\n newEvents.push(newEventsFromSplit[i]);\n }\n }\n if (!nextSeg.isAnEndpoint(inter)) {\n const newEventsFromSplit = this._splitSafely(nextSeg, inter);\n for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {\n newEvents.push(newEventsFromSplit[i]);\n }\n }\n }\n }\n this.tree.delete(segment);\n }\n return newEvents;\n }\n /* Safely split a segment that is currently in the datastructures\n * IE - a segment other than the one that is currently being processed. */\n _splitSafely(seg, pt) {\n this.tree.delete(seg);\n const rightSE = seg.rightSE;\n this.queue.delete(rightSE);\n const newEvents = seg.split(pt);\n newEvents.push(rightSE);\n if (seg.consumedBy === void 0) this.tree.add(seg);\n return newEvents;\n }\n};\n\n// src/operation.ts\nvar Operation = class {\n type;\n numMultiPolys;\n run(type, geom, moreGeoms) {\n operation.type = type;\n const multipolys = [new MultiPolyIn(geom, true)];\n for (let i = 0, iMax = moreGeoms.length; i < iMax; i++) {\n multipolys.push(new MultiPolyIn(moreGeoms[i], false));\n }\n operation.numMultiPolys = multipolys.length;\n if (operation.type === \"difference\") {\n const subject = multipolys[0];\n let i = 1;\n while (i < multipolys.length) {\n if (getBboxOverlap(multipolys[i].bbox, subject.bbox) !== null) i++;\n else multipolys.splice(i, 1);\n }\n }\n if (operation.type === \"intersection\") {\n for (let i = 0, iMax = multipolys.length; i < iMax; i++) {\n const mpA = multipolys[i];\n for (let j = i + 1, jMax = multipolys.length; j < jMax; j++) {\n if (getBboxOverlap(mpA.bbox, multipolys[j].bbox) === null) return [];\n }\n }\n }\n const queue = new SplayTreeSet3(SweepEvent.compare);\n for (let i = 0, iMax = multipolys.length; i < iMax; i++) {\n const sweepEvents = multipolys[i].getSweepEvents();\n for (let j = 0, jMax = sweepEvents.length; j < jMax; j++) {\n queue.add(sweepEvents[j]);\n }\n }\n const sweepLine = new SweepLine(queue);\n let evt = null;\n if (queue.size != 0) {\n evt = queue.first();\n queue.delete(evt);\n }\n while (evt) {\n const newEvents = sweepLine.process(evt);\n for (let i = 0, iMax = newEvents.length; i < iMax; i++) {\n const evt2 = newEvents[i];\n if (evt2.consumedBy === void 0) queue.add(evt2);\n }\n if (queue.size != 0) {\n evt = queue.first();\n queue.delete(evt);\n } else {\n evt = null;\n }\n }\n precision.reset();\n const ringsOut = RingOut.factory(sweepLine.segments);\n const result = new MultiPolyOut(ringsOut);\n return result.getGeom();\n }\n};\nvar operation = new Operation();\nvar operation_default = operation;\n\n// src/segment.ts\nvar segmentId = 0;\nvar Segment = class _Segment {\n id;\n leftSE;\n rightSE;\n rings;\n windings;\n ringOut;\n consumedBy;\n prev;\n _prevInResult;\n _beforeState;\n _afterState;\n _isInResult;\n /* This compare() function is for ordering segments in the sweep\n * line tree, and does so according to the following criteria:\n *\n * Consider the vertical line that lies an infinestimal step to the\n * right of the right-more of the two left endpoints of the input\n * segments. Imagine slowly moving a point up from negative infinity\n * in the increasing y direction. Which of the two segments will that\n * point intersect first? That segment comes 'before' the other one.\n *\n * If neither segment would be intersected by such a line, (if one\n * or more of the segments are vertical) then the line to be considered\n * is directly on the right-more of the two left inputs.\n */\n static compare(a, b) {\n const alx = a.leftSE.point.x;\n const blx = b.leftSE.point.x;\n const arx = a.rightSE.point.x;\n const brx = b.rightSE.point.x;\n if (brx.isLessThan(alx)) return 1;\n if (arx.isLessThan(blx)) return -1;\n const aly = a.leftSE.point.y;\n const bly = b.leftSE.point.y;\n const ary = a.rightSE.point.y;\n const bry = b.rightSE.point.y;\n if (alx.isLessThan(blx)) {\n if (bly.isLessThan(aly) && bly.isLessThan(ary)) return 1;\n if (bly.isGreaterThan(aly) && bly.isGreaterThan(ary)) return -1;\n const aCmpBLeft = a.comparePoint(b.leftSE.point);\n if (aCmpBLeft < 0) return 1;\n if (aCmpBLeft > 0) return -1;\n const bCmpARight = b.comparePoint(a.rightSE.point);\n if (bCmpARight !== 0) return bCmpARight;\n return -1;\n }\n if (alx.isGreaterThan(blx)) {\n if (aly.isLessThan(bly) && aly.isLessThan(bry)) return -1;\n if (aly.isGreaterThan(bly) && aly.isGreaterThan(bry)) return 1;\n const bCmpALeft = b.comparePoint(a.leftSE.point);\n if (bCmpALeft !== 0) return bCmpALeft;\n const aCmpBRight = a.comparePoint(b.rightSE.point);\n if (aCmpBRight < 0) return 1;\n if (aCmpBRight > 0) return -1;\n return 1;\n }\n if (aly.isLessThan(bly)) return -1;\n if (aly.isGreaterThan(bly)) return 1;\n if (arx.isLessThan(brx)) {\n const bCmpARight = b.comparePoint(a.rightSE.point);\n if (bCmpARight !== 0) return bCmpARight;\n }\n if (arx.isGreaterThan(brx)) {\n const aCmpBRight = a.comparePoint(b.rightSE.point);\n if (aCmpBRight < 0) return 1;\n if (aCmpBRight > 0) return -1;\n }\n if (!arx.eq(brx)) {\n const ay = ary.minus(aly);\n const ax = arx.minus(alx);\n const by = bry.minus(bly);\n const bx = brx.minus(blx);\n if (ay.isGreaterThan(ax) && by.isLessThan(bx)) return 1;\n if (ay.isLessThan(ax) && by.isGreaterThan(bx)) return -1;\n }\n if (arx.isGreaterThan(brx)) return 1;\n if (arx.isLessThan(brx)) return -1;\n if (ary.isLessThan(bry)) return -1;\n if (ary.isGreaterThan(bry)) return 1;\n if (a.id < b.id) return -1;\n if (a.id > b.id) return 1;\n return 0;\n }\n /* Warning: a reference to ringWindings input will be stored,\n * and possibly will be later modified */\n constructor(leftSE, rightSE, rings, windings) {\n this.id = ++segmentId;\n this.leftSE = leftSE;\n leftSE.segment = this;\n leftSE.otherSE = rightSE;\n this.rightSE = rightSE;\n rightSE.segment = this;\n rightSE.otherSE = leftSE;\n this.rings = rings;\n this.windings = windings;\n }\n static fromRing(pt1, pt2, ring) {\n let leftPt, rightPt, winding;\n const cmpPts = SweepEvent.comparePoints(pt1, pt2);\n if (cmpPts < 0) {\n leftPt = pt1;\n rightPt = pt2;\n winding = 1;\n } else if (cmpPts > 0) {\n leftPt = pt2;\n rightPt = pt1;\n winding = -1;\n } else\n throw new Error(\n `Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`\n );\n const leftSE = new SweepEvent(leftPt, true);\n const rightSE = new SweepEvent(rightPt, false);\n return new _Segment(leftSE, rightSE, [ring], [winding]);\n }\n /* When a segment is split, the rightSE is replaced with a new sweep event */\n replaceRightSE(newRightSE) {\n this.rightSE = newRightSE;\n this.rightSE.segment = this;\n this.rightSE.otherSE = this.leftSE;\n this.leftSE.otherSE = this.rightSE;\n }\n bbox() {\n const y1 = this.leftSE.point.y;\n const y2 = this.rightSE.point.y;\n return {\n ll: { x: this.leftSE.point.x, y: y1.isLessThan(y2) ? y1 : y2 },\n ur: { x: this.rightSE.point.x, y: y1.isGreaterThan(y2) ? y1 : y2 }\n };\n }\n /* A vector from the left point to the right */\n vector() {\n return {\n x: this.rightSE.point.x.minus(this.leftSE.point.x),\n y: this.rightSE.point.y.minus(this.leftSE.point.y)\n };\n }\n isAnEndpoint(pt) {\n return pt.x.eq(this.leftSE.point.x) && pt.y.eq(this.leftSE.point.y) || pt.x.eq(this.rightSE.point.x) && pt.y.eq(this.rightSE.point.y);\n }\n /* Compare this segment with a point.\n *\n * A point P is considered to be colinear to a segment if there\n * exists a distance D such that if we travel along the segment\n * from one * endpoint towards the other a distance D, we find\n * ourselves at point P.\n *\n * Return value indicates:\n *\n * 1: point lies above the segment (to the left of vertical)\n * 0: point is colinear to segment\n * -1: point lies below the segment (to the right of vertical)\n */\n comparePoint(point) {\n return precision.orient(this.leftSE.point, point, this.rightSE.point);\n }\n /**\n * Given another segment, returns the first non-trivial intersection\n * between the two segments (in terms of sweep line ordering), if it exists.\n *\n * A 'non-trivial' intersection is one that will cause one or both of the\n * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:\n *\n * * endpoint of segA with endpoint of segB --> trivial\n * * endpoint of segA with point along segB --> non-trivial\n * * endpoint of segB with point along segA --> non-trivial\n * * point along segA with point along segB --> non-trivial\n *\n * If no non-trivial intersection exists, return null\n * Else, return null.\n */\n getIntersection(other) {\n const tBbox = this.bbox();\n const oBbox = other.bbox();\n const bboxOverlap = getBboxOverlap(tBbox, oBbox);\n if (bboxOverlap === null) return null;\n const tlp = this.leftSE.point;\n const trp = this.rightSE.point;\n const olp = other.leftSE.point;\n const orp = other.rightSE.point;\n const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;\n const touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;\n const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;\n const touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;\n if (touchesThisLSE && touchesOtherLSE) {\n if (touchesThisRSE && !touchesOtherRSE) return trp;\n if (!touchesThisRSE && touchesOtherRSE) return orp;\n return null;\n }\n if (touchesThisLSE) {\n if (touchesOtherRSE) {\n if (tlp.x.eq(orp.x) && tlp.y.eq(orp.y)) return null;\n }\n return tlp;\n }\n if (touchesOtherLSE) {\n if (touchesThisRSE) {\n if (trp.x.eq(olp.x) && trp.y.eq(olp.y)) return null;\n }\n return olp;\n }\n if (touchesThisRSE && touchesOtherRSE) return null;\n if (touchesThisRSE) return trp;\n if (touchesOtherRSE) return orp;\n const pt = intersection(tlp, this.vector(), olp, other.vector());\n if (pt === null) return null;\n if (!isInBbox(bboxOverlap, pt)) return null;\n return precision.snap(pt);\n }\n /**\n * Split the given segment into multiple segments on the given points.\n * * Each existing segment will retain its leftSE and a new rightSE will be\n * generated for it.\n * * A new segment will be generated which will adopt the original segment's\n * rightSE, and a new leftSE will be generated for it.\n * * If there are more than two points given to split on, new segments\n * in the middle will be generated with new leftSE and rightSE's.\n * * An array of the newly generated SweepEvents will be returned.\n *\n * Warning: input array of points is modified\n */\n split(point) {\n const newEvents = [];\n const alreadyLinked = point.events !== void 0;\n const newLeftSE = new SweepEvent(point, true);\n const newRightSE = new SweepEvent(point, false);\n const oldRightSE = this.rightSE;\n this.replaceRightSE(newRightSE);\n newEvents.push(newRightSE);\n newEvents.push(newLeftSE);\n const newSeg = new _Segment(\n newLeftSE,\n oldRightSE,\n this.rings.slice(),\n this.windings.slice()\n );\n if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {\n newSeg.swapEvents();\n }\n if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {\n this.swapEvents();\n }\n if (alreadyLinked) {\n newLeftSE.checkForConsuming();\n newRightSE.checkForConsuming();\n }\n return newEvents;\n }\n /* Swap which event is left and right */\n swapEvents() {\n const tmpEvt = this.rightSE;\n this.rightSE = this.leftSE;\n this.leftSE = tmpEvt;\n this.leftSE.isLeft = true;\n this.rightSE.isLeft = false;\n for (let i = 0, iMax = this.windings.length; i < iMax; i++) {\n this.windings[i] *= -1;\n }\n }\n /* Consume another segment. We take their rings under our wing\n * and mark them as consumed. Use for perfectly overlapping segments */\n consume(other) {\n let consumer = this;\n let consumee = other;\n while (consumer.consumedBy) consumer = consumer.consumedBy;\n while (consumee.consumedBy) consumee = consumee.consumedBy;\n const cmp = _Segment.compare(consumer, consumee);\n if (cmp === 0) return;\n if (cmp > 0) {\n const tmp = consumer;\n consumer = consumee;\n consumee = tmp;\n }\n if (consumer.prev === consumee) {\n const tmp = consumer;\n consumer = consumee;\n consumee = tmp;\n }\n for (let i = 0, iMax = consumee.rings.length; i < iMax; i++) {\n const ring = consumee.rings[i];\n const winding = consumee.windings[i];\n const index = consumer.rings.indexOf(ring);\n if (index === -1) {\n consumer.rings.push(ring);\n consumer.windings.push(winding);\n } else consumer.windings[index] += winding;\n }\n consumee.rings = null;\n consumee.windings = null;\n consumee.consumedBy = consumer;\n consumee.leftSE.consumedBy = consumer.leftSE;\n consumee.rightSE.consumedBy = consumer.rightSE;\n }\n /* The first segment previous segment chain that is in the result */\n prevInResult() {\n if (this._prevInResult !== void 0) return this._prevInResult;\n if (!this.prev) this._prevInResult = null;\n else if (this.prev.isInResult()) this._prevInResult = this.prev;\n else this._prevInResult = this.prev.prevInResult();\n return this._prevInResult;\n }\n beforeState() {\n if (this._beforeState !== void 0) return this._beforeState;\n if (!this.prev)\n this._beforeState = {\n rings: [],\n windings: [],\n multiPolys: []\n };\n else {\n const seg = this.prev.consumedBy || this.prev;\n this._beforeState = seg.afterState();\n }\n return this._beforeState;\n }\n afterState() {\n if (this._afterState !== void 0) return this._afterState;\n const beforeState = this.beforeState();\n this._afterState = {\n rings: beforeState.rings.slice(0),\n windings: beforeState.windings.slice(0),\n multiPolys: []\n };\n const ringsAfter = this._afterState.rings;\n const windingsAfter = this._afterState.windings;\n const mpsAfter = this._afterState.multiPolys;\n for (let i = 0, iMax = this.rings.length; i < iMax; i++) {\n const ring = this.rings[i];\n const winding = this.windings[i];\n const index = ringsAfter.indexOf(ring);\n if (index === -1) {\n ringsAfter.push(ring);\n windingsAfter.push(winding);\n } else windingsAfter[index] += winding;\n }\n const polysAfter = [];\n const polysExclude = [];\n for (let i = 0, iMax = ringsAfter.length; i < iMax; i++) {\n if (windingsAfter[i] === 0) continue;\n const ring = ringsAfter[i];\n const poly = ring.poly;\n if (polysExclude.indexOf(poly) !== -1) continue;\n if (ring.isExterior) polysAfter.push(poly);\n else {\n if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);\n const index = polysAfter.indexOf(ring.poly);\n if (index !== -1) polysAfter.splice(index, 1);\n }\n }\n for (let i = 0, iMax = polysAfter.length; i < iMax; i++) {\n const mp = polysAfter[i].multiPoly;\n if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);\n }\n return this._afterState;\n }\n /* Is this segment part of the final result? */\n isInResult() {\n if (this.consumedBy) return false;\n if (this._isInResult !== void 0) return this._isInResult;\n const mpsBefore = this.beforeState().multiPolys;\n const mpsAfter = this.afterState().multiPolys;\n switch (operation_default.type) {\n case \"union\": {\n const noBefores = mpsBefore.length === 0;\n const noAfters = mpsAfter.length === 0;\n this._isInResult = noBefores !== noAfters;\n break;\n }\n case \"intersection\": {\n let least;\n let most;\n if (mpsBefore.length < mpsAfter.length) {\n least = mpsBefore.length;\n most = mpsAfter.length;\n } else {\n least = mpsAfter.length;\n most = mpsBefore.length;\n }\n this._isInResult = most === operation_default.numMultiPolys && least < most;\n break;\n }\n case \"xor\": {\n const diff = Math.abs(mpsBefore.length - mpsAfter.length);\n this._isInResult = diff % 2 === 1;\n break;\n }\n case \"difference\": {\n const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;\n this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);\n break;\n }\n }\n return this._isInResult;\n }\n};\n\n// src/geom-in.ts\nvar RingIn = class {\n poly;\n isExterior;\n segments;\n bbox;\n constructor(geomRing, poly, isExterior) {\n if (!Array.isArray(geomRing) || geomRing.length === 0) {\n throw new Error(\"Input geometry is not a valid Polygon or MultiPolygon\");\n }\n this.poly = poly;\n this.isExterior = isExterior;\n this.segments = [];\n if (typeof geomRing[0][0] !== \"number\" || typeof geomRing[0][1] !== \"number\") {\n throw new Error(\"Input geometry is not a valid Polygon or MultiPolygon\");\n }\n const firstPoint = precision.snap({ x: new BigNumber2(geomRing[0][0]), y: new BigNumber2(geomRing[0][1]) });\n this.bbox = {\n ll: { x: firstPoint.x, y: firstPoint.y },\n ur: { x: firstPoint.x, y: firstPoint.y }\n };\n let prevPoint = firstPoint;\n for (let i = 1, iMax = geomRing.length; i < iMax; i++) {\n if (typeof geomRing[i][0] !== \"number\" || typeof geomRing[i][1] !== \"number\") {\n throw new Error(\"Input geometry is not a valid Polygon or MultiPolygon\");\n }\n const point = precision.snap({ x: new BigNumber2(geomRing[i][0]), y: new BigNumber2(geomRing[i][1]) });\n if (point.x.eq(prevPoint.x) && point.y.eq(prevPoint.y)) continue;\n this.segments.push(Segment.fromRing(prevPoint, point, this));\n if (point.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = point.x;\n if (point.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = point.y;\n if (point.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = point.x;\n if (point.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = point.y;\n prevPoint = point;\n }\n if (!firstPoint.x.eq(prevPoint.x) || !firstPoint.y.eq(prevPoint.y)) {\n this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));\n }\n }\n getSweepEvents() {\n const sweepEvents = [];\n for (let i = 0, iMax = this.segments.length; i < iMax; i++) {\n const segment = this.segments[i];\n sweepEvents.push(segment.leftSE);\n sweepEvents.push(segment.rightSE);\n }\n return sweepEvents;\n }\n};\nvar PolyIn = class {\n multiPoly;\n exteriorRing;\n interiorRings;\n bbox;\n constructor(geomPoly, multiPoly) {\n if (!Array.isArray(geomPoly)) {\n throw new Error(\"Input geometry is not a valid Polygon or MultiPolygon\");\n }\n this.exteriorRing = new RingIn(geomPoly[0], this, true);\n this.bbox = {\n ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },\n ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }\n };\n this.interiorRings = [];\n for (let i = 1, iMax = geomPoly.length; i < iMax; i++) {\n const ring = new RingIn(geomPoly[i], this, false);\n if (ring.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = ring.bbox.ll.x;\n if (ring.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = ring.bbox.ll.y;\n if (ring.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = ring.bbox.ur.x;\n if (ring.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = ring.bbox.ur.y;\n this.interiorRings.push(ring);\n }\n this.multiPoly = multiPoly;\n }\n getSweepEvents() {\n const sweepEvents = this.exteriorRing.getSweepEvents();\n for (let i = 0, iMax = this.interiorRings.length; i < iMax; i++) {\n const ringSweepEvents = this.interiorRings[i].getSweepEvents();\n for (let j = 0, jMax = ringSweepEvents.length; j < jMax; j++) {\n sweepEvents.push(ringSweepEvents[j]);\n }\n }\n return sweepEvents;\n }\n};\nvar MultiPolyIn = class {\n isSubject;\n polys;\n bbox;\n constructor(geom, isSubject) {\n if (!Array.isArray(geom)) {\n throw new Error(\"Input geometry is not a valid Polygon or MultiPolygon\");\n }\n try {\n if (typeof geom[0][0][0] === \"number\") geom = [geom];\n } catch (ex) {\n }\n this.polys = [];\n this.bbox = {\n ll: { x: new BigNumber2(Number.POSITIVE_INFINITY), y: new BigNumber2(Number.POSITIVE_INFINITY) },\n ur: { x: new BigNumber2(Number.NEGATIVE_INFINITY), y: new BigNumber2(Number.NEGATIVE_INFINITY) }\n };\n for (let i = 0, iMax = geom.length; i < iMax; i++) {\n const poly = new PolyIn(geom[i], this);\n if (poly.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = poly.bbox.ll.x;\n if (poly.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = poly.bbox.ll.y;\n if (poly.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = poly.bbox.ur.x;\n if (poly.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = poly.bbox.ur.y;\n this.polys.push(poly);\n }\n this.isSubject = isSubject;\n }\n getSweepEvents() {\n const sweepEvents = [];\n for (let i = 0, iMax = this.polys.length; i < iMax; i++) {\n const polySweepEvents = this.polys[i].getSweepEvents();\n for (let j = 0, jMax = polySweepEvents.length; j < jMax; j++) {\n sweepEvents.push(polySweepEvents[j]);\n }\n }\n return sweepEvents;\n }\n};\n\n// src/index.ts\nvar union = (geom, ...moreGeoms) => operation_default.run(\"union\", geom, moreGeoms);\nvar intersection2 = (geom, ...moreGeoms) => operation_default.run(\"intersection\", geom, moreGeoms);\nvar xor = (geom, ...moreGeoms) => operation_default.run(\"xor\", geom, moreGeoms);\nvar difference = (geom, ...moreGeoms) => operation_default.run(\"difference\", geom, moreGeoms);\nvar setPrecision = precision.set;\nexport {\n difference,\n intersection2 as intersection,\n setPrecision,\n union,\n xor\n};\n//# sourceMappingURL=index.js.map"],"names":["constant_default","x","compare_default","eps","almostEqual","a","b","orient_default","almostCollinear","area2","ax","ay","cx","cy","c","identity_default","snap_default","xTree","SplayTreeSet","yTree","snapCoord","coord","tree","snap","v","BigNumber","set","eps2","precision","isInBbox","bbox","point","getBboxOverlap","b1","b2","lowerX","upperX","lowerY","upperY","crossProduct","dotProduct","length","sineOfAngle","pShared","pBase","pAngle","vBase","vAngle","cosineOfAngle","horizontalIntersection","pt","y","verticalIntersection","intersection","pt1","v1","pt2","v2","kross","ve","d1","d2","x1","x2","y1","y2","SweepEvent","_SweepEvent","isLeft","__publicField","ptCmp","Segment","aPt","bPt","other","otherEvents","iMax","evt","numEvents","i","evt1","j","evt2","events","baseEvent","cache","fillCache","linkedEvent","nextEvent","asine","acosine","bsine","bcosine","RingOut","_RingOut","allSegments","ringsOut","segment","prevEvent","event","startingPoint","intersectionLEs","availableLEs","firstPt","lastPt","indexLE","jMax","intersectionLE","ringEvents","comparator","prevPt","points","nextPt2","nextPt","step","iStart","iEnd","orderedPoints","enclosing","leftMostEvt","prevSeg","prevPrevSeg","_a","_b","PolyOut","exteriorRing","ring","geom0","geom","ringGeom","MultiPolyOut","rings","polyGeom","polys","enclosingRing","SweepLine","queue","SplayTreeSet2","newEvents","nextSeg","prevMySplitter","prevInter","newEventsFromSplit","nextMySplitter","nextInter","mySplitter","inter","seg","rightSE","Operation","type","moreGeoms","operation","multipolys","MultiPolyIn","subject","mpA","SplayTreeSet3","sweepEvents","sweepLine","operation_default","segmentId","_Segment","leftSE","windings","alx","blx","arx","brx","aly","bly","ary","bry","aCmpBLeft","bCmpARight","bCmpALeft","aCmpBRight","by","bx","leftPt","rightPt","winding","cmpPts","newRightSE","tBbox","oBbox","bboxOverlap","tlp","trp","olp","orp","touchesOtherLSE","touchesThisLSE","touchesOtherRSE","touchesThisRSE","alreadyLinked","newLeftSE","oldRightSE","newSeg","tmpEvt","consumer","consumee","cmp","tmp","index","beforeState","ringsAfter","windingsAfter","mpsAfter","polysAfter","polysExclude","poly","mp","mpsBefore","noBefores","noAfters","least","most","diff","isJustSubject","mps","RingIn","geomRing","isExterior","firstPoint","BigNumber2","prevPoint","PolyIn","geomPoly","multiPoly","ringSweepEvents","isSubject","polySweepEvents","intersection2"],"mappings":"2kBAIA,IAAIA,EAAoBC,GACf,IACEA,EAKPC,EAAmBC,GAAQ,CAC7B,MAAMC,EAAcD,EAAM,CAACE,EAAGC,IAAMA,EAAE,MAAMD,CAAC,EAAE,IAAK,EAAC,oBAAoBF,CAAG,EAAIH,EAAiB,EAAK,EACtG,MAAO,CAACK,EAAGC,IACLF,EAAYC,EAAGC,CAAC,EAAU,EACvBD,EAAE,WAAWC,CAAC,CAEzB,EAGA,SAASC,EAAeJ,EAAK,CAC3B,MAAMK,EAAkBL,EAAM,CAACM,EAAOC,EAAIC,EAAIC,EAAIC,IAAOJ,EAAM,gBAAgB,CAAC,EAAE,oBAChFG,EAAG,MAAMF,CAAE,EAAE,gBAAgB,CAAC,EAAE,KAAKG,EAAG,MAAMF,CAAE,EAAE,gBAAgB,CAAC,CAAC,EAAE,MAAMR,CAAG,CACnF,EAAMH,EAAiB,EAAK,EAC1B,MAAO,CAACK,EAAGC,EAAGQ,IAAM,CAClB,MAAMJ,EAAKL,EAAE,EAAGM,EAAKN,EAAE,EAAGO,EAAKE,EAAE,EAAGD,EAAKC,EAAE,EACrCL,EAAQE,EAAG,MAAME,CAAE,EAAE,MAAMP,EAAE,EAAE,MAAMM,CAAE,CAAC,EAAE,MAAMF,EAAG,MAAME,CAAE,EAAE,MAAMN,EAAE,EAAE,MAAMO,CAAE,CAAC,CAAC,EACvF,OAAIL,EAAgBC,EAAOC,EAAIC,EAAIC,EAAIC,CAAE,EAAU,EAC5CJ,EAAM,WAAW,CAAC,CAC1B,CACH,CAOA,IAAIM,EAAoBd,GACfA,EAILe,EAAgBb,GAAQ,CAC1B,GAAIA,EAAK,CACP,MAAMc,EAAQ,IAAIC,EAAahB,EAAgBC,CAAG,CAAC,EAC7CgB,EAAQ,IAAID,EA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