{ "pandav:/geojson-vt-dev.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/geojson-vt-dev\", [], function (module, exports, require, load, process, global) {\n\n function _typeof(o) {\"@babel/helpers - typeof\";return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;}, _typeof(o);}\n (function (global, factory) {\n (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.geojsonvt = factory());\n })(void 0, function () {\n 'use strict';\n function simplify(coords, first, last, sqTolerance, stride) {\n if (stride === void 0) stride = 3;\n var maxSqDist = sqTolerance;\n var mid = last - first >> 1;\n var minPosToMid = last - first;\n var index;\n var ax = coords[first];\n var ay = coords[first + 1];\n var bx = coords[last];\n var by = coords[last + 1];\n for (var i = first + stride; i < last; i += stride) {\n var d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by);\n if (d > maxSqDist) {\n index = i;\n maxSqDist = d;\n } else if (d === maxSqDist) {\n var posToMid = Math.abs(i - mid);\n if (posToMid < minPosToMid) {\n index = i;\n minPosToMid = posToMid;\n }\n }\n }\n if (maxSqDist > sqTolerance) {\n if (index - first > stride) {\n simplify(coords, first, index, sqTolerance, stride);\n }\n coords[index + 2] = maxSqDist;\n if (last - index > stride) {\n simplify(coords, index, last, sqTolerance, stride);\n }\n }\n }\n function getSqSegDist(px, py, x, y, bx, by) {\n var dx = bx - x;\n var dy = by - y;\n if (dx !== 0 || dy !== 0) {\n var t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x = bx;\n y = by;\n } else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n dx = px - x;\n dy = py - y;\n return dx * dx + dy * dy;\n }\n function createFeature(id, type, geom, tags, layer, hasAltitude) {\n var feature = {\n id: id == null ? null : id,\n type: type,\n geometry: geom,\n tags: tags,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity };\n\n if (layer) {\n feature.layer = layer;\n }\n var stride = hasAltitude ? 4 : 3;\n calcBBox(feature, stride);\n return feature;\n }\n function calcBBox(feature, stride) {\n var geom = feature.geometry;\n var type = feature.type;\n if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {\n calcLineBBox(feature, geom, stride);\n } else if (type === 'Polygon') {\n calcLineBBox(feature, geom[0], stride);\n } else if (type === 'MultiLineString') {\n for (var i = 0, list = geom; i < list.length; i += 1) {\n var line = list[i];\n calcLineBBox(feature, line, stride);\n }\n } else if (type === 'MultiPolygon') {\n for (var i$1 = 0, list$1 = geom; i$1 < list$1.length; i$1 += 1) {\n var polygon = list$1[i$1];\n calcLineBBox(feature, polygon[0], stride);\n }\n }\n return feature;\n }\n function calcLineBBox(feature, geom, stride) {\n for (var i = 0; i < geom.length; i += stride) {\n feature.minX = Math.min(feature.minX, geom[i]);\n feature.minY = Math.min(feature.minY, geom[i + 1]);\n feature.maxX = Math.max(feature.maxX, geom[i]);\n feature.maxY = Math.max(feature.maxY, geom[i + 1]);\n }\n }\n function convert(data, options) {\n var features = [];\n if (Array.isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n convertLayerData(features, data[i].layer, data[i].data, options);\n }\n return features;\n }\n if (data.type === 'FeatureCollection') {\n for (var i$1 = 0; i$1 < data.features.length; i$1++) {\n convertFeature(features, data.features[i$1], options, i$1);\n }\n } else if (data.type === 'Feature') {\n convertFeature(features, data, options);\n } else {\n convertFeature(features, {\n geometry: data },\n options);\n }\n return features;\n }\n function convertLayerData(features, layer, data, options) {\n options.layer = layer;\n if (data.type === 'FeatureCollection') {\n for (var i = 0; i < data.features.length; i++) {\n convertFeature(features, data.features[i], options, i);\n }\n } else if (data.type === 'Feature') {\n convertFeature(features, data, options);\n } else {\n convertFeature(features, {\n geometry: data },\n options);\n }\n }\n function convertFeature(features, geojson, options, index) {\n if (!geojson.geometry) {\n return;\n }\n var coords = geojson.geometry.coordinates;\n var type = geojson.geometry.type;\n var tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2);\n var geometry = [];\n var id = geojson.id;\n if (options.promoteId) {\n id = geojson.properties[options.promoteId];\n } else if (options.generateId) {\n id = index || 0;\n }\n if (type === 'Point') {\n convertPoint(coords, geometry, options);\n } else if (type === 'MultiPoint') {\n for (var i = 0, list = coords; i < list.length; i += 1) {\n var p = list[i];\n convertPoint(p, geometry, options);\n }\n } else if (type === 'LineString') {\n convertLine(coords, geometry, tolerance, false, options);\n } else if (type === 'MultiLineString') {\n if (options.lineMetrics) {\n for (var i$1 = 0, list$1 = coords; i$1 < list$1.length; i$1 += 1) {\n var line = list$1[i$1];\n geometry = [];\n convertLine(line, geometry, tolerance, false, options);\n features.push(createFeature(id, 'LineString', geometry, geojson.properties, options.layer, options.hasAltitude));\n }\n return;\n } else {\n convertLines(coords, geometry, tolerance, false, options);\n }\n } else if (type === 'Polygon') {\n convertLines(coords, geometry, tolerance, true, options);\n } else if (type === 'MultiPolygon') {\n for (var i$2 = 0, list$2 = coords; i$2 < list$2.length; i$2 += 1) {\n var polygon = list$2[i$2];\n var newPolygon = [];\n convertLines(polygon, newPolygon, tolerance, true, options);\n geometry.push(newPolygon);\n }\n } else if (type === 'GeometryCollection') {\n for (var i$3 = 0, list$3 = geojson.geometry.geometries; i$3 < list$3.length; i$3 += 1) {\n var singleGeometry = list$3[i$3];\n convertFeature(features, {\n id: id,\n geometry: singleGeometry,\n properties: geojson.properties },\n options, index);\n }\n return;\n } else {\n throw new Error('Input data is not a valid GeoJSON object.');\n }\n features.push(createFeature(id, type, geometry, geojson.properties, options.layer, options.hasAltitude));\n }\n function convertPoint(coords, out, options) {\n out.push(projectX(coords[0]), projectY(coords[1], options.projection), 0);\n if (options.hasAltitude) {\n if (coords.length > 2) {\n out.push(coords[2]);\n } else {\n out.push(0);\n }\n }\n }\n function convertLine(ring, out, tolerance, isPolygon, options) {\n var x0, y0;\n var size = 0;\n for (var j = 0; j < ring.length; j++) {\n var x = projectX(ring[j][0]);\n var y = projectY(ring[j][1], options.projection);\n out.push(x, y, 0);\n if (options.hasAltitude) {\n if (ring[j].length > 2) {\n out.push(ring[j][2]);\n } else {\n out.push(0);\n }\n }\n if (j > 0) {\n if (isPolygon) {\n size += (x0 * y - x * y0) / 2;\n } else {\n size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2));\n }\n }\n x0 = x;\n y0 = y;\n }\n var stride = options.hasAltitude ? 4 : 3;\n var last = out.length - stride;\n out[2] = 1;\n simplify(out, 0, last, tolerance, stride);\n out[last + 2] = 1;\n out.size = Math.abs(size);\n out.start = 0;\n out.end = out.size;\n }\n function convertLines(rings, out, tolerance, isPolygon, options) {\n for (var i = 0; i < rings.length; i++) {\n var geom = [];\n convertLine(rings[i], geom, tolerance, isPolygon, options);\n out.push(geom);\n }\n }\n function projectX(x) {\n return x / 360 + 0.5;\n }\n function projectY(y, proj) {\n switch (proj) {\n case 'EPSG:4326':\n return (90 - y) / 360.0;}\n\n var sin = Math.sin(y * Math.PI / 180);\n var y2 = 0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI;\n return y2 < 0 ? 0 : y2 > 1 ? 1 : y2;\n }\n function clip(features, scale, k1, k2, axis, minAll, maxAll, options) {\n k1 /= scale;\n k2 /= scale;\n if (minAll >= k1 && maxAll < k2) {\n return features;\n } else if (maxAll < k1 || minAll >= k2) {\n return null;\n }\n var clipped = [];\n for (var i$2 = 0, list$2 = features; i$2 < list$2.length; i$2 += 1) {\n var feature = list$2[i$2];\n var geometry = feature.geometry;\n var type = feature.type;\n var min = axis === 0 ? feature.minX : feature.minY;\n var max = axis === 0 ? feature.maxX : feature.maxY;\n if (min >= k1 && max < k2) {\n clipped.push(feature);\n continue;\n } else if (max < k1 || min >= k2) {\n continue;\n }\n var newGeometry = [];\n if (type === 'Point' || type === 'MultiPoint') {\n clipPoints(geometry, newGeometry, k1, k2, axis, options.hasAltitude);\n } else if (type === 'LineString') {\n clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics, options.hasAltitude);\n } else if (type === 'MultiLineString') {\n clipLines(geometry, newGeometry, k1, k2, axis, false, options.hasAltitude);\n } else if (type === 'Polygon') {\n clipLines(geometry, newGeometry, k1, k2, axis, true, options.hasAltitude);\n } else if (type === 'MultiPolygon') {\n for (var i = 0, list = geometry; i < list.length; i += 1) {\n var polygon = list[i];\n var newPolygon = [];\n clipLines(polygon, newPolygon, k1, k2, axis, true, options.hasAltitude);\n if (newPolygon.length) {\n newGeometry.push(newPolygon);\n }\n }\n }\n if (newGeometry.length) {\n if (options.lineMetrics && type === 'LineString') {\n for (var i$1 = 0, list$1 = newGeometry; i$1 < list$1.length; i$1 += 1) {\n var line = list$1[i$1];\n clipped.push(createFeature(feature.id, type, line, feature.tags, feature.layer, options.hasAltitude));\n }\n continue;\n }\n if (type === 'LineString' || type === 'MultiLineString') {\n if (newGeometry.length === 1) {\n type = 'LineString';\n newGeometry = newGeometry[0];\n } else {\n type = 'MultiLineString';\n }\n }\n if (type === 'Point' || type === 'MultiPoint') {\n type = newGeometry.length === 3 ? 'Point' : 'MultiPoint';\n }\n clipped.push(createFeature(feature.id, type, newGeometry, feature.tags, feature.layer, options.hasAltitude));\n }\n }\n return clipped.length ? clipped : null;\n }\n function clipPoints(geom, newGeom, k1, k2, axis, hasAltitude) {\n var stride = hasAltitude ? 4 : 3;\n for (var i = 0; i < geom.length; i += stride) {\n var a = geom[i + axis];\n if (a >= k1 && a <= k2) {\n addPoint(newGeom, geom[i], geom[i + 1], geom[i + 2]);\n if (hasAltitude) {\n newGeom.push(geom[i + 3]);\n }\n }\n }\n }\n function clipLine(geom, newGeom, k1, k2, axis, isPolygon, trackMetrics, hasAltitude) {\n var slice = newSlice(geom);\n var intersect = axis === 0 ? intersectX : intersectY;\n var len = geom.start;\n var segLen, t;\n var stride = hasAltitude ? 4 : 3;\n var count = isPolygon ? geom.length : geom.length - stride;\n for (var i = 0; i < count; i += stride) {\n var ax = geom[i];\n var ay = geom[i + 1];\n var az = geom[i + 2];\n var bx = void 0,\n by = void 0;\n if (isPolygon && i === count - stride) {\n bx = geom[0];\n by = geom[1];\n } else {\n bx = geom[i + stride];\n by = geom[i + stride + 1];\n }\n var ah = void 0,\n bh = void 0;\n if (hasAltitude) {\n ah = geom[i + 3];\n bh = isPolygon && i === count - stride ? geom[3] : geom[i + stride + 3];\n }\n var a = axis === 0 ? ax : ay;\n var b = axis === 0 ? bx : by;\n var exited = false;\n if (trackMetrics) {\n segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));\n }\n if (a < k1) {\n if (b > k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (hasAltitude) {\n slice.push(newHeight(ah, bh, t));\n }\n if (trackMetrics) {\n slice.start = len + segLen * t;\n }\n }\n } else if (a > k2) {\n if (b < k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (hasAltitude) {\n slice.push(newHeight(ah, bh, t));\n }\n if (trackMetrics) {\n slice.start = len + segLen * t;\n }\n }\n } else {\n addPoint(slice, ax, ay, az);\n if (hasAltitude) {\n slice.push(ah);\n }\n }\n if (b < k1 && a >= k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (hasAltitude) {\n slice.push(newHeight(ah, bh, t));\n }\n exited = true;\n }\n if (b > k2 && a <= k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (hasAltitude) {\n slice.push(newHeight(ah, bh, t));\n }\n exited = true;\n }\n if (!isPolygon && exited) {\n if (trackMetrics) {\n slice.end = len + segLen * t;\n }\n newGeom.push(slice);\n slice = newSlice(geom);\n }\n if (trackMetrics) {\n len += segLen;\n }\n }\n var last = geom.length - stride;\n if (!isPolygon) {\n var ax$1 = geom[last];\n var ay$1 = geom[last + 1];\n var az$1 = geom[last + 2];\n var a$1 = axis === 0 ? ax$1 : ay$1;\n if (a$1 >= k1 && a$1 <= k2) {\n addPoint(slice, ax$1, ay$1, az$1);\n }\n if (a$1 >= k1 && a$1 <= k2) {\n if (hasAltitude) {\n var ah$1 = geom[last + 3];\n slice.push(ah$1);\n }\n }\n }\n last = slice.length - stride;\n if (isPolygon && last >= stride && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) {\n addPoint(slice, slice[0], slice[1], slice[2]);\n if (hasAltitude) {\n slice.push(slice[3]);\n }\n }\n if (slice.length) {\n newGeom.push(slice);\n }\n }\n function newSlice(line) {\n var slice = [];\n slice.size = line.size;\n slice.start = line.start;\n slice.end = line.end;\n return slice;\n }\n function clipLines(geom, newGeom, k1, k2, axis, isPolygon, hasAltitude) {\n for (var i = 0, list = geom; i < list.length; i += 1) {\n var line = list[i];\n clipLine(line, newGeom, k1, k2, axis, isPolygon, false, hasAltitude);\n }\n }\n function addPoint(out, x, y, z) {\n out.push(x, y, z);\n }\n function intersectX(out, ax, ay, bx, by, x) {\n var t = (x - ax) / (bx - ax);\n addPoint(out, x, ay + (by - ay) * t, 1);\n return t;\n }\n function intersectY(out, ax, ay, bx, by, y) {\n var t = (y - ay) / (by - ay);\n addPoint(out, ax + (bx - ax) * t, y, 1);\n return t;\n }\n function newHeight(ah, bh, t) {\n return ah + (bh - ah) * t;\n }\n function wrap(features, options) {\n var buffer = options.buffer / options.extent;\n var merged = features;\n var left = clip(features, 1, -1 - buffer, buffer, 0, -1, 2, options);\n var right = clip(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options);\n if (left || right) {\n merged = clip(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || [];\n if (left) {\n merged = shiftFeatureCoords(left, 1, options.hasAltitude).concat(merged);\n }\n if (right) {\n merged = merged.concat(shiftFeatureCoords(right, -1, options.hasAltitude));\n }\n }\n return merged;\n }\n function shiftFeatureCoords(features, offset, hasAltitude) {\n var newFeatures = [];\n for (var i = 0; i < features.length; i++) {\n var feature = features[i];\n var type = feature.type;\n var newGeometry = void 0;\n if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {\n newGeometry = shiftCoords(feature.geometry, offset, hasAltitude);\n } else if (type === 'MultiLineString' || type === 'Polygon') {\n newGeometry = [];\n for (var i$1 = 0, list = feature.geometry; i$1 < list.length; i$1 += 1) {\n var line = list[i$1];\n newGeometry.push(shiftCoords(line, offset, hasAltitude));\n }\n } else if (type === 'MultiPolygon') {\n newGeometry = [];\n for (var i$3 = 0, list$2 = feature.geometry; i$3 < list$2.length; i$3 += 1) {\n var polygon = list$2[i$3];\n var newPolygon = [];\n for (var i$2 = 0, list$1 = polygon; i$2 < list$1.length; i$2 += 1) {\n var line$1 = list$1[i$2];\n newPolygon.push(shiftCoords(line$1, offset, hasAltitude));\n }\n newGeometry.push(newPolygon);\n }\n }\n newFeatures.push(createFeature(feature.id, type, newGeometry, feature.tags, feature.layer, hasAltitude));\n }\n return newFeatures;\n }\n function shiftCoords(points, offset, hasAltitude) {\n var newPoints = [];\n newPoints.size = points.size;\n if (points.start !== undefined) {\n newPoints.start = points.start;\n newPoints.end = points.end;\n }\n var stride = hasAltitude ? 4 : 3;\n for (var i = 0; i < points.length; i += stride) {\n newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);\n if (hasAltitude) {\n newPoints.push(points[i + 3]);\n }\n }\n return newPoints;\n }\n function transformTile(tile, extent, hasAltitude) {\n if (tile.transformed) {\n return tile;\n }\n var z2 = 1 << tile.z;\n var tx = tile.x;\n var ty = tile.y;\n var stride = hasAltitude ? 3 : 2;\n for (var i = 0, list = tile.features; i < list.length; i += 1) {\n var feature = list[i];\n var geom = feature.geometry;\n var type = feature.type;\n feature.geometry = [];\n if (type === 1) {\n for (var j = 0; j < geom.length; j += stride) {\n feature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));\n if (hasAltitude) {\n feature.geometry[feature.geometry.length - 1].push(geom[j + 2]);\n }\n }\n } else {\n for (var j$1 = 0; j$1 < geom.length; j$1++) {\n var ring = [];\n for (var k = 0; k < geom[j$1].length; k += stride) {\n ring.push(transformPoint(geom[j$1][k], geom[j$1][k + 1], extent, z2, tx, ty));\n if (hasAltitude) {\n ring[ring.length - 1].push(geom[j$1][k + 2]);\n }\n }\n feature.geometry.push(ring);\n }\n }\n }\n tile.transformed = true;\n return tile;\n }\n function transformPoint(x, y, extent, z2, tx, ty) {\n return [Math.round(extent * (x * z2 - tx)), Math.round(extent * (y * z2 - ty))];\n }\n function createTile(features, z, tx, ty, options) {\n var tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);\n var tile = {\n features: [],\n numPoints: 0,\n numSimplified: 0,\n numFeatures: features.length,\n source: null,\n x: tx,\n y: ty,\n z: z,\n transformed: false,\n minX: 2,\n minY: 1,\n maxX: -1,\n maxY: 0 };\n\n for (var i = 0, list = features; i < list.length; i += 1) {\n var feature = list[i];\n addFeature(tile, feature, tolerance, options);\n }\n return tile;\n }\n function addFeature(tile, feature, tolerance, options) {\n var geom = feature.geometry;\n var type = feature.type;\n var simplified = [];\n var stride = options.hasAltitude ? 4 : 3;\n tile.minX = Math.min(tile.minX, feature.minX);\n tile.minY = Math.min(tile.minY, feature.minY);\n tile.maxX = Math.max(tile.maxX, feature.maxX);\n tile.maxY = Math.max(tile.maxY, feature.maxY);\n if (type === 'Point' || type === 'MultiPoint') {\n for (var i = 0; i < geom.length; i += stride) {\n simplified.push(geom[i], geom[i + 1]);\n if (options.hasAltitude) {\n simplified.push(geom[i + 3]);\n }\n tile.numPoints++;\n tile.numSimplified++;\n }\n } else if (type === 'LineString') {\n addLine(simplified, geom, tile, tolerance, false, false, options);\n } else if (type === 'MultiLineString' || type === 'Polygon') {\n for (var i$1 = 0; i$1 < geom.length; i$1++) {\n addLine(simplified, geom[i$1], tile, tolerance, type === 'Polygon', i$1 === 0, options);\n }\n } else if (type === 'MultiPolygon') {\n for (var k = 0; k < geom.length; k++) {\n var polygon = geom[k];\n for (var i$2 = 0; i$2 < polygon.length; i$2++) {\n addLine(simplified, polygon[i$2], tile, tolerance, true, i$2 === 0, options);\n }\n }\n }\n if (simplified.length) {\n var tags = feature.tags || null;\n if (type === 'LineString' && options.lineMetrics) {\n tags = {};\n for (var key in feature.tags) {\n tags[key] = feature.tags[key];\n }\n tags['mapbox_clip_start'] = geom.start / geom.size;\n tags['mapbox_clip_end'] = geom.end / geom.size;\n }\n var tileFeature = {\n geometry: simplified,\n type: type === 'Polygon' || type === 'MultiPolygon' ? 3 : type === 'LineString' || type === 'MultiLineString' ? 2 : 1,\n tags: tags };\n\n if (feature.layer) {\n tileFeature.layer = feature.layer;\n }\n if (feature.id !== null) {\n tileFeature.id = feature.id;\n }\n tile.features.push(tileFeature);\n }\n }\n function keepSimplified(geom, i, hasAltitude) {\n return geom[i + 2] === 0 && geom[i + 3] > 0 && hasAltitude;\n }\n function addLine(result, geom, tile, tolerance, isPolygon, isOuter, options) {\n var sqTolerance = tolerance * tolerance;\n var hasAltitude = options.hasAltitude;\n var disableFilter = options.disableFilter;\n var stride = hasAltitude ? 4 : 3;\n if (!disableFilter && tolerance > 0 && geom.size < (isPolygon ? sqTolerance : tolerance)) {\n tile.numPoints += geom.length / stride;\n return;\n }\n var ring = [];\n for (var i = 0; i < geom.length; i += stride) {\n if (tolerance === 0 || geom[i + 2] > sqTolerance || keepSimplified(geom, i, hasAltitude)) {\n tile.numSimplified++;\n ring.push(geom[i], geom[i + 1]);\n if (hasAltitude) {\n ring.push(geom[i + 3]);\n }\n }\n tile.numPoints++;\n }\n if (isPolygon) {\n rewind(ring, isOuter, hasAltitude);\n }\n result.push(ring);\n }\n function rewind(ring, clockwise, hasAltitude) {\n var stride = hasAltitude ? 3 : 2;\n var area = 0;\n for (var i = 0, len = ring.length, j = len - stride; i < len; j = i, i += stride) {\n area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);\n }\n if (area > 0 === clockwise) {\n var posX = stride;\n var posY = stride - 1;\n var posA = stride - 2;\n for (var i$1 = 0, len$1 = ring.length; i$1 < len$1 / 2; i$1 += stride) {\n var x = ring[i$1];\n var y = ring[i$1 + 1];\n var altitude = void 0;\n if (hasAltitude) {\n altitude = ring[i$1 + 2];\n }\n ring[i$1] = ring[len$1 - posX - i$1];\n ring[i$1 + 1] = ring[len$1 - posY - i$1];\n if (hasAltitude) {\n ring[i$1 + 2] = ring[len$1 - posA - i$1];\n }\n ring[len$1 - posX - i$1] = x;\n ring[len$1 - posY - i$1] = y;\n if (hasAltitude) {\n ring[len$1 - posA - i$1] = altitude;\n }\n }\n }\n }\n var defaultOptions = {\n maxZoom: 14,\n indexMaxZoom: 5,\n indexMaxPoints: 100000,\n tolerance: 3,\n extent: 4096,\n buffer: 64,\n lineMetrics: false,\n promoteId: null,\n generateId: false,\n hasAltitude: false,\n disableFilter: false,\n debug: 0 };\n\n var GeoJSONVT = function GeoJSONVT(data, options) {\n options = this.options = extend(Object.create(defaultOptions), options);\n var debug = options.debug;\n if (debug) {\n console.time('preprocess data');\n }\n if (options.maxZoom < 0 || options.maxZoom > 24) {\n throw new Error('maxZoom should be in the 0-24 range');\n }\n if (options.promoteId && options.generateId) {\n throw new Error('promoteId and generateId cannot be used together.');\n }\n var features = convert(data, options);\n this.tiles = {};\n this.tileCoords = [];\n if (debug) {\n console.timeEnd('preprocess data');\n console.log('index: maxZoom: %d, maxPoints: %d', options.indexMaxZoom, options.indexMaxPoints);\n console.time('generate tiles');\n this.stats = {};\n this.total = 0;\n }\n features = wrap(features, options);\n if (features.length) {\n this.splitTile(features, 0, 0, 0);\n }\n if (debug) {\n if (features.length) {\n console.log('features: %d, points: %d', this.tiles[0].numFeatures, this.tiles[0].numPoints);\n }\n console.timeEnd('generate tiles');\n console.log('tiles generated:', this.total, JSON.stringify(this.stats));\n }\n };\n GeoJSONVT.prototype.splitTile = function splitTile(features, z, x, y, cz, cx, cy) {\n var stack = [features, z, x, y];\n var options = this.options;\n var debug = options.debug;\n while (stack.length) {\n y = stack.pop();\n x = stack.pop();\n z = stack.pop();\n features = stack.pop();\n var z2 = 1 << z;\n var id = toID(z, x, y);\n var tile = this.tiles[id];\n if (!tile) {\n if (debug > 1) {\n console.time('creation');\n }\n tile = this.tiles[id] = createTile(features, z, x, y, options);\n this.tileCoords.push({\n z: z,\n x: x,\n y: y });\n\n if (debug) {\n if (debug > 1) {\n console.log('tile z%d-%d-%d (features: %d, points: %d, simplified: %d)', z, x, y, tile.numFeatures, tile.numPoints, tile.numSimplified);\n console.timeEnd('creation');\n }\n var key = \"z\" + z;\n this.stats[key] = (this.stats[key] || 0) + 1;\n this.total++;\n }\n }\n tile.source = features;\n if (cz == null) {\n if (z === options.indexMaxZoom || tile.numPoints <= options.indexMaxPoints) {\n continue;\n }\n } else if (z === options.maxZoom || z === cz) {\n continue;\n } else if (cz != null) {\n var zoomSteps = cz - z;\n if (x !== cx >> zoomSteps || y !== cy >> zoomSteps) {\n continue;\n }\n }\n tile.source = null;\n if (features.length === 0) {\n continue;\n }\n if (debug > 1) {\n console.time('clipping');\n }\n var k1 = 0.5 * options.buffer / options.extent;\n var k2 = 0.5 - k1;\n var k3 = 0.5 + k1;\n var k4 = 1 + k1;\n var tl = null;\n var bl = null;\n var tr = null;\n var br = null;\n var left = clip(features, z2, x - k1, x + k3, 0, tile.minX, tile.maxX, options);\n var right = clip(features, z2, x + k2, x + k4, 0, tile.minX, tile.maxX, options);\n features = null;\n if (left) {\n tl = clip(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n bl = clip(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n left = null;\n }\n if (right) {\n tr = clip(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n br = clip(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n right = null;\n }\n if (debug > 1) {\n console.timeEnd('clipping');\n }\n stack.push(tl || [], z + 1, x * 2, y * 2);\n stack.push(bl || [], z + 1, x * 2, y * 2 + 1);\n stack.push(tr || [], z + 1, x * 2 + 1, y * 2);\n stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);\n }\n };\n GeoJSONVT.prototype.getTile = function getTile(z, x, y) {\n z = +z;\n x = +x;\n y = +y;\n var options = this.options;\n var extent = options.extent;\n var debug = options.debug;\n var hasAltitude = options.hasAltitude;\n var wrapX = options.wrapX;\n if (z < 0 || z > 24) {\n return null;\n }\n if (wrapX) {\n var z2 = 1 << z;\n x = x + z2 & z2 - 1;\n }\n var id = toID(z, x, y);\n if (this.tiles[id]) {\n return transformTile(this.tiles[id], extent, hasAltitude);\n }\n if (debug > 1) {\n console.log('drilling down to z%d-%d-%d', z, x, y);\n }\n var z0 = z;\n var x0 = x;\n var y0 = y;\n var parent;\n while (!parent && z0 > 0) {\n z0--;\n x0 = x0 >> 1;\n y0 = y0 >> 1;\n parent = this.tiles[toID(z0, x0, y0)];\n }\n if (!parent || !parent.source) {\n return null;\n }\n if (debug > 1) {\n console.log('found parent tile z%d-%d-%d', z0, x0, y0);\n console.time('drilling down');\n }\n this.splitTile(parent.source, z0, x0, y0, z, x, y);\n if (debug > 1) {\n console.timeEnd('drilling down');\n }\n return this.tiles[id] ? transformTile(this.tiles[id], extent, hasAltitude) : null;\n };\n function toID(z, x, y) {\n return ((1 << z) * y + x) * 32 + z;\n }\n function extend(dest, src) {\n for (var i in src) {\n dest[i] = src[i];\n }\n return dest;\n }\n function geojsonvt(data, options) {\n return new GeoJSONVT(data, options);\n }\n return geojsonvt;\n });return module.exports;});", "requires": [], "buildLevel": 0, "fileName": "/geojson-vt-dev.js" }, "pandav:/src/clip.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/clip\", [\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/feature\"], function (module, exports, require, load, process, global) {\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.default = clip;\n var _feature = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/feature'));\n function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}\n function _createForOfIteratorHelper(r, e) {var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];if (!t) {if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {t && (r = t);var _n = 0,F = function F() {};return { s: F, n: function n() {return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] };}, e: function e(r) {throw r;}, f: F };}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");}var o,a = !0,u = !1;return { s: function s() {t = t.call(r);}, n: function n() {var r = t.next();return a = r.done, r;}, e: function e(r) {u = !0, o = r;}, f: function f() {try {a || null == t.return || t.return();} finally {if (u) throw o;}} };}\n function _unsupportedIterableToArray(r, a) {if (r) {if (\"string\" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}\n function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}\n function clip(features, scale, k1, k2, axis, minAll, maxAll, options) {\n k1 /= scale;\n k2 /= scale;\n if (minAll >= k1 && maxAll < k2) return features;else if (maxAll < k1 || minAll >= k2) return null;\n var clipped = [];\n var _iterator = _createForOfIteratorHelper(features),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var feature = _step.value;\n var geometry = feature.geometry;\n var type = feature.type;\n var min = axis === 0 ? feature.minX : feature.minY;\n var max = axis === 0 ? feature.maxX : feature.maxY;\n if (min >= k1 && max < k2) {\n clipped.push(feature);\n continue;\n } else if (max < k1 || min >= k2) {\n continue;\n }\n var newGeometry = [];\n if (type === 'Point' || type === 'MultiPoint') {\n clipPoints(geometry, newGeometry, k1, k2, axis, options.hasAltitude);\n } else if (type === 'LineString') {\n clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics, options.hasAltitude);\n } else if (type === 'MultiLineString') {\n clipLines(geometry, newGeometry, k1, k2, axis, false, options.hasAltitude);\n } else if (type === 'Polygon') {\n clipLines(geometry, newGeometry, k1, k2, axis, true, options.hasAltitude);\n } else if (type === 'MultiPolygon') {\n var _iterator2 = _createForOfIteratorHelper(geometry),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var polygon = _step2.value;\n var newPolygon = [];\n clipLines(polygon, newPolygon, k1, k2, axis, true, options.hasAltitude);\n if (newPolygon.length) {\n newGeometry.push(newPolygon);\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n if (newGeometry.length) {\n if (options.lineMetrics && type === 'LineString') {\n var _iterator3 = _createForOfIteratorHelper(newGeometry),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var line = _step3.value;\n clipped.push((0, _feature.default)(feature.id, type, line, feature.tags, feature.layer, options.hasAltitude));\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n continue;\n }\n if (type === 'LineString' || type === 'MultiLineString') {\n if (newGeometry.length === 1) {\n type = 'LineString';\n newGeometry = newGeometry[0];\n } else {\n type = 'MultiLineString';\n }\n }\n if (type === 'Point' || type === 'MultiPoint') {\n type = newGeometry.length === 3 ? 'Point' : 'MultiPoint';\n }\n clipped.push((0, _feature.default)(feature.id, type, newGeometry, feature.tags, feature.layer, options.hasAltitude));\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return clipped.length ? clipped : null;\n }\n function clipPoints(geom, newGeom, k1, k2, axis, hasAltitude) {\n var stride = hasAltitude ? 4 : 3;\n for (var i = 0; i < geom.length; i += stride) {\n var a = geom[i + axis];\n if (a >= k1 && a <= k2) {\n addPoint(newGeom, geom[i], geom[i + 1], geom[i + 2]);\n if (hasAltitude) {\n newGeom.push(geom[i + 3]);\n }\n }\n }\n }\n function clipLine(geom, newGeom, k1, k2, axis, isPolygon, trackMetrics, hasAltitude) {\n var slice = newSlice(geom);\n var intersect = axis === 0 ? intersectX : intersectY;\n var len = geom.start;\n var segLen, t;\n var stride = hasAltitude ? 4 : 3;\n var count = isPolygon ? geom.length : geom.length - stride;\n for (var i = 0; i < count; i += stride) {\n var ax = geom[i];\n var ay = geom[i + 1];\n var az = geom[i + 2];\n var bx = void 0,\n by = void 0;\n if (isPolygon && i === count - stride) {\n bx = geom[0];\n by = geom[1];\n } else {\n bx = geom[i + stride];\n by = geom[i + stride + 1];\n }\n var ah = void 0,\n bh = void 0;\n if (hasAltitude) {\n ah = geom[i + 3];\n bh = isPolygon && i === count - stride ? geom[3] : geom[i + stride + 3];\n }\n var a = axis === 0 ? ax : ay;\n var b = axis === 0 ? bx : by;\n var exited = false;\n if (trackMetrics) segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));\n if (a < k1) {\n if (b > k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (hasAltitude) {\n slice.push(newHeight(ah, bh, t));\n }\n if (trackMetrics) slice.start = len + segLen * t;\n }\n } else if (a > k2) {\n if (b < k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (hasAltitude) {\n slice.push(newHeight(ah, bh, t));\n }\n if (trackMetrics) slice.start = len + segLen * t;\n }\n } else {\n addPoint(slice, ax, ay, az);\n if (hasAltitude) {\n slice.push(ah);\n }\n }\n if (b < k1 && a >= k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (hasAltitude) {\n slice.push(newHeight(ah, bh, t));\n }\n exited = true;\n }\n if (b > k2 && a <= k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (hasAltitude) {\n slice.push(newHeight(ah, bh, t));\n }\n exited = true;\n }\n if (!isPolygon && exited) {\n if (trackMetrics) slice.end = len + segLen * t;\n newGeom.push(slice);\n slice = newSlice(geom);\n }\n if (trackMetrics) len += segLen;\n }\n var last = geom.length - stride;\n if (!isPolygon) {\n var _ax = geom[last];\n var _ay = geom[last + 1];\n var _az = geom[last + 2];\n var _a = axis === 0 ? _ax : _ay;\n if (_a >= k1 && _a <= k2) addPoint(slice, _ax, _ay, _az);\n if (_a >= k1 && _a <= k2) {\n if (hasAltitude) {\n var _ah = geom[last + 3];\n slice.push(_ah);\n }\n }\n }\n last = slice.length - stride;\n if (isPolygon && last >= stride && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) {\n addPoint(slice, slice[0], slice[1], slice[2]);\n if (hasAltitude) {\n slice.push(slice[3]);\n }\n }\n if (slice.length) {\n newGeom.push(slice);\n }\n }\n function newSlice(line) {\n var slice = [];\n slice.size = line.size;\n slice.start = line.start;\n slice.end = line.end;\n return slice;\n }\n function clipLines(geom, newGeom, k1, k2, axis, isPolygon, hasAltitude) {\n var _iterator4 = _createForOfIteratorHelper(geom),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var line = _step4.value;\n clipLine(line, newGeom, k1, k2, axis, isPolygon, false, hasAltitude);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n }\n function addPoint(out, x, y, z) {\n out.push(x, y, z);\n }\n function intersectX(out, ax, ay, bx, by, x) {\n var t = (x - ax) / (bx - ax);\n addPoint(out, x, ay + (by - ay) * t, 1);\n return t;\n }\n function intersectY(out, ax, ay, bx, by, y) {\n var t = (y - ay) / (by - ay);\n addPoint(out, ax + (bx - ax) * t, y, 1);\n return t;\n }\n function newHeight(ah, bh, t) {\n return ah + (bh - ah) * t;\n }return module.exports;});", "requires": [ "pandav:/src/feature.js" ], "buildLevel": 0, "fileName": "/src/clip.js" }, "pandav:/geojson-vt.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/geojson-vt\", [], function (module, exports, require, load, process, global) {\n\n function _typeof(o) {\"@babel/helpers - typeof\";return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;}, _typeof(o);}\n !function (t, e) {\n \"object\" == (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) && \"undefined\" != typeof module ? module.exports = e() : \"function\" == typeof define && define.amd ? define(e) : (t = t || self).geojsonvt = e();\n }(void 0, function () {\n \"use strict\";\n\n function t(t, e, n, i, r, o) {\n var l = r - n,\n a = o - i;\n if (0 !== l || 0 !== a) {\n var s = ((t - n) * l + (e - i) * a) / (l * l + a * a);\n s > 1 ? (n = r, i = o) : s > 0 && (n += l * s, i += a * s);\n }\n return (l = t - n) * l + (a = e - i) * a;\n }\n function e(t, e, i, r, o, l) {\n var a = {\n id: null == t ? null : t,\n type: e,\n geometry: i,\n tags: r,\n minX: 1 / 0,\n minY: 1 / 0,\n maxX: -1 / 0,\n maxY: -1 / 0 };\n\n return o && (a.layer = o), function (t, e) {\n var i = t.geometry,\n r = t.type;\n if (\"Point\" === r || \"MultiPoint\" === r || \"LineString\" === r) n(t, i, e);else if (\"Polygon\" === r) n(t, i[0], e);else if (\"MultiLineString\" === r) for (var o = 0, l = i; o < l.length; o += 1) {\n var a = l[o];\n n(t, a, e);\n } else if (\"MultiPolygon\" === r) for (var s = 0, u = i; s < u.length; s += 1) {\n var h = u[s];\n n(t, h[0], e);\n }\n }(a, l ? 4 : 3), a;\n }\n function n(t, e, n) {\n for (var i = 0; i < e.length; i += n) t.minX = Math.min(t.minX, e[i]), t.minY = Math.min(t.minY, e[i + 1]), t.maxX = Math.max(t.maxX, e[i]), t.maxY = Math.max(t.maxY, e[i + 1]);\n }\n function i(t, e, n, i) {\n if (i.layer = e, \"FeatureCollection\" === n.type) for (var o = 0; o < n.features.length; o++) r(t, n.features[o], i, o);else \"Feature\" === n.type ? r(t, n, i) : r(t, {\n geometry: n },\n i);\n }\n function r(t, n, i, s) {\n if (n.geometry) {\n var u = n.geometry.coordinates,\n h = n.geometry.type,\n f = Math.pow(i.tolerance / ((1 << i.maxZoom) * i.extent), 2),\n g = [],\n m = n.id;\n if (i.promoteId ? m = n.properties[i.promoteId] : i.generateId && (m = s || 0), \"Point\" === h) o(u, g, i);else if (\"MultiPoint\" === h) for (var p = 0, d = u; p < d.length; p += 1) {\n o(d[p], g, i);\n } else if (\"LineString\" === h) l(u, g, f, !1, i);else if (\"MultiLineString\" === h) {\n if (i.lineMetrics) {\n for (var c = 0, v = u; c < v.length; c += 1) {\n l(v[c], g = [], f, !1, i), t.push(e(m, \"LineString\", g, n.properties, i.layer, i.hasAltitude));\n }\n return;\n }\n a(u, g, f, !1, i);\n } else if (\"Polygon\" === h) a(u, g, f, !0, i);else {\n if (\"MultiPolygon\" !== h) {\n if (\"GeometryCollection\" === h) {\n for (var y = 0, x = n.geometry.geometries; y < x.length; y += 1) {\n r(t, {\n id: m,\n geometry: x[y],\n properties: n.properties },\n i, s);\n }\n return;\n }\n throw new Error(\"Input data is not a valid GeoJSON object.\");\n }\n for (var M = 0, P = u; M < P.length; M += 1) {\n var S = [];\n a(P[M], S, f, !0, i), g.push(S);\n }\n }\n t.push(e(m, h, g, n.properties, i.layer, i.hasAltitude));\n }\n }\n function o(t, e, n) {\n e.push(s(t[0]), u(t[1], n.projection), 0), n.hasAltitude && (t.length > 2 ? e.push(t[2]) : e.push(0));\n }\n function l(e, n, i, r, o) {\n for (var l, a, h = 0, f = 0; f < e.length; f++) {\n var g = s(e[f][0]),\n m = u(e[f][1], o.projection);\n n.push(g, m, 0), o.hasAltitude && (e[f].length > 2 ? n.push(e[f][2]) : n.push(0)), f > 0 && (h += r ? (l * m - g * a) / 2 : Math.sqrt(Math.pow(g - l, 2) + Math.pow(m - a, 2))), l = g, a = m;\n }\n var p = o.hasAltitude ? 4 : 3,\n d = n.length - p;\n n[2] = 1, function e(n, i, r, o, l) {\n void 0 === l && (l = 3);\n for (var a, s = o, u = r - i >> 1, h = r - i, f = n[i], g = n[i + 1], m = n[r], p = n[r + 1], d = i + l; d < r; d += l) {\n var c = t(n[d], n[d + 1], f, g, m, p);\n if (c > s) a = d, s = c;else if (c === s) {\n var v = Math.abs(d - u);\n v < h && (a = d, h = v);\n }\n }\n s > o && (a - i > l && e(n, i, a, o, l), n[a + 2] = s, r - a > l && e(n, a, r, o, l));\n }(n, 0, d, i, p), n[d + 2] = 1, n.size = Math.abs(h), n.start = 0, n.end = n.size;\n }\n function a(t, e, n, i, r) {\n for (var o = 0; o < t.length; o++) {\n var a = [];\n l(t[o], a, n, i, r), e.push(a);\n }\n }\n function s(t) {\n return t / 360 + .5;\n }\n function u(t, e) {\n switch (e) {\n case \"EPSG:4326\":\n return (90 - t) / 360;}\n\n var n = Math.sin(t * Math.PI / 180),\n i = .5 - .25 * Math.log((1 + n) / (1 - n)) / Math.PI;\n return i < 0 ? 0 : i > 1 ? 1 : i;\n }\n function h(t, n, i, r, o, l, a, s) {\n if (r /= n, l >= (i /= n) && a < r) return t;\n if (a < i || l >= r) return null;\n for (var u = [], h = 0, m = t; h < m.length; h += 1) {\n var d = m[h],\n c = d.geometry,\n v = d.type,\n y = 0 === o ? d.minX : d.minY,\n x = 0 === o ? d.maxX : d.maxY;\n if (y >= i && x < r) u.push(d);else if (!(x < i || y >= r)) {\n var M = [];\n if (\"Point\" === v || \"MultiPoint\" === v) f(c, M, i, r, o, s.hasAltitude);else if (\"LineString\" === v) g(c, M, i, r, o, !1, s.lineMetrics, s.hasAltitude);else if (\"MultiLineString\" === v) p(c, M, i, r, o, !1, s.hasAltitude);else if (\"Polygon\" === v) p(c, M, i, r, o, !0, s.hasAltitude);else if (\"MultiPolygon\" === v) for (var P = 0, S = c; P < S.length; P += 1) {\n var Y = [];\n p(S[P], Y, i, r, o, !0, s.hasAltitude), Y.length && M.push(Y);\n }\n if (M.length) {\n if (s.lineMetrics && \"LineString\" === v) {\n for (var A = 0, X = M; A < X.length; A += 1) {\n var L = X[A];\n u.push(e(d.id, v, L, d.tags, d.layer, s.hasAltitude));\n }\n continue;\n }\n \"LineString\" !== v && \"MultiLineString\" !== v || (1 === M.length ? (v = \"LineString\", M = M[0]) : v = \"MultiLineString\"), \"Point\" !== v && \"MultiPoint\" !== v || (v = 3 === M.length ? \"Point\" : \"MultiPoint\"), u.push(e(d.id, v, M, d.tags, d.layer, s.hasAltitude));\n }\n }\n }\n return u.length ? u : null;\n }\n function f(t, e, n, i, r, o) {\n for (var l = o ? 4 : 3, a = 0; a < t.length; a += l) {\n var s = t[a + r];\n s >= n && s <= i && (d(e, t[a], t[a + 1], t[a + 2]), o && e.push(t[a + 3]));\n }\n }\n function g(t, e, n, i, r, o, l, a) {\n for (var s, u, h = m(t), f = 0 === r ? c : v, g = t.start, p = a ? 4 : 3, x = o ? t.length : t.length - p, M = 0; M < x; M += p) {\n var P = t[M],\n S = t[M + 1],\n Y = t[M + 2],\n A = void 0,\n X = void 0;\n o && M === x - p ? (A = t[0], X = t[1]) : (A = t[M + p], X = t[M + p + 1]);\n var L = void 0,\n b = void 0;\n a && (L = t[M + 3], b = o && M === x - p ? t[3] : t[M + p + 3]);\n var w = 0 === r ? P : S,\n z = 0 === r ? A : X,\n I = !1;\n l && (s = Math.sqrt(Math.pow(P - A, 2) + Math.pow(S - X, 2))), w < n ? z > n && (u = f(h, P, S, A, X, n), a && h.push(y(L, b, u)), l && (h.start = g + s * u)) : w > i ? z < i && (u = f(h, P, S, A, X, i), a && h.push(y(L, b, u)), l && (h.start = g + s * u)) : (d(h, P, S, Y), a && h.push(L)), z < n && w >= n && (u = f(h, P, S, A, X, n), a && h.push(y(L, b, u)), I = !0), z > i && w <= i && (u = f(h, P, S, A, X, i), a && h.push(y(L, b, u)), I = !0), !o && I && (l && (h.end = g + s * u), e.push(h), h = m(t)), l && (g += s);\n }\n var Z = t.length - p;\n if (!o) {\n var E = t[Z],\n F = t[Z + 1],\n j = t[Z + 2],\n C = 0 === r ? E : F;\n if (C >= n && C <= i && d(h, E, F, j), C >= n && C <= i && a) {\n var T = t[Z + 3];\n h.push(T);\n }\n }\n Z = h.length - p, o && Z >= p && (h[Z] !== h[0] || h[Z + 1] !== h[1]) && (d(h, h[0], h[1], h[2]), a && h.push(h[3])), h.length && e.push(h);\n }\n function m(t) {\n var e = [];\n return e.size = t.size, e.start = t.start, e.end = t.end, e;\n }\n function p(t, e, n, i, r, o, l) {\n for (var a = 0, s = t; a < s.length; a += 1) {\n g(s[a], e, n, i, r, o, !1, l);\n }\n }\n function d(t, e, n, i) {\n t.push(e, n, i);\n }\n function c(t, e, n, i, r, o) {\n var l = (o - e) / (i - e);\n return d(t, o, n + (r - n) * l, 1), l;\n }\n function v(t, e, n, i, r, o) {\n var l = (o - n) / (r - n);\n return d(t, e + (i - e) * l, o, 1), l;\n }\n function y(t, e, n) {\n return t + (e - t) * n;\n }\n function x(t, n, i) {\n for (var r = [], o = 0; o < t.length; o++) {\n var l = t[o],\n a = l.type,\n s = void 0;\n if (\"Point\" === a || \"MultiPoint\" === a || \"LineString\" === a) s = M(l.geometry, n, i);else if (\"MultiLineString\" === a || \"Polygon\" === a) {\n s = [];\n for (var u = 0, h = l.geometry; u < h.length; u += 1) {\n var f = h[u];\n s.push(M(f, n, i));\n }\n } else if (\"MultiPolygon\" === a) {\n s = [];\n for (var g = 0, m = l.geometry; g < m.length; g += 1) {\n for (var p = [], d = 0, c = m[g]; d < c.length; d += 1) {\n var v = c[d];\n p.push(M(v, n, i));\n }\n s.push(p);\n }\n }\n r.push(e(l.id, a, s, l.tags, l.layer, i));\n }\n return r;\n }\n function M(t, e, n) {\n var i = [];\n i.size = t.size, void 0 !== t.start && (i.start = t.start, i.end = t.end);\n for (var r = n ? 4 : 3, o = 0; o < t.length; o += r) i.push(t[o] + e, t[o + 1], t[o + 2]), n && i.push(t[o + 3]);\n return i;\n }\n function P(t, e, n) {\n if (t.transformed) return t;\n for (var i = 1 << t.z, r = t.x, o = t.y, l = n ? 3 : 2, a = 0, s = t.features; a < s.length; a += 1) {\n var u = s[a],\n h = u.geometry,\n f = u.type;\n if (u.geometry = [], 1 === f) for (var g = 0; g < h.length; g += l) u.geometry.push(S(h[g], h[g + 1], e, i, r, o)), n && u.geometry[u.geometry.length - 1].push(h[g + 2]);else for (var m = 0; m < h.length; m++) {\n for (var p = [], d = 0; d < h[m].length; d += l) p.push(S(h[m][d], h[m][d + 1], e, i, r, o)), n && p[p.length - 1].push(h[m][d + 2]);\n u.geometry.push(p);\n }\n }\n return t.transformed = !0, t;\n }\n function S(t, e, n, i, r, o) {\n return [Math.round(n * (t * i - r)), Math.round(n * (e * i - o))];\n }\n function Y(t, e, n, i, r) {\n for (var o = e === r.maxZoom ? 0 : r.tolerance / ((1 << e) * r.extent), l = {\n features: [],\n numPoints: 0,\n numSimplified: 0,\n numFeatures: t.length,\n source: null,\n x: n,\n y: i,\n z: e,\n transformed: !1,\n minX: 2,\n minY: 1,\n maxX: -1,\n maxY: 0 },\n a = 0, s = t; a < s.length; a += 1) {\n A(l, s[a], o, r);\n }\n return l;\n }\n function A(t, e, n, i) {\n var r = e.geometry,\n o = e.type,\n l = [],\n a = i.hasAltitude ? 4 : 3;\n if (t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), \"Point\" === o || \"MultiPoint\" === o) for (var s = 0; s < r.length; s += a) l.push(r[s], r[s + 1]), i.hasAltitude && l.push(r[s + 3]), t.numPoints++, t.numSimplified++;else if (\"LineString\" === o) L(l, r, t, n, !1, !1, i);else if (\"MultiLineString\" === o || \"Polygon\" === o) for (var u = 0; u < r.length; u++) L(l, r[u], t, n, \"Polygon\" === o, 0 === u, i);else if (\"MultiPolygon\" === o) for (var h = 0; h < r.length; h++) for (var f = r[h], g = 0; g < f.length; g++) L(l, f[g], t, n, !0, 0 === g, i);\n if (l.length) {\n var m = e.tags || null;\n if (\"LineString\" === o && i.lineMetrics) {\n for (var p in m = {}, e.tags) m[p] = e.tags[p];\n m.mapbox_clip_start = r.start / r.size, m.mapbox_clip_end = r.end / r.size;\n }\n var d = {\n geometry: l,\n type: \"Polygon\" === o || \"MultiPolygon\" === o ? 3 : \"LineString\" === o || \"MultiLineString\" === o ? 2 : 1,\n tags: m };\n\n e.layer && (d.layer = e.layer), null !== e.id && (d.id = e.id), t.features.push(d);\n }\n }\n function X(t, e, n) {\n return 0 === t[e + 2] && t[e + 3] > 0 && n;\n }\n function L(t, e, n, i, r, o, l) {\n var a = i * i,\n s = l.hasAltitude,\n u = s ? 4 : 3;\n if (!l.disableFilter && i > 0 && e.size < (r ? a : i)) n.numPoints += e.length / u;else {\n for (var h = [], f = 0; f < e.length; f += u) (0 === i || e[f + 2] > a || X(e, f, s)) && (n.numSimplified++, h.push(e[f], e[f + 1]), s && h.push(e[f + 3])), n.numPoints++;\n r && function (t, e, n) {\n for (var i = n ? 3 : 2, r = 0, o = 0, l = t.length, a = l - i; o < l; a = o, o += i) r += (t[o] - t[a]) * (t[o + 1] + t[a + 1]);\n if (r > 0 === e) for (var s = i, u = i - 1, h = i - 2, f = 0, g = t.length; f < g / 2; f += i) {\n var m = t[f],\n p = t[f + 1],\n d = void 0;\n n && (d = t[f + 2]), t[f] = t[g - s - f], t[f + 1] = t[g - u - f], n && (t[f + 2] = t[g - h - f]), t[g - s - f] = m, t[g - u - f] = p, n && (t[g - h - f] = d);\n }\n }(h, o, s), t.push(h);\n }\n }\n var b = {\n maxZoom: 14,\n indexMaxZoom: 5,\n indexMaxPoints: 1e5,\n tolerance: 3,\n extent: 4096,\n buffer: 64,\n lineMetrics: !1,\n promoteId: null,\n generateId: !1,\n hasAltitude: !1,\n disableFilter: !1,\n debug: 0 },\n\n w = function w(t, e) {\n var n = (e = this.options = function (t, e) {\n for (var n in e) t[n] = e[n];\n return t;\n }(Object.create(b), e)).debug;\n if (n && console.time(\"preprocess data\"), e.maxZoom < 0 || e.maxZoom > 24) throw new Error(\"maxZoom should be in the 0-24 range\");\n if (e.promoteId && e.generateId) throw new Error(\"promoteId and generateId cannot be used together.\");\n var o = function (t, e) {\n var n = [];\n if (Array.isArray(t)) {\n for (var o = 0; o < t.length; o++) i(n, t[o].layer, t[o].data, e);\n return n;\n }\n if (\"FeatureCollection\" === t.type) for (var l = 0; l < t.features.length; l++) r(n, t.features[l], e, l);else \"Feature\" === t.type ? r(n, t, e) : r(n, {\n geometry: t },\n e);\n return n;\n }(t, e);\n this.tiles = {}, this.tileCoords = [], n && (console.timeEnd(\"preprocess data\"), console.log(\"index: maxZoom: %d, maxPoints: %d\", e.indexMaxZoom, e.indexMaxPoints), console.time(\"generate tiles\"), this.stats = {}, this.total = 0), (o = function (t, e) {\n var n = e.buffer / e.extent,\n i = t,\n r = h(t, 1, -1 - n, n, 0, -1, 2, e),\n o = h(t, 1, 1 - n, 2 + n, 0, -1, 2, e);\n return (r || o) && (i = h(t, 1, -n, 1 + n, 0, -1, 2, e) || [], r && (i = x(r, 1, e.hasAltitude).concat(i)), o && (i = i.concat(x(o, -1, e.hasAltitude)))), i;\n }(o, e)).length && this.splitTile(o, 0, 0, 0), n && (o.length && console.log(\"features: %d, points: %d\", this.tiles[0].numFeatures, this.tiles[0].numPoints), console.timeEnd(\"generate tiles\"), console.log(\"tiles generated:\", this.total, JSON.stringify(this.stats)));\n };\n function z(t, e, n) {\n return 32 * ((1 << t) * n + e) + t;\n }\n return w.prototype.splitTile = function (t, e, n, i, r, o, l) {\n for (var a = [t, e, n, i], s = this.options, u = s.debug; a.length;) {\n i = a.pop(), n = a.pop(), e = a.pop(), t = a.pop();\n var f = 1 << e,\n g = z(e, n, i),\n m = this.tiles[g];\n if (!m && (u > 1 && console.time(\"creation\"), m = this.tiles[g] = Y(t, e, n, i, s), this.tileCoords.push({\n z: e,\n x: n,\n y: i }),\n u)) {\n u > 1 && (console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\", e, n, i, m.numFeatures, m.numPoints, m.numSimplified), console.timeEnd(\"creation\"));\n var p = \"z\" + e;\n this.stats[p] = (this.stats[p] || 0) + 1, this.total++;\n }\n if (m.source = t, null == r) {\n if (e === s.indexMaxZoom || m.numPoints <= s.indexMaxPoints) continue;\n } else {\n if (e === s.maxZoom || e === r) continue;\n if (null != r) {\n var d = r - e;\n if (n !== o >> d || i !== l >> d) continue;\n }\n }\n if (m.source = null, 0 !== t.length) {\n u > 1 && console.time(\"clipping\");\n var c = .5 * s.buffer / s.extent,\n v = .5 - c,\n y = .5 + c,\n x = 1 + c,\n M = null,\n P = null,\n S = null,\n A = null,\n X = h(t, f, n - c, n + y, 0, m.minX, m.maxX, s),\n L = h(t, f, n + v, n + x, 0, m.minX, m.maxX, s);\n t = null, X && (M = h(X, f, i - c, i + y, 1, m.minY, m.maxY, s), P = h(X, f, i + v, i + x, 1, m.minY, m.maxY, s), X = null), L && (S = h(L, f, i - c, i + y, 1, m.minY, m.maxY, s), A = h(L, f, i + v, i + x, 1, m.minY, m.maxY, s), L = null), u > 1 && console.timeEnd(\"clipping\"), a.push(M || [], e + 1, 2 * n, 2 * i), a.push(P || [], e + 1, 2 * n, 2 * i + 1), a.push(S || [], e + 1, 2 * n + 1, 2 * i), a.push(A || [], e + 1, 2 * n + 1, 2 * i + 1);\n }\n }\n }, w.prototype.getTile = function (t, e, n) {\n t = +t, e = +e, n = +n;\n var i = this.options,\n r = i.extent,\n o = i.debug,\n l = i.hasAltitude,\n a = i.wrapX;\n if (t < 0 || t > 24) return null;\n if (a) {\n var s = 1 << t;\n e = e + s & s - 1;\n }\n var u = z(t, e, n);\n if (this.tiles[u]) return P(this.tiles[u], r, l);\n o > 1 && console.log(\"drilling down to z%d-%d-%d\", t, e, n);\n for (var h, f = t, g = e, m = n; !h && f > 0;) f--, g >>= 1, m >>= 1, h = this.tiles[z(f, g, m)];\n return h && h.source ? (o > 1 && (console.log(\"found parent tile z%d-%d-%d\", f, g, m), console.time(\"drilling down\")), this.splitTile(h.source, f, g, m, t, e, n), o > 1 && console.timeEnd(\"drilling down\"), this.tiles[u] ? P(this.tiles[u], r, l) : null) : null;\n }, function (t, e) {\n return new w(t, e);\n };\n });return module.exports;});", "requires": [], "buildLevel": 0, "fileName": "/geojson-vt.js" }, "pandav:/src/index.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src\", [\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/convert\", \"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/clip\", \"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/wrap\", \"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/transform\", \"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/tile\"], function (module, exports, require, load, process, global) {\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.default = geojsonvt;\n var _convert = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/convert'));\n var _clip = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/clip'));\n var _wrap = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/wrap'));\n var _transform = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/transform'));\n var _tile = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/tile'));\n function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}\n function _typeof(o) {\"@babel/helpers - typeof\";return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;}, _typeof(o);}\n function _classCallCheck(a, n) {if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");}\n function _defineProperties(e, r) {for (var t = 0; t < r.length; t++) {var o = r[t];o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);}}\n function _createClass(e, r, t) {return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e;}\n function _toPropertyKey(t) {var i = _toPrimitive(t, \"string\");return \"symbol\" == _typeof(i) ? i : i + \"\";}\n function _toPrimitive(t, r) {if (\"object\" != _typeof(t) || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || \"default\");if (\"object\" != _typeof(i)) return i;throw new TypeError(\"@@toPrimitive must return a primitive value.\");}return (\"string\" === r ? String : Number)(t);}\n var defaultOptions = {\n maxZoom: 14,\n indexMaxZoom: 5,\n indexMaxPoints: 100000,\n tolerance: 3,\n extent: 4096,\n buffer: 64,\n lineMetrics: false,\n promoteId: null,\n generateId: false,\n hasAltitude: false,\n disableFilter: false,\n debug: 0 };\n\n var GeoJSONVT = function () {\n function GeoJSONVT(data, options) {\n _classCallCheck(this, GeoJSONVT);\n options = this.options = extend(Object.create(defaultOptions), options);\n var debug = options.debug;\n if (debug) console.time('preprocess data');\n if (options.maxZoom < 0 || options.maxZoom > 24) throw new Error('maxZoom should be in the 0-24 range');\n if (options.promoteId && options.generateId) throw new Error('promoteId and generateId cannot be used together.');\n var features = (0, _convert.default)(data, options);\n this.tiles = {};\n this.tileCoords = [];\n if (debug) {\n console.timeEnd('preprocess data');\n console.log('index: maxZoom: %d, maxPoints: %d', options.indexMaxZoom, options.indexMaxPoints);\n console.time('generate tiles');\n this.stats = {};\n this.total = 0;\n }\n features = (0, _wrap.default)(features, options);\n if (features.length) this.splitTile(features, 0, 0, 0);\n if (debug) {\n if (features.length) console.log('features: %d, points: %d', this.tiles[0].numFeatures, this.tiles[0].numPoints);\n console.timeEnd('generate tiles');\n console.log('tiles generated:', this.total, JSON.stringify(this.stats));\n }\n }\n return _createClass(GeoJSONVT, [{\n key: \"splitTile\",\n value: function splitTile(features, z, x, y, cz, cx, cy) {\n var stack = [features, z, x, y];\n var options = this.options;\n var debug = options.debug;\n while (stack.length) {\n y = stack.pop();\n x = stack.pop();\n z = stack.pop();\n features = stack.pop();\n var z2 = 1 << z;\n var id = toID(z, x, y);\n var tile = this.tiles[id];\n if (!tile) {\n if (debug > 1) console.time('creation');\n tile = this.tiles[id] = (0, _tile.default)(features, z, x, y, options);\n this.tileCoords.push({\n z: z,\n x: x,\n y: y });\n\n if (debug) {\n if (debug > 1) {\n console.log('tile z%d-%d-%d (features: %d, points: %d, simplified: %d)', z, x, y, tile.numFeatures, tile.numPoints, tile.numSimplified);\n console.timeEnd('creation');\n }\n var key = \"z\".concat(z);\n this.stats[key] = (this.stats[key] || 0) + 1;\n this.total++;\n }\n }\n tile.source = features;\n if (cz == null) {\n if (z === options.indexMaxZoom || tile.numPoints <= options.indexMaxPoints) continue;\n } else if (z === options.maxZoom || z === cz) {\n continue;\n } else if (cz != null) {\n var zoomSteps = cz - z;\n if (x !== cx >> zoomSteps || y !== cy >> zoomSteps) continue;\n }\n tile.source = null;\n if (features.length === 0) continue;\n if (debug > 1) console.time('clipping');\n var k1 = 0.5 * options.buffer / options.extent;\n var k2 = 0.5 - k1;\n var k3 = 0.5 + k1;\n var k4 = 1 + k1;\n var tl = null;\n var bl = null;\n var tr = null;\n var br = null;\n var left = (0, _clip.default)(features, z2, x - k1, x + k3, 0, tile.minX, tile.maxX, options);\n var right = (0, _clip.default)(features, z2, x + k2, x + k4, 0, tile.minX, tile.maxX, options);\n features = null;\n if (left) {\n tl = (0, _clip.default)(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n bl = (0, _clip.default)(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n left = null;\n }\n if (right) {\n tr = (0, _clip.default)(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n br = (0, _clip.default)(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n right = null;\n }\n if (debug > 1) console.timeEnd('clipping');\n stack.push(tl || [], z + 1, x * 2, y * 2);\n stack.push(bl || [], z + 1, x * 2, y * 2 + 1);\n stack.push(tr || [], z + 1, x * 2 + 1, y * 2);\n stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);\n }\n } },\n {\n key: \"getTile\",\n value: function getTile(z, x, y) {\n z = +z;\n x = +x;\n y = +y;\n var options = this.options;\n var extent = options.extent,\n debug = options.debug;\n var hasAltitude = options.hasAltitude,\n wrapX = options.wrapX;\n if (z < 0 || z > 24) return null;\n if (wrapX) {\n var z2 = 1 << z;\n x = x + z2 & z2 - 1;\n }\n var id = toID(z, x, y);\n if (this.tiles[id]) return (0, _transform.default)(this.tiles[id], extent, hasAltitude);\n if (debug > 1) console.log('drilling down to z%d-%d-%d', z, x, y);\n var z0 = z;\n var x0 = x;\n var y0 = y;\n var parent;\n while (!parent && z0 > 0) {\n z0--;\n x0 = x0 >> 1;\n y0 = y0 >> 1;\n parent = this.tiles[toID(z0, x0, y0)];\n }\n if (!parent || !parent.source) return null;\n if (debug > 1) {\n console.log('found parent tile z%d-%d-%d', z0, x0, y0);\n console.time('drilling down');\n }\n this.splitTile(parent.source, z0, x0, y0, z, x, y);\n if (debug > 1) console.timeEnd('drilling down');\n return this.tiles[id] ? (0, _transform.default)(this.tiles[id], extent, hasAltitude) : null;\n } }]);\n\n }();\n function toID(z, x, y) {\n return ((1 << z) * y + x) * 32 + z;\n }\n function extend(dest, src) {\n for (var i in src) dest[i] = src[i];\n return dest;\n }\n function geojsonvt(data, options) {\n return new GeoJSONVT(data, options);\n }return module.exports;});", "requires": [ "pandav:/src/convert.js", "pandav:/src/clip.js", "pandav:/src/wrap.js", "pandav:/src/transform.js", "pandav:/src/tile.js" ], "buildLevel": 0, "fileName": "/src/index.js" }, "pandav:/src/feature.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/feature\", [], function (module, exports, require, load, process, global) {\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.default = createFeature;\n function _createForOfIteratorHelper(r, e) {var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];if (!t) {if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {t && (r = t);var _n = 0,F = function F() {};return { s: F, n: function n() {return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] };}, e: function e(r) {throw r;}, f: F };}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");}var o,a = !0,u = !1;return { s: function s() {t = t.call(r);}, n: function n() {var r = t.next();return a = r.done, r;}, e: function e(r) {u = !0, o = r;}, f: function f() {try {a || null == t.return || t.return();} finally {if (u) throw o;}} };}\n function _unsupportedIterableToArray(r, a) {if (r) {if (\"string\" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}\n function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}\n function createFeature(id, type, geom, tags, layer, hasAltitude) {\n var feature = {\n id: id == null ? null : id,\n type: type,\n geometry: geom,\n tags: tags,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity };\n\n if (layer) {\n feature.layer = layer;\n }\n var stride = hasAltitude ? 4 : 3;\n calcBBox(feature, stride);\n return feature;\n }\n function calcBBox(feature, stride) {\n var geom = feature.geometry;\n var type = feature.type;\n if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {\n calcLineBBox(feature, geom, stride);\n } else if (type === 'Polygon') {\n calcLineBBox(feature, geom[0], stride);\n } else if (type === 'MultiLineString') {\n var _iterator = _createForOfIteratorHelper(geom),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var line = _step.value;\n calcLineBBox(feature, line, stride);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n } else if (type === 'MultiPolygon') {\n var _iterator2 = _createForOfIteratorHelper(geom),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var polygon = _step2.value;\n calcLineBBox(feature, polygon[0], stride);\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n return feature;\n }\n function calcLineBBox(feature, geom, stride) {\n for (var i = 0; i < geom.length; i += stride) {\n feature.minX = Math.min(feature.minX, geom[i]);\n feature.minY = Math.min(feature.minY, geom[i + 1]);\n feature.maxX = Math.max(feature.maxX, geom[i]);\n feature.maxY = Math.max(feature.maxY, geom[i + 1]);\n }\n }return module.exports;});", "requires": [], "buildLevel": 0, "fileName": "/src/feature.js" }, "pandav:/src/simplify.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/simplify\", [], function (module, exports, require, load, process, global) {\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.default = simplify;\n function simplify(coords, first, last, sqTolerance) {\n var stride = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 3;\n var maxSqDist = sqTolerance;\n var mid = last - first >> 1;\n var minPosToMid = last - first;\n var index;\n var ax = coords[first];\n var ay = coords[first + 1];\n var bx = coords[last];\n var by = coords[last + 1];\n for (var i = first + stride; i < last; i += stride) {\n var d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by);\n if (d > maxSqDist) {\n index = i;\n maxSqDist = d;\n } else if (d === maxSqDist) {\n var posToMid = Math.abs(i - mid);\n if (posToMid < minPosToMid) {\n index = i;\n minPosToMid = posToMid;\n }\n }\n }\n if (maxSqDist > sqTolerance) {\n if (index - first > stride) simplify(coords, first, index, sqTolerance, stride);\n coords[index + 2] = maxSqDist;\n if (last - index > stride) simplify(coords, index, last, sqTolerance, stride);\n }\n }\n function getSqSegDist(px, py, x, y, bx, by) {\n var dx = bx - x;\n var dy = by - y;\n if (dx !== 0 || dy !== 0) {\n var t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x = bx;\n y = by;\n } else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n dx = px - x;\n dy = py - y;\n return dx * dx + dy * dy;\n }return module.exports;});", "requires": [], "buildLevel": 0, "fileName": "/src/simplify.js" }, "pandav:/src/tile.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/tile\", [], function (module, exports, require, load, process, global) {\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.default = createTile;\n function _createForOfIteratorHelper(r, e) {var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];if (!t) {if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {t && (r = t);var _n = 0,F = function F() {};return { s: F, n: function n() {return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] };}, e: function e(r) {throw r;}, f: F };}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");}var o,a = !0,u = !1;return { s: function s() {t = t.call(r);}, n: function n() {var r = t.next();return a = r.done, r;}, e: function e(r) {u = !0, o = r;}, f: function f() {try {a || null == t.return || t.return();} finally {if (u) throw o;}} };}\n function _unsupportedIterableToArray(r, a) {if (r) {if (\"string\" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}\n function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}\n function createTile(features, z, tx, ty, options) {\n var tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);\n var tile = {\n features: [],\n numPoints: 0,\n numSimplified: 0,\n numFeatures: features.length,\n source: null,\n x: tx,\n y: ty,\n z: z,\n transformed: false,\n minX: 2,\n minY: 1,\n maxX: -1,\n maxY: 0 };\n\n var _iterator = _createForOfIteratorHelper(features),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var feature = _step.value;\n addFeature(tile, feature, tolerance, options);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return tile;\n }\n function addFeature(tile, feature, tolerance, options) {\n var geom = feature.geometry;\n var type = feature.type;\n var simplified = [];\n var stride = options.hasAltitude ? 4 : 3;\n tile.minX = Math.min(tile.minX, feature.minX);\n tile.minY = Math.min(tile.minY, feature.minY);\n tile.maxX = Math.max(tile.maxX, feature.maxX);\n tile.maxY = Math.max(tile.maxY, feature.maxY);\n if (type === 'Point' || type === 'MultiPoint') {\n for (var i = 0; i < geom.length; i += stride) {\n simplified.push(geom[i], geom[i + 1]);\n if (options.hasAltitude) {\n simplified.push(geom[i + 3]);\n }\n tile.numPoints++;\n tile.numSimplified++;\n }\n } else if (type === 'LineString') {\n addLine(simplified, geom, tile, tolerance, false, false, options);\n } else if (type === 'MultiLineString' || type === 'Polygon') {\n for (var _i = 0; _i < geom.length; _i++) {\n addLine(simplified, geom[_i], tile, tolerance, type === 'Polygon', _i === 0, options);\n }\n } else if (type === 'MultiPolygon') {\n for (var k = 0; k < geom.length; k++) {\n var polygon = geom[k];\n for (var _i2 = 0; _i2 < polygon.length; _i2++) {\n addLine(simplified, polygon[_i2], tile, tolerance, true, _i2 === 0, options);\n }\n }\n }\n if (simplified.length) {\n var tags = feature.tags || null;\n if (type === 'LineString' && options.lineMetrics) {\n tags = {};\n for (var key in feature.tags) tags[key] = feature.tags[key];\n tags['mapbox_clip_start'] = geom.start / geom.size;\n tags['mapbox_clip_end'] = geom.end / geom.size;\n }\n var tileFeature = {\n geometry: simplified,\n type: type === 'Polygon' || type === 'MultiPolygon' ? 3 : type === 'LineString' || type === 'MultiLineString' ? 2 : 1,\n tags: tags };\n\n if (feature.layer) {\n tileFeature.layer = feature.layer;\n }\n if (feature.id !== null) {\n tileFeature.id = feature.id;\n }\n tile.features.push(tileFeature);\n }\n }\n function keepSimplified(geom, i, hasAltitude) {\n return geom[i + 2] === 0 && geom[i + 3] > 0 && hasAltitude;\n }\n function addLine(result, geom, tile, tolerance, isPolygon, isOuter, options) {\n var sqTolerance = tolerance * tolerance;\n var hasAltitude = options.hasAltitude,\n disableFilter = options.disableFilter;\n var stride = hasAltitude ? 4 : 3;\n if (!disableFilter && tolerance > 0 && geom.size < (isPolygon ? sqTolerance : tolerance)) {\n tile.numPoints += geom.length / stride;\n return;\n }\n var ring = [];\n for (var i = 0; i < geom.length; i += stride) {\n if (tolerance === 0 || geom[i + 2] > sqTolerance || keepSimplified(geom, i, hasAltitude)) {\n tile.numSimplified++;\n ring.push(geom[i], geom[i + 1]);\n if (hasAltitude) {\n ring.push(geom[i + 3]);\n }\n }\n tile.numPoints++;\n }\n if (isPolygon) rewind(ring, isOuter, hasAltitude);\n result.push(ring);\n }\n function rewind(ring, clockwise, hasAltitude) {\n var stride = hasAltitude ? 3 : 2;\n var area = 0;\n for (var i = 0, len = ring.length, j = len - stride; i < len; j = i, i += stride) {\n area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);\n }\n if (area > 0 === clockwise) {\n var posX = stride;\n var posY = stride - 1;\n var posA = stride - 2;\n for (var _i3 = 0, _len = ring.length; _i3 < _len / 2; _i3 += stride) {\n var x = ring[_i3];\n var y = ring[_i3 + 1];\n var altitude = void 0;\n if (hasAltitude) {\n altitude = ring[_i3 + 2];\n }\n ring[_i3] = ring[_len - posX - _i3];\n ring[_i3 + 1] = ring[_len - posY - _i3];\n if (hasAltitude) {\n ring[_i3 + 2] = ring[_len - posA - _i3];\n }\n ring[_len - posX - _i3] = x;\n ring[_len - posY - _i3] = y;\n if (hasAltitude) {\n ring[_len - posA - _i3] = altitude;\n }\n }\n }\n }return module.exports;});", "requires": [], "buildLevel": 0, "fileName": "/src/tile.js" }, "pandav:/src/convert.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/convert\", [\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/simplify\", \"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/feature\"], function (module, exports, require, load, process, global) {\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.default = convert;\n var _simplify = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/simplify'));\n var _feature = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/feature'));\n function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}\n function _createForOfIteratorHelper(r, e) {var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];if (!t) {if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {t && (r = t);var _n = 0,F = function F() {};return { s: F, n: function n() {return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] };}, e: function e(r) {throw r;}, f: F };}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");}var o,a = !0,u = !1;return { s: function s() {t = t.call(r);}, n: function n() {var r = t.next();return a = r.done, r;}, e: function e(r) {u = !0, o = r;}, f: function f() {try {a || null == t.return || t.return();} finally {if (u) throw o;}} };}\n function _unsupportedIterableToArray(r, a) {if (r) {if (\"string\" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}\n function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}\n function convert(data, options) {\n var features = [];\n if (Array.isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n convertLayerData(features, data[i].layer, data[i].data, options);\n }\n return features;\n }\n if (data.type === 'FeatureCollection') {\n for (var _i = 0; _i < data.features.length; _i++) {\n convertFeature(features, data.features[_i], options, _i);\n }\n } else if (data.type === 'Feature') {\n convertFeature(features, data, options);\n } else {\n convertFeature(features, {\n geometry: data },\n options);\n }\n return features;\n }\n function convertLayerData(features, layer, data, options) {\n options.layer = layer;\n if (data.type === 'FeatureCollection') {\n for (var i = 0; i < data.features.length; i++) {\n convertFeature(features, data.features[i], options, i);\n }\n } else if (data.type === 'Feature') {\n convertFeature(features, data, options);\n } else {\n convertFeature(features, {\n geometry: data },\n options);\n }\n }\n function convertFeature(features, geojson, options, index) {\n if (!geojson.geometry) return;\n var coords = geojson.geometry.coordinates;\n var type = geojson.geometry.type;\n var tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2);\n var geometry = [];\n var id = geojson.id;\n if (options.promoteId) {\n id = geojson.properties[options.promoteId];\n } else if (options.generateId) {\n id = index || 0;\n }\n if (type === 'Point') {\n convertPoint(coords, geometry, options);\n } else if (type === 'MultiPoint') {\n var _iterator = _createForOfIteratorHelper(coords),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var p = _step.value;\n convertPoint(p, geometry, options);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n } else if (type === 'LineString') {\n convertLine(coords, geometry, tolerance, false, options);\n } else if (type === 'MultiLineString') {\n if (options.lineMetrics) {\n var _iterator2 = _createForOfIteratorHelper(coords),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var line = _step2.value;\n geometry = [];\n convertLine(line, geometry, tolerance, false, options);\n features.push((0, _feature.default)(id, 'LineString', geometry, geojson.properties, options.layer, options.hasAltitude));\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return;\n } else {\n convertLines(coords, geometry, tolerance, false, options);\n }\n } else if (type === 'Polygon') {\n convertLines(coords, geometry, tolerance, true, options);\n } else if (type === 'MultiPolygon') {\n var _iterator3 = _createForOfIteratorHelper(coords),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var polygon = _step3.value;\n var newPolygon = [];\n convertLines(polygon, newPolygon, tolerance, true, options);\n geometry.push(newPolygon);\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n } else if (type === 'GeometryCollection') {\n var _iterator4 = _createForOfIteratorHelper(geojson.geometry.geometries),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var singleGeometry = _step4.value;\n convertFeature(features, {\n id: id,\n geometry: singleGeometry,\n properties: geojson.properties },\n options, index);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n return;\n } else {\n throw new Error('Input data is not a valid GeoJSON object.');\n }\n features.push((0, _feature.default)(id, type, geometry, geojson.properties, options.layer, options.hasAltitude));\n }\n function convertPoint(coords, out, options) {\n out.push(projectX(coords[0]), projectY(coords[1], options.projection), 0);\n if (options.hasAltitude) {\n if (coords.length > 2) {\n out.push(coords[2]);\n } else {\n out.push(0);\n }\n }\n }\n function convertLine(ring, out, tolerance, isPolygon, options) {\n var x0, y0;\n var size = 0;\n for (var j = 0; j < ring.length; j++) {\n var x = projectX(ring[j][0]);\n var y = projectY(ring[j][1], options.projection);\n out.push(x, y, 0);\n if (options.hasAltitude) {\n if (ring[j].length > 2) {\n out.push(ring[j][2]);\n } else {\n out.push(0);\n }\n }\n if (j > 0) {\n if (isPolygon) {\n size += (x0 * y - x * y0) / 2;\n } else {\n size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2));\n }\n }\n x0 = x;\n y0 = y;\n }\n var stride = options.hasAltitude ? 4 : 3;\n var last = out.length - stride;\n out[2] = 1;\n (0, _simplify.default)(out, 0, last, tolerance, stride);\n out[last + 2] = 1;\n out.size = Math.abs(size);\n out.start = 0;\n out.end = out.size;\n }\n function convertLines(rings, out, tolerance, isPolygon, options) {\n for (var i = 0; i < rings.length; i++) {\n var geom = [];\n convertLine(rings[i], geom, tolerance, isPolygon, options);\n out.push(geom);\n }\n }\n function projectX(x) {\n return x / 360 + 0.5;\n }\n function projectY(y, proj) {\n switch (proj) {\n case 'EPSG:4326':\n return (90 - y) / 360.0;}\n\n var sin = Math.sin(y * Math.PI / 180);\n var y2 = 0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI;\n return y2 < 0 ? 0 : y2 > 1 ? 1 : y2;\n }return module.exports;});", "requires": [ "pandav:/src/simplify.js", "pandav:/src/feature.js" ], "buildLevel": 0, "fileName": "/src/convert.js" }, "pandav:/src/wrap.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/wrap\", [\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/clip\", \"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/feature\"], function (module, exports, require, load, process, global) {\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.default = wrap;\n var _clip = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/clip'));\n var _feature = _interopRequireDefault(require('pandav:/npm/@maptalks/geojson-vt/3.5.0/src/feature'));\n function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}\n function _createForOfIteratorHelper(r, e) {var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];if (!t) {if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {t && (r = t);var _n = 0,F = function F() {};return { s: F, n: function n() {return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] };}, e: function e(r) {throw r;}, f: F };}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");}var o,a = !0,u = !1;return { s: function s() {t = t.call(r);}, n: function n() {var r = t.next();return a = r.done, r;}, e: function e(r) {u = !0, o = r;}, f: function f() {try {a || null == t.return || t.return();} finally {if (u) throw o;}} };}\n function _unsupportedIterableToArray(r, a) {if (r) {if (\"string\" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}\n function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}\n function wrap(features, options) {\n var buffer = options.buffer / options.extent;\n var merged = features;\n var left = (0, _clip.default)(features, 1, -1 - buffer, buffer, 0, -1, 2, options);\n var right = (0, _clip.default)(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options);\n if (left || right) {\n merged = (0, _clip.default)(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || [];\n if (left) merged = shiftFeatureCoords(left, 1, options.hasAltitude).concat(merged);\n if (right) merged = merged.concat(shiftFeatureCoords(right, -1, options.hasAltitude));\n }\n return merged;\n }\n function shiftFeatureCoords(features, offset, hasAltitude) {\n var newFeatures = [];\n for (var i = 0; i < features.length; i++) {\n var feature = features[i];\n var type = feature.type;\n var newGeometry = void 0;\n if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {\n newGeometry = shiftCoords(feature.geometry, offset, hasAltitude);\n } else if (type === 'MultiLineString' || type === 'Polygon') {\n newGeometry = [];\n var _iterator = _createForOfIteratorHelper(feature.geometry),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var line = _step.value;\n newGeometry.push(shiftCoords(line, offset, hasAltitude));\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n } else if (type === 'MultiPolygon') {\n newGeometry = [];\n var _iterator2 = _createForOfIteratorHelper(feature.geometry),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var polygon = _step2.value;\n var newPolygon = [];\n var _iterator3 = _createForOfIteratorHelper(polygon),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var _line = _step3.value;\n newPolygon.push(shiftCoords(_line, offset, hasAltitude));\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n newGeometry.push(newPolygon);\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n newFeatures.push((0, _feature.default)(feature.id, type, newGeometry, feature.tags, feature.layer, hasAltitude));\n }\n return newFeatures;\n }\n function shiftCoords(points, offset, hasAltitude) {\n var newPoints = [];\n newPoints.size = points.size;\n if (points.start !== undefined) {\n newPoints.start = points.start;\n newPoints.end = points.end;\n }\n var stride = hasAltitude ? 4 : 3;\n for (var i = 0; i < points.length; i += stride) {\n newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);\n if (hasAltitude) {\n newPoints.push(points[i + 3]);\n }\n }\n return newPoints;\n }return module.exports;});", "requires": [ "pandav:/src/clip.js", "pandav:/src/feature.js" ], "buildLevel": 0, "fileName": "/src/wrap.js" }, "pandav:/src/transform.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/geojson-vt/3.5.0/src/transform\", [], function (module, exports, require, load, process, global) {\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.default = transformTile;\n function _createForOfIteratorHelper(r, e) {var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];if (!t) {if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {t && (r = t);var _n = 0,F = function F() {};return { s: F, n: function n() {return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] };}, e: function e(r) {throw r;}, f: F };}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");}var o,a = !0,u = !1;return { s: function s() {t = t.call(r);}, n: function n() {var r = t.next();return a = r.done, r;}, e: function e(r) {u = !0, o = r;}, f: function f() {try {a || null == t.return || t.return();} finally {if (u) throw o;}} };}\n function _unsupportedIterableToArray(r, a) {if (r) {if (\"string\" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}\n function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}\n function transformTile(tile, extent, hasAltitude) {\n if (tile.transformed) return tile;\n var z2 = 1 << tile.z;\n var tx = tile.x;\n var ty = tile.y;\n var stride = hasAltitude ? 3 : 2;\n var _iterator = _createForOfIteratorHelper(tile.features),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var feature = _step.value;\n var geom = feature.geometry;\n var type = feature.type;\n feature.geometry = [];\n if (type === 1) {\n for (var j = 0; j < geom.length; j += stride) {\n feature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));\n if (hasAltitude) {\n feature.geometry[feature.geometry.length - 1].push(geom[j + 2]);\n }\n }\n } else {\n for (var _j = 0; _j < geom.length; _j++) {\n var ring = [];\n for (var k = 0; k < geom[_j].length; k += stride) {\n ring.push(transformPoint(geom[_j][k], geom[_j][k + 1], extent, z2, tx, ty));\n if (hasAltitude) {\n ring[ring.length - 1].push(geom[_j][k + 2]);\n }\n }\n feature.geometry.push(ring);\n }\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n tile.transformed = true;\n return tile;\n }\n function transformPoint(x, y, extent, z2, tx, ty) {\n return [Math.round(extent * (x * z2 - tx)), Math.round(extent * (y * z2 - ty))];\n }return module.exports;});", "requires": [], "buildLevel": 0, "fileName": "/src/transform.js" } }