UNPKG

leaflet-ptv-developer

Version:
3 lines 27.4 kB
/*! leaflet-ptv-developer - v1.0.3 - 2023-04-26 */ !function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).leafletPtvDeveloper=t()}(function(){return function o(i,n,s){function a(e,t){if(!n[e]){if(!i[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(u)return u(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=n[e]={exports:{}},i[e][0].call(r.exports,function(t){return a(i[e][1][t]||t)},r,r.exports,o,i,n,s)}return n[e].exports}for(var u="function"==typeof require&&require,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,r){function o(t){if(t){var e,r=t;for(e in o.prototype)r[e]=o.prototype[e];return r}}void 0!==e&&(e.exports=o),o.prototype.on=o.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},o.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)this._callbacks={};else{var r=this._callbacks["$"+t];if(r)if(1==arguments.length)delete this._callbacks["$"+t];else{for(var o,i=0;i<r.length;i++)if((o=r[i])===e||o.fn===e){r.splice(i,1);break}0===r.length&&delete this._callbacks["$"+t]}}return this},o.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],o=1;o<arguments.length;o++)e[o-1]=arguments[o];if(r)for(var o=0,i=(r=r.slice(0)).length;o<i;++o)r[o].apply(this,e);return this},o.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},o.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],2:[function(t,e,r){((e.exports=o).default=o).stable=i,o.stableStringify=i;var h="[...]",f="[Circular]",d=[],s=[];function a(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function o(t,e,r,o){var i;!function t(e,r,o,i,n,s,a){s+=1;var u;if("object"==typeof e&&null!==e){for(u=0;u<i.length;u++)if(i[u]===e)return void y(f,e,r,n);if(void 0!==a.depthLimit&&s>a.depthLimit)y(h,e,r,n);else if(void 0!==a.edgesLimit&&o+1>a.edgesLimit)y(h,e,r,n);else{if(i.push(e),Array.isArray(e))for(u=0;u<e.length;u++)t(e[u],u,u,i,e,s,a);else{var l=Object.keys(e);for(u=0;u<l.length;u++){var p=l[u];t(e[p],p,u,i,e,s,a)}}i.pop()}}}(t,"",0,[],void 0,0,o=void 0===o?a():o);try{i=0===s.length?JSON.stringify(t,e,r):JSON.stringify(t,u(e),r)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==d.length;){var n=d.pop();4===n.length?Object.defineProperty(n[0],n[1],n[3]):n[0][n[1]]=n[2]}}return i}function y(t,e,r,o){var i=Object.getOwnPropertyDescriptor(o,r);void 0!==i.get?i.configurable?(Object.defineProperty(o,r,{value:t}),d.push([o,r,e,i])):s.push([e,r,t]):(o[r]=t,d.push([o,r,e]))}function m(t,e){return t<e?-1:e<t?1:0}function i(t,e,r,o){var i,o=function t(e,r,o,i,n,s,a){s+=1;var u;if("object"==typeof e&&null!==e){for(u=0;u<i.length;u++)if(i[u]===e)return void y(f,e,r,n);try{if("function"==typeof e.toJSON)return}catch(t){return}if(void 0!==a.depthLimit&&s>a.depthLimit)y(h,e,r,n);else if(void 0!==a.edgesLimit&&o+1>a.edgesLimit)y(h,e,r,n);else{if(i.push(e),Array.isArray(e))for(u=0;u<e.length;u++)t(e[u],u,u,i,e,s,a);else{var l={},p=Object.keys(e).sort(m);for(u=0;u<p.length;u++){var c=p[u];t(e[c],c,u,i,e,s,a),l[c]=e[c]}if(void 0===n)return l;d.push([n,r,e]),n[r]=l}i.pop()}}}(t,"",0,[],void 0,0,o=void 0===o?a():o)||t;try{i=0===s.length?JSON.stringify(o,e,r):JSON.stringify(o,u(e),r)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==d.length;){var n=d.pop();4===n.length?Object.defineProperty(n[0],n[1],n[3]):n[0][n[1]]=n[2]}}return i}function u(i){return i=void 0!==i?i:function(t,e){return e},function(t,e){if(0<s.length)for(var r=0;r<s.length;r++){var o=s[r];if(o[1]===t&&o[0]===e){e=o[2],s.splice(r,1);break}}return i.call(this,t,e)}}},{}],3:[function(t,e,r){"use strict";function o(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){var r;if(t)return"string"==typeof t?i(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function n(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach(function(o){n.prototype[o]=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this._defaults.push({fn:o,args:e}),this}}),n.prototype._setDefaults=function(e){this._defaults.forEach(function(t){e[t.fn].apply(e,o(t.args))})},e.exports=n},{}],4:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i="undefined"!=typeof window?window:"undefined"==typeof self?void console.warn("Using browser-only version of superagent in non-browser environment"):self,n=t("component-emitter"),s=t("fast-safe-stringify"),a=t("./request-base"),u=t("./is-object"),l=t("./response-base"),p=t("./agent-base");function c(){}e.exports=function(t,e){return"function"==typeof e?new r.Request("GET",t).end(e):1===arguments.length?new r.Request("GET",t):new r.Request(t,e)};var h=r=e.exports,f=(r.Request=b,h.getXHR=function(){if(i.XMLHttpRequest&&(!i.location||"file:"!==i.location.protocol||!i.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw new Error("Browser-only version of superagent could not find XHR")},"".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")});function d(t){if(!u(t))return t;var e,r=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&!function e(r,o,t){if(void 0===t)return;if(null===t)return void r.push(encodeURI(o));if(Array.isArray(t))t.forEach(function(t){e(r,o,t)});else if(u(t))for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e(r,"".concat(o,"[").concat(i,"]"),t[i]);else r.push(encodeURI(o)+"="+encodeURIComponent(t))}(r,e,t[e]);return r.join("&")}function y(t){for(var e,r,o={},i=t.split("&"),n=0,s=i.length;n<s;++n)-1===(r=(e=i[n]).indexOf("="))?o[decodeURIComponent(e)]="":o[decodeURIComponent(e.slice(0,r))]=decodeURIComponent(e.slice(r+1));return o}function m(t){return/[/+]json($|[^-\w])/.test(t)}function _(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var e=this.xhr.status;this._setStatusProperties(e=1223===e?204:e),this.headers=function(t){for(var e,r,o,i=t.split(/\r?\n/),n={},s=0,a=i.length;s<a;++s)-1!==(e=(o=i[s]).indexOf(":"))&&(r=o.slice(0,e).toLowerCase(),o=f(o.slice(e+1)),n[r]=o);return n}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text||this.xhr.response)}function b(t,e){var o=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var e,r=null,t=null;try{t=new _(o)}catch(t){return(r=new Error("Parser is unable to parse the response")).parse=!0,r.original=t,o.xhr?(r.rawResponse=void 0===o.xhr.responseType?o.xhr.responseText:o.xhr.response,r.status=o.xhr.status||null,r.statusCode=r.status):(r.rawResponse=null,r.status=null),o.callback(r)}o.emit("response",t);try{o._isResponseOK(t)||(e=new Error(t.statusText||t.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=r,e.response=t,e.status=t.status,o.callback(e,t)):o.callback(null,t)})}function g(t,e,r){t=h("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t}h.serializeObject=d,h.parseString=y,h.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},h.serialize={"application/x-www-form-urlencoded":d,"application/json":s},h.parse={"application/x-www-form-urlencoded":y,"application/json":JSON.parse},l(_.prototype),_.prototype._parseBody=function(t){var e=h.parse[this.type];return this.req._parser?this.req._parser(this,t):(e=!e&&m(this.type)?h.parse["application/json"]:e)&&t&&(0<t.length||t instanceof Object)?e(t):null},_.prototype.toError=function(){var t=this.req,e=t.method,t=t.url,r="cannot ".concat(e," ").concat(t," (").concat(this.status,")"),r=new Error(r);return r.status=this.status,r.method=e,r.url=t,r},h.Response=_,n(b.prototype),a(b.prototype),b.prototype.type=function(t){return this.set("Content-Type",h.types[t]||t),this},b.prototype.accept=function(t){return this.set("Accept",h.types[t]||t),this},b.prototype.auth=function(t,e,r){"object"===o(e=1===arguments.length?"":e)&&null!==e&&(r=e,e=""),r=r||{type:"function"==typeof btoa?"basic":"auto"};return this._auth(t,e,r,function(t){if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")})},b.prototype.query=function(t){return(t="string"!=typeof t?d(t):t)&&this._query.push(t),this},b.prototype.attach=function(t,e,r){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},b.prototype._getFormData=function(){return this._formData||(this._formData=new i.FormData),this._formData},b.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();var r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},b.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},b.prototype.buffer=b.prototype.ca=b.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},b.prototype.pipe=b.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},b.prototype._isHost=function(t){return t&&"object"===o(t)&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},b.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||c,this._finalizeQueryString(),this._end()},b.prototype._setUploadTimeout=function(){var t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(function(){t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},b.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));function t(t,e){0<e.total&&(e.percent=e.loaded/e.total*100,100===e.percent)&&clearTimeout(i._uploadTimeoutTimer),e.direction=t,i.emit("progress",e)}var e,r,o,i=this,n=(this.xhr=h.getXHR(),this.xhr),s=this._formData||this._data;this._setTimeouts(),n.onreadystatechange=function(){var e,t=n.readyState;if(2<=t&&i._responseTimeoutTimer&&clearTimeout(i._responseTimeoutTimer),4===t){try{e=n.status}catch(t){e=0}if(!e)return i.timedout||i._aborted?void 0:i.crossDomainError();i.emit("end")}};if(this.hasListeners("progress"))try{n.addEventListener("progress",t.bind(null,"download")),n.upload&&n.upload.addEventListener("progress",t.bind(null,"upload"))}catch(t){}n.upload&&this._setUploadTimeout();try{this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0)}catch(t){return this.callback(t)}for(o in this._withCredentials&&(n.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof s&&!this._isHost(s)&&(e=this._header["content-type"],r=!(r=this._serializer||h.serialize[e?e.split(";")[0]:""])&&m(e)?h.serialize["application/json"]:r)&&(s=r(s)),this.header)null!==this.header[o]&&Object.prototype.hasOwnProperty.call(this.header,o)&&n.setRequestHeader(o,this.header[o]);this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send(void 0===s?null:s)},h.agent=function(){return new p},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(r){p.prototype[r.toLowerCase()]=function(t,e){t=new h.Request(r,t);return this._setDefaults(t),e&&t.end(e),t}}),p.prototype.del=p.prototype.delete,h.get=function(t,e,r){t=h("GET",t);return"function"==typeof e&&(r=e,e=null),e&&t.query(e),r&&t.end(r),t},h.head=function(t,e,r){t=h("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&t.query(e),r&&t.end(r),t},h.options=function(t,e,r){t=h("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t},h.del=g,h.delete=g,h.patch=function(t,e,r){t=h("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t},h.post=function(t,e,r){t=h("POST",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t},h.put=function(t,e,r){t=h("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t}},{"./agent-base":3,"./is-object":5,"./request-base":6,"./response-base":7,"component-emitter":1,"fast-safe-stringify":2}],5:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}e.exports=function(t){return null!==t&&"object"===o(t)}},{}],6:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=t("./is-object");function n(t){if(t){var e,r=t;for(e in n.prototype)Object.prototype.hasOwnProperty.call(n.prototype,e)&&(r[e]=n.prototype[e]);return r}}(e.exports=n).prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},n.prototype.parse=function(t){return this._parser=t,this},n.prototype.responseType=function(t){return this._responseType=t,this},n.prototype.serialize=function(t){return this._serializer=t,this},n.prototype.timeout=function(t){if(t&&"object"===o(t)){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}}else this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0;return this},n.prototype.retry=function(t,e){return this._maxRetries=t=(t=0!==arguments.length&&!0!==t?t:1)<=0?0:t,this._retries=0,this._retryCallback=e,this};var s=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];n.prototype._shouldRetry=function(t,e){if(this._maxRetries&&!(this._retries++>=this._maxRetries)){if(this._retryCallback)try{var r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(t){console.error(t)}if(e&&e.status&&500<=e.status&&501!==e.status)return!0;if(t){if(t.code&&s.includes(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}}return!1},n.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},n.prototype.then=function(t,e){var i,n=this;return this._fullfilledPromise||((i=this)._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(r,o){i.on("abort",function(){var t;n._maxRetries&&n._maxRetries>n._retries||(n.timedout&&n.timedoutError?o(n.timedoutError):((t=new Error("Aborted")).code="ABORTED",t.status=n.status,t.method=n.method,t.url=n.url,o(t)))}),i.end(function(t,e){t?o(t):r(e)})})),this._fullfilledPromise.then(t,e)},n.prototype.catch=function(t){return this.then(void 0,t)},n.prototype.use=function(t){return t(this),this},n.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},n.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):200<=t.status&&t.status<300)},n.prototype.getHeader=n.prototype.get=function(t){return this._header[t.toLowerCase()]},n.prototype.set=function(t,e){if(i(t))for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.set(r,t[r]);else this._header[t.toLowerCase()]=e,this.header[t]=e;return this},n.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},n.prototype.field=function(t,e){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(i(t))for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.field(r,t[r]);else if(Array.isArray(e))for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&this.field(t,e[o]);else{if(null==e)throw new Error(".field(name, val) val can not be empty");"boolean"==typeof e&&(e=String(e)),this._getFormData().append(t,e)}return this},n.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},n.prototype._auth=function(t,e,r,o){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(o("".concat(t,":").concat(e))));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer ".concat(t))}return this},n.prototype.withCredentials=function(t){return this._withCredentials=t=void 0===t?!0:t,this},n.prototype.redirects=function(t){return this._maxRedirects=t,this},n.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},n.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},n.prototype.send=function(t){var e=i(t),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(e&&i(this._data))for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(this._data[o]=t[o]);else"string"==typeof t?(r||this.type("form"),r=this._header["content-type"],this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(t):t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)||r||this.type("json"),this},n.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},n.prototype._finalizeQueryString=function(){var t,e=this._query.join("&");e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort&&0<=(e=this.url.indexOf("?"))&&(t=this.url.slice(e+1).split("&"),"function"==typeof this._sort?t.sort(this._sort):t.sort(),this.url=this.url.slice(0,e)+"?"+t.join("&"))},n.prototype._appendQueryString=function(){console.warn("Unsupported")},n.prototype._timeoutError=function(t,e,r){this._aborted||((t=new Error("".concat(t+e,"ms exceeded"))).timeout=e,t.code="ECONNABORTED",t.errno=r,this.timedout=!0,this.timedoutError=t,this.abort(),this.callback(t))},n.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},{"./is-object":5}],7:[function(t,e,r){"use strict";var i=t("./utils");function o(t){if(t){var e,r=t;for(e in o.prototype)Object.prototype.hasOwnProperty.call(o.prototype,e)&&(r[e]=o.prototype[e]);return r}}(e.exports=o).prototype.get=function(t){return this.header[t.toLowerCase()]},o.prototype._setHeaderProperties=function(t){var e,r=t["content-type"]||"",o=(this.type=i.type(r),i.params(r));for(e in o)Object.prototype.hasOwnProperty.call(o,e)&&(this[e]=o[e]);this.links={};try{t.link&&(this.links=i.parseLinks(t.link))}catch(t){}},o.prototype._setStatusProperties=function(t){var e=t/100|0;this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t}},{"./utils":8}],8:[function(t,e,r){"use strict";r.type=function(t){return t.split(/ *; */).shift()},r.params=function(t){return t.split(/ *; */).reduce(function(t,e){var e=e.split(/ *= */),r=e.shift(),e=e.shift();return r&&e&&(t[r]=e),t},{})},r.parseLinks=function(t){return t.split(/ *, */).reduce(function(t,e){var e=e.split(/ *; */),r=e[0].slice(1,-1);return t[e[1].split(/ *= */)[1].slice(1,-1)]=r,t},{})},r.cleanHeader=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&(delete t.authorization,delete t.cookie),t}},{}],9:[function(r,o,t){!function(t){!function(){"use strict";var h="undefined"!=typeof window?window.L:void 0!==t?t.L:null,e=r("superagent");h.TileLayer.PtvDeveloper=h.TileLayer.extend({options:{disableMouseEvents:!1},initialize:function(t,e){e=h.setOptions(this,e),h.TileLayer.prototype.initialize.call(this,t,e)},onAdd:function(t){h.TileLayer.prototype.onAdd.call(this,t),this.options.disableMouseEvents||(t._container.addEventListener("mousemove",h.bind(this._onMouseMove,this),!0),t._mapPane.addEventListener("mousedown",h.bind(this._onMouseDown,this),!0),t._mapPane.addEventListener("click",h.bind(this._onClick,this),!0),t.addEventListener("click",h.bind(this._onMapClick,this),!1))},onRemove:function(t){this.options.disableMouseEvents||(t._container.removeEventListener("mousemove",h.bind(this._onMouseMove,this),!0),t._mapPane.removeEventListener("mousedown",h.bind(this._onMouseDown,this),!0),t._mapPane.removeEventListener("click",h.bind(this._onClick,this),!0),t.removeEventListener("click",h.bind(this._onMapClick,this),!1)),h.TileLayer.prototype.onRemove.call(this,t)},findElement:function(t,e){if(!e)return null;for(var r={},o=Array.prototype.slice.call(e.getElementsByTagName("img")),i=0,n=o.length;i<n;i++)for(var s=o[i],a=h.DomEvent.getMousePosition(t,s),u=s._layers.length-1;0<=u;u--){var l=s._layers[u],p=Math.abs(l.pixelBoundingBox.right-l.pixelBoundingBox.left),c=Math.abs(l.pixelBoundingBox.top-l.pixelBoundingBox.bottom);l.referencePixelCoordinates.x-p/2<=a.x&&l.referencePixelCoordinates.x+p/2>=a.x&&l.referencePixelCoordinates.y-c/2<=a.y&&l.referencePixelCoordinates.y+c/2>=a.y&&(r[l.id]||(r[l.id]=l))}return 0<Object.keys(r).length?r:null},_onMouseMove:function(t){!this._map||this._map.dragging._draggable&&this._map.dragging._draggable._moving||this._map._animatingZoom||(this.findElement(t,this._container)?(t.preventDefault(),this._map._container.style.cursor="pointer",t.stopPropagation()):this._map._container.style.cursor="")},_onMouseDown:function(t){if(this.findElement(t,this._container))return t.preventDefault(),t.stopPropagation(),!1},_onClick:function(t){var e,r=this.findElement(t,this._container);if(r)return t.preventDefault(),e=this.buildDescriptionText(r),r=r[Object.keys(r)[0]].latLng,h.popup().setLatLng(r).setContent(e).openOn(this._map),t.stopPropagation(),!1},_onMapClick:function(t){var e,t=this.findElement(t.originalEvent,this._container);if(t)return e=this.buildDescriptionText(t),t=t[Object.keys(t)[0]].latLng,h.popup().setLatLng(t).setContent(e).openOn(this._map),!1},buildDescriptionText:function(t){var e,r="",o=!0;for(e in t)for(var i in o?o=!1:r+="<br>",t[e].attributes)var n=t[e].attributes[i],r=r.concat(i.replace(/[A-Z]/g," $&")+": "+n.replace("_"," ")+"<br>");return r.toLowerCase()},pixelToLatLng:function(t,e,r,o){var i=Math.PI,r=2*i/Math.pow(2,r),n=-i+(t.x+o.x/e.x)*r,i=i-(t.y+o.y/e.y)*r;return h.latLng(360/Math.PI*(Math.atan(Math.exp(i))-Math.PI/4),180/Math.PI*n)},_removeTile:function(t){var e=this._tiles[t];return e&&e.el&&e.el.request&&e.el.request.abort(),h.TileLayer.prototype._removeTile.call(this,t)},createTile:function(s,a){var t=this.getTileUrl(s),u=document.createElement("img"),l=this._getZoomForUrl(),p=this.getTileSize();return u._map=this._map,u._layers=[],u.request=e.get(t),u.request.responseType("json").end(h.bind(function(t,e){if(u.request=null,e&&e.body&&e.body.image){var e=e.body,r=e.image;if(u.src={iVBOR:"data:image/png;base64,",R0lGO:"data:image/gif;base64,","/9j/4":"data:image/jpeg;base64,",Qk02U:"data:image/bmp;base64,"}[r.substr(0,5)]+r,e.features)for(var o=e.features,i=0;i<o.length;i++){var n=o[i];"latitude"in n&&"longitude"in n?n.latLng=h.latLng(n.latitude,n.longitude):n.latLng=this.pixelToLatLng(s,p,l,n.referencePixelCoordinates),u._layers.push(n)}}a(null,u)},this)),u}}),h.tileLayer.ptvDeveloper=function(t,e){return new(-1!==h.Util.template(t,h.extend({s:0,x:0,y:0,z:0},e)).indexOf("/data-tiles")?h.TileLayer.PtvDeveloper:h.TileLayer)(t,e)},o.exports=h.tileLayer.ptvDeveloper}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{superagent:4}]},{},[9])(9)}); //# sourceMappingURL=leaflet-ptv-developer.js.map