forked from platanus/bower-mapboxjs
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmapbox.standalone.js.map
1 lines (1 loc) · 241 KB
/
mapbox.standalone.js.map
1
{"version":3,"sources":["node_modules/browser-pack/_prelude.js","package.json","src/mapbox.js","src/grid_control.js","src/geocoder_control.js","src/feature_layer.js","src/legend_control.js","src/share_control.js","src/tile_layer.js","src/map.js","src/grid_layer.js","src/style_layer.js","src/geocoder.js","src/marker.js","src/simplestyle.js","src/config.js","src/feedback.js","src/util.js","src/format_url.js","src/request.js","src/load_tilejson.js","src/mapbox_logo.js","src/grid.js","node_modules/mustache/mustache.js","node_modules/sanitize-caja/index.js","node_modules/isarray/index.js","node_modules/sanitize-caja/sanitizer-bundle.js","node_modules/corslite/corslite.js"],"names":["geocoderControl","require","gridControl","featureLayer","legendControl","shareControl","tileLayer","map","gridLayer","styleLayer","L","mapbox","module","exports","VERSION","version","geocoder","marker","simplestyle","TileLayer","StyleLayer","ShareControl","LegendControl","GeocoderControl","GridControl","GridLayer","FeatureLayer","Map","config","sanitize","template","to_html","feedback","window","Icon","Default","imagePath","document","location","protocol","util","Mustache","Control","extend","options","pinnable","follow","sanitizer","touchTeaser","_currentContent","_pinned","initialize","_","Util","setOptions","this","strict_instance","Class","_layer","setTemplate","strict","_template","format","data","getTileJSON","d","_show","content","o","_popup","setContent","setLatLng","latLng","_map","openOn","_container","style","display","_contentWrapper","innerHTML","hide","closePopup","DomUtil","removeClass","_mouseover","addClass","_mousemove","_navigateTo","url","top","href","_click","location_formatted","search","Browser","touch","_onPopupClose","_createClosebutton","container","fn","link","create","title","DomEvent","on","stopPropagation","preventDefault","onAdd","contentWrapper","appendChild","Popup","autoPan","closeOnClick","disableClickPropagation","addListener","onRemove","off","includes","Mixin","Events","proximity","position","pointZoom","keepOpen","autocomplete","queryOptions","setURL","_updateSubmit","bind","_updateAutocomplete","_chooseResult","accessToken","getURL","setID","setTileJSON","_toggle","e","stop","hasClass","_results","_input","blur","focus","select","_closeIfOpen","results","wrap","form","input","type","setAttribute","_geocode","_autocomplete","_form","err","resp","fire","error","features","length","feature","_displayResults","i","l","Math","min","name","place_name","r","result","bbox","fitBounds","lbounds","center","setView","undefined","getZoom","max","value","query","getCenter","format_url","request","FeatureGroup","filter","popupOptions","closeButton","_layers","idUrl","setGeoJSON","_geojson","clearLayers","_initialize","getGeoJSON","loadURL","_request","abort","json","log","loadID","id","setFilter","getFilter","len","isArray","geometries","geometry","opts","pointToLayer","latlon","layer","GeoJSON","geometryToLayer","popupHtml","createPopup","defaultStyle","Circle","CircleMarker","setStyle","bindPopup","addLayer","_legends","_update","addLegend","text","removeLegend","hasOwnProperty","div","_loadTileJSON","_setTileJSON","_tilejson","_modal","_mask","_content","_shareClick","_clickOut","_sharing","createShareButton","buttonClass","socialMediaName","elem","createElement","createTextNode","tilejson","encodeURIComponent","webpage","image","lng","lat","embed","twitterURL","facebookURL","pinterestURL","embedValue","twitterButton","facebookButton","pinterestButton","shareHeader","shareText","shareButtons","close","target","formatPattern","formats","scalePrefix","prototype","call","strict_oneof","setFormat","redraw","setUrl","match","tiles","attribution","minZoom","minzoom","maxZoom","maxzoom","tms","scheme","bounds","getTileUrl","tilePoint","index","floor","abs","x","y","templated","replace","retina","withAccessToken","mapboxLogoControl","LMap","element","attributionControl","setPrefix","compact","offsetWidth","addControl","_mapboxLogoControl","_onLayerAdd","_onLayerRemove","_updateMapFeedbackLink","whenReady","_updateLayer","legend","_loaded","zoom","_controlContainer","getElementsByClassName","hash","toFixed","key","_onLayerReady","setTimeout","getAttribution","addAttribution","stamp","_zoomBoundLayers","_updateZoomLevels","grid","Layer","_mouseOn","_cache","grids","active","_move","getData","latlng","callback","point","project","crs","scale","_getTile","gridX","gridY","_getTileURL","urls","getPixelBounds","z","tileBounds","divideBy","_floor","_tileShouldBeLoaded","push","callbacks","nwPoint","multiplyBy","sePoint","add","Point","nw","unproject","se","LatLngBounds","intersects","tileSize","zoomOffset","minNativeZoom","_url","_formatTileURL","_getAttribution","styleURL","sources","source","split","tileJSON","join","indexOf","ownerIDStyle","owner","roundTo","precision","mult","pow","round","queryURL","isObject","parts","record","geocoding","types","country","res","reverseQuery","normalize","lon","q","pts","icon","fp","sizes","small","medium","large","size","symbol","color","iconUrl","charAt","iconSize","iconAnchor","popupAnchor","f","properties","strip_tags","popup","description","fallback","a","b","c","k","remap","mapping","defaults","stroke","stroke-width","stroke-opacity","fill","fill-opacity","HTTP_URL","HTTPS_URL","FORCE_HTTPS","REQUIRE_ACCESS_TOKEN","Feedback","contains","item","list","t","console","Error","klass","values","path","urlOrMapID","corslite","onload","JSON","parse","responseText","XMLHttpRequest","MapboxLogoControl","mapbox_logo","utfDecode","idx","charCodeAt","keys","global","factory","nodeName","define","amd","mustache","isFunction","object","typeStr","obj","escapeRegExp","string","hasProperty","propName","testRegExp","re","regExpTest","isWhitespace","nonSpaceRe","escapeHtml","String","s","entityMap","parseTemplate","tags","compileTags","tagsToCompile","spaceRe","openingTagRe","RegExp","closingTagRe","closingCurlyRe","sections","tokens","spaces","hasTag","nonSpace","start","chr","token","openSection","scanner","Scanner","eos","pos","scanUntil","valueLength","pop","scan","tagRe","whiteRe","equalsRe","curlyRe","nestTokens","squashTokens","lastToken","squashedTokens","numTokens","section","nestedTokens","collector","tail","Context","view","parentContext","cache",".","parent","Writer","objectToString","Object","toString","Array","test","&","<",">","\"","'","/","`","=","substring","lookup","names","context","lookupHit","clearCache","render","partials","renderTokens","originalTemplate","buffer","renderSection","renderInverted","renderPartial","unescapedValue","escapedValue","rawValue","subRender","self","j","slice","escape","defaultWriter","TypeError","send","cleanUrl","getScheme","getPath","cleanId","html_sanitize","arr","URI","uriStr","m","URI_RE_","nullIfAbsent","credentials","domain","port","fragment","uri","encodeIfExists2","URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_","encodeIfExists","URI_DISALLOWED_IN_PATH_","setRawQuery","encodeOne","setAllParameters","unescapedPart","extra","encodeURI","ch","n","normPath","collapse_dots","p","PARENT_DIRECTORY_HANDLER_RE","resolve","baseUri","relativeUri","absoluteUri","clone","overridden","hasScheme","setRawScheme","getRawScheme","hasCredentials","setRawCredentials","getRawCredentials","hasDomain","setRawDomain","getRawDomain","hasPort","rawPath","getRawPath","simplifiedPath","setPort","getPort","EXTRA_PARENT_PATHS_RE","absRawPath","slash","lastIndexOf","setRawPath","hasQuery","getRawQuery","hasFragment","setRawFragment","getRawFragment","rawScheme","rawCredentials","rawDomain","rawQuery","rawFragment","scheme_","credentials_","domain_","port_","path_","query_","fragment_","paramCache_","matchPart","PARENT_DIRECTORY_HANDLER","out","decodeURIComponent","toLowerCase","setScheme","newScheme","getCredentials","setCredentials","newCredentials","getDomain","setDomain","newDomain","newPort","Number","setPath","newPath","hasPath","getQuery","setQuery","newQuery","params","newParams","v","queryBuf","separator","checkParameterCache_","cgiParams","setParameterValues","newValueIndex","pc","removeParameter","getAllParameters","getParameterValues","paramNameUnescaped","getParameterMap","paramMap","getParameterValue","getFragment","setFragment","newFragment","utils","mimeTypeOf","base","html4","atype","NONE","URI_FRAGMENT","SCRIPT","STYLE","HTML","ID","IDREF","IDREFS","GLOBAL_NAME","LOCAL_NAME","CLASSES","FRAME_TARGET","MEDIA_QUERY","ATTRIBS","*::class","*::dir","*::draggable","*::hidden","*::id","*::inert","*::itemprop","*::itemref","*::itemscope","*::lang","*::onblur","*::onchange","*::onclick","*::ondblclick","*::onfocus","*::onkeydown","*::onkeypress","*::onkeyup","*::onload","*::onmousedown","*::onmousemove","*::onmouseout","*::onmouseover","*::onmouseup","*::onreset","*::onscroll","*::onselect","*::onsubmit","*::onunload","*::spellcheck","*::style","*::title","*::translate","a::accesskey","a::coords","a::href","a::hreflang","a::name","a::onblur","a::onfocus","a::shape","a::tabindex","a::target","a::type","area::accesskey","area::alt","area::coords","area::href","area::nohref","area::onblur","area::onfocus","area::shape","area::tabindex","area::target","audio::controls","audio::loop","audio::mediagroup","audio::muted","audio::preload","bdo::dir","blockquote::cite","br::clear","button::accesskey","button::disabled","button::name","button::onblur","button::onfocus","button::tabindex","button::type","button::value","canvas::height","canvas::width","caption::align","col::align","col::char","col::charoff","col::span","col::valign","col::width","colgroup::align","colgroup::char","colgroup::charoff","colgroup::span","colgroup::valign","colgroup::width","command::checked","command::command","command::disabled","command::icon","command::label","command::radiogroup","command::type","data::value","del::cite","del::datetime","details::open","dir::compact","div::align","dl::compact","fieldset::disabled","font::color","font::face","font::size","form::accept","form::action","form::autocomplete","form::enctype","form::method","form::name","form::novalidate","form::onreset","form::onsubmit","form::target","h1::align","h2::align","h3::align","h4::align","h5::align","h6::align","hr::align","hr::noshade","hr::size","hr::width","iframe::align","iframe::frameborder","iframe::height","iframe::marginheight","iframe::marginwidth","iframe::width","img::align","img::alt","img::border","img::height","img::hspace","img::ismap","img::name","img::src","img::usemap","img::vspace","img::width","input::accept","input::accesskey","input::align","input::alt","input::autocomplete","input::checked","input::disabled","input::inputmode","input::ismap","input::list","input::max","input::maxlength","input::min","input::multiple","input::name","input::onblur","input::onchange","input::onfocus","input::onselect","input::placeholder","input::readonly","input::required","input::size","input::src","input::step","input::tabindex","input::type","input::usemap","input::value","ins::cite","ins::datetime","label::accesskey","label::for","label::onblur","label::onfocus","legend::accesskey","legend::align","li::type","li::value","map::name","menu::compact","menu::label","menu::type","meter::high","meter::low","meter::max","meter::min","meter::value","ol::compact","ol::reversed","ol::start","ol::type","optgroup::disabled","optgroup::label","option::disabled","option::label","option::selected","option::value","output::for","output::name","p::align","pre::width","progress::max","progress::min","progress::value","q::cite","select::autocomplete","select::disabled","select::multiple","select::name","select::onblur","select::onchange","select::onfocus","select::required","select::size","select::tabindex","source::type","table::align","table::bgcolor","table::border","table::cellpadding","table::cellspacing","table::frame","table::rules","table::summary","table::width","tbody::align","tbody::char","tbody::charoff","tbody::valign","td::abbr","td::align","td::axis","td::bgcolor","td::char","td::charoff","td::colspan","td::headers","td::height","td::nowrap","td::rowspan","td::scope","td::valign","td::width","textarea::accesskey","textarea::autocomplete","textarea::cols","textarea::disabled","textarea::inputmode","textarea::name","textarea::onblur","textarea::onchange","textarea::onfocus","textarea::onselect","textarea::placeholder","textarea::readonly","textarea::required","textarea::rows","textarea::tabindex","textarea::wrap","tfoot::align","tfoot::char","tfoot::charoff","tfoot::valign","th::abbr","th::align","th::axis","th::bgcolor","th::char","th::charoff","th::colspan","th::headers","th::height","th::nowrap","th::rowspan","th::scope","th::valign","th::width","thead::align","thead::char","thead::charoff","thead::valign","tr::align","tr::bgcolor","tr::char","tr::charoff","tr::valign","track::default","track::kind","track::label","track::srclang","ul::compact","ul::type","video::controls","video::height","video::loop","video::mediagroup","video::muted","video::poster","video::preload","video::width","eflags","OPTIONAL_ENDTAG","EMPTY","CDATA","RCDATA","UNSAFE","FOLDABLE","VIRTUALIZED","ELEMENTS","abbr","acronym","address","applet","area","article","aside","audio","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dialog","dir","dl","dt","em","fieldset","figcaption","figure","font","footer","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","ins","isindex","kbd","keygen","label","li","mark","menu","meta","meter","nav","nobr","noembed","noframes","noscript","ol","optgroup","option","output","param","pre","progress","samp","script","span","strike","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr","ELEMENT_DOM_INTERFACES","ueffects","NOT_LOADED","SAME_DOCUMENT","NEW_DOCUMENT","URIEFFECTS","ltypes","UNSANDBOXED","SANDBOXED","DATA","LOADERTYPES","lookupEntity","ENTITIES","decimalEscapeRe","fromCharCode","parseInt","hexEscapeRe","entityLookupElement","safeEntityNameRe","textContent","decodeOneEntity","stripNULs","nulRe","unescapeEntities","ENTITY_RE_1","escapeAttrib","ampRe","ltRe","gtRe","quotRe","normalizeRCData","rcdata","looseAmpRe","makeSaxParser","handler","hcopy","cdata","comment","endDoc","endTag","pcdata","startDoc","startTag","htmlText","parseCPS","htmlSplit","noMoreGT","noMoreEndComments","continuationMaker","h","initial","state","tagName","end","current","next","ENTITY_RE_2","continuationMarker","exec","parseEndTag","EFLAGS_TEXT","tag","parseText","parseStartTag","substr","str","splitWillCapture","lastPos","parseTagAndAttrs","attrs","endTagRe","first","buf","ATTR_RE","quote","sawQuote","abuf","aName","aValue","decodeValue","makeHtmlSanitizer","tagPolicy","stack","ignoring","emit","tagNameOrig","attribs","eflagsOrig","decision","eflagsRep","tagNameRep","onStack","orig","rep","attribName","stackElOrigTag","stackElRepTag","safeUri","effect","ltype","hints","naiveUriRewriter","parsed","ALLOWED_URI_SCHEMES","safe","logger","oldValue","newValue","change","changed","lookupAttribute","attribKey","getLoaderType","getUriEffect","sanitizeAttribs","opt_naiveUriRewriter","opt_nmTokenPolicy","opt_logger","parseCssDeclarations","sanitizedDeclarations","declaration","property","normProp","schema","cssSchema","sanitizeCssProperty","TYPE","CSS_PROP","XML_ATTR","XML_TAG","makeTagPolicy","sanitizeWithPolicy","inputHtml","outputArray","lt","LT","gt","GT","amp","AMP","quot","apos","nbsp","cors","isSuccessful","status","loaded","sent","XDomainRequest","original","apply","arguments","that","args","onreadystatechange","readyState","onerror","evt","onprogress","ontimeout","onabort","open"],"mappings":"AAAA;A2BAA,QAASsb,UAAS9V,EAAKkP,EAAUm5B,GAe7B,QAASC,GAAaC,GAClB,MAAOA,IAAU,KAAOA,EAAS,KAAkB,MAAXA,EAuB5C,QAASC,SAGYjjC,KAAb+G,EAAEi8B,QAEFD,EAAah8B,EAAEi8B,QAASr5B,EAAShE,KAAKoB,EAAG,KAAMA,GAC9C4C,EAAShE,KAAKoB,EAAGA,EAAG,MA5C7B,GAAIm8B,IAAO,CAEX,QAAqC,KAA1BhsC,OAAO0Z,eACd,MAAOjH,GAASuG,MAAM,yBAG1B,QAAoB,KAAT4yB,EAAsB,CAC7B,GAAIxqB,GAAI7d,EAAIuL,MAAM,wBAClB88B,GAAOxqB,GAAMA,EAAE,KAAO/gB,SAASC,SAAW,KAAOD,SAASmhB,QACjD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!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(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 s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","module.exports={\"author\":\"Mapbox\",\"name\":\"mapbox.js\",\"description\":\"mapbox javascript api\",\"version\":\"3.1.1\",\"homepage\":\"http://mapbox.com/\",\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/mapbox/mapbox.js.git\"},\"main\":\"src/index.js\",\"dependencies\":{\"corslite\":\"0.0.6\",\"isarray\":\"0.0.1\",\"leaflet\":\"1.0.2\",\"mustache\":\"2.2.1\",\"sanitize-caja\":\"0.1.4\"},\"scripts\":{\"test\":\"eslint --no-eslintrc -c .eslintrc src && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html\"},\"license\":\"BSD-3-Clause\",\"devDependencies\":{\"browserify\":\"^13.0.0\",\"clean-css\":\"~2.0.7\",\"cz-conventional-changelog\":\"1.2.0\",\"eslint\":\"^0.23.0\",\"expect.js\":\"0.3.1\",\"happen\":\"0.1.3\",\"leaflet-fullscreen\":\"0.0.4\",\"leaflet-hash\":\"0.2.1\",\"marked\":\"~0.3.0\",\"minifyify\":\"^6.1.0\",\"minimist\":\"0.0.5\",\"mocha\":\"2.4.5\",\"mocha-phantomjs-core\":\"2.0.1\",\"phantomjs-prebuilt\":\"2.1.12\",\"sinon\":\"1.10.2\"},\"optionalDependencies\":{},\"engines\":{\"node\":\"*\"},\"config\":{\"commitizen\":{\"path\":\"./node_modules/cz-conventional-changelog\"}}}","'use strict';\n\nvar geocoderControl = require('./geocoder_control'),\n gridControl = require('./grid_control'),\n featureLayer = require('./feature_layer'),\n legendControl = require('./legend_control'),\n shareControl = require('./share_control'),\n tileLayer = require('./tile_layer'),\n map = require('./map'),\n gridLayer = require('./grid_layer'),\n styleLayer = require('./style_layer');\n\nL.mapbox = module.exports = {\n VERSION: require('../package.json').version,\n geocoder: require('./geocoder'),\n marker: require('./marker'),\n simplestyle: require('./simplestyle'),\n tileLayer: tileLayer.tileLayer,\n TileLayer: tileLayer.TileLayer,\n styleLayer: styleLayer.styleLayer,\n StyleLayer: styleLayer.StyleLayer,\n shareControl: shareControl.shareControl,\n ShareControl: shareControl.ShareControl,\n legendControl: legendControl.legendControl,\n LegendControl: legendControl.LegendControl,\n geocoderControl: geocoderControl.geocoderControl,\n GeocoderControl: geocoderControl.GeocoderControl,\n gridControl: gridControl.gridControl,\n GridControl: gridControl.GridControl,\n gridLayer: gridLayer.gridLayer,\n GridLayer: gridLayer.GridLayer,\n featureLayer: featureLayer.featureLayer,\n FeatureLayer: featureLayer.FeatureLayer,\n map: map.map,\n Map: map.Map,\n config: require('./config'),\n sanitize: require('sanitize-caja'),\n template: require('mustache').to_html,\n feedback: require('./feedback')\n};\n\n\n// Hardcode image path, because Leaflet's autodetection\n// fails, because mapbox.js is not named leaflet.js\nwindow.L.Icon.Default.imagePath =\n // Detect bad-news protocols like file:// and hardcode\n // to https if they're detected.\n ((document.location.protocol === 'https:' ||\n document.location.protocol === 'http:') ? '' : 'https:') +\n '//api.tiles.mapbox.com/mapbox.js/' + 'v' +\n require('../package.json').version + '/images/';\n","'use strict';\n\nvar util = require('./util'),\n Mustache = require('mustache');\n\nvar GridControl = L.Control.extend({\n\n options: {\n pinnable: true,\n follow: false,\n sanitizer: require('sanitize-caja'),\n touchTeaser: true,\n location: true\n },\n\n _currentContent: '',\n\n // pinned means that this control is on a feature and the user has likely\n // clicked. pinned will not become false unless the user clicks off\n // of the feature onto another or clicks x\n _pinned: false,\n\n initialize: function(_, options) {\n L.Util.setOptions(this, options);\n util.strict_instance(_, L.Class, 'L.mapbox.gridLayer');\n this._layer = _;\n },\n\n setTemplate: function(template) {\n util.strict(template, 'string');\n this.options.template = template;\n return this;\n },\n\n _template: function(format, data) {\n if (!data) return;\n var template = this.options.template || this._layer.getTileJSON().template;\n if (template) {\n var d = {};\n d['__' + format + '__'] = true;\n return this.options.sanitizer(\n Mustache.to_html(template, L.extend(d, data)));\n }\n },\n\n // change the content of the tooltip HTML if it has changed, otherwise\n // noop\n _show: function(content, o) {\n if (content === this._currentContent) return;\n\n this._currentContent = content;\n\n if (this.options.follow) {\n this._popup.setContent(content)\n .setLatLng(o.latLng);\n if (this._map._popup !== this._popup) this._popup.openOn(this._map);\n } else {\n this._container.style.display = 'block';\n this._contentWrapper.innerHTML = content;\n }\n },\n\n hide: function() {\n this._pinned = false;\n this._currentContent = '';\n\n this._map.closePopup();\n this._container.style.display = 'none';\n this._contentWrapper.innerHTML = '';\n\n L.DomUtil.removeClass(this._container, 'closable');\n\n return this;\n },\n\n _mouseover: function(o) {\n if (o.data) {\n L.DomUtil.addClass(this._map._container, 'map-clickable');\n } else {\n L.DomUtil.removeClass(this._map._container, 'map-clickable');\n }\n\n if (this._pinned) return;\n\n var content = this._template('teaser', o.data);\n if (content) {\n this._show(content, o);\n } else {\n this.hide();\n }\n },\n\n _mousemove: function(o) {\n if (this._pinned) return;\n if (!this.options.follow) return;\n\n this._popup.setLatLng(o.latLng);\n },\n\n _navigateTo: function(url) {\n window.top.location.href = url;\n },\n\n _click: function(o) {\n\n var location_formatted = this._template('location', o.data);\n if (this.options.location && location_formatted &&\n location_formatted.search(/^https?:/) === 0) {\n return this._navigateTo(this._template('location', o.data));\n }\n\n if (!this.options.pinnable) return;\n\n var content = this._template('full', o.data);\n\n if (!content && this.options.touchTeaser && L.Browser.touch) {\n content = this._template('teaser', o.data);\n }\n\n if (content) {\n L.DomUtil.addClass(this._container, 'closable');\n this._pinned = true;\n this._show(content, o);\n } else if (this._pinned) {\n L.DomUtil.removeClass(this._container, 'closable');\n this._pinned = false;\n this.hide();\n }\n },\n\n _onPopupClose: function() {\n this._currentContent = null;\n this._pinned = false;\n },\n\n _createClosebutton: function(container, fn) {\n var link = L.DomUtil.create('a', 'close', container);\n\n link.innerHTML = 'close';\n link.href = '#';\n link.title = 'close';\n\n L.DomEvent\n .on(link, 'click', L.DomEvent.stopPropagation)\n .on(link, 'mousedown', L.DomEvent.stopPropagation)\n .on(link, 'dblclick', L.DomEvent.stopPropagation)\n .on(link, 'click', L.DomEvent.preventDefault)\n .on(link, 'click', fn, this);\n\n return link;\n },\n\n onAdd: function(map) {\n this._map = map;\n\n var className = 'leaflet-control-grid map-tooltip',\n container = L.DomUtil.create('div', className),\n contentWrapper = L.DomUtil.create('div', 'map-tooltip-content');\n\n // hide the container element initially\n container.style.display = 'none';\n this._createClosebutton(container, this.hide);\n container.appendChild(contentWrapper);\n\n this._contentWrapper = contentWrapper;\n this._popup = new L.Popup({ autoPan: false, closeOnClick: false });\n\n map.on('popupclose', this._onPopupClose, this);\n\n L.DomEvent\n .disableClickPropagation(container)\n // allow people to scroll tooltips with mousewheel\n .addListener(container, 'mousewheel', L.DomEvent.stopPropagation);\n\n this._layer\n .on('mouseover', this._mouseover, this)\n .on('mousemove', this._mousemove, this)\n .on('click', this._click, this);\n\n return container;\n },\n\n onRemove: function (map) {\n\n map.off('popupclose', this._onPopupClose, this);\n\n this._layer\n .off('mouseover', this._mouseover, this)\n .off('mousemove', this._mousemove, this)\n .off('click', this._click, this);\n }\n});\n\nmodule.exports.GridControl = GridControl;\n\nmodule.exports.gridControl = function(_, options) {\n return new GridControl(_, options);\n};\n","'use strict';\n\nvar geocoder = require('./geocoder'),\n util = require('./util');\n\nvar GeocoderControl = L.Control.extend({\n includes: L.Mixin.Events,\n\n options: {\n proximity: true,\n position: 'topleft',\n pointZoom: 16,\n keepOpen: false,\n autocomplete: false,\n queryOptions: {}\n },\n\n initialize: function(_, options) {\n L.Util.setOptions(this, options);\n this.setURL(_);\n this._updateSubmit = L.bind(this._updateSubmit, this);\n this._updateAutocomplete = L.bind(this._updateAutocomplete, this);\n this._chooseResult = L.bind(this._chooseResult, this);\n },\n\n setURL: function(_) {\n this.geocoder = geocoder(_, {\n accessToken: this.options.accessToken\n });\n return this;\n },\n\n getURL: function() {\n return this.geocoder.getURL();\n },\n\n setID: function(_) {\n return this.setURL(_);\n },\n\n setTileJSON: function(_) {\n return this.setURL(_.geocoder);\n },\n\n _toggle: function(e) {\n if (e) L.DomEvent.stop(e);\n if (L.DomUtil.hasClass(this._container, 'active')) {\n L.DomUtil.removeClass(this._container, 'active');\n this._results.innerHTML = '';\n this._input.blur();\n } else {\n L.DomUtil.addClass(this._container, 'active');\n this._input.focus();\n this._input.select();\n }\n },\n\n _closeIfOpen: function() {\n if (L.DomUtil.hasClass(this._container, 'active') &&\n !this.options.keepOpen) {\n L.DomUtil.removeClass(this._container, 'active');\n this._results.innerHTML = '';\n this._input.blur();\n }\n },\n\n onAdd: function(map) {\n\n var container = L.DomUtil.create('div', 'leaflet-control-mapbox-geocoder leaflet-bar leaflet-control'),\n link = L.DomUtil.create('a', 'leaflet-control-mapbox-geocoder-toggle mapbox-icon mapbox-icon-geocoder', container),\n results = L.DomUtil.create('div', 'leaflet-control-mapbox-geocoder-results', container),\n wrap = L.DomUtil.create('div', 'leaflet-control-mapbox-geocoder-wrap', container),\n form = L.DomUtil.create('form', 'leaflet-control-mapbox-geocoder-form', wrap),\n input = L.DomUtil.create('input', '', form);\n\n link.href = '#';\n link.innerHTML = ' ';\n\n input.type = 'text';\n input.setAttribute('placeholder', 'Search');\n\n L.DomEvent.addListener(form, 'submit', this._geocode, this);\n L.DomEvent.addListener(input, 'keyup', this._autocomplete, this);\n L.DomEvent.disableClickPropagation(container);\n\n this._map = map;\n this._results = results;\n this._input = input;\n this._form = form;\n\n if (this.options.keepOpen) {\n L.DomUtil.addClass(container, 'active');\n } else {\n this._map.on('click', this._closeIfOpen, this);\n L.DomEvent.addListener(link, 'click', this._toggle, this);\n }\n\n return container;\n },\n\n _updateSubmit: function(err, resp) {\n L.DomUtil.removeClass(this._container, 'searching');\n this._results.innerHTML = '';\n if (err || !resp) {\n this.fire('error', {error: err});\n } else {\n var features = [];\n if (resp.results && resp.results.features) {\n features = resp.results.features;\n }\n if (features.length === 1) {\n this.fire('autoselect', { feature: features[0] });\n this.fire('found', {results: resp.results});\n this._chooseResult(features[0]);\n this._closeIfOpen();\n } else if (features.length > 1) {\n this.fire('found', {results: resp.results});\n this._displayResults(features);\n } else {\n this.fire('notfound');\n this._displayResults(features);\n }\n }\n },\n\n _updateAutocomplete: function(err, resp) {\n this._results.innerHTML = '';\n if (err || !resp) {\n this.fire('error', {error: err});\n } else {\n var features = [];\n if (resp.results && resp.results.features) {\n features = resp.results.features;\n }\n if (features.length) {\n this.fire('found', {results: resp.results});\n } else {\n this.fire('notfound');\n }\n this._displayResults(features);\n }\n },\n\n _displayResults: function(features) {\n for (var i = 0, l = Math.min(features.length, 5); i < l; i++) {\n var feature = features[i];\n var name = feature.place_name;\n if (!name.length) continue;\n\n var r = L.DomUtil.create('a', '', this._results);\n var text = ('innerText' in r) ? 'innerText' : 'textContent';\n r[text] = name;\n r.setAttribute('title', name);\n r.href = '#';\n\n (L.bind(function(feature) {\n L.DomEvent.addListener(r, 'click', function(e) {\n this._chooseResult(feature);\n L.DomEvent.stop(e);\n this.fire('select', { feature: feature });\n }, this);\n }, this))(feature);\n }\n if (features.length > 5) {\n var outof = L.DomUtil.create('span', '', this._results);\n outof.innerHTML = 'Top 5 of ' + features.length + ' results';\n }\n },\n\n _chooseResult: function(result) {\n if (result.bbox) {\n this._map.fitBounds(util.lbounds(result.bbox));\n } else if (result.center) {\n this._map.setView([result.center[1], result.center[0]], (this._map.getZoom() === undefined) ?\n this.options.pointZoom :\n Math.max(this._map.getZoom(), this.options.pointZoom));\n }\n },\n\n _geocode: function(e) {\n L.DomEvent.preventDefault(e);\n if (this._input.value === '') return this._updateSubmit();\n L.DomUtil.addClass(this._container, 'searching');\n this.geocoder.query(L.Util.extend({\n query: this._input.value,\n proximity: this.options.proximity ? this._map.getCenter() : false\n }, this.options.queryOptions), this._updateSubmit);\n },\n\n _autocomplete: function() {\n if (!this.options.autocomplete) return;\n if (this._input.value === '') return this._updateAutocomplete();\n this.geocoder.query(L.Util.extend({\n query: this._input.value,\n proximity: this.options.proximity ? this._map.getCenter() : false\n }, this.options.queryOptions), this._updateAutocomplete);\n }\n});\n\nmodule.exports.GeocoderControl = GeocoderControl;\n\nmodule.exports.geocoderControl = function(_, options) {\n return new GeocoderControl(_, options);\n};\n","'use strict';\n\nvar util = require('./util'),\n format_url = require('./format_url'),\n request = require('./request'),\n marker = require('./marker'),\n simplestyle = require('./simplestyle');\n\n// # featureLayer\n//\n// A layer of features, loaded from Mapbox or else. Adds the ability\n// to reset features, filter them, and load them from a GeoJSON URL.\nvar FeatureLayer = L.FeatureGroup.extend({\n options: {\n filter: function() { return true; },\n sanitizer: require('sanitize-caja'),\n style: simplestyle.style,\n popupOptions: { closeButton: false }\n },\n\n initialize: function(_, options) {\n L.setOptions(this, options);\n\n this._layers = {};\n\n if (typeof _ === 'string') {\n util.idUrl(_, this);\n // javascript object of TileJSON data\n } else if (_ && typeof _ === 'object') {\n this.setGeoJSON(_);\n }\n },\n\n setGeoJSON: function(_) {\n this._geojson = _;\n this.clearLayers();\n this._initialize(_);\n return this;\n },\n\n getGeoJSON: function() {\n return this._geojson;\n },\n\n loadURL: function(url) {\n if (this._request && 'abort' in this._request) this._request.abort();\n this._request = request(url, L.bind(function(err, json) {\n this._request = null;\n if (err && err.type !== 'abort') {\n util.log('could not load features at ' + url);\n this.fire('error', {error: err});\n } else if (json) {\n this.setGeoJSON(json);\n this.fire('ready');\n }\n }, this));\n return this;\n },\n\n loadID: function(id) {\n return this.loadURL(format_url('/v4/' + id + '/features.json', this.options.accessToken));\n },\n\n setFilter: function(_) {\n this.options.filter = _;\n if (this._geojson) {\n this.clearLayers();\n this._initialize(this._geojson);\n }\n return this;\n },\n\n getFilter: function() {\n return this.options.filter;\n },\n\n _initialize: function(json) {\n var features = L.Util.isArray(json) ? json : json.features,\n i, len;\n\n if (features) {\n for (i = 0, len = features.length; i < len; i++) {\n // Only add this if geometry or geometries are set and not null\n if (features[i].geometries || features[i].geometry || features[i].features) {\n this._initialize(features[i]);\n }\n }\n } else if (this.options.filter(json)) {\n\n var opts = {accessToken: this.options.accessToken},\n pointToLayer = this.options.pointToLayer || function(feature, latlon) {\n return marker.style(feature, latlon, opts);\n },\n layer = L.GeoJSON.geometryToLayer(json, {\n pointToLayer: pointToLayer\n }),\n popupHtml = marker.createPopup(json, this.options.sanitizer),\n style = this.options.style,\n defaultStyle = style === simplestyle.style;\n\n if (style && 'setStyle' in layer &&\n // if the style method is the simplestyle default, then\n // never style L.Circle or L.CircleMarker because\n // simplestyle has no rules over them, only over geometry\n // primitives directly from GeoJSON\n (!(defaultStyle && (layer instanceof L.Circle ||\n layer instanceof L.CircleMarker)))) {\n if (typeof style === 'function') {\n style = style(json);\n }\n layer.setStyle(style);\n }\n\n layer.feature = json;\n\n if (popupHtml) {\n layer.bindPopup(popupHtml, this.options.popupOptions);\n }\n\n this.addLayer(layer);\n }\n }\n});\n\nmodule.exports.FeatureLayer = FeatureLayer;\n\nmodule.exports.featureLayer = function(_, options) {\n return new FeatureLayer(_, options);\n};\n","'use strict';\n\nvar LegendControl = L.Control.extend({\n\n options: {\n position: 'bottomright',\n sanitizer: require('sanitize-caja')\n },\n\n initialize: function(options) {\n L.setOptions(this, options);\n this._legends = {};\n },\n\n onAdd: function() {\n this._container = L.DomUtil.create('div', 'map-legends wax-legends');\n L.DomEvent.disableClickPropagation(this._container);\n\n this._update();\n\n return this._container;\n },\n\n addLegend: function(text) {\n if (!text) { return this; }\n\n if (!this._legends[text]) {\n this._legends[text] = 0;\n }\n\n this._legends[text]++;\n return this._update();\n },\n\n removeLegend: function(text) {\n if (!text) { return this; }\n if (this._legends[text]) this._legends[text]--;\n return this._update();\n },\n\n _update: function() {\n if (!this._map) { return this; }\n\n this._container.innerHTML = '';\n var hide = 'none';\n\n for (var i in this._legends) {\n if (this._legends.hasOwnProperty(i) && this._legends[i]) {\n var div = L.DomUtil.create('div', 'map-legend wax-legend', this._container);\n div.innerHTML = this.options.sanitizer(i);\n hide = 'block';\n }\n }\n\n // hide the control entirely unless there is at least one legend;\n // otherwise there will be a small grey blemish on the map.\n this._container.style.display = hide;\n\n return this;\n }\n});\n\nmodule.exports.LegendControl = LegendControl;\n\nmodule.exports.legendControl = function(options) {\n return new LegendControl(options);\n};\n","'use strict';\n\nvar format_url = require('./format_url');\n\nvar ShareControl = L.Control.extend({\n includes: [require('./load_tilejson')],\n\n options: {\n position: 'topleft',\n url: ''\n },\n\n initialize: function(_, options) {\n L.setOptions(this, options);\n this._loadTileJSON(_);\n },\n\n _setTileJSON: function(json) {\n this._tilejson = json;\n },\n\n onAdd: function(map) {\n this._map = map;\n\n var container = L.DomUtil.create('div', 'leaflet-control-mapbox-share leaflet-bar');\n var link = L.DomUtil.create('a', 'mapbox-share mapbox-icon mapbox-icon-share', container);\n link.href = '#';\n\n this._modal = L.DomUtil.create('div', 'mapbox-modal', this._map._container);\n this._mask = L.DomUtil.create('div', 'mapbox-modal-mask', this._modal);\n this._content = L.DomUtil.create('div', 'mapbox-modal-content', this._modal);\n\n L.DomEvent.addListener(link, 'click', this._shareClick, this);\n L.DomEvent.disableClickPropagation(container);\n\n this._map.on('mousedown', this._clickOut, this);\n\n return container;\n },\n\n _clickOut: function(e) {\n if (this._sharing) {\n L.DomEvent.preventDefault(e);\n L.DomUtil.removeClass(this._modal, 'active');\n this._content.innerHTML = '';\n this._sharing = null;\n return;\n }\n },\n\n _shareClick: function(e) {\n L.DomEvent.stop(e);\n if (this._sharing) return this._clickOut(e);\n\n var tilejson = this._tilejson || this._map._tilejson || {},\n url = encodeURIComponent(this.options.url || tilejson.webpage || window.location),\n name = encodeURIComponent(tilejson.name),\n image = format_url('/v4/' + tilejson.id + '/' + this._map.getCenter().lng + ',' + this._map.getCenter().lat + ',' + this._map.getZoom() + '/600x600.png', this.options.accessToken),\n embed = format_url('/v4/' + tilejson.id + '.html', this.options.accessToken),\n twitterURL = '//twitter.com/intent/tweet?status=' + name + ' ' + url,\n facebookURL = '//www.facebook.com/sharer.php?u=' + url + '&t=' + name,\n pinterestURL = '//www.pinterest.com/pin/create/button/?url=' + url + '&media=' + image + '&description=' + name,\n embedValue = '<iframe width=\"100%\" height=\"500px\" frameBorder=\"0\" src=\"' + embed + '\"></iframe>',\n embedLabel = 'Copy and paste this <strong>HTML code</strong> into documents to embed this map on web pages.';\n\n function createShareButton(buttonClass, href, socialMediaName) {\n var elem = document.createElement('a');\n elem.setAttribute('class', buttonClass);\n elem.setAttribute('href', href);\n elem.setAttribute('target', '_blank');\n socialMediaName = document.createTextNode(socialMediaName);\n elem.appendChild(socialMediaName);\n\n return elem;\n }\n\n L.DomUtil.addClass(this._modal, 'active');\n\n this._sharing = L.DomUtil.create('div', 'mapbox-modal-body', this._content);\n\n var twitterButton = createShareButton('mapbox-button mapbox-button-icon mapbox-icon-twitter', twitterURL, 'Twitter');\n var facebookButton = createShareButton('mapbox-button mapbox-button-icon mapbox-icon-facebook', facebookURL, 'Facebook');\n var pinterestButton = createShareButton('mapbox-button mapbox-button-icon mapbox-icon-pinterest', pinterestURL, 'Pinterest');\n\n var shareHeader = document.createElement('h3');\n var shareText = document.createTextNode('Share this map');\n shareHeader.appendChild(shareText);\n\n var shareButtons = document.createElement('div');\n shareButtons.setAttribute('class', 'mapbox-share-buttons');\n shareButtons.appendChild(facebookButton);\n shareButtons.appendChild(twitterButton);\n shareButtons.appendChild(pinterestButton);\n\n this._sharing.appendChild(shareHeader);\n this._sharing.appendChild(shareButtons);\n\n var input = L.DomUtil.create('input', 'mapbox-embed', this._sharing);\n input.type = 'text';\n input.value = embedValue;\n\n var label = L.DomUtil.create('label', 'mapbox-embed-description', this._sharing);\n label.innerHTML = embedLabel;\n\n var close = L.DomUtil.create('a', 'leaflet-popup-close-button', this._sharing);\n close.href = '#';\n\n L.DomEvent.disableClickPropagation(this._sharing);\n L.DomEvent.addListener(close, 'click', this._clickOut, this);\n L.DomEvent.addListener(input, 'click', function(e) {\n e.target.focus();\n e.target.select();\n });\n }\n});\n\nmodule.exports.ShareControl = ShareControl;\n\nmodule.exports.shareControl = function(_, options) {\n return new ShareControl(_, options);\n};\n","'use strict';\n\nvar util = require('./util');\nvar formatPattern = /\\.((?:png|jpg)\\d*)(?=$|\\?)/;\n\nvar TileLayer = L.TileLayer.extend({\n includes: [require('./load_tilejson')],\n\n options: {\n sanitizer: require('sanitize-caja')\n },\n\n // http://mapbox.com/developers/api/#image_quality\n formats: [\n 'png', 'jpg',\n // PNG\n 'png32', 'png64', 'png128', 'png256',\n // JPG\n 'jpg70', 'jpg80', 'jpg90'],\n\n scalePrefix: '@2x.',\n\n initialize: function(_, options) {\n L.TileLayer.prototype.initialize.call(this, undefined, options);\n\n this._tilejson = {};\n\n if (options && options.format) {\n util.strict_oneof(options.format, this.formats);\n }\n\n this._loadTileJSON(_);\n },\n\n setFormat: function(_) {\n util.strict(_, 'string');\n this.options.format = _;\n this.redraw();\n return this;\n },\n\n // disable the setUrl function, which is not available on mapbox tilelayers\n setUrl: null,\n\n _setTileJSON: function(json) {\n util.strict(json, 'object');\n\n if (!this.options.format) {\n var match = json.tiles[0].match(formatPattern);\n if (match) {\n this.options.format = match[1];\n }\n }\n\n L.extend(this.options, {\n tiles: json.tiles,\n attribution: this.options.sanitizer(json.attribution),\n minZoom: json.minzoom || 0,\n maxZoom: json.maxzoom || 18,\n tms: json.scheme === 'tms',\n bounds: json.bounds && util.lbounds(json.bounds)\n });\n\n this._tilejson = json;\n this.redraw();\n return this;\n },\n\n getTileJSON: function() {\n return this._tilejson;\n },\n\n // this is an exception to mapbox.js naming rules because it's called\n // by `L.map`\n getTileUrl: function(tilePoint) {\n var tiles = this.options.tiles,\n index = Math.floor(Math.abs(tilePoint.x + tilePoint.y) % tiles.length),\n url = tiles[index];\n\n var templated = L.Util.template(url, tilePoint);\n if (!templated || !this.options.format) {\n return templated;\n } else {\n return templated.replace(formatPattern,\n (L.Browser.retina ? this.scalePrefix : '.') + this.options.format);\n }\n },\n\n // TileJSON.TileLayers are added to the map immediately, so that they get\n // the desired z-index, but do not update until the TileJSON has been loaded.\n _update: function() {\n if (this.options.tiles) {\n L.TileLayer.prototype._update.call(this);\n }\n }\n});\n\nmodule.exports.TileLayer = TileLayer;\n\nmodule.exports.tileLayer = function(_, options) {\n return new TileLayer(_, options);\n};\n","'use strict';\n\nvar tileLayer = require('./tile_layer').tileLayer,\n featureLayer = require('./feature_layer').featureLayer,\n gridLayer = require('./grid_layer').gridLayer,\n gridControl = require('./grid_control').gridControl,\n shareControl = require('./share_control').shareControl,\n legendControl = require('./legend_control').legendControl,\n mapboxLogoControl = require('./mapbox_logo').mapboxLogoControl,\n feedback = require('./feedback');\n\nfunction withAccessToken(options, accessToken) {\n if (!accessToken || options.accessToken)\n return options;\n return L.extend({accessToken: accessToken}, options);\n}\n\nvar LMap = L.Map.extend({\n includes: [require('./load_tilejson')],\n\n options: {\n tileLayer: {},\n featureLayer: {},\n gridLayer: {},\n legendControl: {},\n gridControl: {},\n shareControl: false,\n sanitizer: require('sanitize-caja')\n },\n\n _tilejson: {},\n\n initialize: function(element, _, options) {\n\n L.Map.prototype.initialize.call(this, element,\n L.extend({}, L.Map.prototype.options, options));\n\n // Disable the default 'Leaflet' text\n if (this.attributionControl) {\n this.attributionControl.setPrefix('');\n\n var compact = this.options.attributionControl.compact;\n // Set a compact display if map container width is < 640 or\n // compact is set to `true` in attributionControl options.\n if (compact || (compact !== false && this._container.offsetWidth <= 640)) {\n L.DomUtil.addClass(this.attributionControl._container, 'leaflet-compact-attribution');\n }\n\n if (compact === undefined) {\n this.on('resize', function() {\n if (this._container.offsetWidth > 640) {\n L.DomUtil.removeClass(this.attributionControl._container, 'leaflet-compact-attribution');\n } else {\n L.DomUtil.addClass(this.attributionControl._container, 'leaflet-compact-attribution');\n }\n });\n }\n }\n\n if (this.options.tileLayer) {\n this.tileLayer = tileLayer(undefined,\n withAccessToken(this.options.tileLayer, this.options.accessToken));\n this.addLayer(this.tileLayer);\n }\n\n if (this.options.featureLayer) {\n this.featureLayer = featureLayer(undefined,\n withAccessToken(this.options.featureLayer, this.options.accessToken));\n this.addLayer(this.featureLayer);\n }\n\n if (this.options.gridLayer) {\n this.gridLayer = gridLayer(undefined,\n withAccessToken(this.options.gridLayer, this.options.accessToken));\n this.addLayer(this.gridLayer);\n }\n\n if (this.options.gridLayer && this.options.gridControl) {\n this.gridControl = gridControl(this.gridLayer, this.options.gridControl);\n this.addControl(this.gridControl);\n }\n\n if (this.options.legendControl) {\n this.legendControl = legendControl(this.options.legendControl);\n this.addControl(this.legendControl);\n }\n\n if (this.options.shareControl) {\n this.shareControl = shareControl(undefined,\n withAccessToken(this.options.shareControl, this.options.accessToken));\n this.addControl(this.shareControl);\n }\n\n this._mapboxLogoControl = mapboxLogoControl(this.options.mapboxLogoControl);\n this.addControl(this._mapboxLogoControl);\n\n this._loadTileJSON(_);\n\n this.on('layeradd', this._onLayerAdd, this)\n .on('layerremove', this._onLayerRemove, this)\n .on('moveend', this._updateMapFeedbackLink, this);\n\n this.whenReady(function () {\n feedback.on('change', this._updateMapFeedbackLink, this);\n });\n\n this.on('unload', function () {\n feedback.off('change', this._updateMapFeedbackLink, this);\n });\n },\n\n // use a javascript object of tilejson data to configure this layer\n _setTileJSON: function(_) {\n this._tilejson = _;\n this._initialize(_);\n return this;\n },\n\n getTileJSON: function() {\n return this._tilejson;\n },\n\n _initialize: function(json) {\n if (this.tileLayer) {\n this.tileLayer._setTileJSON(json);\n this._updateLayer(this.tileLayer);\n }\n\n if (this.featureLayer && !this.featureLayer.getGeoJSON() && json.data && json.data[0]) {\n this.featureLayer.loadURL(json.data[0]);\n }\n\n if (this.gridLayer) {\n this.gridLayer._setTileJSON(json);\n this._updateLayer(this.gridLayer);\n }\n\n if (this.legendControl && json.legend) {\n this.legendControl.addLegend(json.legend);\n }\n\n if (this.shareControl) {\n this.shareControl._setTileJSON(json);\n }\n\n this._mapboxLogoControl._setTileJSON(json);\n\n if (!this._loaded && json.center) {\n var zoom = this.getZoom() !== undefined ? this.getZoom() : json.center[2],\n center = L.latLng(json.center[1], json.center[0]);\n\n this.setView(center, zoom);\n }\n },\n\n _updateMapFeedbackLink: function() {\n if (!this._controlContainer.getElementsByClassName) return;\n var link = this._controlContainer.getElementsByClassName('mapbox-improve-map');\n if (link.length && this._loaded) {\n var center = this.getCenter().wrap();\n var tilejson = this._tilejson || {};\n var id = tilejson.id || '';\n\n var hash = '#' + id + '/' +\n center.lng.toFixed(3) + '/' +\n center.lat.toFixed(3) + '/' +\n this.getZoom();\n\n for (var key in feedback.data) {\n hash += '/' + key + '=' + feedback.data[key];\n }\n\n for (var i = 0; i < link.length; i++) {\n link[i].hash = hash;\n }\n }\n },\n\n _onLayerAdd: function(e) {\n if ('on' in e.layer) {\n e.layer.on('ready', this._onLayerReady, this);\n }\n window.setTimeout(L.bind(this._updateMapFeedbackLink, this), 0); // Update after attribution control resets the HTML.\n },\n\n _onLayerRemove: function(e) {\n if ('on' in e.layer) {\n e.layer.off('ready', this._onLayerReady, this);\n }\n window.setTimeout(L.bind(this._updateMapFeedbackLink, this), 0); // Update after attribution control resets the HTML.\n },\n\n _onLayerReady: function(e) {\n this._updateLayer(e.target);\n },\n\n _updateLayer: function(layer) {\n if (!layer.options) return;\n\n if (this.attributionControl && this._loaded && layer.getAttribution) {\n this.attributionControl.addAttribution(layer.getAttribution());\n }\n\n if (!(L.stamp(layer) in this._zoomBoundLayers) &&\n (layer.options.maxZoom || layer.options.minZoom)) {\n this._zoomBoundLayers[L.stamp(layer)] = layer;\n }\n\n this._updateMapFeedbackLink();\n this._updateZoomLevels();\n }\n});\n\nmodule.exports.Map = LMap;\n\nmodule.exports.map = function(element, _, options) {\n return new LMap(element, _, options);\n};\n","'use strict';\n\nvar util = require('./util'),\n request = require('./request'),\n grid = require('./grid');\n\n// forked from danzel/L.UTFGrid\nvar GridLayer = L.Layer.extend({\n includes: [require('./load_tilejson')],\n\n options: {\n template: function() { return ''; }\n },\n\n _mouseOn: null,\n _tilejson: {},\n _cache: {},\n\n initialize: function(_, options) {\n L.Util.setOptions(this, options);\n this._loadTileJSON(_);\n },\n\n _setTileJSON: function(json) {\n util.strict(json, 'object');\n\n L.extend(this.options, {\n grids: json.grids,\n minZoom: json.minzoom,\n maxZoom: json.maxzoom,\n bounds: json.bounds && util.lbounds(json.bounds)\n });\n\n this._tilejson = json;\n this._cache = {};\n this._update();\n\n return this;\n },\n\n getTileJSON: function() {\n return this._tilejson;\n },\n\n active: function() {\n return !!(this._map && this.options.grids && this.options.grids.length);\n },\n\n onAdd: function(map) {\n this._map = map;\n this._update();\n\n this._map\n .on('click', this._click, this)\n .on('mousemove', this._move, this)\n .on('moveend', this._update, this);\n },\n\n onRemove: function() {\n this._map\n .off('click', this._click, this)\n .off('mousemove', this._move, this)\n .off('moveend', this._update, this);\n },\n\n getData: function(latlng, callback) {\n if (!this.active()) return;\n\n var map = this._map,\n point = map.project(latlng.wrap()),\n tileSize = 256,\n resolution = 4,\n x = Math.floor(point.x / tileSize),\n y = Math.floor(point.y / tileSize),\n max = map.options.crs.scale(map.getZoom()) / tileSize;\n\n x = (x + max) % max;\n y = (y + max) % max;\n\n this._getTile(map.getZoom(), x, y, function(grid) {\n var gridX = Math.floor((point.x - (x * tileSize)) / resolution),\n gridY = Math.floor((point.y - (y * tileSize)) / resolution);\n\n callback(grid(gridX, gridY));\n });\n\n return this;\n },\n\n _click: function(e) {\n this.getData(e.latlng, L.bind(function(data) {\n this.fire('click', {\n latLng: e.latlng,\n data: data\n });\n }, this));\n },\n\n _move: function(e) {\n this.getData(e.latlng, L.bind(function(data) {\n if (data !== this._mouseOn) {\n if (this._mouseOn) {\n this.fire('mouseout', {\n latLng: e.latlng,\n data: this._mouseOn\n });\n }\n\n this.fire('mouseover', {\n latLng: e.latlng,\n data: data\n });\n\n this._mouseOn = data;\n } else {\n this.fire('mousemove', {\n latLng: e.latlng,\n data: data\n });\n }\n }, this));\n },\n\n _getTileURL: function(tilePoint) {\n var urls = this.options.grids,\n index = (tilePoint.x + tilePoint.y) % urls.length,\n url = urls[index];\n\n return L.Util.template(url, tilePoint);\n },\n\n // Load up all required json grid files\n _update: function() {\n if (!this.active()) return;\n\n var bounds = this._map.getPixelBounds(),\n z = this._map.getZoom(),\n tileSize = 256;\n\n if (z > this.options.maxZoom || z < this.options.minZoom) return;\n\n var tileBounds = L.bounds(\n bounds.min.divideBy(tileSize)._floor(),\n bounds.max.divideBy(tileSize)._floor()),\n max = this._map.options.crs.scale(z) / tileSize;\n\n for (var x = tileBounds.min.x; x <= tileBounds.max.x; x++) {\n for (var y = tileBounds.min.y; y <= tileBounds.max.y; y++) {\n // x wrapped\n this._getTile(z, ((x % max) + max) % max, ((y % max) + max) % max);\n }\n }\n },\n\n _getTile: function(z, x, y, callback) {\n var key = z + '_' + x + '_' + y,\n tilePoint = L.point(x, y);\n\n tilePoint.z = z;\n\n if (!this._tileShouldBeLoaded(tilePoint)) {\n return;\n }\n\n if (key in this._cache) {\n if (!callback) return;\n\n if (typeof this._cache[key] === 'function') {\n callback(this._cache[key]); // Already loaded\n } else {\n this._cache[key].push(callback); // Pending\n }\n\n return;\n }\n\n this._cache[key] = [];\n\n if (callback) {\n this._cache[key].push(callback);\n }\n\n request(this._getTileURL(tilePoint), L.bind(function(err, json) {\n var callbacks = this._cache[key];\n this._cache[key] = grid(json);\n for (var i = 0; i < callbacks.length; ++i) {\n callbacks[i](this._cache[key]);\n }\n }, this));\n },\n\n _tileShouldBeLoaded: function(tilePoint) {\n if (tilePoint.z > this.options.maxZoom || tilePoint.z < this.options.minZoom) {\n return false;\n }\n\n if (this.options.bounds) {\n var tileSize = 256,\n nwPoint = tilePoint.multiplyBy(tileSize),\n sePoint = nwPoint.add(new L.Point(tileSize, tileSize)),\n nw = this._map.unproject(nwPoint),\n se = this._map.unproject(sePoint),\n bounds = new L.LatLngBounds([nw, se]);\n\n if (!this.options.bounds.intersects(bounds)) {\n return false;\n }\n }\n\n return true;\n }\n});\n\nmodule.exports.GridLayer = GridLayer;\n\nmodule.exports.gridLayer = function(_, options) {\n return new GridLayer(_, options);\n};\n","'use strict';\n\nvar util = require('./util');\nvar format_url = require('./format_url');\nvar request = require('./request');\n\nvar StyleLayer = L.TileLayer.extend({\n\n options: {\n sanitizer: require('sanitize-caja')\n },\n\n initialize: function(_, options) {\n L.TileLayer.prototype.initialize.call(this, undefined, L.extend({}, options, {\n tileSize: 512,\n zoomOffset: -1,\n minNativeZoom: 0,\n tms: false\n }));\n this._url = this._formatTileURL(_);\n this._getAttribution(_);\n },\n\n _getAttribution: function(_) {\n var styleURL = format_url.style(_, this.options && this.options.accessToken);\n request(styleURL, L.bind(function(err, style) {\n if (err) {\n util.log('could not load Mapbox style at ' + styleURL);\n this.fire('error', {error: err});\n }\n var sources = [];\n for (var id in style.sources) {\n var source = style.sources[id].url.split('mapbox://')[1];\n sources.push(source);\n }\n request(format_url.tileJSON(sources.join(), this.options.accessToken), L.bind(function(err, json) {\n if (err) {\n util.log('could not load TileJSON at ' + _);\n this.fire('error', {error: err});\n } else if (json) {\n util.strict(json, 'object');\n\n this.options.attribution = this.options.sanitizer(json.attribution);\n\n this._tilejson = json;\n this.fire('ready');\n }\n }, this));\n }, this));\n },\n\n // disable the setUrl function, which is not available on mapbox tilelayers\n setUrl: null,\n\n _formatTileURL: function(style) {\n if (typeof style === 'string') {\n if (style.indexOf('mapbox://styles/') === -1) {\n util.log('Incorrectly formatted Mapbox style at ' + style);\n this.fire('error');\n }\n var ownerIDStyle = style.split('mapbox://styles/')[1];\n return format_url('/styles/v1/' + ownerIDStyle + '/tiles/{z}/{x}/{y}{r}', this.options.accessToken);\n } else if (typeof style === 'object') {\n return format_url('/styles/v1/' + style.owner + '/' + style.id + '/tiles/{z}/{x}/{y}{r}', this.options.accessToken);\n }\n }\n});\n\nmodule.exports.StyleLayer = StyleLayer;\n\nmodule.exports.styleLayer = function(_, options) {\n return new StyleLayer(_, options);\n};\n","'use strict';\n\nvar isArray = require('isarray'),\n util = require('./util'),\n format_url = require('./format_url'),\n feedback = require('./feedback'),\n request = require('./request');\n\n// Low-level geocoding interface - wraps specific API calls and their\n// return values.\nmodule.exports = function(url, options) {\n if (!options) options = {};\n var geocoder = {};\n\n util.strict(url, 'string');\n\n if (url.indexOf('/') === -1) {\n url = format_url('/geocoding/v5/' + url + '/{query}.json', options.accessToken, 5);\n }\n\n function roundTo(latLng, precision) {\n var mult = Math.pow(10, precision);\n latLng.lat = Math.round(latLng.lat * mult) / mult;\n latLng.lng = Math.round(latLng.lng * mult) / mult;\n return latLng;\n }\n\n geocoder.getURL = function() {\n return url;\n };\n\n geocoder.queryURL = function(_) {\n var isObject = !(isArray(_) || typeof _ === 'string'),\n query = isObject ? _.query : _;\n\n if (isArray(query)) {\n var parts = [];\n for (var i = 0; i < query.length; i++) {\n parts[i] = encodeURIComponent(query[i]);\n }\n query = parts.join(';');\n } else {\n query = encodeURIComponent(query);\n }\n\n feedback.record({ geocoding: query });\n\n var url = L.Util.template(geocoder.getURL(), {query: query});\n\n if (isObject) {\n if (_.types) {\n if (isArray(_.types)) {\n url += '&types=' + _.types.join();\n } else {\n url += '&types=' + _.types;\n }\n }\n\n if (_.country) {\n if (isArray(_.country)) {\n url += '&country=' + _.country.join();\n } else {\n url += '&country=' + _.country;\n }\n }\n\n if (_.bbox) {\n if (isArray(_.bbox)) {\n url += '&bbox=' + _.bbox.join();\n } else {\n url += '&bbox=' + _.bbox;\n }\n }\n\n if (_.proximity) {\n var proximity = roundTo(L.latLng(_.proximity), 3);\n url += '&proximity=' + proximity.lng + ',' + proximity.lat;\n }\n\n if (typeof _.autocomplete === 'boolean') {\n url += '&autocomplete=' + _.autocomplete;\n }\n }\n\n return url;\n };\n\n geocoder.query = function(_, callback) {\n util.strict(callback, 'function');\n\n request(geocoder.queryURL(_), function(err, json) {\n if (json && (json.length || json.features)) {\n var res = {\n results: json\n };\n if (json.features && json.features.length) {\n res.latlng = [\n json.features[0].center[1],\n json.features[0].center[0]];\n\n if (json.features[0].bbox) {\n res.bounds = json.features[0].bbox;\n res.lbounds = util.lbounds(res.bounds);\n }\n }\n callback(null, res);\n } else callback(err || true);\n });\n\n return geocoder;\n };\n\n // a reverse geocode:\n //\n // geocoder.reverseQuery([80, 20])\n geocoder.reverseQuery = function(_, callback) {\n var q = '';\n\n // sort through different ways people represent lat and lon pairs\n function normalize(x) {\n var latLng;\n if (x.lat !== undefined && x.lng !== undefined) {\n latLng = L.latLng(x.lat, x.lng);\n } else if (x.lat !== undefined && x.lon !== undefined) {\n latLng = L.latLng(x.lat, x.lon);\n } else {\n latLng = L.latLng(x[1], x[0]);\n }\n latLng = roundTo(latLng, 5);\n return latLng.lng + ',' + latLng.lat;\n }\n\n if (_.length && _[0].length) {\n for (var i = 0, pts = []; i < _.length; i++) {\n pts.push(normalize(_[i]));\n }\n q = pts.join(';');\n } else {\n q = normalize(_);\n }\n\n request(geocoder.queryURL(q), function(err, json) {\n callback(err, json);\n });\n\n return geocoder;\n };\n\n return geocoder;\n};\n","'use strict';\n\nvar format_url = require('./format_url'),\n util = require('./util'),\n sanitize = require('sanitize-caja');\n\n// mapbox-related markers functionality\n// provide an icon from mapbox's simple-style spec and hosted markers\n// service\nfunction icon(fp, options) {\n fp = fp || {};\n\n var sizes = {\n small: [20, 50],\n medium: [30, 70],\n large: [35, 90]\n },\n size = fp['marker-size'] || 'medium',\n symbol = ('marker-symbol' in fp && fp['marker-symbol'] !== '') ? '-' + fp['marker-symbol'] : '',\n color = (fp['marker-color'] || '7e7e7e').replace('#', '');\n\n return L.icon({\n iconUrl: format_url('/v4/marker/' +\n 'pin-' + size.charAt(0) + symbol + '+' + color +\n // detect and use retina markers, which are x2 resolution\n (L.Browser.retina ? '@2x' : '') + '.png', options && options.accessToken),\n iconSize: sizes[size],\n iconAnchor: [sizes[size][0] / 2, sizes[size][1] / 2],\n popupAnchor: [0, -sizes[size][1] / 2]\n });\n}\n\n// a factory that provides markers for Leaflet from Mapbox's\n// [simple-style specification](https://github.com/mapbox/simplestyle-spec)\n// and [Markers API](http://mapbox.com/developers/api/#markers).\nfunction style(f, latlon, options) {\n return L.marker(latlon, {\n icon: icon(f.properties, options),\n title: util.strip_tags(\n sanitize((f.properties && f.properties.title) || ''))\n });\n}\n\n// Sanitize and format properties of a GeoJSON Feature object in order\n// to form the HTML string used as the argument for `L.createPopup`\nfunction createPopup(f, sanitizer) {\n if (!f || !f.properties) return '';\n var popup = '';\n\n if (f.properties.title) {\n popup += '<div class=\"marker-title\">' + f.properties.title + '</div>';\n }\n\n if (f.properties.description) {\n popup += '<div class=\"marker-description\">' + f.properties.description + '</div>';\n }\n\n return (sanitizer || sanitize)(popup);\n}\n\nmodule.exports = {\n icon: icon,\n style: style,\n createPopup: createPopup\n};\n","'use strict';\n\n// an implementation of the simplestyle spec for polygon and linestring features\n// https://github.com/mapbox/simplestyle-spec\nvar defaults = {\n stroke: '#555555',\n 'stroke-width': 2,\n 'stroke-opacity': 1,\n fill: '#555555',\n 'fill-opacity': 0.5\n};\n\nvar mapping = [\n ['stroke', 'color'],\n ['stroke-width', 'weight'],\n ['stroke-opacity', 'opacity'],\n ['fill', 'fillColor'],\n ['fill-opacity', 'fillOpacity']\n];\n\nfunction fallback(a, b) {\n var c = {};\n for (var k in b) {\n if (a[k] === undefined) c[k] = b[k];\n else c[k] = a[k];\n }\n return c;\n}\n\nfunction remap(a) {\n var d = {};\n for (var i = 0; i < mapping.length; i++) {\n d[mapping[i][1]] = a[mapping[i][0]];\n }\n return d;\n}\n\nfunction style(feature) {\n return remap(fallback(feature.properties || {}, defaults));\n}\n\nmodule.exports = {\n style: style,\n defaults: defaults\n};\n","'use strict';\n\nmodule.exports = {\n HTTP_URL: 'http://a.tiles.mapbox.com/v4',\n HTTPS_URL: 'https://a.tiles.mapbox.com/v4',\n FORCE_HTTPS: false,\n REQUIRE_ACCESS_TOKEN: true\n};\n","'use strict';\n\nvar Feedback = L.Class.extend({\n includes: L.Mixin.Events,\n data: {},\n record: function(data) {\n L.extend(this.data, data);\n this.fire('change');\n }\n});\n\nmodule.exports = new Feedback();\n","'use strict';\n\nfunction contains(item, list) {\n if (!list || !list.length) return false;\n for (var i = 0; i < list.length; i++) {\n if (list[i] === item) return true;\n }\n return false;\n}\n\nmodule.exports = {\n idUrl: function(_, t) {\n if (_.indexOf('/') === -1) t.loadID(_);\n else t.loadURL(_);\n },\n log: function(_) {\n if (typeof console === 'object' &&\n typeof console.error === 'function') {\n console.error(_);\n }\n },\n strict: function(_, type) {\n if (typeof _ !== type) {\n throw new Error('Invalid argument: ' + type + ' expected');\n }\n },\n strict_instance: function(_, klass, name) {\n if (!(_ instanceof klass)) {\n throw new Error('Invalid argument: ' + name + ' expected');\n }\n },\n strict_oneof: function(_, values) {\n if (!contains(_, values)) {\n throw new Error('Invalid argument: ' + _ + ' given, valid values are ' +\n values.join(', '));\n }\n },\n strip_tags: function(_) {\n return _.replace(/<[^<]+>/g, '');\n },\n lbounds: function(_) {\n // leaflet-compatible bounds, since leaflet does not do geojson\n return new L.LatLngBounds([[_[1], _[0]], [_[3], _[2]]]);\n }\n};\n","'use strict';\n\nvar config = require('./config'),\n version = require('../package.json').version;\n\nmodule.exports = function(path, accessToken) {\n accessToken = accessToken || L.mapbox.accessToken;\n\n if (!accessToken && config.REQUIRE_ACCESS_TOKEN) {\n throw new Error('An API access token is required to use Mapbox.js. ' +\n 'See https://www.mapbox.com/mapbox.js/api/v' + version + '/api-access-tokens/');\n }\n\n var url = (document.location.protocol === 'https:' || config.FORCE_HTTPS) ? config.HTTPS_URL : config.HTTP_URL;\n url = url.replace(/\\/v4$/, '');\n url += path;\n\n if (config.REQUIRE_ACCESS_TOKEN) {\n if (accessToken[0] === 's') {\n throw new Error('Use a public access token (pk.*) with Mapbox.js, not a secret access token (sk.*). ' +\n 'See https://www.mapbox.com/mapbox.js/api/v' + version + '/api-access-tokens/');\n }\n\n url += url.indexOf('?') !== -1 ? '&access_token=' : '?access_token=';\n url += accessToken;\n }\n\n return url;\n};\n\nmodule.exports.tileJSON = function(urlOrMapID, accessToken) {\n\n if (urlOrMapID.indexOf('mapbox://styles') === 0) {\n throw new Error('Styles created with Mapbox Studio need to be used with ' +\n 'L.mapbox.styleLayer, not L.mapbox.tileLayer');\n }\n\n if (urlOrMapID.indexOf('/') !== -1)\n return urlOrMapID;\n\n var url = module.exports('/v4/' + urlOrMapID + '.json', accessToken);\n\n // TileJSON requests need a secure flag appended to their URLs so\n // that the server knows to send SSL-ified resource references.\n if (url.indexOf('https') === 0)\n url += '&secure';\n\n return url;\n};\n\n\nmodule.exports.style = function(styleURL, accessToken) {\n if (styleURL.indexOf('mapbox://styles/') === -1) throw new Error('Incorrectly formatted Mapbox style at ' + styleURL);\n\n var ownerIDStyle = styleURL.split('mapbox://styles/')[1];\n var url = module.exports('/styles/v1/' + ownerIDStyle, accessToken)\n .replace('http://', 'https://');\n\n return url;\n};\n","'use strict';\n\nvar corslite = require('corslite'),\n strict = require('./util').strict,\n config = require('./config');\n\nvar protocol = /^(https?:)?(?=\\/\\/(.|api)\\.tiles\\.mapbox\\.com\\/)/;\n\nmodule.exports = function(url, callback) {\n strict(url, 'string');\n strict(callback, 'function');\n\n url = url.replace(protocol, function(match, protocol) {\n if (!('withCredentials' in new window.XMLHttpRequest())) {\n // XDomainRequest in use; doesn't support cross-protocol requests\n return document.location.protocol;\n } else if (protocol === 'https:' || document.location.protocol === 'https:' || config.FORCE_HTTPS) {\n return 'https:';\n } else {\n return 'http:';\n }\n });\n\n function onload(err, resp) {\n if (!err && resp) {\n resp = JSON.parse(resp.responseText);\n }\n callback(err, resp);\n }\n\n return corslite(url, onload);\n};\n","'use strict';\n\nvar request = require('./request'),\n format_url = require('./format_url'),\n util = require('./util');\n\nmodule.exports = {\n _loadTileJSON: function(_) {\n if (typeof _ === 'string') {\n _ = format_url.tileJSON(_, this.options && this.options.accessToken);\n request(_, L.bind(function(err, json) {\n if (err) {\n util.log('could not load TileJSON at ' + _);\n this.fire('error', {error: err});\n } else if (json) {\n this._setTileJSON(json);\n this.fire('ready');\n }\n }, this));\n } else if (_ && typeof _ === 'object') {\n this._setTileJSON(_);\n }\n }\n};\n","'use strict';\n\nvar MapboxLogoControl = L.Control.extend({\n\n options: {\n position: 'bottomleft'\n },\n\n initialize: function(options) {\n L.setOptions(this, options);\n },\n\n onAdd: function() {\n this._container = L.DomUtil.create('div', 'mapbox-logo');\n return this._container;\n },\n\n _setTileJSON: function(json) {\n // Check if account referenced by the accessToken\n // is asscociated with the Mapbox Logo\n // as determined by mapbox-maps.\n if (json.mapbox_logo) {\n L.DomUtil.addClass(this._container, 'mapbox-logo-true');\n }\n }\n});\n\nmodule.exports.MapboxLogoControl = MapboxLogoControl;\n\nmodule.exports.mapboxLogoControl = function(options) {\n return new MapboxLogoControl(options);\n};\n","'use strict';\n\nfunction utfDecode(c) {\n if (c >= 93) c--;\n if (c >= 35) c--;\n return c - 32;\n}\n\nmodule.exports = function(data) {\n return function(x, y) {\n if (!data) return;\n var idx = utfDecode(data.grid[y].charCodeAt(x)),\n key = data.keys[idx];\n return data.data[key];\n };\n};\n","/*!\n * mustache.js - Logic-less {{mustache}} templates with JavaScript\n * http://github.com/janl/mustache.js\n */\n\n/*global define: false Mustache: true*/\n\n(function defineMustache (global, factory) {\n if (typeof exports === 'object' && exports && typeof exports.nodeName !== 'string') {\n factory(exports); // CommonJS\n } else if (typeof define === 'function' && define.amd) {\n define(['exports'], factory); // AMD\n } else {\n global.Mustache = {};\n factory(global.Mustache); // script, wsh, asp\n }\n}(this, function mustacheFactory (mustache) {\n\n var objectToString = Object.prototype.toString;\n var isArray = Array.isArray || function isArrayPolyfill (object) {\n return objectToString.call(object) === '[object Array]';\n };\n\n function isFunction (object) {\n return typeof object === 'function';\n }\n\n /**\n * More correct typeof string handling array\n * which normally returns typeof 'object'\n */\n function typeStr (obj) {\n return isArray(obj) ? 'array' : typeof obj;\n }\n\n function escapeRegExp (string) {\n return string.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, '\\\\$&');\n }\n\n /**\n * Null safe way of checking whether or not an object,\n * including its prototype, has a given property\n */\n function hasProperty (obj, propName) {\n return obj != null && typeof obj === 'object' && (propName in obj);\n }\n\n // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577\n // See https://github.com/janl/mustache.js/issues/189\n var regExpTest = RegExp.prototype.test;\n function testRegExp (re, string) {\n return regExpTest.call(re, string);\n }\n\n var nonSpaceRe = /\\S/;\n function isWhitespace (string) {\n return !testRegExp(nonSpaceRe, string);\n }\n\n var entityMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '/': '/',\n '`': '`',\n '=': '='\n };\n\n function escapeHtml (string) {\n return String(string).replace(/[&<>\"'`=\\/]/g, function fromEntityMap (s) {\n return entityMap[s];\n });\n }\n\n var whiteRe = /\\s*/;\n var spaceRe = /\\s+/;\n var equalsRe = /\\s*=/;\n var curlyRe = /\\s*\\}/;\n var tagRe = /#|\\^|\\/|>|\\{|&|=|!/;\n\n /**\n * Breaks up the given `template` string into a tree of tokens. If the `tags`\n * argument is given here it must be an array with two string values: the\n * opening and closing tags used in the template (e.g. [ \"<%\", \"%>\" ]). Of\n * course, the default is to use mustaches (i.e. mustache.tags).\n *\n * A token is an array with at least 4 elements. The first element is the\n * mustache symbol that was used inside the tag, e.g. \"#\" or \"&\". If the tag\n * did not contain a symbol (i.e. {{myValue}}) this element is \"name\". For\n * all text that appears outside a symbol this element is \"text\".\n *\n * The second element of a token is its \"value\". For mustache tags this is\n * whatever else was inside the tag besides the opening symbol. For text tokens\n * this is the text itself.\n *\n * The third and fourth elements of the token are the start and end indices,\n * respectively, of the token in the original template.\n *\n * Tokens that are the root node of a subtree contain two more elements: 1) an\n * array of tokens in the subtree and 2) the index in the original template at\n * which the closing tag for that section begins.\n */\n function parseTemplate (template, tags) {\n if (!template)\n return [];\n\n var sections = []; // Stack to hold section tokens\n var tokens = []; // Buffer to hold the tokens\n var spaces = []; // Indices of whitespace tokens on the current line\n var hasTag = false; // Is there a {{tag}} on the current line?\n var nonSpace = false; // Is there a non-space char on the current line?\n\n // Strips all whitespace tokens array for the current line\n // if there was a {{#tag}} on it and otherwise only space.\n function stripSpace () {\n if (hasTag && !nonSpace) {\n while (spaces.length)\n delete tokens[spaces.pop()];\n } else {\n spaces = [];\n }\n\n hasTag = false;\n nonSpace = false;\n }\n\n var openingTagRe, closingTagRe, closingCurlyRe;\n function compileTags (tagsToCompile) {\n if (typeof tagsToCompile === 'string')\n tagsToCompile = tagsToCompile.split(spaceRe, 2);\n\n if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)\n throw new Error('Invalid tags: ' + tagsToCompile);\n\n openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\\\s*');\n closingTagRe = new RegExp('\\\\s*' + escapeRegExp(tagsToCompile[1]));\n closingCurlyRe = new RegExp('\\\\s*' + escapeRegExp('}' + tagsToCompile[1]));\n }\n\n compileTags(tags || mustache.tags);\n\n var scanner = new Scanner(template);\n\n var start, type, value, chr, token, openSection;\n while (!scanner.eos()) {\n start = scanner.pos;\n\n // Match any text between tags.\n value = scanner.scanUntil(openingTagRe);\n\n if (value) {\n for (var i = 0, valueLength = value.length; i < valueLength; ++i) {\n chr = value.charAt(i);\n\n if (isWhitespace(chr)) {\n spaces.push(tokens.length);\n } else {\n nonSpace = true;\n }\n\n tokens.push([ 'text', chr, start, start + 1 ]);\n start += 1;\n\n // Check for whitespace on the current line.\n if (chr === '\\n')\n stripSpace();\n }\n }\n\n // Match the opening tag.\n if (!scanner.scan(openingTagRe))\n break;\n\n hasTag = true;\n\n // Get the tag type.\n type = scanner.scan(tagRe) || 'name';\n scanner.scan(whiteRe);\n\n // Get the tag value.\n if (type === '=') {\n value = scanner.scanUntil(equalsRe);\n scanner.scan(equalsRe);\n scanner.scanUntil(closingTagRe);\n } else if (type === '{') {\n value = scanner.scanUntil(closingCurlyRe);\n scanner.scan(curlyRe);\n scanner.scanUntil(closingTagRe);\n type = '&';\n } else {\n value = scanner.scanUntil(closingTagRe);\n }\n\n // Match the closing tag.\n if (!scanner.scan(closingTagRe))\n throw new Error('Unclosed tag at ' + scanner.pos);\n\n token = [ type, value, start, scanner.pos ];\n tokens.push(token);\n\n if (type === '#' || type === '^') {\n sections.push(token);\n } else if (type === '/') {\n // Check section nesting.\n openSection = sections.pop();\n\n if (!openSection)\n throw new Error('Unopened section \"' + value + '\" at ' + start);\n\n if (openSection[1] !== value)\n throw new Error('Unclosed section \"' + openSection[1] + '\" at ' + start);\n } else if (type === 'name' || type === '{' || type === '&') {\n nonSpace = true;\n } else if (type === '=') {\n // Set the tags for the next time around.\n compileTags(value);\n }\n }\n\n // Make sure there are no open sections when we're done.\n openSection = sections.pop();\n\n if (openSection)\n throw new Error('Unclosed section \"' + openSection[1] + '\" at ' + scanner.pos);\n\n return nestTokens(squashTokens(tokens));\n }\n\n /**\n * Combines the values of consecutive text tokens in the given `tokens` array\n * to a single token.\n */\n function squashTokens (tokens) {\n var squashedTokens = [];\n\n var token, lastToken;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n if (token) {\n if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {\n lastToken[1] += token[1];\n lastToken[3] = token[3];\n } else {\n squashedTokens.push(token);\n lastToken = token;\n }\n }\n }\n\n return squashedTokens;\n }\n\n /**\n * Forms the given array of `tokens` into a nested tree structure where\n * tokens that represent a section have two additional items: 1) an array of\n * all tokens that appear in that section and 2) the index in the original\n * template that represents the end of that section.\n */\n function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }\n\n /**\n * A simple string scanner that is used by the template parser to find\n * tokens in template strings.\n */\n function Scanner (string) {\n this.string = string;\n this.tail = string;\n this.pos = 0;\n }\n\n /**\n * Returns `true` if the tail is empty (end of string).\n */\n Scanner.prototype.eos = function eos () {\n return this.tail === '';\n };\n\n /**\n * Tries to match the given regular expression at the current position.\n * Returns the matched text if it can match, the empty string otherwise.\n */\n Scanner.prototype.scan = function scan (re) {\n var match = this.tail.match(re);\n\n if (!match || match.index !== 0)\n return '';\n\n var string = match[0];\n\n this.tail = this.tail.substring(string.length);\n this.pos += string.length;\n\n return string;\n };\n\n /**\n * Skips all text until the given regular expression can be matched. Returns\n * the skipped string, which is the entire tail if no match can be made.\n */\n Scanner.prototype.scanUntil = function scanUntil (re) {\n var index = this.tail.search(re), match;\n\n switch (index) {\n case -1:\n match = this.tail;\n this.tail = '';\n break;\n case 0:\n match = '';\n break;\n default:\n match = this.tail.substring(0, index);\n this.tail = this.tail.substring(index);\n }\n\n this.pos += match.length;\n\n return match;\n };\n\n /**\n * Represents a rendering context by wrapping a view object and\n * maintaining a reference to the parent context.\n */\n function Context (view, parentContext) {\n this.view = view;\n this.cache = { '.': this.view };\n this.parent = parentContext;\n }\n\n /**\n * Creates a new context using the given view with this context\n * as the parent.\n */\n Context.prototype.push = function push (view) {\n return new Context(view, this);\n };\n\n /**\n * Returns the value of the given name in this context, traversing\n * up the context hierarchy if the value is absent in this context's view.\n */\n Context.prototype.lookup = function lookup (name) {\n var cache = this.cache;\n\n var value;\n if (cache.hasOwnProperty(name)) {\n value = cache[name];\n } else {\n var context = this, names, index, lookupHit = false;\n\n while (context) {\n if (name.indexOf('.') > 0) {\n value = context.view;\n names = name.split('.');\n index = 0;\n\n /**\n * Using the dot notion path in `name`, we descend through the\n * nested objects.\n *\n * To be certain that the lookup has been successful, we have to\n * check if the last object in the path actually has the property\n * we are looking for. We store the result in `lookupHit`.\n *\n * This is specially necessary for when the value has been set to\n * `undefined` and we want to avoid looking up parent contexts.\n **/\n while (value != null && index < names.length) {\n if (index === names.length - 1)\n lookupHit = hasProperty(value, names[index]);\n\n value = value[names[index++]];\n }\n } else {\n value = context.view[name];\n lookupHit = hasProperty(context.view, name);\n }\n\n if (lookupHit)\n break;\n\n context = context.parent;\n }\n\n cache[name] = value;\n }\n\n if (isFunction(value))\n value = value.call(this.view);\n\n return value;\n };\n\n /**\n * A Writer knows how to take a stream of tokens and render them to a\n * string, given a context. It also maintains a cache of templates to\n * avoid the need to parse the same template twice.\n */\n function Writer () {\n this.cache = {};\n }\n\n /**\n * Clears all cached templates in this writer.\n */\n Writer.prototype.clearCache = function clearCache () {\n this.cache = {};\n };\n\n /**\n * Parses and caches the given `template` and returns the array of tokens\n * that is generated from the parse.\n */\n Writer.prototype.parse = function parse (template, tags) {\n var cache = this.cache;\n var tokens = cache[template];\n\n if (tokens == null)\n tokens = cache[template] = parseTemplate(template, tags);\n\n return tokens;\n };\n\n /**\n * High-level method that is used to render the given `template` with\n * the given `view`.\n *\n * The optional `partials` argument may be an object that contains the\n * names and templates of partials that are used in the template. It may\n * also be a function that is used to load partial templates on the fly\n * that takes a single argument: the name of the partial.\n */\n Writer.prototype.render = function render (template, view, partials) {\n var tokens = this.parse(template);\n var context = (view instanceof Context) ? view : new Context(view);\n return this.renderTokens(tokens, context, partials, template);\n };\n\n /**\n * Low-level method that renders the given array of `tokens` using\n * the given `context` and `partials`.\n *\n * Note: The `originalTemplate` is only ever used to extract the portion\n * of the original template that was contained in a higher-order section.\n * If the template doesn't use higher-order sections, this argument may\n * be omitted.\n */\n Writer.prototype.renderTokens = function renderTokens (tokens, context, partials, originalTemplate) {\n var buffer = '';\n\n var token, symbol, value;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n value = undefined;\n token = tokens[i];\n symbol = token[0];\n\n if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate);\n else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate);\n else if (symbol === '>') value = this.renderPartial(token, context, partials, originalTemplate);\n else if (symbol === '&') value = this.unescapedValue(token, context);\n else if (symbol === 'name') value = this.escapedValue(token, context);\n else if (symbol === 'text') value = this.rawValue(token);\n\n if (value !== undefined)\n buffer += value;\n }\n\n return buffer;\n };\n\n Writer.prototype.renderSection = function renderSection (token, context, partials, originalTemplate) {\n var self = this;\n var buffer = '';\n var value = context.lookup(token[1]);\n\n // This function is used to render an arbitrary template\n // in the current context by higher-order sections.\n function subRender (template) {\n return self.render(template, context, partials);\n }\n\n if (!value) return;\n\n if (isArray(value)) {\n for (var j = 0, valueLength = value.length; j < valueLength; ++j) {\n buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate);\n }\n } else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') {\n buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate);\n } else if (isFunction(value)) {\n if (typeof originalTemplate !== 'string')\n throw new Error('Cannot use higher-order sections without the original template');\n\n // Extract the portion of the original template that the section contains.\n value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);\n\n if (value != null)\n buffer += value;\n } else {\n buffer += this.renderTokens(token[4], context, partials, originalTemplate);\n }\n return buffer;\n };\n\n Writer.prototype.renderInverted = function renderInverted (token, context, partials, originalTemplate) {\n var value = context.lookup(token[1]);\n\n // Use JavaScript's definition of falsy. Include empty arrays.\n // See https://github.com/janl/mustache.js/issues/186\n if (!value || (isArray(value) && value.length === 0))\n return this.renderTokens(token[4], context, partials, originalTemplate);\n };\n\n Writer.prototype.renderPartial = function renderPartial (token, context, partials) {\n if (!partials) return;\n\n var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];\n if (value != null)\n return this.renderTokens(this.parse(value), context, partials, value);\n };\n\n Writer.prototype.unescapedValue = function unescapedValue (token, context) {\n var value = context.lookup(token[1]);\n if (value != null)\n return value;\n };\n\n Writer.prototype.escapedValue = function escapedValue (token, context) {\n var value = context.lookup(token[1]);\n if (value != null)\n return mustache.escape(value);\n };\n\n Writer.prototype.rawValue = function rawValue (token) {\n return token[1];\n };\n\n mustache.name = 'mustache.js';\n mustache.version = '2.2.1';\n mustache.tags = [ '{{', '}}' ];\n\n // All high-level mustache.* functions use this writer.\n var defaultWriter = new Writer();\n\n /**\n * Clears all cached templates in the default writer.\n */\n mustache.clearCache = function clearCache () {\n return defaultWriter.clearCache();\n };\n\n /**\n * Parses and caches the given template in the default writer and returns the\n * array of tokens it contains. Doing this ahead of time avoids the need to\n * parse templates on the fly as they are rendered.\n */\n mustache.parse = function parse (template, tags) {\n return defaultWriter.parse(template, tags);\n };\n\n /**\n * Renders the `template` with the given `view` and `partials` using the\n * default writer.\n */\n mustache.render = function render (template, view, partials) {\n if (typeof template !== 'string') {\n throw new TypeError('Invalid template! Template should be a \"string\" ' +\n 'but \"' + typeStr(template) + '\" was given as the first ' +\n 'argument for mustache#render(template, view, partials)');\n }\n\n return defaultWriter.render(template, view, partials);\n };\n\n // This is here for backwards compatibility with 0.4.x.,\n /*eslint-disable */ // eslint wants camel cased function name\n mustache.to_html = function to_html (template, view, partials, send) {\n /*eslint-enable*/\n\n var result = mustache.render(template, view, partials);\n\n if (isFunction(send)) {\n send(result);\n } else {\n return result;\n }\n };\n\n // Export the escaping function so that the user may override it.\n // See https://github.com/janl/mustache.js/issues/244\n mustache.escape = escapeHtml;\n\n // Export these mainly for testing, but also for advanced usage.\n mustache.Scanner = Scanner;\n mustache.Context = Context;\n mustache.Writer = Writer;\n\n}));\n","var html_sanitize = require('./sanitizer-bundle.js');\n\nmodule.exports = function(_) {\n if (!_) return '';\n return html_sanitize(_, cleanUrl, cleanId);\n};\n\n// https://bugzilla.mozilla.org/show_bug.cgi?id=255107\nfunction cleanUrl(url) {\n 'use strict';\n if (/^https?/.test(url.getScheme())) return url.toString();\n if (/^mailto?/.test(url.getScheme())) return url.toString();\n if ('data' == url.getScheme() && /^image/.test(url.getPath())) {\n return url.toString();\n }\n}\n\nfunction cleanId(id) { return id; }\n","module.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n","\n// Copyright (C) 2010 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * @fileoverview\n * Implements RFC 3986 for parsing/formatting URIs.\n *\n * @author mikesamuel@gmail.com\n * \\@provides URI\n * \\@overrides window\n */\n\nvar URI = (function () {\n\n/**\n * creates a uri from the string form. The parser is relaxed, so special\n * characters that aren't escaped but don't cause ambiguities will not cause\n * parse failures.\n *\n * @return {URI|null}\n */\nfunction parse(uriStr) {\n var m = ('' + uriStr).match(URI_RE_);\n if (!m) { return null; }\n return new URI(\n nullIfAbsent(m[1]),\n nullIfAbsent(m[2]),\n nullIfAbsent(m[3]),\n nullIfAbsent(m[4]),\n nullIfAbsent(m[5]),\n nullIfAbsent(m[6]),\n nullIfAbsent(m[7]));\n}\n\n\n/**\n * creates a uri from the given parts.\n *\n * @param scheme {string} an unencoded scheme such as \"http\" or null\n * @param credentials {string} unencoded user credentials or null\n * @param domain {string} an unencoded domain name or null\n * @param port {number} a port number in [1, 32768].\n * -1 indicates no port, as does null.\n * @param path {string} an unencoded path\n * @param query {Array.<string>|string|null} a list of unencoded cgi\n * parameters where even values are keys and odds the corresponding values\n * or an unencoded query.\n * @param fragment {string} an unencoded fragment without the \"#\" or null.\n * @return {URI}\n */\nfunction create(scheme, credentials, domain, port, path, query, fragment) {\n var uri = new URI(\n encodeIfExists2(scheme, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),\n encodeIfExists2(\n credentials, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),\n encodeIfExists(domain),\n port > 0 ? port.toString() : null,\n encodeIfExists2(path, URI_DISALLOWED_IN_PATH_),\n null,\n encodeIfExists(fragment));\n if (query) {\n if ('string' === typeof query) {\n uri.setRawQuery(query.replace(/[^?&=0-9A-Za-z_\\-~.%]/g, encodeOne));\n } else {\n uri.setAllParameters(query);\n }\n }\n return uri;\n}\nfunction encodeIfExists(unescapedPart) {\n if ('string' == typeof unescapedPart) {\n return encodeURIComponent(unescapedPart);\n }\n return null;\n};\n/**\n * if unescapedPart is non null, then escapes any characters in it that aren't\n * valid characters in a url and also escapes any special characters that\n * appear in extra.\n *\n * @param unescapedPart {string}\n * @param extra {RegExp} a character set of characters in [\\01-\\177].\n * @return {string|null} null iff unescapedPart == null.\n */\nfunction encodeIfExists2(unescapedPart, extra) {\n if ('string' == typeof unescapedPart) {\n return encodeURI(unescapedPart).replace(extra, encodeOne);\n }\n return null;\n};\n/** converts a character in [\\01-\\177] to its url encoded equivalent. */\nfunction encodeOne(ch) {\n var n = ch.charCodeAt(0);\n return '%' + '0123456789ABCDEF'.charAt((n >> 4) & 0xf) +\n '0123456789ABCDEF'.charAt(n & 0xf);\n}\n\n/**\n * {@updoc\n * $ normPath('foo/./bar')\n * # 'foo/bar'\n * $ normPath('./foo')\n * # 'foo'\n * $ normPath('foo/.')\n * # 'foo'\n * $ normPath('foo//bar')\n * # 'foo/bar'\n * }\n */\nfunction normPath(path) {\n return path.replace(/(^|\\/)\\.(?:\\/|$)/g, '$1').replace(/\\/{2,}/g, '/');\n}\n\nvar PARENT_DIRECTORY_HANDLER = new RegExp(\n ''\n // A path break\n + '(/|^)'\n // followed by a non .. path element\n // (cannot be . because normPath is used prior to this RegExp)\n + '(?:[^./][^/]*|\\\\.{2,}(?:[^./][^/]*)|\\\\.{3,}[^/]*)'\n // followed by .. followed by a path break.\n + '/\\\\.\\\\.(?:/|$)');\n\nvar PARENT_DIRECTORY_HANDLER_RE = new RegExp(PARENT_DIRECTORY_HANDLER);\n\nvar EXTRA_PARENT_PATHS_RE = /^(?:\\.\\.\\/)*(?:\\.\\.$)?/;\n\n/**\n * Normalizes its input path and collapses all . and .. sequences except for\n * .. sequences that would take it above the root of the current parent\n * directory.\n * {@updoc\n * $ collapse_dots('foo/../bar')\n * # 'bar'\n * $ collapse_dots('foo/./bar')\n * # 'foo/bar'\n * $ collapse_dots('foo/../bar/./../../baz')\n * # 'baz'\n * $ collapse_dots('../foo')\n * # '../foo'\n * $ collapse_dots('../foo').replace(EXTRA_PARENT_PATHS_RE, '')\n * # 'foo'\n * }\n */\nfunction collapse_dots(path) {\n if (path === null) { return null; }\n var p = normPath(path);\n // Only /../ left to flatten\n var r = PARENT_DIRECTORY_HANDLER_RE;\n // We replace with $1 which matches a / before the .. because this\n // guarantees that:\n // (1) we have at most 1 / between the adjacent place,\n // (2) always have a slash if there is a preceding path section, and\n // (3) we never turn a relative path into an absolute path.\n for (var q; (q = p.replace(r, '$1')) != p; p = q) {};\n return p;\n}\n\n/**\n * resolves a relative url string to a base uri.\n * @return {URI}\n */\nfunction resolve(baseUri, relativeUri) {\n // there are several kinds of relative urls:\n // 1. //foo - replaces everything from the domain on. foo is a domain name\n // 2. foo - replaces the last part of the path, the whole query and fragment\n // 3. /foo - replaces the the path, the query and fragment\n // 4. ?foo - replace the query and fragment\n // 5. #foo - replace the fragment only\n\n var absoluteUri = baseUri.clone();\n // we satisfy these conditions by looking for the first part of relativeUri\n // that is not blank and applying defaults to the rest\n\n var overridden = relativeUri.hasScheme();\n\n if (overridden) {\n absoluteUri.setRawScheme(relativeUri.getRawScheme());\n } else {\n overridden = relativeUri.hasCredentials();\n }\n\n if (overridden) {\n absoluteUri.setRawCredentials(relativeUri.getRawCredentials());\n } else {\n overridden = relativeUri.hasDomain();\n }\n\n if (overridden) {\n absoluteUri.setRawDomain(relativeUri.getRawDomain());\n } else {\n overridden = relativeUri.hasPort();\n }\n\n var rawPath = relativeUri.getRawPath();\n var simplifiedPath = collapse_dots(rawPath);\n if (overridden) {\n absoluteUri.setPort(relativeUri.getPort());\n simplifiedPath = simplifiedPath\n && simplifiedPath.replace(EXTRA_PARENT_PATHS_RE, '');\n } else {\n overridden = !!rawPath;\n if (overridden) {\n // resolve path properly\n if (simplifiedPath.charCodeAt(0) !== 0x2f /* / */) { // path is relative\n var absRawPath = collapse_dots(absoluteUri.getRawPath() || '')\n .replace(EXTRA_PARENT_PATHS_RE, '');\n var slash = absRawPath.lastIndexOf('/') + 1;\n simplifiedPath = collapse_dots(\n (slash ? absRawPath.substring(0, slash) : '')\n + collapse_dots(rawPath))\n .replace(EXTRA_PARENT_PATHS_RE, '');\n }\n } else {\n simplifiedPath = simplifiedPath\n && simplifiedPath.replace(EXTRA_PARENT_PATHS_RE, '');\n if (simplifiedPath !== rawPath) {\n absoluteUri.setRawPath(simplifiedPath);\n }\n }\n }\n\n if (overridden) {\n absoluteUri.setRawPath(simplifiedPath);\n } else {\n overridden = relativeUri.hasQuery();\n }\n\n if (overridden) {\n absoluteUri.setRawQuery(relativeUri.getRawQuery());\n } else {\n overridden = relativeUri.hasFragment();\n }\n\n if (overridden) {\n absoluteUri.setRawFragment(relativeUri.getRawFragment());\n }\n\n return absoluteUri;\n}\n\n/**\n * a mutable URI.\n *\n * This class contains setters and getters for the parts of the URI.\n * The <tt>getXYZ</tt>/<tt>setXYZ</tt> methods return the decoded part -- so\n * <code>uri.parse('/foo%20bar').getPath()</code> will return the decoded path,\n * <tt>/foo bar</tt>.\n *\n * <p>The raw versions of fields are available too.\n * <code>uri.parse('/foo%20bar').getRawPath()</code> will return the raw path,\n * <tt>/foo%20bar</tt>. Use the raw setters with care, since\n * <code>URI::toString</code> is not guaranteed to return a valid url if a\n * raw setter was used.\n *\n * <p>All setters return <tt>this</tt> and so may be chained, a la\n * <code>uri.parse('/foo').setFragment('part').toString()</code>.\n *\n * <p>You should not use this constructor directly -- please prefer the factory\n * functions {@link uri.parse}, {@link uri.create}, {@link uri.resolve}\n * instead.</p>\n *\n * <p>The parameters are all raw (assumed to be properly escaped) parts, and\n * any (but not all) may be null. Undefined is not allowed.</p>\n *\n * @constructor\n */\nfunction URI(\n rawScheme,\n rawCredentials, rawDomain, port,\n rawPath, rawQuery, rawFragment) {\n this.scheme_ = rawScheme;\n this.credentials_ = rawCredentials;\n this.domain_ = rawDomain;\n this.port_ = port;\n this.path_ = rawPath;\n this.query_ = rawQuery;\n this.fragment_ = rawFragment;\n /**\n * @type {Array|null}\n */\n this.paramCache_ = null;\n}\n\n/** returns the string form of the url. */\nURI.prototype.toString = function () {\n var out = [];\n if (null !== this.scheme_) { out.push(this.scheme_, ':'); }\n if (null !== this.domain_) {\n out.push('//');\n if (null !== this.credentials_) { out.push(this.credentials_, '@'); }\n out.push(this.domain_);\n if (null !== this.port_) { out.push(':', this.port_.toString()); }\n }\n if (null !== this.path_) { out.push(this.path_); }\n if (null !== this.query_) { out.push('?', this.query_); }\n if (null !== this.fragment_) { out.push('#', this.fragment_); }\n return out.join('');\n};\n\nURI.prototype.clone = function () {\n return new URI(this.scheme_, this.credentials_, this.domain_, this.port_,\n this.path_, this.query_, this.fragment_);\n};\n\nURI.prototype.getScheme = function () {\n // HTML5 spec does not require the scheme to be lowercased but\n // all common browsers except Safari lowercase the scheme.\n return this.scheme_ && decodeURIComponent(this.scheme_).toLowerCase();\n};\nURI.prototype.getRawScheme = function () {\n return this.scheme_;\n};\nURI.prototype.setScheme = function (newScheme) {\n this.scheme_ = encodeIfExists2(\n newScheme, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_);\n return this;\n};\nURI.prototype.setRawScheme = function (newScheme) {\n this.scheme_ = newScheme ? newScheme : null;\n return this;\n};\nURI.prototype.hasScheme = function () {\n return null !== this.scheme_;\n};\n\n\nURI.prototype.getCredentials = function () {\n return this.credentials_ && decodeURIComponent(this.credentials_);\n};\nURI.prototype.getRawCredentials = function () {\n return this.credentials_;\n};\nURI.prototype.setCredentials = function (newCredentials) {\n this.credentials_ = encodeIfExists2(\n newCredentials, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_);\n\n return this;\n};\nURI.prototype.setRawCredentials = function (newCredentials) {\n this.credentials_ = newCredentials ? newCredentials : null;\n return this;\n};\nURI.prototype.hasCredentials = function () {\n return null !== this.credentials_;\n};\n\n\nURI.prototype.getDomain = function () {\n return this.domain_ && decodeURIComponent(this.domain_);\n};\nURI.prototype.getRawDomain = function () {\n return this.domain_;\n};\nURI.prototype.setDomain = function (newDomain) {\n return this.setRawDomain(newDomain && encodeURIComponent(newDomain));\n};\nURI.prototype.setRawDomain = function (newDomain) {\n this.domain_ = newDomain ? newDomain : null;\n // Maintain the invariant that paths must start with a slash when the URI\n // is not path-relative.\n return this.setRawPath(this.path_);\n};\nURI.prototype.hasDomain = function () {\n return null !== this.domain_;\n};\n\n\nURI.prototype.getPort = function () {\n return this.port_ && decodeURIComponent(this.port_);\n};\nURI.prototype.setPort = function (newPort) {\n if (newPort) {\n newPort = Number(newPort);\n if (newPort !== (newPort & 0xffff)) {\n throw new Error('Bad port number ' + newPort);\n }\n this.port_ = '' + newPort;\n } else {\n this.port_ = null;\n }\n return this;\n};\nURI.prototype.hasPort = function () {\n return null !== this.port_;\n};\n\n\nURI.prototype.getPath = function () {\n return this.path_ && decodeURIComponent(this.path_);\n};\nURI.prototype.getRawPath = function () {\n return this.path_;\n};\nURI.prototype.setPath = function (newPath) {\n return this.setRawPath(encodeIfExists2(newPath, URI_DISALLOWED_IN_PATH_));\n};\nURI.prototype.setRawPath = function (newPath) {\n if (newPath) {\n newPath = String(newPath);\n this.path_ = \n // Paths must start with '/' unless this is a path-relative URL.\n (!this.domain_ || /^\\//.test(newPath)) ? newPath : '/' + newPath;\n } else {\n this.path_ = null;\n }\n return this;\n};\nURI.prototype.hasPath = function () {\n return null !== this.path_;\n};\n\n\nURI.prototype.getQuery = function () {\n // From http://www.w3.org/Addressing/URL/4_URI_Recommentations.html\n // Within the query string, the plus sign is reserved as shorthand notation\n // for a space.\n return this.query_ && decodeURIComponent(this.query_).replace(/\\+/g, ' ');\n};\nURI.prototype.getRawQuery = function () {\n return this.query_;\n};\nURI.prototype.setQuery = function (newQuery) {\n this.paramCache_ = null;\n this.query_ = encodeIfExists(newQuery);\n return this;\n};\nURI.prototype.setRawQuery = function (newQuery) {\n this.paramCache_ = null;\n this.query_ = newQuery ? newQuery : null;\n return this;\n};\nURI.prototype.hasQuery = function () {\n return null !== this.query_;\n};\n\n/**\n * sets the query given a list of strings of the form\n * [ key0, value0, key1, value1, ... ].\n *\n * <p><code>uri.setAllParameters(['a', 'b', 'c', 'd']).getQuery()</code>\n * will yield <code>'a=b&c=d'</code>.\n */\nURI.prototype.setAllParameters = function (params) {\n if (typeof params === 'object') {\n if (!(params instanceof Array)\n && (params instanceof Object\n || Object.prototype.toString.call(params) !== '[object Array]')) {\n var newParams = [];\n var i = -1;\n for (var k in params) {\n var v = params[k];\n if ('string' === typeof v) {\n newParams[++i] = k;\n newParams[++i] = v;\n }\n }\n params = newParams;\n }\n }\n this.paramCache_ = null;\n var queryBuf = [];\n var separator = '';\n for (var j = 0; j < params.length;) {\n var k = params[j++];\n var v = params[j++];\n queryBuf.push(separator, encodeURIComponent(k.toString()));\n separator = '&';\n if (v) {\n queryBuf.push('=', encodeURIComponent(v.toString()));\n }\n }\n this.query_ = queryBuf.join('');\n return this;\n};\nURI.prototype.checkParameterCache_ = function () {\n if (!this.paramCache_) {\n var q = this.query_;\n if (!q) {\n this.paramCache_ = [];\n } else {\n var cgiParams = q.split(/[&\\?]/);\n var out = [];\n var k = -1;\n for (var i = 0; i < cgiParams.length; ++i) {\n var m = cgiParams[i].match(/^([^=]*)(?:=(.*))?$/);\n // From http://www.w3.org/Addressing/URL/4_URI_Recommentations.html\n // Within the query string, the plus sign is reserved as shorthand\n // notation for a space.\n out[++k] = decodeURIComponent(m[1]).replace(/\\+/g, ' ');\n out[++k] = decodeURIComponent(m[2] || '').replace(/\\+/g, ' ');\n }\n this.paramCache_ = out;\n }\n }\n};\n/**\n * sets the values of the named cgi parameters.\n *\n * <p>So, <code>uri.parse('foo?a=b&c=d&e=f').setParameterValues('c', ['new'])\n * </code> yields <tt>foo?a=b&c=new&e=f</tt>.</p>\n *\n * @param key {string}\n * @param values {Array.<string>} the new values. If values is a single string\n * then it will be treated as the sole value.\n */\nURI.prototype.setParameterValues = function (key, values) {\n // be nice and avoid subtle bugs where [] operator on string performs charAt\n // on some browsers and crashes on IE\n if (typeof values === 'string') {\n values = [ values ];\n }\n\n this.checkParameterCache_();\n var newValueIndex = 0;\n var pc = this.paramCache_;\n var params = [];\n for (var i = 0, k = 0; i < pc.length; i += 2) {\n if (key === pc[i]) {\n if (newValueIndex < values.length) {\n params.push(key, values[newValueIndex++]);\n }\n } else {\n params.push(pc[i], pc[i + 1]);\n }\n }\n while (newValueIndex < values.length) {\n params.push(key, values[newValueIndex++]);\n }\n this.setAllParameters(params);\n return this;\n};\nURI.prototype.removeParameter = function (key) {\n return this.setParameterValues(key, []);\n};\n/**\n * returns the parameters specified in the query part of the uri as a list of\n * keys and values like [ key0, value0, key1, value1, ... ].\n *\n * @return {Array.<string>}\n */\nURI.prototype.getAllParameters = function () {\n this.checkParameterCache_();\n return this.paramCache_.slice(0, this.paramCache_.length);\n};\n/**\n * returns the value<b>s</b> for a given cgi parameter as a list of decoded\n * query parameter values.\n * @return {Array.<string>}\n */\nURI.prototype.getParameterValues = function (paramNameUnescaped) {\n this.checkParameterCache_();\n var values = [];\n for (var i = 0; i < this.paramCache_.length; i += 2) {\n if (paramNameUnescaped === this.paramCache_[i]) {\n values.push(this.paramCache_[i + 1]);\n }\n }\n return values;\n};\n/**\n * returns a map of cgi parameter names to (non-empty) lists of values.\n * @return {Object.<string,Array.<string>>}\n */\nURI.prototype.getParameterMap = function (paramNameUnescaped) {\n this.checkParameterCache_();\n var paramMap = {};\n for (var i = 0; i < this.paramCache_.length; i += 2) {\n var key = this.paramCache_[i++],\n value = this.paramCache_[i++];\n if (!(key in paramMap)) {\n paramMap[key] = [value];\n } else {\n paramMap[key].push(value);\n }\n }\n return paramMap;\n};\n/**\n * returns the first value for a given cgi parameter or null if the given\n * parameter name does not appear in the query string.\n * If the given parameter name does appear, but has no '<tt>=</tt>' following\n * it, then the empty string will be returned.\n * @return {string|null}\n */\nURI.prototype.getParameterValue = function (paramNameUnescaped) {\n this.checkParameterCache_();\n for (var i = 0; i < this.paramCache_.length; i += 2) {\n if (paramNameUnescaped === this.paramCache_[i]) {\n return this.paramCache_[i + 1];\n }\n }\n return null;\n};\n\nURI.prototype.getFragment = function () {\n return this.fragment_ && decodeURIComponent(this.fragment_);\n};\nURI.prototype.getRawFragment = function () {\n return this.fragment_;\n};\nURI.prototype.setFragment = function (newFragment) {\n this.fragment_ = newFragment ? encodeURIComponent(newFragment) : null;\n return this;\n};\nURI.prototype.setRawFragment = function (newFragment) {\n this.fragment_ = newFragment ? newFragment : null;\n return this;\n};\nURI.prototype.hasFragment = function () {\n return null !== this.fragment_;\n};\n\nfunction nullIfAbsent(matchPart) {\n return ('string' == typeof matchPart) && (matchPart.length > 0)\n ? matchPart\n : null;\n}\n\n\n\n\n/**\n * a regular expression for breaking a URI into its component parts.\n *\n * <p>http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#RFC2234 says\n * As the \"first-match-wins\" algorithm is identical to the \"greedy\"\n * disambiguation method used by POSIX regular expressions, it is natural and\n * commonplace to use a regular expression for parsing the potential five\n * components of a URI reference.\n *\n * <p>The following line is the regular expression for breaking-down a\n * well-formed URI reference into its components.\n *\n * <pre>\n * ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?\n * 12 3 4 5 6 7 8 9\n * </pre>\n *\n * <p>The numbers in the second line above are only to assist readability; they\n * indicate the reference points for each subexpression (i.e., each paired\n * parenthesis). We refer to the value matched for subexpression <n> as $<n>.\n * For example, matching the above expression to\n * <pre>\n * http://www.ics.uci.edu/pub/ietf/uri/#Related\n * </pre>\n * results in the following subexpression matches:\n * <pre>\n * $1 = http:\n * $2 = http\n * $3 = //www.ics.uci.edu\n * $4 = www.ics.uci.edu\n * $5 = /pub/ietf/uri/\n * $6 = <undefined>\n * $7 = <undefined>\n * $8 = #Related\n * $9 = Related\n * </pre>\n * where <undefined> indicates that the component is not present, as is the\n * case for the query component in the above example. Therefore, we can\n * determine the value of the five components as\n * <pre>\n * scheme = $2\n * authority = $4\n * path = $5\n * query = $7\n * fragment = $9\n * </pre>\n *\n * <p>msamuel: I have modified the regular expression slightly to expose the\n * credentials, domain, and port separately from the authority.\n * The modified version yields\n * <pre>\n * $1 = http scheme\n * $2 = <undefined> credentials -\\\n * $3 = www.ics.uci.edu domain | authority\n * $4 = <undefined> port -/\n * $5 = /pub/ietf/uri/ path\n * $6 = <undefined> query without ?\n * $7 = Related fragment without #\n * </pre>\n */\nvar URI_RE_ = new RegExp(\n \"^\" +\n \"(?:\" +\n \"([^:/?#]+)\" + // scheme\n \":)?\" +\n \"(?://\" +\n \"(?:([^/?#]*)@)?\" + // credentials\n \"([^/?#:@]*)\" + // domain\n \"(?::([0-9]+))?\" + // port\n \")?\" +\n \"([^?#]+)?\" + // path\n \"(?:\\\\?([^#]*))?\" + // query\n \"(?:#(.*))?\" + // fragment\n \"$\"\n );\n\nvar URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_ = /[#\\/\\?@]/g;\nvar URI_DISALLOWED_IN_PATH_ = /[\\#\\?]/g;\n\nURI.parse = parse;\nURI.create = create;\nURI.resolve = resolve;\nURI.collapse_dots = collapse_dots; // Visible for testing.\n\n// lightweight string-based api for loadModuleMaker\nURI.utils = {\n mimeTypeOf: function (uri) {\n var uriObj = parse(uri);\n if (/\\.html$/.test(uriObj.getPath())) {\n return 'text/html';\n } else {\n return 'application/javascript';\n }\n },\n resolve: function (base, uri) {\n if (base) {\n return resolve(parse(base), parse(uri)).toString();\n } else {\n return '' + uri;\n }\n }\n};\n\n\nreturn URI;\n})();\n\n// Copyright Google Inc.\n// Licensed under the Apache Licence Version 2.0\n// Autogenerated at Mon Feb 25 13:05:42 EST 2013\n// @overrides window\n// @provides html4\nvar html4 = {};\nhtml4.atype = {\n 'NONE': 0,\n 'URI': 1,\n 'URI_FRAGMENT': 11,\n 'SCRIPT': 2,\n 'STYLE': 3,\n 'HTML': 12,\n 'ID': 4,\n 'IDREF': 5,\n 'IDREFS': 6,\n 'GLOBAL_NAME': 7,\n 'LOCAL_NAME': 8,\n 'CLASSES': 9,\n 'FRAME_TARGET': 10,\n 'MEDIA_QUERY': 13\n};\nhtml4[ 'atype' ] = html4.atype;\nhtml4.ATTRIBS = {\n '*::class': 9,\n '*::dir': 0,\n '*::draggable': 0,\n '*::hidden': 0,\n '*::id': 4,\n '*::inert': 0,\n '*::itemprop': 0,\n '*::itemref': 6,\n '*::itemscope': 0,\n '*::lang': 0,\n '*::onblur': 2,\n '*::onchange': 2,\n '*::onclick': 2,\n '*::ondblclick': 2,\n '*::onfocus': 2,\n '*::onkeydown': 2,\n '*::onkeypress': 2,\n '*::onkeyup': 2,\n '*::onload': 2,\n '*::onmousedown': 2,\n '*::onmousemove': 2,\n '*::onmouseout': 2,\n '*::onmouseover': 2,\n '*::onmouseup': 2,\n '*::onreset': 2,\n '*::onscroll': 2,\n '*::onselect': 2,\n '*::onsubmit': 2,\n '*::onunload': 2,\n '*::spellcheck': 0,\n '*::style': 3,\n '*::title': 0,\n '*::translate': 0,\n 'a::accesskey': 0,\n 'a::coords': 0,\n 'a::href': 1,\n 'a::hreflang': 0,\n 'a::name': 7,\n 'a::onblur': 2,\n 'a::onfocus': 2,\n 'a::shape': 0,\n 'a::tabindex': 0,\n 'a::target': 10,\n 'a::type': 0,\n 'area::accesskey': 0,\n 'area::alt': 0,\n 'area::coords': 0,\n 'area::href': 1,\n 'area::nohref': 0,\n 'area::onblur': 2,\n 'area::onfocus': 2,\n 'area::shape': 0,\n 'area::tabindex': 0,\n 'area::target': 10,\n 'audio::controls': 0,\n 'audio::loop': 0,\n 'audio::mediagroup': 5,\n 'audio::muted': 0,\n 'audio::preload': 0,\n 'bdo::dir': 0,\n 'blockquote::cite': 1,\n 'br::clear': 0,\n 'button::accesskey': 0,\n 'button::disabled': 0,\n 'button::name': 8,\n 'button::onblur': 2,\n 'button::onfocus': 2,\n 'button::tabindex': 0,\n 'button::type': 0,\n 'button::value': 0,\n 'canvas::height': 0,\n 'canvas::width': 0,\n 'caption::align': 0,\n 'col::align': 0,\n 'col::char': 0,\n 'col::charoff': 0,\n 'col::span': 0,\n 'col::valign': 0,\n 'col::width': 0,\n 'colgroup::align': 0,\n 'colgroup::char': 0,\n 'colgroup::charoff': 0,\n 'colgroup::span': 0,\n 'colgroup::valign': 0,\n 'colgroup::width': 0,\n 'command::checked': 0,\n 'command::command': 5,\n 'command::disabled': 0,\n 'command::icon': 1,\n 'command::label': 0,\n 'command::radiogroup': 0,\n 'command::type': 0,\n 'data::value': 0,\n 'del::cite': 1,\n 'del::datetime': 0,\n 'details::open': 0,\n 'dir::compact': 0,\n 'div::align': 0,\n 'dl::compact': 0,\n 'fieldset::disabled': 0,\n 'font::color': 0,\n 'font::face': 0,\n 'font::size': 0,\n 'form::accept': 0,\n 'form::action': 1,\n 'form::autocomplete': 0,\n 'form::enctype': 0,\n 'form::method': 0,\n 'form::name': 7,\n 'form::novalidate': 0,\n 'form::onreset': 2,\n 'form::onsubmit': 2,\n 'form::target': 10,\n 'h1::align': 0,\n 'h2::align': 0,\n 'h3::align': 0,\n 'h4::align': 0,\n 'h5::align': 0,\n 'h6::align': 0,\n 'hr::align': 0,\n 'hr::noshade': 0,\n 'hr::size': 0,\n 'hr::width': 0,\n 'iframe::align': 0,\n 'iframe::frameborder': 0,\n 'iframe::height': 0,\n 'iframe::marginheight': 0,\n 'iframe::marginwidth': 0,\n 'iframe::width': 0,\n 'img::align': 0,\n 'img::alt': 0,\n 'img::border': 0,\n 'img::height': 0,\n 'img::hspace': 0,\n 'img::ismap': 0,\n 'img::name': 7,\n 'img::src': 1,\n 'img::usemap': 11,\n 'img::vspace': 0,\n 'img::width': 0,\n 'input::accept': 0,\n 'input::accesskey': 0,\n 'input::align': 0,\n 'input::alt': 0,\n 'input::autocomplete': 0,\n 'input::checked': 0,\n 'input::disabled': 0,\n 'input::inputmode': 0,\n 'input::ismap': 0,\n 'input::list': 5,\n 'input::max': 0,\n 'input::maxlength': 0,\n 'input::min': 0,\n 'input::multiple': 0,\n 'input::name': 8,\n 'input::onblur': 2,\n 'input::onchange': 2,\n 'input::onfocus': 2,\n 'input::onselect': 2,\n 'input::placeholder': 0,\n 'input::readonly': 0,\n 'input::required': 0,\n 'input::size': 0,\n 'input::src': 1,\n 'input::step': 0,\n 'input::tabindex': 0,\n 'input::type': 0,\n 'input::usemap': 11,\n 'input::value': 0,\n 'ins::cite': 1,\n 'ins::datetime': 0,\n 'label::accesskey': 0,\n 'label::for': 5,\n 'label::onblur': 2,\n 'label::onfocus': 2,\n 'legend::accesskey': 0,\n 'legend::align': 0,\n 'li::type': 0,\n 'li::value': 0,\n 'map::name': 7,\n 'menu::compact': 0,\n 'menu::label': 0,\n 'menu::type': 0,\n 'meter::high': 0,\n 'meter::low': 0,\n 'meter::max': 0,\n 'meter::min': 0,\n 'meter::value': 0,\n 'ol::compact': 0,\n 'ol::reversed': 0,\n 'ol::start': 0,\n 'ol::type': 0,\n 'optgroup::disabled': 0,\n 'optgroup::label': 0,\n 'option::disabled': 0,\n 'option::label': 0,\n 'option::selected': 0,\n 'option::value': 0,\n 'output::for': 6,\n 'output::name': 8,\n 'p::align': 0,\n 'pre::width': 0,\n 'progress::max': 0,\n 'progress::min': 0,\n 'progress::value': 0,\n 'q::cite': 1,\n 'select::autocomplete': 0,\n 'select::disabled': 0,\n 'select::multiple': 0,\n 'select::name': 8,\n 'select::onblur': 2,\n 'select::onchange': 2,\n 'select::onfocus': 2,\n 'select::required': 0,\n 'select::size': 0,\n 'select::tabindex': 0,\n 'source::type': 0,\n 'table::align': 0,\n 'table::bgcolor': 0,\n 'table::border': 0,\n 'table::cellpadding': 0,\n 'table::cellspacing': 0,\n 'table::frame': 0,\n 'table::rules': 0,\n 'table::summary': 0,\n 'table::width': 0,\n 'tbody::align': 0,\n 'tbody::char': 0,\n 'tbody::charoff': 0,\n 'tbody::valign': 0,\n 'td::abbr': 0,\n 'td::align': 0,\n 'td::axis': 0,\n 'td::bgcolor': 0,\n 'td::char': 0,\n 'td::charoff': 0,\n 'td::colspan': 0,\n 'td::headers': 6,\n 'td::height': 0,\n 'td::nowrap': 0,\n 'td::rowspan': 0,\n 'td::scope': 0,\n 'td::valign': 0,\n 'td::width': 0,\n 'textarea::accesskey': 0,\n 'textarea::autocomplete': 0,\n 'textarea::cols': 0,\n 'textarea::disabled': 0,\n 'textarea::inputmode': 0,\n 'textarea::name': 8,\n 'textarea::onblur': 2,\n 'textarea::onchange': 2,\n 'textarea::onfocus': 2,\n 'textarea::onselect': 2,\n 'textarea::placeholder': 0,\n 'textarea::readonly': 0,\n 'textarea::required': 0,\n 'textarea::rows': 0,\n 'textarea::tabindex': 0,\n 'textarea::wrap': 0,\n 'tfoot::align': 0,\n 'tfoot::char': 0,\n 'tfoot::charoff': 0,\n 'tfoot::valign': 0,\n 'th::abbr': 0,\n 'th::align': 0,\n 'th::axis': 0,\n 'th::bgcolor': 0,\n 'th::char': 0,\n 'th::charoff': 0,\n 'th::colspan': 0,\n 'th::headers': 6,\n 'th::height': 0,\n 'th::nowrap': 0,\n 'th::rowspan': 0,\n 'th::scope': 0,\n 'th::valign': 0,\n 'th::width': 0,\n 'thead::align': 0,\n 'thead::char': 0,\n 'thead::charoff': 0,\n 'thead::valign': 0,\n 'tr::align': 0,\n 'tr::bgcolor': 0,\n 'tr::char': 0,\n 'tr::charoff': 0,\n 'tr::valign': 0,\n 'track::default': 0,\n 'track::kind': 0,\n 'track::label': 0,\n 'track::srclang': 0,\n 'ul::compact': 0,\n 'ul::type': 0,\n 'video::controls': 0,\n 'video::height': 0,\n 'video::loop': 0,\n 'video::mediagroup': 5,\n 'video::muted': 0,\n 'video::poster': 1,\n 'video::preload': 0,\n 'video::width': 0\n};\nhtml4[ 'ATTRIBS' ] = html4.ATTRIBS;\nhtml4.eflags = {\n 'OPTIONAL_ENDTAG': 1,\n 'EMPTY': 2,\n 'CDATA': 4,\n 'RCDATA': 8,\n 'UNSAFE': 16,\n 'FOLDABLE': 32,\n 'SCRIPT': 64,\n 'STYLE': 128,\n 'VIRTUALIZED': 256\n};\nhtml4[ 'eflags' ] = html4.eflags;\n// these are bitmasks of the eflags above.\nhtml4.ELEMENTS = {\n 'a': 0,\n 'abbr': 0,\n 'acronym': 0,\n 'address': 0,\n 'applet': 272,\n 'area': 2,\n 'article': 0,\n 'aside': 0,\n 'audio': 0,\n 'b': 0,\n 'base': 274,\n 'basefont': 274,\n 'bdi': 0,\n 'bdo': 0,\n 'big': 0,\n 'blockquote': 0,\n 'body': 305,\n 'br': 2,\n 'button': 0,\n 'canvas': 0,\n 'caption': 0,\n 'center': 0,\n 'cite': 0,\n 'code': 0,\n 'col': 2,\n 'colgroup': 1,\n 'command': 2,\n 'data': 0,\n 'datalist': 0,\n 'dd': 1,\n 'del': 0,\n 'details': 0,\n 'dfn': 0,\n 'dialog': 272,\n 'dir': 0,\n 'div': 0,\n 'dl': 0,\n 'dt': 1,\n 'em': 0,\n 'fieldset': 0,\n 'figcaption': 0,\n 'figure': 0,\n 'font': 0,\n 'footer': 0,\n 'form': 0,\n 'frame': 274,\n 'frameset': 272,\n 'h1': 0,\n 'h2': 0,\n 'h3': 0,\n 'h4': 0,\n 'h5': 0,\n 'h6': 0,\n 'head': 305,\n 'header': 0,\n 'hgroup': 0,\n 'hr': 2,\n 'html': 305,\n 'i': 0,\n 'iframe': 16,\n 'img': 2,\n 'input': 2,\n 'ins': 0,\n 'isindex': 274,\n 'kbd': 0,\n 'keygen': 274,\n 'label': 0,\n 'legend': 0,\n 'li': 1,\n 'link': 274,\n 'map': 0,\n 'mark': 0,\n 'menu': 0,\n 'meta': 274,\n 'meter': 0,\n 'nav': 0,\n 'nobr': 0,\n 'noembed': 276,\n 'noframes': 276,\n 'noscript': 276,\n 'object': 272,\n 'ol': 0,\n 'optgroup': 0,\n 'option': 1,\n 'output': 0,\n 'p': 1,\n 'param': 274,\n 'pre': 0,\n 'progress': 0,\n 'q': 0,\n 's': 0,\n 'samp': 0,\n 'script': 84,\n 'section': 0,\n 'select': 0,\n 'small': 0,\n 'source': 2,\n 'span': 0,\n 'strike': 0,\n 'strong': 0,\n 'style': 148,\n 'sub': 0,\n 'summary': 0,\n 'sup': 0,\n 'table': 0,\n 'tbody': 1,\n 'td': 1,\n 'textarea': 8,\n 'tfoot': 1,\n 'th': 1,\n 'thead': 1,\n 'time': 0,\n 'title': 280,\n 'tr': 1,\n 'track': 2,\n 'tt': 0,\n 'u': 0,\n 'ul': 0,\n 'var': 0,\n 'video': 0,\n 'wbr': 2\n};\nhtml4[ 'ELEMENTS' ] = html4.ELEMENTS;\nhtml4.ELEMENT_DOM_INTERFACES = {\n 'a': 'HTMLAnchorElement',\n 'abbr': 'HTMLElement',\n 'acronym': 'HTMLElement',\n 'address': 'HTMLElement',\n 'applet': 'HTMLAppletElement',\n 'area': 'HTMLAreaElement',\n 'article': 'HTMLElement',\n 'aside': 'HTMLElement',\n 'audio': 'HTMLAudioElement',\n 'b': 'HTMLElement',\n 'base': 'HTMLBaseElement',\n 'basefont': 'HTMLBaseFontElement',\n 'bdi': 'HTMLElement',\n 'bdo': 'HTMLElement',\n 'big': 'HTMLElement',\n 'blockquote': 'HTMLQuoteElement',\n 'body': 'HTMLBodyElement',\n 'br': 'HTMLBRElement',\n 'button': 'HTMLButtonElement',\n 'canvas': 'HTMLCanvasElement',\n 'caption': 'HTMLTableCaptionElement',\n 'center': 'HTMLElement',\n 'cite': 'HTMLElement',\n 'code': 'HTMLElement',\n 'col': 'HTMLTableColElement',\n 'colgroup': 'HTMLTableColElement',\n 'command': 'HTMLCommandElement',\n 'data': 'HTMLElement',\n 'datalist': 'HTMLDataListElement',\n 'dd': 'HTMLElement',\n 'del': 'HTMLModElement',\n 'details': 'HTMLDetailsElement',\n 'dfn': 'HTMLElement',\n 'dialog': 'HTMLDialogElement',\n 'dir': 'HTMLDirectoryElement',\n 'div': 'HTMLDivElement',\n 'dl': 'HTMLDListElement',\n 'dt': 'HTMLElement',\n 'em': 'HTMLElement',\n 'fieldset': 'HTMLFieldSetElement',\n 'figcaption': 'HTMLElement',\n 'figure': 'HTMLElement',\n 'font': 'HTMLFontElement',\n 'footer': 'HTMLElement',\n 'form': 'HTMLFormElement',\n 'frame': 'HTMLFrameElement',\n 'frameset': 'HTMLFrameSetElement',\n 'h1': 'HTMLHeadingElement',\n 'h2': 'HTMLHeadingElement',\n 'h3': 'HTMLHeadingElement',\n 'h4': 'HTMLHeadingElement',\n 'h5': 'HTMLHeadingElement',\n 'h6': 'HTMLHeadingElement',\n 'head': 'HTMLHeadElement',\n 'header': 'HTMLElement',\n 'hgroup': 'HTMLElement',\n 'hr': 'HTMLHRElement',\n 'html': 'HTMLHtmlElement',\n 'i': 'HTMLElement',\n 'iframe': 'HTMLIFrameElement',\n 'img': 'HTMLImageElement',\n 'input': 'HTMLInputElement',\n 'ins': 'HTMLModElement',\n 'isindex': 'HTMLUnknownElement',\n 'kbd': 'HTMLElement',\n 'keygen': 'HTMLKeygenElement',\n 'label': 'HTMLLabelElement',\n 'legend': 'HTMLLegendElement',\n 'li': 'HTMLLIElement',\n 'link': 'HTMLLinkElement',\n 'map': 'HTMLMapElement',\n 'mark': 'HTMLElement',\n 'menu': 'HTMLMenuElement',\n 'meta': 'HTMLMetaElement',\n 'meter': 'HTMLMeterElement',\n 'nav': 'HTMLElement',\n 'nobr': 'HTMLElement',\n 'noembed': 'HTMLElement',\n 'noframes': 'HTMLElement',\n 'noscript': 'HTMLElement',\n 'object': 'HTMLObjectElement',\n 'ol': 'HTMLOListElement',\n 'optgroup': 'HTMLOptGroupElement',\n 'option': 'HTMLOptionElement',\n 'output': 'HTMLOutputElement',\n 'p': 'HTMLParagraphElement',\n 'param': 'HTMLParamElement',\n 'pre': 'HTMLPreElement',\n 'progress': 'HTMLProgressElement',\n 'q': 'HTMLQuoteElement',\n 's': 'HTMLElement',\n 'samp': 'HTMLElement',\n 'script': 'HTMLScriptElement',\n 'section': 'HTMLElement',\n 'select': 'HTMLSelectElement',\n 'small': 'HTMLElement',\n 'source': 'HTMLSourceElement',\n 'span': 'HTMLSpanElement',\n 'strike': 'HTMLElement',\n 'strong': 'HTMLElement',\n 'style': 'HTMLStyleElement',\n 'sub': 'HTMLElement',\n 'summary': 'HTMLElement',\n 'sup': 'HTMLElement',\n 'table': 'HTMLTableElement',\n 'tbody': 'HTMLTableSectionElement',\n 'td': 'HTMLTableDataCellElement',\n 'textarea': 'HTMLTextAreaElement',\n 'tfoot': 'HTMLTableSectionElement',\n 'th': 'HTMLTableHeaderCellElement',\n 'thead': 'HTMLTableSectionElement',\n 'time': 'HTMLTimeElement',\n 'title': 'HTMLTitleElement',\n 'tr': 'HTMLTableRowElement',\n 'track': 'HTMLTrackElement',\n 'tt': 'HTMLElement',\n 'u': 'HTMLElement',\n 'ul': 'HTMLUListElement',\n 'var': 'HTMLElement',\n 'video': 'HTMLVideoElement',\n 'wbr': 'HTMLElement'\n};\nhtml4[ 'ELEMENT_DOM_INTERFACES' ] = html4.ELEMENT_DOM_INTERFACES;\nhtml4.ueffects = {\n 'NOT_LOADED': 0,\n 'SAME_DOCUMENT': 1,\n 'NEW_DOCUMENT': 2\n};\nhtml4[ 'ueffects' ] = html4.ueffects;\nhtml4.URIEFFECTS = {\n 'a::href': 2,\n 'area::href': 2,\n 'blockquote::cite': 0,\n 'command::icon': 1,\n 'del::cite': 0,\n 'form::action': 2,\n 'img::src': 1,\n 'input::src': 1,\n 'ins::cite': 0,\n 'q::cite': 0,\n 'video::poster': 1\n};\nhtml4[ 'URIEFFECTS' ] = html4.URIEFFECTS;\nhtml4.ltypes = {\n 'UNSANDBOXED': 2,\n 'SANDBOXED': 1,\n 'DATA': 0\n};\nhtml4[ 'ltypes' ] = html4.ltypes;\nhtml4.LOADERTYPES = {\n 'a::href': 2,\n 'area::href': 2,\n 'blockquote::cite': 2,\n 'command::icon': 1,\n 'del::cite': 2,\n 'form::action': 2,\n 'img::src': 1,\n 'input::src': 1,\n 'ins::cite': 2,\n 'q::cite': 2,\n 'video::poster': 1\n};\nhtml4[ 'LOADERTYPES' ] = html4.LOADERTYPES;\n\n// Copyright (C) 2006 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * @fileoverview\n * An HTML sanitizer that can satisfy a variety of security policies.\n *\n * <p>\n * The HTML sanitizer is built around a SAX parser and HTML element and\n * attributes schemas.\n *\n * If the cssparser is loaded, inline styles are sanitized using the\n * css property and value schemas. Else they are remove during\n * sanitization.\n *\n * If it exists, uses parseCssDeclarations, sanitizeCssProperty, cssSchema\n *\n * @author mikesamuel@gmail.com\n * @author jasvir@gmail.com\n * \\@requires html4, URI\n * \\@overrides window\n * \\@provides html, html_sanitize\n */\n\n// The Turkish i seems to be a non-issue, but abort in case it is.\nif ('I'.toLowerCase() !== 'i') { throw 'I/i problem'; }\n\n/**\n * \\@namespace\n */\nvar html = (function(html4) {\n\n // For closure compiler\n var parseCssDeclarations, sanitizeCssProperty, cssSchema;\n if ('undefined' !== typeof window) {\n parseCssDeclarations = window['parseCssDeclarations'];\n sanitizeCssProperty = window['sanitizeCssProperty'];\n cssSchema = window['cssSchema'];\n }\n\n // The keys of this object must be 'quoted' or JSCompiler will mangle them!\n // This is a partial list -- lookupEntity() uses the host browser's parser\n // (when available) to implement full entity lookup.\n // Note that entities are in general case-sensitive; the uppercase ones are\n // explicitly defined by HTML5 (presumably as compatibility).\n var ENTITIES = {\n 'lt': '<',\n 'LT': '<',\n 'gt': '>',\n 'GT': '>',\n 'amp': '&',\n 'AMP': '&',\n 'quot': '\"',\n 'apos': '\\'',\n 'nbsp': '\\u00A0'\n };\n\n // Patterns for types of entity/character reference names.\n var decimalEscapeRe = /^#(\\d+)$/;\n var hexEscapeRe = /^#x([0-9A-Fa-f]+)$/;\n // contains every entity per http://www.w3.org/TR/2011/WD-html5-20110113/named-character-references.html\n var safeEntityNameRe = /^[A-Za-z][A-za-z0-9]+$/;\n // Used as a hook to invoke the browser's entity parsing. <textarea> is used\n // because its content is parsed for entities but not tags.\n // TODO(kpreid): This retrieval is a kludge and leads to silent loss of\n // functionality if the document isn't available.\n var entityLookupElement =\n ('undefined' !== typeof window && window['document'])\n ? window['document'].createElement('textarea') : null;\n /**\n * Decodes an HTML entity.\n *\n * {\\@updoc\n * $ lookupEntity('lt')\n * # '<'\n * $ lookupEntity('GT')\n * # '>'\n * $ lookupEntity('amp')\n * # '&'\n * $ lookupEntity('nbsp')\n * # '\\xA0'\n * $ lookupEntity('apos')\n * # \"'\"\n * $ lookupEntity('quot')\n * # '\"'\n * $ lookupEntity('#xa')\n * # '\\n'\n * $ lookupEntity('#10')\n * # '\\n'\n * $ lookupEntity('#x0a')\n * # '\\n'\n * $ lookupEntity('#010')\n * # '\\n'\n * $ lookupEntity('#x00A')\n * # '\\n'\n * $ lookupEntity('Pi') // Known failure\n * # '\\u03A0'\n * $ lookupEntity('pi') // Known failure\n * # '\\u03C0'\n * }\n *\n * @param {string} name the content between the '&' and the ';'.\n * @return {string} a single unicode code-point as a string.\n */\n function lookupEntity(name) {\n // TODO: entity lookup as specified by HTML5 actually depends on the\n // presence of the \";\".\n if (ENTITIES.hasOwnProperty(name)) { return ENTITIES[name]; }\n var m = name.match(decimalEscapeRe);\n if (m) {\n return String.fromCharCode(parseInt(m[1], 10));\n } else if (!!(m = name.match(hexEscapeRe))) {\n return String.fromCharCode(parseInt(m[1], 16));\n } else if (entityLookupElement && safeEntityNameRe.test(name)) {\n entityLookupElement.innerHTML = '&' + name + ';';\n var text = entityLookupElement.textContent;\n ENTITIES[name] = text;\n return text;\n } else {\n return '&' + name + ';';\n }\n }\n\n function decodeOneEntity(_, name) {\n return lookupEntity(name);\n }\n\n var nulRe = /\\0/g;\n function stripNULs(s) {\n return s.replace(nulRe, '');\n }\n\n var ENTITY_RE_1 = /&(#[0-9]+|#[xX][0-9A-Fa-f]+|\\w+);/g;\n var ENTITY_RE_2 = /^(#[0-9]+|#[xX][0-9A-Fa-f]+|\\w+);/;\n /**\n * The plain text of a chunk of HTML CDATA which possibly containing.\n *\n * {\\@updoc\n * $ unescapeEntities('')\n * # ''\n * $ unescapeEntities('hello World!')\n * # 'hello World!'\n * $ unescapeEntities('1 < 2 && 4 > 3 ')\n * # '1 < 2 && 4 > 3\\n'\n * $ unescapeEntities('<< <- unfinished entity>')\n * # '<< <- unfinished entity>'\n * $ unescapeEntities('/foo?bar=baz©=true') // & often unescaped in URLS\n * # '/foo?bar=baz©=true'\n * $ unescapeEntities('pi=ππ, Pi=Π\\u03A0') // FIXME: known failure\n * # 'pi=\\u03C0\\u03c0, Pi=\\u03A0\\u03A0'\n * }\n *\n * @param {string} s a chunk of HTML CDATA. It must not start or end inside\n * an HTML entity.\n */\n function unescapeEntities(s) {\n return s.replace(ENTITY_RE_1, decodeOneEntity);\n }\n\n var ampRe = /&/g;\n var looseAmpRe = /&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi;\n var ltRe = /[<]/g;\n var gtRe = />/g;\n var quotRe = /\\\"/g;\n\n /**\n * Escapes HTML special characters in attribute values.\n *\n * {\\@updoc\n * $ escapeAttrib('')\n * # ''\n * $ escapeAttrib('\"<<&==&>>\"') // Do not just escape the first occurrence.\n * # '"<<&==&>>"'\n * $ escapeAttrib('Hello <World>!')\n * # 'Hello <World>!'\n * }\n */\n function escapeAttrib(s) {\n return ('' + s).replace(ampRe, '&').replace(ltRe, '<')\n .replace(gtRe, '>').replace(quotRe, '"');\n }\n\n /**\n * Escape entities in RCDATA that can be escaped without changing the meaning.\n * {\\@updoc\n * $ normalizeRCData('1 < 2 && 3 > 4 && 5 < 7&8')\n * # '1 < 2 && 3 > 4 && 5 < 7&8'\n * }\n */\n function normalizeRCData(rcdata) {\n return rcdata\n .replace(looseAmpRe, '&$1')\n .replace(ltRe, '<')\n .replace(gtRe, '>');\n }\n\n // TODO(felix8a): validate sanitizer regexs against the HTML5 grammar at\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html\n\n // We initially split input so that potentially meaningful characters\n // like '<' and '>' are separate tokens, using a fast dumb process that\n // ignores quoting. Then we walk that token stream, and when we see a\n // '<' that's the start of a tag, we use ATTR_RE to extract tag\n // attributes from the next token. That token will never have a '>'\n // character. However, it might have an unbalanced quote character, and\n // when we see that, we combine additional tokens to balance the quote.\n\n var ATTR_RE = new RegExp(\n '^\\\\s*' +\n '([-.:\\\\w]+)' + // 1 = Attribute name\n '(?:' + (\n '\\\\s*(=)\\\\s*' + // 2 = Is there a value?\n '(' + ( // 3 = Attribute value\n // TODO(felix8a): maybe use backref to match quotes\n '(\\\")[^\\\"]*(\\\"|$)' + // 4, 5 = Double-quoted string\n '|' +\n '(\\')[^\\']*(\\'|$)' + // 6, 7 = Single-quoted string\n '|' +\n // Positive lookahead to prevent interpretation of\n // <foo a= b=c> as <foo a='b=c'>\n // TODO(felix8a): might be able to drop this case\n '(?=[a-z][-\\\\w]*\\\\s*=)' +\n '|' +\n // Unquoted value that isn't an attribute name\n // (since we didn't match the positive lookahead above)\n '[^\\\"\\'\\\\s]*' ) +\n ')' ) +\n ')?',\n 'i');\n\n // false on IE<=8, true on most other browsers\n var splitWillCapture = ('a,b'.split(/(,)/).length === 3);\n\n // bitmask for tags with special parsing, like <script> and <textarea>\n var EFLAGS_TEXT = html4.eflags['CDATA'] | html4.eflags['RCDATA'];\n\n /**\n * Given a SAX-like event handler, produce a function that feeds those\n * events and a parameter to the event handler.\n *\n * The event handler has the form:{@code\n * {\n * // Name is an upper-case HTML tag name. Attribs is an array of\n * // alternating upper-case attribute names, and attribute values. The\n * // attribs array is reused by the parser. Param is the value passed to\n * // the saxParser.\n * startTag: function (name, attribs, param) { ... },\n * endTag: function (name, param) { ... },\n * pcdata: function (text, param) { ... },\n * rcdata: function (text, param) { ... },\n * cdata: function (text, param) { ... },\n * startDoc: function (param) { ... },\n * endDoc: function (param) { ... }\n * }}\n *\n * @param {Object} handler a record containing event handlers.\n * @return {function(string, Object)} A function that takes a chunk of HTML\n * and a parameter. The parameter is passed on to the handler methods.\n */\n function makeSaxParser(handler) {\n // Accept quoted or unquoted keys (Closure compat)\n var hcopy = {\n cdata: handler.cdata || handler['cdata'],\n comment: handler.comment || handler['comment'],\n endDoc: handler.endDoc || handler['endDoc'],\n endTag: handler.endTag || handler['endTag'],\n pcdata: handler.pcdata || handler['pcdata'],\n rcdata: handler.rcdata || handler['rcdata'],\n startDoc: handler.startDoc || handler['startDoc'],\n startTag: handler.startTag || handler['startTag']\n };\n return function(htmlText, param) {\n return parse(htmlText, hcopy, param);\n };\n }\n\n // Parsing strategy is to split input into parts that might be lexically\n // meaningful (every \">\" becomes a separate part), and then recombine\n // parts if we discover they're in a different context.\n\n // TODO(felix8a): Significant performance regressions from -legacy,\n // tested on\n // Chrome 18.0\n // Firefox 11.0\n // IE 6, 7, 8, 9\n // Opera 11.61\n // Safari 5.1.3\n // Many of these are unusual patterns that are linearly slower and still\n // pretty fast (eg 1ms to 5ms), so not necessarily worth fixing.\n\n // TODO(felix8a): \"<script> && && && ... <\\/script>\" is slower on all\n // browsers. The hotspot is htmlSplit.\n\n // TODO(felix8a): \"<p title='>>>>...'><\\/p>\" is slower on all browsers.\n // This is partly htmlSplit, but the hotspot is parseTagAndAttrs.\n\n // TODO(felix8a): \"<a><\\/a><a><\\/a>...\" is slower on IE9.\n // \"<a>1<\\/a><a>1<\\/a>...\" is faster, \"<a><\\/a>2<a><\\/a>2...\" is faster.\n\n // TODO(felix8a): \"<p<p<p...\" is slower on IE[6-8]\n\n var continuationMarker = {};\n function parse(htmlText, handler, param) {\n var m, p, tagName;\n var parts = htmlSplit(htmlText);\n var state = {\n noMoreGT: false,\n noMoreEndComments: false\n };\n parseCPS(handler, parts, 0, state, param);\n }\n\n function continuationMaker(h, parts, initial, state, param) {\n return function () {\n parseCPS(h, parts, initial, state, param);\n };\n }\n\n function parseCPS(h, parts, initial, state, param) {\n try {\n if (h.startDoc && initial == 0) { h.startDoc(param); }\n var m, p, tagName;\n for (var pos = initial, end = parts.length; pos < end;) {\n var current = parts[pos++];\n var next = parts[pos];\n switch (current) {\n case '&':\n if (ENTITY_RE_2.test(next)) {\n if (h.pcdata) {\n h.pcdata('&' + next, param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n pos++;\n } else {\n if (h.pcdata) { h.pcdata(\"&\", param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n }\n break;\n case '<\\/':\n if (m = /^([-\\w:]+)[^\\'\\\"]*/.exec(next)) {\n if (m[0].length === next.length && parts[pos + 1] === '>') {\n // fast case, no attribute parsing needed\n pos += 2;\n tagName = m[1].toLowerCase();\n if (h.endTag) {\n h.endTag(tagName, param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n } else {\n // slow case, need to parse attributes\n // TODO(felix8a): do we really care about misparsing this?\n pos = parseEndTag(\n parts, pos, h, param, continuationMarker, state);\n }\n } else {\n if (h.pcdata) {\n h.pcdata('</', param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n }\n break;\n case '<':\n if (m = /^([-\\w:]+)\\s*\\/?/.exec(next)) {\n if (m[0].length === next.length && parts[pos + 1] === '>') {\n // fast case, no attribute parsing needed\n pos += 2;\n tagName = m[1].toLowerCase();\n if (h.startTag) {\n h.startTag(tagName, [], param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n // tags like <script> and <textarea> have special parsing\n var eflags = html4.ELEMENTS[tagName];\n if (eflags & EFLAGS_TEXT) {\n var tag = { name: tagName, next: pos, eflags: eflags };\n pos = parseText(\n parts, tag, h, param, continuationMarker, state);\n }\n } else {\n // slow case, need to parse attributes\n pos = parseStartTag(\n parts, pos, h, param, continuationMarker, state);\n }\n } else {\n if (h.pcdata) {\n h.pcdata('<', param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n }\n break;\n case '<\\!--':\n // The pathological case is n copies of '<\\!--' without '-->', and\n // repeated failure to find '-->' is quadratic. We avoid that by\n // remembering when search for '-->' fails.\n if (!state.noMoreEndComments) {\n // A comment <\\!--x--> is split into three tokens:\n // '<\\!--', 'x--', '>'\n // We want to find the next '>' token that has a preceding '--'.\n // pos is at the 'x--'.\n for (p = pos + 1; p < end; p++) {\n if (parts[p] === '>' && /--$/.test(parts[p - 1])) { break; }\n }\n if (p < end) {\n if (h.comment) {\n var comment = parts.slice(pos, p).join('');\n h.comment(\n comment.substr(0, comment.length - 2), param,\n continuationMarker,\n continuationMaker(h, parts, p + 1, state, param));\n }\n pos = p + 1;\n } else {\n state.noMoreEndComments = true;\n }\n }\n if (state.noMoreEndComments) {\n if (h.pcdata) {\n h.pcdata('<!--', param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n }\n break;\n case '<\\!':\n if (!/^\\w/.test(next)) {\n if (h.pcdata) {\n h.pcdata('<!', param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n } else {\n // similar to noMoreEndComment logic\n if (!state.noMoreGT) {\n for (p = pos + 1; p < end; p++) {\n if (parts[p] === '>') { break; }\n }\n if (p < end) {\n pos = p + 1;\n } else {\n state.noMoreGT = true;\n }\n }\n if (state.noMoreGT) {\n if (h.pcdata) {\n h.pcdata('<!', param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n }\n }\n break;\n case '<?':\n // similar to noMoreEndComment logic\n if (!state.noMoreGT) {\n for (p = pos + 1; p < end; p++) {\n if (parts[p] === '>') { break; }\n }\n if (p < end) {\n pos = p + 1;\n } else {\n state.noMoreGT = true;\n }\n }\n if (state.noMoreGT) {\n if (h.pcdata) {\n h.pcdata('<?', param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n }\n break;\n case '>':\n if (h.pcdata) {\n h.pcdata(\">\", param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n break;\n case '':\n break;\n default:\n if (h.pcdata) {\n h.pcdata(current, param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n break;\n }\n }\n if (h.endDoc) { h.endDoc(param); }\n } catch (e) {\n if (e !== continuationMarker) { throw e; }\n }\n }\n\n // Split str into parts for the html parser.\n function htmlSplit(str) {\n // can't hoist this out of the function because of the re.exec loop.\n var re = /(<\\/|<\\!--|<[!?]|[&<>])/g;\n str += '';\n if (splitWillCapture) {\n return str.split(re);\n } else {\n var parts = [];\n var lastPos = 0;\n var m;\n while ((m = re.exec(str)) !== null) {\n parts.push(str.substring(lastPos, m.index));\n parts.push(m[0]);\n lastPos = m.index + m[0].length;\n }\n parts.push(str.substring(lastPos));\n return parts;\n }\n }\n\n function parseEndTag(parts, pos, h, param, continuationMarker, state) {\n var tag = parseTagAndAttrs(parts, pos);\n // drop unclosed tags\n if (!tag) { return parts.length; }\n if (h.endTag) {\n h.endTag(tag.name, param, continuationMarker,\n continuationMaker(h, parts, pos, state, param));\n }\n return tag.next;\n }\n\n function parseStartTag(parts, pos, h, param, continuationMarker, state) {\n var tag = parseTagAndAttrs(parts, pos);\n // drop unclosed tags\n if (!tag) { return parts.length; }\n if (h.startTag) {\n h.startTag(tag.name, tag.attrs, param, continuationMarker,\n continuationMaker(h, parts, tag.next, state, param));\n }\n // tags like <script> and <textarea> have special parsing\n if (tag.eflags & EFLAGS_TEXT) {\n return parseText(parts, tag, h, param, continuationMarker, state);\n } else {\n return tag.next;\n }\n }\n\n var endTagRe = {};\n\n // Tags like <script> and <textarea> are flagged as CDATA or RCDATA,\n // which means everything is text until we see the correct closing tag.\n function parseText(parts, tag, h, param, continuationMarker, state) {\n var end = parts.length;\n if (!endTagRe.hasOwnProperty(tag.name)) {\n endTagRe[tag.name] = new RegExp('^' + tag.name + '(?:[\\\\s\\\\/]|$)', 'i');\n }\n var re = endTagRe[tag.name];\n var first = tag.next;\n var p = tag.next + 1;\n for (; p < end; p++) {\n if (parts[p - 1] === '<\\/' && re.test(parts[p])) { break; }\n }\n if (p < end) { p -= 1; }\n var buf = parts.slice(first, p).join('');\n if (tag.eflags & html4.eflags['CDATA']) {\n if (h.cdata) {\n h.cdata(buf, param, continuationMarker,\n continuationMaker(h, parts, p, state, param));\n }\n } else if (tag.eflags & html4.eflags['RCDATA']) {\n if (h.rcdata) {\n h.rcdata(normalizeRCData(buf), param, continuationMarker,\n continuationMaker(h, parts, p, state, param));\n }\n } else {\n throw new Error('bug');\n }\n return p;\n }\n\n // at this point, parts[pos-1] is either \"<\" or \"<\\/\".\n function parseTagAndAttrs(parts, pos) {\n var m = /^([-\\w:]+)/.exec(parts[pos]);\n var tag = {};\n tag.name = m[1].toLowerCase();\n tag.eflags = html4.ELEMENTS[tag.name];\n var buf = parts[pos].substr(m[0].length);\n // Find the next '>'. We optimistically assume this '>' is not in a\n // quoted context, and further down we fix things up if it turns out to\n // be quoted.\n var p = pos + 1;\n var end = parts.length;\n for (; p < end; p++) {\n if (parts[p] === '>') { break; }\n buf += parts[p];\n }\n if (end <= p) { return void 0; }\n var attrs = [];\n while (buf !== '') {\n m = ATTR_RE.exec(buf);\n if (!m) {\n // No attribute found: skip garbage\n buf = buf.replace(/^[\\s\\S][^a-z\\s]*/, '');\n\n } else if ((m[4] && !m[5]) || (m[6] && !m[7])) {\n // Unterminated quote: slurp to the next unquoted '>'\n var quote = m[4] || m[6];\n var sawQuote = false;\n var abuf = [buf, parts[p++]];\n for (; p < end; p++) {\n if (sawQuote) {\n if (parts[p] === '>') { break; }\n } else if (0 <= parts[p].indexOf(quote)) {\n sawQuote = true;\n }\n abuf.push(parts[p]);\n }\n // Slurp failed: lose the garbage\n if (end <= p) { break; }\n // Otherwise retry attribute parsing\n buf = abuf.join('');\n continue;\n\n } else {\n // We have an attribute\n var aName = m[1].toLowerCase();\n var aValue = m[2] ? decodeValue(m[3]) : '';\n attrs.push(aName, aValue);\n buf = buf.substr(m[0].length);\n }\n }\n tag.attrs = attrs;\n tag.next = p + 1;\n return tag;\n }\n\n function decodeValue(v) {\n var q = v.charCodeAt(0);\n if (q === 0x22 || q === 0x27) { // \" or '\n v = v.substr(1, v.length - 2);\n }\n return unescapeEntities(stripNULs(v));\n }\n\n /**\n * Returns a function that strips unsafe tags and attributes from html.\n * @param {function(string, Array.<string>): ?Array.<string>} tagPolicy\n * A function that takes (tagName, attribs[]), where tagName is a key in\n * html4.ELEMENTS and attribs is an array of alternating attribute names\n * and values. It should return a record (as follows), or null to delete\n * the element. It's okay for tagPolicy to modify the attribs array,\n * but the same array is reused, so it should not be held between calls.\n * Record keys:\n * attribs: (required) Sanitized attributes array.\n * tagName: Replacement tag name.\n * @return {function(string, Array)} A function that sanitizes a string of\n * HTML and appends result strings to the second argument, an array.\n */\n function makeHtmlSanitizer(tagPolicy) {\n var stack;\n var ignoring;\n var emit = function (text, out) {\n if (!ignoring) { out.push(text); }\n };\n return makeSaxParser({\n 'startDoc': function(_) {\n stack = [];\n ignoring = false;\n },\n 'startTag': function(tagNameOrig, attribs, out) {\n if (ignoring) { return; }\n if (!html4.ELEMENTS.hasOwnProperty(tagNameOrig)) { return; }\n var eflagsOrig = html4.ELEMENTS[tagNameOrig];\n if (eflagsOrig & html4.eflags['FOLDABLE']) {\n return;\n }\n\n var decision = tagPolicy(tagNameOrig, attribs);\n if (!decision) {\n ignoring = !(eflagsOrig & html4.eflags['EMPTY']);\n return;\n } else if (typeof decision !== 'object') {\n throw new Error('tagPolicy did not return object (old API?)');\n }\n if ('attribs' in decision) {\n attribs = decision['attribs'];\n } else {\n throw new Error('tagPolicy gave no attribs');\n }\n var eflagsRep;\n var tagNameRep;\n if ('tagName' in decision) {\n tagNameRep = decision['tagName'];\n eflagsRep = html4.ELEMENTS[tagNameRep];\n } else {\n tagNameRep = tagNameOrig;\n eflagsRep = eflagsOrig;\n }\n // TODO(mikesamuel): relying on tagPolicy not to insert unsafe\n // attribute names.\n\n // If this is an optional-end-tag element and either this element or its\n // previous like sibling was rewritten, then insert a close tag to\n // preserve structure.\n if (eflagsOrig & html4.eflags['OPTIONAL_ENDTAG']) {\n var onStack = stack[stack.length - 1];\n if (onStack && onStack.orig === tagNameOrig &&\n (onStack.rep !== tagNameRep || tagNameOrig !== tagNameRep)) {\n out.push('<\\/', onStack.rep, '>');\n }\n }\n\n if (!(eflagsOrig & html4.eflags['EMPTY'])) {\n stack.push({orig: tagNameOrig, rep: tagNameRep});\n }\n\n out.push('<', tagNameRep);\n for (var i = 0, n = attribs.length; i < n; i += 2) {\n var attribName = attribs[i],\n value = attribs[i + 1];\n if (value !== null && value !== void 0) {\n out.push(' ', attribName, '=\"', escapeAttrib(value), '\"');\n }\n }\n out.push('>');\n\n if ((eflagsOrig & html4.eflags['EMPTY'])\n && !(eflagsRep & html4.eflags['EMPTY'])) {\n // replacement is non-empty, synthesize end tag\n out.push('<\\/', tagNameRep, '>');\n }\n },\n 'endTag': function(tagName, out) {\n if (ignoring) {\n ignoring = false;\n return;\n }\n if (!html4.ELEMENTS.hasOwnProperty(tagName)) { return; }\n var eflags = html4.ELEMENTS[tagName];\n if (!(eflags & (html4.eflags['EMPTY'] | html4.eflags['FOLDABLE']))) {\n var index;\n if (eflags & html4.eflags['OPTIONAL_ENDTAG']) {\n for (index = stack.length; --index >= 0;) {\n var stackElOrigTag = stack[index].orig;\n if (stackElOrigTag === tagName) { break; }\n if (!(html4.ELEMENTS[stackElOrigTag] &\n html4.eflags['OPTIONAL_ENDTAG'])) {\n // Don't pop non optional end tags looking for a match.\n return;\n }\n }\n } else {\n for (index = stack.length; --index >= 0;) {\n if (stack[index].orig === tagName) { break; }\n }\n }\n if (index < 0) { return; } // Not opened.\n for (var i = stack.length; --i > index;) {\n var stackElRepTag = stack[i].rep;\n if (!(html4.ELEMENTS[stackElRepTag] &\n html4.eflags['OPTIONAL_ENDTAG'])) {\n out.push('<\\/', stackElRepTag, '>');\n }\n }\n if (index < stack.length) {\n tagName = stack[index].rep;\n }\n stack.length = index;\n out.push('<\\/', tagName, '>');\n }\n },\n 'pcdata': emit,\n 'rcdata': emit,\n 'cdata': emit,\n 'endDoc': function(out) {\n for (; stack.length; stack.length--) {\n out.push('<\\/', stack[stack.length - 1].rep, '>');\n }\n }\n });\n }\n\n var ALLOWED_URI_SCHEMES = /^(?:https?|mailto|data)$/i;\n\n function safeUri(uri, effect, ltype, hints, naiveUriRewriter) {\n if (!naiveUriRewriter) { return null; }\n try {\n var parsed = URI.parse('' + uri);\n if (parsed) {\n if (!parsed.hasScheme() ||\n ALLOWED_URI_SCHEMES.test(parsed.getScheme())) {\n var safe = naiveUriRewriter(parsed, effect, ltype, hints);\n return safe ? safe.toString() : null;\n }\n }\n } catch (e) {\n return null;\n }\n return null;\n }\n\n function log(logger, tagName, attribName, oldValue, newValue) {\n if (!attribName) {\n logger(tagName + \" removed\", {\n change: \"removed\",\n tagName: tagName\n });\n }\n if (oldValue !== newValue) {\n var changed = \"changed\";\n if (oldValue && !newValue) {\n changed = \"removed\";\n } else if (!oldValue && newValue) {\n changed = \"added\";\n }\n logger(tagName + \".\" + attribName + \" \" + changed, {\n change: changed,\n tagName: tagName,\n attribName: attribName,\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n\n function lookupAttribute(map, tagName, attribName) {\n var attribKey;\n attribKey = tagName + '::' + attribName;\n if (map.hasOwnProperty(attribKey)) {\n return map[attribKey];\n }\n attribKey = '*::' + attribName;\n if (map.hasOwnProperty(attribKey)) {\n return map[attribKey];\n }\n return void 0;\n }\n function getAttributeType(tagName, attribName) {\n return lookupAttribute(html4.ATTRIBS, tagName, attribName);\n }\n function getLoaderType(tagName, attribName) {\n return lookupAttribute(html4.LOADERTYPES, tagName, attribName);\n }\n function getUriEffect(tagName, attribName) {\n return lookupAttribute(html4.URIEFFECTS, tagName, attribName);\n }\n\n /**\n * Sanitizes attributes on an HTML tag.\n * @param {string} tagName An HTML tag name in lowercase.\n * @param {Array.<?string>} attribs An array of alternating names and values.\n * @param {?function(?string): ?string} opt_naiveUriRewriter A transform to\n * apply to URI attributes; it can return a new string value, or null to\n * delete the attribute. If unspecified, URI attributes are deleted.\n * @param {function(?string): ?string} opt_nmTokenPolicy A transform to apply\n * to attributes containing HTML names, element IDs, and space-separated\n * lists of classes; it can return a new string value, or null to delete\n * the attribute. If unspecified, these attributes are kept unchanged.\n * @return {Array.<?string>} The sanitized attributes as a list of alternating\n * names and values, where a null value means to omit the attribute.\n */\n function sanitizeAttribs(tagName, attribs,\n opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger) {\n // TODO(felix8a): it's obnoxious that domado duplicates much of this\n // TODO(felix8a): maybe consistently enforce constraints like target=\n for (var i = 0; i < attribs.length; i += 2) {\n var attribName = attribs[i];\n var value = attribs[i + 1];\n var oldValue = value;\n var atype = null, attribKey;\n if ((attribKey = tagName + '::' + attribName,\n html4.ATTRIBS.hasOwnProperty(attribKey)) ||\n (attribKey = '*::' + attribName,\n html4.ATTRIBS.hasOwnProperty(attribKey))) {\n atype = html4.ATTRIBS[attribKey];\n }\n if (atype !== null) {\n switch (atype) {\n case html4.atype['NONE']: break;\n case html4.atype['SCRIPT']:\n value = null;\n if (opt_logger) {\n log(opt_logger, tagName, attribName, oldValue, value);\n }\n break;\n case html4.atype['STYLE']:\n if ('undefined' === typeof parseCssDeclarations) {\n value = null;\n if (opt_logger) {\n log(opt_logger, tagName, attribName, oldValue, value);\n\t }\n break;\n }\n var sanitizedDeclarations = [];\n parseCssDeclarations(\n value,\n {\n declaration: function (property, tokens) {\n var normProp = property.toLowerCase();\n var schema = cssSchema[normProp];\n if (!schema) {\n return;\n }\n sanitizeCssProperty(\n normProp, schema, tokens,\n opt_naiveUriRewriter\n ? function (url) {\n return safeUri(\n url, html4.ueffects.SAME_DOCUMENT,\n html4.ltypes.SANDBOXED,\n {\n \"TYPE\": \"CSS\",\n \"CSS_PROP\": normProp\n }, opt_naiveUriRewriter);\n }\n : null);\n sanitizedDeclarations.push(property + ': ' + tokens.join(' '));\n }\n });\n value = sanitizedDeclarations.length > 0 ?\n sanitizedDeclarations.join(' ; ') : null;\n if (opt_logger) {\n log(opt_logger, tagName, attribName, oldValue, value);\n }\n break;\n case html4.atype['ID']:\n case html4.atype['IDREF']:\n case html4.atype['IDREFS']:\n case html4.atype['GLOBAL_NAME']:\n case html4.atype['LOCAL_NAME']:\n case html4.atype['CLASSES']:\n value = opt_nmTokenPolicy ? opt_nmTokenPolicy(value) : value;\n if (opt_logger) {\n log(opt_logger, tagName, attribName, oldValue, value);\n }\n break;\n case html4.atype['URI']:\n value = safeUri(value,\n getUriEffect(tagName, attribName),\n getLoaderType(tagName, attribName),\n {\n \"TYPE\": \"MARKUP\",\n \"XML_ATTR\": attribName,\n \"XML_TAG\": tagName\n }, opt_naiveUriRewriter);\n if (opt_logger) {\n log(opt_logger, tagName, attribName, oldValue, value);\n }\n break;\n case html4.atype['URI_FRAGMENT']:\n if (value && '#' === value.charAt(0)) {\n value = value.substring(1); // remove the leading '#'\n value = opt_nmTokenPolicy ? opt_nmTokenPolicy(value) : value;\n if (value !== null && value !== void 0) {\n value = '#' + value; // restore the leading '#'\n }\n } else {\n value = null;\n }\n if (opt_logger) {\n log(opt_logger, tagName, attribName, oldValue, value);\n }\n break;\n default:\n value = null;\n if (opt_logger) {\n log(opt_logger, tagName, attribName, oldValue, value);\n }\n break;\n }\n } else {\n value = null;\n if (opt_logger) {\n log(opt_logger, tagName, attribName, oldValue, value);\n }\n }\n attribs[i + 1] = value;\n }\n return attribs;\n }\n\n /**\n * Creates a tag policy that omits all tags marked UNSAFE in html4-defs.js\n * and applies the default attribute sanitizer with the supplied policy for\n * URI attributes and NMTOKEN attributes.\n * @param {?function(?string): ?string} opt_naiveUriRewriter A transform to\n * apply to URI attributes. If not given, URI attributes are deleted.\n * @param {function(?string): ?string} opt_nmTokenPolicy A transform to apply\n * to attributes containing HTML names, element IDs, and space-separated\n * lists of classes. If not given, such attributes are left unchanged.\n * @return {function(string, Array.<?string>)} A tagPolicy suitable for\n * passing to html.sanitize.\n */\n function makeTagPolicy(\n opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger) {\n return function(tagName, attribs) {\n if (!(html4.ELEMENTS[tagName] & html4.eflags['UNSAFE'])) {\n return {\n 'attribs': sanitizeAttribs(tagName, attribs,\n opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger)\n };\n } else {\n if (opt_logger) {\n log(opt_logger, tagName, undefined, undefined, undefined);\n }\n }\n };\n }\n\n /**\n * Sanitizes HTML tags and attributes according to a given policy.\n * @param {string} inputHtml The HTML to sanitize.\n * @param {function(string, Array.<?string>)} tagPolicy A function that\n * decides which tags to accept and sanitizes their attributes (see\n * makeHtmlSanitizer above for details).\n * @return {string} The sanitized HTML.\n */\n function sanitizeWithPolicy(inputHtml, tagPolicy) {\n var outputArray = [];\n makeHtmlSanitizer(tagPolicy)(inputHtml, outputArray);\n return outputArray.join('');\n }\n\n /**\n * Strips unsafe tags and attributes from HTML.\n * @param {string} inputHtml The HTML to sanitize.\n * @param {?function(?string): ?string} opt_naiveUriRewriter A transform to\n * apply to URI attributes. If not given, URI attributes are deleted.\n * @param {function(?string): ?string} opt_nmTokenPolicy A transform to apply\n * to attributes containing HTML names, element IDs, and space-separated\n * lists of classes. If not given, such attributes are left unchanged.\n */\n function sanitize(inputHtml,\n opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger) {\n var tagPolicy = makeTagPolicy(\n opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger);\n return sanitizeWithPolicy(inputHtml, tagPolicy);\n }\n\n // Export both quoted and unquoted names for Closure linkage.\n var html = {};\n html.escapeAttrib = html['escapeAttrib'] = escapeAttrib;\n html.makeHtmlSanitizer = html['makeHtmlSanitizer'] = makeHtmlSanitizer;\n html.makeSaxParser = html['makeSaxParser'] = makeSaxParser;\n html.makeTagPolicy = html['makeTagPolicy'] = makeTagPolicy;\n html.normalizeRCData = html['normalizeRCData'] = normalizeRCData;\n html.sanitize = html['sanitize'] = sanitize;\n html.sanitizeAttribs = html['sanitizeAttribs'] = sanitizeAttribs;\n html.sanitizeWithPolicy = html['sanitizeWithPolicy'] = sanitizeWithPolicy;\n html.unescapeEntities = html['unescapeEntities'] = unescapeEntities;\n return html;\n})(html4);\n\nvar html_sanitize = html['sanitize'];\n\n// Loosen restrictions of Caja's\n// html-sanitizer to allow for styling\nhtml4.ATTRIBS['*::style'] = 0;\nhtml4.ELEMENTS['style'] = 0;\nhtml4.ATTRIBS['a::target'] = 0;\nhtml4.ELEMENTS['video'] = 0;\nhtml4.ATTRIBS['video::src'] = 0;\nhtml4.ATTRIBS['video::poster'] = 0;\nhtml4.ATTRIBS['video::controls'] = 0;\nhtml4.ELEMENTS['audio'] = 0;\nhtml4.ATTRIBS['audio::src'] = 0;\nhtml4.ATTRIBS['video::autoplay'] = 0;\nhtml4.ATTRIBS['video::controls'] = 0;\n\nif (typeof module !== 'undefined') {\n module.exports = html_sanitize;\n}\n","function corslite(url, callback, cors) {\n var sent = false;\n\n if (typeof window.XMLHttpRequest === 'undefined') {\n return callback(Error('Browser not supported'));\n }\n\n if (typeof cors === 'undefined') {\n var m = url.match(/^\\s*https?:\\/\\/[^\\/]*/);\n cors = m && (m[0] !== location.protocol + '//' + location.domain +\n (location.port ? ':' + location.port : ''));\n }\n\n var x = new window.XMLHttpRequest();\n\n function isSuccessful(status) {\n return status >= 200 && status < 300 || status === 304;\n }\n\n if (cors && !('withCredentials' in x)) {\n // IE8-9\n x = new window.XDomainRequest();\n\n // Ensure callback is never called synchronously, i.e., before\n // x.send() returns (this has been observed in the wild).\n // See https://github.com/mapbox/mapbox.js/issues/472\n var original = callback;\n callback = function() {\n if (sent) {\n original.apply(this, arguments);\n } else {\n var that = this, args = arguments;\n setTimeout(function() {\n original.apply(that, args);\n }, 0);\n }\n }\n }\n\n function loaded() {\n if (\n // XDomainRequest\n x.status === undefined ||\n // modern browsers\n isSuccessful(x.status)) callback.call(x, null, x);\n else callback.call(x, x, null);\n }\n\n // Both `onreadystatechange` and `onload` can fire. `onreadystatechange`\n // has [been supported for longer](http://stackoverflow.com/a/9181508/229001).\n if ('onload' in x) {\n x.onload = loaded;\n } else {\n x.onreadystatechange = function readystate() {\n if (x.readyState === 4) {\n loaded();\n }\n };\n }\n\n // Call the callback with the XMLHttpRequest object as an error and prevent\n // it from ever being called again by reassigning it to `noop`\n x.onerror = function error(evt) {\n // XDomainRequest provides no evt parameter\n callback.call(this, evt || true, null);\n callback = function() { };\n };\n\n // IE9 must have onprogress be set to a unique function.\n x.onprogress = function() { };\n\n x.ontimeout = function(evt) {\n callback.call(this, evt, null);\n callback = function() { };\n };\n\n x.onabort = function(evt) {\n callback.call(this, evt, null);\n callback = function() { };\n };\n\n // GET is the only supported HTTP Verb by XDomainRequest and is the\n // only one supported here.\n x.open('GET', url, true);\n\n // Send the request. Sending data is not supported.\n x.send(null);\n sent = true;\n\n return x;\n}\n\nif (typeof module !== 'undefined') module.exports = corslite;\n"]}