From eae8886b95ecc5178dfc41a2d228f6e5a5828d0d Mon Sep 17 00:00:00 2001 From: Francisco Dans Date: Mon, 12 Jan 2015 18:35:15 +0100 Subject: [PATCH] new dist --- dist/carto.js | 5255 +------------------------------------------------ 1 file changed, 4 insertions(+), 5251 deletions(-) diff --git a/dist/carto.js b/dist/carto.js index 7dffd0d..d35fc84 100644 --- a/dist/carto.js +++ b/dist/carto.js @@ -1,5251 +1,4 @@ - -var assert = { - ok: function(value, message) { - message = message || ''; - if(!value) throw new Error("assertion failed", message); - } -}; - -if (navigator.userAgent.indexOf('MSIE 8.0') !== -1 || navigator.userAgent.indexOf('MSIE 7.0') !== -1) { - Object.defineProperty = function(o, p, fn) { o[p] = fn.value; }; -} - - - -var carto_initialize = function(carto, uri, callback) { - callback(); -}; -window.carto = window.carto || {}; - -var _mapnik_reference_latest = { - "version": "2.1.1", - "style": { - "filter-mode": { - "type": [ - "all", - "first" - ], - "doc": "Control the processing behavior of Rule filters within a Style. If 'all' is used then all Rules are processed sequentially independent of whether any previous filters matched. If 'first' is used then it means processing ends after the first match (a positive filter evaluation) and no further Rules in the Style are processed ('first' is usually the default for CSS implementations on top of Mapnik to simplify translation from CSS to Mapnik XML)", - "default-value": "all", - "default-meaning": "All Rules in a Style are processed whether they have filters or not and whether or not the filter conditions evaluate to true." - }, - "image-filters": { - "css": "image-filters", - "default-value": "none", - "default-meaning": "no filters", - "type": "functions", - "functions": [ - ["agg-stack-blur", 2], - ["emboss", 0], - ["blur", 0], - ["gray", 0], - ["sobel", 0], - ["edge-detect", 0], - ["x-gradient", 0], - ["y-gradient", 0], - ["invert", 0], - ["sharpen", 0] - ], - "doc": "A list of image filters." - }, - "comp-op": { - "css": "comp-op", - "default-value": "src-over", - "default-meaning": "add the current layer on top of other layers", - "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "source-over", // added for torque - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "lighter", // added for torque - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - }, - "opacity": { - "css": "opacity", - "type": "float", - "doc": "An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)", - "default-value": 1, - "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering" - } - }, - "layer" : { - "name": { - "default-value": "", - "type":"string", - "required" : true, - "default-meaning": "No layer name has been provided", - "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map" - }, - "srs": { - "default-value": "", - "type":"string", - "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs", - "doc": "The spatial reference system definition for the layer, aka the projection. Can either be a proj4 literal string like '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' or, if the proper proj4 epsg/nad/etc identifier files are installed, a string that uses an id like: '+init=epsg:4326'" - }, - "status": { - "default-value": true, - "type":"boolean", - "default-meaning": "This layer will be marked as active and available for processing", - "doc": "A property that can be set to false to disable this layer from being processed" - }, - "minzoom": { - "default-value": "0", - "type":"float", - "default-meaning": "The layer will be visible at the minimum possible scale", - "doc": "The minimum scale denominator that this layer will be visible at. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6" - }, - "maxzoom": { - "default-value": "1.79769e+308", - "type":"float", - "default-meaning": "The layer will be visible at the maximum possible scale", - "doc": "The maximum scale denominator that this layer will be visible at. The default is the numeric limit of the C++ double type, which may vary slightly by system, but is likely a massive number like 1.79769e+308 and ensures that this layer will always be visible unless the value is reduced. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6" - }, - "queryable": { - "default-value": false, - "type":"boolean", - "default-meaning": "The layer will not be available for the direct querying of data values", - "doc": "This property was added for GetFeatureInfo/WMS compatibility and is rarely used. It is off by default meaning that in a WMS context the layer will not be able to be queried unless the property is explicitly set to true" - }, - "clear-label-cache": { - "default-value": false, - "type":"boolean", - "default-meaning": "The renderer's collision detector cache (used for avoiding duplicate labels and overlapping markers) will not be cleared immediately before processing this layer", - "doc": "This property, by default off, can be enabled to allow a user to clear the collision detector cache before a given layer is processed. This may be desirable to ensure that a given layers data shows up on the map even if it normally would not because of collisions with previously rendered labels or markers" - }, - "group-by": { - "default-value": "", - "type":"string", - "default-meaning": "No special layer grouping will be used during rendering", - "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering" - }, - "buffer-size": { - "default-value": "0", - "type":"float", - "default-meaning": "No buffer will be used", - "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering" - }, - "maximum-extent": { - "default-value": "none", - "type":"bbox", - "default-meaning": "No clipping extent will be used", - "doc": "An extent to be used to limit the bounds used to query this specific layer data during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Layer." - } - }, - "symbolizers" : { - "*": { - "image-filters": { - "css": "image-filters", - "default-value": "none", - "default-meaning": "no filters", - "type": "functions", - "functions": [ - ["agg-stack-blur", 2], - ["emboss", 0], - ["blur", 0], - ["gray", 0], - ["sobel", 0], - ["edge-detect", 0], - ["x-gradient", 0], - ["y-gradient", 0], - ["invert", 0], - ["sharpen", 0] - ], - "doc": "A list of image filters." - }, - "comp-op": { - "css": "comp-op", - "default-value": "src-over", - "default-meaning": "add the current layer on top of other layers", - "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "source-over", // added for torque - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "lighter", // added for torque - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - }, - "opacity": { - "css": "opacity", - "type": "float", - "doc": "An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)", - "default-value": 1, - "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering" - } - }, - "map": { - "background-color": { - "css": "background-color", - "default-value": "none", - "default-meaning": "transparent", - "type": "color", - "doc": "Map Background color" - }, - "background-image": { - "css": "background-image", - "type": "uri", - "default-value": "", - "default-meaning": "transparent", - "doc": "An image that is repeated below all features on a map as a background.", - "description": "Map Background image" - }, - "srs": { - "css": "srs", - "type": "string", - "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", - "default-meaning": "The proj4 literal of EPSG:4326 is assumed to be the Map's spatial reference and all data from layers within this map will be plotted using this coordinate system. If any layers do not declare an srs value then they will be assumed to be in the same srs as the Map and not transformations will be needed to plot them in the Map's coordinate space", - "doc": "Map spatial reference (proj4 string)" - }, - "buffer-size": { - "css": "buffer-size", - "default-value": "0", - "type":"float", - "default-meaning": "No buffer will be used", - "doc": "Extra tolerance around the map (in pixels) used to ensure labels crossing tile boundaries are equally rendered in each tile (e.g. cut in each tile). Not intended to be used in combination with \"avoid-edges\"." - }, - "maximum-extent": { - "css": "", - "default-value": "none", - "type":"bbox", - "default-meaning": "No clipping extent will be used", - "doc": "An extent to be used to limit the bounds used to query all layers during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Map." - }, - "base": { - "css": "base", - "default-value": "", - "default-meaning": "This base path defaults to an empty string meaning that any relative paths to files referenced in styles or layers will be interpreted relative to the application process.", - "type": "string", - "doc": "Any relative paths used to reference files will be understood as relative to this directory path if the map is loaded from an in memory object rather than from the filesystem. If the map is loaded from the filesystem and this option is not provided it will be set to the directory of the stylesheet." - }, - "paths-from-xml": { - "css": "", - "default-value": true, - "default-meaning": "Paths read from XML will be interpreted from the location of the XML", - "type": "boolean", - "doc": "value to control whether paths in the XML will be interpreted from the location of the XML or from the working directory of the program that calls load_map()" - }, - "minimum-version": { - "css": "", - "default-value": "none", - "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility", - "type": "string", - "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet" - }, - "font-directory": { - "css": "font-directory", - "type": "uri", - "default-value": "none", - "default-meaning": "No map-specific fonts will be registered", - "doc": "Path to a directory which holds fonts which should be registered when the Map is loaded (in addition to any fonts that may be automatically registered)." - } - }, - "polygon": { - "fill": { - "css": "polygon-fill", - "type": "color", - "default-value": "rgba(128,128,128,1)", - "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)", - "doc": "Fill color to assign to a polygon" - }, - "fill-opacity": { - "css": "polygon-opacity", - "type": "float", - "doc": "The opacity of the polygon", - "default-value": 1, - "default-meaning": "opaque" - }, - "gamma": { - "css": "polygon-gamma", - "type": "float", - "default-value": 1, - "default-meaning": "fully antialiased", - "range": "0-1", - "doc": "Level of antialiasing of polygon edges" - }, - "gamma-method": { - "css": "polygon-gamma-method", - "type": [ - "power", - "linear", - "none", - "threshold", - "multiply" - ], - "default-value": "power", - "default-meaning": "pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA", - "doc": "An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h" - }, - "clip": { - "css": "polygon-clip", - "type": "boolean", - "default-value": true, - "default-meaning": "geometry will be clipped to map bounds before rendering", - "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts." - }, - "smooth": { - "css": "polygon-smooth", - "type": "float", - "default-value": 0, - "default-meaning": "no smoothing", - "range": "0-1", - "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries." - }, - "geometry-transform": { - "css": "polygon-geometry-transform", - "type": "functions", - "default-value": "none", - "default-meaning": "geometry will not be transformed", - "doc": "Allows transformation functions to be applied to the geometry.", - "functions": [ - ["matrix", 6], - ["translate", 2], - ["scale", 2], - ["rotate", 3], - ["skewX", 1], - ["skewY", 1] - ] - }, - "comp-op": { - "css": "polygon-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "line": { - "stroke": { - "css": "line-color", - "default-value": "rgba(0,0,0,1)", - "type": "color", - "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)", - "doc": "The color of a drawn line" - }, - "stroke-width": { - "css": "line-width", - "default-value": 1, - "type": "float", - "doc": "The width of a line in pixels" - }, - "stroke-opacity": { - "css": "line-opacity", - "default-value": 1, - "type": "float", - "default-meaning": "opaque", - "doc": "The opacity of a line" - }, - "stroke-linejoin": { - "css": "line-join", - "default-value": "miter", - "type": [ - "miter", - "round", - "bevel" - ], - "doc": "The behavior of lines when joining" - }, - "stroke-linecap": { - "css": "line-cap", - "default-value": "butt", - "type": [ - "butt", - "round", - "square" - ], - "doc": "The display of line endings" - }, - "stroke-gamma": { - "css": "line-gamma", - "type": "float", - "default-value": 1, - "default-meaning": "fully antialiased", - "range": "0-1", - "doc": "Level of antialiasing of stroke line" - }, - "stroke-gamma-method": { - "css": "line-gamma-method", - "type": [ - "power", - "linear", - "none", - "threshold", - "multiply" - ], - "default-value": "power", - "default-meaning": "pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA", - "doc": "An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h" - }, - "stroke-dasharray": { - "css": "line-dasharray", - "type": "numbers", - "doc": "A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported for more complex patterns.", - "default-value": "none", - "default-meaning": "solid line" - }, - "stroke-dashoffset": { - "css": "line-dash-offset", - "type": "numbers", - "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)", - "default-value": "none", - "default-meaning": "solid line" - }, - "stroke-miterlimit": { - "css": "line-miterlimit", - "type": "float", - "doc": "The limit on the ratio of the miter length to the stroke-width. Used to automatically convert miter joins to bevel joins for sharp angles to avoid the miter extending beyond the thickness of the stroking path. Normally will not need to be set, but a larger value can sometimes help avoid jaggy artifacts.", - "default-value": 4.0, - "default-meaning": "Will auto-convert miters to bevel line joins when theta is less than 29 degrees as per the SVG spec: 'miterLength / stroke-width = 1 / sin ( theta / 2 )'" - }, - "clip": { - "css": "line-clip", - "type": "boolean", - "default-value": true, - "default-meaning": "geometry will be clipped to map bounds before rendering", - "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts." - }, - "smooth": { - "css": "line-smooth", - "type": "float", - "default-value": 0, - "default-meaning": "no smoothing", - "range": "0-1", - "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries." - }, - "offset": { - "css": "line-offset", - "type": "float", - "default-value": 0, - "default-meaning": "no offset", - "doc": "Offsets a line a number of pixels parallel to its actual path. Postive values move the line left, negative values move it right (relative to the directionality of the line)." - }, - "rasterizer": { - "css": "line-rasterizer", - "type": [ - "full", - "fast" - ], - "default-value": "full", - "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed." - }, - "geometry-transform": { - "css": "line-geometry-transform", - "type": "functions", - "default-value": "none", - "default-meaning": "geometry will not be transformed", - "doc": "Allows transformation functions to be applied to the geometry.", - "functions": [ - ["matrix", 6], - ["translate", 2], - ["scale", 2], - ["rotate", 3], - ["skewX", 1], - ["skewY", 1] - ] - }, - "comp-op": { - "css": "line-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "markers": { - "file": { - "css": "marker-file", - "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.", - "default-value": "", - "default-meaning": "An ellipse or circle, if width equals height", - "type": "uri" - }, - "opacity": { - "css": "marker-opacity", - "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke", - "default-value": 1, - "default-meaning": "The stroke-opacity and fill-opacity will be used", - "type": "float" - }, - "fill-opacity": { - "css": "marker-fill-opacity", - "doc": "The fill opacity of the marker", - "default-value": 1, - "default-meaning": "opaque", - "type": "float" - }, - "stroke": { - "css": "marker-line-color", - "doc": "The color of the stroke around a marker shape.", - "default-value": "black", - "type": "color" - }, - "stroke-width": { - "css": "marker-line-width", - "doc": "The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.", - "type": "float" - }, - "stroke-opacity": { - "css": "marker-line-opacity", - "default-value": 1, - "default-meaning": "opaque", - "doc": "The opacity of a line", - "type": "float" - }, - "placement": { - "css": "marker-placement", - "type": [ - "point", - "line", - "interior" - ], - "default-value": "point", - "default-meaning": "Place markers at the center point (centroid) of the geometry", - "doc": "Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior" - }, - "multi-policy": { - "css": "marker-multi-policy", - "type": [ - "each", - "whole", - "largest" - ], - "default-value": "each", - "default-meaning": "If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each", - "doc": "A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)." - }, - "marker-type": { - "css": "marker-type", - "type": [ - "arrow", - "ellipse" - ], - "default-value": "ellipse", - "doc": "The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)" - }, - "width": { - "css": "marker-width", - "default-value": 10, - "doc": "The width of the marker, if using one of the default types.", - "type": "expression" - }, - "height": { - "css": "marker-height", - "default-value": 10, - "doc": "The height of the marker, if using one of the default types.", - "type": "expression" - }, - "fill": { - "css": "marker-fill", - "default-value": "blue", - "doc": "The color of the area of the marker.", - "type": "color" - }, - "allow-overlap": { - "css": "marker-allow-overlap", - "type": "boolean", - "default-value": false, - "doc": "Control whether overlapping markers are shown or hidden.", - "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown." - }, - "ignore-placement": { - "css": "marker-ignore-placement", - "type": "boolean", - "default-value": false, - "default-meaning": "do not store the bbox of this geometry in the collision detector cache", - "doc": "value to control whether the placement of the feature will prevent the placement of other features" - }, - "spacing": { - "css": "marker-spacing", - "doc": "Space between repeated labels", - "default-value": 100, - "type": "float" - }, - "max-error": { - "css": "marker-max-error", - "type": "float", - "default-value": 0.2, - "doc": "The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers." - }, - "transform": { - "css": "marker-transform", - "type": "functions", - "functions": [ - ["matrix", 6], - ["translate", 2], - ["scale", 2], - ["rotate", 3], - ["skewX", 1], - ["skewY", 1] - ], - "default-value": "", - "default-meaning": "No transformation", - "doc": "SVG transformation definition" - }, - "clip": { - "css": "marker-clip", - "type": "boolean", - "default-value": true, - "default-meaning": "geometry will be clipped to map bounds before rendering", - "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts." - }, - "smooth": { - "css": "marker-smooth", - "type": "float", - "default-value": 0, - "default-meaning": "no smoothing", - "range": "0-1", - "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries." - }, - "geometry-transform": { - "css": "marker-geometry-transform", - "type": "functions", - "default-value": "none", - "default-meaning": "geometry will not be transformed", - "doc": "Allows transformation functions to be applied to the geometry.", - "functions": [ - ["matrix", 6], - ["translate", 2], - ["scale", 2], - ["rotate", 3], - ["skewX", 1], - ["skewY", 1] - ] - }, - "comp-op": { - "css": "marker-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "shield": { - "name": { - "css": "shield-name", - "type": "expression", - "serialization": "content", - "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]" - }, - "file": { - "css": "shield-file", - "required": true, - "type": "uri", - "default-value": "none", - "doc": "Image file to render behind the shield text" - }, - "face-name": { - "css": "shield-face-name", - "type": "string", - "validate": "font", - "doc": "Font name and style to use for the shield text", - "default-value": "", - "required": true - }, - "unlock-image": { - "css": "shield-unlock-image", - "type": "boolean", - "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image", - "default-value": false, - "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning." - }, - "size": { - "css": "shield-size", - "type": "float", - "doc": "The size of the shield text in pixels" - }, - "fill": { - "css": "shield-fill", - "type": "color", - "doc": "The color of the shield text" - }, - "placement": { - "css": "shield-placement", - "type": [ - "point", - "line", - "vertex", - "interior" - ], - "default-value": "point", - "doc": "How this shield should be placed. Point placement attempts to place it on top of points, line places along lines multiple times per feature, vertex places on the vertexes of polygons, and interior attempts to place inside of polygons." - }, - "avoid-edges": { - "css": "shield-avoid-edges", - "doc": "Tell positioning algorithm to avoid labeling near intersection edges.", - "type": "boolean", - "default-value": false - }, - "allow-overlap": { - "css": "shield-allow-overlap", - "type": "boolean", - "default-value": false, - "doc": "Control whether overlapping shields are shown or hidden.", - "default-meaning": "Do not allow shields to overlap with other map elements already placed." - }, - "minimum-distance": { - "css": "shield-min-distance", - "type": "float", - "default-value": 0, - "doc": "Minimum distance to the next shield symbol, not necessarily the same shield." - }, - "spacing": { - "css": "shield-spacing", - "type": "float", - "default-value": 0, - "doc": "The spacing between repeated occurrences of the same shield on a line" - }, - "minimum-padding": { - "css": "shield-min-padding", - "default-value": 0, - "doc": "Determines the minimum amount of padding that a shield gets relative to other shields", - "type": "float" - }, - "wrap-width": { - "css": "shield-wrap-width", - "type": "unsigned", - "default-value": 0, - "doc": "Length of a chunk of text in characters before wrapping text" - }, - "wrap-before": { - "css": "shield-wrap-before", - "type": "boolean", - "default-value": false, - "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width." - }, - "wrap-character": { - "css": "shield-wrap-character", - "type": "string", - "default-value": " ", - "doc": "Use this character instead of a space to wrap long names." - }, - "halo-fill": { - "css": "shield-halo-fill", - "type": "color", - "default-value": "#FFFFFF", - "default-meaning": "white", - "doc": "Specifies the color of the halo around the text." - }, - "halo-radius": { - "css": "shield-halo-radius", - "doc": "Specify the radius of the halo in pixels", - "default-value": 0, - "default-meaning": "no halo", - "type": "float" - }, - "character-spacing": { - "css": "shield-character-spacing", - "type": "unsigned", - "default-value": 0, - "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement." - }, - "line-spacing": { - "css": "shield-line-spacing", - "doc": "Vertical spacing between lines of multiline labels (in pixels)", - "type": "unsigned" - }, - "dx": { - "css": "shield-text-dx", - "type": "float", - "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right", - "default-value": 0 - }, - "dy": { - "css": "shield-text-dy", - "type": "float", - "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down", - "default-value": 0 - }, - "shield-dx": { - "css": "shield-dx", - "type": "float", - "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right", - "default-value": 0 - }, - "shield-dy": { - "css": "shield-dy", - "type": "float", - "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down", - "default-value": 0 - }, - "opacity": { - "css": "shield-opacity", - "type": "float", - "doc": "(Default 1.0) - opacity of the image used for the shield", - "default-value": 1 - }, - "text-opacity": { - "css": "shield-text-opacity", - "type": "float", - "doc": "(Default 1.0) - opacity of the text placed on top of the shield", - "default-value": 1 - }, - "horizontal-alignment": { - "css": "shield-horizontal-alignment", - "type": [ - "left", - "middle", - "right", - "auto" - ], - "doc": "The shield's horizontal alignment from its centerpoint", - "default-value": "auto" - }, - "vertical-alignment": { - "css": "shield-vertical-alignment", - "type": [ - "top", - "middle", - "bottom", - "auto" - ], - "doc": "The shield's vertical alignment from its centerpoint", - "default-value": "middle" - }, - "text-transform": { - "css": "shield-text-transform", - "type": [ - "none", - "uppercase", - "lowercase", - "capitalize" - ], - "doc": "Transform the case of the characters", - "default-value": "none" - }, - "justify-alignment": { - "css": "shield-justify-alignment", - "type": [ - "left", - "center", - "right", - "auto" - ], - "doc": "Define how text in a shield's label is justified", - "default-value": "auto" - }, - "clip": { - "css": "shield-clip", - "type": "boolean", - "default-value": true, - "default-meaning": "geometry will be clipped to map bounds before rendering", - "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts." - }, - "comp-op": { - "css": "shield-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "line-pattern": { - "file": { - "css": "line-pattern-file", - "type": "uri", - "default-value": "none", - "required": true, - "doc": "An image file to be repeated and warped along a line" - }, - "clip": { - "css": "line-pattern-clip", - "type": "boolean", - "default-value": true, - "default-meaning": "geometry will be clipped to map bounds before rendering", - "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts." - }, - "smooth": { - "css": "line-pattern-smooth", - "type": "float", - "default-value": 0, - "default-meaning": "no smoothing", - "range": "0-1", - "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries." - }, - "geometry-transform": { - "css": "line-pattern-geometry-transform", - "type": "functions", - "default-value": "none", - "default-meaning": "geometry will not be transformed", - "doc": "Allows transformation functions to be applied to the geometry.", - "functions": [ - ["matrix", 6], - ["translate", 2], - ["scale", 2], - ["rotate", 3], - ["skewX", 1], - ["skewY", 1] - ] - }, - "comp-op": { - "css": "line-pattern-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "polygon-pattern": { - "file": { - "css": "polygon-pattern-file", - "type": "uri", - "default-value": "none", - "required": true, - "doc": "Image to use as a repeated pattern fill within a polygon" - }, - "alignment": { - "css": "polygon-pattern-alignment", - "type": [ - "local", - "global" - ], - "default-value": "local", - "doc": "Specify whether to align pattern fills to the layer or to the map." - }, - "gamma": { - "css": "polygon-pattern-gamma", - "type": "float", - "default-value": 1, - "default-meaning": "fully antialiased", - "range": "0-1", - "doc": "Level of antialiasing of polygon pattern edges" - }, - "opacity": { - "css": "polygon-pattern-opacity", - "type": "float", - "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern", - "default-value": 1, - "default-meaning": "The image is rendered without modifications" - }, - "clip": { - "css": "polygon-pattern-clip", - "type": "boolean", - "default-value": true, - "default-meaning": "geometry will be clipped to map bounds before rendering", - "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts." - }, - "smooth": { - "css": "polygon-pattern-smooth", - "type": "float", - "default-value": 0, - "default-meaning": "no smoothing", - "range": "0-1", - "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries." - }, - "geometry-transform": { - "css": "polygon-pattern-geometry-transform", - "type": "functions", - "default-value": "none", - "default-meaning": "geometry will not be transformed", - "doc": "Allows transformation functions to be applied to the geometry.", - "functions": [ - ["matrix", 6], - ["translate", 2], - ["scale", 2], - ["rotate", 3], - ["skewX", 1], - ["skewY", 1] - ] - }, - "comp-op": { - "css": "polygon-pattern-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "raster": { - "opacity": { - "css": "raster-opacity", - "default-value": 1, - "default-meaning": "opaque", - "type": "float", - "doc": "The opacity of the raster symbolizer on top of other symbolizers." - }, - "filter-factor": { - "css": "raster-filter-factor", - "default-value": -1, - "default-meaning": "Allow the datasource to choose appropriate downscaling.", - "type": "float", - "doc": "This is used by the Raster or Gdal datasources to pre-downscale images using overviews. Higher numbers can sometimes cause much better scaled image output, at the cost of speed." - }, - "scaling": { - "css": "raster-scaling", - "type": [ - "near", - "fast", - "bilinear", - "bilinear8", - "bicubic", - "spline16", - "spline36", - "hanning", - "hamming", - "hermite", - "kaiser", - "quadric", - "catrom", - "gaussian", - "bessel", - "mitchell", - "sinc", - "lanczos", - "blackman" - ], - "default-value": "near", - "doc": "The scaling algorithm used to making different resolution versions of this raster layer. Bilinear is a good compromise between speed and accuracy, while lanczos gives the highest quality." - }, - "mesh-size": { - "css": "raster-mesh-size", - "default-value": 16, - "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image", - "type": "unsigned", - "doc": "A reduced resolution mesh is used for raster reprojection, and the total image size is divided by the mesh-size to determine the quality of that mesh. Values for mesh-size larger than the default will result in faster reprojection but might lead to distortion." - }, - "comp-op": { - "css": "raster-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "point": { - "file": { - "css": "point-file", - "type": "uri", - "required": false, - "default-value": "none", - "doc": "Image file to represent a point" - }, - "allow-overlap": { - "css": "point-allow-overlap", - "type": "boolean", - "default-value": false, - "doc": "Control whether overlapping points are shown or hidden.", - "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown." - }, - "ignore-placement": { - "css": "point-ignore-placement", - "type": "boolean", - "default-value": false, - "default-meaning": "do not store the bbox of this geometry in the collision detector cache", - "doc": "value to control whether the placement of the feature will prevent the placement of other features" - }, - "opacity": { - "css": "point-opacity", - "type": "float", - "default-value": 1.0, - "default-meaning": "Fully opaque", - "doc": "A value from 0 to 1 to control the opacity of the point" - }, - "placement": { - "css": "point-placement", - "type": [ - "centroid", - "interior" - ], - "doc": "How this point should be placed. Centroid calculates the geometric center of a polygon, which can be outside of it, while interior always places inside of a polygon.", - "default-value": "centroid" - }, - "transform": { - "css": "point-transform", - "type": "functions", - "functions": [ - ["matrix", 6], - ["translate", 2], - ["scale", 2], - ["rotate", 3], - ["skewX", 1], - ["skewY", 1] - ], - "default-value": "", - "default-meaning": "No transformation", - "doc": "SVG transformation definition" - }, - "comp-op": { - "css": "point-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "text": { - "name": { - "css": "text-name", - "type": "expression", - "required": true, - "default-value": "", - "serialization": "content", - "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]" - }, - "face-name": { - "css": "text-face-name", - "type": "string", - "validate": "font", - "doc": "Font name and style to render a label in", - "required": true - }, - "size": { - "css": "text-size", - "type": "float", - "default-value": 10, - "doc": "Text size in pixels" - }, - "text-ratio": { - "css": "text-ratio", - "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs", - "default-value": 0, - "type": "unsigned" - }, - "wrap-width": { - "css": "text-wrap-width", - "doc": "Length of a chunk of text in characters before wrapping text", - "default-value": 0, - "type": "unsigned" - }, - "wrap-before": { - "css": "text-wrap-before", - "type": "boolean", - "default-value": false, - "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width." - }, - "wrap-character": { - "css": "text-wrap-character", - "type": "string", - "default-value": " ", - "doc": "Use this character instead of a space to wrap long text." - }, - "spacing": { - "css": "text-spacing", - "type": "unsigned", - "doc": "Distance between repeated text labels on a line (aka. label-spacing)" - }, - "character-spacing": { - "css": "text-character-spacing", - "type": "float", - "default-value": 0, - "doc": "Horizontal spacing adjustment between characters in pixels" - }, - "line-spacing": { - "css": "text-line-spacing", - "default-value": 0, - "type": "unsigned", - "doc": "Vertical spacing adjustment between lines in pixels" - }, - "label-position-tolerance": { - "css": "text-label-position-tolerance", - "default-value": 0, - "type": "unsigned", - "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)" - }, - "max-char-angle-delta": { - "css": "text-max-char-angle-delta", - "type": "float", - "default-value": "22.5", - "doc": "The maximum angle change, in degrees, allowed between adjacent characters in a label. This value internally is converted to radians to the default is 22.5*math.pi/180.0. The higher the value the fewer labels will be placed around around sharp corners." - }, - "fill": { - "css": "text-fill", - "doc": "Specifies the color for the text", - "default-value": "#000000", - "type": "color" - }, - "opacity": { - "css": "text-opacity", - "doc": "A number from 0 to 1 specifying the opacity for the text", - "default-value": 1.0, - "default-meaning": "Fully opaque", - "type": "float" - }, - "halo-fill": { - "css": "text-halo-fill", - "type": "color", - "default-value": "#FFFFFF", - "default-meaning": "white", - "doc": "Specifies the color of the halo around the text." - }, - "halo-radius": { - "css": "text-halo-radius", - "doc": "Specify the radius of the halo in pixels", - "default-value": 0, - "default-meaning": "no halo", - "type": "float" - }, - "dx": { - "css": "text-dx", - "type": "float", - "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right", - "default-value": 0 - }, - "dy": { - "css": "text-dy", - "type": "float", - "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down", - "default-value": 0 - }, - "vertical-alignment": { - "css": "text-vertical-alignment", - "type": [ - "top", - "middle", - "bottom", - "auto" - ], - "doc": "Position of label relative to point position.", - "default-value": "auto", - "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0." - }, - "avoid-edges": { - "css": "text-avoid-edges", - "doc": "Tell positioning algorithm to avoid labeling near intersection edges.", - "default-value": false, - "type": "boolean" - }, - "minimum-distance": { - "css": "text-min-distance", - "doc": "Minimum permitted distance to the next text symbolizer.", - "type": "float" - }, - "minimum-padding": { - "css": "text-min-padding", - "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text", - "type": "float" - }, - "minimum-path-length": { - "css": "text-min-path-length", - "type": "float", - "default-value": 0, - "default-meaning": "place labels on all paths", - "doc": "Place labels only on paths longer than this value." - }, - "allow-overlap": { - "css": "text-allow-overlap", - "type": "boolean", - "default-value": false, - "doc": "Control whether overlapping text is shown or hidden.", - "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown." - }, - "orientation": { - "css": "text-orientation", - "type": "expression", - "doc": "Rotate the text." - }, - "placement": { - "css": "text-placement", - "type": [ - "point", - "line", - "vertex", - "interior" - ], - "default-value": "point", - "doc": "Control the style of placement of a point versus the geometry it is attached to." - }, - "placement-type": { - "css": "text-placement-type", - "doc": "Re-position and/or re-size text to avoid overlaps. \"simple\" for basic algorithm (using text-placements string,) \"dummy\" to turn this feature off.", - "type": [ - "dummy", - "simple" - ], - "default-value": "dummy" - }, - "placements": { - "css": "text-placements", - "type": "string", - "default-value": "", - "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` " - }, - "text-transform": { - "css": "text-transform", - "type": [ - "none", - "uppercase", - "lowercase", - "capitalize" - ], - "doc": "Transform the case of the characters", - "default-value": "none" - }, - "horizontal-alignment": { - "css": "text-horizontal-alignment", - "type": [ - "left", - "middle", - "right", - "auto" - ], - "doc": "The text's horizontal alignment from its centerpoint", - "default-value": "auto" - }, - "justify-alignment": { - "css": "text-align", - "type": [ - "left", - "right", - "center", - "auto" - ], - "doc": "Define how text is justified", - "default-value": "auto", - "default-meaning": "Auto alignment means that text will be centered by default except when using the `placement-type` parameter - in that case either right or left justification will be used automatically depending on where the text could be fit given the `text-placements` directives" - }, - "clip": { - "css": "text-clip", - "type": "boolean", - "default-value": true, - "default-meaning": "geometry will be clipped to map bounds before rendering", - "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts." - }, - "comp-op": { - "css": "text-comp-op", - "default-value": "src-over", - "default-meaning": "add the current symbolizer on top of other symbolizer", - "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.", - "type": ["clear", - "src", - "dst", - "src-over", - "dst-over", - "src-in", - "dst-in", - "src-out", - "dst-out", - "src-atop", - "dst-atop", - "xor", - "plus", - "minus", - "multiply", - "screen", - "overlay", - "darken", - "lighten", - "color-dodge", - "color-burn", - "hard-light", - "soft-light", - "difference", - "exclusion", - "contrast", - "invert", - "invert-rgb", - "grain-merge", - "grain-extract", - "hue", - "saturation", - "color", - "value" - ] - } - }, - "building": { - "fill": { - "css": "building-fill", - "default-value": "#FFFFFF", - "doc": "The color of the buildings walls.", - "type": "color" - }, - "fill-opacity": { - "css": "building-fill-opacity", - "type": "float", - "doc": "The opacity of the building as a whole, including all walls.", - "default-value": 1 - }, - "height": { - "css": "building-height", - "doc": "The height of the building in pixels.", - "type": "expression", - "default-value": "0" - } - }, - "torque": { - "-torque-frame-count": { - "css": "-torque-frame-count", - "default-value": "128", - "type":"float", - "default-meaning": "the data is broken into 128 time frames", - "doc": "Number of animation steps/frames used in the animation. If the data contains a fewere number of total frames, the lesser value will be used." - }, - "-torque-resolution": { - "css": "-torque-resolution", - "default-value": "2", - "type":"float", - "default-meaning": "", - "doc": "Spatial resolution in pixels. A resolution of 1 means no spatial aggregation of the data. Any other resolution of N results in spatial aggregation into cells of NxN pixels. The value N must be power of 2" - }, - "-torque-animation-duration": { - "css": "-torque-animation-duration", - "default-value": "30", - "type":"float", - "default-meaning": "the animation lasts 30 seconds", - "doc": "Animation duration in seconds" - }, - "-torque-aggregation-function": { - "css": "-torque-aggregation-function", - "default-value": "count(cartodb_id)", - "type": "string", - "default-meaning": "the value for each cell is the count of points in that cell", - "doc": "A function used to calculate a value from the aggregate data for each cell. See -torque-resolution" - }, - "-torque-time-attribute": { - "css": "-torque-time-attribute", - "default-value": "time", - "type": "string", - "default-meaning": "the data column in your table that is of a time based type", - "doc": "The table column that contains the time information used create the animation" - }, - "-torque-data-aggregation": { - "css": "-torque-data-aggregation", - "default-value": "linear", - "type": [ - "linear", - "cumulative" - ], - "default-meaning": "previous values are discarded", - "doc": "A linear animation will discard previous values while a cumulative animation will accumulate them until it restarts" - } - } - }, - "colors": { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255,235,205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "grey": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50], - "transparent": [0, 0, 0, 0] - }, - "filter": { - "value": [ - "true", - "false", - "null", - "point", - "linestring", - "polygon", - "collection" - ] - } -} - -window.carto['mapnik-reference'] = { - version: { - latest: _mapnik_reference_latest, - '2.1.1': _mapnik_reference_latest - } -} -// -// Stub out `require` in the browser -// -window.carto = window.carto || {}; -window.carto.underscore = window._; - -function require(arg) { - var mod = window.carto[arg]; - if(!mod) { - mod = window.carto[arg.split('/')[1]]; - } - if(!mod) { - mod = window.carto[arg] - } - if(!mod) { - mod = window[arg.split('/')[1]]; - } - // try global scope - if(!mod) { - mod = window[arg] - } - return mod; -} - -if (typeof(exports) !== 'undefined') { - carto = exports; - tree = require('./tree'); - _ = require('underscore'); -} else { - if (typeof(window.carto) === 'undefined') { window.carto = {}; } - carto = window.carto; - tree = window.carto.tree = {}; - _ = window._; -} - -// carto.js - parser -// -// A relatively straight-forward predictive parser. -// There is no tokenization/lexing stage, the input is parsed -// in one sweep. -// -// To make the parser fast enough to run in the browser, several -// optimization had to be made: -// -// - Matching and slicing on a huge input is often cause of slowdowns. -// The solution is to chunkify the input into smaller strings. -// The chunks are stored in the `chunks` var, -// `j` holds the current chunk index, and `current` holds -// the index of the current chunk in relation to `input`. -// This gives us an almost 4x speed-up. -// -// - In many cases, we don't need to match individual tokens; -// for example, if a value doesn't hold any variables, operations -// or dynamic references, the parser can effectively 'skip' it, -// treating it as a literal. -// An example would be '1px solid #000' - which evaluates to itself, -// we don't need to know what the individual components are. -// The drawback, of course is that you don't get the benefits of -// syntax-checking on the CSS. This gives us a 50% speed-up in the parser, -// and a smaller speed-up in the code-gen. -// -// -// Token matching is done with the `$` function, which either takes -// a terminal string or regexp, or a non-terminal function to call. -// It also takes care of moving all the indices forwards. - -carto.Parser = function Parser(env) { - var input, // LeSS input string - i, // current index in `input` - j, // current chunk - temp, // temporarily holds a chunk's state, for backtracking - memo, // temporarily holds `i`, when backtracking - furthest, // furthest index the parser has gone to - chunks, // chunkified input - current, // index of current chunk, in `input` - parser; - - var that = this; - - // This function is called after all files - // have been imported through `@import`. - var finish = function() {}; - - var imports = this.imports = { - paths: env && env.paths || [], // Search paths, when importing - queue: [], // Files which haven't been imported yet - files: {}, // Holds the imported parse trees - mime: env && env.mime, // MIME type of .carto files - push: function(path, callback) { - var that = this; - this.queue.push(path); - - // - // Import a file asynchronously - // - carto.Parser.importer(path, this.paths, function(root) { - that.queue.splice(that.queue.indexOf(path), 1); // Remove the path from the queue - that.files[path] = root; // Store the root - - callback(root); - - if (that.queue.length === 0) { finish(); } // Call `finish` if we're done importing - }, env); - } - }; - - function save() { - temp = chunks[j]; - memo = i; - current = i; - } - function restore() { - chunks[j] = temp; - i = memo; - current = i; - } - - function sync() { - if (i > current) { - chunks[j] = chunks[j].slice(i - current); - current = i; - } - } - // - // Parse from a token, regexp or string, and move forward if match - // - function $(tok) { - var match, args, length, c, index, endIndex, k; - - // - // Non-terminal - // - if (tok instanceof Function) { - return tok.call(parser.parsers); - // - // Terminal - // - // Either match a single character in the input, - // or match a regexp in the current chunk (chunk[j]). - // - } else if (typeof(tok) === 'string') { - match = input.charAt(i) === tok ? tok : null; - length = 1; - sync(); - } else { - sync(); - - match = tok.exec(chunks[j]); - if (match) { - length = match[0].length; - } else { - return null; - } - } - - // The match is confirmed, add the match length to `i`, - // and consume any extra white-space characters (' ' || '\n') - // which come after that. The reason for this is that LeSS's - // grammar is mostly white-space insensitive. - if (match) { - var mem = i += length; - endIndex = i + chunks[j].length - length; - - while (i < endIndex) { - c = input.charCodeAt(i); - if (! (c === 32 || c === 10 || c === 9)) { break; } - i++; - } - chunks[j] = chunks[j].slice(length + (i - mem)); - current = i; - - if (chunks[j].length === 0 && j < chunks.length - 1) { j++; } - - if (typeof(match) === 'string') { - return match; - } else { - return match.length === 1 ? match[0] : match; - } - } - } - - // Same as $(), but don't change the state of the parser, - // just return the match. - function peek(tok) { - if (typeof(tok) === 'string') { - return input.charAt(i) === tok; - } else { - if (tok.test(chunks[j])) { - return true; - } else { - return false; - } - } - } - - function extractErrorLine(style, errorIndex) { - return (style.slice(0, errorIndex).match(/\n/g) || '').length + 1; - } - - - // Make an error object from a passed set of properties. - // Accepted properties: - // - `message`: Text of the error message. - // - `filename`: Filename where the error occurred. - // - `index`: Char. index where the error occurred. - function makeError(err) { - var einput; - - _(err).defaults({ - index: furthest, - filename: env.filename, - message: 'Parse error.', - line: 0, - column: -1 - }); - - if (err.filename && that.env.inputs && that.env.inputs[err.filename]) { - einput = that.env.inputs[err.filename]; - } else { - einput = input; - } - - err.line = extractErrorLine(einput, err.index); - for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) { - err.column++; - } - - return new Error(_('<%=filename%>:<%=line%>:<%=column%> <%=message%>').template(err)); - } - - this.env = env = env || {}; - this.env.filename = this.env.filename || null; - this.env.inputs = this.env.inputs || {}; - - // The Parser - return parser = { - - imports: imports, - extractErrorLine: extractErrorLine, - // - // Parse an input string into an abstract syntax tree. - // Throws an error on parse errors. - parse: function(str) { - var root, start, end, zone, line, lines, buff = [], c, error = null; - - i = j = current = furthest = 0; - chunks = []; - input = str.replace(/\r\n/g, '\n'); - if (env.filename) { - that.env.inputs[env.filename] = input; - } - - var early_exit = false; - // Split the input into chunks. - chunks = (function(chunks) { - var j = 0, - skip = /[^"'`\{\}\/]+/g, - comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g, - level = 0, - match, - chunk = chunks[0], - inString; - - chunker: for (var i = 0, c, cc; i < input.length; i++) { - skip.lastIndex = i; - if (match = skip.exec(input)) { - if (match.index === i) { - i += match[0].length; - chunk.push(match[0]); - } - } - c = input.charAt(i); - comment.lastIndex = i; - - if (!inString && c === '/') { - cc = input.charAt(i + 1); - if (cc === '/' || cc === '*') { - if (match = comment.exec(input)) { - if (match.index === i) { - i += match[0].length - 1; - chunk.push(match[0]); - c = input.charAt(i); - continue chunker; - } - } - } - } - - if (c === '{' && !inString) { level++; - chunk.push(c); - } else if (c === '}' && !inString) { level--; - chunk.push(c); - chunks[++j] = chunk = []; - } else { - if (c === '"' || c === "'" || c === '`') { - if (! inString) { - inString = c; - } else { - inString = inString === c ? false : inString; - } - } - chunk.push(c); - } - } - if (level > 0) { - // TODO: make invalid instead - throw makeError({ - message: 'Missing closing `}`', - index: i - }); - } - - return chunks.map(function(c) { return c.join(''); }); - })([[]]); - - // Start with the primary rule. - // The whole syntax tree is held under a Ruleset node, - // with the `root` property set to true, so no `{}` are - // output. The callback is called when the input is parsed. - root = new tree.Ruleset([], $(this.parsers.primary)); - root.root = true; - - // Get an array of Ruleset objects, flattened - // and sorted according to specificitySort - root.toList = (function() { - var line, lines, column; - return function(env) { - env.error = function(e) { - if (!env.errors) env.errors = new Error(''); - if (env.errors.message) { - env.errors.message += '\n' + makeError(e).message; - } else { - env.errors.message = makeError(e).message; - } - }; - env.frames = env.frames || []; - - // call populates Invalid-caused errors - var definitions = this.flatten([], [], env); - definitions.sort(specificitySort); - return definitions; - }; - })(); - - // Sort rules by specificity: this function expects selectors to be - // split already. - // - // Written to be used as a .sort(Function); - // argument. - // - // [1, 0, 0, 467] > [0, 0, 1, 520] - var specificitySort = function(a, b) { - var as = a.specificity; - var bs = b.specificity; - - if (as[0] != bs[0]) return bs[0] - as[0]; - if (as[1] != bs[1]) return bs[1] - as[1]; - if (as[2] != bs[2]) return bs[2] - as[2]; - return bs[3] - as[3]; - }; - - // If `i` is smaller than the `input.length - 1`, - // it means the parser wasn't able to parse the whole - // string, so we've got a parsing error. - // - // We try to extract a \n delimited string, - // showing the line where the parse error occured. - // We split it up into two parts (the part which parsed, - // and the part which didn't), so we can color them differently. - if (i < input.length - 1) throw makeError({ - message:'Parse error.', - index:i - }); - - return root; - }, - - // - // Here in, the parsing rules/functions - // - // The basic structure of the syntax tree generated is as follows: - // - // Ruleset -> Rule -> Value -> Expression -> Entity - // - // In general, most rules will try to parse a token with the `$()` function, and if the return - // value is truly, will return a new node, of the relevant type. Sometimes, we need to check - // first, before parsing, that's when we use `peek()`. - // - parsers: { - // - // The `primary` rule is the *entry* and *exit* point of the parser. - // The rules here can appear at any level of the parse tree. - // - // The recursive nature of the grammar is an interplay between the `block` - // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, - // as represented by this simplified grammar: - // - // primary → (ruleset | rule)+ - // ruleset → selector+ block - // block → '{' primary '}' - // - // Only at one point is the primary rule not called from the - // block rule: at the root level. - // - primary: function() { - var node, root = []; - - while ((node = $(this.rule) || $(this.ruleset) || - $(this.comment)) || - $(/^[\s\n]+/) || (node = $(this.invalid))) { - node && root.push(node); - } - return root; - }, - - invalid: function () { - var chunk = $(/^[^;\n]*[;\n]/); - - // To fail gracefully, match everything until a semicolon or linebreak. - if (chunk) { - return new(tree.Invalid)(chunk, memo); - } - }, - - // We create a Comment node for CSS comments `/* */`, - // but keep the LeSS comments `//` silent, by just skipping - // over them. - comment: function() { - var comment; - - if (input.charAt(i) !== '/') return; - - if (input.charAt(i + 1) === '/') { - return new tree.Comment($(/^\/\/.*/), true); - } else if (comment = $(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) { - return new tree.Comment(comment); - } - }, - - // - // Entities are tokens which can be found inside an Expression - // - entities: { - // - // A string, which supports escaping " and ' - // - // "milky way" 'he\'s the one!' - // - quoted: function() { - if (input.charAt(i) !== '"' && input.charAt(i) !== "'") return; - var str = $(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/); - if (str) { - return new tree.Quoted(str[1] || str[2]); - } - }, - - // A reference to a Mapnik field, like - // - // [NAME] - // - // Behind the scenes, this has the same representation, but Carto - // needs to be careful to warn when unsupported operations are used. - field: function() { - if (! $('[')) return; - var field_name = $(/(^[a-zA-Z0-9\-_]+)/); - if (! $(']')) return; - if (field_name) return new tree.Field(field_name[1]); - }, - - // This is a comparison operator - comparison: function() { - var str = $(/^=~|=|!=|<=|>=|<|>/); - if (str) { - return str; - } - }, - - // A catch-all word, such as: - // - // hard-light - // - // These can start with either a letter or a dash (-), - // and then contain numbers, underscores, and letters. - keyword: function() { - var k = $(/^[A-Za-z-]+[A-Za-z-0-9_]*/); - if (k) { return new tree.Keyword(k); } - }, - - // A function call - // - // rgb(255, 0, 255) - // - // The arguments are parsed with the `entities.arguments` parser. - call: function() { - var name, args; - - if (! (name = /^([\w\-]+|%)\(/.exec(chunks[j]))) return; - - name = name[1].toLowerCase(); - - if (name === 'url') { - return null; - } else { - i += name.length + 1; - } - - args = $(this.entities.arguments); - - if (!$(')')) return; - - if (name) { - return new tree.Call(name, args, i); - } - }, - // Arguments are comma-separated expressions - 'arguments': function() { - var args = [], arg; - - while (arg = $(this.expression)) { - args.push(arg); - if (! $(',')) { break; } - } - - return args; - }, - literal: function() { - return $(this.entities.dimension) || - $(this.entities.color) || - $(this.entities.quoted); - }, - - // Parse url() tokens - // - // We use a specific rule for urls, because they don't really behave like - // standard function calls. The difference is that the argument doesn't have - // to be enclosed within a string, so it can't be parsed as an Expression. - url: function() { - var value; - - if (input.charAt(i) !== 'u' || !$(/^url\(/)) return; - value = $(this.entities.quoted) || $(this.entities.variable) || - $(/^[\-\w%@$\/.&=:;#+?~]+/) || ''; - if (! $(')')) { - return new tree.Invalid(value, memo, 'Missing closing ) in URL.'); - } else { - return new tree.URL((value.value || value instanceof tree.Variable) ? - value : new tree.Quoted(value), imports.paths); - } - }, - - // A Variable entity, such as `@fink`, in - // - // width: @fink + 2px - // - // We use a different parser for variable definitions, - // see `parsers.variable`. - variable: function() { - var name, index = i; - - if (input.charAt(i) === '@' && (name = $(/^@[\w-]+/))) { - return new tree.Variable(name, index, env.filename); - } - }, - - // A Hexadecimal color - // - // #4F3C2F - // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. - color: function() { - var rgb; - - if (input.charAt(i) === '#' && (rgb = $(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) { - return new tree.Color(rgb[1]); - } else { - rgb = chunks[j].match(/^[a-z]+/); - if (rgb && rgb[0] in tree.Reference.data.colors) { - return new tree.Color(tree.Reference.data.colors[$(/^[a-z]+/)]); - } - } - }, - - // A Dimension, that is, a number and a unit. The only - // unit that has an effect is % - // - // 0.5em 95% - dimension: function() { - var c = input.charCodeAt(i); - if ((c > 57 || c < 45) || c === 47) return; - var value = $(/^(-?\d*\.?\d+)(\%|\w+)?/); - if (value) { - return new tree.Dimension(value[1], value[2], memo); - } - } - }, - - // The variable part of a variable definition. Used in the `rule` parser - // - // @fink: - variable: function() { - var name; - - if (input.charAt(i) === '@' && (name = $(/^(@[\w-]+)\s*:/))) { - return name[1]; - } - }, - - // - // Entities are the smallest recognized token, - // and can be found inside a rule's value. - // - entity: function() { - return $(this.entities.literal) || - $(this.entities.field) || - $(this.entities.variable) || - $(this.entities.url) || - $(this.entities.call) || - $(this.entities.keyword); - }, - - // - // A Rule terminator. Note that we use `peek()` to check for '}', - // because the `block` rule will be expecting it, but we still need to make sure - // it's there, if ';' was ommitted. - // - end: function() { - return $(';') || peek('}'); - }, - - // Elements are the building blocks for Selectors. They consist of - // an element name, such as a tag a class, or `*`. - element: function() { - var e = $(/^(?:[.#][\w\-]+|\*|Map)/); - if (e) return new tree.Element(e); - }, - - // Attachments allow adding multiple lines, polygons etc. to an - // object. There can only be one attachment per selector. - attachment: function() { - var s = $(/^::([\w\-]+(?:\/[\w\-]+)*)/); - if (s) return s[1]; - }, - - // Selectors are made out of one or more Elements, see above. - selector: function() { - var a, attachment; - var e, elements = []; - var f, filters = new tree.Filterset(); - var z, zoom = tree.Zoom.all; - var fo, frame_offset = tree.FrameOffset.none; - var segments = 0, conditions = 0; - - while ( - (e = $(this.element)) || - (z = $(this.zoom)) || - (fo = $(this.frame_offset)) || - (f = $(this.filter)) || - (a = $(this.attachment)) - ) { - segments++; - if (e) { - elements.push(e); - } else if (z) { - zoom &= z; - conditions++; - } else if (fo) { - frame_offset = fo; - conditions++; - } else if (f) { - filters.add(f); - conditions++; - } else if (attachment) { - throw makeError({ - message:'Encountered second attachment name.', - index:i - 1 - }); - } else { - attachment = a; - } - - var c = input.charAt(i); - if (c === '{' || c === '}' || c === ';' || c === ',') { break; } - } - - if (segments) { - return new tree.Selector(filters, zoom, frame_offset, elements, attachment, conditions, memo); - } - }, - - filter: function() { - save(); - var key, op, val; - if (! $('[')) return; - if (key = $(/^[a-zA-Z0-9\-_]+/) || $(this.entities.quoted) || $(this.entities.variable)) { - if ((op = $(this.entities.comparison)) && - (val = $(this.entities.quoted) || $(this.entities.variable) || $(/^[\w\-\.]+/))) { - if (! $(']')) return; - return new tree.Filter(key, op, val, memo, env.filename); - } - } - }, - - frame_offset: function() { - save(); - var op, val; - if ($(/^\[\s*frame-offset/g) && - (op = $(this.entities.comparison)) && - (val = $(/^\d+/)) && - $(']')) { - return tree.FrameOffset(op, val, memo); - } - }, - - zoom: function() { - save(); - var op, val; - if ($(/^\[\s*zoom/g) && - (op = $(this.entities.comparison)) && - (val = $(/^\d+/)) && - $(']')) { - return tree.Zoom(op, val, memo); - } - }, - - // - // The `block` rule is used by `ruleset` - // It's a wrapper around the `primary` rule, with added `{}`. - // - block: function() { - var content; - - if ($('{') && (content = $(this.primary)) && $('}')) { - return content; - } - }, - - // - // div, .class, body > p {...} - // - ruleset: function() { - var selectors = [], s, f, l, rules, filters = []; - save(); - - while (s = $(this.selector)) { - selectors.push(s); - if (! $(',')) { break } - } - if (s) $(this.comment); - - if (selectors.length > 0 && (rules = $(this.block))) { - if (selectors.length === 1 && - selectors[0].elements.length && - selectors[0].elements[0].value === 'Map') { - var rs = new tree.Ruleset(selectors, rules); - rs.isMap = true; - return rs; - } - return new tree.Ruleset(selectors, rules); - } else { - // Backtrack - restore(); - } - }, - rule: function() { - var name, value, c = input.charAt(i); - save(); - - if (c === '.' || c === '#' || c === '&') { return } - - if (name = $(this.variable) || $(this.property)) { - value = $(this.value); - - if (value && $(this.end)) { - return new tree.Rule(name, value, memo, env.filename); - } else { - furthest = i; - restore(); - } - } - }, - - font: function() { - var value = [], expression = [], weight, font, e; - - while (e = $(this.entity)) { - expression.push(e); - } - - value.push(new tree.Expression(expression)); - - if ($(',')) { - while (e = $(this.expression)) { - value.push(e); - if (! $(',')) { break; } - } - } - return new tree.Value(value); - }, - - // A Value is a comma-delimited list of Expressions - // In a Rule, a Value represents everything after the `:`, - // and before the `;`. - value: function() { - var e, expressions = []; - - while (e = $(this.expression)) { - expressions.push(e); - if (! $(',')) { break; } - } - - if (expressions.length > 0) { - return new tree.Value(expressions); - } - }, - // A sub-expression, contained by parenthensis - sub: function() { - var e; - - if ($('(') && (e = $(this.expression)) && $(')')) { - return e; - } - }, - // This is a misnomer because it actually handles multiplication - // and division. - multiplication: function() { - var m, a, op, operation; - if (m = $(this.operand)) { - while ((op = ($('/') || $('*') || $('%'))) && (a = $(this.operand))) { - operation = new tree.Operation(op, [operation || m, a], memo); - } - return operation || m; - } - }, - addition: function() { - var m, a, op, operation; - if (m = $(this.multiplication)) { - while ((op = $(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && ($('+') || $('-')))) && - (a = $(this.multiplication))) { - operation = new tree.Operation(op, [operation || m, a], memo); - } - return operation || m; - } - }, - - // An operand is anything that can be part of an operation, - // such as a Color, or a Variable - operand: function() { - return $(this.sub) || $(this.entity); - }, - - // Expressions either represent mathematical operations, - // or white-space delimited Entities. - // - // 1px solid black - // @var * 2 - expression: function() { - var e, delim, entities = [], d; - - while (e = $(this.addition) || $(this.entity)) { - entities.push(e); - } - if (entities.length > 0) { - return new tree.Expression(entities); - } - }, - property: function() { - var name = $(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/); - if (name) return name[1]; - } - } - }; -}; - -/** - * TODO: document this. What does this do? - */ -if(typeof(module) !== "undefined") { - module.exports.find = function (obj, fun) { - for (var i = 0, r; i < obj.length; i++) { - if (r = fun.call(obj, obj[i])) { return r; } - } - return null; - }; -} -(function(tree) { - -tree.Anonymous = function Anonymous(string) { - this.value = string.value || string; -}; -tree.Anonymous.prototype = { - toString: function() { - return this.value; - }, - eval: function() { return this; } -}; - -})(require('../tree')); -(function(tree) { - -tree.Call = function Call(name, args, index) { - this.is = 'call'; - - this.name = name; - this.args = args; - this.index = index; -}; - -tree.Call.prototype = { - // - // When evaluating a function call, - // we either find the function in `tree.functions` [1], - // in which case we call it, passing the evaluated arguments, - // or we simply print it out as it appeared originally [2]. - // - // The *functions.js* file contains the built-in functions. - // - // The reason why we evaluate the arguments, is in the case where - // we try to pass a variable to a function, like: `saturate(@color)`. - // The function should receive the value, not the variable. - // - eval: function(env) { - var args = this.args.map(function(a) { return a.eval(env); }); - - for (var i = 0; i < args.length; i++) { - if (args[i].is === 'undefined') { - return { - is: 'undefined', - value: 'undefined' - }; - } - } - - if (this.name in tree.functions) { - if (tree.functions[this.name].length === args.length) { - return tree.functions[this.name].apply(tree.functions, args); - } else { - env.error({ - message: 'incorrect number of arguments for ' + this.name + - '(). ' + tree.functions[this.name].length + ' expected.', - index: this.index, - type: 'runtime', - filename: this.filename - }); - return { - is: 'undefined', - value: 'undefined' - }; - } - } else { - var fn = tree.Reference.mapnikFunction(this.name); - if (!fn) { - env.error({ - message: 'unknown function ' + this.name, - index: this.index, - type: 'runtime', - filename: this.filename - }); - return { - is: 'undefined', - value: 'undefined' - }; - } - if (fn[1] !== args.length) { - env.error({ - message: 'function ' + this.name + ' takes ' + - fn[1] + ' arguments and was given ' + args.length, - index: this.index, - type: 'runtime', - filename: this.filename - }); - return { - is: 'undefined', - value: 'undefined' - }; - } else { - // Save the evaluated versions of arguments - this.args = args; - return this; - } - } - }, - - toString: function(env, format) { - if (format === 'image-filter') { - if (this.args.length) { - return this.name + ':' + this.args.join(','); - } else { - return this.name; - } - } else { - if (this.args.length) { - return this.name + '(' + this.args.join(',') + ')'; - } else { - return this.name; - } - } - } -}; - -})(require('../tree')); -(function(tree) { -// -// RGB Colors - #ff0014, #eee -// -tree.Color = function Color(rgb, a) { - // - // The end goal here, is to parse the arguments - // into an integer triplet, such as `128, 255, 0` - // - // This facilitates operations and conversions. - // - if (Array.isArray(rgb)) { - this.rgb = rgb; - } else if (rgb.length == 6) { - this.rgb = rgb.match(/.{2}/g).map(function(c) { - return parseInt(c, 16); - }); - } else { - this.rgb = rgb.split('').map(function(c) { - return parseInt(c + c, 16); - }); - } - this.is = 'color'; - this.alpha = typeof(a) === 'number' ? a : 1; -}; - -tree.Color.prototype = { - eval: function() { return this; }, - - // If we have some transparency, the only way to represent it - // is via `rgba`. Otherwise, we use the hex representation, - // which has better compatibility with older browsers. - // Values are capped between `0` and `255`, rounded and zero-padded. - toString: function() { - if (this.alpha < 1.0) { - return 'rgba(' + this.rgb.map(function(c) { - return Math.round(c); - }).concat(this.alpha).join(', ') + ')'; - } else { - return '#' + this.rgb.map(function(i) { - i = Math.round(i); - i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16); - return i.length === 1 ? '0' + i : i; - }).join(''); - } - }, - - // Operations have to be done per-channel, if not, - // channels will spill onto each other. Once we have - // our result, in the form of an integer triplet, - // we create a new Color node to hold the result. - operate: function(op, other) { - var result = []; - - if (! (other instanceof tree.Color)) { - other = other.toColor(); - } - - for (var c = 0; c < 3; c++) { - result[c] = tree.operate(op, this.rgb[c], other.rgb[c]); - } - return new tree.Color(result); - }, - - toHSL: function() { - var r = this.rgb[0] / 255, - g = this.rgb[1] / 255, - b = this.rgb[2] / 255, - a = this.alpha; - - var max = Math.max(r, g, b), min = Math.min(r, g, b); - var h, s, l = (max + min) / 2, d = max - min; - - if (max === min) { - h = s = 0; - } else { - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - - switch (max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h * 360, s: s, l: l, a: a }; - } -}; - - -})(require('../tree')); -(function(tree) { - -tree.Comment = function Comment(value, silent) { - this.value = value; - this.silent = !!silent; -}; - -tree.Comment.prototype = { - toString: function(env) { - return ''; - }, - eval: function() { return this; } -}; - -})(require('../tree')); -(function(tree) { -var assert = require('assert'); - -tree.Definition = function Definition(selector, rules) { - this.elements = selector.elements; - assert.ok(selector.filters instanceof tree.Filterset); - this.rules = rules; - this.ruleIndex = []; - for (var i = 0; i < this.rules.length; i++) { - if ('zoom' in this.rules[i]) this.rules[i] = this.rules[i].clone(); - this.rules[i].zoom = selector.zoom; - this.ruleIndex.push(this.rules[i].updateID()); - } - this.filters = selector.filters; - this.zoom = selector.zoom; - this.frame_offset = selector.frame_offset; - this.attachment = selector.attachment || '__default__'; - this.specificity = selector.specificity(); -}; - -tree.Definition.prototype.toString = function() { - var str = this.filters.toString(); - for (var i = 0; i < this.rules.length; i++) { - str += '\n ' + this.rules[i]; - } - return str; -}; - -tree.Definition.prototype.clone = function(filters) { - if (filters) assert.ok(filters instanceof tree.Filterset); - var clone = Object.create(tree.Definition.prototype); - clone.rules = this.rules.slice(); - clone.ruleIndex = this.ruleIndex.slice(); - clone.filters = filters ? filters : this.filters.clone(); - clone.attachment = this.attachment; - return clone; -}; - -tree.Definition.prototype.addRules = function(rules) { - var added = 0; - - // Add only unique rules. - for (var i = 0; i < rules.length; i++) { - if (this.ruleIndex.indexOf(rules[i].id) < 0) { - this.rules.push(rules[i]); - this.ruleIndex.push(rules[i].id); - added++; - } - } - - return added; -}; - -/** - * Determine whether this selector matches a given id - * and array of classes, by determining whether - * all elements it contains match. - */ -tree.Definition.prototype.appliesTo = function(id, classes) { - for (var i = 0; i < this.elements.length; i++) { - if (!this.elements[i].matches(id, classes)) { - return false; - } - } - return true; -}; - -tree.Definition.prototype.symbolizersToXML = function(env, symbolizers, zoom) { - var xml = ' \n'; - xml += tree.Zoom.toXML(zoom).join(''); - xml += this.filters.toXML(env); - - // Sort symbolizers by the index of their first property definition - var sym_order = [], indexes = []; - for (var key in symbolizers) { - indexes = []; - for (var prop in symbolizers[key]) { - indexes.push(symbolizers[key][prop].index); - } - var min_idx = Math.min.apply(Math, indexes); - sym_order.push([key, min_idx]); - } - - // Get a simple list of the symbolizers, in order - sym_order = sym_order.sort(function(a, b) { - return a[1] - b[1]; - }).map(function(v) { - return v[0]; - }); - - for (var i = 0; i < sym_order.length; i++) { - var attributes = symbolizers[sym_order[i]]; - var symbolizer = sym_order[i].split('/').pop(); - - // Skip the magical * symbolizer which is used for universal properties - // which are bubbled up to Style elements intead of Symbolizer elements. - if (symbolizer === '*') continue; - - var fail = tree.Reference.requiredProperties(symbolizer, attributes); - if (fail) { - var rule = attributes[Object.keys(attributes).shift()]; - env.error({ - message: fail, - index: rule.index, - filename: rule.filename - }); - } - - var name = symbolizer.charAt(0).toUpperCase() + - symbolizer.slice(1).replace(/\-./, function(str) { - return str[1].toUpperCase(); - }) + 'Symbolizer'; - - var selfclosing = true, tagcontent; - xml += ' <' + name + ' '; - for (var key in attributes) { - if (symbolizer === 'map') env.error({ - message: 'Map properties are not permitted in other rules', - index: attributes[key].index, - filename: attributes[key].filename - }); - var x = tree.Reference.selector(attributes[key].name); - if (x && x.serialization && x.serialization === 'content') { - selfclosing = false; - tagcontent = attributes[key].eval(env).toXML(env, true); - } else { - xml += attributes[key].eval(env).toXML(env) + ' '; - } - } - if (selfclosing) { - xml += '/>\n'; - } else { - xml += '>\n'; - } - } - xml += ' \n'; - return xml; -}; - -tree.Definition.prototype.collectSymbolizers = function(zooms, i) { - var symbolizers = {}, child; - - for (var j = i; j < this.rules.length; j++) { - child = this.rules[j]; - var key = child.instance + '/' + child.symbolizer; - if (zooms.current & child.zoom && - (!(key in symbolizers) || - (!(child.name in symbolizers[key])))) { - zooms.current &= child.zoom; - if (!(key in symbolizers)) { - symbolizers[key] = {}; - } - symbolizers[key][child.name] = child; - } - } - - if (Object.keys(symbolizers).length) { - zooms.rule &= (zooms.available &= ~zooms.current); - return symbolizers; - } -}; - -tree.Definition.prototype.toXML = function(env, existing) { - // The tree.Zoom.toString function ignores the holes in zoom ranges and outputs - // scaledenominators that cover the whole range from the first to last bit set. - // This algorithm can produces zoom ranges that may have holes. However, - // when using the filter-mode="first", more specific zoom filters will always - // end up before broader ranges. The filter-mode will pick those first before - // resorting to the zoom range with the hole and stop processing further rules. - var filter = this.filters.toString(); - if (!(filter in existing)) existing[filter] = tree.Zoom.all; - - var available = tree.Zoom.all, xml = '', zoom, symbolizers; - var zooms = { available: tree.Zoom.all }; - for (var i = 0; i < this.rules.length && available; i++) { - zooms.rule = this.rules[i].zoom; - if (!(existing[filter] & zooms.rule)) continue; - - while (zooms.current = zooms.rule & available) { - if (symbolizers = this.collectSymbolizers(zooms, i)) { - if (!(existing[filter] & zooms.current)) continue; - xml += this.symbolizersToXML(env, symbolizers, existing[filter] & zooms.current); - existing[filter] &= ~zooms.current; - } - } - } - - return xml; -}; - -})(require('../tree')); -(function(tree) { - -// -// A number with a unit -// -tree.Dimension = function Dimension(value, unit, index) { - this.value = parseFloat(value); - this.unit = unit || null; - this.is = 'float'; - this.index = index; -}; - -tree.Dimension.prototype = { - eval: function (env) { - if (this.unit && ['px', '%'].indexOf(this.unit) === -1) { - env.error({ - message: "Invalid unit: '" + this.unit + "'", - index: this.index - }); - } - - return this; - }, - round: function() { - this.value = Math.round(this.value); - return this; - }, - toColor: function() { - return new tree.Color([this.value, this.value, this.value]); - }, - toString: function() { - return this.value.toString(); - }, - - // In an operation between two Dimensions, - // we default to the first Dimension's unit, - // so `1px + 2em` will yield `3px`. - // In the future, we could implement some unit - // conversions such that `100cm + 10mm` would yield - // `101cm`. - operate: function(op, other) { - return new tree.Dimension(tree.operate(op, this.value, other.value), - this.unit || other.unit); - } -}; - -})(require('../tree')); -(function(tree) { - -tree.Directive = function Directive(name, value) { - this.name = name; - if (Array.isArray(value)) { - this.ruleset = new tree.Ruleset([], value); - } else { - this.value = value; - } -}; -tree.Directive.prototype = { - toString: function(ctx, env) { - if (this.ruleset) { - this.ruleset.root = true; - return this.name + ' {\n ' + - this.ruleset.toString(ctx, env).trim().replace(/\n/g, '\n ') + - '\n}\n'; - } else { - return this.name + ' ' + this.value.toString() + ';\n'; - } - }, - eval: function(env) { - env.frames.unshift(this); - this.ruleset = this.ruleset && this.ruleset.eval(env); - env.frames.shift(); - return this; - }, - variable: function(name) { - return tree.Ruleset.prototype.variable.call(this.ruleset, name); - }, - find: function() { - return tree.Ruleset.prototype.find.apply(this.ruleset, arguments); - }, - rulesets: function() { - return tree.Ruleset.prototype.rulesets.apply(this.ruleset); - } -}; - -})(require('../tree')); -(function(tree) { - -// An element is an id or class selector -tree.Element = function Element(value) { - this.value = value.trim(); -}; - -// Determine the 'specificity matrix' of this -// specific selector -tree.Element.prototype.specificity = function() { - return [ - (this.value[0] == '#') ? 1 : 0, // a - (this.value[0] == '.') ? 1 : 0 // b - ]; -}; - -tree.Element.prototype.toString = function() { - return this.value; -}; - -// Determine whether this element matches an id or classes. -// An element is a single id or class, or check whether the given -// array of classes contains this, or the id is equal to this. -// -// Takes a plain string for id and plain strings in the array of -// classes. -tree.Element.prototype.matches = function(id, classes) { - return (classes.indexOf(this.value.replace(/^\./, '')) !== -1) || - (this.value.replace(/^#/, '') === id) || - (this.value === '*'); -}; - -})(require('../tree')); -(function(tree) { - -tree.Expression = function Expression(value) { - this.value = value; -}; -tree.Expression.prototype = { - eval: function(env) { - if (this.value.length > 1) { - return new tree.Expression(this.value.map(function(e) { - return e.eval(env); - })); - } else { - return this.value[0].eval(env); - } - }, - toString: function(env) { - return this.value.map(function(e) { - return e.toString(env); - }).join(' '); - } -}; - -})(require('../tree')); -(function(tree) { - -tree.Field = function Field(content) { - this.value = content || ''; - this.is = 'field'; -}; - -tree.Field.prototype = { - toString: function() { - return '[' + this.value + ']'; - }, - 'eval': function() { - return this; - } -}; - -})(require('../tree')); -(function(tree) { - -tree.Filter = function Filter(key, op, val, index, filename) { - if (key.is) { - this.key = key.value; - this._key = key; - } else { - this.key = key; - } - - this.op = op; - this.index = index; - this.filename = filename; - - if (val.is) { - this.val = val.value; - this._val = val; - } else { - this.val = val; - } - - if (ops[this.op][1] == 'numeric') { - this.val = 1 * this.val; - } - - this.id = this.key + this.op + this.val; -}; - - -// xmlsafe, numeric, suffix -var ops = { - '<': [' < ', 'numeric'], - '>': [' > ', 'numeric'], - '=': [' = ', 'both'], - '!=': [' != ', 'both'], - '<=': [' <= ', 'numeric'], - '>=': [' >= ', 'numeric'], - '=~': ['.match(', 'string', ')'] -}; - -tree.Filter.prototype.toXML = function(env) { - if (this.val.eval) this._val = this.val.eval(env); - if (this.key.eval) this._key = this.key.eval(env); - if (this._key) var key = this._key.toString(false); - if (this._val) var val = this._val.toString(this._val.is == 'string'); - - if ( - (ops[this.op][1] == 'numeric' && isNaN(this.val)) || - (ops[this.op][1] == 'string' && (val || this.val)[0] != "'") - ) { - env.error({ - message: 'Cannot use operator "' + this.op + '" with value ' + this.val, - index: this.index, - filename: this.filename - }); - } - - return '[' + (key || this.key) + ']' + ops[this.op][0] + '' + (val || this.val) + (ops[this.op][2] || ''); -}; - -tree.Filter.prototype.toString = function() { - return '[' + this.id + ']'; -}; - -})(require('../tree')); -var tree = require('../tree'); - -tree.Filterset = function Filterset() {}; - -Object.defineProperty(tree.Filterset.prototype, 'toXML', { - enumerable: false, - value: function(env) { - var filters = []; - for (var id in this) { - filters.push('(' + this[id].toXML(env).trim() + ')'); - } - - if (filters.length) { - return ' ' + filters.join(' and ') + '\n'; - } else { - return ''; - } - } -}); - -Object.defineProperty(tree.Filterset.prototype, 'toString', { - enumerable: false, - value: function() { - var arr = []; - for (var id in this) arr.push(this[id].id); - arr.sort(); - return arr.join('\t'); - } -}); - -Object.defineProperty(tree.Filterset.prototype, 'clone', { - enumerable: false, - value: function() { - var clone = new tree.Filterset(); - for (var id in this) { - clone[id] = this[id]; - } - return clone; - } -}); - -// Note: other has to be a tree.Filterset. -Object.defineProperty(tree.Filterset.prototype, 'cloneWith', { - enumerable: false, - value: function(other) { - var additions; - for (var id in other) { - var status = this.addable(other[id]); - if (status === false) { - return false; - } - if (status === true) { - // Adding the filter will override another value. - if (!additions) additions = []; - additions.push(other[id]); - } - } - - // Adding the other filters doesn't make this filterset invalid, but it - // doesn't add anything to it either. - if (!additions) return null; - - // We can successfully add all filters. Now clone the filterset and add the - // new rules. - var clone = new tree.Filterset(); - - // We can add the rules that are already present without going through the - // add function as a Filterset is always in it's simplest canonical form. - for (var id in this) { - clone[id] = this[id]; - } - - // Only add new filters that actually change the filter. - while (id = additions.shift()) { - clone.add(id); - } - - return clone; - } -}); - -/** - * Returns true when the new filter can be added, false otherwise. - */ -Object.defineProperty(tree.Filterset.prototype, 'addable', { - enumerable: false, - value: function(filter) { - var key = filter.key, value = filter.val; - - switch (filter.op) { - case '=': - if (key + '=' in this) return (this[key + '='].val != value) ? false : null; - if (key + '!=' + value in this) return false; - if (key + '>' in this && this[key + '>'].val >= value) return false; - if (key + '<' in this && this[key + '<'].val <= value) return false; - if (key + '>=' in this && this[key + '>='].val > value) return false; - if (key + '<=' in this && this[key + '<='].val < value) return false; - return true; - - case '!=': - if (key + '=' in this) return (this[key + '='].val == value) ? false : null; - if (key + '!=' + value in this) return null; - if (key + '>' in this && this[key + '>'].val >= value) return null; - if (key + '<' in this && this[key + '<'].val <= value) return null; - if (key + '>=' in this && this[key + '>='].val > value) return null; - if (key + '<=' in this && this[key + '<='].val < value) return null; - return true; - - case '>': - if (key + '=' in this) return (this[key + '='].val <= value) ? false : null; - if (key + '<' in this && this[key + '<'].val <= value) return false; - if (key + '<=' in this && this[key + '<='].val <= value) return false; - if (key + '>' in this && this[key + '>'].val >= value) return null; - if (key + '>=' in this && this[key + '>='].val > value) return null; - return true; - - case '>=': - if (key + '=' in this) return (this[key + '='].val < value) ? false : null; - if (key + '<' in this && this[key + '<'].val <= value) return false; - if (key + '<=' in this && this[key + '<='].val < value) return false; - if (key + '>' in this && this[key + '>'].val >= value) return null; - if (key + '>=' in this && this[key + '>='].val >= value) return null; - return true; - - case '<': - if (key + '=' in this) return (this[key + '='].val >= value) ? false : null; - if (key + '>' in this && this[key + '>'].val >= value) return false; - if (key + '>=' in this && this[key + '>='].val >= value) return false; - if (key + '<' in this && this[key + '<'].val <= value) return null; - if (key + '<=' in this && this[key + '<='].val < value) return null; - return true; - - case '<=': - if (key + '=' in this) return (this[key + '='].val > value) ? false : null; - if (key + '>' in this && this[key + '>'].val >= value) return false; - if (key + '>=' in this && this[key + '>='].val > value) return false; - if (key + '<' in this && this[key + '<'].val <= value) return null; - if (key + '<=' in this && this[key + '<='].val <= value) return null; - return true; - } - } -}); - -/** - * Only call this function for filters that have been cleared by .addable(). - */ -Object.defineProperty(tree.Filterset.prototype, 'add', { - enumerable: false, - value: function(filter) { - var key = filter.key; - - switch (filter.op) { - case '=': - for (var id in this) { - if (this[id].key == key) { - delete this[id]; - } - } - this[key + '='] = filter; - break; - - case '!=': - this[key + '!=' + filter.val] = filter; - break; - - case '=~': - this[key + '=~' + filter.val] = filter; - break; - - case '>': - // If there are other filters that are also > - // but are less than this one, they don't matter, so - // remove them. - for (var id in this) { - if (this[id].key == key && this[id].val <= filter.val) { - delete this[id]; - } - } - this[key + '>'] = filter; - break; - - case '>=': - for (var id in this) { - if (this[id].key == key && this[id].val < filter.val) { - delete this[id]; - } - } - if (key + '!=' + filter.val in this) { - delete this[key + '!=' + filter.val]; - filter.op = '>'; - this[key + '>'] = filter; - } - else { - this[key + '>='] = filter; - } - break; - - case '<': - for (var id in this) { - if (this[id].key == key && this[id].val >= filter.val) { - delete this[id]; - } - } - this[key + '<'] = filter; - break; - - case '<=': - for (var id in this) { - if (this[id].key == key && this[id].val > filter.val) { - delete this[id]; - } - } - if (key + '!=' + filter.val in this) { - delete this[key + '!=' + filter.val]; - filter.op = '<'; - this[key + '<'] = filter; - } - else { - this[key + '<='] = filter; - } - break; - } - } -}); -(function(tree) { - -tree._getFontSet = function(env, fonts) { - var find_existing = function(fonts) { - var findFonts = fonts.join(''); - for (var i = 0; i < env.effects.length; i++) { - if (findFonts == env.effects[i].fonts.join('')) { - return env.effects[i]; - } - } - }; - - var existing = false; - if (existing = find_existing(fonts)) { - return existing; - } else { - var new_fontset = new tree.FontSet(env, fonts); - env.effects.push(new_fontset); - return new_fontset; - } -}; - -tree.FontSet = function FontSet(env, fonts) { - this.fonts = fonts; - this.name = 'fontset-' + env.effects.length; -}; - -tree.FontSet.prototype.toXML = function(env) { - return '\n' + - this.fonts.map(function(f) { - return ' '; - }).join('\n') + - '\n'; -}; - -})(require('../tree')); -var tree = require('../tree'); - -// Storage for Frame offset value -// and stores them as bit-sequences so that they can be combined, -// inverted, and compared quickly. -tree.FrameOffset = function(op, value, index) { - value = parseInt(value, 10); - if (value > tree.FrameOffset.max || value <= 0) { - throw { - message: 'Only frame-offset levels between 1 and ' + - tree.FrameOffset.max + ' supported.', - index: index - }; - } - - if (op !== '=') { - throw { - message: 'only = operator is supported for frame-offset', - index: index - }; - } - return value; -}; - -tree.FrameOffset.max = 32; -tree.FrameOffset.none = 0; - -(function(tree) { -// -// RGB Colors - #ff0014, #eee -// -tree.ImageFilter = function ImageFilter(filter, args) { - this.is = 'imagefilter'; - this.filter = filter; - this.args = args || null; -}; -tree.ImageFilter.prototype = { - eval: function() { return this; }, - - toString: function() { - if (this.args) { - return this.filter + ':' + this.args.join(','); - } else { - return this.filter; - } - } -}; - - -})(require('../tree')); -(function (tree) { -tree.Invalid = function Invalid(chunk, index, message) { - this.chunk = chunk; - this.index = index; - this.type = 'syntax'; - this.message = message || "Invalid code: " + this.chunk; -}; - -tree.Invalid.prototype.eval = function(env) { - env.error({ - chunk: this.chunk, - index: this.index, - type: 'syntax', - message: this.message || "Invalid code: " + this.chunk - }); - return { - is: 'undefined' - }; -}; -})(require('../tree')); -(function(tree) { - -tree.Keyword = function Keyword(value) { - this.value = value; - var special = { - 'transparent': 'color', - 'true': 'boolean', - 'false': 'boolean' - }; - this.is = special[value] ? special[value] : 'keyword'; -}; -tree.Keyword.prototype = { - eval: function() { return this; }, - toString: function() { return this.value; } -}; - -})(require('../tree')); -(function(tree) { - -tree.Layer = function Layer(obj) { - this.name = obj.name; - this.status = obj.status; - this.styles = obj.styles; - this.properties = obj.properties || {}; - this.srs = obj.srs; - this.datasource = obj.Datasource; -}; - -tree.Layer.prototype.toXML = function() { - var dsoptions = []; - for (var i in this.datasource) { - dsoptions.push(''); - } - - var prop_string = ''; - for (var i in this.properties) { - prop_string += ' ' + i + '="' + this.properties[i] + '"\n'; - } - - return '\n ' + - this.styles.reverse().map(function(s) { - return '' + s + ''; - }).join('\n ') + - '\n \n ' + - dsoptions.join('\n ') + - '\n \n' + - ' \n'; -}; - -})(require('../tree')); -// A literal is a literal string for Mapnik - the -// result of the combination of a `tree.Field` with any -// other type. -(function(tree) { - -tree.Literal = function Field(content) { - this.value = content || ''; - this.is = 'field'; -}; - -tree.Literal.prototype = { - toString: function() { - return this.value; - }, - 'eval': function() { - return this; - } -}; - -})(require('../tree')); -(function(tree) { - -tree.Operation = function Operation(op, operands, index) { - this.op = op.trim(); - this.operands = operands; - this.index = index; - this.is = 'operation'; -}; - -tree.Operation.prototype.eval = function(env) { - var a = this.operands[0].eval(env), - b = this.operands[1].eval(env), - temp; - - if (a.is === 'undefined' || b.is === 'undefined') { - return { - is: 'undefined', - value: 'undefined' - }; - } - - if (a instanceof tree.Dimension && b instanceof tree.Color) { - if (this.op === '*' || this.op === '+') { - temp = b, b = a, a = temp; - } else { - env.error({ - name: "OperationError", - message: "Can't substract or divide a color from a number", - index: this.index - }); - } - } - - // Only concatenate plain strings, because this is easily - // pre-processed - if (a instanceof tree.Quoted && b instanceof tree.Quoted && this.op !== '+') { - env.error({ - message: "Can't subtract, divide, or multiply strings.", - index: this.index, - type: 'runtime', - filename: this.filename - }); - return { - is: 'undefined', - value: 'undefined' - }; - } - - // Fields, literals, dimensions, and quoted strings can be combined. - if (a instanceof tree.Field || b instanceof tree.Field || - a instanceof tree.Literal || b instanceof tree.Literal) { - if (a.is === 'color' || b.is === 'color') { - env.error({ - message: "Can't subtract, divide, or multiply colors in expressions.", - index: this.index, - type: 'runtime', - filename: this.filename - }); - return { - is: 'undefined', - value: 'undefined' - }; - } else { - return new tree.Literal(a.eval(env).toString(true) + this.op + b.eval(env).toString(true)); - } - } - - return a.operate(this.op, b); -}; - -tree.operate = function(op, a, b) { - switch (op) { - case '+': return a + b; - case '-': return a - b; - case '*': return a * b; - case '%': return a % b; - case '/': return a / b; - } -}; - -})(require('../tree')); -(function(tree) { - -tree.Quoted = function Quoted(content) { - this.value = content || ''; - this.is = 'string'; -}; - -tree.Quoted.prototype = { - toString: function(quotes) { - var xmlvalue = this.value.replace(/\'/g, '''); - return (quotes === true) ? "'" + xmlvalue + "'" : this.value; - }, - - 'eval': function() { - return this; - }, - - operate: function(op, other) { - return new tree.Quoted(true, - tree.operate(op, this.toString(), other.toString(this.contains_field))); - } -}; - -})(require('../tree')); -/* - * Carto pulls in a reference from the `mapnik-reference` - * module. This file builds indexes from that file for its various - * options, and provides validation methods for property: value - * combinations. - */ -(function(tree) { - - -var _ = require('underscore'); -var reference = require('mapnik-reference'); - -tree.Reference = { - data: reference.version.latest -}; - -tree.Reference.set = function(ref, version) { - reference = ref; - tree.Reference.setVersion(version || 'latest'); -}; - -tree.Reference.setVersion = function(version) { - tree.Reference.data = reference.version[version]; -}; - -tree.Reference.required_prop_list_cache = {}; - -tree.Reference.selectors = tree.Reference.selectors || (function() { - var list = []; - for (var i in tree.Reference.data.symbolizers) { - for (var j in tree.Reference.data.symbolizers[i]) { - if (tree.Reference.data.symbolizers[i][j].hasOwnProperty('css')) { - list.push(tree.Reference.data.symbolizers[i][j].css); - } - } - } - return list; -})(); - -tree.Reference.validSelector = function(selector) { - return tree.Reference.selectors.indexOf(selector) !== -1; -}; - -tree.Reference.selectorName = function(selector) { - for (var i in tree.Reference.data.symbolizers) { - for (var j in tree.Reference.data.symbolizers[i]) { - if (selector == tree.Reference.data.symbolizers[i][j].css) { - return j; - } - } - } -}; - -tree.Reference.selector = function(selector) { - for (var i in tree.Reference.data.symbolizers) { - for (var j in tree.Reference.data.symbolizers[i]) { - if (selector == tree.Reference.data.symbolizers[i][j].css) { - return tree.Reference.data.symbolizers[i][j]; - } - } - } -}; - -tree.Reference.symbolizer = function(selector) { - for (var i in tree.Reference.data.symbolizers) { - for (var j in tree.Reference.data.symbolizers[i]) { - if (selector == tree.Reference.data.symbolizers[i][j].css) { - return i; - } - } - } -}; - -/* - * For transform properties and image-filters, - * mapnik has its own functions. - */ -tree.Reference.mapnikFunction = function(name) { - var functions = []; - for (var i in tree.Reference.data.symbolizers) { - for (var j in tree.Reference.data.symbolizers[i]) { - if (tree.Reference.data.symbolizers[i][j].type === 'functions') { - functions = functions.concat(tree.Reference.data.symbolizers[i][j].functions); - } - } - } - return _.find(functions, function(f) { - return f[0] === name; - }); -}; - -tree.Reference.requiredPropertyList = function(symbolizer_name) { - if (this.required_prop_list_cache[symbolizer_name]) { - return this.required_prop_list_cache[symbolizer_name]; - } - var properties = []; - for (var j in tree.Reference.data.symbolizers[symbolizer_name]) { - if (tree.Reference.data.symbolizers[symbolizer_name][j].required) { - properties.push(tree.Reference.data.symbolizers[symbolizer_name][j].css); - } - } - return this.required_prop_list_cache[symbolizer_name] = properties; -}; - -tree.Reference.requiredProperties = function(symbolizer_name, rules) { - var req = tree.Reference.requiredPropertyList(symbolizer_name); - for (var i in req) { - if (!(req[i] in rules)) { - return 'Property ' + req[i] + ' required for defining ' + - symbolizer_name + ' styles.'; - } - } -}; - -/** - * TODO: finish implementation - this is dead code - */ -tree.Reference._validateValue = { - 'font': function(env, value) { - if (env.validation_data && env.validation_data.fonts) { - return env.validation_data.fonts.indexOf(value) != -1; - } else { - return true; - } - } -}; - -tree.Reference.isFont = function(selector) { - return tree.Reference.selector(selector).validate == 'font'; -}; - -tree.Reference.validValue = function(env, selector, value) { - var i, j; - // TODO: handle in reusable way - if (!tree.Reference.selector(selector)) { - return false; - } else if (value.value[0].is == 'keyword') { - return tree.Reference - .selector(selector).type - .indexOf(value.value[0].value) !== -1; - } else if (value.value[0].is == 'undefined') { - // caught earlier in the chain - ignore here so that - // error is not overridden - return true; - } else if (tree.Reference.selector(selector).type == 'numbers') { - for (i in value.value) { - if (value.value[i].is !== 'float') { - return false; - } - } - return true; - } else if (tree.Reference.selector(selector).type == 'functions') { - // For backwards compatibility, you can specify a string for `functions`-compatible - // values, though they will not be validated. - if (value.value[0].is === 'string') { - return true; - } else { - for (i in value.value) { - for (j in value.value[i].value) { - if (value.value[i].value[j].is !== 'call') { - return false; - } - var f = _.find(tree.Reference - .selector(selector).functions, function(x) { - return x[0] == value.value[i].value[j].name; - }); - // This filter is unknown - if (!f) return false; - // The filter has been given an incorrect number of arguments - if (f[1] !== value.value[i].value[j].args.length) return false; - } - } - return true; - } - } else if (tree.Reference.selector(selector).type == 'expression') { - return true; - } else if (tree.Reference.selector(selector).type === 'unsigned') { - if (value.value[0].is === 'float') { - value.value[0].round(); - return true; - } else { - return false; - } - } else { - if (tree.Reference.selector(selector).validate) { - var valid = false; - for (i = 0; i < value.value.length; i++) { - if (tree.Reference.selector(selector).type == value.value[i].is && - tree.Reference - ._validateValue - [tree.Reference.selector(selector).validate] - (env, value.value[i].value)) { - return true; - } - } - return valid; - } else { - return tree.Reference.selector(selector).type == value.value[0].is; - } - } -}; - -})(require('../tree')); -(function(tree) { -tree.Rule = function Rule(name, value, index, filename) { - var parts = name.split('/'); - this.name = parts.pop(); - this.instance = parts.length ? parts[0] : '__default__'; - this.value = (value instanceof tree.Value) ? - value : new tree.Value([value]); - this.index = index; - this.symbolizer = tree.Reference.symbolizer(this.name); - this.filename = filename; - this.variable = (name.charAt(0) === '@'); -}; - -tree.Rule.prototype.clone = function() { - var clone = Object.create(tree.Rule.prototype); - clone.name = this.name; - clone.value = this.value; - clone.index = this.index; - clone.instance = this.instance; - clone.symbolizer = this.symbolizer; - clone.filename = this.filename; - clone.variable = this.variable; - return clone; -}; - -tree.Rule.prototype.updateID = function() { - return this.id = this.zoom + '#' + this.name; -}; - -tree.Rule.prototype.toString = function() { - return '[' + tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value; -}; - -// second argument, if true, outputs the value of this -// rule without the usual attribute="content" wrapping. Right -// now this is just for the TextSymbolizer, but applies to other -// properties in reference.json which specify serialization=content -tree.Rule.prototype.toXML = function(env, content, sep, format) { - if (!tree.Reference.validSelector(this.name)) { - return env.error({ - message: "Unrecognized rule: " + this.name, - index: this.index, - type: 'syntax', - filename: this.filename - }); - } - - if ((this.value instanceof tree.Value) && - !tree.Reference.validValue(env, this.name, this.value)) { - if (!tree.Reference.selector(this.name)) { - return env.error({ - message: 'Unrecognized property: ' + - this.name, - index: this.index, - type: 'syntax', - filename: this.filename - }); - } else { - return env.error({ - message: 'Invalid value for ' + - this.name + - ', a valid ' + - (tree.Reference.selector(this.name).validate || - tree.Reference.selector(this.name).type) + - ' is expected. ' + this.value + - ' was given.', - index: this.index, - type: 'syntax', - filename: this.filename - }); - } - } - - if (this.variable) { - return ''; - } else if (tree.Reference.isFont(this.name) && this.value.value.length > 1) { - var f = tree._getFontSet(env, this.value.value); - return 'fontset-name="' + f.name + '"'; - } else if (content) { - return this.value.toString(env, this.name, sep); - } else { - return tree.Reference.selectorName(this.name) + - '="' + - this.value.toString(env, this.name) + - '"'; - } -}; - -/** - * TODO: Rule eval chain should add fontsets to env.frames - */ -tree.Rule.prototype['eval'] = function(context) { - return new tree.Rule(this.name, - this.value['eval'](context), - this.index, - this.filename); -}; - -})(require('../tree')); -(function(tree) { - -tree.Ruleset = function Ruleset(selectors, rules) { - this.selectors = selectors; - this.rules = rules; - // static cache of find() function - this._lookups = {}; -}; -tree.Ruleset.prototype = { - eval: function(env) { - var ruleset = new tree.Ruleset(this.selectors, this.rules.slice(0)); - ruleset.root = this.root; - - // push the current ruleset to the frames stack - env.frames.unshift(ruleset); - - // Evaluate imports - if (ruleset.root) { - for (var i = 0; i < ruleset.rules.length; i++) { - if (ruleset.rules[i] instanceof tree.Import) { - Array.prototype.splice - .apply(ruleset.rules, [i, 1].concat(ruleset.rules[i].eval(env))); - } - } - } - - // Evaluate everything else - for (var i = 0, rule; i < ruleset.rules.length; i++) { - rule = ruleset.rules[i]; - ruleset.rules[i] = rule.eval ? rule.eval(env) : rule; - } - - // Pop the stack - env.frames.shift(); - - return ruleset; - }, - match: function(args) { - return !args || args.length === 0; - }, - variables: function() { - if (this._variables) { return this._variables; } - else { - return this._variables = this.rules.reduce(function(hash, r) { - if (r instanceof tree.Rule && r.variable === true) { - hash[r.name] = r; - } - return hash; - }, {}); - } - }, - variable: function(name) { - return this.variables()[name]; - }, - /** - * Extend this rule by adding rules from another ruleset - * - * Currently this is designed to accept less specific - * rules and add their values only if this ruleset doesn't - * contain them. - */ - - rulesets: function() { - if (this._rulesets) { return this._rulesets; } - else { - return this._rulesets = this.rules.filter(function(r) { - return (r instanceof tree.Ruleset); - }); - } - }, - find: function(selector, self) { - self = self || this; - var rules = [], rule, match, - key = selector.toString(); - - if (key in this._lookups) { return this._lookups[key]; } - - this.rulesets().forEach(function(rule) { - if (rule !== self) { - for (var j = 0; j < rule.selectors.length; j++) { - if (match = selector.match(rule.selectors[j])) { - if (selector.elements.length > 1) { - Array.prototype.push.apply(rules, rule.find( - new tree.Selector(null, null, null, selector.elements.slice(1)), self)); - } else { - rules.push(rule); - } - break; - } - } - } - }); - return this._lookups[key] = rules; - }, - flatten: function(result, parents, env) { - var selectors = []; - if (this.selectors.length === 0) { - env.frames = env.frames.concat(this.rules); - } - for (var i = 0; i < this.selectors.length; i++) { - var child = this.selectors[i]; - - // This is an invalid filterset. - if (!child.filters) continue; - - if (parents.length) { - for (var j = 0; j < parents.length; j++) { - var parent = parents[j]; - - var mergedFilters = parent.filters.cloneWith(child.filters); - if (mergedFilters === null) { - // Filters could be added, but they didn't change the - // filters. This means that we only have to clone when - // the zoom levels or the attachment is different too. - if (parent.zoom === (parent.zoom & child.zoom) && - parent.frame_offset === child.frame_offset && - parent.attachment === child.attachment) { - continue; - } else { - mergedFilters = parent.filters; - } - } else if (!mergedFilters) { - // The merged filters are invalid, that means we don't - // have to clone. - continue; - } - - var clone = Object.create(tree.Selector.prototype); - clone.filters = mergedFilters; - clone.zoom = parent.zoom & child.zoom; - clone.frame_offset = child.frame_offset; - clone.elements = parent.elements.concat(child.elements); - if (parent.attachment && child.attachment) { - clone.attachment = parent.attachment + '/' + child.attachment; - } - else clone.attachment = child.attachment || parent.attachment; - clone.conditions = parent.conditions + child.conditions; - clone.index = child.index; - selectors.push(clone); - } - } else { - selectors.push(child); - } - } - - var rules = []; - for (var i = 0; i < this.rules.length; i++) { - var rule = this.rules[i]; - - if (rule instanceof tree.Ruleset) { - rule.flatten(result, selectors, env); - } else if (rule instanceof tree.Rule) { - rules.push(rule); - } else if (rule instanceof tree.Invalid) { - env.error(rule); - } - } - - var index = rules.length ? rules[0].index : false; - for (var i = 0; i < selectors.length; i++) { - // For specificity sort, use the position of the first rule to allow - // defining attachments that are under current element as a descendant - // selector. - if (index !== false) { - selectors[i].index = index; - } - result.push(new tree.Definition(selectors[i], rules.slice())); - } - - return result; - } -}; -})(require('../tree')); -var assert = require('assert'); - -(function(tree) { - -tree.Selector = function Selector(filters, zoom, frame_offset, elements, attachment, conditions, index) { - this.elements = elements || []; - this.attachment = attachment; - this.filters = filters || {}; - this.frame_offset = frame_offset; - this.zoom = typeof zoom !== 'undefined' ? zoom : tree.Zoom.all; - this.conditions = conditions; - this.index = index; -}; - -/** - * Determine the specificity of this selector - * based on the specificity of its elements - calling - * Element.specificity() in order to do so - * - * [ID, Class, Filters, Position in document] - */ -tree.Selector.prototype.specificity = function() { - return this.elements.reduce(function(memo, e) { - var spec = e.specificity(); - memo[0] += spec[0]; - memo[1] += spec[1]; - return memo; - }, [0, 0, this.conditions, this.index]); -}; - -})(require('../tree')); -(function(tree) { -var _ = require('underscore'); - -tree.Style = function Style(name, attachment, definitions) { - this.attachment = attachment; - this.definitions = definitions; - this.name = name + (attachment !== '__default__' ? '-' + attachment : ''); -}; - -tree.Style.prototype.toXML = function(env) { - var existing = {}; - - var image_filters = _.flatten(this.definitions.map(function(definition) { - return definition.rules.filter(function(rule) { - return (rule.name === 'image-filters'); - }); - })); - - var comp_op = _.flatten(this.definitions.map(function(definition) { - return definition.rules.filter(function(rule) { - return (rule.name === 'composite-operation'); - }); - })); - - var opacity = _.flatten(this.definitions.map(function(definition) { - return definition.rules.filter(function(rule) { - return (rule.name === 'opacity'); - }); - })); - - var rules = this.definitions.map(function(definition) { - return definition.toXML(env, existing); - }); - - var attrs_xml = ''; - - if (image_filters.length) { - attrs_xml += ' image-filters="' + image_filters.map(function(f) { - return f.eval(env).toXML(env, true, ' ', 'image-filter'); - }).join(' ') + '" '; - } - - if (comp_op.length) { - attrs_xml += ' comp-op="' + comp_op[0].value.eval(env).toString() + '" '; - } - - if (opacity.length) { - attrs_xml += ' opacity="' + opacity[0].value.eval(env).toString() + '" '; - } - - return ''; -}; - -})(require('../tree')); -(function(tree) { - -tree.URL = function URL(val, paths) { - this.value = val; - this.paths = paths; - this.is = 'uri'; -}; -tree.URL.prototype = { - toString: function() { - return this.value.toString(); - }, - eval: function(ctx) { - return new tree.URL(this.value.eval(ctx), this.paths); - } -}; - -})(require('../tree')); -(function(tree) { - -tree.Value = function Value(value) { - this.value = value; - this.is = 'value'; -}; -tree.Value.prototype = { - eval: function(env) { - if (this.value.length === 1) { - return this.value[0].eval(env); - } else { - return new tree.Value(this.value.map(function(v) { - return v.eval(env); - })); - } - }, - toString: function(env, selector, sep, format) { - return this.value.map(function(e) { - return e.toString(env, format); - }).join(sep || ', '); - }, - clone: function() { - var obj = Object.create(tree.Value.prototype); - if (Array.isArray(obj)) obj.value = this.value.slice(); - else obj.value = this.value; - obj.is = this.is; - return obj; - } -}; - -})(require('../tree')); -(function(tree) { - -tree.Variable = function Variable(name, index, filename) { - this.name = name; - this.index = index; - this.filename = filename; -}; -tree.Variable.prototype = { - eval: function(env) { - var variable, - v, - that = this, - name = this.name; - - if (this._css) return this._css; - - var thisframe = env.frames.filter(function(f) { - return f.name == that.name; - }); - if (thisframe.length) { - return thisframe[0].value.eval(env); - } else { - env.error({ - message: 'variable ' + this.name + ' is undefined', - index: this.index, - type: 'runtime', - filename: this.filename - }); - return { - is: 'undefined', - value: 'undefined' - }; - } - } -}; - -})(require('../tree')); -var tree = require('../tree'); - -// Storage for zoom ranges. Only supports continuous ranges, -// and stores them as bit-sequences so that they can be combined, -// inverted, and compared quickly. -tree.Zoom = function(op, value, index) { - value = parseInt(value, 10); - if (value > tree.Zoom.maxZoom || value < 0) { - throw { - message: 'Only zoom levels between 0 and ' + - tree.Zoom.maxZoom + ' supported.', - index: index - }; - } - - var start = 0, - end = Infinity, - zoom = 0; - - switch (op) { - case '=': - return 1 << value; - case '>': - start = value + 1; - break; - case '>=': - start = value; - break; - case '<': - end = value - 1; - break; - case '<=': - end = value; - break; - } - for (var i = 0; i <= tree.Zoom.maxZoom; i++) { - if (i >= start && i <= end) { - zoom |= (1 << i); - } - } - return zoom; -}; - -// Covers all zoomlevels from 0 to 22 -tree.Zoom.all = 0x7FFFFF; - -tree.Zoom.maxZoom = 22; - -tree.Zoom.ranges = { - 0: 1000000000, - 1: 500000000, - 2: 200000000, - 3: 100000000, - 4: 50000000, - 5: 25000000, - 6: 12500000, - 7: 6500000, - 8: 3000000, - 9: 1500000, - 10: 750000, - 11: 400000, - 12: 200000, - 13: 100000, - 14: 50000, - 15: 25000, - 16: 12500, - 17: 5000, - 18: 2500, - 19: 1500, - 20: 750, - 21: 500, - 22: 250, - 23: 100 -}; - -// Only works for single range zooms. `[XXX....XXXXX.........]` is invalid. -tree.Zoom.toXML = function(zoom) { - var conditions = []; - if (zoom != tree.Zoom.all) { - var start = null, end = null; - for (var i = 0; i <= tree.Zoom.maxZoom; i++) { - if (zoom & (1 << i)) { - if (start === null) start = i; - end = i; - } - } - if (start > 0) conditions.push(' ' + - tree.Zoom.ranges[start] + '\n'); - if (end < 22) conditions.push(' ' + - tree.Zoom.ranges[end + 1] + '\n'); - } - return conditions; -}; - - -tree.Zoom.toString = function(zoom) { - var str = ''; - for (var i = 0; i <= tree.Zoom.maxZoom; i++) { - str += (zoom & (1 << i)) ? 'X' : '.'; - } - return str; -}; -(function (tree) { - -tree.functions = { - rgb: function (r, g, b) { - return this.rgba(r, g, b, 1.0); - }, - rgba: function (r, g, b, a) { - var rgb = [r, g, b].map(function (c) { return number(c); }); - a = number(a); - return new tree.Color(rgb, a); - }, - hsl: function (h, s, l) { - return this.hsla(h, s, l, 1.0); - }, - hsla: function (h, s, l, a) { - h = (number(h) % 360) / 360; - s = number(s); l = number(l); a = number(a); - - var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - var m1 = l * 2 - m2; - - return this.rgba(hue(h + 1/3) * 255, - hue(h) * 255, - hue(h - 1/3) * 255, - a); - - function hue(h) { - h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h); - if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; - else if (h * 2 < 1) return m2; - else if (h * 3 < 2) return m1 + (m2 - m1) * (2/3 - h) * 6; - else return m1; - } - }, - hue: function (color) { - return new tree.Dimension(Math.round(color.toHSL().h)); - }, - saturation: function (color) { - return new tree.Dimension(Math.round(color.toHSL().s * 100), '%'); - }, - lightness: function (color) { - return new tree.Dimension(Math.round(color.toHSL().l * 100), '%'); - }, - alpha: function (color) { - return new tree.Dimension(color.toHSL().a); - }, - saturate: function (color, amount) { - var hsl = color.toHSL(); - - hsl.s += amount.value / 100; - hsl.s = clamp(hsl.s); - return hsla(hsl); - }, - desaturate: function (color, amount) { - var hsl = color.toHSL(); - - hsl.s -= amount.value / 100; - hsl.s = clamp(hsl.s); - return hsla(hsl); - }, - lighten: function (color, amount) { - var hsl = color.toHSL(); - - hsl.l += amount.value / 100; - hsl.l = clamp(hsl.l); - return hsla(hsl); - }, - darken: function (color, amount) { - var hsl = color.toHSL(); - - hsl.l -= amount.value / 100; - hsl.l = clamp(hsl.l); - return hsla(hsl); - }, - fadein: function (color, amount) { - var hsl = color.toHSL(); - - hsl.a += amount.value / 100; - hsl.a = clamp(hsl.a); - return hsla(hsl); - }, - fadeout: function (color, amount) { - var hsl = color.toHSL(); - - hsl.a -= amount.value / 100; - hsl.a = clamp(hsl.a); - return hsla(hsl); - }, - spin: function (color, amount) { - var hsl = color.toHSL(); - var hue = (hsl.h + amount.value) % 360; - - hsl.h = hue < 0 ? 360 + hue : hue; - - return hsla(hsl); - }, - replace: function (entity, a, b) { - if (entity.is === 'field') { - return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')'; - } else { - return entity.replace(a, b); - } - }, - // - // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein - // http://sass-lang.com - // - mix: function (color1, color2, weight) { - var p = weight.value / 100.0; - var w = p * 2 - 1; - var a = color1.toHSL().a - color2.toHSL().a; - - var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; - var w2 = 1 - w1; - - var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2, - color1.rgb[1] * w1 + color2.rgb[1] * w2, - color1.rgb[2] * w1 + color2.rgb[2] * w2]; - - var alpha = color1.alpha * p + color2.alpha * (1 - p); - - return new tree.Color(rgb, alpha); - }, - greyscale: function (color) { - return this.desaturate(color, new tree.Dimension(100)); - }, - '%': function (quoted /* arg, arg, ...*/) { - var args = Array.prototype.slice.call(arguments, 1), - str = quoted.value; - - for (var i = 0; i < args.length; i++) { - str = str.replace(/%s/, args[i].value) - .replace(/%[da]/, args[i].toString()); - } - str = str.replace(/%%/g, '%'); - return new tree.Quoted(str); - } -}; - -var image_filter_functors = [ - 'emboss', 'blur', 'gray', 'sobel', 'edge-detect', - 'x-gradient', 'y-gradient', 'sharpen']; - -for (var i = 0; i < image_filter_functors.length; i++) { - var f = image_filter_functors[i]; - tree.functions[f] = (function(f) { - return function() { - return new tree.ImageFilter(f); - }; - })(f); -} - -tree.functions['agg-stack-blur'] = function(x, y) { - return new tree.ImageFilter('agg-stack-blur', [x, y]); -}; - -function hsla(hsla) { - return tree.functions.hsla(hsla.h, hsla.s, hsla.l, hsla.a); -} - -function number(n) { - if (n instanceof tree.Dimension) { - return parseFloat(n.unit == '%' ? n.value / 100 : n.value); - } else if (typeof(n) === 'number') { - return n; - } else { - throw new Error('Color functions take numbers as parameters.'); - } -} - -function clamp(val) { - return Math.min(1, Math.max(0, val)); -} - -})(require('./tree')); -(function(carto) { -var tree = require('./tree'); -var _ = require('underscore'); - -// monkey patch less classes -tree.Value.prototype.toJS = function() { - //var v = this.value[0].value[0]; - var val = this.eval() - var v = val.toString(); - if(val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') { - v = "'" + v + "'"; - } else if (val.is === 'field') { - // replace [varuable] by ctx['variable'] - v = v.replace(/\[(.*)\]/g, "data['\$1']") - } - return "_value = " + v + ";"; -}; - -Object.defineProperty(tree.Filterset.prototype, 'toJS', { - enumerable: false, - value: function(env) { - var opMap = { - '=': '===' - }; - return _.map(this, function(filter) { - var op = filter.op; - if(op in opMap) { - op = opMap[op]; - } - var val = filter.val; - if(filter._val !== undefined) { - val = filter._val.toString(true); - } - - var attrs = "data"; - return attrs + "." + filter.key + " " + op + " " + val; - }).join(' && '); - } -}); - -tree.Definition.prototype.toJS = function() { - var shaderAttrs = {}; - - // merge conditions from filters with zoom condition of the - // definition - var zoom = "(" + this.zoom + " & (1 << ctx.zoom))"; - var frame_offset = this.frame_offset; - var _if = this.filters.toJS(); - var filters = [zoom]; - if(_if) filters.push(_if); - if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset); - _if = filters.join(" && "); - _.each(this.rules, function(rule) { - if(rule instanceof tree.Rule) { - shaderAttrs[rule.name] = shaderAttrs[rule.name] || []; - if (_if) { - shaderAttrs[rule.name].push( - "if(" + _if + "){" + rule.value.toJS() + "}" - ); - } else { - shaderAttrs[rule.name].push(rule.value.toJS()); - } - } else { - if (rule instanceof tree.Ruleset) { - var sh = rule.toJS(); - for(var v in sh) { - shaderAttrs[v] = shaderAttrs[v] || []; - for(var attr in sh[v]) { - shaderAttrs[v].push(sh[v][attr]); - } - } - } - } - }); - return shaderAttrs; -}; - - -function CartoCSS(style, options) { - this.options = options || {}; - if(style) { - this.setStyle(style); - } -} - -CartoCSS.Layer = function(shader, options) { - this.options = options; - this.shader = shader; -}; - -CartoCSS.renderers = {}; - -CartoCSS.renderers['svg'] = { - - maps: {}, - - transform: function(src) { - var target = {}; - for(var i in src) { - var t = this.maps[i]; - if(t) { - target[t] = src[i]; - } else { - // copy it - target[i] = src[i]; - } - } - return target; - } - -}; - -CartoCSS.renderers['canvas-2d'] = { - - maps: { - // marker - 'marker-width': 'point-radius', - 'marker-line-color': 'strokeStyle', - 'marker-line-width': 'lineWidth', - 'marker-line-opacity': 'strokeOpacity', - 'marker-fill-opacity': 'fillOpacity', - 'marker-opacity': 'fillOpacity', - 'marker-fill': 'fillStyle', - 'marker-file': function(attr) { - var img = new Image(); - img.src = attr; - return img; - }, - // point - 'point-color': 'fillStyle', - 'point-file': function(attr) { - var img = new Image(); - img.src = attr; - return img; - }, - // line - 'line-color': 'strokeStyle', - 'line-width': 'lineWidth', - 'line-opacity': 'globalAlpha', - // polygon - 'polygon-fill': 'fillStyle', - 'polygon-opacity': 'globalAlpha', - 'comp-op': 'comp-op' - }, - - transform: function(src) { - var target = {}; - for(var i in src) { - var t = this.maps[i]; - if(t) { - if(typeof(t) === 'function') { - target[i] = t(src[i]); - } else { - target[t] = src[i]; - } - } else { - // copy it - target[i] = src[i]; - } - } - return target; - } -} - -var renderer = CartoCSS.renderers['svg']; -var ref = require('mapnik-reference').version.latest; -var to_load = ['polygon', 'line', 'point', 'markers']; -for(var ss in to_load) { - var s = to_load[ss]; - for(var i in ref.symbolizers[s]) { - renderer.maps[ref.symbolizers[s][i].css] = i; - } -} - - -CartoCSS.Layer.prototype = { - - fullName: function() { - return this.shader.attachment; - }, - - name: function() { - return this.fullName().split('::')[0]; - }, - - // frames this layer need to be rendered - frames: function() { - return this.shader.frames; - }, - - attachment: function() { - return this.fullName().split('::')[1]; - }, - - eval: function(prop) { - var p = this.shader[prop]; - if (!p) return; - return p({}, { zoom: 0, 'frame-offset': 0 }); - }, - - /* - * `target`: style, 'svg', 'canvas-2d'... - * `props`: feature properties - * `context`: rendering properties, i.e zoom - */ - getStyle: function(target, props, context) { - var style = {}; - for(var i in this.shader) { - if(i !== 'attachment' && i !== 'zoom' && i !== 'frames') { - style[i] = this.shader[i](props, context); - } - } - return CartoCSS.renderers[target].transform(style); - }, - - /** - * returns true if a feature needs to be rendered - */ - filter: function(featureType, props, context) { - for(var i in this.shader) { - var s = this.shader[i](props, context); - if(s) { - return true; - } - } - return false; - }, - - // - // given a geoemtry type returns the transformed one acording the CartoCSS - // For points there are two kind of types: point and sprite, the first one - // is a circle, second one is an image sprite - // - // the other geometry types are the same than geojson (polygon, linestring...) - // - transformGeometry: function(type) { - return type; - }, - - transformGeometries: function(geojson) { - return geojson; - } - -}; - -CartoCSS.prototype = { - - setStyle: function(style) { - var layers = this.parse(style); - if(!layers) { - throw new Error(this.parse_env.errors); - } - this.layers = layers.map(function(shader) { - return new CartoCSS.Layer(shader); - }); - }, - - getLayers: function() { - return this.layers; - }, - - getDefault: function() { - return this.findLayer({ attachment: '__default__' }); - }, - - findLayer: function(where) { - return _.find(this.layers, function(value) { - for (var key in where) { - var v = value[key]; - if (typeof(v) === 'function') { - v = v.call(value); - } - if (where[key] !== v) return false; - } - return true; - }); - }, - - _createFn: function(ops) { - var body = ops.join('\n'); - if(this.options.debug) console.log(body); - return Function("data","ctx", "var _value = null; " + body + "; return _value; "); - }, - - _compile: function(shader) { - if(typeof shader === 'string') { - shader = eval("(function() { return " + shader +"; })()"); - } - this.shader_src = shader; - for(var attr in shader) { - var c = mapper[attr]; - if(c) { - this.compiled[c] = eval("(function() { return shader[attr]; })();"); - } - } - }, - - parse: function(cartocss) { - var parse_env = { - frames: [], - errors: [], - error: function(obj) { - this.errors.push(obj); - } - }; - this.parse_env = parse_env; - - var ruleset = null; - try { - ruleset = (new carto.Parser(parse_env)).parse(cartocss); - } catch(e) { - console.log(e.stack); - // add the style.mss string to match the response from the server - parse_env.errors.push(e.message); - return; - } - if(ruleset) { - var defs = ruleset.toList(parse_env); - defs.reverse(); - // group by elements[0].value::attachment - var layers = {}; - for(var i = 0; i < defs.length; ++i) { - var def = defs[i]; - var key = def.elements[0] + "::" + def.attachment; - var layer = layers[key] = (layers[key] || {}); - layer.frames = []; - layer.zoom = tree.Zoom.all; - var props = def.toJS(); - for(var v in props) { - (layer[v] = (layer[v] || [])).push(props[v].join('\n')) - } - } - - var ordered_layers = []; - - var done = {}; - for(var i = 0; i < defs.length; ++i) { - var def = defs[i]; - var k = def.elements[0] + "::" + def.attachment; - var layer = layers[k]; - if(!done[k]) { - for(var prop in layer) { - if (prop !== 'zoom' && prop !== 'frames') { - - if(this.options.debug) console.log("****", prop); - layer[prop] = this._createFn(layer[prop]); - } - } - layer.attachment = k; - ordered_layers.push(layer); - done[k] = true; - } - layer.zoom |= def.zoom; - layer.frames.push(def.frame_offset); - } - - // uniq the frames - for(i = 0; i < ordered_layers.length; ++i) { - ordered_layers[i].frames = _.uniq(ordered_layers[i].frames); - } - - return ordered_layers; - - } - return null; - } -}; - - -carto.RendererJS = function (options) { - this.options = options || {}; - this.options.mapnik_version = this.options.mapnik_version || 'latest'; -}; - -// Prepare a javascript object which contains the layers -carto.RendererJS.prototype.render = function render(cartocss, callback) { - tree.Reference.setVersion(this.options.mapnik_version); - return new CartoCSS(cartocss, this.options); -} -if(typeof(module) !== 'undefined') { - module.exports = carto.RendererJS; -} - - -})(require('../carto')); +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.carto=e()}}(function(){var define,module,exports;return function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var s=typeof require=="function"&&require;for(var o=0;o1&&(t=arguments[1]),arguments.length>2&&(n=arguments[2]),{is:"tag",val:e,color:t,mode:n,toString:function(r){return'\n "}}},hsl:function(e,t,n){return this.hsla(e,t,n,1)},hsla:function(e,t,n,r){function u(e){return e=e<0?e+1:e>1?e-1:e,e*6<1?o+(i-o)*e*6:e*2<1?i:e*3<2?o+(i-o)*(2/3-e)*6:o}e=s(e)%360/360,t=s(t),n=s(n),r=s(r);if([e,t,n,r].some(isNaN))return null;var i=n<=.5?n*(t+1):n+t-n*t,o=n*2-i;return this.rgba(u(e+1/3)*255,u(e)*255,u(e-1/3)*255,r)},hue:function(t){return"toHSL"in t?new e.Dimension(Math.round(t.toHSL().h)):null},saturation:function(t){return"toHSL"in t?new e.Dimension(Math.round(t.toHSL().s*100),"%"):null},lightness:function(t){return"toHSL"in t?new e.Dimension(Math.round(t.toHSL().l*100),"%"):null},alpha:function(t){return"toHSL"in t?new e.Dimension(t.toHSL().a):null},saturate:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.s+=t.value/100,n.s=o(n.s),i(n)}return null},desaturate:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.s-=t.value/100,n.s=o(n.s),i(n)}return null},lighten:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.l+=t.value/100,n.l=o(n.l),i(n)}return null},darken:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.l-=t.value/100,n.l=o(n.l),i(n)}return null},fadein:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.a+=t.value/100,n.a=o(n.a),i(n)}return null},fadeout:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.a-=t.value/100,n.a=o(n.a),i(n)}return null},spin:function(e,t){if("toHSL"in e){var n=e.toHSL(),r=(n.h+t.value)%360;return n.h=r<0?360+r:r,i(n)}return null},replace:function(e,t,n){return e.is==="field"?e.toString+".replace("+t.toString()+", "+n.toString()+")":e.replace(t,n)},mix:function(t,n,r){var i=r.value/100,s=i*2-1,o=t.toHSL().a-n.toHSL().a,u=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,a=1-u,f=[t.rgb[0]*u+n.rgb[0]*a,t.rgb[1]*u+n.rgb[1]*a,t.rgb[2]*u+n.rgb[2]*a],l=t.alpha*i+n.alpha*(1-i);return new e.Color(f,l)},greyscale:function(t){return this.desaturate(t,new e.Dimension(100))},"%":function(t){var n=Array.prototype.slice.call(arguments,1),r=t.value;for(var i=0;i4)return e("../../package.json").version.split(".");var n=JSON.parse(s.readFileSync(o.join(r,"../../package.json")));return n.version.split(".")}function l(e,t){var n={bold:[1,22],inverse:[7,27],underline:[4,24],yellow:[33,39],green:[32,39],red:[31,39],grey:[90,39]};return"["+n[t][0]+"m"+e+"["+n[t][1]+"m"}var i=e("util"),s=e("fs"),o=e("path"),a={version:u(),Parser:e("./parser").Parser,Renderer:e("./renderer").Renderer,tree:e("./tree"),RendererJS:e("./renderer_js"),default_reference:e("./torque-reference"),writeError:function(e,t){var n="",r=e.extract,s=[];t=t||{};if(t.silent)return;t.indent=t.indent||"";if(!("index"in e)||!r)return i.error(t.indent+(e.stack||e.message));typeof r[0]=="string"&&s.push(l(e.line-1+" "+r[0],"grey")),r[1]===""&&typeof r[2]=="undefined"&&(r[1]="¶"),s.push(e.line+" "+r[1].slice(0,e.column)+l(l(r[1][e.column],"bold")+r[1].slice(e.column+1),"yellow")),typeof r[2]=="string"&&s.push(l(e.line+1+" "+r[2],"grey")),s=t.indent+s.join("\n"+t.indent)+"\n",n=t.indent+n+l(e.message,"red"),e.filename&&(n+=l(" in ","red")+e.filename),i.error(n,s),e.callLine&&(i.error(l("from ","red")+(e.filename||"")),i.error(l(e.callLine,"grey")+" "+e.callExtract)),e.stack&&i.error(l(e.stack,"red"))}};e("./tree/call"),e("./tree/color"),e("./tree/comment"),e("./tree/definition"),e("./tree/dimension"),e("./tree/element"),e("./tree/expression"),e("./tree/filterset"),e("./tree/filter"),e("./tree/field"),e("./tree/keyword"),e("./tree/layer"),e("./tree/literal"),e("./tree/operation"),e("./tree/quoted"),e("./tree/imagefilter"),e("./tree/reference"),e("./tree/rule"),e("./tree/ruleset"),e("./tree/selector"),e("./tree/style"),e("./tree/url"),e("./tree/value"),e("./tree/variable"),e("./tree/zoom"),e("./tree/invalid"),e("./tree/fontset"),e("./tree/frame_offset"),e("./functions");for(var f in a)n[f]=a[f]}).call(this,e("_process"),"/lib/carto")},{"../../package.json":44,"./functions":1,"./parser":3,"./renderer":4,"./renderer_js":5,"./torque-reference":6,"./tree":7,"./tree/call":8,"./tree/color":9,"./tree/comment":10,"./tree/definition":11,"./tree/dimension":12,"./tree/element":13,"./tree/expression":14,"./tree/field":15,"./tree/filter":16,"./tree/filterset":17,"./tree/fontset":18,"./tree/frame_offset":19,"./tree/imagefilter":20,"./tree/invalid":21,"./tree/keyword":22,"./tree/layer":23,"./tree/literal":24,"./tree/operation":25,"./tree/quoted":26,"./tree/reference":27,"./tree/rule":28,"./tree/ruleset":29,"./tree/selector":30,"./tree/style":31,"./tree/url":32,"./tree/value":33,"./tree/variable":34,"./tree/zoom":35,_process:40,fs:36,path:39,util:42}],3:[function(e,t,n){(function(t){var r=n,i=e("./tree"),s=t._||e("underscore");r.Parser=function(t){function v(){u=l[o],a=r,c=r}function m(){l[o]=u,r=a,c=r}function g(){r>c&&(l[o]=l[o].slice(r-c),c=r)}function y(e){var t,i,s,u,a,f,p;if(e instanceof Function)return e.call(h.parsers);if(typeof e=="string")t=n.charAt(r)===e?e:null,s=1,g();else{g(),t=e.exec(l[o]);if(!t)return null;s=t[0].length}if(t){var d=r+=s;f=r+l[o].length-s;while(r=0&&r.charAt(i)!=="\n";i--)e.column++;return new Error(s("<%=filename%>:<%=line%>:<%=column%> <%=message%>").template(e))}var n,r,o,u,a,f,l,c,h,p=this,d=function(){};return this.env=t=t||{},this.env.filename=this.env.filename||null,this.env.inputs=this.env.inputs||{},h={extractErrorLine:w,parse:function(e){var s,u,a,h,d,v,m=[],g,b=null;r=o=c=f=0,l=[],n=e.replace(/\r\n/g,"\n"),t.filename&&(p.env.inputs[t.filename]=n);var w=!1;l=function(e){var t=0,r=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,i=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,s=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,o=0,u,a=e[0],f;for(var l=0,c,h;l0?"missing closing `}`":"missing opening `{`"}),e.map(function(e){return e.join("")})}([[]]);if(b)throw E(b);s=new i.Ruleset([],y(this.parsers.primary)),s.root=!0,s.toList=function(){var e,t,n;return function(e){e.error=function(t){e.errors||(e.errors=new Error("")),e.errors.message?e.errors.message+="\n"+E(t).message:e.errors.message=E(t).message},e.frames=e.frames||[];var t=this.flatten([],[],e);return t.sort(S),t}}();var S=function(e,t){var n=e.specificity,r=t.specificity;return n[0]!=r[0]?r[0]-n[0]:n[1]!=r[1]?r[1]-n[1]:n[2]!=r[2]?r[2]-n[2]:r[3]-n[3]};return s},parsers:{primary:function(){var e,t=[];while((e=y(this.rule)||y(this.ruleset)||y(this.comment))||y(/^[\s\n]+/)||(e=y(this.invalid)))e&&t.push(e);return t},invalid:function(){var e=y(/^[^;\n]*[;\n]/);if(e)return new i.Invalid(e,a)},comment:function(){var e;if(n.charAt(r)!=="/")return;if(n.charAt(r+1)==="/")return new i.Comment(y(/^\/\/.*/),!0);if(e=y(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))return new i.Comment(e)},entities:{quoted:function(){if(n.charAt(r)!=='"'&&n.charAt(r)!=="'")return;var e=y(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);if(e)return new i.Quoted(e[1]||e[2])},field:function(){if(!y("["))return;var e=y(/(^[^\]]+)/);if(!y("]"))return;if(e)return new i.Field(e[1])},comparison:function(){var e=y(/^=~|=|!=|<=|>=|<|>/);if(e)return e},keyword:function(){var e=y(/^[A-Za-z-]+[A-Za-z-0-9_]*/);if(e)return new i.Keyword(e)},call:function(){var e,t;if(!(e=/^([\w\-]+|%)\(/.exec(l[o])))return;e=e[1];if(e==="url")return null;r+=e.length,y("("),t=y(this.entities.arguments);if(!y(")"))return;if(e)return new i.Call(e,t,r)},arguments:function(){var e=[],t;while(t=y(this.expression)){e.push(t);if(!y(","))break}return e},literal:function(){return y(this.entities.dimension)||y(this.entities.keywordcolor)||y(this.entities.hexcolor)||y(this.entities.quoted)},url:function(){var e;if(n.charAt(r)!=="u"||!y(/^url\(/))return;return e=y(this.entities.quoted)||y(this.entities.variable)||y(/^[\-\w%@$\/.&=:;#+?~]+/)||"",y(")")?new i.URL(typeof e.value!="undefined"||e instanceof i.Variable?e:new i.Quoted(e)):new i.Invalid(e,a,"Missing closing ) in URL.")},variable:function(){var e,s=r;if(n.charAt(r)==="@"&&(e=y(/^@[\w-]+/)))return new i.Variable(e,s,t.filename)},hexcolor:function(){var e;if(n.charAt(r)==="#"&&(e=y(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/)))return new i.Color(e[1])},keywordcolor:function(){var e=l[o].match(/^[a-z]+/);if(e&&e[0]in i.Reference.data.colors)return new i.Color(i.Reference.data.colors[y(/^[a-z]+/)])},dimension:function(){var e=n.charCodeAt(r);if(e>57||e<45||e===47)return;var t=y(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);if(t)return new i.Dimension(t[1],t[2],a)}},variable:function(){var e;if(n.charAt(r)==="@"&&(e=y(/^(@[\w-]+)\s*:/)))return e[1]},entity:function(){return y(this.entities.call)||y(this.entities.literal)||y(this.entities.field)||y(this.entities.variable)||y(this.entities.url)||y(this.entities.keyword)},end:function(){return y(";")||b("}")},element:function(){var e=y(/^(?:[.#][\w\-]+|\*|Map)/);if(e)return new i.Element(e)},attachment:function(){var e=y(/^::([\w\-]+(?:\/[\w\-]+)*)/);if(e)return e[1]},selector:function(){var e,t,s,o=[],u,f=new i.Filterset,l,c=[],h=i.FrameOffset.none;segments=0,conditions=0;while((s=y(this.element))||(l=y(this.zoom))||(fo=y(this.frame_offset))||(u=y(this.filter))||(e=y(this.attachment))){segments++;if(s)o.push(s);else if(l)c.push(l),conditions++;else if(fo)h=fo,conditions++;else if(u){var p=f.add(u);if(p)throw E({message:p,index:r-1});conditions++}else{if(t)throw E({message:"Encountered second attachment name.",index:r-1});t=e}var d=n.charAt(r);if(d==="{"||d==="}"||d===";"||d===",")break}if(segments)return new i.Selector(f,c,h,o,t,conditions,a)},filter:function(){v();var e,n,r;if(!y("["))return;if(e=y(/^[a-zA-Z0-9\-_]+/)||y(this.entities.quoted)||y(this.entities.variable)||y(this.entities.keyword)||y(this.entities.field)){e instanceof i.Quoted&&(e=new i.Field(e.toString()));if((n=y(this.entities.comparison))&&(r=y(this.entities.quoted)||y(this.entities.variable)||y(this.entities.dimension)||y(this.entities.keyword)||y(this.entities.field))){if(!y("]"))throw E({message:"Missing closing ] of filter.",index:a-1});return e.is||(e=new i.Field(e)),new i.Filter(e,n,r,a,t.filename)}}},frame_offset:function(){v();var e,t;if(y(/^\[\s*frame-offset/g)&&(e=y(this.entities.comparison))&&(t=y(/^\d+/))&&y("]"))return i.FrameOffset(e,t,a)},zoom:function(){v();var e,t;if(y(/^\[\s*zoom/g)&&(e=y(this.entities.comparison))&&(t=y(this.entities.variable)||y(this.entities.dimension))&&y("]"))return new i.Zoom(e,t,a);m()},block:function(){var e;if(y("{")&&(e=y(this.primary))&&y("}"))return e},ruleset:function(){var e=[],t,n,r,s,o=[];v();while(t=y(this.selector)){e.push(t);while(y(this.comment));if(!y(","))break;while(y(this.comment));}if(t)while(y(this.comment));if(e.length>0&&(s=y(this.block))){if(e.length===1&&e[0].elements.length&&e[0].elements[0].value==="Map"){var u=new i.Ruleset(e,s);return u.isMap=!0,u}return new i.Ruleset(e,s)}m()},rule:function(){var e,s,o=n.charAt(r);v();if(o==="."||o==="#")return;if(e=y(this.variable)||y(this.property)){s=y(this.value);if(s&&y(this.end))return new i.Rule(e,s,a,t.filename);f=r,m()}},font:function(){var e=[],t=[],n,r,s;while(s=y(this.entity))t.push(s);e.push(new i.Expression(t));if(y(","))while(s=y(this.expression)){e.push(s);if(!y(","))break}return new i.Value(e)},value:function(){var e,t=[];while(e=y(this.expression)){t.push(e);if(!y(","))break}if(t.length>1)return new i.Value(t.map(function(e){return e.value[0]}));if(t.length===1)return new i.Value(t)},sub:function(){var e;if(y("(")&&(e=y(this.expression))&&y(")"))return e},multiplication:function(){var e,t,n,r;if(e=y(this.operand)){while((n=y("/")||y("*")||y("%"))&&(t=y(this.operand)))r=new i.Operation(n,[r||e,t],a);return r||e}},addition:function(){var e,t,s,o;if(e=y(this.multiplication)){while((s=y(/^[-+]\s+/)||n.charAt(r-1)!=" "&&(y("+")||y("-")))&&(t=y(this.multiplication)))o=new i.Operation(s,[o||e,t],a);return o||e}},operand:function(){return y(this.sub)||y(this.entity)},expression:function(){var e,t,n=[],r;while(e=y(this.addition)||y(this.entity))n.push(e);if(n.length>0)return new i.Expression(n)},property:function(){var e=y(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);if(e)return e[1]}}},h}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./tree":7,underscore:undefined}],4:[function(e,t,n){(function(n){function s(e,t,n,r){var i=t.filters,s=t.rules,o,u,a;for(var f=0;f'+t+"");break;case"name":case"description":case"legend":case"attribution":case"template":e.push(' ");break;case"format":e.push(' '+t+"");break;case"interactivity":e.push(' '+t.layer+""),e.push(' '+t.fields+"");break;default:"string"==typeof t?e.push(' "):"number"==typeof t?e.push(' '+t+""):"boolean"==typeof t&&e.push(' '+t+"")}return e},[]);N.length&&s.unshift("\n"+N.join("\n")+"\n\n");var C=r(T).map(function(e){return" "+e}).join("");return s.unshift('\n\n\n"),s.push(""),s.join("\n")},t.exports=i,t.exports.addRules=s,t.exports.inheritDefinitions=o,t.exports.sortStyles=a}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./index":2,underscore:undefined}],5:[function(require,module,exports){(function(global){(function(carto){function CartoCSS(e,t){this.options=t||{},this.imageURLs=[],e&&this.setStyle(e)}var tree=require("./tree"),_=global._||require("underscore");CartoCSS.Layer=function(e,t){this.options=t,this.shader=e},CartoCSS.Layer.prototype={fullName:function(){return this.shader.attachment},name:function(){return this.fullName().split("::")[0]},frames:function(){return this.shader.frames},attachment:function(){return this.fullName().split("::")[1]},eval:function(e){var t=this.shader[e];if(!t||!t.style)return;return t.style({},{zoom:0,"frame-offset":0})},getStyle:function(e,t){var n={};for(var r in this.shader)r!=="attachment"&&r!=="zoom"&&r!=="frames"&&r!=="symbolizers"&&(n[r]=this.shader[r].style(e,t));return n},getSymbolizers:function(){return this.shader.symbolizers},isVariable:function(){for(var e in this.shader)if(e!=="attachment"&&e!=="zoom"&&e!=="frames"&&e!=="symbolizers"&&!this.shader[e].constant)return!0;return!1},getShader:function(){return this.shader},filter:function(e,t,n){for(var r in this.shader){var i=this.shader[r](t,n);if(i)return!0}return!1},transformGeometry:function(e){return e},transformGeometries:function(e){return e}},CartoCSS.prototype={setStyle:function(e){var t=this.parse(e);if(!t)throw new Error(this.parse_env.errors);this.layers=t.map(function(e){return new CartoCSS.Layer(e)})},getLayers:function(){return this.layers},getDefault:function(){return this.findLayer({attachment:"__default__"})},findLayer:function(e){return _.find(this.layers,function(t){for(var n in e){var r=t[n];typeof r=="function"&&(r=r.call(t));if(e[n]!==r)return!1}return!0})},_createFn:function(e){var t=e.join("\n");return this.options.debug&&console.log(t),Function("data","ctx","var _value = null; "+t+"; return _value; ")},_compile:function(shader){typeof shader=="string"&&(shader=eval("(function() { return "+shader+"; })()")),this.shader_src=shader;for(var attr in shader){var c=mapper[attr];c&&(this.compiled[c]=eval("(function() { return shader[attr]; })();"))}},getImageURLs:function(){return this.imageURLs},parse:function(e){var t={frames:[],errors:[],error:function(e){this.errors.push(e)}};this.parse_env=t;var n=null;try{n=(new carto.Parser(t)).parse(e)}catch(r){t.errors.push(r.message);return}if(n){function i(e){return e.elements[0]+"::"+e.attachment}var s=n.toList(t);s.reverse();var o={};for(var u=0;u= minzoom - 1e-6 and scale < maxzoom + 1e-6"},maxzoom:{"default-value":"1.79769e+308",type:"float","default-meaning":"The layer will be visible at the maximum possible scale",doc:"The maximum scale denominator that this layer will be visible at. The default is the numeric limit of the C++ double type, which may vary slightly by system, but is likely a massive number like 1.79769e+308 and ensures that this layer will always be visible unless the value is reduced. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"},queryable:{"default-value":!1,type:"boolean","default-meaning":"The layer will not be available for the direct querying of data values",doc:"This property was added for GetFeatureInfo/WMS compatibility and is rarely used. It is off by default meaning that in a WMS context the layer will not be able to be queried unless the property is explicitly set to true"},"clear-label-cache":{"default-value":!1,type:"boolean","default-meaning":"The renderer's collision detector cache (used for avoiding duplicate labels and overlapping markers) will not be cleared immediately before processing this layer",doc:"This property, by default off, can be enabled to allow a user to clear the collision detector cache before a given layer is processed. This may be desirable to ensure that a given layers data shows up on the map even if it normally would not because of collisions with previously rendered labels or markers"},"group-by":{"default-value":"",type:"string","default-meaning":"No special layer grouping will be used during rendering",doc:"https://github.com/mapnik/mapnik/wiki/Grouped-rendering"},"buffer-size":{"default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:"Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"},"maximum-extent":{"default-value":"none",type:"bbox","default-meaning":"No clipping extent will be used",doc:"An extent to be used to limit the bounds used to query this specific layer data during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Layer."}},symbolizers:{"*":{"image-filters":{css:"image-filters","default-value":"none","default-meaning":"no filters",type:"functions",functions:[["agg-stack-blur",2],["emboss",0],["blur",0],["gray",0],["sobel",0],["edge-detect",0],["x-gradient",0],["y-gradient",0],["invert",0],["sharpen",0]],doc:"A list of image filters."},"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["clear","src","dst","src-over","source-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","lighter","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]},opacity:{css:"opacity",type:"float",doc:"An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)","default-value":1,"default-meaning":"no separate buffer will be used and no alpha will be applied to the style after rendering"}},map:{"background-color":{css:"background-color","default-value":"none","default-meaning":"transparent",type:"color",doc:"Map Background color"},"background-image":{css:"background-image",type:"uri","default-value":"","default-meaning":"transparent",doc:"An image that is repeated below all features on a map as a background.",description:"Map Background image"},srs:{css:"srs",type:"string","default-value":"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs","default-meaning":"The proj4 literal of EPSG:4326 is assumed to be the Map's spatial reference and all data from layers within this map will be plotted using this coordinate system. If any layers do not declare an srs value then they will be assumed to be in the same srs as the Map and not transformations will be needed to plot them in the Map's coordinate space",doc:"Map spatial reference (proj4 string)"},"buffer-size":{css:"buffer-size","default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:'Extra tolerance around the map (in pixels) used to ensure labels crossing tile boundaries are equally rendered in each tile (e.g. cut in each tile). Not intended to be used in combination with "avoid-edges".'},"maximum-extent":{css:"","default-value":"none",type:"bbox","default-meaning":"No clipping extent will be used",doc:"An extent to be used to limit the bounds used to query all layers during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Map."},base:{css:"base","default-value":"","default-meaning":"This base path defaults to an empty string meaning that any relative paths to files referenced in styles or layers will be interpreted relative to the application process." +,type:"string",doc:"Any relative paths used to reference files will be understood as relative to this directory path if the map is loaded from an in memory object rather than from the filesystem. If the map is loaded from the filesystem and this option is not provided it will be set to the directory of the stylesheet."},"paths-from-xml":{css:"","default-value":!0,"default-meaning":"Paths read from XML will be interpreted from the location of the XML",type:"boolean",doc:"value to control whether paths in the XML will be interpreted from the location of the XML or from the working directory of the program that calls load_map()"},"minimum-version":{css:"","default-value":"none","default-meaning":"Mapnik version will not be detected and no error will be thrown about compatibility",type:"string",doc:"The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"},"font-directory":{css:"font-directory",type:"uri","default-value":"none","default-meaning":"No map-specific fonts will be registered",doc:"Path to a directory which holds fonts which should be registered when the Map is loaded (in addition to any fonts that may be automatically registered)."}},polygon:{fill:{css:"polygon-fill",type:"color","default-value":"rgba(128,128,128,1)","default-meaning":"gray and fully opaque (alpha = 1), same as rgb(128,128,128)",doc:"Fill color to assign to a polygon"},"fill-opacity":{css:"polygon-opacity",type:"float",doc:"The opacity of the polygon","default-value":1,"default-meaning":"opaque"},gamma:{css:"polygon-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of polygon edges"},"gamma-method":{css:"polygon-gamma-method",type:["power","linear","none","threshold","multiply"],"default-value":"power","default-meaning":"pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",doc:"An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"},clip:{css:"polygon-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"polygon-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"polygon-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"polygon-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},line:{stroke:{css:"line-color","default-value":"rgba(0,0,0,1)",type:"color","default-meaning":"black and fully opaque (alpha = 1), same as rgb(0,0,0)",doc:"The color of a drawn line"},"stroke-width":{css:"line-width","default-value":1,type:"float",doc:"The width of a line in pixels"},"stroke-opacity":{css:"line-opacity","default-value":1,type:"float","default-meaning":"opaque",doc:"The opacity of a line"},"stroke-linejoin":{css:"line-join","default-value":"miter",type:["miter","round","bevel"],doc:"The behavior of lines when joining"},"stroke-linecap":{css:"line-cap","default-value":"butt",type:["butt","round","square"],doc:"The display of line endings"},"stroke-gamma":{css:"line-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of stroke line"},"stroke-gamma-method":{css:"line-gamma-method",type:["power","linear","none","threshold","multiply"],"default-value":"power","default-meaning":"pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",doc:"An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"},"stroke-dasharray":{css:"line-dasharray",type:"numbers",doc:"A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported for more complex patterns.","default-value":"none","default-meaning":"solid line"},"stroke-dashoffset":{css:"line-dash-offset",type:"numbers",doc:"valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)","default-value":"none","default-meaning":"solid line"},"stroke-miterlimit":{css:"line-miterlimit",type:"float",doc:"The limit on the ratio of the miter length to the stroke-width. Used to automatically convert miter joins to bevel joins for sharp angles to avoid the miter extending beyond the thickness of the stroking path. Normally will not need to be set, but a larger value can sometimes help avoid jaggy artifacts.","default-value":4,"default-meaning":"Will auto-convert miters to bevel line joins when theta is less than 29 degrees as per the SVG spec: 'miterLength / stroke-width = 1 / sin ( theta / 2 )'"},clip:{css:"line-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"line-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},offset:{css:"line-offset",type:"float","default-value":0,"default-meaning":"no offset",doc:"Offsets a line a number of pixels parallel to its actual path. Postive values move the line left, negative values move it right (relative to the directionality of the line)."},rasterizer:{css:"line-rasterizer",type:["full","fast"],"default-value":"full",doc:"Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."},"geometry-transform":{css:"line-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"line-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},markers:{file:{css:"marker-file",doc:"An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.","default-value":"","default-meaning":"An ellipse or circle, if width equals height",type:"uri"},opacity:{css:"marker-opacity",doc:"The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke","default-value":1,"default-meaning":"The stroke-opacity and fill-opacity will be used",type:"float"},"fill-opacity":{css:"marker-fill-opacity",doc:"The fill opacity of the marker","default-value":1,"default-meaning":"opaque",type:"float"},stroke:{css:"marker-line-color",doc:"The color of the stroke around a marker shape.","default-value":"black",type:"color"},"stroke-width":{css:"marker-line-width",doc:"The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",type:"float"},"stroke-opacity":{css:"marker-line-opacity","default-value":1,"default-meaning":"opaque",doc:"The opacity of a line",type:"float"},placement:{css:"marker-placement",type:["point","line","interior"],"default-value":"point","default-meaning":"Place markers at the center point (centroid) of the geometry",doc:"Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior"},"multi-policy":{css:"marker-multi-policy",type:["each","whole","largest"],"default-value":"each","default-meaning":"If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each",doc:"A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)."},"marker-type":{css:"marker-type",type:["arrow","ellipse","rectangle"],"default-value":"ellipse",doc:"The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)"},width:{css:"marker-width","default-value":10,doc:"The width of the marker, if using one of the default types.",type:"float",expression:!0},height:{css:"marker-height","default-value":10,doc:"The height of the marker, if using one of the default types.",type:"float",expression:!0},fill:{css:"marker-fill","default-value":"blue",doc:"The color of the area of the marker.",type:"color"},"allow-overlap":{css:"marker-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping markers are shown or hidden.","default-meaning":"Do not allow makers to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"marker-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},spacing:{css:"marker-spacing",doc:"Space between repeated labels","default-value":100,type:"float"},"max-error":{css:"marker-max-error",type:"float","default-value":.2,doc:"The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers."},transform:{css:"marker-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},clip:{css:"marker-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"marker-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"marker-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"marker-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},shield:{name:{css:"shield-name",type:"string",expression:!0,serialization:"content",doc:'Value to use for a shield"s text label. Data columns are specified using brackets like [column_name]'},file:{css:"shield-file",required:!0,type:"uri","default-value":"none",doc:"Image file to render behind the shield text"},"face-name":{css:"shield-face-name",type:"string",validate:"font",doc:"Font name and style to use for the shield text","default-value":"",required:!0},"unlock-image":{css:"shield-unlock-image",type:"boolean",doc:"This parameter should be set to true if you are trying to position text beside rather than on top of the shield image","default-value":!1,"default-meaning":"text alignment relative to the shield image uses the center of the image as the anchor for text positioning."},size:{css:"shield-size",type:"float",doc:"The size of the shield text in pixels"},fill:{css:"shield-fill",type:"color",doc:"The color of the shield text"},placement:{css:"shield-placement",type:["point","line","vertex","interior"],"default-value":"point",doc:"How this shield should be placed. Point placement attempts to place it on top of points, line places along lines multiple times per feature, vertex places on the vertexes of polygons, and interior attempts to place inside of polygons."},"avoid-edges":{css:"shield-avoid-edges",doc:"Tell positioning algorithm to avoid labeling near intersection edges.",type:"boolean","default-value":!1},"allow-overlap":{css:"shield-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping shields are shown or hidden.","default-meaning":"Do not allow shields to overlap with other map elements already placed."},"minimum-distance":{css:"shield-min-distance",type:"float","default-value":0,doc:"Minimum distance to the next shield symbol, not necessarily the same shield."},spacing:{css:"shield-spacing",type:"float","default-value":0,doc:"The spacing between repeated occurrences of the same shield on a line"},"minimum-padding":{css:"shield-min-padding","default-value":0,doc:"Determines the minimum amount of padding that a shield gets relative to other shields",type:"float"},"wrap-width":{css:"shield-wrap-width",type:"unsigned","default-value":0,doc:"Length of a chunk of text in characters before wrapping text"},"wrap-before":{css:"shield-wrap-before",type:"boolean","default-value":!1,doc:"Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."},"wrap-character":{css:"shield-wrap-character",type:"string","default-value":" ",doc:"Use this character instead of a space to wrap long names."},"halo-fill":{css:"shield-halo-fill",type:"color","default-value":"#FFFFFF","default-meaning":"white",doc:"Specifies the color of the halo around the text."},"halo-radius":{css:"shield-halo-radius",doc:"Specify the radius of the halo in pixels","default-value":0,"default-meaning":"no halo",type:"float"},"character-spacing":{css:"shield-character-spacing",type:"unsigned","default-value":0,doc:"Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."},"line-spacing":{css:"shield-line-spacing",doc:"Vertical spacing between lines of multiline labels (in pixels)",type:"unsigned"},dx:{css:"shield-text-dx",type:"float",doc:"Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},dy:{css:"shield-text-dy",type:"float",doc:"Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},"shield-dx":{css:"shield-dx",type:"float",doc:"Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},"shield-dy":{css:"shield-dy",type:"float",doc:"Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},opacity:{css:"shield-opacity",type:"float",doc:"(Default 1.0) - opacity of the image used for the shield","default-value":1},"text-opacity":{css:"shield-text-opacity",type:"float",doc:"(Default 1.0) - opacity of the text placed on top of the shield","default-value":1},"horizontal-alignment":{css:"shield-horizontal-alignment",type:["left","middle","right","auto"],doc:"The shield's horizontal alignment from its centerpoint","default-value":"auto"},"vertical-alignment":{css:"shield-vertical-alignment",type:["top","middle","bottom","auto"],doc:"The shield's vertical alignment from its centerpoint","default-value":"middle"},"text-transform":{css:"shield-text-transform",type:["none","uppercase","lowercase","capitalize"],doc:"Transform the case of the characters","default-value":"none"},"justify-alignment":{css:"shield-justify-alignment",type:["left","center","right","auto"],doc:"Define how text in a shield's label is justified","default-value":"auto"},clip:{css:"shield-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},"comp-op":{css:"shield-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},"line-pattern":{file:{css:"line-pattern-file",type:"uri","default-value":"none",required:!0,doc:"An image file to be repeated and warped along a line"},clip:{css:"line-pattern-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"line-pattern-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"line-pattern-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"line-pattern-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},"polygon-pattern":{file:{css:"polygon-pattern-file",type:"uri","default-value":"none",required:!0,doc:"Image to use as a repeated pattern fill within a polygon"},alignment:{css:"polygon-pattern-alignment",type:["local","global"],"default-value":"local",doc:"Specify whether to align pattern fills to the layer or to the map."},gamma:{css:"polygon-pattern-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of polygon pattern edges"},opacity:{css:"polygon-pattern-opacity",type:"float",doc:"(Default 1.0) - Apply an opacity level to the image used for the pattern","default-value":1,"default-meaning":"The image is rendered without modifications"},clip:{css:"polygon-pattern-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"polygon-pattern-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"polygon-pattern-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"polygon-pattern-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},raster:{opacity:{css:"raster-opacity","default-value":1,"default-meaning":"opaque",type:"float",doc:"The opacity of the raster symbolizer on top of other symbolizers."},"filter-factor":{css:"raster-filter-factor","default-value":-1,"default-meaning":"Allow the datasource to choose appropriate downscaling.",type:"float",doc:"This is used by the Raster or Gdal datasources to pre-downscale images using overviews. Higher numbers can sometimes cause much better scaled image output, at the cost of speed."},scaling:{css:"raster-scaling",type:["near","fast","bilinear","bilinear8","bicubic","spline16","spline36","hanning","hamming","hermite","kaiser","quadric","catrom","gaussian","bessel","mitchell","sinc","lanczos","blackman"],"default-value":"near",doc:"The scaling algorithm used to making different resolution versions of this raster layer. Bilinear is a good compromise between speed and accuracy, while lanczos gives the highest quality."},"mesh-size":{css:"raster-mesh-size","default-value":16,"default-meaning":"Reprojection mesh will be 1/16 of the resolution of the source image",type:"unsigned",doc:"A reduced resolution mesh is used for raster reprojection, and the total image size is divided by the mesh-size to determine the quality of that mesh. Values for mesh-size larger than the default will result in faster reprojection but might lead to distortion."},"comp-op":{css:"raster-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},point:{file:{css:"point-file",type:"uri",required:!1,"default-value":"none",doc:"Image file to represent a point"},"allow-overlap":{css:"point-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping points are shown or hidden.","default-meaning":"Do not allow points to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"point-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},opacity:{css:"point-opacity",type:"float","default-value":1,"default-meaning":"Fully opaque",doc:"A value from 0 to 1 to control the opacity of the point"},placement:{css:"point-placement",type:["centroid","interior"],doc:"How this point should be placed. Centroid calculates the geometric center of a polygon, which can be outside of it, while interior always places inside of a polygon.","default-value":"centroid"},transform:{css:"point-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},"comp-op":{css:"point-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},text:{name:{css:"text-name",type:"string",expression:!0,required:!0,"default-value":"",serialization:"content",doc:"Value to use for a text label. Data columns are specified using brackets like [column_name]"},"face-name":{css:"text-face-name",type:"string",validate:"font",doc:"Font name and style to render a label in",required:!0},size:{css:"text-size",type:"float","default-value":10,doc:"Text size in pixels"},"text-ratio":{css:"text-ratio",doc:"Define the amount of text (of the total) present on successive lines when wrapping occurs","default-value":0,type:"unsigned"},"wrap-width":{css:"text-wrap-width",doc:"Length of a chunk of text in characters before wrapping text","default-value":0,type:"unsigned"},"wrap-before":{css:"text-wrap-before",type:"boolean","default-value":!1,doc:"Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."},"wrap-character":{css:"text-wrap-character",type:"string","default-value":" ",doc:"Use this character instead of a space to wrap long text."},spacing:{css:"text-spacing",type:"unsigned",doc:"Distance between repeated text labels on a line (aka. label-spacing)"},"character-spacing":{css:"text-character-spacing",type:"float","default-value":0,doc:"Horizontal spacing adjustment between characters in pixels"},"line-spacing":{css:"text-line-spacing","default-value":0,type:"unsigned",doc:"Vertical spacing adjustment between lines in pixels"},"label-position-tolerance":{css:"text-label-position-tolerance","default-value":0,type:"unsigned",doc:"Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"},"max-char-angle-delta":{css:"text-max-char-angle-delta",type:"float","default-value":"22.5",doc:"The maximum angle change, in degrees, allowed between adjacent characters in a label. This value internally is converted to radians to the default is 22.5*math.pi/180.0. The higher the value the fewer labels will be placed around around sharp corners."},fill:{css:"text-fill",doc:"Specifies the color for the text","default-value":"#000000",type:"color"},opacity:{css:"text-opacity",doc:"A number from 0 to 1 specifying the opacity for the text","default-value":1,"default-meaning":"Fully opaque",type:"float"},"halo-fill":{css:"text-halo-fill",type:"color","default-value":"#FFFFFF","default-meaning":"white",doc:"Specifies the color of the halo around the text."},"halo-radius":{css:"text-halo-radius",doc:"Specify the radius of the halo in pixels","default-value":0,"default-meaning":"no halo",type:"float"},dx:{css:"text-dx",type:"float",doc:"Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},dy:{css:"text-dy",type:"float",doc:"Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},"vertical-alignment":{css:"text-vertical-alignment",type:["top","middle","bottom","auto"],doc:"Position of label relative to point position.","default-value":"auto","default-meaning":'Default affected by value of dy; "bottom" for dy>0, "top" for dy<0.'},"avoid-edges":{css:"text-avoid-edges",doc:"Tell positioning algorithm to avoid labeling near intersection edges.","default-value":!1,type:"boolean"},"minimum-distance":{css:"text-min-distance",doc:"Minimum permitted distance to the next text symbolizer.",type:"float"},"minimum-padding":{css:"text-min-padding",doc:"Determines the minimum amount of padding that a text symbolizer gets relative to other text",type:"float"},"minimum-path-length":{css:"text-min-path-length",type:"float","default-value":0,"default-meaning":"place labels on all paths",doc:"Place labels only on paths longer than this value."},"allow-overlap":{css:"text-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping text is shown or hidden.","default-meaning":"Do not allow text to overlap with other text - overlapping markers will not be shown."},orientation:{css:"text-orientation",type:"float",expression:!0,doc:"Rotate the text."},placement:{css:"text-placement",type:["point","line","vertex","interior"],"default-value":"point",doc:"Control the style of placement of a point versus the geometry it is attached to."},"placement-type":{css:"text-placement-type",doc:'Re-position and/or re-size text to avoid overlaps. "simple" for basic algorithm (using text-placements string,) "dummy" to turn this feature off.',type:["dummy","simple"],"default-value":"dummy"},placements:{css:"text-placements",type:"string","default-value":"",doc:'If "placement-type" is set to "simple", use this "POSITIONS,[SIZES]" string. An example is `text-placements: "E,NE,SE,W,NW,SW";` '},"text-transform":{css:"text-transform",type:["none","uppercase","lowercase","capitalize"],doc:"Transform the case of the characters","default-value":"none"},"horizontal-alignment":{css:"text-horizontal-alignment",type:["left","middle","right","auto"],doc:"The text's horizontal alignment from its centerpoint","default-value":"auto"},"justify-alignment":{css:"text-align",type:["left","right","center","auto"],doc:"Define how text is justified","default-value":"auto","default-meaning":"Auto alignment means that text will be centered by default except when using the `placement-type` parameter - in that case either right or left justification will be used automatically depending on where the text could be fit given the `text-placements` directives"},clip:{css:"text-clip" +,type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},"comp-op":{css:"text-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},building:{fill:{css:"building-fill","default-value":"#FFFFFF",doc:"The color of the buildings walls.",type:"color"},"fill-opacity":{css:"building-fill-opacity",type:"float",doc:"The opacity of the building as a whole, including all walls.","default-value":1},height:{css:"building-height",doc:"The height of the building in pixels.",type:"float",expression:!0,"default-value":"0"}},torque:{"-torque-clear-color":{css:"-torque-clear-color",type:"color","default-value":"rgba(255, 255, 255, 0)","default-meaning":"full clear",doc:"color used to clear canvas on each frame"},"-torque-frame-count":{css:"-torque-frame-count","default-value":"128",type:"float","default-meaning":"the data is broken into 128 time frames",doc:"Number of animation steps/frames used in the animation. If the data contains a fewere number of total frames, the lesser value will be used."},"-torque-resolution":{css:"-torque-resolution","default-value":"2",type:"float","default-meaning":"",doc:"Spatial resolution in pixels. A resolution of 1 means no spatial aggregation of the data. Any other resolution of N results in spatial aggregation into cells of NxN pixels. The value N must be power of 2"},"-torque-animation-duration":{css:"-torque-animation-duration","default-value":"30",type:"float","default-meaning":"the animation lasts 30 seconds",doc:"Animation duration in seconds"},"-torque-aggregation-function":{css:"-torque-aggregation-function","default-value":"count(cartodb_id)",type:"string","default-meaning":"the value for each cell is the count of points in that cell",doc:"A function used to calculate a value from the aggregate data for each cell. See -torque-resolution"},"-torque-time-attribute":{css:"-torque-time-attribute","default-value":"time",type:"string","default-meaning":"the data column in your table that is of a time based type",doc:"The table column that contains the time information used create the animation"},"-torque-data-aggregation":{css:"-torque-data-aggregation","default-value":"linear",type:["linear","cumulative"],"default-meaning":"previous values are discarded",doc:"A linear animation will discard previous values while a cumulative animation will accumulate them until it restarts"}}},colors:{aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50],transparent:[0,0,0,0]},filter:{value:["true","false","null","point","linestring","polygon","collection"]}};t.exports={version:{latest:r,"2.1.1":r}}},{}],7:[function(e,t,n){typeof t!="undefined"&&(t.exports.find=function(e,t){for(var n=0,r;n255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("")},operate:function(t,n,r){var i=[];r instanceof e.Color||(r=r.toColor());for(var s=0;s<3;s++)i[s]=e.operate(n,this.rgb[s],r.rgb[s]);return new e.Color(i)},toHSL:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255,r=this.alpha,i=Math.max(e,t,n),s=Math.min(e,t,n),o,u,a=(i+s)/2,f=i-s;if(i===s)o=u=0;else{u=a>.5?f/(2-i-s):f/(i+s);switch(i){case e:o=(t-n)/f+(t"},ev:function(){return this}}})(e("../tree"))},{"../tree":7}],11:[function(e,t,n){(function(t){(function(n){function s(e){function t(e){return e[1].toUpperCase()}return e.charAt(0).toUpperCase()+e.slice(1).replace(/\-./,t)+"Symbolizer"}function o(e){return e.sort(function(e,t){return e[1]-t[1]}).map(function(e){return e[0]})}var r=e("assert"),i=t._||e("underscore");n.Definition=function(t,i){this.elements=t.elements,r.ok(t.filters instanceof n.Filterset),this.rules=i,this.ruleIndex={};for(var s=0;s"+w+"\n":i+=">\n")}return!h||!i?"":" \n"+i+" \n"},n.Definition.prototype.collectSymbolizers=function(e,t){var n={},r;for(var i=t;i1?new e.Expression(this.value.map(function(e){return e.ev(t)})):this.value[0].ev(t)},toString:function(e){return this.value.map(function(t){return t.toString(e)}).join(" ")}}})(e("../tree"))},{"../tree":7}],15:[function(e,t,n){(function(e){e.Field=function(t){this.value=t||""},e.Field.prototype={is:"field",toString:function(){return"["+this.value+"]"},ev:function(){return this}}})(e("../tree"))},{"../tree":7}],16:[function(e,t,n){(function(e){e.Filter=function(t,n,r,i,s){this.key=t,this.op=n,this.val=r,this.index=i,this.filename=s,this.id=this.key+this.op+this.val};var t={"<":[" < ","numeric"],">":[" > ","numeric"],"=":[" = ","both"],"!=":[" != ","both"],"<=":[" <= ","numeric"],">=":[" >= ","numeric"],"=~":[".match(","string",")"]};e.Filter.prototype.ev=function(e){return this.key=this.key.ev(e),this.val=this.val.ev(e),this},e.Filter.prototype.toXML=function(n){e.Reference.data.filter&&(this.key.is==="keyword"&&-1===e.Reference.data.filter.value.indexOf(this.key.toString())&&n.error({message:this.key.toString()+" is not a valid keyword in a filter expression",index:this.index,filename:this.filename}),this.val.is==="keyword"&&-1===e.Reference.data.filter.value.indexOf(this.val.toString())&&n.error({message:this.val.toString()+" is not a valid keyword in a filter expression",index:this.index,filename:this.filename}));var r=this.key.toString(!1),i=this.val.toString(this.val.is=="string");return(t[this.op][1]=="numeric"&&isNaN(i)&&this.val.is!=="field"||t[this.op][1]=="string"&&i[0]!="'")&&n.error({message:'Cannot use operator "'+this.op+'" with value '+this.val,index:this.index,filename:this.filename}),r+t[this.op][0]+i+(t[this.op][2]||"")},e.Filter.prototype.toString=function(){return"["+this.id+"]"}})(e("../tree"))},{"../tree":7}],17:[function(e,t,n){(function(t){var n=e("../tree"),r=t._||e("underscore");n.Filterset=function(){this.filters={}},n.Filterset.prototype.toXML=function(e){var t=[];for(var n in this.filters)t.push("("+this.filters[n].toXML(e).trim()+")");return t.length?" "+t.join(" and ")+"\n":""},n.Filterset.prototype.toString=function(){var e=[];for(var t in this.filters)e.push(this.filters[t].id);return e.sort().join(" ")},n.Filterset.prototype.ev=function(e){for(var t in this.filters)this.filters[t].ev(e);return this},n.Filterset.prototype.clone=function(){var e=new n.Filterset;for(var t in this.filters)e.filters[t]=this.filters[t];return e},n.Filterset.prototype.cloneWith=function(e){var t=[];for(var r in e.filters){var i=this.addable(e.filters[r]);if(i===!1)return!1;i===!0&&t.push(e.filters[r])}if(!t.length)return null;var s=new n.Filterset;for(r in this.filters)s.filters[r]=this.filters[r];while(r=t.shift())s.add(r);return s},n.Filterset.prototype.toJS=function(e){var t={"=":"==="};return r.map(this.filters,function(e){var n=e.op;n in t&&(n=t[n]);var r=e.val;e._val!==undefined&&(r=e._val.toString(!0));var i="data";return i+"."+e.key.value+" "+n+" "+(r.is==="string"?"'"+r+"'":r)}).join(" && ")},n.Filterset.prototype.addable=function(e){var t=e.key.toString(),n=e.val.toString();n.match(/^[0-9]+(\.[0-9]*)?$/)&&(n=parseFloat(n));switch(e.op){case"=":if(this.filters[t+"="]!==undefined)return this.filters[t+"="].val.toString()!=n?!1:null;if(this.filters[t+"!="+n]!==undefined)return!1;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return!1;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return!1;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>n)return!1;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val"]!==undefined&&this.filters[t+">"].val>=n)return null;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return null;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>n)return null;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val":if(t+"="in this.filters)return this.filters[t+"="].val<=n?!1:null;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return!1;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val<=n)return!1;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return null;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>n)return null;return!0;case">=":if(this.filters[t+"="]!==undefined)return this.filters[t+"="].val"]!==undefined&&this.filters[t+">"].val>=n)return null;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>=n)return null;return!0;case"<":if(this.filters[t+"="]!==undefined)return this.filters[t+"="].val>=n?!1:null;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return!1;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>=n)return!1;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return null;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val"]!==undefined&&this.filters[t+">"].val>=n)return!1;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>n)return!1;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return null;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val<=n)return null;return!0}},n.Filterset.prototype.conflict=function(e){var t=e.key.toString(),n=e.val.toString();return isNaN(parseFloat(n))||(n=parseFloat(n)),e.op==="="&&this.filters[t+"="]!==undefined&&n!=this.filters[t+"="].val.toString()||e.op==="!="&&this.filters[t+"="]!==undefined&&n==this.filters[t+"="].val.toString()||e.op==="="&&this.filters[t+"!="]!==undefined&&n==this.filters[t+"!="].val.toString()?e.toString()+" added to "+this.toString()+" produces an invalid filter":!1},n.Filterset.prototype.add=function(e,t){var n=e.key.toString(),r,i=e.op,s=this.conflict(e),o;if(s)return s;if(i==="="){for(var u in this.filters)this.filters[u].key==n&&delete this.filters[u];this.filters[n+"="]=e}else if(i==="!=")this.filters[n+"!="+e.val]=e;else if(i==="=~")this.filters[n+"=~"+e.val]=e;else if(i===">"){for(var a in this.filters)this.filters[a].key==n&&this.filters[a].val<=e.val&&delete this.filters[a];this.filters[n+">"]=e}else if(i===">="){for(var f in this.filters)o=+this.filters[f].val.toString(),this.filters[f].key==n&&o",this.filters[n+">"]=e):this.filters[n+">="]=e}else if(i==="<"){for(var l in this.filters)o=+this.filters[l].val.toString(),this.filters[l].key==n&&o>=e.val&&delete this.filters[l];this.filters[n+"<"]=e}else if(i==="<="){for(var c in this.filters)o=+this.filters[c].val.toString(),this.filters[c].key==n&&o>e.val&&delete this.filters[c];this.filters[n+"!="+e.val]!==undefined?(delete this.filters[n+"!="+e.val],e.op="<",this.filters[n+"<"]=e):this.filters[n+"<="]=e}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../tree":7,underscore:undefined}],18:[function(e,t,n){(function(e){e._getFontSet=function(t,n){var r=n.join("");if(t._fontMap&&t._fontMap[r])return t._fontMap[r];var i=new e.FontSet(t,n);return t.effects.push(i),t._fontMap||(t._fontMap={}),t._fontMap[r]=i,i},e.FontSet=function(t,n){this.fonts=n,this.name="fontset-"+t.effects.length},e.FontSet.prototype.toXML=function(e){return'\n'+this.fonts.map(function(e){return' '}).join("\n")+"\n"}})(e("../tree"))},{"../tree":7}],19:[function(e,t,n){var r=e("../tree");r.FrameOffset=function(e,t,n){t=parseInt(t,10);if(t>r.FrameOffset.max||t<=0)throw{message:"Only frame-offset levels between 1 and "+r.FrameOffset.max+" supported.",index:n};if(e!=="=")throw{message:"only = operator is supported for frame-offset",index:n};return t},r.FrameOffset.max=32,r.FrameOffset.none=0},{"../tree":7}],20:[function(e,t,n){(function(e){e.ImageFilter=function(t,n){this.filter=t,this.args=n||null},e.ImageFilter.prototype={is:"imagefilter",ev:function(){return this},toString:function(){return this.args?this.filter+"("+this.args.join(",")+")":this.filter}}})(e("../tree"))},{"../tree":7}],21:[function(e,t,n){(function(e){e.Invalid=function(t,n,r){this.chunk=t,this.index=n,this.type="syntax",this.message=r||"Invalid code: "+this.chunk},e.Invalid.prototype.is="invalid",e.Invalid.prototype.ev=function(e){return e.error({chunk:this.chunk,index:this.index,type:"syntax",message:this.message||"Invalid code: "+this.chunk}),{is:"undefined"}}})(e("../tree"))},{"../tree":7}],22:[function(e,t,n){(function(e){e.Keyword=function(t){this.value=t;var n={transparent:"color","true":"boolean","false":"boolean"};this.is=n[t]?n[t]:"keyword"},e.Keyword.prototype={ev:function(){return this},toString:function(){return this.value}}})(e("../tree"))},{"../tree":7}],23:[function(e,t,n){(function(e){e.LayerXML=function(t,n){var r=[];for(var i in t.Datasource)r.push('");var s="";for(var o in t.properties)o==="minzoom"?s+=' maxzoom="'+e.Zoom.ranges[t.properties[o]]+'"\n':o==="maxzoom"?s+=' minzoom="'+e.Zoom.ranges[t.properties[o]+1]+'"\n':s+=" "+o+'="'+t.properties[o]+'"\n';return'\n "+n.reverse().map(function(e){return""+e+""}).join("\n ")+(r.length?"\n \n "+r.join("\n ")+"\n \n":"")+" \n"}})(e("../tree"))},{"../tree":7}],24:[function(e,t,n){(function(e){e.Literal=function(t){this.value=t||"",this.is="field"},e.Literal.prototype={toString:function(){return this.value},ev:function(){return this}}})(e("../tree"))},{"../tree":7}],25:[function(e,t,n){(function(e){e.Operation=function(t,n,r){this.op=t.trim(),this.operands=n,this.index=r},e.Operation.prototype.is="operation",e.Operation.prototype.ev=function(t){var n=this.operands[0].ev(t),r=this.operands[1].ev(t),i;return n.is==="undefined"||r.is==="undefined"?{is:"undefined",value:"undefined"}:(n instanceof e.Dimension&&r instanceof e.Color&&(this.op==="*"||this.op==="+"?(i=r,r=n,n=i):t.error({name:"OperationError",message:"Can't substract or divide a color from a number",index:this.index})),n instanceof e.Quoted&&r instanceof e.Quoted&&this.op!=="+"?(t.error({message:"Can't subtract, divide, or multiply strings.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):n instanceof e.Field||r instanceof e.Field||n instanceof e.Literal||r instanceof e.Literal?n.is==="color"||r.is==="color"?(t.error({message:"Can't subtract, divide, or multiply colors in expressions.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):new e.Literal(n.ev(t).toString(!0)+this.op+r.ev(t).toString(!0)):n.operate===undefined?(t.error({message:"Cannot do math with type "+n.is+".",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):n.operate(t,this.op,r))},e.operate=function(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"%":return t%n;case"/":return t/n}}})(e("../tree"))},{"../tree":7}],26:[function(e,t,n){(function(e){e.Quoted=function(t){this.value=t||""},e.Quoted.prototype={is:"string",toString:function(e){var t=this.value.replace(/&/g,"&"),n=t.replace(/\'/g,"\\'").replace(/\"/g,""").replace(//g,">");return e===!0?"'"+n+"'":t},ev:function(){return this},operate:function(t,n,r){return new e.Quoted(e.operate(n,this.toString(),r.toString(this.contains_field)))}}})(e("../tree"))},{"../tree":7}],27:[function(e,t,n){(function(t){(function(n){function s(e){var t={};for(var n in e.symbolizers)for(var r in e.symbolizers[n])e.symbolizers[n][r].hasOwnProperty("css")&&(t[e.symbolizers[n][r].css]=[e.symbolizers[n][r],n,r]);return t}function o(e){var t={};for(var n in e.symbolizers)for(var r in e.symbolizers[n])if(e.symbolizers[n][r].type==="functions")for(var i=0;i1){var f=e._getFontSet(n,this.value.value);return'fontset-name="'+f.name+'"'}return r?this.value.toString(n,this.name,i):e.Reference.selectorName(this.name)+'="'+this.value.toString(n,this.name)+'"'},e.Rule.prototype.ev=function(t){return new e.Rule(this.name,this.value.ev(t),this.index,this.filename)}})(e("../tree"))},{"../tree":7}],29:[function(e,t,n){(function(e){e.Ruleset=function(t,n){this.selectors=t,this.rules=n,this._lookups={}},e.Ruleset.prototype={is:"ruleset",ev:function(t){var n,r=new e.Ruleset(this.selectors,this.rules.slice(0));r.root=this.root,t.frames.unshift(r);for(n=0,rule;n1?Array.prototype.push.apply(r,i.find(new e.Selector(null,null,null,t.elements.slice(1)),n)):r.push(i);break}}}),this._lookups[o]=r)},evZooms:function(t){for(var n=0;n\n"+v+""}})(e("../tree"))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../tree":7,underscore:undefined}],32:[function(e,t,n){(function(e){e.URL=function(t,n){this.value=t,this.paths=n},e.URL.prototype={is:"uri",toString:function(){return this.value.toString()},ev:function(t){return new e.URL(this.value.ev(t),this.paths)}}})(e("../tree"))},{"../tree":7}],33:[function(e,t,n){(function(e){e.Value=function(t){this.value=t},e.Value.prototype={is:"value",ev:function(t){return this.value.length===1?this.value[0].ev(t):new e.Value(this.value.map(function(e){return e.ev(t)}))},toString:function(e,t,n,r){return this.value.map(function(t){return t.toString(e,r)}).join(n||", ")},clone:function(){var t=Object.create(e.Value.prototype);return Array.isArray(t)?t.value=this.value.slice():t.value=this.value,t.is=this.is,t},toJS:function(e){var t=this.ev(e),n=t.toString();return t.is==="color"||t.is==="uri"||t.is==="string"||t.is==="keyword"?n="'"+n+"'":t.is==="field"&&(n=n.replace(/\[(.*)\]/g,"data['$1']")),"_value = "+n+";"}}})(e("../tree"))},{"../tree":7}],34:[function(e,t,n){(function(e){e.Variable=function(t,n,r){this.name=t,this.index=n,this.filename=r},e.Variable.prototype={is:"variable",toString:function(){return this.name},ev:function(e){var t,n,r=this.name;if(this._css)return this._css;var i=e.frames.filter(function(e){return e.name==this.name}.bind(this));return i.length?i[0].value.ev(e):(e.error({message:"variable "+this.name+" is undefined",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"})}}})(e("../tree"))},{"../tree":7}],35:[function(e,t,n){var r=e("../tree");r.Zoom=function(e,t,n){this.op=e,this.value=t,this.index=n},r.Zoom.prototype.setZoom=function(e){return this.zoom=e,this},r.Zoom.prototype.ev=function(e){var t=0,n=Infinity,i=parseInt(this.value.ev(e).toString(),10),s=0;(i>r.Zoom.maxZoom||i<0)&&e.error({message:"Only zoom levels between 0 and "+r.Zoom.maxZoom+" supported.",index:this.index});switch(this.op){case"=":return this.zoom=1<":t=i+1;break;case">=":t=i;break;case"<":n=i-1;break;case"<=":n=i}for(var o=0;o<=r.Zoom.maxZoom;o++)o>=t&&o<=n&&(s|=1<0&&e.push(" "+r.Zoom.ranges[t]+"\n"),n<22&&e.push(" "+r.Zoom.ranges[n+1]+"\n")}return e},r.Zoom.prototype.toString=function(){var e="";for(var t=0;t<=r.Zoom.maxZoom;t++)e+=this.zoom&1<=0;u--)if(n[u]!=s[u])return!1;for(u=n.length-1;u>=0;u--){o=n[u];if(!h(e[o],t[o]))return!1}return!0}function v(e,t){return!e||!t?!1:Object.prototype.toString.call(t)=="[object RegExp]"?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1}function m(e,t,n,i){var s;r.isString(n)&&(i=n,n=null);try{t()}catch(o){s=o}i=(n&&n.name?" ("+n.name+").":".")+(i?" "+i:"."),e&&!s&&l(s,n,"Missing expected exception"+i),!e&&v(s,n)&&l(s,n,"Got unwanted exception"+i);if(e&&s&&n&&!v(s,n)||!e&&s)throw s}var r=e("util/"),i=Array.prototype.slice,s=Object.prototype.hasOwnProperty,o=t.exports=c;o.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=f(this),this.generatedMessage=!0);var n=t.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,s=n.name,o=i.indexOf("\n"+s);if(o>=0){var u=i.indexOf("\n",o+1);i=i.substring(u+1)}this.stack=i}}},r.inherits(o.AssertionError,Error),o.fail=l,o.ok=c,o.equal=function(t,n,r){t!=n&&l(t,n,r,"==",o.equal)},o.notEqual=function(t,n,r){t==n&&l(t,n,r,"!=",o.notEqual)},o.deepEqual=function(t,n,r){h(t,n)||l(t,n,r,"deepEqual",o.deepEqual)},o.notDeepEqual=function(t,n,r){h(t,n)&&l(t,n,r,"notDeepEqual",o.notDeepEqual)},o.strictEqual=function(t,n,r){t!==n&&l(t,n,r,"===",o.strictEqual)},o.notStrictEqual=function(t,n,r){t===n&&l(t,n,r,"!==",o.notStrictEqual)},o.throws=function(e,t,n){m.apply(this,[!0].concat(i.call(arguments)))},o.doesNotThrow=function(e,t){m.apply(this,[!1].concat(i.call(arguments)))},o.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}},{"util/":42}],38:[function(e,t,n){typeof Object.create=="function"?t.exports=function(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],39:[function(e,t,n){(function(e){function t(e,t){var n=0;for(var r=e.length-1;r>=0;r--){var i=e[r];i==="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function s(e,t){if(e.filter)return e.filter(t);var n=[];for(var r=0;r=-1&&!r;i--){var o=i>=0?arguments[i]:e.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)continue;n=o+"/"+n,r=o.charAt(0)==="/"}return n=t(s(n.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+n||"."},n.normalize=function(e){var r=n.isAbsolute(e),i=o(e,-1)==="/";return e=t(s(e.split("/"),function(e){return!!e}),!r).join("/"),!e&&!r&&(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return e.charAt(0)==="/"},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(s(e,function(e,t){if(typeof e!="string")throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){var t=0;for(;t=0;n--)if(e[n]!=="")break;return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);var i=r(e.split("/")),s=r(t.split("/")),o=Math.min(i.length,s.length),u=o;for(var a=0;a0){var n=r.shift();n()}}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=i,r.addListener=i,r.once=i,r.off=i,r.removeListener=i,r.removeAllListeners=i,r.emit=i,r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")}},{}],41:[function(e,t,n){t.exports=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}},{}],42:[function(e,t,n){(function(t,r){function u(e,t){var r={seen:[],stylize:f};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),y(t)?r.showHidden=t:t&&n._extend(r,t),T(r.showHidden)&&(r.showHidden=!1),T(r.depth)&&(r.depth=2),T(r.colors)&&(r.colors=!1),T(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),c(r,e,r.depth)}function a(e,t){var n=u.styles[t];return n?"["+u.colors[n][0]+"m"+e+"["+u.colors[n][1]+"m":e}function f(e,t){return e}function l(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function c(e,t,r){if(e.customInspect&&t&&A(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return S(i)||(i=c(e,i,r)),i}var s=h(e,t);if(s)return s;var o=Object.keys(t),u=l(o);e.showHidden&&(o=Object.getOwnPropertyNames(t));if(L(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return p(t);if(o.length===0){if(A(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(N(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(k(t))return e.stylize(Date.prototype.toString.call(t),"date");if(L(t))return p(t)}var f="",y=!1,b=["{","}"];g(t)&&(y=!0,b=["[","]"]);if(A(t)){var w=t.name?": "+t.name:"";f=" [Function"+w+"]"}N(t)&&(f=" "+RegExp.prototype.toString.call(t)),k(t)&&(f=" "+Date.prototype.toUTCString.call(t)),L(t)&&(f=" "+p(t));if(o.length!==0||!!y&&t.length!=0){if(r<0)return N(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var E;return y?E=d(e,t,r,u,o):E=o.map(function(n){return v(e,t,r,u,n,y)}),e.seen.pop(),m(E,f,b)}return b[0]+f+b[1]}function h(e,t){if(T(t))return e.stylize("undefined","undefined");if(S(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(E(t))return e.stylize(""+t,"number");if(y(t))return e.stylize(""+t,"boolean");if(b(t))return e.stylize("null","null")}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){var s=[];for(var o=0,u=t.length;o-1&&(s?u=u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):u="\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special"));if(T(o)){if(s&&i.match(/^\d+$/))return u;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+u}function m(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(t===""?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function g(e){return Array.isArray(e)}function y(e){return typeof e=="boolean"}function b(e){return e===null}function w(e){return e==null}function E(e){return typeof e=="number"}function S(e){return typeof e=="string"}function x(e){return typeof e=="symbol"}function T(e){return e===void 0}function N(e){return C(e)&&M(e)==="[object RegExp]"}function C(e){return typeof e=="object"&&e!==null}function k(e){return C(e)&&M(e)==="[object Date]"}function L(e){return C(e)&&(M(e)==="[object Error]"||e instanceof Error)}function A(e){return typeof e=="function"}function O(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}function M(e){return Object.prototype.toString.call(e)}function _(e){return e<10?"0"+e.toString(10):e.toString(10)}function P(){var e=new Date,t=[_(e.getHours()),_(e.getMinutes()),_(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function H(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var i=/%[sdj%]/g;n.format=function(e){if(!S(e)){var t=[];for(var n=0;n=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"};default:return e}});for(var a=r[n];n","Konstantin Käfer","Alexis Sellier ","Raul Ochoa ","Javi Santana "],licenses:[{type:"Apache"}],bin:{carto:"./bin/carto"},man:"./man/carto.1",main:"./lib/carto/index",engines:{node:">=0.4.x"},dependencies:{underscore:"~1.6.0","mapnik-reference":"~6.0.2",optimist:"~0.6.0"},devDependencies:{mocha:"1.12.x",jshint:"0.2.x",sax:"0.1.x",istanbul:"~0.2.14",coveralls:"~2.10.1",browserify:"~7.0.0","uglify-js":"1.3.3"},scripts:{pretest:"npm install",test:"mocha -R spec",coverage:"istanbul cover ./node_modules/.bin/_mocha && coveralls < ./coverage/lcov.info"}}},{}]},{},[2])(2)}); \ No newline at end of file