billboard.js 3.18.0-next.2 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +319 -100
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +10 -9
- package/dist/billboard.pkgd.js +2059 -1625
- package/dist/billboard.pkgd.min.js +23 -22
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +305 -79
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-stanford.js +305 -79
- package/dist/plugin/billboardjs-plugin-stanford.min.js +11 -11
- package/dist/plugin/billboardjs-plugin-tableview.js +305 -79
- package/dist/plugin/billboardjs-plugin-tableview.min.js +6 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +305 -79
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -4
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1743 -1528
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2047 -1606
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2048 -1607
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +17 -17
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2049 -1608
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +13 -12
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2050 -1609
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -10
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/billboard.js +441 -135
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +416 -102
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +1 -1
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/internals/tooltip.ts +11 -9
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/config/Options/common/legend.ts +1 -0
- package/src/config/Options/common/point.ts +1 -1
- package/src/config/Options/common/tooltip.ts +3 -1
- package/src/module/sanitize.ts +471 -0
- package/src/module/util.ts +1 -131
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.18.0
|
|
8
|
+
* @version 3.18.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -135,7 +135,7 @@ class Plugin {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
__publicField(Plugin, "version", "3.18.0
|
|
138
|
+
__publicField(Plugin, "version", "3.18.0");
|
|
139
139
|
|
|
140
140
|
;// ./src/Plugin/bubblecompare/index.ts
|
|
141
141
|
var bubblecompare_defProp = Object.defineProperty;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.18.0
|
|
8
|
+
* @version 3.18.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
|
-
*/(function(n,i){typeof exports=="object"&&typeof module=="object"?module.exports=i(require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-selection"],i):typeof exports=="object"?exports.bb=i(require("d3-selection")):(n.bb=n.bb||{},n.bb.plugin=n.bb.plugin||{},n.bb.plugin.bubblecompare=i(n.d3))})(this,function(p){return(function(){"use strict";var n={747:(function(r){r.exports=p})},i={};function s(r){var e=i[r];if(e!==void 0)return e.exports;var t=i[r]={exports:{}};return n[r](t,t.exports,s),t.exports}(function(){s.d=function(r,e){for(var t in e)s.o(e,t)&&!s.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})}})(),(function(){s.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}})();var b={};s.d(b,{default:function(){return R}});var $=s(747),g=Object.defineProperty,
|
|
11
|
+
*/(function(n,i){typeof exports=="object"&&typeof module=="object"?module.exports=i(require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-selection"],i):typeof exports=="object"?exports.bb=i(require("d3-selection")):(n.bb=n.bb||{},n.bb.plugin=n.bb.plugin||{},n.bb.plugin.bubblecompare=i(n.d3))})(this,function(p){return(function(){"use strict";var n={747:(function(r){r.exports=p})},i={};function s(r){var e=i[r];if(e!==void 0)return e.exports;var t=i[r]={exports:{}};return n[r](t,t.exports,s),t.exports}(function(){s.d=function(r,e){for(var t in e)s.o(e,t)&&!s.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})}})(),(function(){s.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}})();var b={};s.d(b,{default:function(){return R}});var $=s(747),g=Object.defineProperty,v=(r,e,t)=>e in r?g(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l=(r,e,t)=>v(r,typeof e!="symbol"?e+"":e,t);class d{constructor(e={}){l(this,"$$"),l(this,"options"),this.options=e}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(e=>{this[e]=null,delete this[e]})}}l(d,"version","3.18.0");var x=Object.defineProperty,B=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_=(r,e,t)=>B(r,typeof e!="symbol"?e+"":e,t);const f=class m extends d{constructor(e){return super(e),_(this,"$$"),this}$init(){const{$$:e}=this;e.findClosest=this.findClosest.bind(this),e.getBubbleR=this.getBubbleR.bind(this),e.pointExpandedR=this.pointExpandedR.bind(this)}pointExpandedR(e){const t=this.getBubbleR(e),{expandScale:a=1}=this.options;return m.raiseFocusedBubbleLayer(e),this.changeCursorPoint(),t*a}static raiseFocusedBubbleLayer(e){e.raise&&(0,$.select)(e.node().parentNode.parentNode).raise()}changeCursorPoint(){this.$$.$el.eventRect.style("cursor","pointer")}findClosest(e,t){const{$$:a}=this;return e.filter(o=>o&&!a.isBarType(o.id)).reduce((o,u)=>a.dist(u,t)<this.getBubbleR(u)?u:o,0)}getBubbleR(e){const{minR:t,maxR:a}=this.options,o=this.getZData(e);if(!o)return t;const[u,c]=this.$$.data.targets.reduce(([w,C],j)=>{const h=this.getZData(j.values[0]);return[Math.min(w,h),Math.max(C,h)]},[1e4,0]),P=u>0&&c===u?0:o/c;return Math.abs(P)*(a-t)+t}getZData(e){return this.$$.isBubbleZType(e)?this.$$.getBubbleZData(e.value,"z"):e.value}};_(f,"version","0.0.1");let R=f;return b=b.default,b})()});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.18.0
|
|
8
|
+
* @version 3.18.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -308,6 +308,308 @@ const [
|
|
|
308
308
|
] = getFallback(win);
|
|
309
309
|
|
|
310
310
|
|
|
311
|
+
;// ./src/module/sanitize.ts
|
|
312
|
+
const ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
313
|
+
// HTML tags for tooltip/legend templates
|
|
314
|
+
"span",
|
|
315
|
+
"div",
|
|
316
|
+
"p",
|
|
317
|
+
"br",
|
|
318
|
+
"b",
|
|
319
|
+
"i",
|
|
320
|
+
"em",
|
|
321
|
+
"strong",
|
|
322
|
+
"u",
|
|
323
|
+
"s",
|
|
324
|
+
"sub",
|
|
325
|
+
"sup",
|
|
326
|
+
"ul",
|
|
327
|
+
"ol",
|
|
328
|
+
"li",
|
|
329
|
+
"dl",
|
|
330
|
+
"dt",
|
|
331
|
+
"dd",
|
|
332
|
+
"table",
|
|
333
|
+
"thead",
|
|
334
|
+
"tbody",
|
|
335
|
+
"tfoot",
|
|
336
|
+
"tr",
|
|
337
|
+
"th",
|
|
338
|
+
"td",
|
|
339
|
+
"caption",
|
|
340
|
+
"colgroup",
|
|
341
|
+
"col",
|
|
342
|
+
"hr",
|
|
343
|
+
"pre",
|
|
344
|
+
"code",
|
|
345
|
+
"blockquote",
|
|
346
|
+
"a",
|
|
347
|
+
"img",
|
|
348
|
+
// SVG tags for point patterns
|
|
349
|
+
"svg",
|
|
350
|
+
"g",
|
|
351
|
+
"path",
|
|
352
|
+
"circle",
|
|
353
|
+
"ellipse",
|
|
354
|
+
"rect",
|
|
355
|
+
"line",
|
|
356
|
+
"polyline",
|
|
357
|
+
"polygon",
|
|
358
|
+
"text",
|
|
359
|
+
"tspan",
|
|
360
|
+
"textPath",
|
|
361
|
+
"use",
|
|
362
|
+
"defs",
|
|
363
|
+
"symbol",
|
|
364
|
+
"clipPath",
|
|
365
|
+
"mask",
|
|
366
|
+
"linearGradient",
|
|
367
|
+
"radialGradient",
|
|
368
|
+
"stop",
|
|
369
|
+
"pattern",
|
|
370
|
+
"marker",
|
|
371
|
+
"title",
|
|
372
|
+
"desc"
|
|
373
|
+
]);
|
|
374
|
+
const ALLOWED_ATTRS = /* @__PURE__ */ new Set([
|
|
375
|
+
// Common attributes
|
|
376
|
+
"class",
|
|
377
|
+
"id",
|
|
378
|
+
"style",
|
|
379
|
+
"title",
|
|
380
|
+
"lang",
|
|
381
|
+
"dir",
|
|
382
|
+
// HTML specific
|
|
383
|
+
"href",
|
|
384
|
+
"src",
|
|
385
|
+
"alt",
|
|
386
|
+
"width",
|
|
387
|
+
"height",
|
|
388
|
+
"colspan",
|
|
389
|
+
"rowspan",
|
|
390
|
+
"scope",
|
|
391
|
+
"headers",
|
|
392
|
+
// SVG presentation attributes
|
|
393
|
+
"d",
|
|
394
|
+
"points",
|
|
395
|
+
"x",
|
|
396
|
+
"y",
|
|
397
|
+
"x1",
|
|
398
|
+
"x2",
|
|
399
|
+
"y1",
|
|
400
|
+
"y2",
|
|
401
|
+
"cx",
|
|
402
|
+
"cy",
|
|
403
|
+
"r",
|
|
404
|
+
"rx",
|
|
405
|
+
"ry",
|
|
406
|
+
"dx",
|
|
407
|
+
"dy",
|
|
408
|
+
"viewBox",
|
|
409
|
+
"preserveAspectRatio",
|
|
410
|
+
"transform",
|
|
411
|
+
"fill",
|
|
412
|
+
"fill-opacity",
|
|
413
|
+
"fill-rule",
|
|
414
|
+
"stroke",
|
|
415
|
+
"stroke-width",
|
|
416
|
+
"stroke-opacity",
|
|
417
|
+
"stroke-linecap",
|
|
418
|
+
"stroke-linejoin",
|
|
419
|
+
"stroke-dasharray",
|
|
420
|
+
"stroke-dashoffset",
|
|
421
|
+
"opacity",
|
|
422
|
+
"clip-path",
|
|
423
|
+
"clip-rule",
|
|
424
|
+
"mask",
|
|
425
|
+
"font-family",
|
|
426
|
+
"font-size",
|
|
427
|
+
"font-weight",
|
|
428
|
+
"font-style",
|
|
429
|
+
"text-anchor",
|
|
430
|
+
"dominant-baseline",
|
|
431
|
+
"offset",
|
|
432
|
+
"stop-color",
|
|
433
|
+
"stop-opacity",
|
|
434
|
+
"gradientUnits",
|
|
435
|
+
"gradientTransform",
|
|
436
|
+
"spreadMethod",
|
|
437
|
+
"patternUnits",
|
|
438
|
+
"patternTransform",
|
|
439
|
+
"marker-start",
|
|
440
|
+
"marker-mid",
|
|
441
|
+
"marker-end",
|
|
442
|
+
"markerWidth",
|
|
443
|
+
"markerHeight",
|
|
444
|
+
"refX",
|
|
445
|
+
"refY",
|
|
446
|
+
"xlink:href"
|
|
447
|
+
]);
|
|
448
|
+
const ALLOWED_URI_PROTOCOLS = /* @__PURE__ */ new Set([
|
|
449
|
+
"http:",
|
|
450
|
+
"https:",
|
|
451
|
+
"mailto:"
|
|
452
|
+
]);
|
|
453
|
+
const URI_ATTRS = /* @__PURE__ */ new Set(["href", "src", "xlink:href"]);
|
|
454
|
+
const TAG_NAME_REGEX = /^<\/?([a-zA-Z][a-zA-Z0-9]*)/;
|
|
455
|
+
const CLOSING_TAG_REGEX = /^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/;
|
|
456
|
+
const OPENING_TAG_REGEX = /^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/;
|
|
457
|
+
const ATTR_REGEX = /([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;
|
|
458
|
+
const URL_IN_STYLE_REGEX = /url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi;
|
|
459
|
+
const DANGEROUS_CSS_PATTERNS = [
|
|
460
|
+
"expression(",
|
|
461
|
+
"behavior:",
|
|
462
|
+
"binding:",
|
|
463
|
+
"@import",
|
|
464
|
+
"@charset",
|
|
465
|
+
"-moz-binding:"
|
|
466
|
+
];
|
|
467
|
+
function decodeHTMLEntities(str) {
|
|
468
|
+
return str.replace(/:/gi, ":").replace(/&newline;/gi, "\n").replace(/&tab;/gi, " ").replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/&/gi, "&").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+);/gi, (_, code) => String.fromCharCode(parseInt(code, 10))).replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
|
|
469
|
+
}
|
|
470
|
+
function isSafeURI(uri) {
|
|
471
|
+
const decoded = decodeHTMLEntities(uri).trim();
|
|
472
|
+
const normalized = decoded.replace(/[\s\u0000-\u001f]/g, "").toLowerCase();
|
|
473
|
+
if (!normalized || normalized.startsWith("#")) {
|
|
474
|
+
return true;
|
|
475
|
+
}
|
|
476
|
+
if (normalized.startsWith("/") || normalized.startsWith("./") || normalized.startsWith("../") || !normalized.includes(":")) {
|
|
477
|
+
return true;
|
|
478
|
+
}
|
|
479
|
+
const colonIndex = normalized.indexOf(":");
|
|
480
|
+
if (colonIndex > 0) {
|
|
481
|
+
const protocol = normalized.substring(0, colonIndex + 1);
|
|
482
|
+
return ALLOWED_URI_PROTOCOLS.has(protocol);
|
|
483
|
+
}
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
function sanitizeStyleValue(style) {
|
|
487
|
+
const decoded = decodeHTMLEntities(style);
|
|
488
|
+
const cleaned = decoded.replace(/[\u0000-\u001f]/g, "");
|
|
489
|
+
URL_IN_STYLE_REGEX.lastIndex = 0;
|
|
490
|
+
let match;
|
|
491
|
+
while ((match = URL_IN_STYLE_REGEX.exec(cleaned)) !== null) {
|
|
492
|
+
if (!isSafeURI(match[1])) {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
const normalizedLower = cleaned.toLowerCase().replace(/\s/g, "");
|
|
497
|
+
for (const pattern of DANGEROUS_CSS_PATTERNS) {
|
|
498
|
+
if (normalizedLower.includes(pattern)) {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return style;
|
|
503
|
+
}
|
|
504
|
+
const ATTR_ENCODE_MAP = {
|
|
505
|
+
'"': """,
|
|
506
|
+
"'": "'",
|
|
507
|
+
"`": "`"
|
|
508
|
+
};
|
|
509
|
+
const ATTR_ENCODE_REGEX = /["'`]/g;
|
|
510
|
+
function encodeAttrValue(value) {
|
|
511
|
+
return value.replace(ATTR_ENCODE_REGEX, (char) => ATTR_ENCODE_MAP[char]);
|
|
512
|
+
}
|
|
513
|
+
function sanitizeAttrValue(name, value, wasUnquoted = false) {
|
|
514
|
+
if (URI_ATTRS.has(name)) {
|
|
515
|
+
if (!isSafeURI(value)) {
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
return wasUnquoted ? encodeAttrValue(value) : value;
|
|
519
|
+
}
|
|
520
|
+
if (name === "style") {
|
|
521
|
+
const sanitizedStyle = sanitizeStyleValue(value);
|
|
522
|
+
if (sanitizedStyle === null) {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
return wasUnquoted ? encodeAttrValue(sanitizedStyle) : sanitizedStyle;
|
|
526
|
+
}
|
|
527
|
+
const decoded = decodeHTMLEntities(value).toLowerCase().replace(/\s/g, "");
|
|
528
|
+
if (/\bon\w+=/.test(decoded)) {
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
return wasUnquoted ? encodeAttrValue(value) : value;
|
|
532
|
+
}
|
|
533
|
+
function extractTagName(tag) {
|
|
534
|
+
const match = tag.match(TAG_NAME_REGEX);
|
|
535
|
+
return match ? match[1].toLowerCase() : null;
|
|
536
|
+
}
|
|
537
|
+
function isAllowedTag(tag) {
|
|
538
|
+
const tagName = extractTagName(tag);
|
|
539
|
+
return tagName !== null && ALLOWED_TAGS.has(tagName);
|
|
540
|
+
}
|
|
541
|
+
function sanitizeTag(fullTag) {
|
|
542
|
+
const closingMatch = fullTag.match(CLOSING_TAG_REGEX);
|
|
543
|
+
if (closingMatch) {
|
|
544
|
+
return `</${closingMatch[1].toLowerCase()}>`;
|
|
545
|
+
}
|
|
546
|
+
const openingMatch = fullTag.match(OPENING_TAG_REGEX);
|
|
547
|
+
if (!openingMatch) {
|
|
548
|
+
return "";
|
|
549
|
+
}
|
|
550
|
+
const [, tagName, attrString, selfClose] = openingMatch;
|
|
551
|
+
const lowerTagName = tagName.toLowerCase();
|
|
552
|
+
const allowedAttrs = [];
|
|
553
|
+
ATTR_REGEX.lastIndex = 0;
|
|
554
|
+
let attrMatch;
|
|
555
|
+
while ((attrMatch = ATTR_REGEX.exec(attrString)) !== null) {
|
|
556
|
+
const attrName = attrMatch[1].toLowerCase();
|
|
557
|
+
const doubleQuotedValue = attrMatch[2];
|
|
558
|
+
const singleQuotedValue = attrMatch[3];
|
|
559
|
+
const unquotedValue = attrMatch[4];
|
|
560
|
+
if (attrName.startsWith("on")) {
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
let attrValue;
|
|
564
|
+
let quoteChar;
|
|
565
|
+
if (doubleQuotedValue !== void 0) {
|
|
566
|
+
attrValue = doubleQuotedValue;
|
|
567
|
+
quoteChar = '"';
|
|
568
|
+
} else if (singleQuotedValue !== void 0) {
|
|
569
|
+
attrValue = singleQuotedValue;
|
|
570
|
+
quoteChar = "'";
|
|
571
|
+
} else if (unquotedValue !== void 0) {
|
|
572
|
+
attrValue = unquotedValue;
|
|
573
|
+
quoteChar = '"';
|
|
574
|
+
} else {
|
|
575
|
+
if (ALLOWED_ATTRS.has(attrName)) {
|
|
576
|
+
allowedAttrs.push(attrName);
|
|
577
|
+
}
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
if (ALLOWED_ATTRS.has(attrName)) {
|
|
581
|
+
const wasUnquoted = unquotedValue !== void 0;
|
|
582
|
+
const sanitizedValue = sanitizeAttrValue(attrName, attrValue, wasUnquoted);
|
|
583
|
+
if (sanitizedValue !== null) {
|
|
584
|
+
allowedAttrs.push(`${attrName}=${quoteChar}${sanitizedValue}${quoteChar}`);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
const attrsStr = allowedAttrs.length > 0 ? ` ${allowedAttrs.join(" ")}` : "";
|
|
589
|
+
const selfCloseStr = selfClose ? "/>" : ">";
|
|
590
|
+
return `<${lowerTagName}${attrsStr}${selfCloseStr}`;
|
|
591
|
+
}
|
|
592
|
+
function sanitize(str) {
|
|
593
|
+
if (typeof str !== "string" || !str || str.indexOf("<") === -1) {
|
|
594
|
+
return str;
|
|
595
|
+
}
|
|
596
|
+
return str.replace(
|
|
597
|
+
/<\/?[^>]*>|[^<>\s]+>/g,
|
|
598
|
+
(match) => {
|
|
599
|
+
if (match.startsWith("<!--")) {
|
|
600
|
+
return "";
|
|
601
|
+
}
|
|
602
|
+
if (!match.startsWith("<")) {
|
|
603
|
+
return match.slice(0, -1) + ">";
|
|
604
|
+
}
|
|
605
|
+
if (isAllowedTag(match)) {
|
|
606
|
+
return sanitizeTag(match);
|
|
607
|
+
}
|
|
608
|
+
return match.replace(/</g, "<");
|
|
609
|
+
}
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
|
|
311
613
|
;// ./src/module/util.ts
|
|
312
614
|
var util_defProp = Object.defineProperty;
|
|
313
615
|
var util_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -328,6 +630,7 @@ var util_spreadValues = (a, b) => {
|
|
|
328
630
|
|
|
329
631
|
|
|
330
632
|
|
|
633
|
+
|
|
331
634
|
function _getRect(relativeViewport, node, forceEval = false) {
|
|
332
635
|
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
333
636
|
if (forceEval) {
|
|
@@ -345,66 +648,6 @@ function _forEachValidItem(items, callback) {
|
|
|
345
648
|
}
|
|
346
649
|
}
|
|
347
650
|
}
|
|
348
|
-
const _sanitize = (() => {
|
|
349
|
-
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
350
|
-
const ENTITY_MAP = {
|
|
351
|
-
quot: 34,
|
|
352
|
-
amp: 38,
|
|
353
|
-
apos: 39,
|
|
354
|
-
lt: 60,
|
|
355
|
-
gt: 62,
|
|
356
|
-
nbsp: 160,
|
|
357
|
-
iexcl: 161,
|
|
358
|
-
cent: 162,
|
|
359
|
-
pound: 163,
|
|
360
|
-
curren: 164,
|
|
361
|
-
yen: 165
|
|
362
|
-
};
|
|
363
|
-
const LT_CODE = 60;
|
|
364
|
-
const GT_CODE = 62;
|
|
365
|
-
const MAX_ITERATIONS = 10;
|
|
366
|
-
const rx = {
|
|
367
|
-
tags: new RegExp(
|
|
368
|
-
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
369
|
-
"gi"
|
|
370
|
-
),
|
|
371
|
-
htmlEntity: /&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,
|
|
372
|
-
// eslint-disable-next-line no-control-regex
|
|
373
|
-
controlChar: /[\x00-\x1F\x7F]/g,
|
|
374
|
-
eventHandler: /\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,
|
|
375
|
-
dangerousUri: /(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,
|
|
376
|
-
dangerousProtocol: /^(javascript|data|vbscript):/
|
|
377
|
-
};
|
|
378
|
-
return {
|
|
379
|
-
ENTITY_MAP,
|
|
380
|
-
LT_CODE,
|
|
381
|
-
GT_CODE,
|
|
382
|
-
MAX_ITERATIONS,
|
|
383
|
-
rx,
|
|
384
|
-
/**
|
|
385
|
-
* Decode HTML entities to prevent bypass attacks
|
|
386
|
-
* @param {string} str String with potential HTML entities
|
|
387
|
-
* @returns {string} Decoded string
|
|
388
|
-
*/
|
|
389
|
-
decodeEntities(str) {
|
|
390
|
-
return str.replace(rx.htmlEntity, (match, hex, dec, named) => {
|
|
391
|
-
const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : named ? ENTITY_MAP[named.toLowerCase()] || 0 : 0;
|
|
392
|
-
return code && code !== LT_CODE && code !== GT_CODE ? String.fromCharCode(code) : match;
|
|
393
|
-
});
|
|
394
|
-
},
|
|
395
|
-
/**
|
|
396
|
-
* Remove dangerous URI protocols from attribute values
|
|
397
|
-
* @param {string} str String to sanitize
|
|
398
|
-
* @returns {string} Sanitized string
|
|
399
|
-
*/
|
|
400
|
-
removeDangerousUris(str) {
|
|
401
|
-
return str.replace(rx.dangerousUri, (match, attr, quote, value) => {
|
|
402
|
-
const normalized = value.toLowerCase().replace(/\s/g, "");
|
|
403
|
-
return rx.dangerousProtocol.test(normalized) ? `${attr}=${quote}${quote}` : match;
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
})();
|
|
408
651
|
const isValue = (v) => v || v === 0;
|
|
409
652
|
const isFunction = (v) => typeof v === "function";
|
|
410
653
|
const isString = (v) => typeof v === "string";
|
|
@@ -451,23 +694,6 @@ function endall(transition, cb) {
|
|
|
451
694
|
transition.call(end);
|
|
452
695
|
}
|
|
453
696
|
}
|
|
454
|
-
function sanitize(str) {
|
|
455
|
-
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
456
|
-
return str;
|
|
457
|
-
}
|
|
458
|
-
let result = str;
|
|
459
|
-
let prev;
|
|
460
|
-
let iterations = 0;
|
|
461
|
-
do {
|
|
462
|
-
prev = result;
|
|
463
|
-
result = _sanitize.decodeEntities(result).replace(_sanitize.rx.controlChar, "").replace(_sanitize.rx.tags, "").replace(_sanitize.rx.eventHandler, "");
|
|
464
|
-
result = _sanitize.removeDangerousUris(result);
|
|
465
|
-
if (++iterations >= _sanitize.MAX_ITERATIONS) {
|
|
466
|
-
break;
|
|
467
|
-
}
|
|
468
|
-
} while (result !== prev);
|
|
469
|
-
return result;
|
|
470
|
-
}
|
|
471
697
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
472
698
|
if (!node || !isString(text)) {
|
|
473
699
|
return;
|
|
@@ -958,7 +1184,7 @@ class Plugin {
|
|
|
958
1184
|
});
|
|
959
1185
|
}
|
|
960
1186
|
}
|
|
961
|
-
__publicField(Plugin, "version", "3.18.0
|
|
1187
|
+
__publicField(Plugin, "version", "3.18.0");
|
|
962
1188
|
|
|
963
1189
|
;// ./src/Plugin/sparkline/Options.ts
|
|
964
1190
|
class Options {
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.18.0
|
|
8
|
+
* @version 3.18.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
|
-
*/(function(
|
|
12
|
-
`)===-1)e.text(t);else{const
|
|
13
|
-
`),s=r?i.length-1:1;e.html(""),i.forEach((c,a)=>{e.append("tspan").attr("x",0).attr("dy",`${a===0?n[0]*s:n[1]}em`).text(c)})}}}function Ae(e){const{x:t,y:n,width:r,height:o}=e.getBBox();return[{x:t,y:n+o},{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o}]}function rt(e){const{width:t,height:n}=j(e),r=Ae(e),o=r[0].x,i=Math.min(r[0].y,r[1].y);return{x:o,y:i,width:t,height:n}}function ot(e,t){var n;const r=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let o=[0,0];try{o=d3Pointer(r||e,t)}catch(i){}return o.map(i=>isNaN(i)?0:i)}function Ce(e){const{event:t,$el:n}=e,r=n.subchart.main||n.main;let o;return t&&t.type==="brush"?o=t.selection:r&&(o=r.select(".bb-brush").node())&&(o=d3BrushSelection(o)),o}function j(e,t=!1){return D(!0,e,t)}function it(e,t=!1){return D(!1,e,t)}function st(e=!0,t=0,n=1e4){const r=window.crypto||window.msCrypto,o=r?t+r.getRandomValues(new Uint32Array(1))[0]%(n-t+1):Math.floor(Math.random()*(n-t)+t);return e?String(o):o}function B(e,t,n,r,o){if(n>r)return-1;const i=Math.floor((n+r)/2);let{x:s,w:c=0}=e[i];return o&&(s=e[i].y,c=e[i].h),t>=s&&t<=s+c?i:t<s?B(e,t,n,i-1,o):B(e,t,i+1,r,o)}function ct(e){const t=Ce(e);return t?t[0]===t[1]:!0}function lt(...e){const t=n=>{if(_(n)&&n.constructor){const r=new n.constructor;for(const o in n)r[o]=t(n[o]);return r}return n};return e.map(n=>t(n)).reduce((n,r)=>M(M({},n),r))}function Pe(e={},t){$(t)&&t.forEach(n=>Pe(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}const at=e=>e.charAt(0).toUpperCase()+e.slice(1);function ut(e,t="-"){return e.split(t).map((n,r)=>r?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Re=e=>[].slice.call(e);function bt(e,t,n){const{rootSelector:r="",sheet:o}=e,s=`${r} ${(c=>c.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${n.join(";")}}`;return o[o.insertRule?"insertRule":"addRule"](s,o.cssRules.length)}function dt(e){let t=[];return e.forEach(n=>{var r;try{n.cssRules&&n.cssRules.length&&(t=t.concat(Re(n.cssRules)))}catch(o){(r=window.console)==null||r.warn(`Error while reading rules from ${n.href}: ${o.toString()}`)}}),t}function ft(e){var t,n,r,o,i,s;return{x:((n=(t=window.pageXOffset)!=null?t:window.scrollX)!=null?n:0)+((r=e.scrollLeft)!=null?r:0),y:((i=(o=window.pageYOffset)!=null?o:window.scrollY)!=null?i:0)+((s=e.scrollTop)!=null?s:0)}}function ht(e,t=0,n=0,r=!0){const o=new DOMPoint(t,n),i=e.getScreenCTM(),s=o.matrixTransform(r?i==null?void 0:i.inverse():i);if(r===!1){const c=j(e);s.x-=c.x,s.y-=c.y}return s}function pt(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function gt(e){const t=e[0]instanceof Date,n=(t?e.map(Number):e).filter((r,o,i)=>i.indexOf(r)===o);return t?n.map(r=>new Date(r)):n}function mt(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function E(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return _(e)&&_(n)&&Object.keys(n).forEach(r=>{if(!/^(__proto__|constructor|prototype)$/i.test(r)){const o=n[r];_(o)?(!e[r]&&(e[r]={}),e[r]=E(e[r],o)):e[r]=$(o)?o.concat():o}}),E(e,...t)}function Ie(e,t=!0){let n;return e[0]instanceof Date?n=t?(r,o)=>r-o:(r,o)=>o-r:t&&!e.every(isNaN)?n=(r,o)=>r-o:t||(n=(r,o)=>r>o&&-1||r<o&&1||r===o&&0),e.concat().sort(n)}function _t(e,t){let n=t.filter(r=>Oe(r));return n.length?y(n[0])?n=Math[e](...n):n[0]instanceof Date&&(n=Ie(n,e==="min")[0]):n=void 0,n}const vt=(e,t,n=1)=>{const r=[],o=Math.max(0,Math.ceil((t-e)/n))|0;for(let i=e;i<o;i++)r.push(e+i*n);return r},xt={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,r=e())=>{t.dispatchEvent(new MouseEvent(n,r))}}catch(t){return(n,r,o=e())=>{const i=me.createEvent("MouseEvent");i.initMouseEvent(r,o.bubbles,o.cancelable,x,0,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(i)}}})(),touch:(e,t,n)=>{const r=new Touch(E({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[r],targetTouches:[],changedTouches:[r]}))}};function yt(e,t){let n=e;for(const r in t)n=n.replace(new RegExp(`{=${r}}`,"g"),t[r]);return Te(n)}function wt(e){var t;let n;if(e instanceof Date)n=e;else if(m(e)){const{config:r,format:o}=this;n=(t=o.dataTime(r.data_xFormat)(e))!=null?t:new Date(e)}else y(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function $t(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function Et(e,t,n=!1){const r=!!e.node;let o=!1;for(const[i,s]of Object.entries(t))if(o=r?e.style(i)===s:e.style[i]===s,n===!1&&o)break;return o}function Ot(){var e,t;return((e=document)==null?void 0:e.hidden)===!1||((t=document)==null?void 0:t.visibilityState)==="visible"}function Tt(e,t){const{DocumentTouch:n,matchMedia:r,navigator:o}=window,i=r==null?void 0:r("(pointer:coarse)").matches;let s=!1;if(t)if(o&&"maxTouchPoints"in o)s=o.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)s=!0;else if(i)s=!0;else{const a=o.userAgent;s=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(a)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(a)}return e&&!i&&(r==null?void 0:r("(pointer:fine)").matches)&&"mouse"||s&&"touch"||"mouse"}function Se(e,t){t()===!1?requestAnimationFrame(()=>Se(e,t)):e()}function At(e){if(_(e)&&!m(e)){const s=e;return{top:s.top||0,right:s.right||0,bottom:s.bottom||0,left:s.left||0}}const t=(m(e)?e.trim().split(/\s+/):[e]).map(s=>+s||0),[n,r=n,o=n,i=r]=t;return{top:n,right:r,bottom:o,left:i}}function Ct(e,t){e.pendingRaf!==null?(window.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=window.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=window.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}function Pt(e,t=(n=>n)){const n=new Set;return F(e,(r,o)=>{n.add(t(r,o))}),n}function Rt(e,t,n=(r=>r)){const r=new Map;return F(e,(o,i)=>{r.set(t(o,i),n(o,i))}),r}function Le(e){const t=this.config;let n,r,o;const i=()=>{const s=r.shift();if(s&&n&&w(n)&&s in n)return n=n[s],i();if(!s)return n};Object.keys(t).forEach(s=>{n=e,r=s.split("_"),o=i(),N(o)&&(t[s]=o)}),this.api&&(this.state.orgConfig=e)}var Me=Object.defineProperty,De=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t,n)=>De(e,typeof t!="symbol"?t+"":t,n);class q{constructor(t={}){O(this,"$$"),O(this,"options"),this.options=t}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}O(q,"version","3.18.0-next.2");class Fe{constructor(){return{selector:void 0}}}var Ne=Object.defineProperty,je=(e,t,n)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t,n)=>je(e,typeof t!="symbol"?t+"":t,n);class k extends q{constructor(t){return super(t),T(this,"config"),T(this,"element"),this.config=new Fe,this}$beforeInit(){Le.call(this,this.options),this.validate(),this.element=[].slice.call(document.querySelectorAll(this.config.selector)),this.overrideInternals(),this.overrideOptions(),this.overHandler=this.overHandler.bind(this),this.moveHandler=this.moveHandler.bind(this),this.outHandler=this.outHandler.bind(this)}validate(){const{$$:t,config:n}=this;let r="";if((!n.selector||!document.querySelector(n.selector))&&(r="No holder elements found from given selector option."),(t.hasType("bubble")||t.hasType("scatter")||t.hasArcType(t.data.targets))&&(r="Contains non supported chart types."),r)throw new Error(`[Sparkline plugin] ${r}`)}overrideInternals(){const{$$:t}=this,{getBarW:n,getIndices:r}=t;t.getIndices=function(o,i,s){return s==="getShapeX"?{}:r.call(this,o,i)},t.getBarW=function(o,i){return n.call(this,o,i,1)}}overrideOptions(){const{config:t}=this.$$;if(t.legend_show=!1,t.resize_auto=!1,t.axis_x_show=!1,t.padding!==!1){const n=r=>Object.keys(r||{}).length>0;n(t.axis_x_padding)&&(t.axis_x_padding={left:15,right:15,unit:"px"}),n(t.axis_y_padding)&&(t.axis_y_padding=5)}t.axis_y_show=!1,t.tooltip_position||(t.tooltip_position=function(n,r,o){const{internal:{state:{event:i}}}=this;let s=i.pageY-o*1.35,c=i.pageX-r/2;return s<0&&(s=0),c<0&&(c=0),{top:s,left:c}})}$init(){var t;const{$$:{$el:n}}=this;n.chart.style("width","0").style("height","0").style("pointer-events","none"),(t=n.tooltip)!=null&&t.node()&&document.body.appendChild(n.tooltip.node())}$afterInit(){const{$$:t}=this;t.$el.svg.attr("style",null).style("width","0").style("height","0"),this.bindEvents(!0)}bindEvents(t=!0){const{$$:{config:n}}=this;if(n.interaction_enabled&&n.tooltip_show){const r=`${t?"add":"remove"}EventListener`;this.element.forEach(o=>{const i=o.querySelector("svg");i[r]("mouseover",this.overHandler),i[r]("mousemove",this.moveHandler),i[r]("mouseout",this.outHandler)})}}overHandler(t){const{$$:n}=this,{state:{eventReceiver:r}}=n;r.rect=t.target.getBoundingClientRect()}moveHandler(t){var n,r,o,i;const{$$:s}=this,c=s.getDataIndexFromEvent(t),a=(n=s.api.data(t.target.__id))==null?void 0:n[0],u=(r=a==null?void 0:a.values)==null?void 0:r[c];u&&!u.name&&(u.name=u.id),s.state.event=t,(o=s.isPointFocusOnly)!=null&&o.call(s)&&u&&((i=s.showCircleFocus)==null||i.call(s,[u])),s.setExpand(c,a.id,!0),s.showTooltip([u],t.target)}outHandler(t){const{$$:n}=this;n.state.event=t,n.isPointFocusOnly()?n.hideCircleFocus():n.unexpandCircles(),n.hideTooltip()}$redraw(){var t;const{$$:n}=this,{$el:r}=n;let o=this.element;const i=n.api.data(),s=(t=r.chart.html().match(/<svg[^>]*>/))==null?void 0:t[0];if(o.length<i.length){const c=r.chart.node();for(let a=i.length-o.length;a>0;a--)c.parentNode.insertBefore(o[0].cloneNode(),c.nextSibling);this.element=document.querySelectorAll(this.config.selector),o=this.element}i.map(c=>c.id).forEach((c,a)=>{const u=`.${I.target}-${c}`,h=r.main.selectAll(u);let b=o[a].querySelector("svg");b||(o[a].innerHTML=`${s}</svg>`,b=o[a].querySelector("svg"),b.__id=c),b.querySelector(u)||h.style("opacity",null),h.style("fill","none").style("opacity",null),b.innerHTML="",b.appendChild(h.node())})}$willDestroy(){this.bindEvents(!1),this.element.forEach(t=>{t.innerHTML=""})}}return T(k,"version","0.0.1"),v=v.default,v})()});
|
|
11
|
+
*/(function(b,f){typeof exports=="object"&&typeof module=="object"?module.exports=f(require("d3-brush"),require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-brush","d3-selection"],f):typeof exports=="object"?exports.bb=f(require("d3-brush"),require("d3-selection")):(b.bb=b.bb||{},b.bb.plugin=b.bb.plugin||{},b.bb.plugin.sparkline=f(b.d3,b.d3))})(this,function(T,b){return(function(){"use strict";var f={747:(function(e){e.exports=b}),853:(function(e){e.exports=T})},A={};function d(e){var t=A[e];if(t!==void 0)return t.exports;var n=A[e]={exports:{}};return f[e](n,n.exports,d),n.exports}(function(){d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(function(){d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var m={};d.d(m,{default:function(){return q}});var H=Object.defineProperty,C=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,P=(e,t,n)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,c=(e,t)=>{for(var n in t||(t={}))k.call(t,n)&&P(e,n,t[n]);if(C)for(var n of C(t))U.call(t,n)&&P(e,n,t[n]);return e};const R={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},X={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},V={area:"bb-area",areas:"bb-areas"},Y={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},G={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},z={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},W={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},K={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Z={dragarea:"bb-dragarea",INCLUDED:"_included_"},J={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},Q={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},ee={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},te={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},ne={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},re={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},ie={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},Be={level:"bb-level",levels:"bb-levels"},oe={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},se={region:"bb-region",regions:"bb-regions"},ce={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},le={shape:"bb-shape",shapes:"bb-shapes"},ae={brush:"bb-brush",subchart:"bb-subchart"},ue={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},be={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},de={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},fe={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var je=c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c({},R),X),V),Y),G),z),W),K),Z),Q),ee),te),ne),re),J),ie),oe),se),ce),le),ae),ue),be),de),fe),Ne=d(853),qe=d(747);function he(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof global=="object"&&global!==null&&global.Object===Object&&global||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function pe(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",r=o=>setTimeout(o,1),i=o=>clearTimeout(o);return[t?e.requestAnimationFrame:r,t?e.cancelAnimationFrame:i,n?e.requestIdleCallback:r,n?e.cancelIdleCallback:i]}const _=he(),ge=_==null?void 0:_.document,[He,ke,Ue,Xe]=pe(_);var me=Object.defineProperty,I=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,L=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t)=>{for(var n in t||(t={}))_e.call(t,n)&&L(e,n,t[n]);if(I)for(var n of I(t))ve.call(t,n)&&L(e,n,t[n]);return e};function S(e,t,n=!1){const r=i=>i[e?"getBoundingClientRect":"getBBox"]();return n?r(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=r(t):t.rect}function D(e,t){for(let n=0;n<e.length;n++){const r=e[n];r&&t(r,n)}}const Ve=e=>e||e===0,xe=e=>typeof e=="function",p=e=>typeof e=="string",v=e=>typeof e=="number",ye=e=>typeof e=="undefined",F=e=>typeof e!="undefined",Ye=e=>typeof e=="boolean",Ge=e=>Math.ceil(e/10)*10,ze=e=>Math.ceil(e)+.5,We=e=>e[1]-e[0],x=e=>typeof e=="object",we=e=>{for(const t in e)return!1;return!0},$e=e=>ye(e)||e===null||p(e)&&e.length===0||x(e)&&!(e instanceof Date)&&we(e)||v(e)&&isNaN(e),Ee=e=>!$e(e),y=e=>Array.isArray(e),g=e=>e&&!(e!=null&&e.nodeType)&&x(e)&&!y(e);function Ke(e,t,n){return F(e[t])?e[t]:n}function Ze(e,t){let n=!1;return Object.keys(e).forEach(r=>e[r]===t&&(n=!0)),n}function Je(e,t,...n){const r=xe(e);return r&&e.call(t,...n),r}function Qe(e,t){let n=0;const r=function(...i){!--n&&t.apply(this,...i)};"duration"in e?e.each(()=>++n).on("end",r):(++n,e.call(r))}function et(e,t,n=[-1,1],r=!1){if(!(!e||!p(t)))if(t.indexOf(`
|
|
12
|
+
`)===-1)e.text(t);else{const i=[e.text(),t].map(o=>o.replace(/[\s\n]/g,""));if(i[0]!==i[1]){const o=t.split(`
|
|
13
|
+
`),s=r?o.length-1:1;e.html(""),o.forEach((l,a)=>{e.append("tspan").attr("x",0).attr("dy",`${a===0?n[0]*s:n[1]}em`).text(l)})}}}function Oe(e){const{x:t,y:n,width:r,height:i}=e.getBBox();return[{x:t,y:n+i},{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+i}]}function tt(e){const{width:t,height:n}=B(e),r=Oe(e),i=r[0].x,o=Math.min(r[0].y,r[1].y);return{x:i,y:o,width:t,height:n}}function nt(e,t){var n;const r=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let i=[0,0];try{i=d3Pointer(r||e,t)}catch(o){}return i.map(o=>isNaN(o)?0:o)}function Te(e){const{event:t,$el:n}=e,r=n.subchart.main||n.main;let i;return t&&t.type==="brush"?i=t.selection:r&&(i=r.select(".bb-brush").node())&&(i=d3BrushSelection(i)),i}function B(e,t=!1){return S(!0,e,t)}function rt(e,t=!1){return S(!1,e,t)}function it(e=!0,t=0,n=1e4){const r=window.crypto||window.msCrypto,i=r?t+r.getRandomValues(new Uint32Array(1))[0]%(n-t+1):Math.floor(Math.random()*(n-t)+t);return e?String(i):i}function j(e,t,n,r,i){if(n>r)return-1;const o=Math.floor((n+r)/2);let{x:s,w:l=0}=e[o];return i&&(s=e[o].y,l=e[o].h),t>=s&&t<=s+l?o:t<s?j(e,t,n,o-1,i):j(e,t,o+1,r,i)}function ot(e){const t=Te(e);return t?t[0]===t[1]:!0}function st(...e){const t=n=>{if(g(n)&&n.constructor){const r=new n.constructor;for(const i in n)r[i]=t(n[i]);return r}return n};return e.map(n=>t(n)).reduce((n,r)=>M(M({},n),r))}function Ae(e={},t){y(t)&&t.forEach(n=>Ae(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}const ct=e=>e.charAt(0).toUpperCase()+e.slice(1);function lt(e,t="-"){return e.split(t).map((n,r)=>r?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Ce=e=>[].slice.call(e);function at(e,t,n){const{rootSelector:r="",sheet:i}=e,s=`${r} ${(l=>l.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${n.join(";")}}`;return i[i.insertRule?"insertRule":"addRule"](s,i.cssRules.length)}function ut(e){let t=[];return e.forEach(n=>{var r;try{n.cssRules&&n.cssRules.length&&(t=t.concat(Ce(n.cssRules)))}catch(i){(r=window.console)==null||r.warn(`Error while reading rules from ${n.href}: ${i.toString()}`)}}),t}function bt(e){var t,n,r,i,o,s;return{x:((n=(t=window.pageXOffset)!=null?t:window.scrollX)!=null?n:0)+((r=e.scrollLeft)!=null?r:0),y:((o=(i=window.pageYOffset)!=null?i:window.scrollY)!=null?o:0)+((s=e.scrollTop)!=null?s:0)}}function dt(e,t=0,n=0,r=!0){const i=new DOMPoint(t,n),o=e.getScreenCTM(),s=i.matrixTransform(r?o==null?void 0:o.inverse():o);if(r===!1){const l=B(e);s.x-=l.x,s.y-=l.y}return s}function ft(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function ht(e){const t=e[0]instanceof Date,n=(t?e.map(Number):e).filter((r,i,o)=>o.indexOf(r)===i);return t?n.map(r=>new Date(r)):n}function pt(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function w(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return g(e)&&g(n)&&Object.keys(n).forEach(r=>{if(!/^(__proto__|constructor|prototype)$/i.test(r)){const i=n[r];g(i)?(!e[r]&&(e[r]={}),e[r]=w(e[r],i)):e[r]=y(i)?i.concat():i}}),w(e,...t)}function Pe(e,t=!0){let n;return e[0]instanceof Date?n=t?(r,i)=>r-i:(r,i)=>i-r:t&&!e.every(isNaN)?n=(r,i)=>r-i:t||(n=(r,i)=>r>i&&-1||r<i&&1||r===i&&0),e.concat().sort(n)}function gt(e,t){let n=t.filter(r=>Ee(r));return n.length?v(n[0])?n=Math[e](...n):n[0]instanceof Date&&(n=Pe(n,e==="min")[0]):n=void 0,n}const mt=(e,t,n=1)=>{const r=[],i=Math.max(0,Math.ceil((t-e)/n))|0;for(let o=e;o<i;o++)r.push(e+o*n);return r},_t={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,r=e())=>{t.dispatchEvent(new MouseEvent(n,r))}}catch(t){return(n,r,i=e())=>{const o=ge.createEvent("MouseEvent");o.initMouseEvent(r,i.bubbles,i.cancelable,_,0,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(o)}}})(),touch:(e,t,n)=>{const r=new Touch(w({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[r],targetTouches:[],changedTouches:[r]}))}};function vt(e,t){let n=e;for(const r in t)n=n.replace(new RegExp(`{=${r}}`,"g"),t[r]);return sanitize(n)}function xt(e){var t;let n;if(e instanceof Date)n=e;else if(p(e)){const{config:r,format:i}=this;n=(t=i.dataTime(r.data_xFormat)(e))!=null?t:new Date(e)}else v(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function yt(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function wt(e,t,n=!1){const r=!!e.node;let i=!1;for(const[o,s]of Object.entries(t))if(i=r?e.style(o)===s:e.style[o]===s,n===!1&&i)break;return i}function $t(){var e,t;return((e=document)==null?void 0:e.hidden)===!1||((t=document)==null?void 0:t.visibilityState)==="visible"}function Et(e,t){const{DocumentTouch:n,matchMedia:r,navigator:i}=window,o=r==null?void 0:r("(pointer:coarse)").matches;let s=!1;if(t)if(i&&"maxTouchPoints"in i)s=i.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)s=!0;else if(o)s=!0;else{const a=i.userAgent;s=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(a)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(a)}return e&&!o&&(r==null?void 0:r("(pointer:fine)").matches)&&"mouse"||s&&"touch"||"mouse"}function Re(e,t){t()===!1?requestAnimationFrame(()=>Re(e,t)):e()}function Ot(e){if(g(e)&&!p(e)){const s=e;return{top:s.top||0,right:s.right||0,bottom:s.bottom||0,left:s.left||0}}const t=(p(e)?e.trim().split(/\s+/):[e]).map(s=>+s||0),[n,r=n,i=n,o=r]=t;return{top:n,right:r,bottom:i,left:o}}function Tt(e,t){e.pendingRaf!==null?(window.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=window.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=window.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}function At(e,t=(n=>n)){const n=new Set;return D(e,(r,i)=>{n.add(t(r,i))}),n}function Ct(e,t,n=(r=>r)){const r=new Map;return D(e,(i,o)=>{r.set(t(i,o),n(i,o))}),r}function Ie(e){const t=this.config;let n,r,i;const o=()=>{const s=r.shift();if(s&&n&&x(n)&&s in n)return n=n[s],o();if(!s)return n};Object.keys(t).forEach(s=>{n=e,r=s.split("_"),i=o(),F(i)&&(t[s]=i)}),this.api&&(this.state.orgConfig=e)}var Le=Object.defineProperty,Me=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);class N{constructor(t={}){$(this,"$$"),$(this,"options"),this.options=t}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}$(N,"version","3.18.0");class Se{constructor(){return{selector:void 0}}}var De=Object.defineProperty,Fe=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t,n)=>Fe(e,typeof t!="symbol"?t+"":t,n);class q extends N{constructor(t){return super(t),E(this,"config"),E(this,"element"),this.config=new Se,this}$beforeInit(){Ie.call(this,this.options),this.validate(),this.element=[].slice.call(document.querySelectorAll(this.config.selector)),this.overrideInternals(),this.overrideOptions(),this.overHandler=this.overHandler.bind(this),this.moveHandler=this.moveHandler.bind(this),this.outHandler=this.outHandler.bind(this)}validate(){const{$$:t,config:n}=this;let r="";if((!n.selector||!document.querySelector(n.selector))&&(r="No holder elements found from given selector option."),(t.hasType("bubble")||t.hasType("scatter")||t.hasArcType(t.data.targets))&&(r="Contains non supported chart types."),r)throw new Error(`[Sparkline plugin] ${r}`)}overrideInternals(){const{$$:t}=this,{getBarW:n,getIndices:r}=t;t.getIndices=function(i,o,s){return s==="getShapeX"?{}:r.call(this,i,o)},t.getBarW=function(i,o){return n.call(this,i,o,1)}}overrideOptions(){const{config:t}=this.$$;if(t.legend_show=!1,t.resize_auto=!1,t.axis_x_show=!1,t.padding!==!1){const n=r=>Object.keys(r||{}).length>0;n(t.axis_x_padding)&&(t.axis_x_padding={left:15,right:15,unit:"px"}),n(t.axis_y_padding)&&(t.axis_y_padding=5)}t.axis_y_show=!1,t.tooltip_position||(t.tooltip_position=function(n,r,i){const{internal:{state:{event:o}}}=this;let s=o.pageY-i*1.35,l=o.pageX-r/2;return s<0&&(s=0),l<0&&(l=0),{top:s,left:l}})}$init(){var t;const{$$:{$el:n}}=this;n.chart.style("width","0").style("height","0").style("pointer-events","none"),(t=n.tooltip)!=null&&t.node()&&document.body.appendChild(n.tooltip.node())}$afterInit(){const{$$:t}=this;t.$el.svg.attr("style",null).style("width","0").style("height","0"),this.bindEvents(!0)}bindEvents(t=!0){const{$$:{config:n}}=this;if(n.interaction_enabled&&n.tooltip_show){const r=`${t?"add":"remove"}EventListener`;this.element.forEach(i=>{const o=i.querySelector("svg");o[r]("mouseover",this.overHandler),o[r]("mousemove",this.moveHandler),o[r]("mouseout",this.outHandler)})}}overHandler(t){const{$$:n}=this,{state:{eventReceiver:r}}=n;r.rect=t.target.getBoundingClientRect()}moveHandler(t){var n,r,i,o;const{$$:s}=this,l=s.getDataIndexFromEvent(t),a=(n=s.api.data(t.target.__id))==null?void 0:n[0],u=(r=a==null?void 0:a.values)==null?void 0:r[l];u&&!u.name&&(u.name=u.id),s.state.event=t,(i=s.isPointFocusOnly)!=null&&i.call(s)&&u&&((o=s.showCircleFocus)==null||o.call(s,[u])),s.setExpand(l,a.id,!0),s.showTooltip([u],t.target)}outHandler(t){const{$$:n}=this;n.state.event=t,n.isPointFocusOnly()?n.hideCircleFocus():n.unexpandCircles(),n.hideTooltip()}$redraw(){var t;const{$$:n}=this,{$el:r}=n;let i=this.element;const o=n.api.data(),s=(t=r.chart.html().match(/<svg[^>]*>/))==null?void 0:t[0];if(i.length<o.length){const l=r.chart.node();for(let a=o.length-i.length;a>0;a--)l.parentNode.insertBefore(i[0].cloneNode(),l.nextSibling);this.element=document.querySelectorAll(this.config.selector),i=this.element}o.map(l=>l.id).forEach((l,a)=>{const u=`.${R.target}-${l}`,O=r.main.selectAll(u);let h=i[a].querySelector("svg");h||(i[a].innerHTML=`${s}</svg>`,h=i[a].querySelector("svg"),h.__id=l),h.querySelector(u)||O.style("opacity",null),O.style("fill","none").style("opacity",null),h.innerHTML="",h.appendChild(O.node())})}$willDestroy(){this.bindEvents(!1),this.element.forEach(t=>{t.innerHTML=""})}}return E(q,"version","0.0.1"),m=m.default,m})()});
|