From ed8138d66584445f2571ba50d3da07c5f354a89b Mon Sep 17 00:00:00 2001 From: Brett Camper Date: Sun, 23 Feb 2020 21:44:59 -0500 Subject: [PATCH] v0.20.1 --- dist/tangram.debug.js | 1333 +++++++++++++++++++----------------- dist/tangram.debug.js.map | 2 +- dist/tangram.debug.mjs | 1147 +++++++++++++++++-------------- dist/tangram.debug.mjs.map | 2 +- dist/tangram.min.js | 8 +- dist/tangram.min.mjs | 8 +- package-lock.json | 24 +- package.json | 2 +- 8 files changed, 1354 insertions(+), 1172 deletions(-) diff --git a/dist/tangram.debug.js b/dist/tangram.debug.js index 129cdb67b..271629d97 100644 --- a/dist/tangram.debug.js +++ b/dist/tangram.debug.js @@ -519,7 +519,7 @@ var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORC // Set @@toStringTag to native iterators _setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines - if (typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); + if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF @@ -528,7 +528,7 @@ var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORC $default = function values() { return $native.call(this); }; } // Define iterator - if (BUGGY || VALUES_BUG || !proto[ITERATOR]) { + if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { _hide(proto, ITERATOR, $default); } // Plug for library @@ -1477,8 +1477,6 @@ var SAFE_CLOSING = false; try { var riter = [7][ITERATOR$4](); riter['return'] = function () { SAFE_CLOSING = true; }; - // eslint-disable-next-line no-throw-literal - Array.from(riter, function () { throw 2; }); } catch (e) { /* empty */ } var _iterDetect = function (exec, skipClosing) { @@ -1719,10 +1717,10 @@ _export(_export.S + _export.F * !USE_NATIVE, PROMISE, { return capability.promise; } }); -_export(_export.S + _export.F * (!USE_NATIVE), PROMISE, { +_export(_export.S + _export.F * (_library || !USE_NATIVE), PROMISE, { // 25.4.4.6 Promise.resolve(x) resolve: function resolve(x) { - return _promiseResolve(this, x); + return _promiseResolve(_library && this === Wrapper ? $Promise : this, x); } }); _export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) { @@ -1914,7 +1912,7 @@ function _wrapNativeSuper(Class) { return _wrapNativeSuper(Class); } -var version = "0.20.0"; +var version = "0.20.1"; var version$1 = 'v' + version; @@ -1935,7 +1933,7 @@ var LAST_INDEX$1 = 'lastIndex'; var MAX_UINT32 = 0xffffffff; // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError -var SUPPORTS_Y = !_fails(function () { RegExp(MAX_UINT32, 'y'); }); +var SUPPORTS_Y = !_fails(function () { }); // @@split logic _fixReWks('split', 2, function (defined, SPLIT, $split, maybeCallNative) { @@ -2948,7 +2946,9 @@ var debugSettings$1 = debugSettings = { // show hidden labels for debugging show_hidden_labels: false, // collect feature/geometry stats on styling layers - layer_stats: false + layer_stats: false, + // draw scene in wireframe mode + wireframe: false }; function mergeDebugSettings(settings) { Object.assign(debugSettings, settings); @@ -6070,7 +6070,7 @@ var VertexArrayObject = { log('warn', 'Vertex Array Object extension force disabled'); } }, - getExtension: function getExtension$1(gl, ext_name) { + getExtension: function getExtension$$1(gl, ext_name) { if (this.disabled !== true) { return getExtension(gl, ext_name); } @@ -9978,6 +9978,23 @@ DataSource.register('Raster', function (source) { return RasterTileSource.urlHasTilePattern(source.url) ? RasterTileSource : RasterSource; }); +// Rearranges element array for triangles into a new element array that draws a wireframe +// Used for debugging +function makeWireframeForTriangleElementData(element_data) { + var wireframe_data = new Uint16Array(element_data.length * 2); // Draw triangles as lines: + // Make a copy of element_data, and for every group of three vertices, duplicate + // each vertex according to the following pattern: + // [1, 2, 3] => [1, 2, 2, 3, 3, 1] + // This takes three vertices which would have been interpreted as a triangle, + // and converts them into three 2-vertex line segments. + + for (var i = 0; i < element_data.length; i += 3) { + wireframe_data.set([element_data[i], element_data[i + 1], element_data[i + 1], element_data[i + 2], element_data[i + 2], element_data[i]], i * 2); + } + + return wireframe_data; +} + var selection_fragment_source = "// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n"; var rasters_source = "// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(TANGRAM_HAS_MASKED_RASTERS) && !defined(TANGRAM_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n"; @@ -10401,6 +10418,15 @@ var Style = { } var vertex_layout = this.vertexLayoutForMeshVariant(options.variant); + + if (debugSettings$1.wireframe) { + // In wireframe debug mode, transform mesh into lines + vertex_elements = makeWireframeForTriangleElementData(vertex_elements); + return new VBOMesh(this.gl, vertex_data, vertex_elements, vertex_layout, Object.assign({}, options, { + draw_mode: this.gl.LINES + })); + } + return new VBOMesh(this.gl, vertex_data, vertex_elements, vertex_layout, options); }, render: function render(mesh) { @@ -10684,7 +10710,7 @@ var Style = { } }, $Try_3_Catch); } catch (e) { - $Try_3_Catch(); + $Try_3_Catch(e); } }.bind(this)); }, @@ -12116,7 +12142,7 @@ function triangulatePolygon(data) { var polygons_vs = "uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define TANGRAM_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define TANGRAM_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define TANGRAM_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define TANGRAM_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define TANGRAM_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, TANGRAM_POSITION_Z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // \"Flattens\" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * TANGRAM_UNPACK_SCALING(TANGRAM_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = TANGRAM_UNPACK_SCALING(TANGRAM_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates \"direction\" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale \"up\" or \"down\"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef TANGRAM_BLOCK_WIDTH\n float width = 1.;\n #pragma tangram: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n"; -var polygons_fs = "uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip conditional if *only* masked raster sources (always true)\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n if (_line_color.a < TANGRAM_ALPHA_TEST) {\n #if defined(TANGRAM_BLEND_OPAQUE)\n // use discard when alpha blending is unavailable\n if (u_dash_background_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n color = vec4(u_dash_background_color.rgb, 1.); // only allow full alpha in opaque blend mode\n #else\n // use alpha channel when blending is available\n color = vec4(u_dash_background_color.rgb, color.a * step(TANGRAM_EPSILON, u_dash_background_color.a));\n #endif\n }\n else {\n color *= _line_color;\n }\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n"; +var polygons_fs = "uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(TANGRAM_BLEND_OPAQUE)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n"; var Polygons = Object.create(Style); Object.assign(Polygons, { @@ -12293,7 +12319,7 @@ Object.assign(Polygons, { this.addCustomAttributesToVertexTemplate(style, i); return this.vertex_template; }, - buildPolygons: function buildPolygons$1(polygons, style, context) { + buildPolygons: function buildPolygons$$1(polygons, style, context) { var mesh = this.getTileMesh(context.tile, this.meshVariantTypeForDraw(style)); var vertex_data = mesh.vertex_data; var vertex_layout = vertex_data.vertex_layout; @@ -13384,6 +13410,7 @@ Object.assign(Lines, { if (variant.dash) { uniforms.u_v_scale_adjust = Geo$1.tile_scale * DASH_SCALE; + uniforms.u_has_dash = variant.dash_background_color != null ? 1 : 0; uniforms.u_dash_background_color = variant.dash_background_color || [0, 0, 0, 0]; } @@ -15088,7 +15115,7 @@ var FontManager = { } }, $Try_1_Catch); } catch (e) { - $Try_1_Catch(); + $Try_1_Catch(e); } } @@ -16361,7 +16388,7 @@ var TextLabels = { } }.bind(this), $Try_1_Catch); } catch (e) { - $Try_1_Catch(); + $Try_1_Catch(e); } }.bind(this)); }, @@ -16413,14 +16440,6 @@ var TextLabels = { } }); // second call to main thread, for rasterizing the set of texts - var $Try_2_Post = function () { - try { - return $return(); - } catch ($boundEx) { - return $error($boundEx); - } - }; - var $Try_2_Catch = function (e) { try { // error thrown if style has been removed from main thread @@ -17681,7 +17700,7 @@ function () { var points_vs = "uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform bool u_tile_fade_in;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_view_panning;\nuniform float u_view_pan_snap_timer;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\nuniform float u_point_type;\n\n#ifdef TANGRAM_CURVED_LABEL\n attribute vec4 a_offsets;\n attribute vec4 a_pre_angles;\n attribute vec4 a_angles;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n attribute float a_outline_edge;\n attribute vec4 a_outline_color;\n\n varying float v_outline_edge;\n varying vec4 v_outline_color;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\n#ifdef TANGRAM_CURVED_LABEL\n // Assumes stops are [0, 0.33, 0.66, 0.99];\n float mix4linear(vec4 v, float x) {\n x = clamp(x, 0., 1.);\n return mix(mix(v[0], v[1], 3. * x),\n mix(v[1],\n mix(v[2], v[3], 3. * (max(x, .66) - .66)),\n 3. * (clamp(x, .33, .66) - .33)),\n step(0.33, x)\n );\n }\n#endif\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // discard hidden labels by collapsing into degenerate triangle\n #ifndef TANGRAM_SHOW_HIDDEN_LABELS\n if (a_shape.w == 0.) {\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n #else\n // highlight hidden label in fragment shader for debugging\n if (a_shape.w == 0.) {\n v_label_hidden = 1.; // label debug testing\n }\n else {\n v_label_hidden = 0.;\n }\n #endif\n\n v_alpha_factor = 1.0;\n v_color = a_color;\n v_texcoord = a_texcoord; // UV from vertex attribute\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n v_outline_color = a_outline_color;\n v_outline_edge = a_outline_edge;\n\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // use point dimensions for UVs instead (ignore attribute), add antialiasing info for fragment shader\n float _size = abs(a_shape.x / 128.); // radius in pixels\n v_texcoord = sign(a_shape.xy) * (_size + 1.) / _size;\n _size += 2.;\n v_aa_offset = 2. / _size;\n }\n #endif\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 _shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 _offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float _theta = a_shape.z / 4096.;\n\n #ifdef TANGRAM_CURVED_LABEL\n //TODO: potential bug? null is passed in for non-curved labels, otherwise the first offset will be 0\n if (a_offsets[0] != 0.){\n vec4 _angles_scaled = (TANGRAM_PI / 16384.) * a_angles;\n vec4 _pre_angles_scaled = (TANGRAM_PI / 128.) * a_pre_angles;\n vec4 _offsets_scaled = (1. / 64.) * a_offsets;\n\n float _zoom = clamp(u_map_position.z - u_tile_origin.z, 0., 1.); //fract(u_map_position.z);\n float _pre_angle = mix4linear(_pre_angles_scaled, _zoom);\n float _angle = mix4linear(_angles_scaled, _zoom);\n float _offset_curve = mix4linear(_offsets_scaled, _zoom);\n\n _shape = rotate2D(_shape, _pre_angle); // rotate in place\n _shape.x += _offset_curve; // offset for curved label segment\n _shape = rotate2D(_shape, _angle); // rotate relative to curved label anchor\n _shape += rotate2D(_offset, _theta); // offset if specified in the scene file\n }\n else {\n _shape = rotate2D(_shape + _offset, _theta);\n }\n #else\n _shape = rotate2D(_shape + _offset, _theta);\n #endif\n\n // Fade in (if requested) based on time mesh has been visible.\n // Value passed to fragment shader in the v_alpha_factor varying\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_tile_fade_in) {\n v_alpha_factor *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += _shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += _shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // enlarge by 1px to catch missed MSAA fragments\n position.xy += sign(_shape) * position.w * u_device_pixel_ratio / u_resolution;\n }\n #endif\n\n // Snap to pixel grid\n // Only applied to fully upright sprites/labels (not shader-drawn points), while panning is not active\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON) && u_point_type != TANGRAM_POINT_TYPE_SHADER) {\n #else\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON)) {\n #endif\n vec2 _position_fract = fract((((position.xy / position.w) + 1.) * .5) * u_resolution);\n vec2 _position_snap = position.xy + ((step(0.5, _position_fract) - _position_fract) * position.w * 2. / u_resolution);\n\n // Animate the snapping to smooth the transition and make it less noticeable\n #ifdef TANGRAM_VIEW_PAN_SNAP_RATE\n position.xy = mix(position.xy, _position_snap, clamp(u_view_pan_snap_timer * TANGRAM_VIEW_PAN_SNAP_RATE, 0., 1.));\n #else\n position.xy = _position_snap;\n #endif\n }\n\n gl_Position = position;\n}\n"; -var points_fs = "uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n gl_FragColor = color;\n}\n"; +var points_fs = "uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n // Make points more visible in wireframe debug mode\n #ifdef TANGRAM_WIREFRAME\n color = vec4(vec3(0.5), 1.); // use gray outline for textured points\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) {\n color = vec4(v_color.rgb, 1.); // use original vertex color outline for shader points\n }\n #endif\n #endif\n\n gl_FragColor = color;\n}\n"; var PLACEMENT$1 = LabelPoint.PLACEMENT; var Points = Object.create(Style); @@ -17756,6 +17775,11 @@ Object.assign(Points, { if (debugSettings$1.show_hidden_labels === true) { this.defines.TANGRAM_SHOW_HIDDEN_LABELS = true; + } // Enable wireframe for debugging + + + if (debugSettings$1.wireframe === true) { + this.defines.TANGRAM_WIREFRAME = true; } }, reset: function reset() { @@ -20512,10 +20536,10 @@ function parseFilter(filter, options) { if (value.max || value.min) { filterAST.push(rangeMatch(key, value, options)); } else if (value.includes_any || value.includes_all) { - filterAST.push(includesMatch(key, value)); + filterAST.push(includesMatch(key, value, options)); } } else if (value == null) { - filterAST.push(nullValue()); + filterAST.push(nullValue(key, value)); } else { throw new Error('Unknown Query syntax: ' + value); } @@ -20673,7 +20697,7 @@ function () { this.calculatedDraw = calculateDraw(this); }; - _proto.buildFilter = function buildFilter$1() { + _proto.buildFilter = function buildFilter$$1() { this.filter_original = this.filter; this.filter = compileFunctionStrings(this.filter, StyleParser.wrapFunction); var type = typeof this.filter; @@ -21120,7 +21144,7 @@ function matchFeature(context, layers, collected_layers, collected_layers_ids) { return matched; } -var id$1 = 0; // unique tile id +var id$2 = 0; // unique tile id var build_id = 0; // id tracking order in which tiles were build @@ -21140,7 +21164,7 @@ function () { source = _ref.source, workers = _ref.workers, view = _ref.view; - this.id = id$1++; + this.id = id$2++; this.view = view; this.source = source; this.generation = null; @@ -21562,12 +21586,10 @@ function () { } for (var layer in source_data.layers) { - if (source_data.layers[layer].features) { - layers.push({ - layer: layer, - geom: source_data.layers[layer] - }); - } + layers.push({ + layer: layer, + geom: source_data.layers[layer] + }); } } // If no source layer specified, and a default data source layer exists else if (!source_config.layer && source_data.layers._default) { @@ -21589,12 +21611,10 @@ function () { } // If multiple source layers are specified by name, combine them else if (Array.isArray(source_config.layer)) { source_config.layer.forEach(function (layer) { - if (source_data.layers[layer] && source_data.layers[layer].features) { - layers.push({ - layer: layer, - geom: source_data.layers[layer] - }); - } + layers.push({ + layer: layer, + geom: source_data.layers[layer] + }); }); } } @@ -23419,58 +23439,50 @@ DataSource.register('MVT', function () { return MVTSource; }); -var simplify_1 = simplify; - // calculate simplification data using optimized Douglas-Peucker algorithm -function simplify(points, tolerance) { - - var sqTolerance = tolerance * tolerance, - len = points.length, - first = 0, - last = len - 1, - stack = [], - i, maxSqDist, sqDist, index; - - // always retain the endpoints (1 is the max value) - points[first][2] = 1; - points[last][2] = 1; - - // avoid recursion by using a stack - while (last) { - - maxSqDist = 0; - - for (i = first + 1; i < last; i++) { - sqDist = getSqSegDist(points[i], points[first], points[last]); - - if (sqDist > maxSqDist) { +function simplify(coords, first, last, sqTolerance) { + var maxSqDist = sqTolerance; + var mid = (last - first) >> 1; + var minPosToMid = last - first; + var index; + + var ax = coords[first]; + var ay = coords[first + 1]; + var bx = coords[last]; + var by = coords[last + 1]; + + for (var i = first + 3; i < last; i += 3) { + var d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by); + + if (d > maxSqDist) { + index = i; + maxSqDist = d; + + } else if (d === maxSqDist) { + // a workaround to ensure we choose a pivot close to the middle of the list, + // reducing recursion depth, for certain degenerate inputs + // https://github.com/mapbox/geojson-vt/issues/104 + var posToMid = Math.abs(i - mid); + if (posToMid < minPosToMid) { index = i; - maxSqDist = sqDist; + minPosToMid = posToMid; } } + } - if (maxSqDist > sqTolerance) { - points[index][2] = maxSqDist; // save the point importance in squared pixels as a z coordinate - stack.push(first); - stack.push(index); - first = index; - - } else { - last = stack.pop(); - first = stack.pop(); - } + if (maxSqDist > sqTolerance) { + if (index - first > 3) simplify(coords, first, index, sqTolerance); + coords[index + 2] = maxSqDist; + if (last - index > 3) simplify(coords, index, last, sqTolerance); } } // square distance from a point to a segment -function getSqSegDist(p, a, b) { +function getSqSegDist(px, py, x, y, bx, by) { - var x = a[0], y = a[1], - bx = b[0], by = b[1], - px = p[0], py = p[1], - dx = bx - x, - dy = by - y; + var dx = bx - x; + var dy = by - y; if (dx !== 0 || dy !== 0) { @@ -23492,216 +23504,189 @@ function getSqSegDist(p, a, b) { return dx * dx + dy * dy; } -var feature$1 = createFeature; - -function createFeature(tags, type, geom, id) { +function createFeature(id, type, geom, tags) { var feature = { - id: id || null, + id: typeof id === 'undefined' ? null : id, type: type, geometry: geom, - tags: tags || null, - min: [Infinity, Infinity], // initial bbox values - max: [-Infinity, -Infinity] + tags: tags, + minX: Infinity, + minY: Infinity, + maxX: -Infinity, + maxY: -Infinity }; calcBBox(feature); return feature; } -// calculate the feature bounding box for faster clipping later function calcBBox(feature) { - var geometry = feature.geometry, - min = feature.min, - max = feature.max; + var geom = feature.geometry; + var type = feature.type; - if (feature.type === 1) { - calcRingBBox(min, max, geometry); - } else { - for (var i = 0; i < geometry.length; i++) { - calcRingBBox(min, max, geometry[i]); + if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') { + calcLineBBox(feature, geom); + + } else if (type === 'Polygon' || type === 'MultiLineString') { + for (var i = 0; i < geom.length; i++) { + calcLineBBox(feature, geom[i]); } - } - return feature; + } else if (type === 'MultiPolygon') { + for (i = 0; i < geom.length; i++) { + for (var j = 0; j < geom[i].length; j++) { + calcLineBBox(feature, geom[i][j]); + } + } + } } -function calcRingBBox(min, max, points) { - for (var i = 0, p; i < points.length; i++) { - p = points[i]; - min[0] = Math.min(p[0], min[0]); - max[0] = Math.max(p[0], max[0]); - min[1] = Math.min(p[1], min[1]); - max[1] = Math.max(p[1], max[1]); +function calcLineBBox(feature, geom) { + for (var i = 0; i < geom.length; i += 3) { + feature.minX = Math.min(feature.minX, geom[i]); + feature.minY = Math.min(feature.minY, geom[i + 1]); + feature.maxX = Math.max(feature.maxX, geom[i]); + feature.maxY = Math.max(feature.maxY, geom[i + 1]); } } -var convert_1 = convert; - - - - // converts GeoJSON feature into an intermediate projected JSON vector format with simplification data -function convert(data, tolerance) { +function convert(data, options) { var features = []; - if (data.type === 'FeatureCollection') { for (var i = 0; i < data.features.length; i++) { - convertFeature(features, data.features[i], tolerance); + convertFeature(features, data.features[i], options, i); } + } else if (data.type === 'Feature') { - convertFeature(features, data, tolerance); + convertFeature(features, data, options); } else { // single geometry or a geometry collection - convertFeature(features, {geometry: data}, tolerance); + convertFeature(features, {geometry: data}, options); } + return features; } -function convertFeature(features, feature, tolerance) { - if (feature.geometry === null) { - // ignore features with null geometry - return; - } - - var geom = feature.geometry, - type = geom.type, - coords = geom.coordinates, - tags = feature.properties, - id = feature.id, - i, j, rings, projectedRing; +function convertFeature(features, geojson, options, index) { + if (!geojson.geometry) return; + var coords = geojson.geometry.coordinates; + var type = geojson.geometry.type; + var tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2); + var geometry = []; + var id = geojson.id; + if (options.promoteId) { + id = geojson.properties[options.promoteId]; + } else if (options.generateId) { + id = index || 0; + } if (type === 'Point') { - features.push(feature$1(tags, 1, [projectPoint(coords)], id)); + convertPoint(coords, geometry); } else if (type === 'MultiPoint') { - features.push(feature$1(tags, 1, project(coords), id)); + for (var i = 0; i < coords.length; i++) { + convertPoint(coords[i], geometry); + } } else if (type === 'LineString') { - features.push(feature$1(tags, 2, [project(coords, tolerance)], id)); - - } else if (type === 'MultiLineString' || type === 'Polygon') { - rings = []; - for (i = 0; i < coords.length; i++) { - projectedRing = project(coords[i], tolerance); - if (type === 'Polygon') projectedRing.outer = (i === 0); - rings.push(projectedRing); + convertLine(coords, geometry, tolerance, false); + + } else if (type === 'MultiLineString') { + if (options.lineMetrics) { + // explode into linestrings to be able to track metrics + for (i = 0; i < coords.length; i++) { + geometry = []; + convertLine(coords[i], geometry, tolerance, false); + features.push(createFeature(id, 'LineString', geometry, geojson.properties)); + } + return; + } else { + convertLines(coords, geometry, tolerance, false); } - features.push(feature$1(tags, type === 'Polygon' ? 3 : 2, rings, id)); + + } else if (type === 'Polygon') { + convertLines(coords, geometry, tolerance, true); } else if (type === 'MultiPolygon') { - rings = []; for (i = 0; i < coords.length; i++) { - for (j = 0; j < coords[i].length; j++) { - projectedRing = project(coords[i][j], tolerance); - projectedRing.outer = (j === 0); - rings.push(projectedRing); - } + var polygon = []; + convertLines(coords[i], polygon, tolerance, true); + geometry.push(polygon); } - features.push(feature$1(tags, 3, rings, id)); - } else if (type === 'GeometryCollection') { - for (i = 0; i < geom.geometries.length; i++) { + for (i = 0; i < geojson.geometry.geometries.length; i++) { convertFeature(features, { - geometry: geom.geometries[i], - properties: tags - }, tolerance); + id: id, + geometry: geojson.geometry.geometries[i], + properties: geojson.properties + }, options, index); } - + return; } else { throw new Error('Input data is not a valid GeoJSON object.'); } -} -function project(lonlats, tolerance) { - var projected = []; - for (var i = 0; i < lonlats.length; i++) { - projected.push(projectPoint(lonlats[i])); - } - if (tolerance) { - simplify_1(projected, tolerance); - calcSize(projected); - } - return projected; + features.push(createFeature(id, type, geometry, geojson.properties)); } -function projectPoint(p) { - var sin = Math.sin(p[1] * Math.PI / 180), - x = (p[0] / 360 + 0.5), - y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI); - - y = y < 0 ? 0 : - y > 1 ? 1 : y; - - return [x, y, 0]; -} - -// calculate area and length of the poly -function calcSize(points) { - var area = 0, - dist = 0; - - for (var i = 0, a, b; i < points.length - 1; i++) { - a = b || points[i]; - b = points[i + 1]; - - area += a[0] * b[1] - b[0] * a[1]; - - // use Manhattan distance instead of Euclidian one to avoid expensive square root computation - dist += Math.abs(b[0] - a[0]) + Math.abs(b[1] - a[1]); - } - points.area = Math.abs(area / 2); - points.dist = dist; +function convertPoint(coords, out) { + out.push(projectX(coords[0])); + out.push(projectY(coords[1])); + out.push(0); } -var tile = transformTile; -var point = transformPoint; - -// Transforms the coordinates of each feature in the given tile from -// mercator-projected space into (extent x extent) tile space. -function transformTile(tile, extent) { - if (tile.transformed) return tile; - - var z2 = tile.z2, - tx = tile.x, - ty = tile.y, - i, j, k; +function convertLine(ring, out, tolerance, isPolygon) { + var x0, y0; + var size = 0; - for (i = 0; i < tile.features.length; i++) { - var feature = tile.features[i], - geom = feature.geometry, - type = feature.type; + for (var j = 0; j < ring.length; j++) { + var x = projectX(ring[j][0]); + var y = projectY(ring[j][1]); - if (type === 1) { - for (j = 0; j < geom.length; j++) geom[j] = transformPoint(geom[j], extent, z2, tx, ty); + out.push(x); + out.push(y); + out.push(0); - } else { - for (j = 0; j < geom.length; j++) { - var ring = geom[j]; - for (k = 0; k < ring.length; k++) ring[k] = transformPoint(ring[k], extent, z2, tx, ty); + if (j > 0) { + if (isPolygon) { + size += (x0 * y - x * y0) / 2; // area + } else { + size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2)); // length } } + x0 = x; + y0 = y; } - tile.transformed = true; + var last = out.length - 3; + out[2] = 1; + simplify(out, 0, last, tolerance); + out[last + 2] = 1; - return tile; + out.size = Math.abs(size); + out.start = 0; + out.end = out.size; } -function transformPoint(p, extent, z2, tx, ty) { - var x = Math.round(extent * (p[0] * z2 - tx)), - y = Math.round(extent * (p[1] * z2 - ty)); - return [x, y]; +function convertLines(rings, out, tolerance, isPolygon) { + for (var i = 0; i < rings.length; i++) { + var geom = []; + convertLine(rings[i], geom, tolerance, isPolygon); + out.push(geom); + } } -var transform = { - tile: tile, - point: point -}; - -var clip_1 = clip; - +function projectX(x) { + return x / 360 + 0.5; +} +function projectY(y) { + var sin = Math.sin(y * Math.PI / 180); + var y2 = 0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI; + return y2 < 0 ? 0 : y2 > 1 ? 1 : y2; +} /* clip features between two axis-parallel lines: * | | @@ -23710,152 +23695,213 @@ var clip_1 = clip; * | | */ -function clip(features, scale, k1, k2, axis, intersect, minAll, maxAll) { +function clip(features, scale, k1, k2, axis, minAll, maxAll, options) { k1 /= scale; k2 /= scale; - if (minAll >= k1 && maxAll <= k2) return features; // trivial accept - else if (minAll > k2 || maxAll < k1) return null; // trivial reject + if (minAll >= k1 && maxAll < k2) return features; // trivial accept + else if (maxAll < k1 || minAll >= k2) return null; // trivial reject var clipped = []; for (var i = 0; i < features.length; i++) { - var feature = features[i], - geometry = feature.geometry, - type = feature.type, - min, max; + var feature = features[i]; + var geometry = feature.geometry; + var type = feature.type; - min = feature.min[axis]; - max = feature.max[axis]; + var min = axis === 0 ? feature.minX : feature.minY; + var max = axis === 0 ? feature.maxX : feature.maxY; - if (min >= k1 && max <= k2) { // trivial accept + if (min >= k1 && max < k2) { // trivial accept clipped.push(feature); continue; - } else if (min > k2 || max < k1) continue; // trivial reject - - var slices = type === 1 ? - clipPoints(geometry, k1, k2, axis) : - clipGeometry(geometry, k1, k2, axis, intersect, type === 3); - - if (slices.length) { - // if a feature got clipped, it will likely get clipped on the next zoom level as well, - // so there's no need to recalculate bboxes - clipped.push(feature$1(feature.tags, type, slices, feature.id)); + } else if (max < k1 || min >= k2) { // trivial reject + continue; } - } - return clipped.length ? clipped : null; -} - -function clipPoints(geometry, k1, k2, axis) { - var slice = []; - - for (var i = 0; i < geometry.length; i++) { - var a = geometry[i], - ak = a[axis]; - - if (ak >= k1 && ak <= k2) slice.push(a); - } - return slice; -} + var newGeometry = []; -function clipGeometry(geometry, k1, k2, axis, intersect, closed) { + if (type === 'Point' || type === 'MultiPoint') { + clipPoints(geometry, newGeometry, k1, k2, axis); - var slices = []; + } else if (type === 'LineString') { + clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics); - for (var i = 0; i < geometry.length; i++) { + } else if (type === 'MultiLineString') { + clipLines(geometry, newGeometry, k1, k2, axis, false); - var ak = 0, - bk = 0, - b = null, - points = geometry[i], - area = points.area, - dist = points.dist, - outer = points.outer, - len = points.length, - a, j, last; + } else if (type === 'Polygon') { + clipLines(geometry, newGeometry, k1, k2, axis, true); - var slice = []; + } else if (type === 'MultiPolygon') { + for (var j = 0; j < geometry.length; j++) { + var polygon = []; + clipLines(geometry[j], polygon, k1, k2, axis, true); + if (polygon.length) { + newGeometry.push(polygon); + } + } + } - for (j = 0; j < len - 1; j++) { - a = b || points[j]; - b = points[j + 1]; - ak = bk || a[axis]; - bk = b[axis]; + if (newGeometry.length) { + if (options.lineMetrics && type === 'LineString') { + for (j = 0; j < newGeometry.length; j++) { + clipped.push(createFeature(feature.id, type, newGeometry[j], feature.tags)); + } + continue; + } - if (ak < k1) { + if (type === 'LineString' || type === 'MultiLineString') { + if (newGeometry.length === 1) { + type = 'LineString'; + newGeometry = newGeometry[0]; + } else { + type = 'MultiLineString'; + } + } + if (type === 'Point' || type === 'MultiPoint') { + type = newGeometry.length === 3 ? 'Point' : 'MultiPoint'; + } - if ((bk > k2)) { // ---|-----|--> - slice.push(intersect(a, b, k1), intersect(a, b, k2)); - if (!closed) slice = newSlice(slices, slice, area, dist, outer); + clipped.push(createFeature(feature.id, type, newGeometry, feature.tags)); + } + } - } else if (bk >= k1) slice.push(intersect(a, b, k1)); // ---|--> | + return clipped.length ? clipped : null; +} - } else if (ak > k2) { +function clipPoints(geom, newGeom, k1, k2, axis) { + for (var i = 0; i < geom.length; i += 3) { + var a = geom[i + axis]; - if ((bk < k1)) { // <--|-----|--- - slice.push(intersect(a, b, k2), intersect(a, b, k1)); - if (!closed) slice = newSlice(slices, slice, area, dist, outer); + if (a >= k1 && a <= k2) { + newGeom.push(geom[i]); + newGeom.push(geom[i + 1]); + newGeom.push(geom[i + 2]); + } + } +} - } else if (bk <= k2) slice.push(intersect(a, b, k2)); // | <--|--- +function clipLine(geom, newGeom, k1, k2, axis, isPolygon, trackMetrics) { - } else { + var slice = newSlice(geom); + var intersect = axis === 0 ? intersectX : intersectY; + var len = geom.start; + var segLen, t; - slice.push(a); + for (var i = 0; i < geom.length - 3; i += 3) { + var ax = geom[i]; + var ay = geom[i + 1]; + var az = geom[i + 2]; + var bx = geom[i + 3]; + var by = geom[i + 4]; + var a = axis === 0 ? ax : ay; + var b = axis === 0 ? bx : by; + var exited = false; - if (bk < k1) { // <--|--- | - slice.push(intersect(a, b, k1)); - if (!closed) slice = newSlice(slices, slice, area, dist, outer); + if (trackMetrics) segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2)); - } else if (bk > k2) { // | ---|--> - slice.push(intersect(a, b, k2)); - if (!closed) slice = newSlice(slices, slice, area, dist, outer); - } - // | --> | + if (a < k1) { + // ---|--> | (line enters the clip region from the left) + if (b > k1) { + t = intersect(slice, ax, ay, bx, by, k1); + if (trackMetrics) slice.start = len + segLen * t; + } + } else if (a > k2) { + // | <--|--- (line enters the clip region from the right) + if (b < k2) { + t = intersect(slice, ax, ay, bx, by, k2); + if (trackMetrics) slice.start = len + segLen * t; } + } else { + addPoint(slice, ax, ay, az); + } + if (b < k1 && a >= k1) { + // <--|--- | or <--|-----|--- (line exits the clip region on the left) + t = intersect(slice, ax, ay, bx, by, k1); + exited = true; + } + if (b > k2 && a <= k2) { + // | ---|--> or ---|-----|--> (line exits the clip region on the right) + t = intersect(slice, ax, ay, bx, by, k2); + exited = true; } - // add the last point - a = points[len - 1]; - ak = a[axis]; - if (ak >= k1 && ak <= k2) slice.push(a); + if (!isPolygon && exited) { + if (trackMetrics) slice.end = len + segLen * t; + newGeom.push(slice); + slice = newSlice(geom); + } - // close the polygon if its endpoints are not the same after clipping + if (trackMetrics) len += segLen; + } - last = slice[slice.length - 1]; - if (closed && last && (slice[0][0] !== last[0] || slice[0][1] !== last[1])) slice.push(slice[0]); + // add the last point + var last = geom.length - 3; + ax = geom[last]; + ay = geom[last + 1]; + az = geom[last + 2]; + a = axis === 0 ? ax : ay; + if (a >= k1 && a <= k2) addPoint(slice, ax, ay, az); - // add the final slice - newSlice(slices, slice, area, dist, outer); + // close the polygon if its endpoints are not the same after clipping + last = slice.length - 3; + if (isPolygon && last >= 3 && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) { + addPoint(slice, slice[0], slice[1], slice[2]); } - return slices; + // add the final slice + if (slice.length) { + newGeom.push(slice); + } } -function newSlice(slices, slice, area, dist, outer) { - if (slice.length) { - // we don't recalculate the area/length of the unclipped geometry because the case where it goes - // below the visibility threshold as a result of clipping is rare, so we avoid doing unnecessary work - slice.area = area; - slice.dist = dist; - if (outer !== undefined) slice.outer = outer; +function newSlice(line) { + var slice = []; + slice.size = line.size; + slice.start = line.start; + slice.end = line.end; + return slice; +} - slices.push(slice); +function clipLines(geom, newGeom, k1, k2, axis, isPolygon) { + for (var i = 0; i < geom.length; i++) { + clipLine(geom[i], newGeom, k1, k2, axis, isPolygon, false); } - return []; } -var wrap_1 = wrap$1; +function addPoint(out, x, y, z) { + out.push(x); + out.push(y); + out.push(z); +} + +function intersectX(out, ax, ay, bx, by, x) { + var t = (x - ax) / (bx - ax); + out.push(x); + out.push(ay + (by - ay) * t); + out.push(1); + return t; +} + +function intersectY(out, ax, ay, bx, by, y) { + var t = (y - ay) / (by - ay); + out.push(ax + (bx - ax) * t); + out.push(y); + out.push(1); + return t; +} -function wrap$1(features, buffer, intersectX) { - var merged = features, - left = clip_1(features, 1, -1 - buffer, buffer, 0, intersectX, -1, 2), // left world copy - right = clip_1(features, 1, 1 - buffer, 2 + buffer, 0, intersectX, -1, 2); // right world copy +function wrap$1(features, options) { + var buffer = options.buffer / options.extent; + var merged = features; + var left = clip(features, 1, -1 - buffer, buffer, 0, -1, 2, options); // left world copy + var right = clip(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options); // right world copy if (left || right) { - merged = clip_1(features, 1, -buffer, 1 + buffer, 0, intersectX, -1, 2) || []; // center world copy + merged = clip(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || []; // center world copy if (left) merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center if (right) merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center @@ -23873,16 +23919,26 @@ function shiftFeatureCoords(features, offset) { var newGeometry; - if (type === 1) { + if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') { newGeometry = shiftCoords(feature.geometry, offset); - } else { + + } else if (type === 'MultiLineString' || type === 'Polygon') { newGeometry = []; for (var j = 0; j < feature.geometry.length; j++) { newGeometry.push(shiftCoords(feature.geometry[j], offset)); } + } else if (type === 'MultiPolygon') { + newGeometry = []; + for (j = 0; j < feature.geometry.length; j++) { + var newPolygon = []; + for (var k = 0; k < feature.geometry[j].length; k++) { + newPolygon.push(shiftCoords(feature.geometry[j][k], offset)); + } + newGeometry.push(newPolygon); + } } - newFeatures.push(feature$1(feature.tags, type, newGeometry, feature.id)); + newFeatures.push(createFeature(feature.id, type, newGeometry, feature.tags)); } return newFeatures; @@ -23890,18 +23946,64 @@ function shiftFeatureCoords(features, offset) { function shiftCoords(points, offset) { var newPoints = []; - newPoints.area = points.area; - newPoints.dist = points.dist; + newPoints.size = points.size; - for (var i = 0; i < points.length; i++) { - newPoints.push([points[i][0] + offset, points[i][1], points[i][2]]); + if (points.start !== undefined) { + newPoints.start = points.start; + newPoints.end = points.end; + } + + for (var i = 0; i < points.length; i += 3) { + newPoints.push(points[i] + offset, points[i + 1], points[i + 2]); } return newPoints; } -var tile$1 = createTile; +// Transforms the coordinates of each feature in the given tile from +// mercator-projected space into (extent x extent) tile space. +function transformTile(tile, extent) { + if (tile.transformed) return tile; + + var z2 = 1 << tile.z, + tx = tile.x, + ty = tile.y, + i, j, k; + + for (i = 0; i < tile.features.length; i++) { + var feature = tile.features[i], + geom = feature.geometry, + type = feature.type; + + feature.geometry = []; -function createTile(features, z2, tx, ty, tolerance, noSimplify) { + if (type === 1) { + for (j = 0; j < geom.length; j += 2) { + feature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty)); + } + } else { + for (j = 0; j < geom.length; j++) { + var ring = []; + for (k = 0; k < geom[j].length; k += 2) { + ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty)); + } + feature.geometry.push(ring); + } + } + } + + tile.transformed = true; + + return tile; +} + +function transformPoint(x, y, extent, z2, tx, ty) { + return [ + Math.round(extent * (x * z2 - tx)), + Math.round(extent * (y * z2 - ty))]; +} + +function createTile(features, z, tx, ty, options) { + var tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent); var tile = { features: [], numPoints: 0, @@ -23910,77 +24012,75 @@ function createTile(features, z2, tx, ty, tolerance, noSimplify) { source: null, x: tx, y: ty, - z2: z2, + z: z, transformed: false, - min: [2, 1], - max: [-1, 0] + minX: 2, + minY: 1, + maxX: -1, + maxY: 0 }; for (var i = 0; i < features.length; i++) { tile.numFeatures++; - addFeature(tile, features[i], tolerance, noSimplify); + addFeature(tile, features[i], tolerance, options); - var min = features[i].min, - max = features[i].max; + var minX = features[i].minX; + var minY = features[i].minY; + var maxX = features[i].maxX; + var maxY = features[i].maxY; - if (min[0] < tile.min[0]) tile.min[0] = min[0]; - if (min[1] < tile.min[1]) tile.min[1] = min[1]; - if (max[0] > tile.max[0]) tile.max[0] = max[0]; - if (max[1] > tile.max[1]) tile.max[1] = max[1]; + if (minX < tile.minX) tile.minX = minX; + if (minY < tile.minY) tile.minY = minY; + if (maxX > tile.maxX) tile.maxX = maxX; + if (maxY > tile.maxY) tile.maxY = maxY; } return tile; } -function addFeature(tile, feature, tolerance, noSimplify) { +function addFeature(tile, feature, tolerance, options) { var geom = feature.geometry, type = feature.type, - simplified = [], - sqTolerance = tolerance * tolerance, - i, j, ring, p; + simplified = []; - if (type === 1) { - for (i = 0; i < geom.length; i++) { + if (type === 'Point' || type === 'MultiPoint') { + for (var i = 0; i < geom.length; i += 3) { simplified.push(geom[i]); + simplified.push(geom[i + 1]); tile.numPoints++; tile.numSimplified++; } - } else { + } else if (type === 'LineString') { + addLine(simplified, geom, tile, tolerance, false, false); - // simplify and transform projected coordinates for tile geometry + } else if (type === 'MultiLineString' || type === 'Polygon') { for (i = 0; i < geom.length; i++) { - ring = geom[i]; - - // filter out tiny polylines & polygons - if (!noSimplify && ((type === 2 && ring.dist < tolerance) || - (type === 3 && ring.area < sqTolerance))) { - tile.numPoints += ring.length; - continue; - } + addLine(simplified, geom[i], tile, tolerance, type === 'Polygon', i === 0); + } - var simplifiedRing = []; + } else if (type === 'MultiPolygon') { - for (j = 0; j < ring.length; j++) { - p = ring[j]; - // keep points with importance > tolerance - if (noSimplify || p[2] > sqTolerance) { - simplifiedRing.push(p); - tile.numSimplified++; - } - tile.numPoints++; + for (var k = 0; k < geom.length; k++) { + var polygon = geom[k]; + for (i = 0; i < polygon.length; i++) { + addLine(simplified, polygon[i], tile, tolerance, true, i === 0); } - - if (type === 3) rewind(simplifiedRing, ring.outer); - - simplified.push(simplifiedRing); } } if (simplified.length) { + var tags = feature.tags || null; + if (type === 'LineString' && options.lineMetrics) { + tags = {}; + for (var key in feature.tags) tags[key] = feature.tags[key]; + tags['mapbox_clip_start'] = geom.start / geom.size; + tags['mapbox_clip_end'] = geom.end / geom.size; + } var tileFeature = { geometry: simplified, - type: type, - tags: feature.tags || null + type: type === 'Polygon' || type === 'MultiPolygon' ? 3 : + type === 'LineString' || type === 'MultiLineString' ? 2 : 1, + tags: tags }; if (feature.id !== null) { tileFeature.id = feature.id; @@ -23989,25 +24089,46 @@ function addFeature(tile, feature, tolerance, noSimplify) { } } -function rewind(ring, clockwise) { - var area = signedArea$2(ring); - if (area < 0 === clockwise) ring.reverse(); -} +function addLine(result, geom, tile, tolerance, isPolygon, isOuter) { + var sqTolerance = tolerance * tolerance; -function signedArea$2(ring) { - var sum = 0; - for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) { - p1 = ring[i]; - p2 = ring[j]; - sum += (p2[0] - p1[0]) * (p1[1] + p2[1]); + if (tolerance > 0 && (geom.size < (isPolygon ? sqTolerance : tolerance))) { + tile.numPoints += geom.length / 3; + return; } - return sum; -} -var src = geojsonvt; + var ring = []; - // final simplified tile generation + for (var i = 0; i < geom.length; i += 3) { + if (tolerance === 0 || geom[i + 2] > sqTolerance) { + tile.numSimplified++; + ring.push(geom[i]); + ring.push(geom[i + 1]); + } + tile.numPoints++; + } + + if (isPolygon) rewind(ring, isOuter); + result.push(ring); +} + +function rewind(ring, clockwise) { + var area = 0; + for (var i = 0, len = ring.length, j = len - 2; i < len; j = i, i += 2) { + area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]); + } + if (area > 0 === clockwise) { + for (i = 0, len = ring.length; i < len / 2; i += 2) { + var x = ring[i]; + var y = ring[i + 1]; + ring[i] = ring[len - 2 - i]; + ring[i + 1] = ring[len - 1 - i]; + ring[len - 2 - i] = x; + ring[len - 1 - i] = y; + } + } +} function geojsonvt(data, options) { return new GeoJSONVT(data, options); @@ -24020,8 +24141,10 @@ function GeoJSONVT(data, options) { if (debug) console.time('preprocess data'); - var z2 = 1 << options.maxZoom, // 2^z - features = convert_1(data, options.tolerance / (z2 * options.extent)); + if (options.maxZoom < 0 || options.maxZoom > 24) throw new Error('maxZoom should be in the 0-24 range'); + if (options.promoteId && options.generateId) throw new Error('promoteId and generateId cannot be used together.'); + + var features = convert(data, options); this.tiles = {}; this.tileCoords = []; @@ -24034,7 +24157,7 @@ function GeoJSONVT(data, options) { this.total = 0; } - features = wrap_1(features, options.buffer / options.extent, intersectX); + features = wrap$1(features, options); // start slicing from the top tile down if (features.length) this.splitTile(features, 0, 0, 0); @@ -24050,10 +24173,12 @@ GeoJSONVT.prototype.options = { maxZoom: 14, // max zoom to preserve detail on indexMaxZoom: 5, // max zoom in the tile index indexMaxPoints: 100000, // max number of points per tile in the tile index - solidChildren: false, // whether to tile solid square tiles further tolerance: 3, // simplification tolerance (higher means simpler) extent: 4096, // tile extent buffer: 64, // tile buffer on each side + lineMetrics: false, // whether to calculate line metrics + promoteId: null, // name of a feature property to be promoted to feature.id + generateId: false, // whether to generate feature ids. Cannot be used with promoteId debug: 0 // logging level (0, 1 or 2) }; @@ -24061,8 +24186,7 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) { var stack = [features, z, x, y], options = this.options, - debug = options.debug, - solid = null; + debug = options.debug; // avoid recursion by using a processing queue while (stack.length) { @@ -24073,13 +24197,12 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) { var z2 = 1 << z, id = toID(z, x, y), - tile = this.tiles[id], - tileTolerance = z === options.maxZoom ? 0 : options.tolerance / (z2 * options.extent); + tile = this.tiles[id]; if (!tile) { if (debug > 1) console.time('creation'); - tile = this.tiles[id] = tile$1(features, z2, x, y, tileTolerance, z === options.maxZoom); + tile = this.tiles[id] = createTile(features, z, x, y, options); this.tileCoords.push({z: z, x: x, y: y}); if (debug) { @@ -24112,15 +24235,11 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) { if (x !== Math.floor(cx / m) || y !== Math.floor(cy / m)) continue; } - // stop tiling if the tile is solid clipped square - if (!options.solidChildren && isClippedSquare(tile, options.extent, options.buffer)) { - if (cz) solid = z; // and remember the zoom if we're drilling down - continue; - } - // if we slice further down, no need to keep source geometry tile.source = null; + if (features.length === 0) continue; + if (debug > 1) console.time('clipping'); // values we'll use for clipping @@ -24132,30 +24251,29 @@ GeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) { tl = bl = tr = br = null; - left = clip_1(features, z2, x - k1, x + k3, 0, intersectX, tile.min[0], tile.max[0]); - right = clip_1(features, z2, x + k2, x + k4, 0, intersectX, tile.min[0], tile.max[0]); + left = clip(features, z2, x - k1, x + k3, 0, tile.minX, tile.maxX, options); + right = clip(features, z2, x + k2, x + k4, 0, tile.minX, tile.maxX, options); + features = null; if (left) { - tl = clip_1(left, z2, y - k1, y + k3, 1, intersectY, tile.min[1], tile.max[1]); - bl = clip_1(left, z2, y + k2, y + k4, 1, intersectY, tile.min[1], tile.max[1]); + tl = clip(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options); + bl = clip(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options); + left = null; } if (right) { - tr = clip_1(right, z2, y - k1, y + k3, 1, intersectY, tile.min[1], tile.max[1]); - br = clip_1(right, z2, y + k2, y + k4, 1, intersectY, tile.min[1], tile.max[1]); + tr = clip(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options); + br = clip(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options); + right = null; } if (debug > 1) console.timeEnd('clipping'); - if (features.length) { - stack.push(tl || [], z + 1, x * 2, y * 2); - stack.push(bl || [], z + 1, x * 2, y * 2 + 1); - stack.push(tr || [], z + 1, x * 2 + 1, y * 2); - stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1); - } + stack.push(tl || [], z + 1, x * 2, y * 2); + stack.push(bl || [], z + 1, x * 2, y * 2 + 1); + stack.push(tr || [], z + 1, x * 2 + 1, y * 2); + stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1); } - - return solid; }; GeoJSONVT.prototype.getTile = function (z, x, y) { @@ -24163,11 +24281,13 @@ GeoJSONVT.prototype.getTile = function (z, x, y) { extent = options.extent, debug = options.debug; + if (z < 0 || z > 24) return null; + var z2 = 1 << z; x = ((x % z2) + z2) % z2; // wrap tile x coordinate var id = toID(z, x, y); - if (this.tiles[id]) return transform.tile(this.tiles[id], extent); + if (this.tiles[id]) return transformTile(this.tiles[id], extent); if (debug > 1) console.log('drilling down to z%d-%d-%d', z, x, y); @@ -24188,59 +24308,22 @@ GeoJSONVT.prototype.getTile = function (z, x, y) { // if we found a parent tile containing the original geometry, we can drill down from it if (debug > 1) console.log('found parent tile z%d-%d-%d', z0, x0, y0); - // it parent tile is a solid clipped square, return it instead since it's identical - if (isClippedSquare(parent, extent, options.buffer)) return transform.tile(parent, extent); - if (debug > 1) console.time('drilling down'); - var solid = this.splitTile(parent.source, z0, x0, y0, z, x, y); + this.splitTile(parent.source, z0, x0, y0, z, x, y); if (debug > 1) console.timeEnd('drilling down'); - // one of the parent tiles was a solid clipped square - if (solid !== null) { - var m = 1 << (z - solid); - id = toID(solid, Math.floor(x / m), Math.floor(y / m)); - } - - return this.tiles[id] ? transform.tile(this.tiles[id], extent) : null; + return this.tiles[id] ? transformTile(this.tiles[id], extent) : null; }; function toID(z, x, y) { return (((1 << z) * y + x) * 32) + z; } -function intersectX(a, b, x) { - return [x, (x - a[0]) * (b[1] - a[1]) / (b[0] - a[0]) + a[1], 1]; -} -function intersectY(a, b, y) { - return [(y - a[1]) * (b[0] - a[0]) / (b[1] - a[1]) + a[0], y, 1]; -} - function extend(dest, src) { for (var i in src) dest[i] = src[i]; return dest; } -// checks whether a tile is a whole-area fill after clipping; if it is, there's no sense slicing it further -function isClippedSquare(tile, extent, buffer) { - - var features = tile.source; - if (features.length !== 1) return false; - - var feature = features[0]; - if (feature.type !== 3 || feature.geometry.length > 1) return false; - - var len = feature.geometry[0].length; - if (len !== 5) return false; - - for (var i = 0; i < len; i++) { - var p = transform.point(feature.geometry[0][i], extent, tile.z2, tile.x, tile.y); - if ((p[0] !== -buffer && p[0] !== extent + buffer) || - (p[1] !== -buffer && p[1] !== extent + buffer)) return false; - } - - return true; -} - /** GeoJSON standalone (non-tiled) source Uses geojson-vt split into tiles client-side @@ -24285,7 +24368,7 @@ function (_NetworkSource) { var layers = data.source_data.layers; for (var layer_name in layers) { - _this2.tile_indexes[layer_name] = src(layers[layer_name], { + _this2.tile_indexes[layer_name] = geojsonvt(layers[layer_name], { maxZoom: _this2.max_zoom, // max zoom to preserve detail on tolerance: 1.5, @@ -24555,7 +24638,7 @@ function identity$1(x) { return x; } -function transform$1(topology) { +function transform(topology) { if ((transform = topology.transform) == null) return identity$1; var transform, x0, @@ -24572,13 +24655,13 @@ function transform$1(topology) { }; } -function feature$2(topology, o) { +function feature$1(topology, o) { return o.type === "GeometryCollection" - ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature$3(topology, o); })} - : feature$3(topology, o); + ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature$2(topology, o); })} + : feature$2(topology, o); } -function feature$3(topology, o) { +function feature$2(topology, o) { var id = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, @@ -24589,7 +24672,7 @@ function feature$3(topology, o) { } function object(topology, o) { - var transformPoint = transform$1(topology), + var transformPoint = transform(topology), arcs = topology.arcs; function arc(i, points) { @@ -24696,7 +24779,7 @@ function (_GeoJSONSource) { }(GeoJSONSource); function getTopoJSONFeature(topology, object) { - var feature = feature$2(topology, object); // Convert single feature to a feature collection + var feature = feature$1(topology, object); // Convert single feature to a feature collection if (feature.type === 'Feature') { feature = { @@ -24739,94 +24822,94 @@ DataSource.register('TopoJSON', function (source) { // add all data source types +exports.require$$0 = _wks; +exports.require$$1 = _core; +exports.global = _global; +exports.require$$1$1 = _objectDp; +exports.getKeys = _objectKeys; +exports.gOPS = _objectGops; +exports.require$$0$1 = _objectPie; +exports.toIObject = _toIobject; +exports.require$$0$2 = _objectGopn; +exports.require$$0$3 = _meta; +exports.require$$0$4 = _shared; +exports.DESCRIPTORS = _descriptors; +exports.fails = _fails; +exports.require$$22 = _objectCreate; +exports.uid = _uid; +exports.redefine = _redefine; +exports.LIBRARY = _library; exports.$export = _export; -exports.Collision = Collision; -exports.DataSource = DataSource; -exports.FeatureSelection = FeatureSelection; -exports.FilterOptions = FilterOptions; -exports.FontManager = FontManager; +exports.require$$17 = _has; +exports.isObject = _isObject; +exports.isArray = _isArray; +exports.hide = _hide; +exports.setToStringTag = _setToStringTag; +exports.require$$1$2 = _objectGopd; +exports.anObject = _anObject; +exports.require$$16 = _toPrimitive; +exports.require$$9 = _propertyDesc; +exports.createCommonjsModule = createCommonjsModule; +exports.commonjsRequire = commonjsRequire; +exports.Utils = Utils; +exports.isRelativeURL = isRelativeURL; +exports.addBaseURL = addBaseURL; +exports.pathForURL = pathForURL; +exports.extensionForURL = extensionForURL; +exports._inheritsLoose = _inheritsLoose; +exports.flattenRelativeURL = flattenRelativeURL; +exports.createObjectURL = createObjectURL; +exports.isLocalURL = isLocalURL; +exports.subscribeMixin = subscribeMixin; +exports.log = log; +exports.mergeObjects = mergeObjects; +exports.isReserved = isReserved; exports.GLSL = GLSL; +exports.TileID = TileID; +exports.Collision = Collision; exports.Geo = Geo$1; -exports.Label = Label; -exports.LabelLineStraight = LabelLineStraight; exports.LabelPoint = LabelPoint; -exports.Light = Light; -exports.Material = Material; +exports.LabelLineStraight = LabelLineStraight; exports.OBB = OBB; -exports.ShaderProgram = ShaderProgram; -exports.Style = Style; -exports.StyleManager = StyleManager; -exports.StyleParser = StyleParser; +exports.Label = Label; +exports.WorkerBroker = WorkerBroker$1; exports.Task = Task; -exports.TextCanvas = TextCanvas; +exports.Tile = Tile; +exports._createClass = _createClass; +exports.require$$0$5 = _typedArray; +exports.StyleParser = StyleParser; exports.Texture = Texture; +exports.debugSettings = debugSettings$1; +exports.debugSumLayerStats = debugSumLayerStats; +exports.ShaderProgram = ShaderProgram; +exports.VertexArrayObject = VertexArrayObject; +exports.TextCanvas = TextCanvas; +exports.DataSource = DataSource; +exports.Light = Light; +exports.FontManager = FontManager; +exports.FeatureSelection = FeatureSelection; +exports.View = View; +exports.StyleManager = StyleManager; +exports.Style = Style; +exports.sliceObject = sliceObject; exports.Thread = Thread; -exports.Tile = Tile; -exports.TileID = TileID; -exports.Utils = Utils; +exports.mergeDebugSettings = mergeDebugSettings; +exports.version = version$1; exports.Vector = Vector$1; -exports.VertexArrayObject = VertexArrayObject; exports.VertexData = VertexData; +exports.Material = Material; exports.VertexElements = VertexElements; -exports.View = View; -exports.WorkerBroker = WorkerBroker$1; -exports._createClass = _createClass; -exports._inheritsLoose = _inheritsLoose; -exports.addBaseURL = addBaseURL; -exports.anObject = _anObject; +exports.compileFunctionStrings = compileFunctionStrings; +exports.parseLayers = parseLayers; exports.buildFilter = buildFilter; +exports.FilterOptions = FilterOptions; +exports.layerCache = layerCache; exports.cache = cache; exports.clearFunctionStringCache = clearFunctionStringCache; -exports.commonjsRequire = commonjsRequire; -exports.compileFunctionStrings = compileFunctionStrings; -exports.core = _core; -exports.createCommonjsModule = createCommonjsModule; -exports.createObjectURL = createObjectURL; -exports.debugSettings = debugSettings$1; -exports.debugSumLayerStats = debugSumLayerStats; -exports.extensionForURL = extensionForURL; -exports.flattenRelativeURL = flattenRelativeURL; -exports.getKeys = _objectKeys; -exports.global = _global; -exports.has = _has; -exports.isArray = _isArray; -exports.isLocalURL = isLocalURL; -exports.isObject = _isObject; -exports.isRelativeURL = isRelativeURL; -exports.isReserved = isReserved; -exports.layerCache = layerCache; -exports.log = log; -exports.mergeDebugSettings = mergeDebugSettings; -exports.mergeObjects = mergeObjects; -exports.parseLayers = parseLayers; -exports.pathForURL = pathForURL; -exports.require$$0 = _objectPie; -exports.require$$0$1 = _objectGopn; -exports.require$$0$2 = _meta; -exports.require$$0$3 = _fails; -exports.require$$0$4 = _typedArray; -exports.require$$1 = _library; -exports.require$$1$1 = _objectGopd; -exports.require$$10 = _hide; -exports.require$$2 = _objectDp; -exports.require$$26 = _uid; -exports.require$$27 = _wks; -exports.require$$3 = _objectGops; -exports.require$$4 = _objectCreate; -exports.require$$5 = _descriptors; -exports.require$$6 = _redefine; -exports.require$$9 = _propertyDesc; -exports.setToStringTag = _setToStringTag; -exports.shared = _shared; -exports.sliceObject = sliceObject; -exports.subscribeMixin = subscribeMixin; -exports.toIObject = _toIobject; -exports.toPrimitive = _toPrimitive; -exports.version = version$1; }); -define(['./shared'], function (__chunk_1) { 'use strict'; +define(['./shared.js'], function (__chunk_1) { 'use strict'; var SceneWorker = Object.assign(self, { FeatureSelection: __chunk_1.FeatureSelection, @@ -25200,17 +25283,17 @@ __chunk_1.WorkerBroker.addTarget('self', SceneWorker); }); -define(['./shared'], function (__chunk_1) { 'use strict'; +define(['./shared.js'], function (__chunk_1) { 'use strict'; -var f = __chunk_1.require$$27; +var f = __chunk_1.require$$0; var _wksExt = { f: f }; -var defineProperty = __chunk_1.require$$2.f; +var defineProperty = __chunk_1.require$$1$1.f; var _wksDefine = function (name) { - var $Symbol = __chunk_1.core.Symbol || (__chunk_1.core.Symbol = __chunk_1.global.Symbol || {}); + var $Symbol = __chunk_1.require$$1.Symbol || (__chunk_1.require$$1.Symbol = __chunk_1.global.Symbol || {}); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); }; @@ -25222,10 +25305,10 @@ _wksDefine('asyncIterator'); var _enumKeys = function (it) { var result = __chunk_1.getKeys(it); - var getSymbols = __chunk_1.require$$3.f; + var getSymbols = __chunk_1.gOPS.f; if (getSymbols) { var symbols = getSymbols(it); - var isEnum = __chunk_1.require$$0.f; + var isEnum = __chunk_1.require$$0$1.f; var i = 0; var key; while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); @@ -25234,7 +25317,7 @@ var _enumKeys = function (it) { // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window -var gOPN = __chunk_1.require$$0$1.f; +var gOPN = __chunk_1.require$$0$2.f; var toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames @@ -25262,7 +25345,7 @@ var _objectGopnExt = { -var META = __chunk_1.require$$0$2.KEY; +var META = __chunk_1.require$$0$3.KEY; @@ -25282,19 +25365,19 @@ var META = __chunk_1.require$$0$2.KEY; -var gOPD = __chunk_1.require$$1$1.f; -var dP = __chunk_1.require$$2.f; +var gOPD = __chunk_1.require$$1$2.f; +var dP = __chunk_1.require$$1$1.f; var gOPN$1 = _objectGopnExt.f; var $Symbol = __chunk_1.global.Symbol; var $JSON = __chunk_1.global.JSON; var _stringify = $JSON && $JSON.stringify; var PROTOTYPE = 'prototype'; -var HIDDEN = __chunk_1.require$$27('_hidden'); -var TO_PRIMITIVE = __chunk_1.require$$27('toPrimitive'); +var HIDDEN = __chunk_1.require$$0('_hidden'); +var TO_PRIMITIVE = __chunk_1.require$$0('toPrimitive'); var isEnum = {}.propertyIsEnumerable; -var SymbolRegistry = __chunk_1.shared('symbol-registry'); -var AllSymbols = __chunk_1.shared('symbols'); -var OPSymbols = __chunk_1.shared('op-symbols'); +var SymbolRegistry = __chunk_1.require$$0$4('symbol-registry'); +var AllSymbols = __chunk_1.require$$0$4('symbols'); +var OPSymbols = __chunk_1.require$$0$4('op-symbols'); var ObjectProto = Object[PROTOTYPE]; var USE_NATIVE = typeof $Symbol == 'function'; var QObject = __chunk_1.global.QObject; @@ -25302,8 +25385,8 @@ var QObject = __chunk_1.global.QObject; var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 -var setSymbolDesc = __chunk_1.require$$5 && __chunk_1.require$$0$3(function () { - return __chunk_1.require$$4(dP({}, 'a', { +var setSymbolDesc = __chunk_1.DESCRIPTORS && __chunk_1.fails(function () { + return __chunk_1.require$$22(dP({}, 'a', { get: function () { return dP(this, 'a', { value: 7 }).a; } })).a != 7; }) ? function (it, key, D) { @@ -25314,7 +25397,7 @@ var setSymbolDesc = __chunk_1.require$$5 && __chunk_1.require$$0$3(function () { } : dP; var wrap = function (tag) { - var sym = AllSymbols[tag] = __chunk_1.require$$4($Symbol[PROTOTYPE]); + var sym = AllSymbols[tag] = __chunk_1.require$$22($Symbol[PROTOTYPE]); sym._k = tag; return sym; }; @@ -25328,15 +25411,15 @@ var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) var $defineProperty = function defineProperty(it, key, D) { if (it === ObjectProto) $defineProperty(OPSymbols, key, D); __chunk_1.anObject(it); - key = __chunk_1.toPrimitive(key, true); + key = __chunk_1.require$$16(key, true); __chunk_1.anObject(D); - if (__chunk_1.has(AllSymbols, key)) { + if (__chunk_1.require$$17(AllSymbols, key)) { if (!D.enumerable) { - if (!__chunk_1.has(it, HIDDEN)) dP(it, HIDDEN, __chunk_1.require$$9(1, {})); + if (!__chunk_1.require$$17(it, HIDDEN)) dP(it, HIDDEN, __chunk_1.require$$9(1, {})); it[HIDDEN][key] = true; } else { - if (__chunk_1.has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; - D = __chunk_1.require$$4(D, { enumerable: __chunk_1.require$$9(0, false) }); + if (__chunk_1.require$$17(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = __chunk_1.require$$22(D, { enumerable: __chunk_1.require$$9(0, false) }); } return setSymbolDesc(it, key, D); } return dP(it, key, D); }; @@ -25350,19 +25433,19 @@ var $defineProperties = function defineProperties(it, P) { return it; }; var $create = function create(it, P) { - return P === undefined ? __chunk_1.require$$4(it) : $defineProperties(__chunk_1.require$$4(it), P); + return P === undefined ? __chunk_1.require$$22(it) : $defineProperties(__chunk_1.require$$22(it), P); }; var $propertyIsEnumerable = function propertyIsEnumerable(key) { - var E = isEnum.call(this, key = __chunk_1.toPrimitive(key, true)); - if (this === ObjectProto && __chunk_1.has(AllSymbols, key) && !__chunk_1.has(OPSymbols, key)) return false; - return E || !__chunk_1.has(this, key) || !__chunk_1.has(AllSymbols, key) || __chunk_1.has(this, HIDDEN) && this[HIDDEN][key] ? E : true; + var E = isEnum.call(this, key = __chunk_1.require$$16(key, true)); + if (this === ObjectProto && __chunk_1.require$$17(AllSymbols, key) && !__chunk_1.require$$17(OPSymbols, key)) return false; + return E || !__chunk_1.require$$17(this, key) || !__chunk_1.require$$17(AllSymbols, key) || __chunk_1.require$$17(this, HIDDEN) && this[HIDDEN][key] ? E : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { it = __chunk_1.toIObject(it); - key = __chunk_1.toPrimitive(key, true); - if (it === ObjectProto && __chunk_1.has(AllSymbols, key) && !__chunk_1.has(OPSymbols, key)) return; + key = __chunk_1.require$$16(key, true); + if (it === ObjectProto && __chunk_1.require$$17(AllSymbols, key) && !__chunk_1.require$$17(OPSymbols, key)) return; var D = gOPD(it, key); - if (D && __chunk_1.has(AllSymbols, key) && !(__chunk_1.has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + if (D && __chunk_1.require$$17(AllSymbols, key) && !(__chunk_1.require$$17(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; return D; }; var $getOwnPropertyNames = function getOwnPropertyNames(it) { @@ -25371,7 +25454,7 @@ var $getOwnPropertyNames = function getOwnPropertyNames(it) { var i = 0; var key; while (names.length > i) { - if (!__chunk_1.has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + if (!__chunk_1.require$$17(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); } return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { @@ -25381,7 +25464,7 @@ var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { var i = 0; var key; while (names.length > i) { - if (__chunk_1.has(AllSymbols, key = names[i++]) && (IS_OP ? __chunk_1.has(ObjectProto, key) : true)) result.push(AllSymbols[key]); + if (__chunk_1.require$$17(AllSymbols, key = names[i++]) && (IS_OP ? __chunk_1.require$$17(ObjectProto, key) : true)) result.push(AllSymbols[key]); } return result; }; @@ -25389,31 +25472,31 @@ var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { if (!USE_NATIVE) { $Symbol = function Symbol() { if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); - var tag = __chunk_1.require$$26(arguments.length > 0 ? arguments[0] : undefined); + var tag = __chunk_1.uid(arguments.length > 0 ? arguments[0] : undefined); var $set = function (value) { if (this === ObjectProto) $set.call(OPSymbols, value); - if (__chunk_1.has(this, HIDDEN) && __chunk_1.has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + if (__chunk_1.require$$17(this, HIDDEN) && __chunk_1.require$$17(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDesc(this, tag, __chunk_1.require$$9(1, value)); }; - if (__chunk_1.require$$5 && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); + if (__chunk_1.DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); return wrap(tag); }; - __chunk_1.require$$6($Symbol[PROTOTYPE], 'toString', function toString() { + __chunk_1.redefine($Symbol[PROTOTYPE], 'toString', function toString() { return this._k; }); - __chunk_1.require$$1$1.f = $getOwnPropertyDescriptor; - __chunk_1.require$$2.f = $defineProperty; - __chunk_1.require$$0$1.f = _objectGopnExt.f = $getOwnPropertyNames; - __chunk_1.require$$0.f = $propertyIsEnumerable; - __chunk_1.require$$3.f = $getOwnPropertySymbols; + __chunk_1.require$$1$2.f = $getOwnPropertyDescriptor; + __chunk_1.require$$1$1.f = $defineProperty; + __chunk_1.require$$0$2.f = _objectGopnExt.f = $getOwnPropertyNames; + __chunk_1.require$$0$1.f = $propertyIsEnumerable; + __chunk_1.gOPS.f = $getOwnPropertySymbols; - if (__chunk_1.require$$5 && !__chunk_1.require$$1) { - __chunk_1.require$$6(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + if (__chunk_1.DESCRIPTORS && !__chunk_1.LIBRARY) { + __chunk_1.redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } _wksExt.f = function (name) { - return wrap(__chunk_1.require$$27(name)); + return wrap(__chunk_1.require$$0(name)); }; } @@ -25422,14 +25505,14 @@ __chunk_1.$export(__chunk_1.$export.G + __chunk_1.$export.W + __chunk_1.$export. for (var es6Symbols = ( // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' -).split(','), j = 0; es6Symbols.length > j;)__chunk_1.require$$27(es6Symbols[j++]); +).split(','), j = 0; es6Symbols.length > j;)__chunk_1.require$$0(es6Symbols[j++]); -for (var wellKnownSymbols = __chunk_1.getKeys(__chunk_1.require$$27.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]); +for (var wellKnownSymbols = __chunk_1.getKeys(__chunk_1.require$$0.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]); __chunk_1.$export(__chunk_1.$export.S + __chunk_1.$export.F * !USE_NATIVE, 'Symbol', { // 19.4.2.1 Symbol.for(key) 'for': function (key) { - return __chunk_1.has(SymbolRegistry, key += '') + return __chunk_1.require$$17(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); }, @@ -25458,7 +25541,7 @@ __chunk_1.$export(__chunk_1.$export.S + __chunk_1.$export.F * !USE_NATIVE, 'Obje }); // 24.3.2 JSON.stringify(value [, replacer [, space]]) -$JSON && __chunk_1.$export(__chunk_1.$export.S + __chunk_1.$export.F * (!USE_NATIVE || __chunk_1.require$$0$3(function () { +$JSON && __chunk_1.$export(__chunk_1.$export.S + __chunk_1.$export.F * (!USE_NATIVE || __chunk_1.fails(function () { var S = $Symbol(); // MS Edge converts symbol values to JSON as {} // WebKit converts symbol values to JSON as null @@ -25482,7 +25565,7 @@ $JSON && __chunk_1.$export(__chunk_1.$export.S + __chunk_1.$export.F * (!USE_NAT }); // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) -$Symbol[PROTOTYPE][TO_PRIMITIVE] || __chunk_1.require$$10($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +$Symbol[PROTOTYPE][TO_PRIMITIVE] || __chunk_1.hide($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); // 19.4.3.5 Symbol.prototype[@@toStringTag] __chunk_1.setToStringTag($Symbol, 'Symbol'); // 20.2.1.9 Math[@@toStringTag] @@ -26448,7 +26531,7 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { } } - function read (buf, i) { + function read$$1 (buf, i) { if (indexSize === 1) { return buf[i] } else { @@ -26460,7 +26543,7 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { if (dir) { var foundIndex = -1; for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (read$$1(arr, i) === read$$1(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i; if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { @@ -26473,7 +26556,7 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { for (i = byteOffset; i >= 0; i--) { var found = true; for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { + if (read$$1(arr, i + j) !== read$$1(val, j)) { found = false; break } @@ -26544,7 +26627,7 @@ function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } -Buffer.prototype.write = function write (string, offset, length, encoding) { +Buffer.prototype.write = function write$$1 (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8'; @@ -27213,7 +27296,7 @@ function checkIEEE754 (buf, value, offset, ext, max, min) { function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { - checkIEEE754(buf, value, offset, 4); + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38); } write(buf, value, offset, littleEndian, 23, 4); return offset + 4 @@ -27229,7 +27312,7 @@ Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { - checkIEEE754(buf, value, offset, 8); + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308); } write(buf, value, offset, littleEndian, 52, 8); return offset + 8 @@ -28158,19 +28241,19 @@ function chdir (dir) { }function umask() { return 0; } // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js -var performance = global$1.performance || {}; +var performance$1 = global$1.performance || {}; var performanceNow = - performance.now || - performance.mozNow || - performance.msNow || - performance.oNow || - performance.webkitNow || + performance$1.now || + performance$1.mozNow || + performance$1.msNow || + performance$1.oNow || + performance$1.webkitNow || function(){ return (new Date()).getTime() }; // generate timestamp or delta // see http://nodejs.org/api/process.html#process_process_hrtime function hrtime(previousTimestamp){ - var clocktime = performanceNow.call(performance)*1e-3; + var clocktime = performanceNow.call(performance$1)*1e-3; var seconds = Math.floor(clocktime); var nanoseconds = Math.floor((clocktime%1)*1e9); if (previousTimestamp) { @@ -28342,7 +28425,7 @@ var debugs = {}; var debugEnviron; exports.debuglog = function(set) { if (isUndefined(debugEnviron)) - debugEnviron = ''; + debugEnviron = process.env.NODE_DEBUG || ''; set = set.toUpperCase(); if (!debugs[set]) { if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { @@ -29867,7 +29950,7 @@ Readable.prototype.on = function (ev, fn) { if (!state.reading) { nextTick(nReadingNextTick, this); } else if (state.length) { - emitReadable(this); + emitReadable(this, state); } } } @@ -40513,7 +40596,7 @@ var generateZipParts = function(streamInfo, streamedContent, streamingEnded, off extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); } else { // DOS or other, fallback to DOS versionMadeBy = 0x0014; // DOS, version 2.0 - extFileAttr |= generateDosExternalFileAttr(file.dosPermissions); + extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); } // date @@ -41981,8 +42064,8 @@ ZipEntries.prototype = { checkSignature: function(expectedSignature) { if (!this.reader.readAndCheckSignature(expectedSignature)) { this.reader.index -= 4; - var signature = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); + var signature$$1 = this.reader.readString(4); + throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature$$1) + ", expected " + utils.pretty(expectedSignature) + ")"); } }, /** @@ -41994,8 +42077,8 @@ ZipEntries.prototype = { isSignature: function(askedIndex, expectedSignature) { var currentIndex = this.reader.index; this.reader.setIndex(askedIndex); - var signature = this.reader.readString(4); - var result = signature === expectedSignature; + var signature$$1 = this.reader.readString(4); + var result = signature$$1 === expectedSignature; this.reader.setIndex(currentIndex); return result; }, @@ -42249,12 +42332,12 @@ var load = function(data, options) { return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64) .then(function(data) { - var zipEntries$1 = new zipEntries(options); - zipEntries$1.load(data); - return zipEntries$1; - }).then(function checkCRC32(zipEntries) { - var promises = [external.Promise.resolve(zipEntries)]; - var files = zipEntries.files; + var zipEntries$$1 = new zipEntries(options); + zipEntries$$1.load(data); + return zipEntries$$1; + }).then(function checkCRC32(zipEntries$$1) { + var promises = [external.Promise.resolve(zipEntries$$1)]; + var files = zipEntries$$1.files; if (options.checkCRC32) { for (var i = 0; i < files.length; i++) { promises.push(checkEntryCRC32(files[i])); @@ -42262,8 +42345,8 @@ var load = function(data, options) { } return external.Promise.all(promises); }).then(function addFiles(results) { - var zipEntries = results.shift(); - var files = zipEntries.files; + var zipEntries$$1 = results.shift(); + var files = zipEntries$$1.files; for (var i = 0; i < files.length; i++) { var input = files[i]; zip.file(input.fileNameStr, input.decompressed, { @@ -42277,8 +42360,8 @@ var load = function(data, options) { createFolders: options.createFolders }); } - if (zipEntries.zipComment.length) { - zip.comment = zipEntries.zipComment; + if (zipEntries$$1.zipComment.length) { + zip.comment = zipEntries$$1.zipComment; } return zip; @@ -42597,7 +42680,7 @@ function compileList(schema, name, result) { result.push(currentType); }); - return result.filter(function (type, index) { + return result.filter(function (type$$1, index) { return exclude.indexOf(index) === -1; }); } @@ -42606,8 +42689,8 @@ function compileList(schema, name, result) { function compileMap(/* lists... */) { var result = {}, index, length; - function collectType(type) { - result[type.tag] = type; + function collectType(type$$1) { + result[type$$1.tag] = type$$1; } for (index = 0, length = arguments.length; index < length; index += 1) { @@ -42623,8 +42706,8 @@ function Schema(definition) { this.implicit = definition.implicit || []; this.explicit = definition.explicit || []; - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { + this.implicit.forEach(function (type$$1) { + if (type$$1.loadKind && type$$1.loadKind !== 'scalar') { throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); } }); @@ -42663,7 +42746,7 @@ Schema.create = function createSchema() { throw new exception('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); } - if (!types.every(function (type$1) { return type$1 instanceof type; })) { + if (!types.every(function (type$$1) { return type$$1 instanceof type; })) { throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); } @@ -46992,7 +47075,7 @@ var RenderStateManager = function RenderStateManager(gl) { }); }; -__chunk_1.require$$0$4('Uint8', 1, function (init) { +__chunk_1.require$$0$5('Uint8', 1, function (init) { return function Uint8ClampedArray(data, byteOffset, length) { return init(this, data, byteOffset, length); }; @@ -48765,6 +48848,10 @@ function () { _proto.createLights = function createLights() { this.lights = {}; + if (__chunk_1.debugSettings.wireframe) { + __chunk_1.Light.enabled = false; // disable lighting for wireframe mode + } + for (var i in this.config.lights) { if (!this.config.lights[i] || typeof this.config.lights[i] !== 'object') { continue; @@ -49732,7 +49819,7 @@ return index; // Script modules can't expose exports try { Tangram.debug.ESM = false; // mark build as ES module - Tangram.debug.SHA = 'e76e4fd4278c18dccb19ec07d7550bbb76bdd8f7'; + Tangram.debug.SHA = 'f0e7cf665ee5bfbc46bfffb6b64474f2caee7de0'; if (false === true && typeof window === 'object') { window.Tangram = Tangram; } diff --git a/dist/tangram.debug.js.map b/dist/tangram.debug.js.map index 331f1f9b2..bbdba354e 100644 --- a/dist/tangram.debug.js.map +++ b/dist/tangram.debug.js.map @@ -1 +1 @@ -{"version":3,"file":"tangram.debug.js","sources":["../node_modules/core-js/modules/_core.js","../node_modules/core-js/modules/_global.js","../node_modules/core-js/modules/_library.js","../node_modules/core-js/modules/_shared.js","../node_modules/core-js/modules/_uid.js","../node_modules/core-js/modules/_wks.js","../node_modules/core-js/modules/_is-object.js","../node_modules/core-js/modules/_an-object.js","../node_modules/core-js/modules/_fails.js","../node_modules/core-js/modules/_descriptors.js","../node_modules/core-js/modules/_dom-create.js","../node_modules/core-js/modules/_ie8-dom-define.js","../node_modules/core-js/modules/_to-primitive.js","../node_modules/core-js/modules/_object-dp.js","../node_modules/core-js/modules/_property-desc.js","../node_modules/core-js/modules/_hide.js","../node_modules/core-js/modules/_add-to-unscopables.js","../node_modules/core-js/modules/_iter-step.js","../node_modules/core-js/modules/_iterators.js","../node_modules/core-js/modules/_cof.js","../node_modules/core-js/modules/_iobject.js","../node_modules/core-js/modules/_defined.js","../node_modules/core-js/modules/_to-iobject.js","../node_modules/core-js/modules/_has.js","../node_modules/core-js/modules/_redefine.js","../node_modules/core-js/modules/_a-function.js","../node_modules/core-js/modules/_ctx.js","../node_modules/core-js/modules/_export.js","../node_modules/core-js/modules/_to-integer.js","../node_modules/core-js/modules/_to-length.js","../node_modules/core-js/modules/_to-absolute-index.js","../node_modules/core-js/modules/_array-includes.js","../node_modules/core-js/modules/_shared-key.js","../node_modules/core-js/modules/_object-keys-internal.js","../node_modules/core-js/modules/_enum-bug-keys.js","../node_modules/core-js/modules/_object-keys.js","../node_modules/core-js/modules/_object-dps.js","../node_modules/core-js/modules/_html.js","../node_modules/core-js/modules/_object-create.js","../node_modules/core-js/modules/_set-to-string-tag.js","../node_modules/core-js/modules/_iter-create.js","../node_modules/core-js/modules/_to-object.js","../node_modules/core-js/modules/_object-gpo.js","../node_modules/core-js/modules/_iter-define.js","../node_modules/core-js/modules/es6.array.iterator.js","../node_modules/core-js/modules/web.dom.iterable.js","../node_modules/core-js/modules/_object-gops.js","../node_modules/core-js/modules/_object-pie.js","../node_modules/core-js/modules/_object-assign.js","../node_modules/core-js/modules/es6.object.assign.js","../src/utils/thread.js","../node_modules/core-js/modules/_string-at.js","../node_modules/core-js/modules/_advance-string-index.js","../node_modules/core-js/modules/_classof.js","../node_modules/core-js/modules/_regexp-exec-abstract.js","../node_modules/core-js/modules/_flags.js","../node_modules/core-js/modules/_regexp-exec.js","../node_modules/core-js/modules/es6.regexp.exec.js","../node_modules/core-js/modules/_fix-re-wks.js","../node_modules/core-js/modules/es6.regexp.replace.js","../node_modules/core-js/modules/_strict-method.js","../node_modules/core-js/modules/es6.array.sort.js","../node_modules/core-js/modules/_meta.js","../node_modules/core-js/modules/_is-array.js","../node_modules/core-js/modules/_object-gopn.js","../node_modules/core-js/modules/_object-gopd.js","../node_modules/core-js/modules/es6.string.iterator.js","../node_modules/core-js/modules/_an-instance.js","../node_modules/core-js/modules/_iter-call.js","../node_modules/core-js/modules/_is-array-iter.js","../node_modules/core-js/modules/core.get-iterator-method.js","../node_modules/core-js/modules/_for-of.js","../node_modules/core-js/modules/_species-constructor.js","../node_modules/core-js/modules/_invoke.js","../node_modules/core-js/modules/_task.js","../node_modules/core-js/modules/_microtask.js","../node_modules/core-js/modules/_new-promise-capability.js","../node_modules/core-js/modules/_perform.js","../node_modules/core-js/modules/_user-agent.js","../node_modules/core-js/modules/_promise-resolve.js","../node_modules/core-js/modules/_redefine-all.js","../node_modules/core-js/modules/_set-species.js","../node_modules/core-js/modules/_iter-detect.js","../node_modules/core-js/modules/es6.promise.js","../node_modules/core-js/modules/es6.function.name.js","../node_modules/core-js/modules/_object-sap.js","../node_modules/core-js/modules/es6.object.keys.js","../src/utils/version.js","../node_modules/core-js/modules/_is-regexp.js","../node_modules/core-js/modules/es6.regexp.split.js","../src/utils/worker_broker.js","../src/utils/log.js","../node_modules/core-js/modules/es6.regexp.flags.js","../node_modules/core-js/modules/es6.regexp.to-string.js","../src/utils/utils.js","../src/utils/debug_settings.js","../node_modules/core-js/modules/_set-proto.js","../node_modules/core-js/modules/_inherit-if-required.js","../node_modules/core-js/modules/es6.regexp.constructor.js","../node_modules/core-js/modules/_same-value.js","../node_modules/core-js/modules/es6.regexp.search.js","../src/utils/urls.js","../src/utils/task.js","../src/utils/subscribe.js","../src/utils/slice.js","../node_modules/core-js/modules/_string-repeat.js","../node_modules/core-js/modules/es6.string.repeat.js","../node_modules/core-js/modules/_typed.js","../node_modules/core-js/modules/_to-index.js","../node_modules/core-js/modules/_array-fill.js","../node_modules/core-js/modules/_typed-buffer.js","../node_modules/core-js/modules/_array-species-constructor.js","../node_modules/core-js/modules/_array-species-create.js","../node_modules/core-js/modules/_array-methods.js","../node_modules/core-js/modules/_array-copy-within.js","../node_modules/core-js/modules/_typed-array.js","../node_modules/core-js/modules/es6.typed.uint8-array.js","../src/gl/texture.js","../node_modules/core-js/modules/_object-to-array.js","../node_modules/core-js/modules/es7.object.entries.js","../node_modules/core-js/modules/es6.regexp.match.js","../src/gl/glsl.js","../src/gl/extensions.js","../src/utils/hash.js","../node_modules/gl-shader-errors/index.js","../src/gl/shader_program.js","../src/gl/vao.js","../node_modules/core-js/modules/es7.object.values.js","../node_modules/core-js/modules/es6.array.find-index.js","../src/utils/merge.js","../src/utils/geo.js","../node_modules/core-js/modules/_string-ws.js","../node_modules/core-js/modules/_string-trim.js","../node_modules/core-js/modules/es6.number.constructor.js","../node_modules/core-js/modules/es6.number.min-safe-integer.js","../node_modules/core-js/modules/es6.object.freeze.js","../src/utils/functions.js","../node_modules/csscolorparser/csscolorparser.js","../src/styles/style_parser.js","../node_modules/core-js/modules/es6.array.fill.js","../src/selection/selection.js","../src/gl/constants.js","../node_modules/core-js/modules/es6.typed.uint16-array.js","../src/gl/vbo_mesh.js","../src/lights/material.js","../src/utils/vector.js","../src/lights/light.js","../node_modules/core-js/modules/es6.math.log2.js","../src/utils/errors.js","../src/sources/data_source.js","../src/tile/tile_id.js","../src/sources/raster.js","../src/styles/style.js","../node_modules/core-js/modules/es6.typed.int16-array.js","../node_modules/core-js/modules/es6.typed.uint32-array.js","../node_modules/core-js/modules/es6.typed.int32-array.js","../node_modules/core-js/modules/es6.typed.int8-array.js","../node_modules/core-js/modules/es6.typed.float32-array.js","../src/gl/vertex_elements.js","../src/gl/vertex_data.js","../src/gl/vertex_layout.js","../src/builders/common.js","../node_modules/earcut/src/earcut.js","../src/builders/polygons.js","../src/styles/polygons/polygons.js","../node_modules/core-js/modules/_string-html.js","../node_modules/core-js/modules/es6.string.sub.js","../src/builders/polylines.js","../src/styles/lines/dasharray.js","../src/styles/lines/lines.js","../node_modules/core-js/modules/es6.date.to-json.js","../node_modules/core-js/modules/es6.string.anchor.js","../src/builders/points.js","../src/labels/point_anchor.js","../src/labels/intersect.js","../src/utils/obb.js","../src/labels/label.js","../src/labels/repeat_group.js","../src/labels/collision_grid.js","../src/labels/collision.js","../src/labels/label_point.js","../src/labels/point_placement.js","../src/styles/text/text_settings.js","../node_modules/fontfaceobserver/fontfaceobserver.standalone.js","../src/styles/text/font_manager.js","../src/styles/text/text_segments.js","../src/styles/text/text_wrap.js","../src/styles/text/text_canvas.js","../src/styles/text/text_labels.js","../node_modules/core-js/modules/es6.typed.float64-array.js","../node_modules/gl-mat3/normal-from-mat4.js","../node_modules/gl-mat3/invert.js","../node_modules/gl-mat4/multiply.js","../node_modules/gl-mat4/translate.js","../node_modules/gl-mat4/scale.js","../node_modules/gl-mat4/perspective.js","../node_modules/gl-mat4/identity.js","../node_modules/gl-mat4/lookAt.js","../node_modules/gl-mat4/copy.js","../src/utils/gl-matrix.js","../src/scene/camera.js","../src/scene/view.js","../src/styles/points/points.js","../node_modules/core-js/modules/es6.math.hypot.js","../src/labels/label_line.js","../src/styles/text/text.js","../src/styles/raster/raster.js","../src/styles/style_manager.js","../node_modules/core-js/modules/es6.number.max-safe-integer.js","../src/styles/filter.js","../src/styles/layer.js","../src/tile/tile.js","../node_modules/ieee754/index.js","../node_modules/pbf/index.js","../node_modules/@mapbox/point-geometry/index.js","../node_modules/@mapbox/vector-tile/lib/vectortilefeature.js","../node_modules/@mapbox/vector-tile/lib/vectortilelayer.js","../node_modules/@mapbox/vector-tile/lib/vectortile.js","../node_modules/@mapbox/vector-tile/index.js","../src/sources/mvt.js","../node_modules/geojson-vt/src/simplify.js","../node_modules/geojson-vt/src/feature.js","../node_modules/geojson-vt/src/convert.js","../node_modules/geojson-vt/src/transform.js","../node_modules/geojson-vt/src/clip.js","../node_modules/geojson-vt/src/wrap.js","../node_modules/geojson-vt/src/tile.js","../node_modules/geojson-vt/src/index.js","../src/sources/geojson.js","../node_modules/topojson-client/src/reverse.js","../node_modules/topojson-client/src/identity.js","../node_modules/topojson-client/src/transform.js","../node_modules/topojson-client/src/feature.js","../src/sources/topojson.js","../src/scene/scene_worker.js","../node_modules/core-js/modules/_wks-ext.js","../node_modules/core-js/modules/_wks-define.js","../node_modules/core-js/modules/es7.symbol.async-iterator.js","../node_modules/core-js/modules/_enum-keys.js","../node_modules/core-js/modules/_object-gopn-ext.js","../node_modules/core-js/modules/es6.symbol.js","../src/gl/context.js","../node_modules/rollup-plugin-node-globals/src/global.js","../node_modules/buffer-es6/base64.js","../node_modules/buffer-es6/ieee754.js","../node_modules/buffer-es6/isArray.js","../node_modules/buffer-es6/index.js","../node_modules/rollup-plugin-node-builtins/src/es6/events.js","../node_modules/process-es6/browser.js","../node_modules/util/support/isBufferBrowser.js","../node_modules/util/node_modules/inherits/inherits_browser.js","../node_modules/util/util.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/buffer-list.js","../node_modules/safe-buffer/index.js","../node_modules/string_decoder/lib/string_decoder.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/readable.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/writable.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/duplex.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/transform.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/passthrough.js","../node_modules/rollup-plugin-node-builtins/src/es6/stream.js","../node_modules/jszip/lib/readable-stream-browser.js","../node_modules/jszip/lib/support.js","../node_modules/jszip/lib/base64.js","../node_modules/jszip/lib/nodejsUtils.js","../node_modules/jszip/node_modules/core-js/library/modules/_global.js","../node_modules/jszip/node_modules/core-js/library/modules/_core.js","../node_modules/jszip/node_modules/core-js/library/modules/_a-function.js","../node_modules/jszip/node_modules/core-js/library/modules/_ctx.js","../node_modules/jszip/node_modules/core-js/library/modules/_is-object.js","../node_modules/jszip/node_modules/core-js/library/modules/_an-object.js","../node_modules/jszip/node_modules/core-js/library/modules/_fails.js","../node_modules/jszip/node_modules/core-js/library/modules/_descriptors.js","../node_modules/jszip/node_modules/core-js/library/modules/_dom-create.js","../node_modules/jszip/node_modules/core-js/library/modules/_ie8-dom-define.js","../node_modules/jszip/node_modules/core-js/library/modules/_to-primitive.js","../node_modules/jszip/node_modules/core-js/library/modules/_object-dp.js","../node_modules/jszip/node_modules/core-js/library/modules/_property-desc.js","../node_modules/jszip/node_modules/core-js/library/modules/_hide.js","../node_modules/jszip/node_modules/core-js/library/modules/_export.js","../node_modules/jszip/node_modules/core-js/library/modules/_invoke.js","../node_modules/jszip/node_modules/core-js/library/modules/_html.js","../node_modules/jszip/node_modules/core-js/library/modules/_cof.js","../node_modules/jszip/node_modules/core-js/library/modules/_task.js","../node_modules/jszip/node_modules/core-js/library/modules/web.immediate.js","../node_modules/jszip/node_modules/core-js/library/fn/set-immediate.js","../node_modules/immediate/lib/browser.js","../node_modules/lie/lib/browser.js","../node_modules/jszip/lib/external.js","../node_modules/jszip/lib/utils.js","../node_modules/jszip/lib/stream/GenericWorker.js","../node_modules/jszip/lib/utf8.js","../node_modules/jszip/lib/stream/ConvertWorker.js","../node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js","../node_modules/jszip/lib/stream/StreamHelper.js","../node_modules/jszip/lib/defaults.js","../node_modules/jszip/lib/stream/DataWorker.js","../node_modules/jszip/lib/stream/DataLengthProbe.js","../node_modules/jszip/lib/crc32.js","../node_modules/jszip/lib/stream/Crc32Probe.js","../node_modules/jszip/lib/compressedObject.js","../node_modules/jszip/lib/zipObject.js","../node_modules/pako/lib/utils/common.js","../node_modules/pako/lib/zlib/trees.js","../node_modules/pako/lib/zlib/adler32.js","../node_modules/pako/lib/zlib/crc32.js","../node_modules/pako/lib/zlib/messages.js","../node_modules/pako/lib/zlib/deflate.js","../node_modules/pako/lib/utils/strings.js","../node_modules/pako/lib/zlib/zstream.js","../node_modules/pako/lib/deflate.js","../node_modules/pako/lib/zlib/inffast.js","../node_modules/pako/lib/zlib/inftrees.js","../node_modules/pako/lib/zlib/inflate.js","../node_modules/pako/lib/zlib/constants.js","../node_modules/pako/lib/zlib/gzheader.js","../node_modules/pako/lib/inflate.js","../node_modules/pako/index.js","../node_modules/jszip/lib/flate.js","../node_modules/jszip/lib/compressions.js","../node_modules/jszip/lib/signature.js","../node_modules/jszip/lib/generate/ZipFileWorker.js","../node_modules/jszip/lib/generate/index.js","../node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js","../node_modules/jszip/lib/object.js","../node_modules/jszip/lib/reader/DataReader.js","../node_modules/jszip/lib/reader/ArrayReader.js","../node_modules/jszip/lib/reader/StringReader.js","../node_modules/jszip/lib/reader/Uint8ArrayReader.js","../node_modules/jszip/lib/reader/NodeBufferReader.js","../node_modules/jszip/lib/reader/readerFor.js","../node_modules/jszip/lib/zipEntry.js","../node_modules/jszip/lib/zipEntries.js","../node_modules/jszip/lib/load.js","../node_modules/jszip/lib/index.js","../node_modules/js-yaml/lib/js-yaml/common.js","../node_modules/js-yaml/lib/js-yaml/exception.js","../node_modules/js-yaml/lib/js-yaml/mark.js","../node_modules/js-yaml/lib/js-yaml/type.js","../node_modules/js-yaml/lib/js-yaml/schema.js","../node_modules/js-yaml/lib/js-yaml/type/str.js","../node_modules/js-yaml/lib/js-yaml/type/seq.js","../node_modules/js-yaml/lib/js-yaml/type/map.js","../node_modules/js-yaml/lib/js-yaml/schema/failsafe.js","../node_modules/js-yaml/lib/js-yaml/type/null.js","../node_modules/js-yaml/lib/js-yaml/type/bool.js","../node_modules/js-yaml/lib/js-yaml/type/int.js","../node_modules/js-yaml/lib/js-yaml/type/float.js","../node_modules/js-yaml/lib/js-yaml/schema/json.js","../node_modules/js-yaml/lib/js-yaml/schema/core.js","../node_modules/js-yaml/lib/js-yaml/type/timestamp.js","../node_modules/js-yaml/lib/js-yaml/type/merge.js","../node_modules/rollup-plugin-node-resolve/src/empty.js","../node_modules/js-yaml/lib/js-yaml/type/binary.js","../node_modules/js-yaml/lib/js-yaml/type/omap.js","../node_modules/js-yaml/lib/js-yaml/type/pairs.js","../node_modules/js-yaml/lib/js-yaml/type/set.js","../node_modules/js-yaml/lib/js-yaml/schema/default_safe.js","../node_modules/js-yaml/lib/js-yaml/type/js/undefined.js","../node_modules/js-yaml/lib/js-yaml/type/js/regexp.js","../node_modules/js-yaml/lib/js-yaml/type/js/function.js","../node_modules/js-yaml/lib/js-yaml/schema/default_full.js","../node_modules/js-yaml/lib/js-yaml/loader.js","../node_modules/js-yaml/lib/js-yaml.js","../node_modules/js-yaml/index.js","../src/scene/scene_bundle.js","../src/scene/scene_loader.js","../src/tile/tile_pyramid.js","../src/labels/main_pass.js","../src/tile/tile_manager.js","../src/gl/render_state.js","../node_modules/core-js/modules/es6.typed.uint8-clamped-array.js","../src/utils/media_capture.js","../src/scene/scene_debug.js","../src/scene/scene.js","../src/utils/debounce.js","../src/leaflet_layer.js","../src/index.js","../build/bundle.js"],"sourcesContent":["var core = module.exports = { version: '2.6.3' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","module.exports = false;\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n});\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n","module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n","module.exports = {};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar TO_STRING = 'toString';\nvar $toString = Function[TO_STRING];\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n","var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables');\nvar step = require('./_iter-step');\nvar Iterators = require('./_iterators');\nvar toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n","var $iterators = require('./es6.array.iterator');\nvar getKeys = require('./_object-keys');\nvar redefine = require('./_redefine');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar wks = require('./_wks');\nvar ITERATOR = wks('iterator');\nvar TO_STRING_TAG = wks('toStringTag');\nvar ArrayValues = Iterators.Array;\n\nvar DOMIterables = {\n CSSRuleList: true, // TODO: Not spec compliant, should be false.\n CSSStyleDeclaration: false,\n CSSValueList: false,\n ClientRectList: false,\n DOMRectList: false,\n DOMStringList: false,\n DOMTokenList: true,\n DataTransferItemList: false,\n FileList: false,\n HTMLAllCollection: false,\n HTMLCollection: false,\n HTMLFormElement: false,\n HTMLSelectElement: false,\n MediaList: true, // TODO: Not spec compliant, should be false.\n MimeTypeArray: false,\n NamedNodeMap: false,\n NodeList: true,\n PaintRequestList: false,\n Plugin: false,\n PluginArray: false,\n SVGLengthList: false,\n SVGNumberList: false,\n SVGPathSegList: false,\n SVGPointList: false,\n SVGStringList: false,\n SVGTransformList: false,\n SourceBufferList: false,\n StyleSheetList: true, // TODO: Not spec compliant, should be false.\n TextTrackCueList: false,\n TextTrackList: false,\n TouchList: false\n};\n\nfor (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {\n var NAME = collections[i];\n var explicit = DOMIterables[NAME];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n var key;\n if (proto) {\n if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);\n if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = ArrayValues;\n if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);\n }\n}\n","exports.f = Object.getOwnPropertySymbols;\n","exports.f = {}.propertyIsEnumerable;\n","'use strict';\n// 19.1.2.1 Object.assign(target, source, ...)\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nvar toObject = require('./_to-object');\nvar IObject = require('./_iobject');\nvar $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nmodule.exports = !$assign || require('./_fails')(function () {\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var S = Symbol();\n var K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function (k) { B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var aLen = arguments.length;\n var index = 1;\n var getSymbols = gOPS.f;\n var isEnum = pIE.f;\n while (aLen > index) {\n var S = IObject(arguments[index++]);\n var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];\n } return T;\n} : $assign;\n","// 19.1.3.1 Object.assign(target, source)\nvar $export = require('./_export');\n\n$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });\n","/*jshint worker: true*/\n\n// Mark thread as main or worker\nconst Thread = {};\n\ntry {\n if (window instanceof Window && window.document instanceof HTMLDocument) { // jshint ignore:line\n Thread.is_worker = false;\n Thread.is_main = true;\n }\n}\ncatch(e) {\n Thread.is_worker = true;\n Thread.is_main = false;\n\n // Patch for 3rd party libs that require these globals to be present. Specifically, FontFaceObserver.\n // Brittle solution but allows that library to load on worker threads.\n self.window = { document: {} };\n self.document = self.window.document;\n}\n\nexport default Thread;\n","var toInteger = require('./_to-integer');\nvar defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n return function (that, pos) {\n var s = String(defined(that));\n var i = toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n","'use strict';\nvar at = require('./_string-at')(true);\n\n // `AdvanceStringIndex` abstract operation\n// https://tc39.github.io/ecma262/#sec-advancestringindex\nmodule.exports = function (S, index, unicode) {\n return index + (unicode ? at(S, index).length : 1);\n};\n","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n","'use strict';\n\nvar classof = require('./_classof');\nvar builtinExec = RegExp.prototype.exec;\n\n // `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n var exec = R.exec;\n if (typeof exec === 'function') {\n var result = exec.call(R, S);\n if (typeof result !== 'object') {\n throw new TypeError('RegExp exec method returned something other than an Object or null');\n }\n return result;\n }\n if (classof(R) !== 'RegExp') {\n throw new TypeError('RegExp#exec called on incompatible receiver');\n }\n return builtinExec.call(R, S);\n};\n","'use strict';\n// 21.2.5.3 get RegExp.prototype.flags\nvar anObject = require('./_an-object');\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n","'use strict';\n\nvar regexpFlags = require('./_flags');\n\nvar nativeExec = RegExp.prototype.exec;\n// This always refers to the native implementation, because the\n// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n// which loads this file before patching the method.\nvar nativeReplace = String.prototype.replace;\n\nvar patchedExec = nativeExec;\n\nvar LAST_INDEX = 'lastIndex';\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/,\n re2 = /b*/g;\n nativeExec.call(re1, 'a');\n nativeExec.call(re2, 'a');\n return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0;\n})();\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;\n\nif (PATCH) {\n patchedExec = function exec(str) {\n var re = this;\n var lastIndex, reCopy, match, i;\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + re.source + '$(?!\\\\s)', regexpFlags.call(re));\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX];\n\n match = nativeExec.call(re, str);\n\n if (UPDATES_LAST_INDEX_WRONG && match) {\n re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n // eslint-disable-next-line no-loop-func\n nativeReplace.call(match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n return match;\n };\n}\n\nmodule.exports = patchedExec;\n","'use strict';\nvar regexpExec = require('./_regexp-exec');\nrequire('./_export')({\n target: 'RegExp',\n proto: true,\n forced: regexpExec !== /./.exec\n}, {\n exec: regexpExec\n});\n","'use strict';\nrequire('./es6.regexp.exec');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar fails = require('./_fails');\nvar defined = require('./_defined');\nvar wks = require('./_wks');\nvar regexpExec = require('./_regexp-exec');\n\nvar SPECIES = wks('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$') !== '7';\n});\n\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () {\n // Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length === 2 && result[0] === 'a' && result[1] === 'b';\n})();\n\nmodule.exports = function (KEY, length, exec) {\n var SYMBOL = wks(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n re.exec = function () { execCalled = true; return null; };\n if (KEY === 'split') {\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES] = function () { return re; };\n }\n re[SYMBOL]('');\n return !execCalled;\n }) : undefined;\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var fns = exec(\n defined,\n SYMBOL,\n ''[KEY],\n function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }\n );\n var strfn = fns[0];\n var rxfn = fns[1];\n\n redefine(String.prototype, KEY, strfn);\n hide(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return rxfn.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return rxfn.call(string, this); }\n );\n }\n};\n","'use strict';\n\nvar anObject = require('./_an-object');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar toInteger = require('./_to-integer');\nvar advanceStringIndex = require('./_advance-string-index');\nvar regExpExec = require('./_regexp-exec-abstract');\nvar max = Math.max;\nvar min = Math.min;\nvar floor = Math.floor;\nvar SUBSTITUTION_SYMBOLS = /\\$([$&`']|\\d\\d?|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&`']|\\d\\d?)/g;\n\nvar maybeToString = function (it) {\n return it === undefined ? it : String(it);\n};\n\n// @@replace logic\nrequire('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) {\n return [\n // `String.prototype.replace` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = defined(this);\n var fn = searchValue == undefined ? undefined : searchValue[REPLACE];\n return fn !== undefined\n ? fn.call(searchValue, O, replaceValue)\n : $replace.call(String(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n function (regexp, replaceValue) {\n var res = maybeCallNative($replace, regexp, this, replaceValue);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var functionalReplace = typeof replaceValue === 'function';\n if (!functionalReplace) replaceValue = String(replaceValue);\n var global = rx.global;\n if (global) {\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n var results = [];\n while (true) {\n var result = regExpExec(rx, S);\n if (result === null) break;\n results.push(result);\n if (!global) break;\n var matchStr = String(result[0]);\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n }\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n var matched = String(result[0]);\n var position = max(min(toInteger(result.index), S.length), 0);\n var captures = [];\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = [matched].concat(captures, position, S);\n if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n var replacement = String(replaceValue.apply(undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n return accumulatedResult + S.slice(nextSourcePosition);\n }\n ];\n\n // https://tc39.github.io/ecma262/#sec-getsubstitution\n function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return $replace.call(replacement, symbols, function (match, ch) {\n var capture;\n switch (ch.charAt(0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return str.slice(0, position);\n case \"'\": return str.slice(tailPos);\n case '<':\n capture = namedCaptures[ch.slice(1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n }\n});\n","'use strict';\nvar fails = require('./_fails');\n\nmodule.exports = function (method, arg) {\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call\n arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n });\n};\n","'use strict';\nvar $export = require('./_export');\nvar aFunction = require('./_a-function');\nvar toObject = require('./_to-object');\nvar fails = require('./_fails');\nvar $sort = [].sort;\nvar test = [1, 2, 3];\n\n$export($export.P + $export.F * (fails(function () {\n // IE8-\n test.sort(undefined);\n}) || !fails(function () {\n // V8 bug\n test.sort(null);\n // Old WebKit\n}) || !require('./_strict-method')($sort)), 'Array', {\n // 22.1.3.25 Array.prototype.sort(comparefn)\n sort: function sort(comparefn) {\n return comparefn === undefined\n ? $sort.call(toObject(this))\n : $sort.call(toObject(this), aFunction(comparefn));\n }\n});\n","var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n","// 7.2.2 IsArray(argument)\nvar cof = require('./_cof');\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n","// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = require('./_object-keys-internal');\nvar hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n","var pIE = require('./_object-pie');\nvar createDesc = require('./_property-desc');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar has = require('./_has');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n","module.exports = function (it, Constructor, name, forbiddenField) {\n if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {\n throw TypeError(name + ': incorrect invocation!');\n } return it;\n};\n","// call something on iterator step with safe closing on error\nvar anObject = require('./_an-object');\nmodule.exports = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) anObject(ret.call(iterator));\n throw e;\n }\n};\n","// check on default Array iterator\nvar Iterators = require('./_iterators');\nvar ITERATOR = require('./_wks')('iterator');\nvar ArrayProto = Array.prototype;\n\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","var ctx = require('./_ctx');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar anObject = require('./_an-object');\nvar toLength = require('./_to-length');\nvar getIterFn = require('./core.get-iterator-method');\nvar BREAK = {};\nvar RETURN = {};\nvar exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {\n var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);\n var f = ctx(fn, that, entries ? 2 : 1);\n var index = 0;\n var length, step, iterator, result;\n if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');\n // fast case for arrays with default iterator\n if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {\n result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);\n if (result === BREAK || result === RETURN) return result;\n } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {\n result = call(iterator, f, step.value, entries);\n if (result === BREAK || result === RETURN) return result;\n }\n};\nexports.BREAK = BREAK;\nexports.RETURN = RETURN;\n","// 7.3.20 SpeciesConstructor(O, defaultConstructor)\nvar anObject = require('./_an-object');\nvar aFunction = require('./_a-function');\nvar SPECIES = require('./_wks')('species');\nmodule.exports = function (O, D) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);\n};\n","// fast apply, http://jsperf.lnkit.com/fast-apply/5\nmodule.exports = function (fn, args, that) {\n var un = that === undefined;\n switch (args.length) {\n case 0: return un ? fn()\n : fn.call(that);\n case 1: return un ? fn(args[0])\n : fn.call(that, args[0]);\n case 2: return un ? fn(args[0], args[1])\n : fn.call(that, args[0], args[1]);\n case 3: return un ? fn(args[0], args[1], args[2])\n : fn.call(that, args[0], args[1], args[2]);\n case 4: return un ? fn(args[0], args[1], args[2], args[3])\n : fn.call(that, args[0], args[1], args[2], args[3]);\n } return fn.apply(that, args);\n};\n","var ctx = require('./_ctx');\nvar invoke = require('./_invoke');\nvar html = require('./_html');\nvar cel = require('./_dom-create');\nvar global = require('./_global');\nvar process = global.process;\nvar setTask = global.setImmediate;\nvar clearTask = global.clearImmediate;\nvar MessageChannel = global.MessageChannel;\nvar Dispatch = global.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\nvar run = function () {\n var id = +this;\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\nvar listener = function (event) {\n run.call(event.data);\n};\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!setTask || !clearTask) {\n setTask = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n invoke(typeof fn == 'function' ? fn : Function(fn), args);\n };\n defer(counter);\n return counter;\n };\n clearTask = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (require('./_cof')(process) == 'process') {\n defer = function (id) {\n process.nextTick(ctx(run, id, 1));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(ctx(run, id, 1));\n };\n // Browsers with MessageChannel, includes WebWorkers\n } else if (MessageChannel) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = ctx(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {\n defer = function (id) {\n global.postMessage(id + '', '*');\n };\n global.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in cel('script')) {\n defer = function (id) {\n html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run.call(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(ctx(run, id, 1), 0);\n };\n }\n}\nmodule.exports = {\n set: setTask,\n clear: clearTask\n};\n","var global = require('./_global');\nvar macrotask = require('./_task').set;\nvar Observer = global.MutationObserver || global.WebKitMutationObserver;\nvar process = global.process;\nvar Promise = global.Promise;\nvar isNode = require('./_cof')(process) == 'process';\n\nmodule.exports = function () {\n var head, last, notify;\n\n var flush = function () {\n var parent, fn;\n if (isNode && (parent = process.domain)) parent.exit();\n while (head) {\n fn = head.fn;\n head = head.next;\n try {\n fn();\n } catch (e) {\n if (head) notify();\n else last = undefined;\n throw e;\n }\n } last = undefined;\n if (parent) parent.enter();\n };\n\n // Node.js\n if (isNode) {\n notify = function () {\n process.nextTick(flush);\n };\n // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339\n } else if (Observer && !(global.navigator && global.navigator.standalone)) {\n var toggle = true;\n var node = document.createTextNode('');\n new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (Promise && Promise.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n var promise = Promise.resolve(undefined);\n notify = function () {\n promise.then(flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessag\n // - onreadystatechange\n // - setTimeout\n } else {\n notify = function () {\n // strange IE + webpack dev server bug - use .call(global)\n macrotask.call(global, flush);\n };\n }\n\n return function (fn) {\n var task = { fn: fn, next: undefined };\n if (last) last.next = task;\n if (!head) {\n head = task;\n notify();\n } last = task;\n };\n};\n","'use strict';\n// 25.4.1.5 NewPromiseCapability(C)\nvar aFunction = require('./_a-function');\n\nfunction PromiseCapability(C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aFunction(resolve);\n this.reject = aFunction(reject);\n}\n\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n","module.exports = function (exec) {\n try {\n return { e: false, v: exec() };\n } catch (e) {\n return { e: true, v: e };\n }\n};\n","var global = require('./_global');\nvar navigator = global.navigator;\n\nmodule.exports = navigator && navigator.userAgent || '';\n","var anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar newPromiseCapability = require('./_new-promise-capability');\n\nmodule.exports = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n","var redefine = require('./_redefine');\nmodule.exports = function (target, src, safe) {\n for (var key in src) redefine(target, key, src[key], safe);\n return target;\n};\n","'use strict';\nvar global = require('./_global');\nvar dP = require('./_object-dp');\nvar DESCRIPTORS = require('./_descriptors');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (KEY) {\n var C = global[KEY];\n if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n};\n","var ITERATOR = require('./_wks')('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function () { SAFE_CLOSING = true; };\n // eslint-disable-next-line no-throw-literal\n Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nmodule.exports = function (exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING) return false;\n var safe = false;\n try {\n var arr = [7];\n var iter = arr[ITERATOR]();\n iter.next = function () { return { done: safe = true }; };\n arr[ITERATOR] = function () { return iter; };\n exec(arr);\n } catch (e) { /* empty */ }\n return safe;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar global = require('./_global');\nvar ctx = require('./_ctx');\nvar classof = require('./_classof');\nvar $export = require('./_export');\nvar isObject = require('./_is-object');\nvar aFunction = require('./_a-function');\nvar anInstance = require('./_an-instance');\nvar forOf = require('./_for-of');\nvar speciesConstructor = require('./_species-constructor');\nvar task = require('./_task').set;\nvar microtask = require('./_microtask')();\nvar newPromiseCapabilityModule = require('./_new-promise-capability');\nvar perform = require('./_perform');\nvar userAgent = require('./_user-agent');\nvar promiseResolve = require('./_promise-resolve');\nvar PROMISE = 'Promise';\nvar TypeError = global.TypeError;\nvar process = global.process;\nvar versions = process && process.versions;\nvar v8 = versions && versions.v8 || '';\nvar $Promise = global[PROMISE];\nvar isNode = classof(process) == 'process';\nvar empty = function () { /* empty */ };\nvar Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;\nvar newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;\n\nvar USE_NATIVE = !!function () {\n try {\n // correct subclassing with @@species support\n var promise = $Promise.resolve(1);\n var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) {\n exec(empty, empty);\n };\n // unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n return (isNode || typeof PromiseRejectionEvent == 'function')\n && promise.then(empty) instanceof FakePromise\n // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // we can't detect it synchronously, so just check versions\n && v8.indexOf('6.6') !== 0\n && userAgent.indexOf('Chrome/66') === -1;\n } catch (e) { /* empty */ }\n}();\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n};\nvar notify = function (promise, isReject) {\n if (promise._n) return;\n promise._n = true;\n var chain = promise._c;\n microtask(function () {\n var value = promise._v;\n var ok = promise._s == 1;\n var i = 0;\n var run = function (reaction) {\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (promise._h == 2) onHandleUnhandled(promise);\n promise._h = 1;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // may throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (e) {\n if (domain && !exited) domain.exit();\n reject(e);\n }\n };\n while (chain.length > i) run(chain[i++]); // variable length - can't use forEach\n promise._c = [];\n promise._n = false;\n if (isReject && !promise._h) onUnhandled(promise);\n });\n};\nvar onUnhandled = function (promise) {\n task.call(global, function () {\n var value = promise._v;\n var unhandled = isUnhandled(promise);\n var result, handler, console;\n if (unhandled) {\n result = perform(function () {\n if (isNode) {\n process.emit('unhandledRejection', value, promise);\n } else if (handler = global.onunhandledrejection) {\n handler({ promise: promise, reason: value });\n } else if ((console = global.console) && console.error) {\n console.error('Unhandled promise rejection', value);\n }\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n promise._h = isNode || isUnhandled(promise) ? 2 : 1;\n } promise._a = undefined;\n if (unhandled && result.e) throw result.v;\n });\n};\nvar isUnhandled = function (promise) {\n return promise._h !== 1 && (promise._a || promise._c).length === 0;\n};\nvar onHandleUnhandled = function (promise) {\n task.call(global, function () {\n var handler;\n if (isNode) {\n process.emit('rejectionHandled', promise);\n } else if (handler = global.onrejectionhandled) {\n handler({ promise: promise, reason: promise._v });\n }\n });\n};\nvar $reject = function (value) {\n var promise = this;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n promise._v = value;\n promise._s = 2;\n if (!promise._a) promise._a = promise._c.slice();\n notify(promise, true);\n};\nvar $resolve = function (value) {\n var promise = this;\n var then;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n try {\n if (promise === value) throw TypeError(\"Promise can't be resolved itself\");\n if (then = isThenable(value)) {\n microtask(function () {\n var wrapper = { _w: promise, _d: false }; // wrap\n try {\n then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));\n } catch (e) {\n $reject.call(wrapper, e);\n }\n });\n } else {\n promise._v = value;\n promise._s = 1;\n notify(promise, false);\n }\n } catch (e) {\n $reject.call({ _w: promise, _d: false }, e); // wrap\n }\n};\n\n// constructor polyfill\nif (!USE_NATIVE) {\n // 25.4.3.1 Promise(executor)\n $Promise = function Promise(executor) {\n anInstance(this, $Promise, PROMISE, '_h');\n aFunction(executor);\n Internal.call(this);\n try {\n executor(ctx($resolve, this, 1), ctx($reject, this, 1));\n } catch (err) {\n $reject.call(this, err);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n this._c = []; // <- awaiting reactions\n this._a = undefined; // <- checked in isUnhandled reactions\n this._s = 0; // <- state\n this._d = false; // <- done\n this._v = undefined; // <- value\n this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled\n this._n = false; // <- notify\n };\n Internal.prototype = require('./_redefine-all')($Promise.prototype, {\n // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)\n then: function then(onFulfilled, onRejected) {\n var reaction = newPromiseCapability(speciesConstructor(this, $Promise));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = isNode ? process.domain : undefined;\n this._c.push(reaction);\n if (this._a) this._a.push(reaction);\n if (this._s) notify(this, false);\n return reaction.promise;\n },\n // 25.4.5.1 Promise.prototype.catch(onRejected)\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n this.promise = promise;\n this.resolve = ctx($resolve, promise, 1);\n this.reject = ctx($reject, promise, 1);\n };\n newPromiseCapabilityModule.f = newPromiseCapability = function (C) {\n return C === $Promise || C === Wrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });\nrequire('./_set-to-string-tag')($Promise, PROMISE);\nrequire('./_set-species')(PROMISE);\nWrapper = require('./_core')[PROMISE];\n\n// statics\n$export($export.S + $export.F * !USE_NATIVE, PROMISE, {\n // 25.4.4.5 Promise.reject(r)\n reject: function reject(r) {\n var capability = newPromiseCapability(this);\n var $$reject = capability.reject;\n $$reject(r);\n return capability.promise;\n }\n});\n$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {\n // 25.4.4.6 Promise.resolve(x)\n resolve: function resolve(x) {\n return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);\n }\n});\n$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {\n $Promise.all(iter)['catch'](empty);\n})), PROMISE, {\n // 25.4.4.1 Promise.all(iterable)\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var values = [];\n var index = 0;\n var remaining = 1;\n forOf(iterable, false, function (promise) {\n var $index = index++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n C.resolve(promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[$index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.e) reject(result.v);\n return capability.promise;\n },\n // 25.4.4.4 Promise.race(iterable)\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var reject = capability.reject;\n var result = perform(function () {\n forOf(iterable, false, function (promise) {\n C.resolve(promise).then(capability.resolve, reject);\n });\n });\n if (result.e) reject(result.v);\n return capability.promise;\n }\n});\n","var dP = require('./_object-dp').f;\nvar FProto = Function.prototype;\nvar nameRE = /^\\s*function ([^ (]*)/;\nvar NAME = 'name';\n\n// 19.2.4.2 name\nNAME in FProto || require('./_descriptors') && dP(FProto, NAME, {\n configurable: true,\n get: function () {\n try {\n return ('' + this).match(nameRE)[1];\n } catch (e) {\n return '';\n }\n }\n});\n","// most Object methods by ES6 should accept primitives\nvar $export = require('./_export');\nvar core = require('./_core');\nvar fails = require('./_fails');\nmodule.exports = function (KEY, exec) {\n var fn = (core.Object || {})[KEY] || Object[KEY];\n var exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);\n};\n","// 19.1.2.14 Object.keys(O)\nvar toObject = require('./_to-object');\nvar $keys = require('./_object-keys');\n\nrequire('./_object-sap')('keys', function () {\n return function keys(it) {\n return $keys(toObject(it));\n };\n});\n","import {version} from '../../package.json';\n\nexport default 'v' + version;\n","// 7.2.8 IsRegExp(argument)\nvar isObject = require('./_is-object');\nvar cof = require('./_cof');\nvar MATCH = require('./_wks')('match');\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');\n};\n","'use strict';\n\nvar isRegExp = require('./_is-regexp');\nvar anObject = require('./_an-object');\nvar speciesConstructor = require('./_species-constructor');\nvar advanceStringIndex = require('./_advance-string-index');\nvar toLength = require('./_to-length');\nvar callRegExpExec = require('./_regexp-exec-abstract');\nvar regexpExec = require('./_regexp-exec');\nvar fails = require('./_fails');\nvar $min = Math.min;\nvar $push = [].push;\nvar $SPLIT = 'split';\nvar LENGTH = 'length';\nvar LAST_INDEX = 'lastIndex';\nvar MAX_UINT32 = 0xffffffff;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !fails(function () { RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\nrequire('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||\n 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||\n 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||\n '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||\n '.'[$SPLIT](/()()/)[LENGTH] > 1 ||\n ''[$SPLIT](/.?/)[LENGTH]\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(this);\n if (separator === undefined && limit === 0) return [];\n // If `separator` is not a regex, use native split\n if (!isRegExp(separator)) return $split.call(string, separator, limit);\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy[LAST_INDEX];\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));\n lastLength = match[0][LENGTH];\n lastLastIndex = lastIndex;\n if (output[LENGTH] >= splitLimit) break;\n }\n if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop\n }\n if (lastLastIndex === string[LENGTH]) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;\n };\n // Chakra, V8\n } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);\n };\n } else {\n internalSplit = $split;\n }\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = defined(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var C = speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n});\n","/*jshint worker: true*/\n\n// WorkerBroker routes messages between web workers and the main thread, allowing for simpler\n// async code via promises. Example usage:\n//\n// In web worker, register self as a callable \"target\", and define a method:\n//\n// WorkerBroker.addTarget('self', self);\n//\n// self.square = function (x) {\n// return x * x;\n// };\n//\n// In main thread, invoke that method and receive the result (if any) as a promise.\n//\n// worker = new Worker(...);\n// WorkerBroker.addWorker(worker);\n//\n// WorkerBroker.postMessage(worker, 'self.square', 5).then(function(y) {\n// console.log(y);\n// });\n//\n// -> prints 25\n//\n// Async code:\n//\n// For synchronous code that must pass a return value to the main thread, the function can simply\n// return an immediate value (see example above). For cases where the worker method needs to run\n// asynchronous code, the function can return a promise, and the resolved or rejected value will\n// be sent back to the main thread when the promise is fulfilled.\n//\n// Error handling:\n//\n// If the worker method either throws an error, or returns a promise that is rejected, it will be\n// sent back to the main thread as a promise rejection. These two examples are equivalent:\n//\n// In worker, throwing an error:\n//\n// self.broken = function () {\n// throw new Error('error in worker!');\n// };\n//\n// In worker, returning a rejected promise:\n//\n// self.broken = function () {\n// return Promise.reject(new Error('error in worker!'));\n// };\n//\n// In main thread, both errors are received as a promise rejection:\n//\n// WorkerBroker.postMessage(worker, 'self.broken').then(\n// // Promise resolved\n// function() {\n// console.log('success!');\n// },\n// // Promise rejected\n// function(error) {\n// console.log('error!', error);\n// });\n//\n// -> prints 'error! error in worker'\n//\n// Calling from worker to main thread:\n//\n// The same style of calls can be made *from* a web worker, to the main thread. The API is the same\n// with the exception that the first argument, 'worker', is not needed for WorkerBroker.postMessage(),\n// since the main thread is the implicit target.\n//\n// In main thread, define a method and register it:\n//\n// var geometry = {\n// length: function(x, y) {\n// return Math.sqrt(x * x + y * y);\n// }\n// };\n//\n// WorkerBroker.addTarget('geometry', geometry);\n//\n// In worker thread):\n//\n// WorkerBroker.postMessage('geometry.length', 3, 4).then(function(d) {\n// console.log(d);\n// });\n//\n// -> prints 5\n//\n\nimport Thread from './thread';\nimport log from './log';\n\nvar WorkerBroker;\nexport default WorkerBroker = {};\n\n// Global list of all worker messages\n// Uniquely tracks every call made between main thread and a worker\nvar message_id = 0;\nvar messages = {};\n\n// Register an object to receive calls from other thread\nWorkerBroker.targets = {};\nWorkerBroker.addTarget = function (name, target) {\n WorkerBroker.targets[name] = target;\n};\n\nWorkerBroker.removeTarget = function (name) {\n if (name) {\n delete WorkerBroker.targets[name];\n }\n};\n\n// Given a dot-notation-style method name, e.g. 'Object.object.method',\n// find the object to call the method on from the list of registered targets\nfunction findTarget (method) {\n var chain = [];\n if (typeof method === 'string') {\n chain = method.split('.');\n method = chain.pop();\n }\n\n var target = WorkerBroker.targets;\n\n for (let m=0; m < chain.length; m++) {\n if (target[chain[m]]) {\n target = target[chain[m]];\n }\n else {\n return [];\n }\n }\n\n return [method, target];\n}\n\n// Main thread:\n// - Send messages to workers, and optionally receive an async response as a promise\n// - Receive messages from workers, and optionally send an async response back as a promise\nfunction setupMainThread () {\n\n // Send a message to a worker, and optionally get an async response\n // Arguments:\n // - worker: one or more web worker instances to send the message to (single value or array)\n // - method: the method with this name, specified with dot-notation, will be invoked in the worker\n // - message: spread of arguments to call the method with\n // Returns:\n // - a promise that will be fulfilled if the worker method returns a value (could be immediately, or async)\n //\n WorkerBroker.postMessage = function (worker, method, ...message) {\n // If more than one worker specified, post to multiple\n if (Array.isArray(worker)) {\n return Promise.all(\n worker.map(w => WorkerBroker.postMessage(w, method, ...message))\n );\n }\n\n // Parse options\n let options = {};\n if (typeof method === 'object') {\n options = method;\n method = method.method;\n }\n\n // Track state of this message\n var promise = new Promise((resolve, reject) => {\n messages[message_id] = { method, message, resolve, reject };\n });\n\n\n let payload, transferables = [];\n\n if (message && message.length === 1 && message[0] instanceof WorkerBroker.withTransferables) {\n transferables = message[0].transferables;\n message = message[0].value;\n }\n\n payload = {\n type: 'main_send', // mark message as method invocation from main thread\n message_id, // unique id for this message, for life of program\n method, // will dispatch to a function of this name within the worker\n message // message payload\n };\n\n if (options.stringify) {\n payload = JSON.stringify(payload);\n }\n\n worker.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method}' transferred ${transferables.length} objects to worker thread`);\n }\n\n message_id++;\n return promise;\n };\n\n // Add a worker to communicate with - each worker must be registered from the main thread\n WorkerBroker.addWorker = function (worker) {\n if (!(worker instanceof Worker)) {\n throw Error('Worker broker could not add non-Worker object', worker);\n }\n\n worker.addEventListener('message', function WorkerBrokerMainThreadHandler(event) {\n let data = ((typeof event.data === 'string') ? JSON.parse(event.data) : event.data);\n let id = data.message_id;\n\n // Listen for messages coming back from the worker, and fulfill that message's promise\n if (data.type === 'worker_reply') {\n // Pass the result to the promise\n if (messages[id]) {\n if (data.error) {\n messages[id].reject(data.error);\n }\n else {\n messages[id].resolve(data.message);\n }\n delete messages[id];\n }\n }\n // Listen for messages initiating a call from the worker, dispatch them,\n // and send any return value back to the worker\n // Unique id for this message & return call to main thread\n else if (data.type === 'worker_send' && id != null) {\n // Call the requested method and save the return value\n let result, error, target, method_name, method;\n try {\n [method_name, target] = findTarget(data.method);\n if (!target) {\n throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because no object with that name is registered on main thread`);\n }\n\n method = (typeof target[method_name] === 'function') && target[method_name];\n if (!method) {\n throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because object has no method with that name`);\n }\n\n result = method.apply(target, data.message);\n }\n catch(e) {\n // Thrown errors will be passed back (in string form) to worker\n error = e;\n\n }\n // Send return value to worker\n let payload, transferables = [];\n\n // Async result\n if (result instanceof Promise) {\n result.then((value) => {\n if (value instanceof WorkerBroker.withTransferables) {\n transferables = value.transferables;\n value = value.value[0];\n }\n\n payload = {\n type: 'main_reply',\n message_id: id,\n message: value\n };\n worker.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method_name}' transferred ${transferables.length} objects to worker thread`);\n }\n\n }, (error) => {\n worker.postMessage({\n type: 'main_reply',\n message_id: id,\n error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)\n });\n });\n }\n // Immediate result\n else {\n if (result instanceof WorkerBroker.withTransferables) {\n transferables = result.transferables;\n result = result.value[0];\n }\n\n payload = {\n type: 'main_reply',\n message_id: id,\n message: result,\n error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)\n };\n worker.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method_name}' transferred ${transferables.length} objects to worker thread`);\n }\n }\n }\n });\n\n };\n\n // Expose for debugging\n WorkerBroker.getMessages = function () {\n return messages;\n };\n\n WorkerBroker.getMessageId = function () {\n return message_id;\n };\n\n}\n\n// Worker threads:\n// - Receive messages from main thread, and optionally send an async response back as a promise\n// - Send messages to main thread, and optionally receive an async response as a promise\nfunction setupWorkerThread () {\n\n // Send a message to the main thread, and optionally get an async response as a promise\n // Arguments:\n // - method: the method with this name, specified with dot-notation, will be invoked on the main thread\n // - message: array of arguments to call the method with\n // Returns:\n // - a promise that will be fulfilled if the main thread method returns a value (could be immediately, or async)\n //\n WorkerBroker.postMessage = function (method, ...message) {\n // Parse options\n let options = {};\n if (typeof method === 'object') {\n options = method;\n method = method.method;\n }\n\n // Track state of this message\n var promise = new Promise((resolve, reject) => {\n messages[message_id] = { method, message, resolve, reject };\n });\n\n let payload, transferables = [];\n\n if (message && message.length === 1 && message[0] instanceof WorkerBroker.withTransferables) {\n transferables = message[0].transferables;\n message = message[0].value;\n }\n\n payload = {\n type: 'worker_send', // mark message as method invocation from worker\n message_id, // unique id for this message, for life of program\n method, // will dispatch to a method of this name on the main thread\n message // message payload\n };\n\n if (options.stringify) {\n payload = JSON.stringify(payload);\n }\n\n self.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method}' transferred ${transferables.length} objects to main thread`);\n }\n\n message_id++;\n return promise;\n };\n\n self.addEventListener('message', function WorkerBrokerWorkerThreadHandler(event) {\n let data = ((typeof event.data === 'string') ? JSON.parse(event.data) : event.data);\n let id = data.message_id;\n\n // Listen for messages coming back from the main thread, and fulfill that message's promise\n if (data.type === 'main_reply') {\n // Pass the result to the promise\n if (messages[id]) {\n if (data.error) {\n messages[id].reject(data.error);\n }\n else {\n messages[id].resolve(data.message);\n }\n delete messages[id];\n }\n }\n // Receive messages from main thread, dispatch them, and send back a reply\n // Unique id for this message & return call to main thread\n else if (data.type === 'main_send' && id != null) {\n // Call the requested worker method and save the return value\n let result, error, target, method_name, method;\n try {\n [method_name, target] = findTarget(data.method);\n if (!target) {\n throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because no object with that name is registered on main thread`);\n }\n\n method = (typeof target[method_name] === 'function') && target[method_name];\n\n if (!method) {\n throw Error(`Worker broker could not dispatch message type ${data.method} because worker has no method with that name`);\n }\n\n result = method.apply(target, data.message);\n }\n catch(e) {\n // Thrown errors will be passed back (in string form) to main thread\n error = e;\n }\n\n // Send return value to main thread\n let payload, transferables = [];\n\n // Async result\n if (result instanceof Promise) {\n result.then((value) => {\n if (value instanceof WorkerBroker.withTransferables) {\n transferables = value.transferables;\n value = value.value[0];\n }\n\n payload = {\n type: 'worker_reply',\n message_id: id,\n message: value\n };\n self.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method_name}' transferred ${transferables.length} objects to main thread`);\n }\n }, (error) => {\n self.postMessage({\n type: 'worker_reply',\n message_id: id,\n error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)\n });\n });\n }\n // Immediate result\n else {\n if (result instanceof WorkerBroker.withTransferables) {\n transferables = result.transferables;\n result = result.value[0];\n }\n\n payload = {\n type: 'worker_reply',\n message_id: id,\n message: result,\n error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)\n };\n self.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method_name}' transferred ${transferables.length} objects to main thread`);\n }\n }\n }\n });\n\n}\n\n// Special value wrapper, to indicate that we want to find and include transferable objects in the message\nWorkerBroker.withTransferables = function (...value) {\n if (!(this instanceof WorkerBroker.withTransferables)) {\n return new WorkerBroker.withTransferables(...value);\n }\n\n this.value = value;\n this.transferables = findTransferables(this.value);\n};\n\n// Build a list of transferable objects from a source object\n// Returns a list of info about each transferable:\n// - object: the actual transferable object\n// - parent: the parent object that the transferable is a property of (if any)\n// - property: the property name of the transferable on the parent object (if any)\n// TODO: add option in case you DON'T want to transfer objects\nfunction findTransferables(source, parent = null, property = null, list = []) {\n if (!source) {\n return list;\n }\n\n if (Array.isArray(source)) {\n // Check each array element\n source.forEach((x, i) => findTransferables(x, source, i, list));\n }\n else if (typeof source === 'object') {\n // Is the object a transferable array buffer?\n if (source instanceof ArrayBuffer) {\n list.push({ object: source, parent, property });\n }\n // Or looks like a typed array (has an array buffer property)?\n else if (source.buffer instanceof ArrayBuffer) {\n list.push({ object: source.buffer, parent, property });\n }\n // Otherwise check each property\n else {\n for (let prop in source) {\n findTransferables(source[prop], source, prop, list);\n }\n }\n }\n return list;\n}\n\n// Remove neutered transferables from parent objects, as they should no longer be accessed after transfer\nfunction freeTransferables(transferables) {\n if (!Array.isArray(transferables)) {\n return;\n }\n transferables.filter(t => t.parent && t.property).forEach(t => delete t.parent[t.property]);\n}\n\n// Setup this thread as appropriate\nif (Thread.is_main) {\n setupMainThread();\n}\n\nif (Thread.is_worker) {\n setupWorkerThread();\n}\n","import version from './version';\nimport Thread from './thread';\nimport WorkerBroker from './worker_broker';\n\nconst LEVELS = {\n silent: -1,\n error: 0,\n warn: 1,\n info: 2,\n debug: 3,\n trace: 4\n};\n\nconst methods = {};\nlet logged_once = {};\n\nfunction methodForLevel (level) {\n if (Thread.is_main) {\n methods[level] = methods[level] || (console[level] ? console[level] : console.log).bind(console); // eslint-disable-line no-console\n return methods[level];\n }\n}\n\n// Logs message, proxying any log requests from worker threads back to the main thread.\n// Returns (asynchronously, due to proxying) a boolean indicating if the message was logged.\n// Option `once: true` can be used to only log each unique log message once (e.g. for warnings\n// that would otherwise be repetitive or possibly logged thousands of times, such as per feature).\nexport default function log (opts, ...msg) {\n let level = (typeof opts === 'object') ? opts.level : opts;\n if (LEVELS[level] <= LEVELS[log.level]) {\n if (Thread.is_worker) {\n // Proxy to main thread\n return WorkerBroker.postMessage({ method: '_logProxy', stringify: true }, opts, ...msg);\n }\n else {\n // Only log message once?\n if (typeof opts === 'object' && opts.once === true) {\n if (logged_once[JSON.stringify(msg)]) {\n return Promise.resolve(false);\n }\n logged_once[JSON.stringify(msg)] = true;\n }\n\n // Write to console (on main thread)\n let logger = methodForLevel(level);\n if (msg.length > 1) {\n logger(`Tangram ${version} [${level}]: ${msg[0]}`, ...msg.slice(1));\n }\n else {\n logger(`Tangram ${version} [${level}]: ${msg[0]}`);\n }\n }\n return Promise.resolve(true);\n }\n return Promise.resolve(false);\n}\n\nlog.level = 'info';\nlog.workers = null;\n\nlog.setLevel = function (level) {\n log.level = level;\n\n if (Thread.is_main && Array.isArray(log.workers)) {\n WorkerBroker.postMessage(log.workers, '_logSetLevelProxy', level);\n }\n};\n\nif (Thread.is_main) {\n log.setWorkers = function (workers) {\n log.workers = workers;\n };\n\n log.reset = function () {\n logged_once = {};\n };\n}\n\nWorkerBroker.addTarget('_logProxy', log); // proxy log messages from worker to main thread\nWorkerBroker.addTarget('_logSetLevelProxy', log.setLevel); // proxy log level setting from main to worker thread\n","// 21.2.5.3 get RegExp.prototype.flags()\nif (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', {\n configurable: true,\n get: require('./_flags')\n});\n","'use strict';\nrequire('./es6.regexp.flags');\nvar anObject = require('./_an-object');\nvar $flags = require('./_flags');\nvar DESCRIPTORS = require('./_descriptors');\nvar TO_STRING = 'toString';\nvar $toString = /./[TO_STRING];\n\nvar define = function (fn) {\n require('./_redefine')(RegExp.prototype, TO_STRING, fn, true);\n};\n\n// 21.2.5.14 RegExp.prototype.toString()\nif (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {\n define(function toString() {\n var R = anObject(this);\n return '/'.concat(R.source, '/',\n 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);\n });\n// FF44- RegExp#toString has a wrong name\n} else if ($toString.name != TO_STRING) {\n define(function toString() {\n return $toString.call(this);\n });\n}\n","// Miscellaneous utilities\n/*jshint worker: true*/\n\nimport log from './log';\nimport Thread from './thread';\nimport WorkerBroker from './worker_broker';\n\nexport default Utils;\n\nconst Utils = {};\n\nWorkerBroker.addTarget('Utils', Utils);\n\n// Basic Safari detection\n// http://stackoverflow.com/questions/7944460/detect-safari-browser\nUtils.isSafari = function () {\n return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n};\n\n// Basic IE11 or Edge detection\nUtils.isMicrosoft = function () {\n return /(Trident\\/7.0|Edge[ /](\\d+[.\\d]+))/i.test(navigator.userAgent);\n};\n\nUtils._requests = {}; // XHR requests on current thread\nUtils._proxy_requests = {}; // XHR requests proxied to main thread\n\n// `request_key` is a user-provided key that can be later used to cancel the request\nUtils.io = function (url, timeout = 60000, responseType = 'text', method = 'GET', headers = {}, request_key = null, proxy = false) {\n if (Thread.is_worker && Utils.isMicrosoft()) {\n // Some versions of IE11 and Edge will hang web workers when performing XHR requests\n // These requests can be proxied through the main thread\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9545866/\n log('debug', 'Proxying request for URL to worker', url);\n\n if (request_key) {\n Utils._proxy_requests[request_key] = true; // mark as proxied\n }\n return WorkerBroker.postMessage('Utils.io', url, timeout, responseType, method, headers, request_key, true);\n }\n else {\n var request = new XMLHttpRequest();\n var promise = new Promise((resolve, reject) => {\n request.open(method, url, true);\n request.timeout = timeout;\n request.responseType = responseType;\n\n // Attach optional request headers\n if (headers && typeof headers === 'object') {\n for (let key in headers) {\n request.setRequestHeader(key, headers[key]);\n }\n }\n\n request.onload = () => {\n if (request.status === 200) {\n if (['text', 'json'].indexOf(request.responseType) > -1) {\n resolve({ body: request.responseText, status: request.status });\n }\n else {\n resolve({ body: request.response, status: request.status });\n }\n }\n else if (request.status === 204) { // No Content\n resolve({ body: null, status: request.status });\n }\n else {\n reject(Error('Request error with a status of ' + request.statusText));\n }\n };\n request.onerror = (evt) => {\n reject(Error('There was a network error' + evt.toString()));\n };\n request.ontimeout = (evt) => {\n reject(Error('timeout '+ evt.toString()));\n };\n request.send();\n });\n\n promise = promise.then(response => {\n if (request_key) {\n delete Utils._requests[request_key];\n }\n\n if (proxy) {\n return WorkerBroker.withTransferables(response);\n }\n return response;\n });\n\n if (request_key) {\n Utils._requests[request_key] = request;\n }\n\n return promise;\n }\n};\n\n// Çancel a pending network request by user-provided request key\nUtils.cancelRequest = function (key) {\n // Check for a request that was proxied to the main thread\n if (Thread.is_worker && Utils._proxy_requests[key]) {\n return WorkerBroker.postMessage('Utils.cancelRequest', key); // forward to main thread\n }\n\n let req = Utils._requests[key];\n if (req) {\n log('trace', `Cancelling network request key '${key}'`);\n Utils._requests[key].abort();\n delete Utils._requests[key];\n }\n else {\n log('trace', `Could not find network request key '${key}'`);\n }\n};\n\n// Stringify an object into JSON, but convert functions to strings\nUtils.serializeWithFunctions = function (obj) {\n if (typeof obj === 'function') {\n return obj.toString();\n }\n\n let serialized = JSON.stringify(obj, function(k, v) {\n // Convert functions to strings\n if (typeof v === 'function') {\n return v.toString();\n }\n return v;\n });\n\n return serialized;\n};\n\n// Default to allowing high pixel density\n// Returns true if display density changed\nUtils.use_high_density_display = true;\nUtils.updateDevicePixelRatio = function () {\n let prev = Utils.device_pixel_ratio;\n Utils.device_pixel_ratio = (Utils.use_high_density_display && window.devicePixelRatio) || 1;\n return Utils.device_pixel_ratio !== prev;\n};\n\nif (Thread.is_main) {\n Utils.updateDevicePixelRatio();\n}\n\n// Used for differentiating between power-of-2 and non-power-of-2 textures\n// Via: http://stackoverflow.com/questions/19722247/webgl-wait-for-texture-to-load\nUtils.isPowerOf2 = function(value) {\n return (value & (value - 1)) === 0;\n};\n\n// Interpolate 'x' along a series of control points\n// 'points' is an array of control points in the form [x, y]\n//\n// Example:\n// Control points:\n// [0, 5]: when x=0, y=5\n// [4, 10]: when x=4, y=10\n//\n// Utils.interpolate(2, [[0, 5], [4, 10]]);\n// -> computes x=2, halfway between x=0 and x=4: (10 - 5) / 2 +5\n// -> returns 7.5\n//\n// TODO: add other interpolation methods besides linear\n//\nUtils.interpolate = function(x, points, transform) {\n // If this doesn't resemble a list of control points, just return the original value\n if (!Array.isArray(points) || !Array.isArray(points[0])) {\n return points;\n }\n else if (points.length < 1) {\n return points;\n }\n\n var x1, x2, d, y, y1, y2;\n\n // Min bounds\n if (x <= points[0][0]) {\n y = points[0][1];\n if (typeof transform === 'function') {\n y = transform(y);\n }\n }\n // Max bounds\n else if (x >= points[points.length-1][0]) {\n y = points[points.length-1][1];\n if (typeof transform === 'function') {\n y = transform(y);\n }\n }\n // Find which control points x is between\n else {\n for (var i=0; i < points.length - 1; i++) {\n if (x >= points[i][0] && x < points[i+1][0]) {\n // Linear interpolation\n x1 = points[i][0];\n x2 = points[i+1][0];\n\n // Multiple values\n if (Array.isArray(points[i][1])) {\n y = [];\n for (var c=0; c < points[i][1].length; c++) {\n if (typeof transform === 'function') {\n y1 = transform(points[i][1][c]);\n y2 = transform(points[i+1][1][c]);\n d = y2 - y1;\n y[c] = d * (x - x1) / (x2 - x1) + y1;\n }\n else {\n d = points[i+1][1][c] - points[i][1][c];\n y[c] = d * (x - x1) / (x2 - x1) + points[i][1][c];\n }\n }\n }\n // Single value\n else {\n if (typeof transform === 'function') {\n y1 = transform(points[i][1]);\n y2 = transform(points[i+1][1]);\n d = y2 - y1;\n y = d * (x - x1) / (x2 - x1) + y1;\n }\n else {\n d = points[i+1][1] - points[i][1];\n y = d * (x - x1) / (x2 - x1) + points[i][1];\n }\n }\n break;\n }\n }\n }\n return y;\n};\n\nUtils.toCSSColor = function (color) {\n if (color[3] === 1) { // full opacity\n return `rgb(${color.slice(0, 3).map(c => Math.round(c * 255)).join(', ')})`;\n }\n // RGB is between [0, 255] opacity is between [0, 1]\n return `rgba(${color.map((c, i) => (i < 3 && Math.round(c * 255)) || c).join(', ')})`;\n};\n","let debugSettings;\n\nexport default debugSettings = {\n // draws a blue rectangle border around the collision box of a label\n draw_label_collision_boxes: false,\n\n // draws a green rectangle border within the texture box of a label\n draw_label_texture_boxes: false,\n\n // suppreses fade-in of labels\n suppress_label_fade_in: false,\n\n // suppress animaton of label snap to pixel grid\n suppress_label_snap_animation: false,\n\n // show hidden labels for debugging\n show_hidden_labels: false,\n\n // collect feature/geometry stats on styling layers\n layer_stats: false\n};\n\nexport function mergeDebugSettings (settings) {\n Object.assign(debugSettings, settings);\n}\n","// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = require('./_is-object');\nvar anObject = require('./_an-object');\nvar check = function (O, proto) {\n anObject(O);\n if (!isObject(proto) && proto !== null) throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n function (test, buggy, set) {\n try {\n set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch (e) { buggy = true; }\n return function setPrototypeOf(O, proto) {\n check(O, proto);\n if (buggy) O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n","var isObject = require('./_is-object');\nvar setPrototypeOf = require('./_set-proto').set;\nmodule.exports = function (that, target, C) {\n var S = target.constructor;\n var P;\n if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {\n setPrototypeOf(that, P);\n } return that;\n};\n","var global = require('./_global');\nvar inheritIfRequired = require('./_inherit-if-required');\nvar dP = require('./_object-dp').f;\nvar gOPN = require('./_object-gopn').f;\nvar isRegExp = require('./_is-regexp');\nvar $flags = require('./_flags');\nvar $RegExp = global.RegExp;\nvar Base = $RegExp;\nvar proto = $RegExp.prototype;\nvar re1 = /a/g;\nvar re2 = /a/g;\n// \"new\" creates a new object, old webkit buggy here\nvar CORRECT_NEW = new $RegExp(re1) !== re1;\n\nif (require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function () {\n re2[require('./_wks')('match')] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';\n}))) {\n $RegExp = function RegExp(p, f) {\n var tiRE = this instanceof $RegExp;\n var piRE = isRegExp(p);\n var fiU = f === undefined;\n return !tiRE && piRE && p.constructor === $RegExp && fiU ? p\n : inheritIfRequired(CORRECT_NEW\n ? new Base(piRE && !fiU ? p.source : p, f)\n : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)\n , tiRE ? this : proto, $RegExp);\n };\n var proxy = function (key) {\n key in $RegExp || dP($RegExp, key, {\n configurable: true,\n get: function () { return Base[key]; },\n set: function (it) { Base[key] = it; }\n });\n };\n for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]);\n proto.constructor = $RegExp;\n $RegExp.prototype = proto;\n require('./_redefine')(global, 'RegExp', $RegExp);\n}\n\nrequire('./_set-species')('RegExp');\n","// 7.2.9 SameValue(x, y)\nmodule.exports = Object.is || function is(x, y) {\n // eslint-disable-next-line no-self-compare\n return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;\n};\n","'use strict';\n\nvar anObject = require('./_an-object');\nvar sameValue = require('./_same-value');\nvar regExpExec = require('./_regexp-exec-abstract');\n\n// @@search logic\nrequire('./_fix-re-wks')('search', 1, function (defined, SEARCH, $search, maybeCallNative) {\n return [\n // `String.prototype.search` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.search\n function search(regexp) {\n var O = defined(this);\n var fn = regexp == undefined ? undefined : regexp[SEARCH];\n return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));\n },\n // `RegExp.prototype[@@search]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search\n function (regexp) {\n var res = maybeCallNative($search, regexp, this);\n if (res.done) return res.value;\n var rx = anObject(regexp);\n var S = String(this);\n var previousLastIndex = rx.lastIndex;\n if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;\n var result = regExpExec(rx, S);\n if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;\n return result === null ? -1 : result.index;\n }\n ];\n});\n","import log from './log';\n\n// Adds a base origin to relative URLs\nexport function addBaseURL (url, base) {\n if (!url || !isRelativeURL(url)) {\n return url;\n }\n\n var relative_path = (url[0] !== '/');\n var base_info;\n if (base) {\n base_info = document.createElement('a'); // use a temporary element to parse URL\n base_info.href = base;\n }\n else {\n base_info = window.location;\n }\n\n if (relative_path) {\n let path = pathForURL(base_info.href);\n url = path + url;\n }\n else {\n let origin = base_info.origin;\n if (!origin) {\n origin = base_info.protocol + '//' + base_info.host; // IE11 doesn't have origin property\n }\n url = origin + url;\n }\n\n return url;\n}\n\nexport function pathForURL (url) {\n if (typeof url === 'string' && url.search(/^(data|blob):/) === -1) {\n let qs = url.indexOf('?');\n if (qs > -1) {\n url = url.substr(0, qs);\n }\n\n let hash = url.indexOf('#');\n if (hash > -1) {\n url = url.substr(0, hash);\n }\n\n return url.substr(0, url.lastIndexOf('/') + 1) || '';\n }\n return '';\n}\n\nexport function extensionForURL (url) {\n url = url.split('/').pop();\n let last_dot = url.lastIndexOf('.');\n if (last_dot > -1) {\n return url.substring(last_dot + 1);\n }\n}\n\nexport function isLocalURL (url) {\n if (typeof url !== 'string') {\n return;\n }\n return (url.search(/^(data|blob):/) > -1);\n}\n\nexport function isRelativeURL (url) {\n if (typeof url !== 'string') {\n return;\n }\n return !(url.search(/^(http|https|data|blob):/) > -1 || url.substr(0, 2) === '//');\n}\n\n// Resolves './' and '../' components from relative path, to get a \"flattened\" path\nexport function flattenRelativeURL (url) {\n let dirs = (url || '').split('/');\n for (let d = 1; d < dirs.length; d++) {\n if (dirs[d] === '.') {\n dirs.splice(d, 1);\n d--;\n }\n else if (dirs[d] === '..') {\n d = d + 0;\n dirs.splice(d-1, 2);\n d--;\n }\n }\n return dirs.join('/');\n}\n\n// Add a set of query string params to a URL\n// params: hash of key/value pairs of query string parameters\n// returns array of: [modified URL, array of duplicate param name and values]\nexport function addParamsToURL (url, params) {\n if (!params || Object.keys(params).length === 0) {\n return [url, []];\n }\n\n var qs_index = url.indexOf('?');\n var hash_index = url.indexOf('#');\n\n // Save and trim hash\n var hash = '';\n if (hash_index > -1) {\n hash = url.slice(hash_index);\n url = url.slice(0, hash_index);\n }\n\n // Start query string\n if (qs_index === -1) {\n qs_index = url.length;\n url += '?';\n }\n qs_index++; // advanced past '?'\n\n // Build query string params\n var url_params = '';\n var dupes = [];\n for (var p in params) {\n if (getURLParameter(p, url) !== '') {\n dupes.push([p, params[p]]);\n continue;\n }\n url_params += `${p}=${params[p]}&`;\n }\n\n // Insert new query string params and restore hash\n url = url.slice(0, qs_index) + url_params + url.slice(qs_index) + hash;\n\n return [url, dupes];\n}\n\n// Polyfill (for Safari compatibility)\nlet _createObjectURL;\nexport function createObjectURL (url) {\n if (_createObjectURL === undefined) {\n _createObjectURL = (window.URL && window.URL.createObjectURL) || (window.webkitURL && window.webkitURL.createObjectURL);\n\n if (typeof _createObjectURL !== 'function') {\n _createObjectURL = null;\n log('warn', 'window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs');\n }\n }\n\n if (_createObjectURL) {\n return _createObjectURL(url);\n }\n else {\n return url;\n }\n}\n\nlet _revokeObjectURL;\nexport function revokeObjectURL (url) {\n if (_revokeObjectURL === undefined) {\n _revokeObjectURL = (window.URL && window.URL.revokeObjectURL) || (window.webkitURL && window.webkitURL.revokeObjectURL);\n\n if (typeof _revokeObjectURL !== 'function') {\n _revokeObjectURL = null;\n log('warn', 'window.URL.revokeObjectURL (or vendor prefix) not found, unable to create local blob URLs');\n }\n }\n\n if (_revokeObjectURL) {\n return _revokeObjectURL(url);\n }\n else {\n return url;\n }\n}\n\n// Get URL that the current script was loaded from\n// If currentScript is not available, loops through