@carto/airship-bridge
Advanced tools
Comparing version 2.1.1 to 2.2.0-2.2.0-rc.3.0
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AsBridge=e():t.AsBridge=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=2)}([function(t,e,r){(function(r){var n;e=t.exports=Z,n="object"==typeof r&&r.env&&r.env.NODE_DEBUG&&/\bsemver\b/i.test(r.env.NODE_DEBUG)?function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("SEMVER"),console.log.apply(console,t)}:function(){},e.SEMVER_SPEC_VERSION="2.0.0";var i=256,o=Number.MAX_SAFE_INTEGER||9007199254740991,a=e.re=[],s=e.src=[],u=0,l=u++;s[l]="0|[1-9]\\d*";var c=u++;s[c]="[0-9]+";var p=u++;s[p]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var h=u++;s[h]="("+s[l]+")\\.("+s[l]+")\\.("+s[l]+")";var f=u++;s[f]="("+s[c]+")\\.("+s[c]+")\\.("+s[c]+")";var m=u++;s[m]="(?:"+s[l]+"|"+s[p]+")";var d=u++;s[d]="(?:"+s[c]+"|"+s[p]+")";var v=u++;s[v]="(?:-("+s[m]+"(?:\\."+s[m]+")*))";var _=u++;s[_]="(?:-?("+s[d]+"(?:\\."+s[d]+")*))";var g=u++;s[g]="[0-9A-Za-z-]+";var y=u++;s[y]="(?:\\+("+s[g]+"(?:\\."+s[g]+")*))";var b=u++,w="v?"+s[h]+s[v]+"?"+s[y]+"?";s[b]="^"+w+"$";var x="[v=\\s]*"+s[f]+s[_]+"?"+s[y]+"?",L=u++;s[L]="^"+x+"$";var j=u++;s[j]="((?:<|>)?=?)";var O=u++;s[O]=s[c]+"|x|X|\\*";var E=u++;s[E]=s[l]+"|x|X|\\*";var k=u++;s[k]="[v=\\s]*("+s[E]+")(?:\\.("+s[E]+")(?:\\.("+s[E]+")(?:"+s[v]+")?"+s[y]+"?)?)?";var P=u++;s[P]="[v=\\s]*("+s[O]+")(?:\\.("+s[O]+")(?:\\.("+s[O]+")(?:"+s[_]+")?"+s[y]+"?)?)?";var T=u++;s[T]="^"+s[j]+"\\s*"+s[k]+"$";var C=u++;s[C]="^"+s[j]+"\\s*"+s[P]+"$";var z=u++;s[z]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var S=u++;s[S]="(?:~>?)";var H=u++;s[H]="(\\s*)"+s[S]+"\\s+",a[H]=new RegExp(s[H],"g");var N=u++;s[N]="^"+s[S]+s[k]+"$";var D=u++;s[D]="^"+s[S]+s[P]+"$";var R=u++;s[R]="(?:\\^)";var A=u++;s[A]="(\\s*)"+s[R]+"\\s+",a[A]=new RegExp(s[A],"g");var F=u++;s[F]="^"+s[R]+s[k]+"$";var V=u++;s[V]="^"+s[R]+s[P]+"$";var $=u++;s[$]="^"+s[j]+"\\s*("+x+")$|^$";var M=u++;s[M]="^"+s[j]+"\\s*("+w+")$|^$";var I=u++;s[I]="(\\s*)"+s[j]+"\\s*("+x+"|"+s[k]+")",a[I]=new RegExp(s[I],"g");var B=u++;s[B]="^\\s*("+s[k]+")\\s+-\\s+("+s[k]+")\\s*$";var q=u++;s[q]="^\\s*("+s[P]+")\\s+-\\s+("+s[P]+")\\s*$";var U=u++;s[U]="(<|>)?=?\\s*\\*";for(var X=0;X<35;X++)n(X,s[X]),a[X]||(a[X]=new RegExp(s[X]));function G(t,e){if(t instanceof Z)return t;if("string"!=typeof t)return null;if(t.length>i)return null;if(!(e?a[L]:a[b]).test(t))return null;try{return new Z(t,e)}catch(t){return null}}function Z(t,e){if(t instanceof Z){if(t.loose===e)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>i)throw new TypeError("version is longer than "+i+" characters");if(!(this instanceof Z))return new Z(t,e);n("SemVer",t,e),this.loose=e;var r=t.trim().match(e?a[L]:a[b]);if(!r)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e<o)return e}return t}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}e.parse=G,e.valid=function(t,e){var r=G(t,e);return r?r.version:null},e.clean=function(t,e){var r=G(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null},e.SemVer=Z,Z.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},Z.prototype.toString=function(){return this.version},Z.prototype.compare=function(t){return n("SemVer.compare",this.version,this.loose,t),t instanceof Z||(t=new Z(t,this.loose)),this.compareMain(t)||this.comparePre(t)},Z.prototype.compareMain=function(t){return t instanceof Z||(t=new Z(t,this.loose)),J(this.major,t.major)||J(this.minor,t.minor)||J(this.patch,t.patch)},Z.prototype.comparePre=function(t){if(t instanceof Z||(t=new Z(t,this.loose)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;var e=0;do{var r=this.prerelease[e],i=t.prerelease[e];if(n("prerelease compare",e,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return J(r,i)}while(++e)},Z.prototype.inc=function(t,e){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e);break;case"prepatch":this.prerelease.length=0,this.inc("patch",e),this.inc("pre",e);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",e),this.inc("pre",e);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+t)}return this.format(),this.raw=this.version,this},e.inc=function(t,e,r,n){"string"==typeof r&&(n=r,r=void 0);try{return new Z(t,r).inc(e,n).version}catch(t){return null}},e.diff=function(t,e){if(tt(t,e))return null;var r=G(t),n=G(e);if(r.prerelease.length||n.prerelease.length){for(var i in r)if(("major"===i||"minor"===i||"patch"===i)&&r[i]!==n[i])return"pre"+i;return"prerelease"}for(var i in r)if(("major"===i||"minor"===i||"patch"===i)&&r[i]!==n[i])return i},e.compareIdentifiers=J;var W=/^[0-9]+$/;function J(t,e){var r=W.test(t),n=W.test(e);return r&&n&&(t=+t,e=+e),r&&!n?-1:n&&!r?1:t<e?-1:t>e?1:0}function K(t,e,r){return new Z(t,r).compare(new Z(e,r))}function Q(t,e,r){return K(t,e,r)>0}function Y(t,e,r){return K(t,e,r)<0}function tt(t,e,r){return 0===K(t,e,r)}function et(t,e,r){return 0!==K(t,e,r)}function rt(t,e,r){return K(t,e,r)>=0}function nt(t,e,r){return K(t,e,r)<=0}function it(t,e,r,n){var i;switch(e){case"===":"object"==typeof t&&(t=t.version),"object"==typeof r&&(r=r.version),i=t===r;break;case"!==":"object"==typeof t&&(t=t.version),"object"==typeof r&&(r=r.version),i=t!==r;break;case"":case"=":case"==":i=tt(t,r,n);break;case"!=":i=et(t,r,n);break;case">":i=Q(t,r,n);break;case">=":i=rt(t,r,n);break;case"<":i=Y(t,r,n);break;case"<=":i=nt(t,r,n);break;default:throw new TypeError("Invalid operator: "+e)}return i}function ot(t,e){if(t instanceof ot){if(t.loose===e)return t;t=t.value}if(!(this instanceof ot))return new ot(t,e);n("comparator",t,e),this.loose=e,this.parse(t),this.semver===at?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}e.rcompareIdentifiers=function(t,e){return J(e,t)},e.major=function(t,e){return new Z(t,e).major},e.minor=function(t,e){return new Z(t,e).minor},e.patch=function(t,e){return new Z(t,e).patch},e.compare=K,e.compareLoose=function(t,e){return K(t,e,!0)},e.rcompare=function(t,e,r){return K(e,t,r)},e.sort=function(t,r){return t.sort(function(t,n){return e.compare(t,n,r)})},e.rsort=function(t,r){return t.sort(function(t,n){return e.rcompare(t,n,r)})},e.gt=Q,e.lt=Y,e.eq=tt,e.neq=et,e.gte=rt,e.lte=nt,e.cmp=it,e.Comparator=ot;var at={};function st(t,e){if(t instanceof st)return t.loose===e?t:new st(t.raw,e);if(t instanceof ot)return new st(t.value,e);if(!(this instanceof st))return new st(t,e);if(this.loose=e,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map(function(t){return this.parseRange(t.trim())},this).filter(function(t){return t.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}function ut(t){return!t||"x"===t.toLowerCase()||"*"===t}function lt(t,e,r,n,i,o,a,s,u,l,c,p,h){return((e=ut(r)?"":ut(n)?">="+r+".0.0":ut(i)?">="+r+"."+n+".0":">="+e)+" "+(s=ut(u)?"":ut(l)?"<"+(+u+1)+".0.0":ut(c)?"<"+u+"."+(+l+1)+".0":p?"<="+u+"."+l+"."+c+"-"+p:"<="+s)).trim()}function ct(t,e){for(var r=0;r<t.length;r++)if(!t[r].test(e))return!1;if(e.prerelease.length){for(r=0;r<t.length;r++)if(n(t[r].semver),t[r].semver!==at&&t[r].semver.prerelease.length>0){var i=t[r].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}function pt(t,e,r){try{e=new st(e,r)}catch(t){return!1}return e.test(t)}function ht(t,e,r,n){var i,o,a,s,u;switch(t=new Z(t,n),e=new st(e,n),r){case">":i=Q,o=nt,a=Y,s=">",u=">=";break;case"<":i=Y,o=rt,a=Q,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(pt(t,e,n))return!1;for(var l=0;l<e.set.length;++l){var c=e.set[l],p=null,h=null;if(c.forEach(function(t){t.semver===at&&(t=new ot(">=0.0.0")),p=p||t,h=h||t,i(t.semver,p.semver,n)?p=t:a(t.semver,h.semver,n)&&(h=t)}),p.operator===s||p.operator===u)return!1;if((!h.operator||h.operator===s)&&o(t,h.semver))return!1;if(h.operator===u&&a(t,h.semver))return!1}return!0}ot.prototype.parse=function(t){var e=this.loose?a[$]:a[M],r=t.match(e);if(!r)throw new TypeError("Invalid comparator: "+t);this.operator=r[1],"="===this.operator&&(this.operator=""),r[2]?this.semver=new Z(r[2],this.loose):this.semver=at},ot.prototype.toString=function(){return this.value},ot.prototype.test=function(t){return n("Comparator.test",t,this.loose),this.semver===at||("string"==typeof t&&(t=new Z(t,this.loose)),it(t,this.operator,this.semver,this.loose))},ot.prototype.intersects=function(t,e){if(!(t instanceof ot))throw new TypeError("a Comparator is required");var r;if(""===this.operator)return r=new st(t.value,e),pt(this.value,r,e);if(""===t.operator)return r=new st(this.value,e),pt(t.semver,r,e);var n=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),o=this.semver.version===t.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),s=it(this.semver,"<",t.semver,e)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),u=it(this.semver,">",t.semver,e)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return n||i||o&&a||s||u},e.Range=st,st.prototype.format=function(){return this.range=this.set.map(function(t){return t.join(" ").trim()}).join("||").trim(),this.range},st.prototype.toString=function(){return this.range},st.prototype.parseRange=function(t){var e=this.loose;t=t.trim(),n("range",t,e);var r=e?a[q]:a[B];t=t.replace(r,lt),n("hyphen replace",t),t=t.replace(a[I],"$1$2$3"),n("comparator trim",t,a[I]),t=(t=(t=t.replace(a[H],"$1~")).replace(a[A],"$1^")).split(/\s+/).join(" ");var i=e?a[$]:a[M],o=t.split(" ").map(function(t){return function(t,e){return n("comp",t),t=function(t,e){return t.trim().split(/\s+/).map(function(t){return function(t,e){n("caret",t,e);var r=e?a[V]:a[F];return t.replace(r,function(e,r,i,o,a){var s;return n("caret",t,e,r,i,o,a),ut(r)?s="":ut(i)?s=">="+r+".0.0 <"+(+r+1)+".0.0":ut(o)?s="0"===r?">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":">="+r+"."+i+".0 <"+(+r+1)+".0.0":a?(n("replaceCaret pr",a),"-"!==a.charAt(0)&&(a="-"+a),s="0"===r?"0"===i?">="+r+"."+i+"."+o+a+" <"+r+"."+i+"."+(+o+1):">="+r+"."+i+"."+o+a+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+o+a+" <"+(+r+1)+".0.0"):(n("no pr"),s="0"===r?"0"===i?">="+r+"."+i+"."+o+" <"+r+"."+i+"."+(+o+1):">="+r+"."+i+"."+o+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+o+" <"+(+r+1)+".0.0"),n("caret return",s),s})}(t,e)}).join(" ")}(t,e),n("caret",t),t=function(t,e){return t.trim().split(/\s+/).map(function(t){return function(t,e){var r=e?a[D]:a[N];return t.replace(r,function(e,r,i,o,a){var s;return n("tilde",t,e,r,i,o,a),ut(r)?s="":ut(i)?s=">="+r+".0.0 <"+(+r+1)+".0.0":ut(o)?s=">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":a?(n("replaceTilde pr",a),"-"!==a.charAt(0)&&(a="-"+a),s=">="+r+"."+i+"."+o+a+" <"+r+"."+(+i+1)+".0"):s=">="+r+"."+i+"."+o+" <"+r+"."+(+i+1)+".0",n("tilde return",s),s})}(t,e)}).join(" ")}(t,e),n("tildes",t),t=function(t,e){return n("replaceXRanges",t,e),t.split(/\s+/).map(function(t){return function(t,e){t=t.trim();var r=e?a[C]:a[T];return t.replace(r,function(e,r,i,o,a,s){n("xRange",t,e,r,i,o,a,s);var u=ut(i),l=u||ut(o),c=l||ut(a),p=c;return"="===r&&p&&(r=""),u?e=">"===r||"<"===r?"<0.0.0":"*":r&&p?(l&&(o=0),c&&(a=0),">"===r?(r=">=",l?(i=+i+1,o=0,a=0):c&&(o=+o+1,a=0)):"<="===r&&(r="<",l?i=+i+1:o=+o+1),e=r+i+"."+o+"."+a):l?e=">="+i+".0.0 <"+(+i+1)+".0.0":c&&(e=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0"),n("xRange return",e),e})}(t,e)}).join(" ")}(t,e),n("xrange",t),t=function(t,e){return n("replaceStars",t,e),t.trim().replace(a[U],"")}(t,e),n("stars",t),t}(t,e)}).join(" ").split(/\s+/);return this.loose&&(o=o.filter(function(t){return!!t.match(i)})),o=o.map(function(t){return new ot(t,e)})},st.prototype.intersects=function(t,e){if(!(t instanceof st))throw new TypeError("a Range is required");return this.set.some(function(r){return r.every(function(r){return t.set.some(function(t){return t.every(function(t){return r.intersects(t,e)})})})})},e.toComparators=function(t,e){return new st(t,e).set.map(function(t){return t.map(function(t){return t.value}).join(" ").trim().split(" ")})},st.prototype.test=function(t){if(!t)return!1;"string"==typeof t&&(t=new Z(t,this.loose));for(var e=0;e<this.set.length;e++)if(ct(this.set[e],t))return!0;return!1},e.satisfies=pt,e.maxSatisfying=function(t,e,r){var n=null,i=null;try{var o=new st(e,r)}catch(t){return null}return t.forEach(function(t){o.test(t)&&(n&&-1!==i.compare(t)||(i=new Z(n=t,r)))}),n},e.minSatisfying=function(t,e,r){var n=null,i=null;try{var o=new st(e,r)}catch(t){return null}return t.forEach(function(t){o.test(t)&&(n&&1!==i.compare(t)||(i=new Z(n=t,r)))}),n},e.validRange=function(t,e){try{return new st(t,e).range||"*"}catch(t){return null}},e.ltr=function(t,e,r){return ht(t,e,"<",r)},e.gtr=function(t,e,r){return ht(t,e,">",r)},e.outside=ht,e.prerelease=function(t,e){var r=G(t,e);return r&&r.prerelease.length?r.prerelease:null},e.intersects=function(t,e,r){return t=new st(t,r),e=new st(e,r),t.intersects(e)},e.coerce=function(t){if(t instanceof Z)return t;if("string"!=typeof t)return null;var e=t.match(a[z]);return null==e?null:G((e[1]||"0")+"."+(e[2]||"0")+"."+(e[3]||"0"))}}).call(this,r(1))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,l=[],c=!1,p=-1;function h(){c&&u&&(c=!1,u.length?l=u.concat(l):p=-1,l.length&&f())}function f(){if(!c){var t=s(h);c=!0;for(var e=l.length;e;){for(u=l,l=[];++p<e;)u&&u[p].run();p=-1,e=l.length}u=null,c=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function m(t,e){this.fun=t,this.array=e}function d(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];l.push(new m(t,e)),1!==l.length||c||s(f)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=d,i.addListener=d,i.once=d,i.off=d,i.removeListener=d,i.removeAllListeners=d,i.emit=d,i.prependListener=d,i.prependOnceListener=d,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){"use strict";function n(t){return"string"==typeof t?document.querySelector(t):t}function i(t){return"string"==typeof t?t:t.propertyName}function o(t){return"string"==typeof t?null:t}function a(t){return"#"+u(t.r)+u(t.g)+u(t.b)+u(Math.floor(255*t.a))}function s(t){return"rgba("+t.r+","+t.g+","+t.b+","+t.a+")"}function u(t){return isNaN(t)||void 0===t?"":t.toString(16).padStart(2,"0").toUpperCase()}function l(t,e,r){void 0===r&&(r=!1),r&&t.on("updated",function(){e(!1)}),t.viz?e(!0):t.on("loaded",function(){e(!0)})}r.r(e);var c=function(){return(c=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},p=16,h="#000";function f(t){var e=t.getLegendData(),r=Math.floor(e.data.length/2);return e.data[r].value}function m(t,e){var r=t[e];return"ramp"===r.expressionName||"opacity"===r.expressionName?s(f(r)):"color"===e||"strokeColor"===e?s(r.value):h}function d(t,e,r){var n=t[e];return"ramp"===n.expressionName?r||f(n):"number"===n.type?n.value:r}function v(t){var e=t.symbol;return"ramp"===e.expressionName?f(e):e.value}function _(t){var e=t.layer,r=t.props,n=e.viz;return n?c({color:m(n,"color"),label:r.label,marker:n.symbol.default?void 0:v(n),strokeColor:m(n,"strokeColor"),strokeStyle:0===d(n,"strokeWidth")?"hidden":void 0,type:e.metadata.geomType,width:d(n,"width",p)},r):{}}function g(t){return t.props?t:{layer:t,props:{label:t.id}}}var y=function(){function t(){}return t.layersLegend=function(t,e,r){void 0===r&&(r={}),t=n(t);var i=e.map(g);i.forEach(function(e,n,o){l(e.layer,function(){var e=i.map(_);r.format&&(e.label=r.format(e.label,n,o)),t.data=e,r.onLoad&&setTimeout(r.onLoad,0)},r.dynamic)})},t.rampLegend=function(t,e,r,i){void 0===i&&(i={}),t=n(t);var o=g(e);l(o.layer,function(){var e=_(o),n=o.layer.viz[r],s=i.config,u=o.layer.viz[r].getLegendData(s).data,l=u.map(function(t,o,s){var u,l,p,h,f;return c({},e,((u={})[r]=function(t,e){return"color"===t.type?a(e):e}(n,t.value),u.label=i.format?i.format(t.key,o,s):(l=t.key,Array.isArray(l)?(h=(p=l)[0],f=p[1],h===-1/0?"< "+f.toFixed(2):f===1/0?"> "+h.toFixed(2):h.toFixed(2)+" - "+f.toFixed(2)):l.toFixed?l.toFixed(2):l),u))});Array.isArray(o.props)&&o.props.length===u.length?t.data=l.map(function(t,e){return c({},t,o.props[e])}):t.data=l,i.onLoad&&setTimeout(i.onLoad,0)},i.dynamic)},t}(),b=r(0),w=r.n(b);var x=function(t){return t=t||Object.create(null),{on:function(e,r){(t[e]||(t[e]=[])).push(r)},off:function(e,r){t[e]&&t[e].splice(t[e].indexOf(r)>>>0,1)},emit:function(e,r){(t[e]||[]).slice().map(function(t){t(r)}),(t["*"]||[]).slice().map(function(t){t(e,r)})}}},L=function(){function t(e,r,n,i,o){void 0===o&&(o=!0),this._emitter=new x,this._name="asbind_"+e+"_"+r+"_"+t._counter,this._column=r,this._layer=n,this._source=i,this._readOnly=o,t._counter++,this._loadLegendData=this._loadLegendData.bind(this)}return Object.defineProperty(t.prototype,"globalExpression",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"column",{get:function(){return this._column},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columnPropName",{get:function(){return this._name+"_col"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readOnly",{get:function(){return this._readOnly},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layer",{get:function(){return this._layer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._source},enumerable:!0,configurable:!0}),t.prototype.on=function(t,e){this._emitter.on(t,e)},t.prototype.setLegendData=function(t){this._legendData=t.data},t.prototype.enableColorMapping=function(){this._mapColors=!0,this._layer.viz?this._loadLegendData():this._layer.on("loaded",this._loadLegendData)},t.prototype._filterChanged=function(){this._emitter.emit("filterChanged",this._name)},t.prototype._loadLegendData=function(){var t=this._layer.viz.color;t.getLegendData&&this.setLegendData(t.getLegendData(this._getLegendConfig()))},t.prototype._getLegendConfig=function(){},t._counter=0,t}();function j(t,e){return E(t.value,e.value,k)}function O(t,e){return E(t.value,e.value,P)}function E(t,e,r){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(r(t[n],e[n]))return!1;return!0}function k(t,e){return t.x[0]!==e.x[0]||t.x[1]!==e.x[1]||t.y!==e.y}function P(t,e){return t.x!==e.x||t.y!==e.y}function T(t){return t.value.map(function(t){return{end:t.x[1],start:t.x[0],value:t.y}})}function C(t,e){return t.value.map(function(t){return{category:t.x,color:z(t.x,e),end:void 0,start:void 0,value:t.y}})}function z(t,e){if(e){var r=e.find(function(e){return e.key===t});return r?function(t){return"string"==typeof t?t:a(t)}(r.value):void 0}}var S,H=function(t,e){return t.value.map(function(t){return{color:z(t.x,e),name:t.x,value:t.y}})},N=(S=function(t,e){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}S(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),D=function(t){function e(e,r,i,o,a,s,u,l){void 0===s&&(s=!0);var c=t.call(this,"category",o,r,a,s)||this;return c._selection=[],c._lastHistogram=null,c._button=null,c._widget=n(i),c._carto=e,c._button=n(u),c._expression=l,c._widget.disableInteractivity=s,c._widget.showClearButton=!s,c.selectionChanged=c.selectionChanged.bind(c),s||(c._widget.addEventListener("categoriesSelected",c.selectionChanged),c._button&&c._button.addEventListener&&c._button.addEventListener("click",function(){c._filterChanged()})),c}return N(e,t),e.prototype.setDataLayer=function(t){var e=this;this._dataLayer=t,this._dataLayer.on("updated",function(){var t=e._dataLayer.viz.variables[e.name];t&&(null!==e._lastHistogram&&O(e._lastHistogram,t)||(e._lastHistogram={value:t.value},e._widget.categories=H(t,e._legendData)))})},Object.defineProperty(e.prototype,"filter",{get:function(){return 0===this._selection.length?null:"@"+this.columnPropName+" in ["+this._selection.map(function(t){return"'"+t+"'"}).join(",")+"]"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expression",{get:function(){var t=this._carto.expressions;return t.viewportHistogram(this._expression?this._expression:t.prop(this._column))},enumerable:!0,configurable:!0}),e.prototype.selectionChanged=function(t){this._selection=t.detail,0!==this._selection.length&&this._button||this._filterChanged()},e}(L),R=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),A=function(t){function e(e,r,i,o,a,s,u,l,c){void 0===u&&(u=!0),void 0===l&&(l=!1),void 0===c&&(c=null);var p=t.call(this,"histogram_"+e,a,i,s,u)||this;return p._selection=null,p._inputExpression=null,p._totals=!1,p._widget=n(o),p._carto=r,p._totals=l,p._widget.disableInteractivity=u,p._widget.showClear=!u,p._inputExpression=c,p.selectionChanged=p.selectionChanged.bind(p),u||p._widget.addEventListener("selectionChanged",p.selectionChanged),p}return R(e,t),e.prototype.removeHistogramLayer=function(){this._layer.remove()},e.prototype.setDataLayer=function(t){this._dataLayer=t,this.bindDataLayer()},e.prototype._getLegendConfig=function(){return{samples:this._buckets}},e}(L),F=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),V=function(t){function e(e,r,n,i,o,a,s,u){void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===u&&(u=null);var l=t.call(this,"categorical",e,r,n,i,o,a,s,u)||this;return l._lastHistogram=null,l}return F(e,t),Object.defineProperty(e.prototype,"filter",{get:function(){return null===this._selection?null:"@"+this.columnPropName+" in ["+this._selection.map(function(t){return"'"+t+"'"}).join(",")+"]"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expression",{get:function(){var t=this._carto.expressions;return t.viewportHistogram(this._inputExpression?this._inputExpression:t.prop(this._column))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalExpression",{get:function(){if(!this._totals)return null;var t=this._carto.expressions;return t.globalHistogram(this._inputExpression?this._inputExpression:t.prop(this._column))},enumerable:!0,configurable:!0}),e.prototype.bindDataLayer=function(){var t=this;this._dataLayer.on("updated",function(){t._totals&&!t._globalHistogram&&(t._globalHistogram=t._dataLayer.viz.variables[t.name+"_global"],t._widget.backgroundData=C(t._globalHistogram));var e=t._dataLayer.viz.variables[t.name];if(e&&(null===t._lastHistogram||!O(t._lastHistogram,e)))if(t._lastHistogram={value:e.value},t._globalHistogram){var r=t._globalHistogram.value.map(function(t){var r=e.value.find(function(e){return e.x===t.x});return{x:t.x,y:r?r.y:0}});t._widget.data=C({value:r},t._legendData)}else t._widget.data=C(e,t._legendData)})},e.prototype.selectionChanged=function(t){if(null===t.detail)this._selection=null;else{var e=t.detail.selection;this._selection=e.map(function(t){return t})}this._filterChanged()},e}(A),$=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),M=function(t){function e(e,r,n,i,o,a,s,u,l,c){void 0===o&&(o=20),void 0===u&&(u=!0),void 0===l&&(l=!1),void 0===c&&(c=null);var p=t.call(this,"numerical",e,r,n,i,a,u,l,c)||this;return p._lastHistogram=null,p._buckets=void 0!==s?s.length:o,p._bucketRanges=s,p}return $(e,t),Object.defineProperty(e.prototype,"filter",{get:function(){return null===this._selection||this._isTimeSeries?null:"(@"+this.columnPropName+" >= "+this._selection[0]+" and @"+this.columnPropName+" < "+this._selection[1]+")"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expression",{get:function(){if(this._totals&&!this._globalHistogram)return null;var t=this._carto.expressions;return t.viewportHistogram(this._inputExpression?this._inputExpression:t.prop(this._column),this._bucketArg())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalExpression",{get:function(){if(!this._totals)return null;var t=this._carto.expressions;return t.globalHistogram(this._inputExpression?this._inputExpression:t.prop(this._column),this._bucketArg())},enumerable:!0,configurable:!0}),e.prototype.setTimeSeries=function(t){this._isTimeSeries=t},e.prototype.enableColorMapping=function(){throw new Error("Unsupported for numerical histograms")},e.prototype.setLegendData=function(){throw new Error("Unsupported for numerical histograms")},e.prototype.bindDataLayer=function(){var t=this;this._dataLayer.on("updated",function(){t._totals&&!t._globalHistogram&&(t._globalHistogram=t._dataLayer.viz.variables[t.name+"_global"],t._globalHistogram&&(t._bucketRanges=t._globalHistogram.value.map(function(t){return[t.x[0],t.x[1]]}),t._emitter.emit("expressionReady",{name:t.name,expression:t.expression})),t._widget.backgroundData=T(t._globalHistogram));var e=t._dataLayer.viz.variables[t.name];e&&(null===e.value||null!==t._lastHistogram&&j(t._lastHistogram,e)||(t._emitter.emit("rangeChanged",[e.value[0].x[0],e.value[e.value.length-1].x[1]]),t._lastHistogram={value:e.value},t._widget.data=T(e)))})},e.prototype.selectionChanged=function(t){if(null===t.detail)this._selection=null;else{var e=this._isTimeSeries?t.detail:t.detail.selection;this._selection=[Number(e[0]),Number(e[1])]}this._emitter.emit("rangeChanged",this._selection),this._filterChanged()},e.prototype._bucketArg=function(){return void 0!==this._bucketRanges?this._bucketRanges:this._buckets},e}(A),I=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),B=function(t){function e(e,r,i,o,a){var s=t.call(this,"global_range",o,r,a,!1)||this;return s._value=null,s._widget=n(i),s._carto=e,s._widget.addEventListener("change",function(t){s._value=t.detail,s._filterChanged()}),s}return I(e,t),e.prototype.setDataLayer=function(t){var e=this;this._dataLayer=t,this._dataLayer.on("updated",function(){var t=e._dataLayer.viz.variables[e.name];t&&!e._populated&&(e._widget.minValue=t.value[0],e._widget.maxValue=t.value[1],e._widget.range=t.value,e._populated=!0)})},Object.defineProperty(e.prototype,"filter",{get:function(){return null===this._value?null:"@"+this.columnPropName+" > "+this._value[0]+" and @"+this.columnPropName+" < "+this._value[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expression",{get:function(){var t=this._carto.expressions;return t.list([t.globalMin(t.prop(this._column)),t.globalMax(t.prop(this._column))])},enumerable:!0,configurable:!0}),e}(L),q=function(){function t(t,e,r,i,o,a,s,u){var l=this;void 0===a&&(a=10),void 0===s&&(s=[.15,.15]),void 0===u&&(u="animation"),this._timeSeries=n(i),this._layer=e,this._carto=t,this._columnName=r,this._duration=a,this._fade=s,this._variableName=u,e.viz?(this._onLayerLoaded(),o()):e.on("loaded",function(){l._onLayerLoaded(),o()})}return t.prototype.removeHistogramLayer=function(){this._dataLayer.remove()},t.prototype.setRange=function(t){if(this._animation&&this._animation.input&&this._animation.input.min&&this._animation.input.max)if(null===t)this._animation.input.min.blendTo(this._min,0),this._animation.input.max.blendTo(this._max,0),this._animation.duration.blendTo(this._duration,0);else if(t[0]!==t[1]){var e=Math.min(1,(t[1]-t[0])/(this._max.value-this._min.value));this._animation.input.min.blendTo(t[0],0),this._animation.input.max.blendTo(t[1],0),this._animation.duration.blendTo(this._duration*e,0)}},Object.defineProperty(t.prototype,"variableName",{get:function(){return this._variableName},enumerable:!0,configurable:!0}),t.prototype.setDuration=function(t){this._duration=t,this._animation.duration.blendTo(t,0)},Object.defineProperty(t.prototype,"animation",{get:function(){return this._animation},enumerable:!0,configurable:!0}),t.prototype._onLayerLoaded=function(){var t=this;this._viz=this._layer.viz,this._viz.variables[this._variableName]?this._animation=this._viz.variables[this._variableName]:(this._animation=this._createAnimation(),this._animation.parent=this._viz,this._animation.notify=this._viz._changed.bind(this._viz),this._viz.variables[this._variableName]=this._animation),this._max=this._animation.input.max,this._min=this._animation.input.min,this._duration=this._animation.duration.value,this._layer.on("updated",function(){t._timeSeries.progress=100*t._animation.getProgressPct(),t._timeSeries.playing=t._animation.isPlaying()}),this._timeSeries.animated=!0,this._timeSeries.addEventListener("seek",function(e){t._animation.setProgressPct(e.detail/100),t._timeSeries.progress=e.detail}),this._timeSeries.addEventListener("play",function(){t._animation.play()}),this._timeSeries.addEventListener("pause",function(){t._animation.pause()})},t.prototype._createAnimation=function(){var t=this._carto.expressions;return t.animation(t.linear(t.prop(this._columnName),t.globalMin(t.prop(this._columnName)),t.globalMax(t.prop(this._columnName))),this._duration,t.fade(this._fade[0],this._fade[1]))},t}(),U="^1.2.3",X=function(){function t(t){var e=t.carto,r=t.map,n=t.layer,i=t.source;if(this._vizFilters=[],this._carto=e,this._map=r,this._layer=n,this._source=i,this._id=this._layer.id,this._rebuildFilters=this._rebuildFilters.bind(this),this._updateDataLayerVariables=this._updateDataLayerVariables.bind(this),!this._carto.expressions.globalHistogram)throw new Error("Provided VL version "+this._carto.version+" lacks globalHistogram support.");if(!w.a.satisfies(this._carto.version,U))throw new Error("Provided VL version "+this._carto.version+" not supported. Must satisfy "+U)}return t.prototype.numericalHistogram=function(t,e,r){void 0===r&&(r={});var n=r.buckets,a=r.bucketRanges,s=r.readOnly,u=r.totals,l=i(e),c=o(e),p=new M(this._carto,this._layer,t,l,n,this._source,a,s,u,c);return this._addFilter(p),p},t.prototype.categoricalHistogram=function(t,e,r){void 0===r&&(r={});var n=r.readOnly,a=r.totals,s=i(e),u=o(e),l=new V(this._carto,this._layer,t,s,this._source,n,a,u);return this._addFilter(l),l},t.prototype.histogram=function(t,e,r){void 0===r&&(r={});var n=r.buckets,i=r.bucketRanges,o=r.readOnly,a=r.totals;if(void 0===n&&void 0===i){var s=t;return this.categoricalHistogram(s,e,{readOnly:o,totals:a})}return this.numericalHistogram(t,e,{readOnly:o,buckets:n,bucketRanges:i,totals:a})},t.prototype.category=function(t,e,r){void 0===r&&(r={});var n=r.readOnly,a=r.button,s=i(e),u=o(e),l=new D(this._carto,this._layer,t,s,this._source,n,a,u);return this._addFilter(l),l},t.prototype.timeSeries=function(t,e,r){var n=this;if(void 0===r&&(r={}),this._animation)throw new Error("There can only be one animation");var i=r.buckets,o=r.bucketRanges,a=r.readOnly,s=r.totals,u=r.duration,l=r.fade,c=r.variableName;this._animation=new q(this._carto,this._layer,e,t,function(){n._rebuildFilters()},u,l,c);var p=this.numericalHistogram(t,e,{bucketRanges:o,buckets:i,readOnly:a,totals:s});return p.setTimeSeries(!0),p.on("rangeChanged",function(t){n._animation.setRange(t)}),this._animation},t.prototype.globalRange=function(t,e){var r=new B(this._carto,this._layer,t,e,this._source);return this._addFilter(r),r},t.prototype.build=function(){var t=this;if(0!==this._vizFilters.length){var e=function(){t._appendVariables(),t._buildDataLayer()};this._layer.viz?e():this._layer.on("loaded",e)}},t.prototype._addFilter=function(t){t.on("filterChanged",this._rebuildFilters),t.on("expressionReady",this._updateDataLayerVariables),this._vizFilters.push(t)},t.prototype._appendVariables=function(){var t=this,e=this._carto.expressions;this._vizFilters.forEach(function(r){return t._layer.viz.variables[r.columnPropName]=e.prop(r.column)})},t.prototype._buildDataLayer=function(){var t=this,e=this._getVariables(),r=this._carto.expressions,n=new this._carto.Viz({color:r.rgba(0,0,0,0),strokeWidth:0,variables:e});this._readOnlyLayer=new this._carto.Layer("asbind_ro_"+this._id,this._source,n),this._readOnlyLayer.addTo(this._map),this._vizFilters.forEach(function(e){return e.setDataLayer(t._readOnlyLayer)})},t.prototype._getVariables=function(){for(var t=void 0!==this._readOnlyLayer?this._readOnlyLayer.viz.variables:{},e=0,r=this._vizFilters;e<r.length;e++){var n=r[e],i=n.name;n.globalExpression&&(t[i+"_global"]=n.globalExpression),n.expression&&(t[i]=n.expression),t[n.columnPropName]=this._carto.expressions.prop(n.column)}return t},t.prototype._updateDataLayerVariables=function(t){this._readOnlyLayer.viz&&(this._readOnlyLayer.viz.variables[t.name]=t.expression)},t.prototype._rebuildFilters=function(){var t=this._combineFilters(this._vizFilters.filter(function(t){return null!==t.filter}).map(function(t){return t.filter}));this._readOnlyLayer&&this._readOnlyLayer.viz.filter.blendTo(t,0),this._animation&&(t="@"+this._animation.variableName+" and "+t),this._layer.viz.filter.blendTo(t,0)},t.prototype._combineFilters=function(t){return 0===t.length?"1":t.join(" and ")},t}();r.d(e,"VL",function(){return G}),r.d(e,"VLBridge",function(){return X});var G={Bridge:X,Legends:y}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AsBridge=e():t.AsBridge=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=2)}([function(t,e,r){(function(r){var n;e=t.exports=X,n="object"==typeof r&&r.env&&r.env.NODE_DEBUG&&/\bsemver\b/i.test(r.env.NODE_DEBUG)?function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("SEMVER"),console.log.apply(console,t)}:function(){},e.SEMVER_SPEC_VERSION="2.0.0";var i=256,o=Number.MAX_SAFE_INTEGER||9007199254740991,a=e.re=[],s=e.src=[],u=0,l=u++;s[l]="0|[1-9]\\d*";var c=u++;s[c]="[0-9]+";var p=u++;s[p]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var h=u++;s[h]="("+s[l]+")\\.("+s[l]+")\\.("+s[l]+")";var f=u++;s[f]="("+s[c]+")\\.("+s[c]+")\\.("+s[c]+")";var m=u++;s[m]="(?:"+s[l]+"|"+s[p]+")";var _=u++;s[_]="(?:"+s[c]+"|"+s[p]+")";var d=u++;s[d]="(?:-("+s[m]+"(?:\\."+s[m]+")*))";var v=u++;s[v]="(?:-?("+s[_]+"(?:\\."+s[_]+")*))";var g=u++;s[g]="[0-9A-Za-z-]+";var y=u++;s[y]="(?:\\+("+s[g]+"(?:\\."+s[g]+")*))";var b=u++,w="v?"+s[h]+s[d]+"?"+s[y]+"?";s[b]="^"+w+"$";var x="[v=\\s]*"+s[f]+s[v]+"?"+s[y]+"?",L=u++;s[L]="^"+x+"$";var O=u++;s[O]="((?:<|>)?=?)";var j=u++;s[j]=s[c]+"|x|X|\\*";var E=u++;s[E]=s[l]+"|x|X|\\*";var N=u++;s[N]="[v=\\s]*("+s[E]+")(?:\\.("+s[E]+")(?:\\.("+s[E]+")(?:"+s[d]+")?"+s[y]+"?)?)?";var P=u++;s[P]="[v=\\s]*("+s[j]+")(?:\\.("+s[j]+")(?:\\.("+s[j]+")(?:"+s[v]+")?"+s[y]+"?)?)?";var z=u++;s[z]="^"+s[O]+"\\s*"+s[N]+"$";var T=u++;s[T]="^"+s[O]+"\\s*"+s[P]+"$";var k=u++;s[k]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var D=u++;s[D]="(?:~>?)";var C=u++;s[C]="(\\s*)"+s[D]+"\\s+",a[C]=new RegExp(s[C],"g");var S=u++;s[S]="^"+s[D]+s[N]+"$";var H=u++;s[H]="^"+s[D]+s[P]+"$";var A=u++;s[A]="(?:\\^)";var R=u++;s[R]="(\\s*)"+s[A]+"\\s+",a[R]=new RegExp(s[R],"g");var V=u++;s[V]="^"+s[A]+s[N]+"$";var F=u++;s[F]="^"+s[A]+s[P]+"$";var W=u++;s[W]="^"+s[O]+"\\s*("+x+")$|^$";var $=u++;s[$]="^"+s[O]+"\\s*("+w+")$|^$";var M=u++;s[M]="(\\s*)"+s[O]+"\\s*("+x+"|"+s[N]+")",a[M]=new RegExp(s[M],"g");var I=u++;s[I]="^\\s*("+s[N]+")\\s+-\\s+("+s[N]+")\\s*$";var B=u++;s[B]="^\\s*("+s[P]+")\\s+-\\s+("+s[P]+")\\s*$";var q=u++;s[q]="(<|>)?=?\\s*\\*";for(var U=0;U<35;U++)n(U,s[U]),a[U]||(a[U]=new RegExp(s[U]));function Z(t,e){if(t instanceof X)return t;if("string"!=typeof t)return null;if(t.length>i)return null;if(!(e?a[L]:a[b]).test(t))return null;try{return new X(t,e)}catch(t){return null}}function X(t,e){if(t instanceof X){if(t.loose===e)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>i)throw new TypeError("version is longer than "+i+" characters");if(!(this instanceof X))return new X(t,e);n("SemVer",t,e),this.loose=e;var r=t.trim().match(e?a[L]:a[b]);if(!r)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e<o)return e}return t})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}e.parse=Z,e.valid=function(t,e){var r=Z(t,e);return r?r.version:null},e.clean=function(t,e){var r=Z(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null},e.SemVer=X,X.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},X.prototype.toString=function(){return this.version},X.prototype.compare=function(t){return n("SemVer.compare",this.version,this.loose,t),t instanceof X||(t=new X(t,this.loose)),this.compareMain(t)||this.comparePre(t)},X.prototype.compareMain=function(t){return t instanceof X||(t=new X(t,this.loose)),J(this.major,t.major)||J(this.minor,t.minor)||J(this.patch,t.patch)},X.prototype.comparePre=function(t){if(t instanceof X||(t=new X(t,this.loose)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;var e=0;do{var r=this.prerelease[e],i=t.prerelease[e];if(n("prerelease compare",e,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return J(r,i)}while(++e)},X.prototype.inc=function(t,e){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e);break;case"prepatch":this.prerelease.length=0,this.inc("patch",e),this.inc("pre",e);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",e),this.inc("pre",e);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+t)}return this.format(),this.raw=this.version,this},e.inc=function(t,e,r,n){"string"==typeof r&&(n=r,r=void 0);try{return new X(t,r).inc(e,n).version}catch(t){return null}},e.diff=function(t,e){if(tt(t,e))return null;var r=Z(t),n=Z(e);if(r.prerelease.length||n.prerelease.length){for(var i in r)if(("major"===i||"minor"===i||"patch"===i)&&r[i]!==n[i])return"pre"+i;return"prerelease"}for(var i in r)if(("major"===i||"minor"===i||"patch"===i)&&r[i]!==n[i])return i},e.compareIdentifiers=J;var G=/^[0-9]+$/;function J(t,e){var r=G.test(t),n=G.test(e);return r&&n&&(t=+t,e=+e),r&&!n?-1:n&&!r?1:t<e?-1:t>e?1:0}function K(t,e,r){return new X(t,r).compare(new X(e,r))}function Q(t,e,r){return K(t,e,r)>0}function Y(t,e,r){return K(t,e,r)<0}function tt(t,e,r){return 0===K(t,e,r)}function et(t,e,r){return 0!==K(t,e,r)}function rt(t,e,r){return K(t,e,r)>=0}function nt(t,e,r){return K(t,e,r)<=0}function it(t,e,r,n){var i;switch(e){case"===":"object"==typeof t&&(t=t.version),"object"==typeof r&&(r=r.version),i=t===r;break;case"!==":"object"==typeof t&&(t=t.version),"object"==typeof r&&(r=r.version),i=t!==r;break;case"":case"=":case"==":i=tt(t,r,n);break;case"!=":i=et(t,r,n);break;case">":i=Q(t,r,n);break;case">=":i=rt(t,r,n);break;case"<":i=Y(t,r,n);break;case"<=":i=nt(t,r,n);break;default:throw new TypeError("Invalid operator: "+e)}return i}function ot(t,e){if(t instanceof ot){if(t.loose===e)return t;t=t.value}if(!(this instanceof ot))return new ot(t,e);n("comparator",t,e),this.loose=e,this.parse(t),this.semver===at?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}e.rcompareIdentifiers=function(t,e){return J(e,t)},e.major=function(t,e){return new X(t,e).major},e.minor=function(t,e){return new X(t,e).minor},e.patch=function(t,e){return new X(t,e).patch},e.compare=K,e.compareLoose=function(t,e){return K(t,e,!0)},e.rcompare=function(t,e,r){return K(e,t,r)},e.sort=function(t,r){return t.sort((function(t,n){return e.compare(t,n,r)}))},e.rsort=function(t,r){return t.sort((function(t,n){return e.rcompare(t,n,r)}))},e.gt=Q,e.lt=Y,e.eq=tt,e.neq=et,e.gte=rt,e.lte=nt,e.cmp=it,e.Comparator=ot;var at={};function st(t,e){if(t instanceof st)return t.loose===e?t:new st(t.raw,e);if(t instanceof ot)return new st(t.value,e);if(!(this instanceof st))return new st(t,e);if(this.loose=e,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map((function(t){return this.parseRange(t.trim())}),this).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}function ut(t){return!t||"x"===t.toLowerCase()||"*"===t}function lt(t,e,r,n,i,o,a,s,u,l,c,p,h){return((e=ut(r)?"":ut(n)?">="+r+".0.0":ut(i)?">="+r+"."+n+".0":">="+e)+" "+(s=ut(u)?"":ut(l)?"<"+(+u+1)+".0.0":ut(c)?"<"+u+"."+(+l+1)+".0":p?"<="+u+"."+l+"."+c+"-"+p:"<="+s)).trim()}function ct(t,e){for(var r=0;r<t.length;r++)if(!t[r].test(e))return!1;if(e.prerelease.length){for(r=0;r<t.length;r++)if(n(t[r].semver),t[r].semver!==at&&t[r].semver.prerelease.length>0){var i=t[r].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}function pt(t,e,r){try{e=new st(e,r)}catch(t){return!1}return e.test(t)}function ht(t,e,r,n){var i,o,a,s,u;switch(t=new X(t,n),e=new st(e,n),r){case">":i=Q,o=nt,a=Y,s=">",u=">=";break;case"<":i=Y,o=rt,a=Q,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(pt(t,e,n))return!1;for(var l=0;l<e.set.length;++l){var c=e.set[l],p=null,h=null;if(c.forEach((function(t){t.semver===at&&(t=new ot(">=0.0.0")),p=p||t,h=h||t,i(t.semver,p.semver,n)?p=t:a(t.semver,h.semver,n)&&(h=t)})),p.operator===s||p.operator===u)return!1;if((!h.operator||h.operator===s)&&o(t,h.semver))return!1;if(h.operator===u&&a(t,h.semver))return!1}return!0}ot.prototype.parse=function(t){var e=this.loose?a[W]:a[$],r=t.match(e);if(!r)throw new TypeError("Invalid comparator: "+t);this.operator=r[1],"="===this.operator&&(this.operator=""),r[2]?this.semver=new X(r[2],this.loose):this.semver=at},ot.prototype.toString=function(){return this.value},ot.prototype.test=function(t){return n("Comparator.test",t,this.loose),this.semver===at||("string"==typeof t&&(t=new X(t,this.loose)),it(t,this.operator,this.semver,this.loose))},ot.prototype.intersects=function(t,e){if(!(t instanceof ot))throw new TypeError("a Comparator is required");var r;if(""===this.operator)return r=new st(t.value,e),pt(this.value,r,e);if(""===t.operator)return r=new st(this.value,e),pt(t.semver,r,e);var n=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),o=this.semver.version===t.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),s=it(this.semver,"<",t.semver,e)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),u=it(this.semver,">",t.semver,e)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return n||i||o&&a||s||u},e.Range=st,st.prototype.format=function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range},st.prototype.toString=function(){return this.range},st.prototype.parseRange=function(t){var e=this.loose;t=t.trim(),n("range",t,e);var r=e?a[B]:a[I];t=t.replace(r,lt),n("hyphen replace",t),t=t.replace(a[M],"$1$2$3"),n("comparator trim",t,a[M]),t=(t=(t=t.replace(a[C],"$1~")).replace(a[R],"$1^")).split(/\s+/).join(" ");var i=e?a[W]:a[$],o=t.split(" ").map((function(t){return function(t,e){return n("comp",t),t=function(t,e){return t.trim().split(/\s+/).map((function(t){return function(t,e){n("caret",t,e);var r=e?a[F]:a[V];return t.replace(r,(function(e,r,i,o,a){var s;return n("caret",t,e,r,i,o,a),ut(r)?s="":ut(i)?s=">="+r+".0.0 <"+(+r+1)+".0.0":ut(o)?s="0"===r?">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":">="+r+"."+i+".0 <"+(+r+1)+".0.0":a?(n("replaceCaret pr",a),"-"!==a.charAt(0)&&(a="-"+a),s="0"===r?"0"===i?">="+r+"."+i+"."+o+a+" <"+r+"."+i+"."+(+o+1):">="+r+"."+i+"."+o+a+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+o+a+" <"+(+r+1)+".0.0"):(n("no pr"),s="0"===r?"0"===i?">="+r+"."+i+"."+o+" <"+r+"."+i+"."+(+o+1):">="+r+"."+i+"."+o+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+o+" <"+(+r+1)+".0.0"),n("caret return",s),s}))}(t,e)})).join(" ")}(t,e),n("caret",t),t=function(t,e){return t.trim().split(/\s+/).map((function(t){return function(t,e){var r=e?a[H]:a[S];return t.replace(r,(function(e,r,i,o,a){var s;return n("tilde",t,e,r,i,o,a),ut(r)?s="":ut(i)?s=">="+r+".0.0 <"+(+r+1)+".0.0":ut(o)?s=">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":a?(n("replaceTilde pr",a),"-"!==a.charAt(0)&&(a="-"+a),s=">="+r+"."+i+"."+o+a+" <"+r+"."+(+i+1)+".0"):s=">="+r+"."+i+"."+o+" <"+r+"."+(+i+1)+".0",n("tilde return",s),s}))}(t,e)})).join(" ")}(t,e),n("tildes",t),t=function(t,e){return n("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return function(t,e){t=t.trim();var r=e?a[T]:a[z];return t.replace(r,(function(e,r,i,o,a,s){n("xRange",t,e,r,i,o,a,s);var u=ut(i),l=u||ut(o),c=l||ut(a);return"="===r&&c&&(r=""),u?e=">"===r||"<"===r?"<0.0.0":"*":r&&c?(l&&(o=0),c&&(a=0),">"===r?(r=">=",l?(i=+i+1,o=0,a=0):c&&(o=+o+1,a=0)):"<="===r&&(r="<",l?i=+i+1:o=+o+1),e=r+i+"."+o+"."+a):l?e=">="+i+".0.0 <"+(+i+1)+".0.0":c&&(e=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0"),n("xRange return",e),e}))}(t,e)})).join(" ")}(t,e),n("xrange",t),t=function(t,e){return n("replaceStars",t,e),t.trim().replace(a[q],"")}(t,e),n("stars",t),t}(t,e)})).join(" ").split(/\s+/);return this.loose&&(o=o.filter((function(t){return!!t.match(i)}))),o=o.map((function(t){return new ot(t,e)}))},st.prototype.intersects=function(t,e){if(!(t instanceof st))throw new TypeError("a Range is required");return this.set.some((function(r){return r.every((function(r){return t.set.some((function(t){return t.every((function(t){return r.intersects(t,e)}))}))}))}))},e.toComparators=function(t,e){return new st(t,e).set.map((function(t){return t.map((function(t){return t.value})).join(" ").trim().split(" ")}))},st.prototype.test=function(t){if(!t)return!1;"string"==typeof t&&(t=new X(t,this.loose));for(var e=0;e<this.set.length;e++)if(ct(this.set[e],t))return!0;return!1},e.satisfies=pt,e.maxSatisfying=function(t,e,r){var n=null,i=null;try{var o=new st(e,r)}catch(t){return null}return t.forEach((function(t){o.test(t)&&(n&&-1!==i.compare(t)||(i=new X(n=t,r)))})),n},e.minSatisfying=function(t,e,r){var n=null,i=null;try{var o=new st(e,r)}catch(t){return null}return t.forEach((function(t){o.test(t)&&(n&&1!==i.compare(t)||(i=new X(n=t,r)))})),n},e.validRange=function(t,e){try{return new st(t,e).range||"*"}catch(t){return null}},e.ltr=function(t,e,r){return ht(t,e,"<",r)},e.gtr=function(t,e,r){return ht(t,e,">",r)},e.outside=ht,e.prerelease=function(t,e){var r=Z(t,e);return r&&r.prerelease.length?r.prerelease:null},e.intersects=function(t,e,r){return t=new st(t,r),e=new st(e,r),t.intersects(e)},e.coerce=function(t){if(t instanceof X)return t;if("string"!=typeof t)return null;var e=t.match(a[k]);return null==e?null:Z((e[1]||"0")+"."+(e[2]||"0")+"."+(e[3]||"0"))}}).call(this,r(1))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,l=[],c=!1,p=-1;function h(){c&&u&&(c=!1,u.length?l=u.concat(l):p=-1,l.length&&f())}function f(){if(!c){var t=s(h);c=!0;for(var e=l.length;e;){for(u=l,l=[];++p<e;)u&&u[p].run();p=-1,e=l.length}u=null,c=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function m(t,e){this.fun=t,this.array=e}function _(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];l.push(new m(t,e)),1!==l.length||c||s(f)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=_,i.addListener=_,i.once=_,i.off=_,i.removeListener=_,i.removeAllListeners=_,i.emit=_,i.prependListener=_,i.prependOnceListener=_,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){"use strict";function n(t){return"string"==typeof t?document.querySelector(t):t}function i(t){return"string"==typeof t?t:t.propertyName}function o(t){return"string"==typeof t?null:t}function a(t){return"#"+u(t.r)+u(t.g)+u(t.b)+u(Math.floor(255*t.a))}function s(t){return"rgba("+t.r+","+t.g+","+t.b+","+t.a+")"}function u(t){return isNaN(t)||void 0===t?"":t.toString(16).padStart(2,"0").toUpperCase()}function l(t,e,r){void 0===r&&(r=!1),r&&t.on("updated",(function(){e(!1)})),t.viz?e(!0):t.on("loaded",(function(){e(!0)}))}r.r(e);var c=function(){return(c=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},p=16,h="#000";function f(t){var e=t.getLegendData(),r=Math.floor(e.data.length/2);return e.data[r].value}function m(t,e){var r=t[e];return"ramp"===r.expressionName||"opacity"===r.expressionName?s(f(r)):"color"===r.type?s(r.value):h}function _(t,e,r){var n=t[e];return"ramp"===n.expressionName?r||f(n):"number"===n.type?n.value:r}function d(t,e){void 0===e&&(e=null);var r=e&&t.variables[e]?t.variables[e]:t.symbol;return"ramp"===r.expressionName?f(r):r.value}function v(t){var e=t.layer,r=t.props,n=e.viz;return n?c({color:m(n,"color"),label:r.label,marker:n.symbol.default?void 0:d(n),strokeColor:m(n,"strokeColor"),strokeStyle:0===_(n,"strokeWidth")?"hidden":void 0,type:e.metadata.geomType,width:_(n,"width",p)},r):{}}function g(t){return t.props?t:{layer:t,props:{label:t.id}}}var y=function(){function t(){}return t.layersLegend=function(t,e,r){void 0===r&&(r={}),t=n(t);var i=e.map(g);i.forEach((function(e,n,o){l(e.layer,(function(){var e=i.map(v);r.format&&(e.label=r.format(e.label,n,o)),t.data=e,r.onLoad&&setTimeout(r.onLoad,0)}),r.dynamic)}))},t.rampLegend=function(t,e,r,i){void 0===i&&(i={}),t=n(t);var o=g(e);l(o.layer,(function(){var e=v(o),n=o.layer.viz[r],s=i.config,u=i.config.variable||r,l=o.layer.viz.variables[u]?o.layer.viz.variables[u]:o.layer.viz[u],p=l.getLegendData(s).data,h=p.map((function(t,o,s){var u,p,h,f,m;return c({},e,((u={})[r]=function(t,e){return"color"===t.type?a(e):e}(n,t.value),u.label=i.format?i.format(t.key,o,s):(p=l.key,Array.isArray(p)?(f=(h=p)[0],m=h[1],f===-1/0?"< "+m.toFixed(2):m===1/0?"> "+f.toFixed(2):f.toFixed(2)+" - "+m.toFixed(2)):p.toFixed?p.toFixed(2):p),u))}));Array.isArray(o.props)&&o.props.length===p.length?t.data=h.map((function(t,e){return c({},t,o.props[e])})):t.data=h,i.onLoad&&setTimeout(i.onLoad,0)}),i.dynamic)},t}(),b=r(0),w=r.n(b),x=function(){function t(t,e,r,i,o,a,s,u,l,c){var p=this;void 0===a&&(a=10),void 0===s&&(s=[.15,.15]),this._animationWidget=n(t),this._column=r,this._variableName=i||"animation",this._propertyName=o||"filter",this._carto=e,this._duration=a,this._fade=s,this._animationWidget.playing=!1,this._animationWidget.isLoading=!0,this._layer=u,this._formatCb=c,u.viz?(this._onLayerLoaded(),l()):u.on("loaded",(function(){p._onLayerLoaded(),l()}))}return Object.defineProperty(t.prototype,"animation",{get:function(){return this._animation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"variableName",{get:function(){return this._variableName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"propertyName",{get:function(){return this._propertyName},set:function(t){this._propertyName=t},enumerable:!0,configurable:!0}),t.prototype.setRange=function(){},t.prototype._onLayerLoaded=function(){var t=this;this._viz=this._layer.viz;var e=this._getAnimationExpression();e.a&&e.b?this._animation="animation"===e.a.expressionName?e.a:e.b:this._animation=e,this._viz[this._propertyName].blendTo(e,0),this._animation.parent=this._viz,this._animation.notify=this._viz._changed.bind(this._viz),this._animationWidget.duration=this._animation.duration.value,this._animationWidget.playing=!0,this._animationWidget.isLoading=!1,this._animationWidget.addEventListener("play",(function(){t._animation.play()})),this._animationWidget.addEventListener("pause",(function(){t._animation.pause()})),this._animationWidget.addEventListener("seek",(function(e){t._animation.setProgressPct(e.detail[0]/100),t._animation.notify(),t._animationWidget.progressValue=t._formatProgressValue()})),this._layer.on("updated",(function(){t._animationWidget.progress=100*t._animation.getProgressPct(),t._animationWidget.progressValue=t._formatProgressValue()}))},t.prototype._getAnimationExpression=function(){return this._variableName&&this._viz.variables[this._variableName]?this._viz.variables[this._variableName]:(this._viz.variables[this._variableName]=this._propertyName&&this._viz[this._propertyName].isAnimated()?this._viz[this._propertyName]:this._createDefaultAnimation(),this._viz.variables[this._variableName])},t.prototype._formatProgressValue=function(){var t=this._animation.getProgressValue();return t instanceof Date?this._formatCb?this._formatCb(t):t.toISOString():t instanceof Object&&this._isVLTimeZoneDate(t)?this._formatCb?this._formatCb(t._date):t._date.toISOString():this._formatCb?this._formatCb(t):t},t.prototype._isVLTimeZoneDate=function(t){return"_date"in t},t.prototype._createDefaultAnimation=function(){var t=this._carto.expressions;return t.animation(t.linear(t.prop(this._column),t.globalMin(t.prop(this._column)),t.globalMax(t.prop(this._column))),this._duration,t.fade(this._fade[0],this._fade[1]))},t}();var L=function(t){return t=t||Object.create(null),{on:function(e,r){(t[e]||(t[e]=[])).push(r)},off:function(e,r){t[e]&&t[e].splice(t[e].indexOf(r)>>>0,1)},emit:function(e,r){(t[e]||[]).slice().map((function(t){t(r)})),(t["*"]||[]).slice().map((function(t){t(e,r)}))}}},O=function(){function t(e,r,n,i,o){void 0===o&&(o=!0),this._emitter=new L,this._name="asbind_"+e+"_"+r+"_"+t._counter,this._column=r,this._layer=n,this._source=i,this._readOnly=o,t._counter++,this._loadLegendData=this._loadLegendData.bind(this)}return Object.defineProperty(t.prototype,"globalExpression",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"column",{get:function(){return this._column},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columnPropName",{get:function(){return this._name+"_col"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readOnly",{get:function(){return this._readOnly},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layer",{get:function(){return this._layer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._source},enumerable:!0,configurable:!0}),t.prototype.on=function(t,e){this._emitter.on(t,e)},t.prototype.setLegendData=function(t){this._legendData=t.data},t.prototype.enableColorMapping=function(){this._mapColors=!0,this._layer.viz?this._loadLegendData():this._layer.on("loaded",this._loadLegendData)},t.prototype._filterChanged=function(){this._emitter.emit("filterChanged",this._name)},t.prototype._loadLegendData=function(){var t=this._layer.viz.color;t.getLegendData&&this.setLegendData(t.getLegendData(this._getLegendConfig()))},t.prototype._getLegendConfig=function(){},t._counter=0,t}();function j(t,e){return N(t.value,e.value,P)}function E(t,e){return N(t.value,e.value,z)}function N(t,e,r){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(r(t[n],e[n]))return!1;return!0}function P(t,e){return t.x[0]!==e.x[0]||t.x[1]!==e.x[1]||t.y!==e.y}function z(t,e){return t.x!==e.x||t.y!==e.y}function T(t){return t.value.map((function(t){return{end:t.x[1],start:t.x[0],value:t.y}}))}function k(t){return t.value.map((function(t){return{end:new Date(t.x[1]),start:new Date(t.x[0]),value:t.y}}))}function D(t,e){return t.value.map((function(t){return{category:t.x,color:C(t.x,e),end:void 0,start:void 0,value:t.y}}))}function C(t,e){if(e){var r=e.find((function(e){return e.key===t}));return r?function(t){return"string"==typeof t?t:a(t)}(r.value):void 0}}var S,H=function(t,e){return t.value.map((function(t){return{color:C(t.x,e),name:t.x,value:t.y}}))},A=(S=function(t,e){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}S(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),R=function(t){function e(e,r,i,o,a,s,u,l){void 0===s&&(s=!0);var c=t.call(this,"category",o,r,a,s)||this;return c._selection=[],c._lastHistogram=null,c._button=null,c._widget=n(i),c._carto=e,c._button=n(u),c._expression=l,c._widget.disableInteractivity=s,c._widget.showClearButton=!s,c.selectionChanged=c.selectionChanged.bind(c),s||(c._widget.addEventListener("categoriesSelected",c.selectionChanged),c._button&&c._button.addEventListener&&c._button.addEventListener("click",(function(){c._filterChanged()}))),c}return A(e,t),e.prototype.setDataLayer=function(t){var e=this;this._dataLayer=t,this._dataLayer.on("updated",(function(){var t=e._dataLayer.viz.variables[e.name];t&&(null!==e._lastHistogram&&E(e._lastHistogram,t)||(e._lastHistogram={value:t.value},e._widget.categories=H(t,e._legendData)))}))},Object.defineProperty(e.prototype,"filter",{get:function(){return 0===this._selection.length?null:"@"+this.columnPropName+" in ["+this._selection.map((function(t){return"'"+t+"'"})).join(",")+"]"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expression",{get:function(){var t=this._carto.expressions;return t.viewportHistogram(this._expression?this._expression:t.prop(this._column))},enumerable:!0,configurable:!0}),e.prototype.selectionChanged=function(t){this._selection=t.detail,0!==this._selection.length&&this._button||this._filterChanged()},e}(O),V=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),F=function(t){function e(e,r,i,o,a,s,u,l,c){void 0===u&&(u=!0),void 0===l&&(l=!1),void 0===c&&(c=null);var p=t.call(this,"histogram_"+e,a,i,s,u)||this;return p._selection=null,p._inputExpression=null,p._totals=!1,p._widget=n(o),p._carto=r,p._totals=l,p._widget.disableInteractivity=u,p._widget.showClear=!u,p._inputExpression=c,p.selectionChanged=p.selectionChanged.bind(p),u||p._widget.addEventListener("selectionChanged",p.selectionChanged),p}return V(e,t),e.prototype.removeHistogramLayer=function(){this._layer.remove()},e.prototype.setDataLayer=function(t){this._dataLayer=t,this.bindDataLayer()},e.prototype._getLegendConfig=function(){return{samples:this._buckets}},e}(O),W=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$=function(t){function e(e,r,n,i,o,a,s,u){void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===u&&(u=null);var l=t.call(this,"categorical",e,r,n,i,o,a,s,u)||this;return l._lastHistogram=null,l}return W(e,t),Object.defineProperty(e.prototype,"filter",{get:function(){return null===this._selection?null:"@"+this.columnPropName+" in ["+this._selection.map((function(t){return"'"+t+"'"})).join(",")+"]"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expression",{get:function(){var t=this._carto.expressions;return t.viewportHistogram(this._inputExpression?this._inputExpression:t.prop(this._column))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalExpression",{get:function(){if(!this._totals)return null;var t=this._carto.expressions;return t.globalHistogram(this._inputExpression?this._inputExpression:t.prop(this._column))},enumerable:!0,configurable:!0}),e.prototype.bindDataLayer=function(){var t=this;this._dataLayer.on("updated",(function(){t._totals&&!t._globalHistogram&&(t._globalHistogram=t._dataLayer.viz.variables[t.name+"_global"],t._widget.backgroundData=D(t._globalHistogram));var e=t._dataLayer.viz.variables[t.name];if(e&&(null===t._lastHistogram||!E(t._lastHistogram,e)))if(t._lastHistogram={value:e.value},t._globalHistogram){var r=t._globalHistogram.value.map((function(t){var r=e.value.find((function(e){return e.x===t.x}));return{x:t.x,y:r?r.y:0}}));t._widget.data=D({value:r},t._legendData)}else t._widget.data=D(e,t._legendData)}))},e.prototype.selectionChanged=function(t){if(null===t.detail)this._selection=null;else{var e=t.detail.selection;this._selection=e.map((function(t){return t}))}this._filterChanged()},e}(F),M=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),I=function(t){function e(e,r,n,i,o,a,s,u,l,c){void 0===o&&(o=20),void 0===u&&(u=!0),void 0===l&&(l=!1),void 0===c&&(c=null);var p=t.call(this,"numerical",e,r,n,i,a,u,l,c)||this;return p._lastHistogram=null,p._buckets=void 0!==s?s.length:o,p._bucketRanges=s,p}return M(e,t),Object.defineProperty(e.prototype,"filter",{get:function(){if(null===this._selection||this._isTimeSeries)return null;var t=this._selection[0],e=this._selection[1],r=t instanceof Date?"date('"+t.toISOString()+"')":t,n=e instanceof Date?"date('"+e.toISOString()+"')":e;return"(@"+this.columnPropName+" >= "+r+" and @"+this.columnPropName+" < "+n+")"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expression",{get:function(){if(this._totals&&!this._globalHistogram)return null;var t=this._carto.expressions;return t.viewportHistogram(this._inputExpression?this._inputExpression:t.prop(this._column),this._bucketArg())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalExpression",{get:function(){if(!this._totals)return null;var t=this._carto.expressions;return t.globalHistogram(this._inputExpression?this._inputExpression:t.prop(this._column),this._bucketArg())},enumerable:!0,configurable:!0}),e.prototype.setTimeSeries=function(t){this._isTimeSeries=t},e.prototype.enableColorMapping=function(){throw new Error("Unsupported for numerical histograms")},e.prototype.setLegendData=function(){throw new Error("Unsupported for numerical histograms")},e.prototype.bindDataLayer=function(){var t=this;this._dataLayer.on("updated",(function(){if(t._totals&&!t._globalHistogram&&(t._globalHistogram=t._dataLayer.viz.variables[t.name+"_global"],t._globalHistogram)){var e=t._globalHistogram.input.type;t._bucketRanges=t._globalHistogram.value.map((function(t){return[t.x[0],t.x[1]]})),t._emitter.emit("expressionReady",{name:t.name,expression:t.expression}),t._widget.backgroundData="number"===e?T(t._globalHistogram):k(t._globalHistogram)}var r=t._dataLayer.viz.variables[t.name];if(r&&null!==r.value&&(null===t._lastHistogram||!j(t._lastHistogram,r))){e=r.input.type;t._emitter.emit("rangeChanged",[r.value[0].x[0],r.value[r.value.length-1].x[1]]),t._lastHistogram={value:r.value,input:{type:e}},t._widget.data="number"===e?T(r):k(r)}}))},e.prototype.selectionChanged=function(t){if(null===t.detail)this._selection=null;else{var e=this._isTimeSeries?t.detail:t.detail.selection;this._selection=[e[0],e[1]]}this._emitter.emit("rangeChanged",this._selection),this._filterChanged()},e.prototype._bucketArg=function(){return void 0!==this._bucketRanges?this._bucketRanges:this._buckets},e}(F),B=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),q=function(t){function e(e,r,i,o,a){var s=t.call(this,"global_range",o,r,a,!1)||this;return s._value=null,s._widget=n(i),s._carto=e,s._widget.addEventListener("change",(function(t){s._value=t.detail,s._filterChanged()})),s}return B(e,t),e.prototype.setDataLayer=function(t){var e=this;this._dataLayer=t,this._dataLayer.on("updated",(function(){var t=e._dataLayer.viz.variables[e.name];t&&!e._populated&&(e._widget.minValue=t.value[0],e._widget.maxValue=t.value[1],e._widget.range=t.value,e._populated=!0)}))},Object.defineProperty(e.prototype,"filter",{get:function(){return null===this._value?null:"@"+this.columnPropName+" > "+this._value[0]+" and @"+this.columnPropName+" < "+this._value[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expression",{get:function(){var t=this._carto.expressions;return t.list([t.globalMin(t.prop(this._column)),t.globalMax(t.prop(this._column))])},enumerable:!0,configurable:!0}),e}(O),U=function(){function t(t,e,r,i,o,a,s,u,l){var c=this;void 0===a&&(a=10),void 0===s&&(s=[.15,.15]),this._timeSeriesWidget=n(i),this._layer=e,this._carto=t,this._columnName=r,this._duration=a,this._fade=s,this._variableName=u||"animation",this._propertyName=l||"filter",e.viz?(this._onLayerLoaded(),o()):e.on("loaded",(function(){c._onLayerLoaded(),o()}))}return t.prototype.removeHistogramLayer=function(){this._dataLayer.remove()},t.prototype.setRange=function(t){if(this._animation&&this._animation.input&&this._animation.input.min&&this._animation.input.max)if(null===t)this._animation.input.min.blendTo(this._min,0),this._animation.input.max.blendTo(this._max,0),this._animation.duration.blendTo(this._duration,0);else if(t[0]!==t[1]){var e=this._carto.expressions,r=void 0,n=void 0,i=void 0;"Blend"===this._animation.input.min.expressionName&&"Transition"!==this._animation.input.min.mix.expressionName&&("number"==typeof t[0]&&"number"==typeof t[1]?(r=t[0],n=t[1],i=Math.min(1,(n-r)/(this._max.value-this._min.value))):t[0]instanceof Date&&t[1]instanceof Date&&(r=e.time(t[0]),n=e.time(t[1]),i=Math.min(1,(t[0].getTime()-t[1].getTime())/(this._max.value-this._min.value))),this._animation.input.min.blendTo(r,0),this._animation.input.max.blendTo(n,0),this._animation.duration.blendTo(this._duration*i,0))}},Object.defineProperty(t.prototype,"variableName",{get:function(){return this._variableName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"propertyName",{get:function(){return this._propertyName},set:function(t){this._propertyName=t},enumerable:!0,configurable:!0}),t.prototype.setDuration=function(t){this._duration=t,this._animation.duration.blendTo(t,0)},Object.defineProperty(t.prototype,"animation",{get:function(){return this._animation},enumerable:!0,configurable:!0}),t.prototype._onLayerLoaded=function(){var t=this;this._viz=this._layer.viz;var e=this._getAnimationExpression();e.a&&e.b?this._animation="animation"===e.a.expressionName?e.a:e.b:this._animation=e,this._viz.variables[this._variableName]=this._animation,this._viz[this._propertyName].blendTo(e,0),this._animation.parent=this._viz,this._animation.notify=this._viz._changed.bind(this._viz),this._max=this._animation.input.max,this._min=this._animation.input.min,this._duration=this._animation.duration.value,this._layer.on("updated",(function(){t._timeSeriesWidget.progress=100*t._animation.getProgressPct(),t._timeSeriesWidget.playing=t._animation.isPlaying()})),this._timeSeriesWidget.animated=!0,this._timeSeriesWidget.addEventListener("seek",(function(e){t._animation.setProgressPct(e.detail/100),t._timeSeriesWidget.progress=e.detail})),this._timeSeriesWidget.addEventListener("play",(function(){t._animation.play()})),this._timeSeriesWidget.addEventListener("pause",(function(){t._animation.pause()}))},t.prototype._getAnimationExpression=function(){return this._variableName&&this._viz.variables[this._variableName]?this._viz.variables[this._variableName]:this._propertyName&&this._viz[this._propertyName]&&this._viz[this._propertyName].isAnimated()?this._viz[this._propertyName]:this._createDefaultAnimation()},t.prototype._createDefaultAnimation=function(){var t=this._carto.expressions;return t.animation(t.linear(t.prop(this._columnName)),this._duration,t.fade(this._fade[0],this._fade[1]))},t}(),Z="^1.2.3",X=function(){function t(t){var e=t.carto,r=t.map,n=t.layer,i=t.source;if(this._vizFilters=[],this._carto=e,this._map=r,this._layer=n,this._source=i,this._id=this._layer.id,this._rebuildFilters=this._rebuildFilters.bind(this),this._updateDataLayerVariables=this._updateDataLayerVariables.bind(this),!this._carto.expressions.globalHistogram)throw new Error("Provided VL version "+this._carto.version+" lacks globalHistogram support.");if(!w.a.satisfies(this._carto.version,Z))throw new Error("Provided VL version "+this._carto.version+" not supported. Must satisfy "+Z)}return t.prototype.numericalHistogram=function(t,e,r){void 0===r&&(r={});var n=r.buckets,a=r.bucketRanges,s=r.readOnly,u=r.totals,l=i(e),c=o(e),p=new I(this._carto,this._layer,t,l,n,this._source,a,s,u,c);return this._addFilter(p),p},t.prototype.categoricalHistogram=function(t,e,r){void 0===r&&(r={});var n=r.readOnly,a=r.totals,s=i(e),u=o(e),l=new $(this._carto,this._layer,t,s,this._source,n,a,u);return this._addFilter(l),l},t.prototype.histogram=function(t,e,r){void 0===r&&(r={});var n=r.buckets,i=r.bucketRanges,o=r.readOnly,a=r.totals;if(void 0===n&&void 0===i){var s=t;return this.categoricalHistogram(s,e,{readOnly:o,totals:a})}return this.numericalHistogram(t,e,{readOnly:o,buckets:n,bucketRanges:i,totals:a})},t.prototype.category=function(t,e,r){void 0===r&&(r={});var n=r.readOnly,a=r.button,s=i(e),u=o(e),l=new R(this._carto,this._layer,t,s,this._source,n,a,u);return this._addFilter(l),l},t.prototype.timeSeries=function(t,e,r){var n=this;if(void 0===r&&(r={}),this._animation)throw new Error("There can only be one animation");var i=r.buckets,o=r.bucketRanges,a=r.readOnly,s=r.totals,u=r.duration,l=r.fade,c=r.variableName,p=r.propertyName;this._animation=new U(this._carto,this._layer,e,t,(function(){"filter"===p&&n._rebuildFilters()}),u,l,c,p);var h=this.numericalHistogram(t,e,{bucketRanges:o,buckets:i,readOnly:a,totals:s});return h.setTimeSeries(!0),h.on("rangeChanged",(function(t){n._animation.setRange(t)})),this._animation},t.prototype.animationControls=function(t,e,r){var n=this;void 0===r&&(r={});var i=r.duration,o=r.fade,a=r.variableName,s=r.propertyName,u=void 0===s?"filter":s;return this._animation=new x(t,this._carto,e,a,u,i,o,this._layer,(function(){"filter"===u&&n._rebuildFilters()}),null),this._animation},t.prototype.globalRange=function(t,e){var r=new q(this._carto,this._layer,t,e,this._source);return this._addFilter(r),r},t.prototype.build=function(){var t=this;if(0!==this._vizFilters.length){var e=function(){t._appendVariables(),t._buildDataLayer()};this._layer.viz?e():this._layer.on("loaded",e)}},t.prototype._addFilter=function(t){t.on("filterChanged",this._rebuildFilters),t.on("expressionReady",this._updateDataLayerVariables),this._vizFilters.push(t)},t.prototype._appendVariables=function(){var t=this,e=this._carto.expressions;this._vizFilters.forEach((function(r){return t._layer.viz.variables[r.columnPropName]=e.prop(r.column)}))},t.prototype._buildDataLayer=function(){var t=this,e=this._getVariables(),r=this._carto.expressions,n=new this._carto.Viz({color:r.rgba(0,0,0,0),strokeWidth:0,variables:e});this._readOnlyLayer=new this._carto.Layer("asbind_ro_"+this._id,this._source,n),this._readOnlyLayer.addTo(this._map),this._vizFilters.forEach((function(e){return e.setDataLayer(t._readOnlyLayer)}))},t.prototype._getVariables=function(){for(var t=void 0!==this._readOnlyLayer?this._readOnlyLayer.viz.variables:{},e=0,r=this._vizFilters;e<r.length;e++){var n=r[e],i=n.name;n.globalExpression&&(t[i+"_global"]=n.globalExpression),n.expression&&(t[i]=n.expression),t[n.columnPropName]=this._carto.expressions.prop(n.column)}return t},t.prototype._updateDataLayerVariables=function(t){this._readOnlyLayer.viz&&(this._readOnlyLayer.viz.variables[t.name]=t.expression)},t.prototype._rebuildFilters=function(){var t=this._combineFilters(this._vizFilters.filter((function(t){return null!==t.filter})).map((function(t){return t.filter})));this._readOnlyLayer&&this._readOnlyLayer.viz.filter.blendTo(t,0),this._layer.viz.filter.isAnimated()&&this._animation&&this._layer.viz.variables[this._animation.variableName]&&(t="@"+this._animation.variableName+" and "+t),this._layer.viz.filter.blendTo(t,0)},t.prototype._combineFilters=function(t){return 0===t.length?"1":t.join(" and ")},t}();r.d(e,"VL",(function(){return G})),r.d(e,"VLBridge",(function(){return X}));var G={Bridge:X,Legends:y}}])})); |
@@ -5,2 +5,3 @@ export interface VLViz { | ||
}; | ||
[key: string]: any; | ||
_changed: () => void; | ||
@@ -13,4 +14,6 @@ } | ||
duration: any; | ||
propertyName: string; | ||
notify: () => void; | ||
getProgressPct(): number; | ||
getProgressValue(): number | Date | VLTimeZoneDate; | ||
setProgressPct(pct: number): void; | ||
@@ -21,6 +24,12 @@ play(): void; | ||
} | ||
export declare type NumericalHistogramData = VLHistogramData<[number, number]>; | ||
export interface VLTimeZoneDate { | ||
_value: number | string; | ||
_date: Date; | ||
_timeZone: number | string; | ||
} | ||
export declare type NumericalHistogramData = VLHistogramData<[number | Date, number | Date]>; | ||
export declare type CategoricalHistogramData = VLHistogramData<string>; | ||
export interface VLNumericalHistogram { | ||
value: NumericalHistogramData[]; | ||
input: any; | ||
} | ||
@@ -48,3 +57,3 @@ export interface VLCategoricalHistogram { | ||
} | ||
export declare type BucketRange = [number, number]; | ||
export declare type BucketRange = [Date | number, Date | number]; | ||
export interface VLBridgeOptions { | ||
@@ -94,4 +103,16 @@ carto: any; | ||
variableName?: string; | ||
propertyName?: string; | ||
} | ||
/** | ||
* Options for the Animation Controls widget | ||
* | ||
* @type {AnimationControlsOptions} | ||
*/ | ||
export interface AnimationControlsOptions { | ||
duration?: number; | ||
fade?: [number, number]; | ||
variableName?: string; | ||
propertyName?: string; | ||
} | ||
/** | ||
* Object used as arguments to create a {@link CategoryFilter} | ||
@@ -98,0 +119,0 @@ * |
@@ -16,3 +16,3 @@ import { BucketRange } from '../../types'; | ||
*/ | ||
export declare class NumericalHistogramFilter extends BaseHistogramFilter<[number, number]> { | ||
export declare class NumericalHistogramFilter extends BaseHistogramFilter<Array<number | Date>> { | ||
private _lastHistogram; | ||
@@ -19,0 +19,0 @@ private _isTimeSeries; |
@@ -75,3 +75,7 @@ var __extends = (this && this.__extends) || (function () { | ||
} | ||
return "(@" + this.columnPropName + " >= " + this._selection[0] + " and @" + this.columnPropName + " < " + this._selection[1] + ")"; | ||
var minN = this._selection[0]; | ||
var maxN = this._selection[1]; | ||
var min = minN instanceof Date ? "date('" + minN.toISOString() + "')" : minN; | ||
var max = maxN instanceof Date ? "date('" + maxN.toISOString() + "')" : maxN; | ||
return "(@" + this.columnPropName + " >= " + min + " and @" + this.columnPropName + " < " + max + ")"; | ||
}, | ||
@@ -143,6 +147,9 @@ enumerable: true, | ||
if (_this._globalHistogram) { | ||
var type = _this._globalHistogram.input.type; | ||
_this._bucketRanges = _this._globalHistogram.value.map(function (value) { return [value.x[0], value.x[1]]; }); | ||
_this._emitter.emit('expressionReady', { name: _this.name, expression: _this.expression }); | ||
_this._widget.backgroundData = type === 'number' | ||
? conversion.numerical(_this._globalHistogram) | ||
: conversion.date(_this._globalHistogram); | ||
} | ||
_this._widget.backgroundData = conversion.numerical(_this._globalHistogram); | ||
} | ||
@@ -155,2 +162,3 @@ var newHistogram = _this._dataLayer.viz.variables[_this.name]; | ||
(_this._lastHistogram === null || !isNumericalHistogramEqual(_this._lastHistogram, newHistogram))) { | ||
var type = newHistogram.input.type; | ||
_this._emitter.emit('rangeChanged', [ | ||
@@ -160,4 +168,6 @@ newHistogram.value[0].x[0], | ||
]); | ||
_this._lastHistogram = { value: newHistogram.value }; | ||
_this._widget.data = conversion.numerical(newHistogram); | ||
_this._lastHistogram = { value: newHistogram.value, input: { type: type } }; | ||
_this._widget.data = type === 'number' | ||
? conversion.numerical(newHistogram) | ||
: conversion.date(newHistogram); | ||
} | ||
@@ -172,3 +182,3 @@ }); | ||
var selection = (this._isTimeSeries ? evt.detail : evt.detail.selection); | ||
this._selection = [Number(selection[0]), Number(selection[1])]; | ||
this._selection = [selection[0], selection[1]]; | ||
} | ||
@@ -175,0 +185,0 @@ this._emitter.emit('rangeChanged', this._selection); |
@@ -8,2 +8,3 @@ interface LegendOptions { | ||
samples?: number; | ||
variable?: string; | ||
}; | ||
@@ -10,0 +11,0 @@ } |
@@ -27,3 +27,3 @@ var __assign = (this && this.__assign) || function () { | ||
} | ||
if (propName === 'color' || propName === 'strokeColor') { | ||
if (prop.type === 'color') { | ||
return rgbaToString(prop.value); | ||
@@ -43,4 +43,7 @@ } | ||
} | ||
function _getSymbolValue(viz) { | ||
var prop = viz.symbol; | ||
function _getSymbolValue(viz, value) { | ||
if (value === void 0) { value = null; } | ||
var prop = value && viz.variables[value] | ||
? viz.variables[value] | ||
: viz.symbol; | ||
if (prop.expressionName === 'ramp') { | ||
@@ -136,6 +139,10 @@ return _getLegendData(prop); | ||
var config = options.config; | ||
var legendData = parsedLayer.layer.viz[prop].getLegendData(config).data; | ||
var parsedData = legendData.map(function (data, index, arr) { | ||
var dataProp = options.config.variable || prop; | ||
var data = parsedLayer.layer.viz.variables[dataProp] | ||
? parsedLayer.layer.viz.variables[dataProp] | ||
: parsedLayer.layer.viz[dataProp]; | ||
var legendData = data.getLegendData(config).data; | ||
var parsedData = legendData.map(function (legend, index, arr) { | ||
var _a; | ||
return __assign({}, baseStyle, (_a = {}, _a[prop] = _formatProp(vizProp, data.value), _a.label = options.format ? options.format(data.key, index, arr) : _formatLegendKey(data.key), _a)); | ||
return __assign({}, baseStyle, (_a = {}, _a[prop] = _formatProp(vizProp, legend.value), _a.label = options.format ? options.format(legend.key, index, arr) : _formatLegendKey(data.key), _a)); | ||
}); | ||
@@ -142,0 +149,0 @@ if (Array.isArray(parsedLayer.props) && parsedLayer.props.length === legendData.length) { |
@@ -13,3 +13,3 @@ import { VLAnimation } from '../../types'; | ||
export declare class TimeSeries { | ||
private _timeSeries; | ||
private _timeSeriesWidget; | ||
private _animation; | ||
@@ -26,2 +26,3 @@ private _layer; | ||
private _variableName; | ||
private _propertyName; | ||
/** | ||
@@ -35,3 +36,3 @@ * Creates an instance of TimeSeries. | ||
*/ | ||
constructor(carto: any, layer: any, column: string, timeSeries: any | string, readyCb: () => void, duration?: number, fade?: [number, number], variableName?: string); | ||
constructor(carto: any, layer: any, column: string, timeSeries: any | string, readyCb: () => void, duration: number, fade: [number, number], variableName: string, propertyName: string); | ||
removeHistogramLayer(): void; | ||
@@ -47,4 +48,5 @@ /** | ||
*/ | ||
setRange(range: [number, number]): void; | ||
setRange(range: [number, number] | [Date, Date]): void; | ||
readonly variableName: string; | ||
propertyName: string; | ||
setDuration(duration: number): void; | ||
@@ -62,4 +64,5 @@ readonly animation: VLAnimation; | ||
private _onLayerLoaded; | ||
private _createAnimation; | ||
private _getAnimationExpression; | ||
private _createDefaultAnimation; | ||
} | ||
export default TimeSeries; |
@@ -21,8 +21,7 @@ import { select } from '../../util/Utils'; | ||
*/ | ||
function TimeSeries(carto, layer, column, timeSeries, readyCb, duration, fade, variableName) { | ||
function TimeSeries(carto, layer, column, timeSeries, readyCb, duration, fade, variableName, propertyName) { | ||
var _this = this; | ||
if (duration === void 0) { duration = 10; } | ||
if (fade === void 0) { fade = [0.15, 0.15]; } | ||
if (variableName === void 0) { variableName = 'animation'; } | ||
this._timeSeries = select(timeSeries); | ||
this._timeSeriesWidget = select(timeSeries); | ||
this._layer = layer; | ||
@@ -33,3 +32,4 @@ this._carto = carto; | ||
this._fade = fade; | ||
this._variableName = variableName; | ||
this._variableName = variableName || 'animation'; | ||
this._propertyName = propertyName || 'filter'; | ||
if (layer.viz) { | ||
@@ -68,6 +68,22 @@ this._onLayerLoaded(); | ||
else if (range[0] !== range[1]) { | ||
var ratio = Math.min(1, (range[1] - range[0]) / (this._max.value - this._min.value)); | ||
this._animation.input.min.blendTo(range[0], 0); | ||
this._animation.input.max.blendTo(range[1], 0); | ||
this._animation.duration.blendTo(this._duration * ratio, 0); | ||
var s = this._carto.expressions; | ||
var min = void 0; | ||
var max = void 0; | ||
var ratio = void 0; | ||
if (this._animation.input.min.expressionName === 'Blend' && | ||
this._animation.input.min.mix.expressionName !== 'Transition') { | ||
if (typeof range[0] === 'number' && typeof range[1] === 'number') { | ||
min = range[0]; | ||
max = range[1]; | ||
ratio = Math.min(1, (max - min) / (this._max.value - this._min.value)); | ||
} | ||
else if (range[0] instanceof Date && range[1] instanceof Date) { | ||
min = s.time(range[0]); | ||
max = s.time(range[1]); | ||
ratio = Math.min(1, (range[0].getTime() - range[1].getTime()) / (this._max.value - this._min.value)); | ||
} | ||
this._animation.input.min.blendTo(min, 0); | ||
this._animation.input.max.blendTo(max, 0); | ||
this._animation.duration.blendTo(this._duration * ratio, 0); | ||
} | ||
} | ||
@@ -82,2 +98,12 @@ }; | ||
}); | ||
Object.defineProperty(TimeSeries.prototype, "propertyName", { | ||
get: function () { | ||
return this._propertyName; | ||
}, | ||
set: function (name) { | ||
this._propertyName = name; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
TimeSeries.prototype.setDuration = function (duration) { | ||
@@ -106,12 +132,13 @@ this._duration = duration; | ||
this._viz = this._layer.viz; | ||
if (!this._viz.variables[this._variableName]) { | ||
this._animation = this._createAnimation(); | ||
/* Big hack, this is done internally on VL */ | ||
this._animation.parent = this._viz; | ||
this._animation.notify = this._viz._changed.bind(this._viz); | ||
this._viz.variables[this._variableName] = this._animation; | ||
var expr = this._getAnimationExpression(); | ||
if (expr.a && expr.b) { | ||
this._animation = expr.a.expressionName === 'animation' ? expr.a : expr.b; | ||
} | ||
else { | ||
this._animation = this._viz.variables[this._variableName]; | ||
this._animation = expr; | ||
} | ||
this._viz.variables[this._variableName] = this._animation; | ||
this._viz[this._propertyName].blendTo(expr, 0); | ||
this._animation.parent = this._viz; | ||
this._animation.notify = this._viz._changed.bind(this._viz); | ||
this._max = this._animation.input.max; | ||
@@ -121,20 +148,31 @@ this._min = this._animation.input.min; | ||
this._layer.on('updated', function () { | ||
_this._timeSeries.progress = _this._animation.getProgressPct() * 100; | ||
_this._timeSeries.playing = _this._animation.isPlaying(); | ||
_this._timeSeriesWidget.progress = _this._animation.getProgressPct() * 100; | ||
_this._timeSeriesWidget.playing = _this._animation.isPlaying(); | ||
}); | ||
this._timeSeries.animated = true; | ||
this._timeSeries.addEventListener('seek', function (evt) { | ||
this._timeSeriesWidget.animated = true; | ||
this._timeSeriesWidget.addEventListener('seek', function (evt) { | ||
_this._animation.setProgressPct(evt.detail / 100); | ||
_this._timeSeries.progress = evt.detail; | ||
_this._timeSeriesWidget.progress = evt.detail; | ||
}); | ||
this._timeSeries.addEventListener('play', function () { | ||
this._timeSeriesWidget.addEventListener('play', function () { | ||
_this._animation.play(); | ||
}); | ||
this._timeSeries.addEventListener('pause', function () { | ||
this._timeSeriesWidget.addEventListener('pause', function () { | ||
_this._animation.pause(); | ||
}); | ||
}; | ||
TimeSeries.prototype._createAnimation = function () { | ||
TimeSeries.prototype._getAnimationExpression = function () { | ||
if (this._variableName && this._viz.variables[this._variableName]) { | ||
return this._viz.variables[this._variableName]; | ||
} | ||
if (this._propertyName && | ||
this._viz[this._propertyName] && | ||
this._viz[this._propertyName].isAnimated()) { | ||
return this._viz[this._propertyName]; | ||
} | ||
return this._createDefaultAnimation(); | ||
}; | ||
TimeSeries.prototype._createDefaultAnimation = function () { | ||
var s = this._carto.expressions; | ||
return s.animation(s.linear(s.prop(this._columnName), s.globalMin(s.prop(this._columnName)), s.globalMax(s.prop(this._columnName))), this._duration, s.fade(this._fade[0], this._fade[1])); | ||
return s.animation(s.linear(s.prop(this._columnName)), this._duration, s.fade(this._fade[0], this._fade[1])); | ||
}; | ||
@@ -141,0 +179,0 @@ return TimeSeries; |
@@ -12,2 +12,3 @@ import { LegendEntry, VLCategoricalHistogram, VLNumericalHistogram } from '../../../../types'; | ||
export declare function numerical(data: VLNumericalHistogram): any[]; | ||
export declare function date(data: VLNumericalHistogram): any[]; | ||
/** | ||
@@ -14,0 +15,0 @@ * Converts a categorical VL Histogram to Airship's Histogram widget format. |
@@ -18,2 +18,9 @@ import { toHex } from '../../color'; | ||
} | ||
export function date(data) { | ||
return data.value.map(function (d) { return ({ | ||
end: new Date(d.x[1]), | ||
start: new Date(d.x[0]), | ||
value: d.y, | ||
}); }); | ||
} | ||
/** | ||
@@ -20,0 +27,0 @@ * Converts a categorical VL Histogram to Airship's Histogram widget format. |
@@ -1,2 +0,3 @@ | ||
import { AnimationOptions, CategoricalHistogramOptions, CategoryOptions, NumericalHistogramOptions, VLBridgeOptions } from '../types'; | ||
import { AnimationControlsOptions, AnimationOptions, CategoricalHistogramOptions, CategoryOptions, NumericalHistogramOptions, VLBridgeOptions } from '../types'; | ||
import { AnimationControls } from './animation-controls/AnimationControls'; | ||
import { CategoryFilter } from './category/CategoryFilter'; | ||
@@ -114,2 +115,20 @@ import { CategoricalHistogramFilter } from './histogram/CategoricalHistogramFilter'; | ||
/** | ||
* Creates an animation controls widget | ||
* | ||
* By default, the animation is set to the 'filter' property, | ||
* but it is possible to animate any style property using the 'propertyName' option. | ||
* | ||
* There can only be one animation per layer (per VLBridge instance) | ||
* | ||
* @param {(any | string)} widget The Animation Controls widget, or a selector | ||
* @param {string} column The name of the column in the dataset used in the animation | ||
* @param {AnimationControlsOptions} [options={}] | ||
* @param {number} [options.duration] Animation duration in seconds. It is 10 by default | ||
* @param {[number, number]} [options.fade] Animation fade in and out. | ||
* @param {string} [options.variableName] Name of the viz variable that has the animation assigned | ||
* @param {string} [options.propertyName] Name of the style property to apply the animation, 'filter' by default. | ||
* @memberof VLBridge | ||
*/ | ||
animationControls(widget: any | string, column: string, options?: AnimationControlsOptions): AnimationControls; | ||
/** | ||
* Creates a global range slider filter. | ||
@@ -116,0 +135,0 @@ * |
import semver from 'semver'; | ||
import { getColumnName, getExpression } from '../util/Utils'; | ||
import { AnimationControls } from './animation-controls/AnimationControls'; | ||
import { CategoryFilter } from './category/CategoryFilter'; | ||
@@ -152,6 +153,8 @@ import { CategoricalHistogramFilter } from './histogram/CategoricalHistogramFilter'; | ||
} | ||
var buckets = options.buckets, bucketRanges = options.bucketRanges, readOnly = options.readOnly, totals = options.totals, duration = options.duration, fade = options.fade, variableName = options.variableName; | ||
var buckets = options.buckets, bucketRanges = options.bucketRanges, readOnly = options.readOnly, totals = options.totals, duration = options.duration, fade = options.fade, variableName = options.variableName, propertyName = options.propertyName; | ||
this._animation = new TimeSeries(this._carto, this._layer, column, widget, function () { | ||
_this._rebuildFilters(); | ||
}, duration, fade, variableName); | ||
if (propertyName === 'filter') { | ||
_this._rebuildFilters(); | ||
} | ||
}, duration, fade, variableName, propertyName); | ||
var histogram = this.numericalHistogram(widget, column, { | ||
@@ -170,2 +173,30 @@ bucketRanges: bucketRanges, | ||
/** | ||
* Creates an animation controls widget | ||
* | ||
* By default, the animation is set to the 'filter' property, | ||
* but it is possible to animate any style property using the 'propertyName' option. | ||
* | ||
* There can only be one animation per layer (per VLBridge instance) | ||
* | ||
* @param {(any | string)} widget The Animation Controls widget, or a selector | ||
* @param {string} column The name of the column in the dataset used in the animation | ||
* @param {AnimationControlsOptions} [options={}] | ||
* @param {number} [options.duration] Animation duration in seconds. It is 10 by default | ||
* @param {[number, number]} [options.fade] Animation fade in and out. | ||
* @param {string} [options.variableName] Name of the viz variable that has the animation assigned | ||
* @param {string} [options.propertyName] Name of the style property to apply the animation, 'filter' by default. | ||
* @memberof VLBridge | ||
*/ | ||
VLBridge.prototype.animationControls = function (widget, column, options) { | ||
var _this = this; | ||
if (options === void 0) { options = {}; } | ||
var duration = options.duration, fade = options.fade, variableName = options.variableName, _a = options.propertyName, propertyName = _a === void 0 ? 'filter' : _a; | ||
this._animation = new AnimationControls(widget, this._carto, column, variableName, propertyName, duration, fade, this._layer, function () { | ||
if (propertyName === 'filter') { | ||
_this._rebuildFilters(); | ||
} | ||
}, null); | ||
return this._animation; | ||
}; | ||
/** | ||
* Creates a global range slider filter. | ||
@@ -287,4 +318,6 @@ * | ||
} | ||
if (this._animation) { | ||
newFilter = "@" + this._animation.variableName + " and " + newFilter; | ||
if (this._layer.viz.filter.isAnimated() && this._animation) { | ||
if (this._layer.viz.variables[this._animation.variableName]) { | ||
newFilter = "@" + this._animation.variableName + " and " + newFilter; | ||
} | ||
} | ||
@@ -291,0 +324,0 @@ // Update the Visualization filter |
{ | ||
"name": "@carto/airship-bridge", | ||
"version": "2.1.1", | ||
"version": "2.2.0-2.2.0-rc.3.0", | ||
"description": "Airship bridge to other libs (CARTO VL, CARTO.js)", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"ts-loader": "^5.3.1", | ||
"typescript": "^3.1.6", | ||
"typescript": "3.5.3", | ||
"webpack": "^4.27.0", | ||
@@ -29,3 +29,3 @@ "webpack-cli": "^3.1.2" | ||
}, | ||
"gitHead": "d41eba572685051fae39f3cfbef7f5db646958c3" | ||
"gitHead": "30be32338889d42b5a7112a9a39cb68a9e21195d" | ||
} |
@@ -5,2 +5,3 @@ export interface VLViz { | ||
}; | ||
[key: string]: any; | ||
_changed: () => void; | ||
@@ -14,4 +15,6 @@ } | ||
duration: any; | ||
propertyName: string; | ||
notify: () => void; | ||
getProgressPct(): number; | ||
getProgressValue(): number | Date | VLTimeZoneDate; | ||
setProgressPct(pct: number): void; | ||
@@ -23,7 +26,13 @@ play(): void; | ||
export interface VLTimeZoneDate { | ||
_value: number | string; | ||
_date: Date; | ||
_timeZone: number | string; | ||
} | ||
export type NumericalHistogramData = VLHistogramData<[number, number]>; | ||
export type NumericalHistogramData = VLHistogramData<[number | Date, number | Date]>; | ||
export type CategoricalHistogramData = VLHistogramData<string>; | ||
export interface VLNumericalHistogram { | ||
value: NumericalHistogramData[]; | ||
input: any; | ||
} | ||
@@ -55,3 +64,3 @@ | ||
export type BucketRange = [number, number]; | ||
export type BucketRange = [Date | number, Date | number]; | ||
@@ -109,5 +118,22 @@ export interface VLBridgeOptions { | ||
variableName?: string; | ||
propertyName?: string; | ||
} | ||
/** | ||
* Options for the Animation Controls widget | ||
* | ||
* @type {AnimationControlsOptions} | ||
*/ | ||
export interface AnimationControlsOptions { | ||
duration?: number; | ||
fade?: [number, number]; | ||
variableName?: string; | ||
propertyName?: string; | ||
} | ||
/** | ||
* Object used as arguments to create a {@link CategoryFilter} | ||
@@ -114,0 +140,0 @@ * |
@@ -69,3 +69,2 @@ import { select } from '../../util/Utils'; | ||
this._dataLayer = layer; | ||
this.bindDataLayer(); | ||
@@ -72,0 +71,0 @@ } |
@@ -19,3 +19,3 @@ import { BucketRange, VLNumericalHistogram } from '../../types'; | ||
*/ | ||
export class NumericalHistogramFilter extends BaseHistogramFilter<[number, number]> { | ||
export class NumericalHistogramFilter extends BaseHistogramFilter<Array<number | Date>> { | ||
private _lastHistogram: VLNumericalHistogram = null; | ||
@@ -75,3 +75,8 @@ private _isTimeSeries: boolean; | ||
return `(@${this.columnPropName} >= ${this._selection[0]} and @${this.columnPropName} < ${this._selection[1]})`; | ||
const minN = this._selection[0]; | ||
const maxN = this._selection[1]; | ||
const min = minN instanceof Date ? `date('${minN.toISOString()}')` : minN; | ||
const max = maxN instanceof Date ? `date('${maxN.toISOString()}')` : maxN; | ||
return `(@${this.columnPropName} >= ${min} and @${this.columnPropName} < ${max})`; | ||
} | ||
@@ -144,2 +149,4 @@ | ||
if (this._globalHistogram) { | ||
const type = this._globalHistogram.input.type; | ||
this._bucketRanges = this._globalHistogram.value.map( | ||
@@ -150,8 +157,11 @@ (value) => ([value.x[0], value.x[1]] as [number, number]) | ||
this._emitter.emit('expressionReady', { name: this.name, expression: this.expression }); | ||
this._widget.backgroundData = type === 'number' | ||
? conversion.numerical(this._globalHistogram) | ||
: conversion.date(this._globalHistogram); | ||
} | ||
this._widget.backgroundData = conversion.numerical(this._globalHistogram); | ||
} | ||
const newHistogram = (this._dataLayer.viz.variables[this.name] as VLNumericalHistogram); | ||
if (!newHistogram) { | ||
@@ -163,2 +173,4 @@ return; | ||
(this._lastHistogram === null || !isNumericalHistogramEqual(this._lastHistogram, newHistogram))) { | ||
const type = newHistogram.input.type; | ||
this._emitter.emit('rangeChanged', [ | ||
@@ -169,5 +181,7 @@ newHistogram.value[0].x[0], | ||
this._lastHistogram = { value: newHistogram.value }; | ||
this._lastHistogram = { value: newHistogram.value, input: { type } }; | ||
this._widget.data = conversion.numerical(newHistogram); | ||
this._widget.data = type === 'number' | ||
? conversion.numerical(newHistogram) | ||
: conversion.date(newHistogram); | ||
} | ||
@@ -181,4 +195,4 @@ }); | ||
} else { | ||
const selection = (this._isTimeSeries ? evt.detail : evt.detail.selection) as [number, number]; | ||
this._selection = [Number(selection[0]), Number(selection[1])]; | ||
const selection = (this._isTimeSeries ? evt.detail : evt.detail.selection); | ||
this._selection = [selection[0], selection[1]]; | ||
} | ||
@@ -185,0 +199,0 @@ |
@@ -21,3 +21,3 @@ import { select } from '../../util/Utils'; | ||
if (propName === 'color' || propName === 'strokeColor') { | ||
if (prop.type === 'color') { | ||
return rgbaToString(prop.value); | ||
@@ -43,4 +43,6 @@ } | ||
function _getSymbolValue(viz) { | ||
const prop = viz.symbol; | ||
function _getSymbolValue(viz, value = null) { | ||
const prop = value && viz.variables[value] | ||
? viz.variables[value] | ||
: viz.symbol; | ||
@@ -60,3 +62,2 @@ if (prop.expressionName === 'ramp') { | ||
const { layer, props } = layerWithProps; | ||
const viz = layer.viz; | ||
@@ -142,4 +143,5 @@ | ||
dynamic?: boolean; | ||
config?: { othersLabel?: string, samples?: number }; | ||
config?: { othersLabel?: string, samples?: number, variable?: string }; | ||
} | ||
export default class Legends { | ||
@@ -176,12 +178,14 @@ public static layersLegend(widget, layers, options: LegendOptions = {}) { | ||
const baseStyle = _styleFromLayer(parsedLayer); | ||
const vizProp = parsedLayer.layer.viz[prop]; | ||
const config = options.config; | ||
const legendData = parsedLayer.layer.viz[prop].getLegendData(config).data; | ||
const parsedData = legendData.map((data, index, arr) => { | ||
const dataProp = options.config.variable || prop; | ||
const data = parsedLayer.layer.viz.variables[dataProp] | ||
? parsedLayer.layer.viz.variables[dataProp] | ||
: parsedLayer.layer.viz[dataProp]; | ||
const legendData = data.getLegendData(config).data; | ||
const parsedData = legendData.map((legend, index, arr) => { | ||
return { | ||
...baseStyle, | ||
[prop]: _formatProp(vizProp, data.value), | ||
label: options.format ? options.format(data.key, index, arr) : _formatLegendKey(data.key) | ||
[prop]: _formatProp(vizProp, legend.value), | ||
label: options.format ? options.format(legend.key, index, arr) : _formatLegendKey(data.key) | ||
}; | ||
@@ -188,0 +192,0 @@ }); |
@@ -17,2 +17,6 @@ import * as mitt from 'mitt'; | ||
viz: { | ||
_changed: () => ({}), | ||
filter: { | ||
blendTo: () => ({}) | ||
}, | ||
variables: { | ||
@@ -43,3 +47,3 @@ animation: { | ||
// tslint:disable no-unused-expression | ||
new TimeSeries({}, layer, 'column', widget, mockCb); | ||
new TimeSeries({}, layer, 'column', widget, mockCb, null, null, null, null); | ||
}; | ||
@@ -53,12 +57,12 @@ | ||
it('should fire immediately if layer is already loaded', () => { | ||
const mockedCb = jest.fn(); | ||
const mockCb = jest.fn(); | ||
// tslint:disable no-unused-expression | ||
new TimeSeries({}, layer, 'column', widget, mockedCb); | ||
new TimeSeries({}, layer, 'column', widget, mockCb, null, null, null, null); | ||
expect(mockedCb).toHaveBeenCalled(); | ||
expect(mockCb).toHaveBeenCalled(); | ||
}); | ||
it('should fire after layer fires loaded event', () => { | ||
const mockedCb = jest.fn(); | ||
const mockCb = jest.fn(); | ||
@@ -69,5 +73,5 @@ const oldViz = layer.viz; | ||
// tslint:disable no-unused-expression | ||
new TimeSeries({}, layer, 'column', widget, mockedCb); | ||
new TimeSeries({}, layer, 'column', widget, mockCb, null, null, null, null); | ||
expect(mockedCb).not.toHaveBeenCalled(); | ||
expect(mockCb).not.toHaveBeenCalled(); | ||
@@ -77,5 +81,5 @@ layer.viz = oldViz; | ||
expect(mockedCb).toHaveBeenCalled(); | ||
expect(mockCb).toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); |
@@ -15,3 +15,3 @@ import { VLAnimation, VLViz } from '../../types'; | ||
export class TimeSeries { | ||
private _timeSeries: any; | ||
private _timeSeriesWidget: any; | ||
private _animation: VLAnimation; | ||
@@ -28,2 +28,3 @@ private _layer: any; | ||
private _variableName: string; | ||
private _propertyName: string; | ||
@@ -46,6 +47,6 @@ /** | ||
fade: [number, number] = [0.15, 0.15], | ||
variableName: string = 'animation' | ||
variableName: string, | ||
propertyName: string | ||
) { | ||
this._timeSeries = select(timeSeries) as any; | ||
this._timeSeriesWidget = select(timeSeries) as any; | ||
this._layer = layer; | ||
@@ -56,3 +57,4 @@ this._carto = carto; | ||
this._fade = fade; | ||
this._variableName = variableName; | ||
this._variableName = variableName || 'animation'; | ||
this._propertyName = propertyName || 'filter'; | ||
@@ -83,3 +85,3 @@ if (layer.viz) { | ||
*/ | ||
public setRange(range: [number, number]) { | ||
public setRange(range: [number, number] | [ Date, Date ]) { | ||
if (!this._animation || !this._animation.input || !this._animation.input.min || !this._animation.input.max) { | ||
@@ -94,9 +96,24 @@ return; | ||
} else if (range[0] !== range[1]) { | ||
const ratio = Math.min(1, (range[1] - range[0]) / (this._max.value - this._min.value)); | ||
this._animation.input.min.blendTo(range[0], 0); | ||
this._animation.input.max.blendTo(range[1], 0); | ||
const s = this._carto.expressions; | ||
let min; | ||
let max; | ||
let ratio; | ||
this._animation.duration.blendTo(this._duration * ratio, 0); | ||
if (this._animation.input.min.expressionName === 'Blend' && | ||
this._animation.input.min.mix.expressionName !== 'Transition') { | ||
if (typeof range[0] === 'number' && typeof range[1] === 'number') { | ||
min = range[0]; | ||
max = range[1]; | ||
ratio = Math.min(1, (max - min) / (this._max.value - this._min.value)); | ||
} else if (range[0] instanceof Date && range[1] instanceof Date) { | ||
min = s.time(range[0]); | ||
max = s.time(range[1]); | ||
ratio = Math.min(1, (range[0].getTime() - range[1].getTime()) / (this._max.value - this._min.value)); | ||
} | ||
this._animation.input.min.blendTo(min, 0); | ||
this._animation.input.max.blendTo(max, 0); | ||
this._animation.duration.blendTo(this._duration * ratio, 0); | ||
} | ||
} | ||
} | ||
@@ -108,2 +125,10 @@ | ||
public get propertyName(): string { | ||
return this._propertyName; | ||
} | ||
public set propertyName(name) { | ||
this._propertyName = name; | ||
} | ||
public setDuration(duration: number) { | ||
@@ -130,14 +155,16 @@ this._duration = duration; | ||
if (!this._viz.variables[this._variableName]) { | ||
this._animation = this._createAnimation(); | ||
const expr = this._getAnimationExpression(); | ||
/* Big hack, this is done internally on VL */ | ||
this._animation.parent = this._viz; | ||
this._animation.notify = this._viz._changed.bind(this._viz); | ||
this._viz.variables[this._variableName] = this._animation; | ||
if (expr.a && expr.b) { | ||
this._animation = expr.a.expressionName === 'animation' ? expr.a : expr.b; | ||
} else { | ||
this._animation = this._viz.variables[this._variableName]; | ||
this._animation = expr; | ||
} | ||
this._viz.variables[this._variableName] = this._animation; | ||
this._viz[this._propertyName].blendTo(expr, 0); | ||
this._animation.parent = this._viz; | ||
this._animation.notify = this._viz._changed.bind(this._viz); | ||
this._max = this._animation.input.max; | ||
@@ -148,20 +175,19 @@ this._min = this._animation.input.min; | ||
this._layer.on('updated', () => { | ||
this._timeSeries.progress = this._animation.getProgressPct() * 100; | ||
this._timeSeries.playing = this._animation.isPlaying(); | ||
this._timeSeriesWidget.progress = this._animation.getProgressPct() * 100; | ||
this._timeSeriesWidget.playing = this._animation.isPlaying(); | ||
}); | ||
this._timeSeries.animated = true; | ||
this._timeSeriesWidget.animated = true; | ||
this._timeSeries.addEventListener('seek', (evt: CustomEvent) => { | ||
this._timeSeriesWidget.addEventListener('seek', (evt: CustomEvent) => { | ||
this._animation.setProgressPct(evt.detail / 100); | ||
this._timeSeries.progress = evt.detail; | ||
this._timeSeriesWidget.progress = evt.detail; | ||
}); | ||
this._timeSeries.addEventListener('play', () => { | ||
this._timeSeriesWidget.addEventListener('play', () => { | ||
this._animation.play(); | ||
}); | ||
this._timeSeries.addEventListener('pause', () => { | ||
this._timeSeriesWidget.addEventListener('pause', () => { | ||
this._animation.pause(); | ||
@@ -171,11 +197,21 @@ }); | ||
private _createAnimation() { | ||
private _getAnimationExpression() { | ||
if (this._variableName && this._viz.variables[this._variableName]) { | ||
return this._viz.variables[this._variableName]; | ||
} | ||
if (this._propertyName && | ||
this._viz[this._propertyName] && | ||
this._viz[this._propertyName].isAnimated()) { | ||
return this._viz[this._propertyName]; | ||
} | ||
return this._createDefaultAnimation(); | ||
} | ||
private _createDefaultAnimation() { | ||
const s = this._carto.expressions; | ||
return s.animation( | ||
s.linear( | ||
s.prop(this._columnName), | ||
s.globalMin(s.prop(this._columnName)), | ||
s.globalMax(s.prop(this._columnName)) | ||
), | ||
s.linear(s.prop(this._columnName)), | ||
this._duration, | ||
@@ -182,0 +218,0 @@ s.fade( |
@@ -16,3 +16,3 @@ import { isNumericalHistogramEqual } from '.'; | ||
it('should detect equal histograms', () => { | ||
expect(isNumericalHistogramEqual({ value: hist1 }, { value: hist1 })).toBe(true); | ||
expect(isNumericalHistogramEqual({ input: '', value: hist1 }, { input: '', value: hist1 })).toBe(true); | ||
}); | ||
@@ -22,3 +22,3 @@ | ||
// Test for different length | ||
expect(isNumericalHistogramEqual({ value: hist1 }, { value: hist1.slice(0, 1) })).toBe(false); | ||
expect(isNumericalHistogramEqual({ input: '', value: hist1 }, { input: '', value: hist1.slice(0, 1) })).toBe(false); | ||
}); | ||
@@ -28,4 +28,7 @@ | ||
// Test for different content | ||
expect(isNumericalHistogramEqual({ value: hist1 }, { value: [hist1[1], hist1[0]] })).toBe(false); | ||
expect(isNumericalHistogramEqual( | ||
{ input: '', value: hist1 }, | ||
{ input: '', value: [hist1[1], hist1[0]] } | ||
)).toBe(false); | ||
}); | ||
}); |
@@ -6,2 +6,3 @@ import * as conversion from '.'; | ||
const airship = conversion.numerical({ | ||
input: '', | ||
value: [ | ||
@@ -8,0 +9,0 @@ { |
@@ -21,2 +21,10 @@ import { LegendEntry, VLCategoricalHistogram, VLNumericalHistogram } from '../../../../types'; | ||
export function date(data: VLNumericalHistogram): any[] { | ||
return data.value.map((d) => ({ | ||
end: new Date(d.x[1]), | ||
start: new Date(d.x[0]), | ||
value: d.y, | ||
})); | ||
} | ||
/** | ||
@@ -23,0 +31,0 @@ * Converts a categorical VL Histogram to Airship's Histogram widget format. |
import semver from 'semver'; | ||
import { | ||
AnimationControlsOptions, | ||
AnimationOptions, | ||
@@ -7,4 +8,6 @@ CategoricalHistogramOptions, | ||
NumericalHistogramOptions, | ||
VLBridgeOptions } from '../types'; | ||
VLBridgeOptions | ||
} from '../types'; | ||
import { getColumnName, getExpression } from '../util/Utils'; | ||
import { AnimationControls } from './animation-controls/AnimationControls'; | ||
import { BaseFilter } from './base/BaseFilter'; | ||
@@ -17,2 +20,3 @@ import { CategoryFilter } from './category/CategoryFilter'; | ||
const VL_VERSION = '^1.2.3'; | ||
@@ -46,3 +50,3 @@ | ||
private _id: string; | ||
private _animation: TimeSeries; | ||
private _animation: TimeSeries | AnimationControls; | ||
@@ -245,2 +249,3 @@ /** | ||
options: AnimationOptions = {}) { | ||
if (this._animation) { | ||
@@ -257,3 +262,4 @@ throw new Error('There can only be one animation'); | ||
fade, | ||
variableName | ||
variableName, | ||
propertyName | ||
} = options; | ||
@@ -267,7 +273,10 @@ | ||
() => { | ||
this._rebuildFilters(); | ||
if (propertyName === 'filter') { | ||
this._rebuildFilters(); | ||
} | ||
}, | ||
duration, | ||
fade, | ||
variableName | ||
variableName, | ||
propertyName | ||
); | ||
@@ -292,2 +301,50 @@ | ||
/** | ||
* Creates an animation controls widget | ||
* | ||
* By default, the animation is set to the 'filter' property, | ||
* but it is possible to animate any style property using the 'propertyName' option. | ||
* | ||
* There can only be one animation per layer (per VLBridge instance) | ||
* | ||
* @param {(any | string)} widget The Animation Controls widget, or a selector | ||
* @param {string} column The name of the column in the dataset used in the animation | ||
* @param {AnimationControlsOptions} [options={}] | ||
* @param {number} [options.duration] Animation duration in seconds. It is 10 by default | ||
* @param {[number, number]} [options.fade] Animation fade in and out. | ||
* @param {string} [options.variableName] Name of the viz variable that has the animation assigned | ||
* @param {string} [options.propertyName] Name of the style property to apply the animation, 'filter' by default. | ||
* @memberof VLBridge | ||
*/ | ||
public animationControls( | ||
widget: any | string, | ||
column: string, | ||
options: AnimationControlsOptions = {}) { | ||
const { | ||
duration, | ||
fade, | ||
variableName, | ||
propertyName = 'filter' | ||
} = options; | ||
this._animation = new AnimationControls( | ||
widget, | ||
this._carto, | ||
column, | ||
variableName, | ||
propertyName, | ||
duration, | ||
fade, | ||
this._layer, | ||
() => { | ||
if (propertyName === 'filter') { | ||
this._rebuildFilters(); | ||
} | ||
}, | ||
null | ||
); | ||
return this._animation; | ||
} | ||
/** | ||
* Creates a global range slider filter. | ||
@@ -384,3 +441,2 @@ * | ||
const variables = this._readOnlyLayer !== undefined ? this._readOnlyLayer.viz.variables : {}; | ||
for (const filter of this._vizFilters) { | ||
@@ -423,4 +479,4 @@ const name = filter.name; | ||
this._vizFilters | ||
.filter((hasFilter) => hasFilter.filter !== null) | ||
.map((hasFilter) => hasFilter.filter) | ||
.filter((hasFilter) => hasFilter.filter !== null) | ||
.map((hasFilter) => hasFilter.filter) | ||
); | ||
@@ -433,4 +489,6 @@ | ||
if (this._animation) { | ||
newFilter = `@${this._animation.variableName} and ${newFilter}`; | ||
if (this._layer.viz.filter.isAnimated() && this._animation) { | ||
if (this._layer.viz.variables[this._animation.variableName]) { | ||
newFilter = `@${this._animation.variableName} and ${newFilter}`; | ||
} | ||
} | ||
@@ -437,0 +495,0 @@ |
@@ -26,4 +26,5 @@ { | ||
"node_modules", | ||
"**/*.spec.ts" | ||
"**/*.spec.ts", | ||
"dist" | ||
] | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
392059
78
5603
2