text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vegaTooltip={})}(this,function(t){"use strict";var i=function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};var e="#vg-tooltip-element {\n  visibility: hidden;\n  padding: 8px;\n  position: fixed;\n  z-index: 1000;\n  font-family: sans-serif;\n  font-size: 11px;\n  border-radius: 3px;\n  box-shadow: 2px 2px 4px rgba(0,0,0,0.1);\n\n  /* The default theme is the light theme. */\n  background-color: rgba(255, 255, 255, 0.95);\n  border: 1px solid #d9d9d9;\n  color: black;\n}\n#vg-tooltip-element.visible {\n  visibility: visible;\n}\n#vg-tooltip-element h2 {\n  margin-top: 0;\n  margin-bottom: 10px;\n  font-size: 13px;\n}\n#vg-tooltip-element table {\n  border-spacing: 0;\n}\n#vg-tooltip-element td {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  padding-top: 2px;\n  padding-bottom: 2px;\n}\n#vg-tooltip-element td.key {\n  color: #808080;\n  max-width: 150px;\n  text-align: right;\n  padding-right: 4px;\n}\n#vg-tooltip-element td.value {\n  display: block;\n  max-width: 300px;\n  max-height: 7em;\n  text-align: left;\n}\n\n/* Dark and light color themes */\n#vg-tooltip-element.dark-theme {\n  background-color: rgba(32, 32, 32, 0.9);\n  border: 1px solid #f5f5f5;\n  color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n  color: #bfbfbf;\n}\n\n#vg-tooltip-element.light-theme {\n  background-color: rgba(255, 255, 255, 0.95);\n  border: 1px solid #d9d9d9;\n  color: black;\n}\n#vg-tooltip-element.light-theme td.key {\n  color: #808080;\n}",n="vg-tooltip-element",o={offsetX:10,offsetY:10,id:n,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:r,maxDepth:2};function r(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;")}function l(t){if(!/^[A-Za-z]+[-:.\w]*$/.test(t))throw new Error("Invalid HTML ID");return e.toString().replace(n,t)}function s(t,e,n){return t.fields=e||[],t.fname=n,t}function c(t){throw Error(t)}var p=Array.isArray;function f(t){return t===Object(t)}function h(t){return"string"==typeof t}function a(t){return p(t)?"["+t.map(a)+"]":f(t)||h(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}var d,u,g,m,b=[];g=function(t){var e,n,i,o=[],r=null,l=0,s=t.length,a="";function d(){o.push(a+t.substring(e,n)),a="",e=n+1}for(t+="",e=n=0;n<s;++n)if("\\"===(i=t[n]))a+=t.substring(e,n),e=++n;else if(i===r)d(),r=null,l=-1;else{if(r)continue;e===l&&'"'===i?(e=n+1,r=i):e===l&&"'"===i?(e=n+1,r=i):"."!==i||l?"["===i?(e<n&&d(),l=e=n+1):"]"===i&&(l||c("Access path missing open bracket: "+t),0<l&&d(),l=0,e=n+1):e<n?d():e=n+1}return l&&c("Access path missing closing bracket: "+t),r&&c("Access path missing closing quote: "+t),e<n&&(n++,d()),o}(d="id"),m="return _["+g.map(a).join("][")+"];",s(Function("_",m),[d=1===g.length?g[0]:d],u||d),s(function(t){return t},b,"identity"),s(function(){return 0},b,"zero"),s(function(){return 1},b,"one"),s(function(){return!0},b,"true"),s(function(){return!1},b,"false");function v(t,e,n){if(p(t))return"["+t.map(function(t){return e(h(t)?t:x(t,n))}).join(", ")+"]";if(f(t)){var i="",o=t,r=o.title,l=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&(n[i[o]]=t[i[o]])}return n}(o,["title"]);r&&(i+="<h2>"+e(r)+"</h2>");var s=Object.keys(l);if(0<s.length){i+="<table>";for(var a=0,d=s;a<d.length;a++){var c=d[a],u=l[c];f(u)&&(u=x(u,n)),i+='<tr><td class="key">'+e(c)+':</td><td class="value">'+e(u)+"</td></tr>"}i+="</table>"}return i||"{}"}return e(t)}function y(i){var o=[];return function(t,e){if("object"!=typeof e||null===e)return e;var n=o.indexOf(this)+1;return o.length=n,o.length>i?"[Object]":0<=o.indexOf(e)?"[Circular]":(o.push(e),e)}}function x(t,e){return JSON.stringify(t,y(e))}function w(t,e,n,i){var o=t.clientX+n;o+e.width>window.innerWidth&&(o=+t.clientX-n-e.width);var r=t.clientY+i;return r+e.height>window.innerHeight&&(r=+t.clientY-i-e.height),{x:o,y:r}}var O=function(){function t(t){this.options=i({},o,t);var e=this.options.id;if(this.call=this.tooltip_handler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){var n=document.createElement("style");n.setAttribute("id",this.options.styleId),n.innerHTML=l(e),0<document.head.childNodes.length?document.head.insertBefore(n,document.head.childNodes[0]):document.head.appendChild(n)}this.el=document.getElementById(e),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",e),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el))}return t.prototype.tooltip_handler=function(t,e,n,i){if(null!=i&&""!==i){this.el.innerHTML=v(i,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",this.options.theme+"-theme");var o=w(e,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY),r=o.x,l=o.y;this.el.setAttribute("style","top: "+l+"px; left: "+r+"px")}else this.el.classList.remove("visible",this.options.theme+"-theme")},t}();t.default=function(t,e){var n=new O(e);return t.tooltip(n.call).run(),n},t.DEFAULT_OPTIONS=o,t.escapeHTML=r,t.createDefaultStyle=l,t.formatValue=v,t.replacer=y,t.stringify=x,t.calculatePosition=w,t.Handler=O,Object.defineProperty(t,"__esModule",{value:!0})});