@bino-bi/bn-template-engine 1.0.0-alpha.2 → 1.0.0-alpha.3

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.
Files changed (88) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-a95ccc16.entry.js → p-1970906d.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-0ca8dc17.entry.js → p-1dbd339c.entry.js} +1 -1
  4. package/dist/bn-template-engine/p-2e68cf09.entry.js +1 -0
  5. package/dist/bn-template-engine/{p-bc59ea5c.entry.js → p-31cc6a2d.entry.js} +1 -1
  6. package/dist/bn-template-engine/{p--PSoPbDM.js → p-8tsCnxIz.js} +1 -1
  7. package/dist/bn-template-engine/{p-dd9dd407.entry.js → p-997b2fe4.entry.js} +1 -1
  8. package/dist/bn-template-engine/{p-DgfL-ffj.js → p-B4ySv9KQ.js} +1 -1
  9. package/dist/bn-template-engine/{p-DVo6aZUE.js → p-BL8gyUwE.js} +1 -1
  10. package/dist/bn-template-engine/{p-CvXqez4D.js → p-C0yAPzJz.js} +1 -1
  11. package/dist/bn-template-engine/p-DtdQCMzj.js +1 -0
  12. package/dist/bn-template-engine/{p-e102a490.entry.js → p-a90f1cbe.entry.js} +1 -1
  13. package/dist/bn-template-engine/{p-35638ad0.entry.js → p-d7f0cbaf.entry.js} +1 -1
  14. package/dist/bn-template-engine/{p-1d9a3be9.entry.js → p-dfb61aa5.entry.js} +1 -1
  15. package/dist/bn-template-engine/{p-f89e55c6.entry.js → p-ece17f84.entry.js} +1 -1
  16. package/dist/bn-template-engine/p-fd427179.entry.js +1 -0
  17. package/dist/bn-template-engine/p-sqjrku2z.js +1 -0
  18. package/dist/cjs/{DataFormatDigits-CbIVfGEH.js → DataFormatDigits-DAmZzqbD.js} +1 -1
  19. package/dist/cjs/{DateStringFactory-CfkXYAMN.js → DateStringFactory-CcluhpGI.js} +1 -1
  20. package/dist/cjs/{Order-DtpbD8mQ.js → Order-BKoDS21t.js} +28 -0
  21. package/dist/cjs/{SVGVariancesStyleGroup-D-rTWlDo.js → SVGVariancesStyleGroup-DYYAU-81.js} +1 -1
  22. package/dist/cjs/{StringAdapter-ByCHdlDO.js → StringAdapter-Bneo8T4k.js} +1 -1
  23. package/dist/cjs/bn-body_4.cjs.entry.js +4 -4
  24. package/dist/cjs/bn-chart-structure.cjs.entry.js +3 -3
  25. package/dist/cjs/bn-chart-time.cjs.entry.js +3 -3
  26. package/dist/cjs/bn-context_5.cjs.entry.js +115 -44
  27. package/dist/cjs/bn-grid.cjs.entry.js +3 -3
  28. package/dist/cjs/bn-image.cjs.entry.js +3 -3
  29. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  30. package/dist/cjs/bn-text.cjs.entry.js +3 -3
  31. package/dist/cjs/bn-tree.cjs.entry.js +3 -3
  32. package/dist/cjs/ibcs-chart-structure.cjs.entry.js +4 -4
  33. package/dist/cjs/ibcs-chart-time.cjs.entry.js +5 -5
  34. package/dist/cjs/loader.cjs.js +1 -1
  35. package/dist/cjs/{withStyled-BBtMesx3.js → withStyled-CW30Bh6c.js} +6 -2
  36. package/dist/collection/components/bn-table/bn-table.js +63 -12
  37. package/dist/collection/components/bn-table/ibcs-table.css +7 -5
  38. package/dist/collection/components/bn-table/ibcs-table.js +22 -1
  39. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +56 -25
  40. package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -1
  41. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +12 -3
  42. package/dist/collection/components/bn-table/utils/helper/ColumnStatistics.js +9 -1
  43. package/dist/collection/utils/constants.js +27 -0
  44. package/dist/collection/utils/validate.js +4 -1
  45. package/dist/components/DataFormatDigits.js +1 -1
  46. package/dist/components/DateStringFactory.js +1 -1
  47. package/dist/components/Order.js +1 -1
  48. package/dist/components/SVGVariancesStyleGroup.js +1 -1
  49. package/dist/components/bn-chart-structure.js +1 -1
  50. package/dist/components/bn-chart-time.js +1 -1
  51. package/dist/components/bn-table.js +1 -1
  52. package/dist/components/bn-title2.js +1 -1
  53. package/dist/components/ibcs-chart-structure2.js +1 -1
  54. package/dist/components/ibcs-chart-time2.js +1 -1
  55. package/dist/components/ibcs-table2.js +1 -1
  56. package/dist/components/ibcs-title2.js +1 -1
  57. package/dist/components/ibcsRuleSet.js +1 -1
  58. package/dist/components/validate.js +1 -1
  59. package/dist/esm/{DataFormatDigits-DYdbRX-1.js → DataFormatDigits--qIbKvXa.js} +1 -1
  60. package/dist/esm/{DateStringFactory-DRcbojUT.js → DateStringFactory-XWdUjsn8.js} +1 -1
  61. package/dist/esm/{Order-DdexOqTs.js → Order-sqjrku2z.js} +28 -1
  62. package/dist/esm/{SVGVariancesStyleGroup-D0Cwprv1.js → SVGVariancesStyleGroup-ibg3sLjM.js} +1 -1
  63. package/dist/esm/{StringAdapter-CTL-Dvzp.js → StringAdapter-BCLJpQQ8.js} +1 -1
  64. package/dist/esm/bn-body_4.entry.js +4 -4
  65. package/dist/esm/bn-chart-structure.entry.js +3 -3
  66. package/dist/esm/bn-chart-time.entry.js +3 -3
  67. package/dist/esm/bn-context_5.entry.js +115 -44
  68. package/dist/esm/bn-grid.entry.js +3 -3
  69. package/dist/esm/bn-image.entry.js +3 -3
  70. package/dist/esm/bn-template-engine.js +1 -1
  71. package/dist/esm/bn-text.entry.js +3 -3
  72. package/dist/esm/bn-tree.entry.js +3 -3
  73. package/dist/esm/ibcs-chart-structure.entry.js +4 -4
  74. package/dist/esm/ibcs-chart-time.entry.js +5 -5
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/{withStyled-DCipbf2O.js → withStyled-D1fAWJ3g.js} +6 -3
  77. package/dist/types/components/bn-table/bn-table.d.ts +11 -7
  78. package/dist/types/components/bn-table/ibcs-table.d.ts +1 -0
  79. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +1 -0
  80. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +3 -0
  81. package/dist/types/components.d.ts +22 -2
  82. package/dist/types/utils/constants.d.ts +15 -0
  83. package/dist/types/utils/validate.d.ts +1 -0
  84. package/package.json +1 -1
  85. package/dist/bn-template-engine/p-60a7fc59.entry.js +0 -1
  86. package/dist/bn-template-engine/p-DdexOqTs.js +0 -1
  87. package/dist/bn-template-engine/p-DyRaC0MB.js +0 -1
  88. package/dist/bn-template-engine/p-d279b578.entry.js +0 -1
@@ -1 +1 @@
1
- import{h as t}from"./Order.js";const n={},s=[];function i(t,s){if(Array.isArray(t))for(const n of t)i(n,s);else if("object"!=typeof t)e(Object.getOwnPropertyNames(s)),n[t]=Object.assign(n[t]||{},s);else for(const n in t)i(n,t[n])}function r(t){return n[t]||{}}function e(t){s.push(...t)}function h(t,n){let s;const i=t.length,r=[];for(s=0;s<i;s++)r.push(n(t[s]));return r}function u(t){return t%360*Math.PI/180}function o(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t,n,s,i){return null!=n&&null!=s||(i=i||t.bbox(),null==n?n=i.width/i.height*s:null==s&&(s=i.height/i.width*n)),{width:n,height:s}}function l(t,n){const s=t.origin;let i=null!=t.ox?t.ox:null!=t.originX?t.originX:"center",r=null!=t.oy?t.oy:null!=t.originY?t.originY:"center";null!=s&&([i,r]=Array.isArray(s)?s:"object"==typeof s?[s.x,s.y]:[s,s]);const e="string"==typeof i,h="string"==typeof r;if(e||h){const{height:t,width:s,x:u,y:o}=n.bbox();e&&(i=i.includes("left")?u:i.includes("right")?u+s:u+s/2),h&&(r=r.includes("top")?o:r.includes("bottom")?o+t:o+t/2)}return[i,r]}const a=new Set(["desc","metadata","title"]),f=t=>a.has(t.nodeName),p=(t,n,s={})=>{const i={...n};for(const t in i)i[t].valueOf()===s[t]&&delete i[t];Object.keys(i).length?t.node.setAttribute("data-svgjs",JSON.stringify(i)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))},d="http://www.w3.org/2000/svg",w="http://www.w3.org/2000/xmlns/",y="http://www.w3.org/1999/xlink",m={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};class g{}const x={},b="___SYMBOL___ROOT___";function v(t,n=d){return m.document.createElementNS(n,t)}function _(t,n=!1){if(t instanceof g)return t;if("object"==typeof t)return A(t);if(null==t)return new x[b];if("string"==typeof t&&"<"!==t.trim().charAt(0))return A(m.document.querySelector(t));const s=n?m.document.createElement("div"):v("svg");return s.innerHTML=t.trim(),t=A(s.firstElementChild),s.removeChild(s.firstElementChild),t}function M(t,n){return n&&(n instanceof m.window.Node||n.ownerDocument&&n instanceof n.ownerDocument.defaultView.Node)?n:v(t)}function k(t){if(!t)return null;if(t.instance instanceof g)return t.instance;if("#document-fragment"===t.nodeName)return new x.Fragment(t);let n=o(t.nodeName||"Dom");return"LinearGradient"===n||"RadialGradient"===n?n="Gradient":x[n]||(n="Dom"),new x[n](t)}let A=k;function O(t,n=t.name,s=!1){return x[n]=t,s&&(x[b]=t),e(Object.getOwnPropertyNames(t.prototype)),t}let j=1e3;function C(t){return"Svgjs"+o(t)+j++}function S(t){for(let n=t.children.length-1;n>=0;n--)S(t.children[n]);return t.id?(t.id=C(t.nodeName),t):t}function E(t,n){let s,i;for(i=(t=Array.isArray(t)?t:[t]).length-1;i>=0;i--)for(s in n)t[i].prototype[s]=n[s]}function T(t){return function(...n){const s=n[n.length-1];return!s||s.constructor!==Object||s instanceof Array?t.apply(this,n):t.apply(this,n.slice(0,-1)).attr(s)}}i("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=_(t)).remove();const n=this.position();return this.parent().add(t,n),this},after:function(t){(t=_(t)).remove();const n=this.position();return this.parent().add(t,n+1),this},insertBefore:function(t){return(t=_(t)).before(this),this},insertAfter:function(t){return(t=_(t)).after(this),this}});const z=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,F=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,N=/rgb\((\d+),(\d+),(\d+)\)/,D=/(#[a-z_][a-z0-9\-_]*)/i,P=/\)\s*,?\s*/,I=/\s/g,R=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,L=/^rgb\(/,$=/^(\s+)?$/,G=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Y=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,X=/[\s,]+/,H=/[MLHVCSQTAZ]/i;function V(t){const n=Math.round(t),s=Math.max(0,Math.min(255,n)).toString(16);return 1===s.length?"0"+s:s}function B(t,n){for(let s=n.length;s--;)if(null==t[n[s]])return!1;return!0}function Q(t,n,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(n-t)*s:s<.5?n:s<2/3?t+(n-t)*(2/3-s)*6:t}i("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(X)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const n=this.classes();n.push(t),this.attr("class",n.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(n){return n!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),i("Dom",{css:function(t,n){const s={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const n=t.split(/\s*:\s*/);s[n[0]]=n[1]})),s;if(arguments.length<2){if(Array.isArray(t)){for(const n of t)s[n]=this.node.style.getPropertyValue(n);return s}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const n in t)this.node.style.setProperty(n,null==t[n]||$.test(t[n])?"":t[n])}return 2===arguments.length&&this.node.style.setProperty(t,null==n||$.test(n)?"":n),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),i("Dom",{data:function(t,n,s){if(null==t)return this.data(h(function(t){let n;const s=t.length,i=[];for(n=0;n<s;n++)0===t[n].nodeName.indexOf("data-")&&i.push(t[n]);return i}(this.node.attributes),(t=>t.nodeName.slice(5))));if(t instanceof Array){const n={};for(const s of t)n[s]=this.data(s);return n}if("object"==typeof t)for(n in t)this.data(n,t[n]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(n){return this.attr("data-"+t)}else this.attr("data-"+t,null===n?null:!0===s||"string"==typeof n||"number"==typeof n?n:JSON.stringify(n));return this}}),i("Dom",{remember:function(t,n){if("object"==typeof arguments[0])for(const n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=n}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class q{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof q||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",n){const{random:s,round:i,sin:r,PI:e}=Math;if("vibrant"===t){const t=24*s()+57,n=38*s()+45,i=360*s();return new q(t,n,i,"lch")}if("sine"===t){const t=i(80*r(2*e*(n=null==n?s():n)/.5+.01)+150),h=i(50*r(2*e*n/.5+4.6)+200),u=i(100*r(2*e*n/.5+2.3)+150);return new q(t,h,u)}if("pastel"===t){const t=8*s()+86,n=17*s()+9,i=360*s();return new q(t,n,i,"lch")}if("dark"===t){const t=10+10*s(),n=50*s()+86,i=360*s();return new q(t,n,i,"lch")}if("rgb"===t){const t=255*s(),n=255*s(),i=255*s();return new q(t,n,i)}if("lab"===t){const t=100*s(),n=256*s()-128,i=256*s()-128;return new q(t,n,i,"lab")}if("grey"===t){const t=255*s();return new q(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(R.test(t)||L.test(t))}cmyk(){const{_a:t,_b:n,_c:s}=this.rgb(),[i,r,e]=[t,n,s].map((t=>t/255)),h=Math.min(1-i,1-r,1-e);return 1===h?new q(0,0,0,1,"cmyk"):new q((1-i-h)/(1-h),(1-r-h)/(1-h),(1-e-h)/(1-h),h,"cmyk")}hsl(){const{_a:t,_b:n,_c:s}=this.rgb(),[i,r,e]=[t,n,s].map((t=>t/255)),h=Math.max(i,r,e),u=Math.min(i,r,e),o=(h+u)/2,c=h===u,l=h-u;return new q(360*(c?0:h===i?((r-e)/l+(r<e?6:0))/6:h===r?((e-i)/l+2)/6:h===e?((i-r)/l+4)/6:0),100*(c?0:o>.5?l/(2-h-u):l/(h+u)),100*o,"hsl")}init(t=0,n=0,s=0,i=0,r="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)r="string"==typeof i?i:r,i="string"==typeof i?0:i,Object.assign(this,{_a:t,_b:n,_c:s,_d:i,space:r});else if(t instanceof Array)this.space=n||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const s=function(t,n){const s=B(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:B(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:B(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:B(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:B(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:B(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return s.space=n||s.space,s}(t,n);Object.assign(this,s)}else if("string"==typeof t)if(L.test(t)){const n=t.replace(I,""),[s,i,r]=N.exec(n).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:s,_b:i,_c:r,_d:0,space:"rgb"})}else{if(!R.test(t))throw Error("Unsupported string format, can't construct Color");{const n=t=>parseInt(t,16),[,s,i,r]=F.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(n);Object.assign(this,{_a:s,_b:i,_c:r,_d:0,space:"rgb"})}}const{_a:e,_b:h,_c:u,_d:o}=this;Object.assign(this,"rgb"===this.space?{r:e,g:h,b:u}:"xyz"===this.space?{x:e,y:h,z:u}:"hsl"===this.space?{h:e,s:h,l:u}:"lab"===this.space?{l:e,a:h,b:u}:"lch"===this.space?{l:e,c:h,h:u}:"cmyk"===this.space?{c:e,m:h,y:u,k:o}:{})}lab(){const{x:t,y:n,z:s}=this.xyz();return new q(116*n-16,500*(t-n),200*(n-s),"lab")}lch(){const{l:t,a:n,b:s}=this.lab(),i=Math.sqrt(n**2+s**2);let r=180*Math.atan2(s,n)/Math.PI;return r<0&&(r*=-1,r=360-r),new q(t,i,r,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:n,z:s}=this;if("lab"===this.space||"lch"===this.space){let{l:i,a:r,b:e}=this;if("lch"===this.space){const{c:t,h:n}=this,s=Math.PI/180;r=t*Math.cos(s*n),e=t*Math.sin(s*n)}const h=(i+16)/116,u=r/500+h,o=h-e/200,c=16/116,l=.008856,a=7.787;t=.95047*(u**3>l?u**3:(u-c)/a),n=1*(h**3>l?h**3:(h-c)/a),s=1.08883*(o**3>l?o**3:(o-c)/a)}const i=3.2406*t+-1.5372*n+-.4986*s,r=-.9689*t+1.8758*n+.0415*s,e=.0557*t+-.204*n+1.057*s,h=Math.pow,u=.0031308,o=i>u?1.055*h(i,1/2.4)-.055:12.92*i,c=r>u?1.055*h(r,1/2.4)-.055:12.92*r,l=e>u?1.055*h(e,1/2.4)-.055:12.92*e;return new q(255*o,255*c,255*l)}if("hsl"===this.space){let{h:t,s:n,l:s}=this;if(t/=360,n/=100,s/=100,0===n)return s*=255,new q(s,s,s);const i=s<.5?s*(1+n):s+n-s*n,r=2*s-i,e=255*Q(r,i,t+1/3),h=255*Q(r,i,t),u=255*Q(r,i,t-1/3);return new q(e,h,u)}if("cmyk"===this.space){const{c:t,m:n,y:s,k:i}=this,r=255*(1-Math.min(1,t*(1-i)+i)),e=255*(1-Math.min(1,n*(1-i)+i)),h=255*(1-Math.min(1,s*(1-i)+i));return new q(r,e,h)}return this;var t}toArray(){const{_a:t,_b:n,_c:s,_d:i,space:r}=this;return[t,n,s,i,r]}toHex(){const[t,n,s]=this._clamped().map(V);return`#${t}${n}${s}`}toRgb(){const[t,n,s]=this._clamped();return`rgb(${t},${n},${s})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:n,_c:s}=this.rgb(),[i,r,e]=[t,n,s].map((t=>t/255)),h=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,u=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,o=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,c=(.4124*h+.3576*u+.1805*o)/.95047,l=(.2126*h+.7152*u+.0722*o)/1,a=(.0193*h+.1192*u+.9505*o)/1.08883,f=c>.008856?Math.pow(c,1/3):7.787*c+16/116,p=l>.008856?Math.pow(l,1/3):7.787*l+16/116,d=a>.008856?Math.pow(a,1/3):7.787*a+16/116;return new q(f,p,d,"xyz")}_clamped(){const{_a:t,_b:n,_c:s}=this.rgb(),{max:i,min:r,round:e}=Math;return[t,n,s].map((t=>i(0,r(e(t),255))))}}class J{constructor(...t){this.init(...t)}clone(){return new J(this)}init(t,n){const s=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:n};return this.x=null==s.x?0:s.x,this.y=null==s.y?0:s.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){Z.isMatrixLike(t)||(t=new Z(t));const{x:n,y:s}=this;return this.x=t.a*n+t.c*s+t.e,this.y=t.b*n+t.d*s+t.f,this}}function U(t,n){return Math.abs(n-t)<1e-6}class Z{constructor(...t){this.init(...t)}static formatTransforms(t){const n="both"===t.flip||!0===t.flip,s=t.flip&&(n||"x"===t.flip)?-1:1,i=t.flip&&(n||"y"===t.flip)?-1:1,r=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,e=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,h=t.scale&&t.scale.length?t.scale[0]*s:isFinite(t.scale)?t.scale*s:isFinite(t.scaleX)?t.scaleX*s:s,u=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,o=t.shear||0,c=t.rotate||t.theta||0,l=new J(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),a=l.x,f=l.y,p=new J(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),d=p.x,w=p.y,y=new J(t.translate||t.tx||t.translateX,t.ty||t.translateY),m=y.x,g=y.y,x=new J(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:h,scaleY:u,skewX:r,skewY:e,shear:o,theta:c,rx:x.x,ry:x.y,tx:m,ty:g,ox:a,oy:f,px:d,py:w}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,n,s){const i=t.b*n.a+t.d*n.b,r=t.a*n.c+t.c*n.d,e=t.b*n.c+t.d*n.d,h=t.e+t.a*n.e+t.c*n.f,u=t.f+t.b*n.e+t.d*n.f;return s.a=t.a*n.a+t.c*n.b,s.b=i,s.c=r,s.d=e,s.e=h,s.f=u,s}around(t,n,s){return this.clone().aroundO(t,n,s)}aroundO(t,n,s){const i=t||0,r=n||0;return this.translateO(-i,-r).lmultiplyO(s).translateO(i,r)}clone(){return new Z(this)}decompose(t=0,n=0){const s=this.a,i=this.b,r=this.c,e=this.d,h=this.e,u=this.f,o=s*e-i*r,c=o>0?1:-1,l=c*Math.sqrt(s*s+i*i),a=Math.atan2(c*i,c*s),f=180/Math.PI*a,p=Math.cos(a),d=Math.sin(a),w=(s*r+i*e)/o,y=r*l/(w*s-i)||e*l/(w*i+s);return{scaleX:l,scaleY:y,shear:w,rotate:f,translateX:h-t+t*p*l+n*(w*p*l-d*y),translateY:u-n+t*d*l+n*(w*d*l+p*y),originX:t,originY:n,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;const n=new Z(t);return U(this.a,n.a)&&U(this.b,n.b)&&U(this.c,n.c)&&U(this.d,n.d)&&U(this.e,n.e)&&U(this.f,n.f)}flip(t,n){return this.clone().flipO(t,n)}flipO(t,n){return"x"===t?this.scaleO(-1,1,n,0):"y"===t?this.scaleO(1,-1,0,n):this.scaleO(-1,-1,t,n||t)}init(t){const n=Z.fromArray([1,0,0,1,0,0]);return t=t instanceof xt?t.matrixify():"string"==typeof t?Z.fromArray(t.split(X).map(parseFloat)):Array.isArray(t)?Z.fromArray(t):"object"==typeof t&&Z.isMatrixLike(t)?t:"object"==typeof t?(new Z).transform(t):6===arguments.length?Z.fromArray([].slice.call(arguments)):n,this.a=null!=t.a?t.a:n.a,this.b=null!=t.b?t.b:n.b,this.c=null!=t.c?t.c:n.c,this.d=null!=t.d?t.d:n.d,this.e=null!=t.e?t.e:n.e,this.f=null!=t.f?t.f:n.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,n=this.b,s=this.c,i=this.d,r=this.e,e=this.f,h=t*i-n*s;if(!h)throw new Error("Cannot invert "+this);const u=i/h,o=-n/h,c=-s/h,l=t/h,a=-(u*r+c*e),f=-(o*r+l*e);return this.a=u,this.b=o,this.c=c,this.d=l,this.e=a,this.f=f,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const n=t instanceof Z?t:new Z(t);return Z.matrixMultiply(n,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const n=t instanceof Z?t:new Z(t);return Z.matrixMultiply(this,n,this)}rotate(t,n,s){return this.clone().rotateO(t,n,s)}rotateO(t,n=0,s=0){t=u(t);const i=Math.cos(t),r=Math.sin(t),{a:e,b:h,c:o,d:c,e:l,f:a}=this;return this.a=e*i-h*r,this.b=h*i+e*r,this.c=o*i-c*r,this.d=c*i+o*r,this.e=l*i-a*r+s*r-n*i+n,this.f=a*i+l*r-n*r-s*i+s,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,n=t,s=0,i=0){3===arguments.length&&(i=s,s=n,n=t);const{a:r,b:e,c:h,d:u,e:o,f:c}=this;return this.a=r*t,this.b=e*n,this.c=h*t,this.d=u*n,this.e=o*t-s*t+s,this.f=c*n-i*n+i,this}shear(t,n,s){return this.clone().shearO(t,n,s)}shearO(t,n=0,s=0){const{a:i,b:r,c:e,d:h,e:u,f:o}=this;return this.a=i+r*t,this.c=e+h*t,this.e=u+o*t-s*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,n=t,s=0,i=0){3===arguments.length&&(i=s,s=n,n=t),t=u(t),n=u(n);const r=Math.tan(t),e=Math.tan(n),{a:h,b:o,c,d:l,e:a,f}=this;return this.a=h+o*r,this.b=o+h*e,this.c=c+l*r,this.d=l+c*e,this.e=a+f*r-i*r,this.f=f+a*e-s*e,this}skewX(t,n,s){return this.skew(t,0,n,s)}skewY(t,n,s){return this.skew(0,t,n,s)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(Z.isMatrixLike(t))return new Z(t).multiplyO(this);const n=Z.formatTransforms(t),{x:s,y:i}=new J(n.ox,n.oy).transform(this),r=(new Z).translateO(n.rx,n.ry).lmultiplyO(this).translateO(-s,-i).scaleO(n.scaleX,n.scaleY).skewO(n.skewX,n.skewY).shearO(n.shear).rotateO(n.theta).translateO(s,i);if(isFinite(n.px)||isFinite(n.py)){const t=new J(s,i).transform(r),e=isFinite(n.px)?n.px-t.x:0,h=isFinite(n.py)?n.py-t.y:0;r.translateO(e,h)}return r.translateO(n.tx,n.ty),r}translate(t,n){return this.clone().translateO(t,n)}translateO(t,n){return this.e+=t||0,this.f+=n||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}function W(){if(!W.nodes){const t=_().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const n=t.path().node;W.nodes={svg:t,path:n}}return W.nodes.svg.node.parentNode||W.nodes.svg.addTo(m.document.body||m.document.documentElement),W.nodes}function K(t){return!(t.width||t.height||t.x||t.y)}O(Z,"Matrix");class tt{constructor(...t){this.init(...t)}addOffset(){return this.x+=m.window.pageXOffset,this.y+=m.window.pageYOffset,new tt(this)}init(t){return t="string"==typeof t?t.split(X).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return K(this)}merge(t){const n=Math.min(this.x,t.x),s=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width)-n,r=Math.max(this.y+this.height,t.y+t.height)-s;return new tt(n,s,i,r)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof Z||(t=new Z(t));let n=1/0,s=-1/0,i=1/0,r=-1/0;return[new J(this.x,this.y),new J(this.x2,this.y),new J(this.x,this.y2),new J(this.x2,this.y2)].forEach((function(e){e=e.transform(t),n=Math.min(n,e.x),s=Math.max(s,e.x),i=Math.min(i,e.y),r=Math.max(r,e.y)})),new tt(n,i,s-n,r-i)}}function nt(t,n,s){let i;try{if(i=n(t.node),K(i)&&(r=t.node)!==m.document&&!(m.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===m.document}).call(m.document.documentElement,r))throw new Error("Element not in the dom")}catch(n){i=s(t)}var r;return i}i({viewbox:{viewbox(t,n,s,i){return null==t?new tt(this.attr("viewBox")):this.attr("viewBox",new tt(t,n,s,i))},zoom(t,n){let{width:s,height:i}=this.attr(["width","height"]);if((s||i)&&"string"!=typeof s&&"string"!=typeof i||(s=this.node.clientWidth,i=this.node.clientHeight),!s||!i)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const r=this.viewbox(),e=s/r.width,h=i/r.height,u=Math.min(e,h);if(null==t)return u;let o=u/t;o===1/0&&(o=Number.MAX_SAFE_INTEGER/100),n=n||new J(s/2/e+r.x,i/2/h+r.y);const c=new tt(r).transform(new Z({scale:o,origin:n}));return this.viewbox(c)}}}),O(tt,"Box");class st extends Array{constructor(t=[],...n){if(super(t,...n),"number"==typeof t)return this;this.length=0,this.push(...t)}}E([st],{each(t,...n){return this.map("function"==typeof t?(n,s,i)=>t.call(n,n,s,i):s=>s[t](...n))},toArray(){return Array.prototype.concat.apply([],this)}});const it=["toArray","constructor","each"];function rt(t,n){return new st(h((n||m.document).querySelectorAll(t),(function(t){return k(t)})))}st.extend=function(t){t=t.reduce(((t,n)=>(it.includes(n)||"_"===n[0]||(n in Array.prototype&&(t["$"+n]=Array.prototype[n]),t[n]=function(...t){return this.each(n,...t)}),t)),{}),E([st],t)};let et=0;const ht={};function ut(t){let n=t.getEventHolder();return n===m.window&&(n=ht),n.events||(n.events={}),n.events}function ot(t){return t.getEventTarget()}function ct(t,n,s,i,r){const e=s.bind(i||t),h=_(t),u=ut(h),o=ot(h);n=Array.isArray(n)?n:n.split(X),s._svgjsListenerId||(s._svgjsListenerId=++et),n.forEach((function(t){const n=t.split(".")[0],i=t.split(".")[1]||"*";u[n]=u[n]||{},u[n][i]=u[n][i]||{},u[n][i][s._svgjsListenerId]=e,o.addEventListener(n,e,r||!1)}))}function lt(t,n,s,i){const r=_(t),e=ut(r),h=ot(r);("function"!=typeof s||(s=s._svgjsListenerId))&&(n=Array.isArray(n)?n:(n||"").split(X)).forEach((function(t){const n=t&&t.split(".")[0],u=t&&t.split(".")[1];let o,c;if(s)e[n]&&e[n][u||"*"]&&(h.removeEventListener(n,e[n][u||"*"][s],i||!1),delete e[n][u||"*"][s]);else if(n&&u){if(e[n]&&e[n][u]){for(c in e[n][u])lt(h,[n,u].join("."),c);delete e[n][u]}}else if(u)for(t in e)for(o in e[t])u===o&&lt(h,[t,u].join("."));else if(n){if(e[n]){for(o in e[n])lt(h,[n,o].join("."));delete e[n]}}else{for(t in e)lt(h,t);!function(t){let n=t.getEventHolder();n===m.window&&(n=ht),n.events&&(n.events={})}(r)}}))}class at extends g{addEventListener(){}dispatch(t,n,s){return function(t,n,s,i){const r=ot(t);return n instanceof m.window.Event||(n=new m.window.CustomEvent(n,{detail:s,cancelable:!0,...i})),r.dispatchEvent(n),n}(this,t,n,s)}dispatchEvent(t){const n=this.getEventHolder().events;if(!n)return!0;const s=n[t.type];for(const n in s)for(const i in s[n])s[n][i](t);return!t.defaultPrevented}fire(t,n,s){return this.dispatch(t,n,s),this}getEventHolder(){return this}getEventTarget(){return this}off(t,n,s){return lt(this,t,n,s),this}on(t,n,s,i){return ct(this,t,n,s,i),this}removeEventListener(){}}function ft(){}O(at,"EventTarget");const pt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};class dt extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(X).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class wt{constructor(...t){this.init(...t)}convert(t){return new wt(this.value,t)}divide(t){return t=new wt(t),new wt(this/t,this.unit||t.unit)}init(t,n){return n=Array.isArray(t)?t[1]:n,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=n||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(n=t.match(z))&&(this.value=parseFloat(n[1]),"%"===n[5]?this.value/=100:"s"===n[5]&&(this.value*=1e3),this.unit=n[5]):t instanceof wt&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new wt(t),new wt(this-t,this.unit||t.unit)}plus(t){return t=new wt(t),new wt(this+t,this.unit||t.unit)}times(t){return t=new wt(t),new wt(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const yt=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),mt=[];class gt extends at{constructor(t,n){super(),this.node=t,this.type=t.nodeName,n&&t!==n&&this.attr(n)}add(t,n){return(t=_(t)).removeNamespace&&this.node instanceof m.window.SVGElement&&t.removeNamespace(),null==n?this.node.appendChild(t.node):t.node!==this.node.childNodes[n]&&this.node.insertBefore(t.node,this.node.childNodes[n]),this}addTo(t,n){return _(t).put(this,n)}children(){return new st(h(this.node.children,(function(t){return k(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,n=!0){this.writeDataToDom();let s=this.node.cloneNode(t);return n&&(s=S(s)),new this.constructor(s)}each(t,n){const s=this.children();let i,r;for(i=0,r=s.length;i<r;i++)t.apply(s[i],[i,s]),n&&s[i].each(t,n);return this}element(t,n){return this.put(new gt(v(t),n))}first(){return k(this.node.firstChild)}get(t){return k(this.node.childNodes[t])}getEventHolder(){return this.node}getEventTarget(){return this.node}has(t){return this.index(t)>=0}html(t,n){return this.xml(t,n,"http://www.w3.org/1999/xhtml")}id(t){return void 0!==t||this.node.id||(this.node.id=C(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return k(this.node.lastChild)}matches(t){const n=this.node,s=n.matches||n.matchesSelector||n.msMatchesSelector||n.mozMatchesSelector||n.webkitMatchesSelector||n.oMatchesSelector||null;return s&&s.call(n,t)}parent(t){let n=this;if(!n.node.parentNode)return null;if(n=k(n.node.parentNode),!t)return n;do{if("string"==typeof t?n.matches(t):n instanceof t)return n}while(n=k(n.node.parentNode));return n}put(t,n){return t=_(t),this.add(t,n),t}putIn(t,n){return _(t).add(this,n)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=_(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,n=null){const s=10**t,i=this.attr(n);for(const t in i)"number"==typeof i[t]&&(i[t]=Math.round(i[t]*s)/s);return this.attr(i),this}svg(t,n){return this.xml(t,n,d)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const n=this.parent();if(!n)return this.addTo(t);const s=n.index(this);return n.put(t,s).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,n,s){if("boolean"==typeof t&&(s=n,n=t,t=null),null==t||"function"==typeof t){n=null==n||n,this.writeDataToDom();let s=this;if(null!=t){if(s=k(s.node.cloneNode(!0)),n){const n=t(s);if(s=n||s,!1===n)return""}s.each((function(){const n=t(this),s=n||this;!1===n?this.remove():n&&this!==s&&this.replace(s)}),!0)}return n?s.node.outerHTML:s.node.innerHTML}n=null!=n&&n;const i=v("wrapper",s),r=m.document.createDocumentFragment();i.innerHTML=t;for(let t=i.children.length;t--;)r.appendChild(i.firstElementChild);const e=this.parent();return n?this.replace(r)&&e:this.add(r)}}E(gt,{attr:function(t,n,s){if(null==t){t={},n=this.node.attributes;for(const s of n)t[s.nodeName]=G.test(s.nodeValue)?parseFloat(s.nodeValue):s.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,n)=>(t[n]=this.attr(n),t)),{});if("object"==typeof t&&t.constructor===Object)for(n in t)this.attr(n,t[n]);else if(null===n)this.node.removeAttribute(t);else{if(null==n)return null==(n=this.node.getAttribute(t))?pt[t]:G.test(n)?parseFloat(n):n;"number"==typeof(n=mt.reduce(((n,s)=>s(t,n,this)),n))?n=new wt(n):yt.has(t)&&q.isColor(n)?n=new q(n):n.constructor===Array&&(n=new dt(n)),"leading"===t?this.leading&&this.leading(n):"string"==typeof s?this.node.setAttributeNS(s,t,n.toString()):this.node.setAttribute(t,n.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return rt(t,this.node)},findOne:function(t){return k(this.node.querySelector(t))}}),O(gt,"Dom");class xt extends gt{constructor(t,n){super(t,n),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,n){return this.cx(t).cy(n)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,n){return this.dx(t).dy(n)}dx(t=0){return this.x(new wt(t).plus(this.x()))}dy(t=0){return this.y(new wt(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,n){return this.x(t).y(n)}parents(t=this.root()){const n="string"==typeof t;n||(t=_(t));const s=new st;let i=this;for(;(i=i.parent())&&i.node!==m.document&&"#document-fragment"!==i.nodeName&&(s.push(i),n||i.node!==t.node)&&(!n||!i.matches(t));)if(i.node===this.root().node)return null;return s}reference(t){if(!(t=this.attr(t)))return null;const n=(t+"").match(D);return n?_(n[1]):null}root(){const t=this.parent(x[b]);return t&&t.root()}setData(t){return this.dom=t,this}size(t,n){const s=c(this,t,n);return this.width(new wt(s.width)).height(new wt(s.height))}width(t){return this.attr("width",t)}writeDataToDom(){return p(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}}E(xt,{bbox:function(){const t=nt(this,(t=>t.getBBox()),(t=>{try{const n=t.clone().addTo(W().svg).show(),s=n.node.getBBox();return n.remove(),s}catch(n){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${n.toString()}`)}}));return new tt(t)},rbox:function(t){const n=nt(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),s=new tt(n);return t?s.transform(t.screenCTM().inverseO()):s.addOffset()},inside:function(t,n){const s=this.bbox();return t>s.x&&n>s.y&&t<s.x+s.width&&n<s.y+s.height},point:function(t,n){return new J(t,n).transformO(this.screenCTM().inverseO())},ctm:function(){return new Z(this.node.getCTM())},screenCTM:function(){try{if("function"==typeof this.isRoot&&!this.isRoot()){const t=this.rect(1,1),n=t.node.getScreenCTM();return t.remove(),new Z(n)}return new Z(this.node.getScreenCTM())}catch(t){return console.warn(`Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`),new Z}}}),O(xt,"Element");const bt={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,n){return"color"===n?t:t+"-"+n}};["fill","stroke"].forEach((function(t){const n={};let s;n[t]=function(n){if(void 0===n)return this.attr(t);if("string"==typeof n||n instanceof q||q.isRgb(n)||n instanceof xt)this.attr(t,n);else for(s=bt[t].length-1;s>=0;s--)null!=n[bt[t][s]]&&this.attr(bt.prefix(t,bt[t][s]),n[bt[t][s]]);return this},i(["Element","Runner"],n)})),i(["Element","Runner"],{matrix:function(t,n,s,i,r,e){return null==t?new Z(this):this.attr("transform",new Z(t,n,s,i,r,e))},rotate:function(t,n,s){return this.transform({rotate:t,ox:n,oy:s},!0)},skew:function(t,n,s,i){return this.transform(1===arguments.length||3===arguments.length?{skew:t,ox:n,oy:s}:{skew:[t,n],ox:s,oy:i},!0)},shear:function(t,n,s){return this.transform({shear:t,ox:n,oy:s},!0)},scale:function(t,n,s,i){return this.transform(1===arguments.length||3===arguments.length?{scale:t,ox:n,oy:s}:{scale:[t,n],ox:s,oy:i},!0)},translate:function(t,n){return this.transform({translate:[t,n]},!0)},relative:function(t,n){return this.transform({relative:[t,n]},!0)},flip:function(t="both",n="center"){return-1==="xybothtrue".indexOf(t)&&(n=t,t="both"),this.transform({flip:t,origin:n},!0)},opacity:function(t){return this.attr("opacity",t)}}),i("radius",{radius:function(t,n=t){return"radialGradient"===(this._element||this).type?this.attr("r",new wt(t)):this.rx(t).ry(n)}}),i("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new J(this.node.getPointAtLength(t))}}),i(["Element","Runner"],{font:function(t,n){if("object"==typeof t){for(n in t)this.font(n,t[n]);return this}return"leading"===t?this.leading(n):this.attr("anchor"===t?"text-anchor":"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?"font-"+t:t,n)}}),i("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,n){return t[n]=function(t){return null===t?this.off(n):this.on(n,t),this},t}),{})),i("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(P).slice(0,-1).map((function(t){const n=t.trim().split("(");return[n[0],n[1].split(X).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,n){return"matrix"===n[0]?t.lmultiply(Z.fromArray(n[1])):t[n[0]].apply(t,n[1])}),new Z)},toParent:function(t,n){if(this===t)return this;if(f(this.node))return this.addTo(t,n);const s=this.screenCTM(),i=t.screenCTM().inverse();return this.addTo(t,n).untransform().transform(i.multiply(s)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,n){if(null==t||"string"==typeof t){const n=new Z(this).decompose();return null==t?n:n[t]}Z.isMatrixLike(t)||(t={...t,origin:l(t,this)});const s=new Z(!0===n?this:n||!1).transform(t);return this.attr("transform",s)}});class vt extends xt{flatten(){return this.each((function(){if(this instanceof vt)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),n=t.index(this)){return n=-1===n?t.children().length:n,this.each((function(s,i){return i[i.length-s-1].toParent(t,n)})),this.remove()}}O(vt,"Container");class _t extends vt{constructor(t,n=t){super(M("defs",t),n)}flatten(){return this}ungroup(){return this}}O(_t,"Defs");class Mt extends xt{}function kt(t){return this.attr("rx",t)}function At(t){return this.attr("ry",t)}function Ot(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function jt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Ct(t){return this.attr("cx",t)}function St(t){return this.attr("cy",t)}function Et(t){return null==t?2*this.rx():this.rx(new wt(t).divide(2))}function Tt(t){return null==t?2*this.ry():this.ry(new wt(t).divide(2))}O(Mt,"Shape");var zt=Object.freeze({__proto__:null,cx:Ct,cy:St,height:Tt,rx:kt,ry:At,width:Et,x:Ot,y:jt});class Ft extends Mt{constructor(t,n=t){super(M("ellipse",t),n)}size(t,n){const s=c(this,t,n);return this.rx(new wt(s.width).divide(2)).ry(new wt(s.height).divide(2))}}E(Ft,zt),i("Container",{ellipse:T((function(t=0,n=t){return this.put(new Ft).size(t,n).move(0,0)}))}),O(Ft,"Ellipse");class Nt extends gt{constructor(t=m.document.createDocumentFragment()){super(t)}xml(t,n,s){if("boolean"==typeof t&&(s=n,n=t,t=null),null==t||"function"==typeof t){const t=new gt(v("wrapper",s));return t.add(this.node.cloneNode(!0)),t.xml(!1,s)}return super.xml(t,!1,s)}}function Dt(t,n){return this.attr("radialGradient"===(this._element||this).type?{fx:new wt(t),fy:new wt(n)}:{x1:new wt(t),y1:new wt(n)})}function Pt(t,n){return this.attr("radialGradient"===(this._element||this).type?{cx:new wt(t),cy:new wt(n)}:{x2:new wt(t),y2:new wt(n)})}O(Nt,"Fragment");var It=Object.freeze({__proto__:null,from:Dt,to:Pt});class Rt extends vt{constructor(t,n){super(M(t+"Gradient","string"==typeof t?null:t),n)}attr(t,n,s){return"transform"===t&&(t="gradientTransform"),super.attr(t,n,s)}bbox(){return new tt}targets(){return rt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}E(Rt,It),i({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:T((function(t,n){return this.put(new Rt(t)).update(n)}))}}),O(Rt,"Gradient");class Lt extends vt{constructor(t,n=t){super(M("pattern",t),n)}attr(t,n,s){return"transform"===t&&(t="patternTransform"),super.attr(t,n,s)}bbox(){return new tt}targets(){return rt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}i({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:T((function(t,n,s){return this.put(new Lt).update(s).attr({x:0,y:0,width:t,height:n,patternUnits:"userSpaceOnUse"})}))}}),O(Lt,"Pattern");class $t extends Mt{constructor(t,n=t){super(M("image",t),n)}load(t,n){if(!t)return this;const s=new m.window.Image;return ct(s,"load",(function(t){const i=this.parent(Lt);0===this.width()&&0===this.height()&&this.size(s.width,s.height),i instanceof Lt&&0===i.width()&&0===i.height()&&i.size(this.width(),this.height()),"function"==typeof n&&n.call(this,t)}),this),ct(s,"load error",(function(){lt(s)})),this.attr("href",s.src=t,y)}}mt.push((function(t,n,s){return"fill"!==t&&"stroke"!==t||Y.test(n)&&(n=s.root().defs().image(n)),n instanceof $t&&(n=s.root().defs().pattern(0,0,(t=>{t.add(n)}))),n})),i({Container:{image:T((function(t,n){return this.put(new $t).size(0,0).load(t,n)}))}}),O($t,"Image");class Gt extends dt{bbox(){let t=-1/0,n=-1/0,s=1/0,i=1/0;return this.forEach((function(r){t=Math.max(r[0],t),n=Math.max(r[1],n),s=Math.min(r[0],s),i=Math.min(r[1],i)})),new tt(s,i,t-s,n-i)}move(t,n){const s=this.bbox();if(t-=s.x,n-=s.y,!isNaN(t)&&!isNaN(n))for(let s=this.length-1;s>=0;s--)this[s]=[this[s][0]+t,this[s][1]+n];return this}parse(t=[0,0]){const n=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(X).map(parseFloat)).length%2!=0&&t.pop();for(let s=0,i=t.length;s<i;s+=2)n.push([t[s],t[s+1]]);return n}size(t,n){let s;const i=this.bbox();for(s=this.length-1;s>=0;s--)i.width&&(this[s][0]=(this[s][0]-i.x)*t/i.width+i.x),i.height&&(this[s][1]=(this[s][1]-i.y)*n/i.height+i.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let n=0,s=this.length;n<s;n++)t.push(this[n].join(","));return t.join(" ")}transform(t){return this.clone().transformO(t)}transformO(t){Z.isMatrixLike(t)||(t=new Z(t));for(let n=this.length;n--;){const[s,i]=this[n];this[n][0]=t.a*s+t.c*i+t.e,this[n][1]=t.b*s+t.d*i+t.f}return this}}var Yt=Object.freeze({__proto__:null,MorphArray:Gt,height:function(t){const n=this.bbox();return null==t?n.height:this.size(n.width,t)},width:function(t){const n=this.bbox();return null==t?n.width:this.size(t,n.height)},x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}});class Xt extends Mt{constructor(t,n=t){super(M("line",t),n)}array(){return new Gt([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}move(t,n){return this.attr(this.array().move(t,n).toLine())}plot(t,n,s,i){return null==t?this.array():(t=void 0!==n?{x1:t,y1:n,x2:s,y2:i}:new Gt(t).toLine(),this.attr(t))}size(t,n){const s=c(this,t,n);return this.attr(this.array().size(s.width,s.height).toLine())}}E(Xt,Yt),i({Container:{line:T((function(...t){return Xt.prototype.plot.apply(this.put(new Xt),null!=t[0]?t:[0,0,0,0])}))}}),O(Xt,"Line");class Ht extends vt{constructor(t,n=t){super(M("marker",t),n)}height(t){return this.attr("markerHeight",t)}orient(t){return this.attr("orient",t)}ref(t,n){return this.attr("refX",t).attr("refY",n)}toString(){return"url(#"+this.id()+")"}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}width(t){return this.attr("markerWidth",t)}}function Vt(t,n){return function(s){return null==s?this[t]:(this[t]=s,n&&n.call(this),this)}}i({Container:{marker(...t){return this.defs().marker(...t)}},Defs:{marker:T((function(t,n,s){return this.put(new Ht).size(t,n).ref(t/2,n/2).viewbox(0,0,t,n).attr("orient","auto").update(s)}))},marker:{marker(t,n,s,i){let r=["marker"];return"all"!==t&&r.push(t),r=r.join("-"),t=arguments[1]instanceof Ht?arguments[1]:this.defs().marker(n,s,i),this.attr(r,t)}}}),O(Ht,"Marker");const Bt={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,n,s,i){return function(r){return r<0?t>0?n/t*r:s>0?i/s*r:0:r>1?s<1?(1-i)/(1-s)*r+(i-s)/(1-s):t<1?(1-n)/(1-t)*r+(n-t)/(1-t):1:3*r*(1-r)**2*n+3*r**2*(1-r)*i+r**3}},steps:function(t,n="end"){n=n.split("-").reverse()[0];let s=t;return"none"===n?--s:"both"===n&&++s,(i,r=!1)=>{let e=Math.floor(i*t);const h=i*e%1==0;return"start"!==n&&"both"!==n||++e,r&&h&&--e,i>=0&&e<0&&(e=0),i<=1&&e>s&&(e=s),e/s}}};class Qt{done(){return!1}}class qt extends Qt{constructor(t=">"){super(),this.ease=Bt[t]||t}step(t,n,s){return"number"!=typeof t?s<1?t:n:t+(n-t)*this.ease(s)}}class Jt extends Qt{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,n,s,i){return this.stepper(t,n,s,i)}}function Ut(){const t=(this._duration||500)/1e3,n=Math.PI,s=Math.log((this._overshoot||0)/100+1e-10),i=-s/Math.sqrt(n*n+s*s),r=3.9/(i*t);this.d=2*i*r,this.k=r*r}E(class extends Jt{constructor(t=500,n=0){super(),this.duration(t).overshoot(n)}step(t,n,s,i){if("string"==typeof t)return t;if(i.done=s===1/0,s===1/0)return n;if(0===s)return t;s>100&&(s=16);const r=i.velocity||0,e=-this.d*r-this.k*(t-n),h=t+r*(s/=1e3)+e*s*s/2;return i.velocity=r+e*s,i.done=Math.abs(n-h)+Math.abs(r)<.002,i.done?n:h}},{duration:Vt("_duration",Ut),overshoot:Vt("_overshoot",Ut)}),E(class extends Jt{constructor(t=.1,n=.01,s=0,i=1e3){super(),this.p(t).i(n).d(s).windup(i)}step(t,n,s,i){if("string"==typeof t)return t;if(i.done=s===1/0,s===1/0)return n;if(0===s)return t;const r=n-t;let e=(i.integral||0)+r*s;const h=(r-(i.error||0))/s,u=this._windup;return!1!==u&&(e=Math.max(-u,Math.min(e,u))),i.error=r,i.integral=e,i.done=Math.abs(r)<.001,i.done?n:t+(this.P*r+this.I*e+this.D*h)}},{windup:Vt("_windup"),p:Vt("P"),i:Vt("I"),d:Vt("D")});const Zt={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Wt={M:function(t,n,s){return n.x=s.x=t[0],n.y=s.y=t[1],["M",n.x,n.y]},L:function(t,n){return n.x=t[0],n.y=t[1],["L",t[0],t[1]]},H:function(t,n){return n.x=t[0],["H",t[0]]},V:function(t,n){return n.y=t[0],["V",t[0]]},C:function(t,n){return n.x=t[4],n.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,n){return n.x=t[2],n.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,n){return n.x=t[2],n.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,n){return n.x=t[0],n.y=t[1],["T",t[0],t[1]]},Z:function(t,n,s){return n.x=s.x,n.y=s.y,["Z"]},A:function(t,n){return n.x=t[5],n.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Kt="mlhvqtcsaz".split("");for(let t=0,n=Kt.length;t<n;++t)Wt[Kt[t]]=function(t){return function(n,s,i){if("H"===t)n[0]=n[0]+s.x;else if("V"===t)n[0]=n[0]+s.y;else if("A"===t)n[5]=n[5]+s.x,n[6]=n[6]+s.y;else for(let t=0,i=n.length;t<i;++t)n[t]=n[t]+(t%2?s.y:s.x);return Wt[t](n,s,i)}}(Kt[t].toUpperCase());function tn(t){return t.segment.length&&t.segment.length-1===Zt[t.segment[0].toUpperCase()]}function nn(t,n){t.inNumber&&sn(t,!1);const s=H.test(n);if(s)t.segment=[n];else{const n=t.lastCommand,s=n.toLowerCase();t.segment=["m"===s?n===s?"l":"L":n]}return t.inSegment=!0,t.lastCommand=t.segment[0],s}function sn(t,n){if(!t.inNumber)throw new Error("Parser Error");t.number&&t.segment.push(parseFloat(t.number)),t.inNumber=n,t.number="",t.pointSeen=!1,t.hasExponent=!1,tn(t)&&rn(t)}function rn(t){t.inSegment=!1,t.absolute&&(t.segment=function(t){return Wt[t.segment[0]](t.segment.slice(1),t.p,t.p0)}(t)),t.segments.push(t.segment)}function en(t){if(!t.segment.length)return!1;const n="A"===t.segment[0].toUpperCase(),s=t.segment.length;return n&&(4===s||5===s)}function hn(t){return"E"===t.lastToken.toUpperCase()}const un=new Set([" ",",","\t","\n","\r","\f"]);class on extends dt{bbox(){return W().path.setAttribute("d",this.toString()),new tt(W.nodes.path.getBBox())}move(t,n){const s=this.bbox();if(t-=s.x,n-=s.y,!isNaN(t)&&!isNaN(n))for(let s,i=this.length-1;i>=0;i--)s=this[i][0],"M"===s||"L"===s||"T"===s?(this[i][1]+=t,this[i][2]+=n):"H"===s?this[i][1]+=t:"V"===s?this[i][1]+=n:"C"===s||"S"===s||"Q"===s?(this[i][1]+=t,this[i][2]+=n,this[i][3]+=t,this[i][4]+=n,"C"===s&&(this[i][5]+=t,this[i][6]+=n)):"A"===s&&(this[i][6]+=t,this[i][7]+=n);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,n=!0){let s=0,i="";const r={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:n,p0:new J,p:new J};for(;r.lastToken=i,i=t.charAt(s++);)if(r.inSegment||!nn(r,i))if("."!==i)if(isNaN(parseInt(i)))if(un.has(i))r.inNumber&&sn(r,!1);else if("-"!==i&&"+"!==i)if("E"!==i.toUpperCase()){if(H.test(i)){if(r.inNumber)sn(r,!1);else{if(!tn(r))throw new Error("parser Error");rn(r)}--s}}else r.number+=i,r.hasExponent=!0;else{if(r.inNumber&&!hn(r)){sn(r,!1),--s;continue}r.number+=i,r.inNumber=!0}else{if("0"===r.number||en(r)){r.inNumber=!0,r.number=i,sn(r,!0);continue}r.inNumber=!0,r.number+=i}else{if(r.pointSeen||r.hasExponent){sn(r,!1),--s;continue}r.inNumber=!0,r.pointSeen=!0,r.number+=i}return r.inNumber&&sn(r,!1),r.inSegment&&tn(r)&&rn(r),r.segments}(t)}size(t,n){const s=this.bbox();let i,r;for(s.width=0===s.width?1:s.width,s.height=0===s.height?1:s.height,i=this.length-1;i>=0;i--)r=this[i][0],"M"===r||"L"===r||"T"===r?(this[i][1]=(this[i][1]-s.x)*t/s.width+s.x,this[i][2]=(this[i][2]-s.y)*n/s.height+s.y):"H"===r?this[i][1]=(this[i][1]-s.x)*t/s.width+s.x:"V"===r?this[i][1]=(this[i][1]-s.y)*n/s.height+s.y:"C"===r||"S"===r||"Q"===r?(this[i][1]=(this[i][1]-s.x)*t/s.width+s.x,this[i][2]=(this[i][2]-s.y)*n/s.height+s.y,this[i][3]=(this[i][3]-s.x)*t/s.width+s.x,this[i][4]=(this[i][4]-s.y)*n/s.height+s.y,"C"===r&&(this[i][5]=(this[i][5]-s.x)*t/s.width+s.x,this[i][6]=(this[i][6]-s.y)*n/s.height+s.y)):"A"===r&&(this[i][1]=this[i][1]*t/s.width,this[i][2]=this[i][2]*n/s.height,this[i][6]=(this[i][6]-s.x)*t/s.width+s.x,this[i][7]=(this[i][7]-s.y)*n/s.height+s.y);return this}toString(){return function(t){let n="";for(let s=0,i=t.length;s<i;s++)n+=t[s][0],null!=t[s][1]&&(n+=t[s][1],null!=t[s][2]&&(n+=" ",n+=t[s][2],null!=t[s][3]&&(n+=" ",n+=t[s][3],n+=" ",n+=t[s][4],null!=t[s][5]&&(n+=" ",n+=t[s][5],n+=" ",n+=t[s][6],null!=t[s][7]&&(n+=" ",n+=t[s][7])))));return n+" "}(this)}}const cn=t=>{const n=typeof t;return"number"===n?wt:"string"===n?q.isColor(t)?q:X.test(t)?H.test(t)?on:dt:z.test(t)?wt:an:wn.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?dt:"object"===n?dn:an};class ln{constructor(t){this._stepper=t||new qt("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,n){return t&&n}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(cn(t));let n=new this._type(t);return this._type===q&&(n=this._to?n[this._to[4]]():this._from?n[this._from[4]]():n),this._type===dn&&(n=this._to?n.align(this._to):this._from?n.align(this._from):n),n=n.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object).map((function(t){return t.done=!0,t})),n}}class an{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class fn{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,fn.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}fn.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const pn=(t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0;class dn{constructor(...t){this.init(...t)}align(t){const n=this.values;for(let s=0,i=n.length;s<i;++s){if(n[s+1]===t[s+1]){if(n[s+1]===q&&t[s+7]!==n[s+7]){const n=t[s+7],i=new q(this.values.splice(s+3,5))[n]().toArray();this.values.splice(s+3,0,...i)}s+=n[s+2]+2;continue}if(!t[s+1])return this;const i=(new t[s+1]).toArray();n.splice(s,n[s+2]+3,t[s],t[s+1],t[s+2],...i),s+=n[s+2]+2}return this}init(t){if(this.values=[],Array.isArray(t))return void(this.values=t.slice());t=t||{};const n=[];for(const s in t){const i=cn(t[s]),r=new i(t[s]).toArray();n.push([s,i,r.length,...r])}return n.sort(pn),this.values=n.reduce(((t,n)=>t.concat(n)),[]),this}toArray(){return this.values}valueOf(){const t={},n=this.values;for(;n.length;){const s=n.shift(),i=n.shift(),r=n.shift(),e=n.splice(0,r);t[s]=new i(e)}return t}}const wn=[an,fn,dn];class yn extends Mt{constructor(t,n=t){super(M("path",t),n)}array(){return this._array||(this._array=new on(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,n){return this.attr("d",this.array().move(t,n))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new on(t))}size(t,n){const s=c(this,t,n);return this.attr("d",this.array().size(s.width,s.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}yn.prototype.MorphArray=on,i({Container:{path:T((function(t){return this.put(new yn).plot(t||new on)}))}}),O(yn,"Path");var mn=Object.freeze({__proto__:null,array:function(){return this._array||(this._array=new Gt(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,n){return this.attr("points",this.array().move(t,n))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new Gt(t))},size:function(t,n){const s=c(this,t,n);return this.attr("points",this.array().size(s.width,s.height))}});class gn extends Mt{constructor(t,n=t){super(M("polygon",t),n)}}i({Container:{polygon:T((function(t){return this.put(new gn).plot(t||new Gt)}))}}),E(gn,Yt),E(gn,mn),O(gn,"Polygon");class xn extends Mt{constructor(t,n=t){super(M("polyline",t),n)}}i({Container:{polyline:T((function(t){return this.put(new xn).plot(t||new Gt)}))}}),E(xn,Yt),E(xn,mn),O(xn,"Polyline");class bn extends Mt{constructor(t,n=t){super(M("rect",t),n)}}E(bn,{rx:kt,ry:At}),i({Container:{rect:T((function(t,n){return this.put(new bn).size(t,n)}))}}),O(bn,"Rect");class vn{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const n=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(n.prev=this._last,this._last.next=n,this._last=n):(this._last=n,this._first=n),n}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}}const _n={nextDraw:null,frames:new vn,timeouts:new vn,immediates:new vn,timer:()=>m.window.performance||m.window.Date,transforms:[],frame(t){const n=_n.frames.push({run:t});return null===_n.nextDraw&&(_n.nextDraw=m.window.requestAnimationFrame(_n._draw)),n},timeout(t,n){n=n||0;const s=_n.timer().now()+n,i=_n.timeouts.push({run:t,time:s});return null===_n.nextDraw&&(_n.nextDraw=m.window.requestAnimationFrame(_n._draw)),i},immediate(t){const n=_n.immediates.push(t);return null===_n.nextDraw&&(_n.nextDraw=m.window.requestAnimationFrame(_n._draw)),n},cancelFrame(t){null!=t&&_n.frames.remove(t)},clearTimeout(t){null!=t&&_n.timeouts.remove(t)},cancelImmediate(t){null!=t&&_n.immediates.remove(t)},_draw(t){let n=null;const s=_n.timeouts.last();for(;(n=_n.timeouts.shift())&&(t>=n.time?n.run():_n.timeouts.push(n),n!==s););let i=null;const r=_n.frames.last();for(;i!==r&&(i=_n.frames.shift());)i.run(t);let e=null;for(;e=_n.immediates.shift();)e();_n.nextDraw=_n.timeouts.first()||_n.frames.first()?m.window.requestAnimationFrame(_n._draw):null}},Mn=function(t){const n=t.start,s=t.runner.duration();return{start:n,duration:s,end:n+s,runner:t.runner}},kn=function(){const t=m.window;return(t.performance||t.Date).now()};class An extends at{constructor(t=kn){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),n=t?t.runner.duration():0;return(t?t.start:this._time)+n}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const n=this.speed();if(null==t)return this.speed(-n);const s=Math.abs(n);return this.speed(t?-s:s)}schedule(t,n,s){if(null==t)return this._runners.map(Mn);let i=0;const r=this.getEndTime();if(n=n||0,null==s||"last"===s||"after"===s)i=r;else if("absolute"===s||"start"===s)i=n,n=0;else if("now"===s)i=this._time;else if("relative"===s){const s=this.getRunnerInfoById(t.id);s&&(i=s.start+n,n=0)}else{if("with-last"!==s)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();i=t?t.start:this._time}}t.unschedule(),t.timeline(this);const e=t.persist(),h={persist:null===e?this._persist:e,start:i+n,runner:t};return this._lastRunnerId=t.id,this._runners.push(h),this._runners.sort(((t,n)=>t.start-n.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const n=this._runnerIds.indexOf(t.id);return n<0||(this._runners.splice(n,1),this._runnerIds.splice(n,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return _n.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=_n.frame(this._step)),this)}_stepFn(t=!1){const n=this._timeSource();let s=n-this._lastSourceTime;t&&(s=0);const i=this._speed*s+(this._time-this._lastStepTime);this._lastSourceTime=n,t||(this._time+=i,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let t=this._runners.length;t--;){const n=this._runners[t];this._time-n.start<=0&&n.runner.reset()}let r=!1;for(let t=0,n=this._runners.length;t<n;t++){const s=this._runners[t],e=s.runner;let h=i;const u=this._time-s.start;u<=0?r=!0:(u<h&&(h=u),e.active()&&(e.step(h).done?!0!==s.persist&&e.duration()-e.time()+this._time+s.persist<this._time&&(e.unschedule(),--t,--n):r=!0))}return r&&!(this._speed<0&&0===this._time)||this._runnerIds.length&&this._speed<0&&this._time>0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}}i({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new An,this._timeline):(this._timeline=t,this)}}});class On extends at{constructor(t){super(),this.id=On.id++,t="function"==typeof(t=null==t?400:t)?new Jt(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof Jt,this._stepper=this._isDeclarative?t:new qt,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new Z,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}static sanitise(t,n,s){let i=1,r=!1,e=0;return n=n??0,s=s||"last","object"!=typeof(t=t??400)||t instanceof Qt||(n=t.delay??n,s=t.when??s,r=t.swing||r,i=t.times??i,e=t.wait??e,t=t.duration??400),{duration:t,delay:n,swing:r,times:i,wait:e,when:s}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,n,s){const i=On.sanitise(t,n,s),r=new On(i.duration);return this._timeline&&r.timeline(this._timeline),this._element&&r.element(this._element),r.loop(i).schedule(i.delay,i.when)}clearTransform(){return this.transforms=new Z,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new qt(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,n,s){return"object"==typeof t&&(n=t.swing,s=t.wait,t=t.times),this._times=t||1/0,this._swing=n||!1,this._wait=s||0,!0===this._times&&(this._times=1/0),this}loops(t){const n=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/n);return Math.min(t+(this._time-t*n)/this._duration,this._times)}const s=Math.floor(t);return this.time(n*s+this._duration*(t%1))}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const n=this._time,s=this._duration,i=this._wait,r=this._swing,e=this._reverse;let h;if(null==t){const t=function(t){const n=r*Math.floor(t%(2*(i+s))/(i+s)),h=n&&!e||!n&&e,u=Math.pow(-1,h)*(t%(i+s))/s+h;return Math.max(Math.min(u,1),0)},u=this._times*(i+s)-i;return h=n<=0?Math.round(t(1e-5)):n<u?t(n):Math.round(t(u-1e-5)),h}const u=Math.floor(this.loops()),o=r&&u%2==0;return h=u+(o&&!e||e&&o?t:1-t),this.loops(h)}progress(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}queue(t,n,s,i){return this._queue.push({initialiser:t||ft,runner:n||ft,retarget:s,isTransform:i,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}reset(){return this._reseted||(this.time(0),this._reseted=!0),this}reverse(t){return this._reverse=null==t?!this._reverse:t,this}schedule(t,n,s){if(t instanceof An||(s=n,n=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,n,s),this}step(t){if(!this.enabled)return this;this._time+=t=null==t?16:t;const n=this.position(),s=this._lastPosition!==n&&this._time>=0;this._lastPosition=n;const i=this.duration(),r=this._lastTime<=0&&this._time>0,e=this._lastTime<i&&this._time>=i;this._lastTime=this._time,r&&this.fire("start",this);const h=this._isDeclarative;this.done=!h&&!e&&this._time>=i,this._reseted=!1;let u=!1;return(s||h)&&(this._initialise(s),this.transforms=new Z,u=this._run(h?t:n),this.fire("step",this)),this.done=this.done||u&&h,e&&this.fire("finished",this),this}time(t){return null==t?this._time:(this.step(t-this._time),this)}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let n=0,s=this._queue.length;n<s;++n){const s=this._queue[n],i=this._isDeclarative||!s.initialised&&t;t=!s.finished,i&&t&&(s.initialiser.call(this),s.initialised=!0)}}_rememberMorpher(t,n){if(this._history[t]={morpher:n,caller:this._queue[this._queue.length-1]},this._isDeclarative){const t=this.timeline();t&&t.play()}}_run(t){let n=!0;for(let s=0,i=this._queue.length;s<i;++s){const i=this._queue[s],r=i.runner.call(this,t);i.finished=i.finished||!0===r,n=n&&i.finished}return n}_tryRetarget(t,n,s){if(this._history[t]){if(!this._history[t].caller.initialised){const n=this._queue.indexOf(this._history[t].caller);return this._queue.splice(n,1),!1}this._history[t].caller.retarget?this._history[t].caller.retarget.call(this,n,s):this._history[t].morpher.to(n),this._history[t].caller.finished=!1;const i=this.timeline();return i&&i.play(),!0}return!1}}On.id=0;class jn{constructor(t=new Z,n=-1,s=!0){this.transforms=t,this.id=n,this.done=s}clearTransformsFromQueue(){}}E([On,jn],{mergeWith(t){return new jn(t.transforms.lmultiply(this.transforms),t.id)}});const Cn=(t,n)=>t.lmultiplyO(n),Sn=t=>t.transforms;function En(){const t=this._transformationRunners.runners.map(Sn).reduce(Cn,new Z);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class Tn{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const n=t.id+1;return this.runners.push(t),this.ids.push(n),this}clearBefore(t){const n=this.ids.indexOf(t+1)||1;return this.ids.splice(0,n,0),this.runners.splice(0,n,new jn).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,n){const s=this.ids.indexOf(t+1);return this.ids.splice(s,1,t+1),this.runners.splice(s,1,n),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let n=0;n<this.runners.length;++n){const s=this.runners[n];if(!(t&&s.done&&t.done)||s._timeline&&s._timeline._runnerIds.includes(s.id)||t._timeline&&t._timeline._runnerIds.includes(t.id))t=s;else{this.remove(s.id);const i=s.mergeWith(t);this.edit(t.id,i),t=i,--n}}return this}remove(t){const n=this.ids.indexOf(t+1);return this.ids.splice(n,1),this.runners.splice(n,1),this}}i({Element:{animate(t,n,s){const i=On.sanitise(t,n,s),r=this.timeline();return new On(i.duration).loop(i).element(this).timeline(r.play()).schedule(i.delay,i.when)},delay(t,n){return this.animate(0,t,n)},_clearTransformRunnersBefore(t){this._transformationRunners.clearBefore(t.id)},_currentTransform(t){return this._transformationRunners.runners.filter((n=>n.id<=t.id)).map(Sn).reduce(Cn,new Z)},_addRunner(t){this._transformationRunners.add(t),_n.cancelImmediate(this._frameId),this._frameId=_n.immediate(En.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new Tn).add(new jn(new Z(this))))}}}),E(On,{attr(t,n){return this.styleAttr("attr",t,n)},css(t,n){return this.styleAttr("css",t,n)},styleAttr(t,n,s){if("string"==typeof n)return this.styleAttr(t,{[n]:s});let i=n;if(this._tryRetarget(t,i))return this;let r=new ln(this._stepper).to(i),e=Object.keys(i);return this.queue((function(){r=r.from(this.element()[t](e))}),(function(n){return this.element()[t](r.at(n).valueOf()),r.done()}),(function(n){const s=Object.keys(n),h=(u=e,s.filter((t=>!u.includes(t))));var u;if(h.length){const n=this.element()[t](h),s=new dn(r.from()).valueOf();Object.assign(s,n),r.from(s)}const o=new dn(r.to()).valueOf();Object.assign(o,n),r.to(o),e=s,i=n})),this._rememberMorpher(t,r),this},zoom(t,n){if(this._tryRetarget("zoom",t,n))return this;let s=new ln(this._stepper).to(new wt(t));return this.queue((function(){s=s.from(this.element().zoom())}),(function(t){return this.element().zoom(s.at(t),n),s.done()}),(function(t,i){n=i,s.to(t)})),this._rememberMorpher("zoom",s),this},transform(t,n,s){if(n=t.relative||n,this._isDeclarative&&!n&&this._tryRetarget("transform",t))return this;const i=Z.isMatrixLike(t);s=null!=t.affine?t.affine:null!=s?s:!i;const r=new ln(this._stepper).type(s?fn:Z);let e,h,u,o,c;return this.queue((function(){h=h||this.element(),e=e||l(t,h),c=new Z(n?void 0:h),h._addRunner(this),n||h._clearTransformRunnersBefore(this)}),(function(l){n||this.clearTransform();const{x:a,y:f}=new J(e).transform(h._currentTransform(this));let p=new Z({...t,origin:[a,f]}),d=this._isDeclarative&&u?u:c;if(s){p=p.decompose(a,f),d=d.decompose(a,f);const t=p.rotate,n=d.rotate,s=[t-360,t,t+360],i=s.map((t=>Math.abs(t-n))),r=Math.min(...i),e=i.indexOf(r);p.rotate=s[e]}n&&(i||(p.rotate=t.rotate||0),this._isDeclarative&&o&&(d.rotate=o)),r.from(d),r.to(p);const w=r.at(l);return o=w.rotate,u=new Z(w),this.addTransform(u),h._addRunner(this),r.done()}),(function(n){(n.origin||"center").toString()!==(t.origin||"center").toString()&&(e=l(n,h)),t={...n,origin:e}}),!0),this._isDeclarative&&this._rememberMorpher("transform",r),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,n){return this.dx(t).dy(n)},_queueNumberDelta(t,n){if(n=new wt(n),this._tryRetarget(t,n))return this;const s=new ln(this._stepper).to(n);let i=null;return this.queue((function(){i=this.element()[t](),s.from(i),s.to(i+n)}),(function(n){return this.element()[t](s.at(n)),s.done()}),(function(t){s.to(i+new wt(t))})),this._rememberMorpher(t,s),this},_queueObject(t,n){if(this._tryRetarget(t,n))return this;const s=new ln(this._stepper).to(n);return this.queue((function(){s.from(this.element()[t]())}),(function(n){return this.element()[t](s.at(n)),s.done()})),this._rememberMorpher(t,s),this},_queueNumber(t,n){return this._queueObject(t,new wt(n))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,n){return this.x(t).y(n)},amove(t,n){return this.ax(t).ay(n)},center(t,n){return this.cx(t).cy(n)},size(t,n){let s;return t&&n||(s=this._element.bbox()),t||(t=s.width/s.height*n),n||(n=s.height/s.width*t),this.width(t).height(n)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,n,s,i){if(4===arguments.length)return this.plot([t,n,s,i]);if(this._tryRetarget("plot",t))return this;const r=new ln(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){r.from(this._element.array())}),(function(t){return this._element.plot(r.at(t)),r.done()})),this._rememberMorpher("plot",r),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,n,s,i){return this._queueObject("viewbox",new tt(t,n,s,i))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),E(On,{rx:kt,ry:At,from:Dt,to:Pt}),O(On,"Runner");class zn extends vt{constructor(t,n=t){super(M("svg",t),n),this.namespace()}defs(){return this.isRoot()?k(this.node.querySelector("defs"))||this.put(new _t):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof m.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:d,version:"1.1"}).attr("xmlns:xlink",y,w):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,w).attr("xmlns:svgjs",null,w)}root(){return this.isRoot()?this:super.root()}}i({Container:{nested:T((function(){return this.put(new zn)}))}}),O(zn,"Svg",!0);class Fn extends vt{constructor(t,n=t){super(M("symbol",t),n)}}i({Container:{symbol:T((function(){return this.put(new Fn)}))}}),O(Fn,"Symbol");var Nn=Object.freeze({__proto__:null,amove:function(t,n){return this.ax(t).ay(n)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,n,s=this.bbox()){return this.cx(t,s).cy(n,s)},cx:function(t,n=this.bbox()){return null==t?n.cx:this.attr("x",this.attr("x")+t-n.cx)},cy:function(t,n=this.bbox()){return null==t?n.cy:this.attr("y",this.attr("y")+t-n.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,n,s=this.bbox()){return this.x(t,s).y(n,s)},plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(m.document.createTextNode(t)),this},x:function(t,n=this.bbox()){return null==t?n.x:this.attr("x",this.attr("x")+t-n.x)},y:function(t,n=this.bbox()){return null==t?n.y:this.attr("y",this.attr("y")+t-n.y)}});class Dn extends Mt{constructor(t,n=t){super(M("text",t),n),this.dom.leading=this.dom.leading??new wt(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new wt(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let n=0;const s=this.dom.leading;this.each((function(i){if(f(this.node))return;const r=m.window.getComputedStyle(this.node).getPropertyValue("font-size"),e=s*new wt(r);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?n+=e:(this.attr("dy",i?e+n:0),n=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new wt(t.leading||1.3),this}writeDataToDom(){return p(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const n=this.node.childNodes;let s=0;t="";for(let i=0,r=n.length;i<r;++i)"textPath"===n[i].nodeName||f(n[i])?0===i&&(s=i+1):(i!==s&&3!==n[i].nodeType&&!0===k(n[i]).dom.newLined&&(t+="\n"),t+=n[i].textContent);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(let n=0,s=(t=(t+"").split("\n")).length;n<s;n++)this.newLine(t[n]);return this.build(!1).rebuild()}}E(Dn,Nn),i({Container:{text:T((function(t=""){return this.put(new Dn).text(t)})),plain:T((function(t=""){return this.put(new Dn).plain(t)}))}}),O(Dn,"Text");class Pn extends Mt{constructor(t,n=t){super(M("tspan",t),n),this._build=!1}dx(t){return this.attr("dx",t)}dy(t){return this.attr("dy",t)}newLine(){this.dom.newLined=!0;const t=this.parent();if(!(t instanceof Dn))return this;const n=t.index(this),s=m.window.getComputedStyle(this.node).getPropertyValue("font-size"),i=t.dom.leading*new wt(s);return this.dy(n?i:0).attr("x",t.x())}text(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?(this.clear().build(!0),t.call(this,this),this.build(!1)):this.plain(t),this)}}E(Pn,Nn),i({Tspan:{tspan:T((function(t=""){const n=new Pn;return this._build||this.clear(),this.put(n).text(t)}))},Text:{newLine:function(t=""){return this.tspan(t).newLine()}}}),O(Pn,"Tspan");class In extends Mt{constructor(t,n=t){super(M("circle",t),n)}radius(t){return this.attr("r",t)}rx(t){return this.attr("r",t)}ry(t){return this.rx(t)}size(t){return this.radius(new wt(t).divide(2))}}E(In,{x:Ot,y:jt,cx:Ct,cy:St,width:Et,height:Tt}),i({Container:{circle:T((function(t=0){return this.put(new In).size(t).move(0,0)}))}}),O(In,"Circle");class Rn extends vt{constructor(t,n=t){super(M("clipPath",t),n)}remove(){return this.targets().forEach((function(t){t.unclip()})),super.remove()}targets(){return rt("svg [clip-path*="+this.id()+"]")}}i({Container:{clip:T((function(){return this.defs().put(new Rn)}))},Element:{clipper(){return this.reference("clip-path")},clipWith(t){const n=t instanceof Rn?t:this.parent().clip().add(t);return this.attr("clip-path","url(#"+n.id()+")")},unclip(){return this.attr("clip-path",null)}}}),O(Rn,"ClipPath");class Ln extends xt{constructor(t,n=t){super(M("foreignObject",t),n)}}i({Container:{foreignObject:T((function(t,n){return this.put(new Ln).size(t,n)}))}}),O(Ln,"ForeignObject");var $n=Object.freeze({__proto__:null,dmove:function(t,n){return this.children().forEach((s=>{let i;try{i=s.node instanceof m.window.SVGSVGElement?new tt(s.attr(["x","y","width","height"])):s.bbox()}catch(t){return}const r=new Z(s),e=r.translate(t,n).transform(r.inverse()),h=new J(i.x,i.y).transform(e);s.move(h.x,h.y)})),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,n=this.bbox()){return null==t?n.height:this.size(n.width,t,n)},move:function(t=0,n=0,s=this.bbox()){return this.dmove(t-s.x,n-s.y)},size:function(t,n,s=this.bbox()){const i=c(this,t,n,s),r=i.width/s.width,e=i.height/s.height;return this.children().forEach((t=>{const n=new J(s).transform(new Z(t).inverse());t.scale(r,e,n.x,n.y)})),this},width:function(t,n=this.bbox()){return null==t?n.width:this.size(t,n.height,n)},x:function(t,n=this.bbox()){return null==t?n.x:this.move(t,n.y,n)},y:function(t,n=this.bbox()){return null==t?n.y:this.move(n.x,t,n)}});class Gn extends vt{constructor(t,n=t){super(M("g",t),n)}}E(Gn,$n),i({Container:{group:T((function(){return this.put(new Gn)}))}}),O(Gn,"G");class Yn extends vt{constructor(t,n=t){super(M("a",t),n)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,y)}}E(Yn,$n),i({Container:{link:T((function(t){return this.put(new Yn).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const n=t.parent();if(!n)return this.remove();const s=n.index(t);return n.add(this,s),t.remove(),this},linkTo(t){let n=this.linker();return n||(n=new Yn,this.wrap(n)),"function"==typeof t?t.call(n,n):n.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),O(Yn,"A");class Xn extends vt{constructor(t,n=t){super(M("mask",t),n)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return rt("svg [mask*="+this.id()+"]")}}i({Container:{mask:T((function(){return this.defs().put(new Xn)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const n=t instanceof Xn?t:this.parent().mask().add(t);return this.attr("mask","url(#"+n.id()+")")},unmask(){return this.attr("mask",null)}}}),O(Xn,"Mask");class Hn extends xt{constructor(t,n=t){super(M("stop",t),n)}update(t){return("number"==typeof t||t instanceof wt)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new wt(t.offset)),this}}i({Gradient:{stop:function(t,n,s){return this.put(new Hn).update(t,n,s)}}}),O(Hn,"Stop");class Vn extends xt{constructor(t,n=t){super(M("style",t),n)}addText(t=""){return this.node.textContent+=t,this}font(t,n,s={}){return this.rule("@font-face",{fontFamily:t,src:n,...s})}rule(t,n){return this.addText(function(t,n){if(!t)return"";if(!n)return t;let s=t+"{";for(const t in n)s+=t.replace(/([A-Z])/g,(function(t,n){return"-"+n.toLowerCase()}))+":"+n[t]+";";return s+="}",s}(t,n))}}i("Dom",{style(t,n){return this.put(new Vn).rule(t,n)},fontface(t,n,s){return this.put(new Vn).font(t,n,s)}}),O(Vn,"Style");class Bn extends Dn{constructor(t,n=t){super(M("textPath",t),n)}array(){const t=this.track();return t?t.array():null}plot(t){const n=this.track();let s=null;return n&&(s=n.plot(t)),null==t?s:this}track(){return this.reference("href")}}i({Container:{textPath:T((function(t,n){return t instanceof Dn||(t=this.text(t)),t.path(n)}))},Text:{path:T((function(t,n=!0){const s=new Bn;let i;if(t instanceof yn||(t=this.defs().path(t)),s.attr("href","#"+t,y),n)for(;i=this.node.firstChild;)s.node.appendChild(i);return this.put(s)})),textPath(){return this.findOne("textPath")}},Path:{text:T((function(t){return t instanceof Dn||(t=(new Dn).addTo(this.parent()).text(t)),t.path(this)})),targets(){return rt("svg textPath").filter((t=>(t.attr("href")||"").includes(this.id())))}}}),Bn.prototype.MorphArray=on,O(Bn,"TextPath");class Qn extends Mt{constructor(t,n=t){super(M("use",t),n)}use(t,n){return this.attr("href",(n||"")+"#"+t,y)}}i({Container:{use:T((function(t,n){return this.put(new Qn).use(t,n)}))}}),O(Qn,"Use"),E([zn,Fn,$t,Lt,Ht],r("viewbox")),E([Xt,xn,gn,yn],r("marker")),E(Dn,r("Text")),E(yn,r("Path")),E(_t,r("Defs")),E([Dn,Pn],r("Tspan")),E([bn,Ft,Rt,On],r("radius")),E(at,r("EventTarget")),E(gt,r("Dom")),E(xt,r("Element")),E(Mt,r("Shape")),E([vt,Nt],r("Container")),E(Rt,r("Gradient")),E(On,r("Runner")),st.extend([...new Set(s)]),function(t=[]){wn.push(...[].concat(t))}([wt,q,tt,Z,dt,Gt,on,J]),E(wn,{to(t){return(new ln).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,n,s,i,r){return this.fromArray(t.map((function(t,e){return i.step(t,n[e],s,r[e],r)})))}});const qn=["#808080","#c0c0c0","#000000"],Jn=["#808080","#c0c0c0","#000000"],Un=["pl","fc","pp","ac"];function Zn(t){return t.replace(/\d+$/,"")}function Wn(t){return qn[t%qn.length]}function Kn(t){return Jn[t%Jn.length]}function ts(t){return.299*parseInt(t.slice(1,3),16)+.587*parseInt(t.slice(3,5),16)+.114*parseInt(t.slice(5,7),16)>128?"#000000":"#ffffff"}class ns{constructor(){this.font="16px Arial",this.size=16,this.color="#000000",this.background="#ffffff",this.leading=1.8}}class ss{adapt(n){const s=new ns;return t.isString(n.font)&&(s.font=n.font),t.isNumber(n.size)&&(s.size=n.size),t.isString(n.color)&&(s.color=n.color),t.isString(n.background)&&(s.background=n.background),t.isNumber(n.leading)&&(s.leading=n.leading),s}default(){return new ns}}class is{constructor(t,n,s,i){this.ac=t,this.fc=n,this.pp=s,this.pl=i}getSVGStyle(t){return"ac"===t?this.ac:"fc"===t?this.fc:"pp"===t?this.pp:"pl"===t?this.pl:this.ac}}class rs{constructor(t){this.svgStyleAdapter=t}adapt(n){const s=new is(this.svgStyleAdapter.defaultAC(),this.svgStyleAdapter.defaultFC(),this.svgStyleAdapter.defaultPP(),this.svgStyleAdapter.defaultPL());return t.isExisting(n.ac)&&(s.ac=this.svgStyleAdapter.adapt(n.ac)),t.isExisting(n.fc)&&(s.fc=this.svgStyleAdapter.adapt(n.fc)),t.isExisting(n.pp)&&(s.pp=this.svgStyleAdapter.adapt(n.pp)),t.isExisting(n.pl)&&(s.pl=this.svgStyleAdapter.adapt(n.pl)),s}default(){return new is(this.svgStyleAdapter.defaultAC(),this.svgStyleAdapter.defaultFC(),this.svgStyleAdapter.defaultPP(),this.svgStyleAdapter.defaultPL())}}class es{constructor(){this.top=10,this.left=10,this.right=10,this.bottom=10}}class hs{adapt(n){const s=new es;return t.isNumber(n.top)&&(s.top=n.top),t.isNumber(n.left)&&(s.left=n.left),t.isNumber(n.right)&&(s.right=n.right),t.isNumber(n.bottom)&&(s.bottom=n.bottom),s}default(){return new es}}class us{constructor(t="#000000",n="#000000",s=.1){this.stroke=t,this.fill=n,this.width=s}}class os{adapt(n){const s=new us(n.stroke,n.fill,n.width);return t.isString(n.fillpattern)&&(s.fillpattern=n.fillpattern),t.isString(n.dasharray)&&(s.dasharray=n.dasharray),s}default(){return new us("#000000","#000000",.3)}defaultAC(){return new us("#000000","#000000",.3)}defaultFC(){const t=new us("#000000","#000000",.3);return t.dasharray="10 5 5 5",t.fillpattern="fc",t}defaultPP(){return new us("#999999","#999999",.3)}defaultPL(){return new us("#000000","#ffffff",.3)}defaultPos(){return new us("#00ff00","#00ff00",.3)}defaultNeg(){return new us("#ff0000","#ff0000",.3)}defaultNeu(){return new us("#999999","#999999",.3)}}class cs{constructor(t,n,s){this.pos=t,this.neg=n,this.neu=s,this.needleHeadColour="#000000"}getSVGStyle(t){return"pos"===t?this.pos:"neg"===t?this.neg:this.neu}}class ls{constructor(t){this.svgStyleAdapter=t}adapt(n){const s=new cs(this.svgStyleAdapter.defaultPos(),this.svgStyleAdapter.defaultNeg(),this.svgStyleAdapter.defaultNeu());return t.isExisting(n.pos)&&(s.pos=this.svgStyleAdapter.adapt(n.pos)),t.isExisting(n.neg)&&(s.neg=this.svgStyleAdapter.adapt(n.neg)),t.isExisting(n.pp)&&(s.neu=this.svgStyleAdapter.adapt(n.neu)),t.isString(n.needleHeadColour)&&(s.needleHeadColour=n.needleHeadColour),s}default(){return new cs(this.svgStyleAdapter.defaultPos(),this.svgStyleAdapter.defaultNeg(),this.svgStyleAdapter.defaultNeu())}}export{ss as F,Un as I,hs as P,zn as S,Wn as a,Kn as b,Zn as c,rs as d,os as e,ls as f,ts as g}
1
+ import{i as t}from"./Order.js";const n={},s=[];function i(t,s){if(Array.isArray(t))for(const n of t)i(n,s);else if("object"!=typeof t)e(Object.getOwnPropertyNames(s)),n[t]=Object.assign(n[t]||{},s);else for(const n in t)i(n,t[n])}function r(t){return n[t]||{}}function e(t){s.push(...t)}function h(t,n){let s;const i=t.length,r=[];for(s=0;s<i;s++)r.push(n(t[s]));return r}function u(t){return t%360*Math.PI/180}function o(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t,n,s,i){return null!=n&&null!=s||(i=i||t.bbox(),null==n?n=i.width/i.height*s:null==s&&(s=i.height/i.width*n)),{width:n,height:s}}function l(t,n){const s=t.origin;let i=null!=t.ox?t.ox:null!=t.originX?t.originX:"center",r=null!=t.oy?t.oy:null!=t.originY?t.originY:"center";null!=s&&([i,r]=Array.isArray(s)?s:"object"==typeof s?[s.x,s.y]:[s,s]);const e="string"==typeof i,h="string"==typeof r;if(e||h){const{height:t,width:s,x:u,y:o}=n.bbox();e&&(i=i.includes("left")?u:i.includes("right")?u+s:u+s/2),h&&(r=r.includes("top")?o:r.includes("bottom")?o+t:o+t/2)}return[i,r]}const a=new Set(["desc","metadata","title"]),f=t=>a.has(t.nodeName),p=(t,n,s={})=>{const i={...n};for(const t in i)i[t].valueOf()===s[t]&&delete i[t];Object.keys(i).length?t.node.setAttribute("data-svgjs",JSON.stringify(i)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))},d="http://www.w3.org/2000/svg",w="http://www.w3.org/2000/xmlns/",y="http://www.w3.org/1999/xlink",m={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};class g{}const x={},b="___SYMBOL___ROOT___";function v(t,n=d){return m.document.createElementNS(n,t)}function _(t,n=!1){if(t instanceof g)return t;if("object"==typeof t)return A(t);if(null==t)return new x[b];if("string"==typeof t&&"<"!==t.trim().charAt(0))return A(m.document.querySelector(t));const s=n?m.document.createElement("div"):v("svg");return s.innerHTML=t.trim(),t=A(s.firstElementChild),s.removeChild(s.firstElementChild),t}function M(t,n){return n&&(n instanceof m.window.Node||n.ownerDocument&&n instanceof n.ownerDocument.defaultView.Node)?n:v(t)}function k(t){if(!t)return null;if(t.instance instanceof g)return t.instance;if("#document-fragment"===t.nodeName)return new x.Fragment(t);let n=o(t.nodeName||"Dom");return"LinearGradient"===n||"RadialGradient"===n?n="Gradient":x[n]||(n="Dom"),new x[n](t)}let A=k;function O(t,n=t.name,s=!1){return x[n]=t,s&&(x[b]=t),e(Object.getOwnPropertyNames(t.prototype)),t}let j=1e3;function C(t){return"Svgjs"+o(t)+j++}function S(t){for(let n=t.children.length-1;n>=0;n--)S(t.children[n]);return t.id?(t.id=C(t.nodeName),t):t}function E(t,n){let s,i;for(i=(t=Array.isArray(t)?t:[t]).length-1;i>=0;i--)for(s in n)t[i].prototype[s]=n[s]}function T(t){return function(...n){const s=n[n.length-1];return!s||s.constructor!==Object||s instanceof Array?t.apply(this,n):t.apply(this,n.slice(0,-1)).attr(s)}}i("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=_(t)).remove();const n=this.position();return this.parent().add(t,n),this},after:function(t){(t=_(t)).remove();const n=this.position();return this.parent().add(t,n+1),this},insertBefore:function(t){return(t=_(t)).before(this),this},insertAfter:function(t){return(t=_(t)).after(this),this}});const z=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,F=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,N=/rgb\((\d+),(\d+),(\d+)\)/,D=/(#[a-z_][a-z0-9\-_]*)/i,P=/\)\s*,?\s*/,I=/\s/g,R=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,L=/^rgb\(/,$=/^(\s+)?$/,G=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Y=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,X=/[\s,]+/,H=/[MLHVCSQTAZ]/i;function V(t){const n=Math.round(t),s=Math.max(0,Math.min(255,n)).toString(16);return 1===s.length?"0"+s:s}function B(t,n){for(let s=n.length;s--;)if(null==t[n[s]])return!1;return!0}function Q(t,n,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(n-t)*s:s<.5?n:s<2/3?t+(n-t)*(2/3-s)*6:t}i("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(X)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const n=this.classes();n.push(t),this.attr("class",n.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(n){return n!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),i("Dom",{css:function(t,n){const s={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const n=t.split(/\s*:\s*/);s[n[0]]=n[1]})),s;if(arguments.length<2){if(Array.isArray(t)){for(const n of t)s[n]=this.node.style.getPropertyValue(n);return s}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const n in t)this.node.style.setProperty(n,null==t[n]||$.test(t[n])?"":t[n])}return 2===arguments.length&&this.node.style.setProperty(t,null==n||$.test(n)?"":n),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),i("Dom",{data:function(t,n,s){if(null==t)return this.data(h(function(t){let n;const s=t.length,i=[];for(n=0;n<s;n++)0===t[n].nodeName.indexOf("data-")&&i.push(t[n]);return i}(this.node.attributes),(t=>t.nodeName.slice(5))));if(t instanceof Array){const n={};for(const s of t)n[s]=this.data(s);return n}if("object"==typeof t)for(n in t)this.data(n,t[n]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(n){return this.attr("data-"+t)}else this.attr("data-"+t,null===n?null:!0===s||"string"==typeof n||"number"==typeof n?n:JSON.stringify(n));return this}}),i("Dom",{remember:function(t,n){if("object"==typeof arguments[0])for(const n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=n}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class q{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof q||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",n){const{random:s,round:i,sin:r,PI:e}=Math;if("vibrant"===t){const t=24*s()+57,n=38*s()+45,i=360*s();return new q(t,n,i,"lch")}if("sine"===t){const t=i(80*r(2*e*(n=null==n?s():n)/.5+.01)+150),h=i(50*r(2*e*n/.5+4.6)+200),u=i(100*r(2*e*n/.5+2.3)+150);return new q(t,h,u)}if("pastel"===t){const t=8*s()+86,n=17*s()+9,i=360*s();return new q(t,n,i,"lch")}if("dark"===t){const t=10+10*s(),n=50*s()+86,i=360*s();return new q(t,n,i,"lch")}if("rgb"===t){const t=255*s(),n=255*s(),i=255*s();return new q(t,n,i)}if("lab"===t){const t=100*s(),n=256*s()-128,i=256*s()-128;return new q(t,n,i,"lab")}if("grey"===t){const t=255*s();return new q(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(R.test(t)||L.test(t))}cmyk(){const{_a:t,_b:n,_c:s}=this.rgb(),[i,r,e]=[t,n,s].map((t=>t/255)),h=Math.min(1-i,1-r,1-e);return 1===h?new q(0,0,0,1,"cmyk"):new q((1-i-h)/(1-h),(1-r-h)/(1-h),(1-e-h)/(1-h),h,"cmyk")}hsl(){const{_a:t,_b:n,_c:s}=this.rgb(),[i,r,e]=[t,n,s].map((t=>t/255)),h=Math.max(i,r,e),u=Math.min(i,r,e),o=(h+u)/2,c=h===u,l=h-u;return new q(360*(c?0:h===i?((r-e)/l+(r<e?6:0))/6:h===r?((e-i)/l+2)/6:h===e?((i-r)/l+4)/6:0),100*(c?0:o>.5?l/(2-h-u):l/(h+u)),100*o,"hsl")}init(t=0,n=0,s=0,i=0,r="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)r="string"==typeof i?i:r,i="string"==typeof i?0:i,Object.assign(this,{_a:t,_b:n,_c:s,_d:i,space:r});else if(t instanceof Array)this.space=n||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const s=function(t,n){const s=B(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:B(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:B(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:B(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:B(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:B(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return s.space=n||s.space,s}(t,n);Object.assign(this,s)}else if("string"==typeof t)if(L.test(t)){const n=t.replace(I,""),[s,i,r]=N.exec(n).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:s,_b:i,_c:r,_d:0,space:"rgb"})}else{if(!R.test(t))throw Error("Unsupported string format, can't construct Color");{const n=t=>parseInt(t,16),[,s,i,r]=F.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(n);Object.assign(this,{_a:s,_b:i,_c:r,_d:0,space:"rgb"})}}const{_a:e,_b:h,_c:u,_d:o}=this;Object.assign(this,"rgb"===this.space?{r:e,g:h,b:u}:"xyz"===this.space?{x:e,y:h,z:u}:"hsl"===this.space?{h:e,s:h,l:u}:"lab"===this.space?{l:e,a:h,b:u}:"lch"===this.space?{l:e,c:h,h:u}:"cmyk"===this.space?{c:e,m:h,y:u,k:o}:{})}lab(){const{x:t,y:n,z:s}=this.xyz();return new q(116*n-16,500*(t-n),200*(n-s),"lab")}lch(){const{l:t,a:n,b:s}=this.lab(),i=Math.sqrt(n**2+s**2);let r=180*Math.atan2(s,n)/Math.PI;return r<0&&(r*=-1,r=360-r),new q(t,i,r,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:n,z:s}=this;if("lab"===this.space||"lch"===this.space){let{l:i,a:r,b:e}=this;if("lch"===this.space){const{c:t,h:n}=this,s=Math.PI/180;r=t*Math.cos(s*n),e=t*Math.sin(s*n)}const h=(i+16)/116,u=r/500+h,o=h-e/200,c=16/116,l=.008856,a=7.787;t=.95047*(u**3>l?u**3:(u-c)/a),n=1*(h**3>l?h**3:(h-c)/a),s=1.08883*(o**3>l?o**3:(o-c)/a)}const i=3.2406*t+-1.5372*n+-.4986*s,r=-.9689*t+1.8758*n+.0415*s,e=.0557*t+-.204*n+1.057*s,h=Math.pow,u=.0031308,o=i>u?1.055*h(i,1/2.4)-.055:12.92*i,c=r>u?1.055*h(r,1/2.4)-.055:12.92*r,l=e>u?1.055*h(e,1/2.4)-.055:12.92*e;return new q(255*o,255*c,255*l)}if("hsl"===this.space){let{h:t,s:n,l:s}=this;if(t/=360,n/=100,s/=100,0===n)return s*=255,new q(s,s,s);const i=s<.5?s*(1+n):s+n-s*n,r=2*s-i,e=255*Q(r,i,t+1/3),h=255*Q(r,i,t),u=255*Q(r,i,t-1/3);return new q(e,h,u)}if("cmyk"===this.space){const{c:t,m:n,y:s,k:i}=this,r=255*(1-Math.min(1,t*(1-i)+i)),e=255*(1-Math.min(1,n*(1-i)+i)),h=255*(1-Math.min(1,s*(1-i)+i));return new q(r,e,h)}return this;var t}toArray(){const{_a:t,_b:n,_c:s,_d:i,space:r}=this;return[t,n,s,i,r]}toHex(){const[t,n,s]=this._clamped().map(V);return`#${t}${n}${s}`}toRgb(){const[t,n,s]=this._clamped();return`rgb(${t},${n},${s})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:n,_c:s}=this.rgb(),[i,r,e]=[t,n,s].map((t=>t/255)),h=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,u=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,o=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,c=(.4124*h+.3576*u+.1805*o)/.95047,l=(.2126*h+.7152*u+.0722*o)/1,a=(.0193*h+.1192*u+.9505*o)/1.08883,f=c>.008856?Math.pow(c,1/3):7.787*c+16/116,p=l>.008856?Math.pow(l,1/3):7.787*l+16/116,d=a>.008856?Math.pow(a,1/3):7.787*a+16/116;return new q(f,p,d,"xyz")}_clamped(){const{_a:t,_b:n,_c:s}=this.rgb(),{max:i,min:r,round:e}=Math;return[t,n,s].map((t=>i(0,r(e(t),255))))}}class J{constructor(...t){this.init(...t)}clone(){return new J(this)}init(t,n){const s=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:n};return this.x=null==s.x?0:s.x,this.y=null==s.y?0:s.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){Z.isMatrixLike(t)||(t=new Z(t));const{x:n,y:s}=this;return this.x=t.a*n+t.c*s+t.e,this.y=t.b*n+t.d*s+t.f,this}}function U(t,n){return Math.abs(n-t)<1e-6}class Z{constructor(...t){this.init(...t)}static formatTransforms(t){const n="both"===t.flip||!0===t.flip,s=t.flip&&(n||"x"===t.flip)?-1:1,i=t.flip&&(n||"y"===t.flip)?-1:1,r=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,e=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,h=t.scale&&t.scale.length?t.scale[0]*s:isFinite(t.scale)?t.scale*s:isFinite(t.scaleX)?t.scaleX*s:s,u=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,o=t.shear||0,c=t.rotate||t.theta||0,l=new J(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),a=l.x,f=l.y,p=new J(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),d=p.x,w=p.y,y=new J(t.translate||t.tx||t.translateX,t.ty||t.translateY),m=y.x,g=y.y,x=new J(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:h,scaleY:u,skewX:r,skewY:e,shear:o,theta:c,rx:x.x,ry:x.y,tx:m,ty:g,ox:a,oy:f,px:d,py:w}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,n,s){const i=t.b*n.a+t.d*n.b,r=t.a*n.c+t.c*n.d,e=t.b*n.c+t.d*n.d,h=t.e+t.a*n.e+t.c*n.f,u=t.f+t.b*n.e+t.d*n.f;return s.a=t.a*n.a+t.c*n.b,s.b=i,s.c=r,s.d=e,s.e=h,s.f=u,s}around(t,n,s){return this.clone().aroundO(t,n,s)}aroundO(t,n,s){const i=t||0,r=n||0;return this.translateO(-i,-r).lmultiplyO(s).translateO(i,r)}clone(){return new Z(this)}decompose(t=0,n=0){const s=this.a,i=this.b,r=this.c,e=this.d,h=this.e,u=this.f,o=s*e-i*r,c=o>0?1:-1,l=c*Math.sqrt(s*s+i*i),a=Math.atan2(c*i,c*s),f=180/Math.PI*a,p=Math.cos(a),d=Math.sin(a),w=(s*r+i*e)/o,y=r*l/(w*s-i)||e*l/(w*i+s);return{scaleX:l,scaleY:y,shear:w,rotate:f,translateX:h-t+t*p*l+n*(w*p*l-d*y),translateY:u-n+t*d*l+n*(w*d*l+p*y),originX:t,originY:n,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;const n=new Z(t);return U(this.a,n.a)&&U(this.b,n.b)&&U(this.c,n.c)&&U(this.d,n.d)&&U(this.e,n.e)&&U(this.f,n.f)}flip(t,n){return this.clone().flipO(t,n)}flipO(t,n){return"x"===t?this.scaleO(-1,1,n,0):"y"===t?this.scaleO(1,-1,0,n):this.scaleO(-1,-1,t,n||t)}init(t){const n=Z.fromArray([1,0,0,1,0,0]);return t=t instanceof xt?t.matrixify():"string"==typeof t?Z.fromArray(t.split(X).map(parseFloat)):Array.isArray(t)?Z.fromArray(t):"object"==typeof t&&Z.isMatrixLike(t)?t:"object"==typeof t?(new Z).transform(t):6===arguments.length?Z.fromArray([].slice.call(arguments)):n,this.a=null!=t.a?t.a:n.a,this.b=null!=t.b?t.b:n.b,this.c=null!=t.c?t.c:n.c,this.d=null!=t.d?t.d:n.d,this.e=null!=t.e?t.e:n.e,this.f=null!=t.f?t.f:n.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,n=this.b,s=this.c,i=this.d,r=this.e,e=this.f,h=t*i-n*s;if(!h)throw new Error("Cannot invert "+this);const u=i/h,o=-n/h,c=-s/h,l=t/h,a=-(u*r+c*e),f=-(o*r+l*e);return this.a=u,this.b=o,this.c=c,this.d=l,this.e=a,this.f=f,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const n=t instanceof Z?t:new Z(t);return Z.matrixMultiply(n,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const n=t instanceof Z?t:new Z(t);return Z.matrixMultiply(this,n,this)}rotate(t,n,s){return this.clone().rotateO(t,n,s)}rotateO(t,n=0,s=0){t=u(t);const i=Math.cos(t),r=Math.sin(t),{a:e,b:h,c:o,d:c,e:l,f:a}=this;return this.a=e*i-h*r,this.b=h*i+e*r,this.c=o*i-c*r,this.d=c*i+o*r,this.e=l*i-a*r+s*r-n*i+n,this.f=a*i+l*r-n*r-s*i+s,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,n=t,s=0,i=0){3===arguments.length&&(i=s,s=n,n=t);const{a:r,b:e,c:h,d:u,e:o,f:c}=this;return this.a=r*t,this.b=e*n,this.c=h*t,this.d=u*n,this.e=o*t-s*t+s,this.f=c*n-i*n+i,this}shear(t,n,s){return this.clone().shearO(t,n,s)}shearO(t,n=0,s=0){const{a:i,b:r,c:e,d:h,e:u,f:o}=this;return this.a=i+r*t,this.c=e+h*t,this.e=u+o*t-s*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,n=t,s=0,i=0){3===arguments.length&&(i=s,s=n,n=t),t=u(t),n=u(n);const r=Math.tan(t),e=Math.tan(n),{a:h,b:o,c,d:l,e:a,f}=this;return this.a=h+o*r,this.b=o+h*e,this.c=c+l*r,this.d=l+c*e,this.e=a+f*r-i*r,this.f=f+a*e-s*e,this}skewX(t,n,s){return this.skew(t,0,n,s)}skewY(t,n,s){return this.skew(0,t,n,s)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(Z.isMatrixLike(t))return new Z(t).multiplyO(this);const n=Z.formatTransforms(t),{x:s,y:i}=new J(n.ox,n.oy).transform(this),r=(new Z).translateO(n.rx,n.ry).lmultiplyO(this).translateO(-s,-i).scaleO(n.scaleX,n.scaleY).skewO(n.skewX,n.skewY).shearO(n.shear).rotateO(n.theta).translateO(s,i);if(isFinite(n.px)||isFinite(n.py)){const t=new J(s,i).transform(r),e=isFinite(n.px)?n.px-t.x:0,h=isFinite(n.py)?n.py-t.y:0;r.translateO(e,h)}return r.translateO(n.tx,n.ty),r}translate(t,n){return this.clone().translateO(t,n)}translateO(t,n){return this.e+=t||0,this.f+=n||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}function W(){if(!W.nodes){const t=_().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const n=t.path().node;W.nodes={svg:t,path:n}}return W.nodes.svg.node.parentNode||W.nodes.svg.addTo(m.document.body||m.document.documentElement),W.nodes}function K(t){return!(t.width||t.height||t.x||t.y)}O(Z,"Matrix");class tt{constructor(...t){this.init(...t)}addOffset(){return this.x+=m.window.pageXOffset,this.y+=m.window.pageYOffset,new tt(this)}init(t){return t="string"==typeof t?t.split(X).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return K(this)}merge(t){const n=Math.min(this.x,t.x),s=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width)-n,r=Math.max(this.y+this.height,t.y+t.height)-s;return new tt(n,s,i,r)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof Z||(t=new Z(t));let n=1/0,s=-1/0,i=1/0,r=-1/0;return[new J(this.x,this.y),new J(this.x2,this.y),new J(this.x,this.y2),new J(this.x2,this.y2)].forEach((function(e){e=e.transform(t),n=Math.min(n,e.x),s=Math.max(s,e.x),i=Math.min(i,e.y),r=Math.max(r,e.y)})),new tt(n,i,s-n,r-i)}}function nt(t,n,s){let i;try{if(i=n(t.node),K(i)&&(r=t.node)!==m.document&&!(m.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===m.document}).call(m.document.documentElement,r))throw new Error("Element not in the dom")}catch(n){i=s(t)}var r;return i}i({viewbox:{viewbox(t,n,s,i){return null==t?new tt(this.attr("viewBox")):this.attr("viewBox",new tt(t,n,s,i))},zoom(t,n){let{width:s,height:i}=this.attr(["width","height"]);if((s||i)&&"string"!=typeof s&&"string"!=typeof i||(s=this.node.clientWidth,i=this.node.clientHeight),!s||!i)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const r=this.viewbox(),e=s/r.width,h=i/r.height,u=Math.min(e,h);if(null==t)return u;let o=u/t;o===1/0&&(o=Number.MAX_SAFE_INTEGER/100),n=n||new J(s/2/e+r.x,i/2/h+r.y);const c=new tt(r).transform(new Z({scale:o,origin:n}));return this.viewbox(c)}}}),O(tt,"Box");class st extends Array{constructor(t=[],...n){if(super(t,...n),"number"==typeof t)return this;this.length=0,this.push(...t)}}E([st],{each(t,...n){return this.map("function"==typeof t?(n,s,i)=>t.call(n,n,s,i):s=>s[t](...n))},toArray(){return Array.prototype.concat.apply([],this)}});const it=["toArray","constructor","each"];function rt(t,n){return new st(h((n||m.document).querySelectorAll(t),(function(t){return k(t)})))}st.extend=function(t){t=t.reduce(((t,n)=>(it.includes(n)||"_"===n[0]||(n in Array.prototype&&(t["$"+n]=Array.prototype[n]),t[n]=function(...t){return this.each(n,...t)}),t)),{}),E([st],t)};let et=0;const ht={};function ut(t){let n=t.getEventHolder();return n===m.window&&(n=ht),n.events||(n.events={}),n.events}function ot(t){return t.getEventTarget()}function ct(t,n,s,i,r){const e=s.bind(i||t),h=_(t),u=ut(h),o=ot(h);n=Array.isArray(n)?n:n.split(X),s._svgjsListenerId||(s._svgjsListenerId=++et),n.forEach((function(t){const n=t.split(".")[0],i=t.split(".")[1]||"*";u[n]=u[n]||{},u[n][i]=u[n][i]||{},u[n][i][s._svgjsListenerId]=e,o.addEventListener(n,e,r||!1)}))}function lt(t,n,s,i){const r=_(t),e=ut(r),h=ot(r);("function"!=typeof s||(s=s._svgjsListenerId))&&(n=Array.isArray(n)?n:(n||"").split(X)).forEach((function(t){const n=t&&t.split(".")[0],u=t&&t.split(".")[1];let o,c;if(s)e[n]&&e[n][u||"*"]&&(h.removeEventListener(n,e[n][u||"*"][s],i||!1),delete e[n][u||"*"][s]);else if(n&&u){if(e[n]&&e[n][u]){for(c in e[n][u])lt(h,[n,u].join("."),c);delete e[n][u]}}else if(u)for(t in e)for(o in e[t])u===o&&lt(h,[t,u].join("."));else if(n){if(e[n]){for(o in e[n])lt(h,[n,o].join("."));delete e[n]}}else{for(t in e)lt(h,t);!function(t){let n=t.getEventHolder();n===m.window&&(n=ht),n.events&&(n.events={})}(r)}}))}class at extends g{addEventListener(){}dispatch(t,n,s){return function(t,n,s,i){const r=ot(t);return n instanceof m.window.Event||(n=new m.window.CustomEvent(n,{detail:s,cancelable:!0,...i})),r.dispatchEvent(n),n}(this,t,n,s)}dispatchEvent(t){const n=this.getEventHolder().events;if(!n)return!0;const s=n[t.type];for(const n in s)for(const i in s[n])s[n][i](t);return!t.defaultPrevented}fire(t,n,s){return this.dispatch(t,n,s),this}getEventHolder(){return this}getEventTarget(){return this}off(t,n,s){return lt(this,t,n,s),this}on(t,n,s,i){return ct(this,t,n,s,i),this}removeEventListener(){}}function ft(){}O(at,"EventTarget");const pt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};class dt extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(X).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class wt{constructor(...t){this.init(...t)}convert(t){return new wt(this.value,t)}divide(t){return t=new wt(t),new wt(this/t,this.unit||t.unit)}init(t,n){return n=Array.isArray(t)?t[1]:n,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=n||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(n=t.match(z))&&(this.value=parseFloat(n[1]),"%"===n[5]?this.value/=100:"s"===n[5]&&(this.value*=1e3),this.unit=n[5]):t instanceof wt&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new wt(t),new wt(this-t,this.unit||t.unit)}plus(t){return t=new wt(t),new wt(this+t,this.unit||t.unit)}times(t){return t=new wt(t),new wt(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const yt=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),mt=[];class gt extends at{constructor(t,n){super(),this.node=t,this.type=t.nodeName,n&&t!==n&&this.attr(n)}add(t,n){return(t=_(t)).removeNamespace&&this.node instanceof m.window.SVGElement&&t.removeNamespace(),null==n?this.node.appendChild(t.node):t.node!==this.node.childNodes[n]&&this.node.insertBefore(t.node,this.node.childNodes[n]),this}addTo(t,n){return _(t).put(this,n)}children(){return new st(h(this.node.children,(function(t){return k(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,n=!0){this.writeDataToDom();let s=this.node.cloneNode(t);return n&&(s=S(s)),new this.constructor(s)}each(t,n){const s=this.children();let i,r;for(i=0,r=s.length;i<r;i++)t.apply(s[i],[i,s]),n&&s[i].each(t,n);return this}element(t,n){return this.put(new gt(v(t),n))}first(){return k(this.node.firstChild)}get(t){return k(this.node.childNodes[t])}getEventHolder(){return this.node}getEventTarget(){return this.node}has(t){return this.index(t)>=0}html(t,n){return this.xml(t,n,"http://www.w3.org/1999/xhtml")}id(t){return void 0!==t||this.node.id||(this.node.id=C(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return k(this.node.lastChild)}matches(t){const n=this.node,s=n.matches||n.matchesSelector||n.msMatchesSelector||n.mozMatchesSelector||n.webkitMatchesSelector||n.oMatchesSelector||null;return s&&s.call(n,t)}parent(t){let n=this;if(!n.node.parentNode)return null;if(n=k(n.node.parentNode),!t)return n;do{if("string"==typeof t?n.matches(t):n instanceof t)return n}while(n=k(n.node.parentNode));return n}put(t,n){return t=_(t),this.add(t,n),t}putIn(t,n){return _(t).add(this,n)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=_(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,n=null){const s=10**t,i=this.attr(n);for(const t in i)"number"==typeof i[t]&&(i[t]=Math.round(i[t]*s)/s);return this.attr(i),this}svg(t,n){return this.xml(t,n,d)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const n=this.parent();if(!n)return this.addTo(t);const s=n.index(this);return n.put(t,s).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,n,s){if("boolean"==typeof t&&(s=n,n=t,t=null),null==t||"function"==typeof t){n=null==n||n,this.writeDataToDom();let s=this;if(null!=t){if(s=k(s.node.cloneNode(!0)),n){const n=t(s);if(s=n||s,!1===n)return""}s.each((function(){const n=t(this),s=n||this;!1===n?this.remove():n&&this!==s&&this.replace(s)}),!0)}return n?s.node.outerHTML:s.node.innerHTML}n=null!=n&&n;const i=v("wrapper",s),r=m.document.createDocumentFragment();i.innerHTML=t;for(let t=i.children.length;t--;)r.appendChild(i.firstElementChild);const e=this.parent();return n?this.replace(r)&&e:this.add(r)}}E(gt,{attr:function(t,n,s){if(null==t){t={},n=this.node.attributes;for(const s of n)t[s.nodeName]=G.test(s.nodeValue)?parseFloat(s.nodeValue):s.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,n)=>(t[n]=this.attr(n),t)),{});if("object"==typeof t&&t.constructor===Object)for(n in t)this.attr(n,t[n]);else if(null===n)this.node.removeAttribute(t);else{if(null==n)return null==(n=this.node.getAttribute(t))?pt[t]:G.test(n)?parseFloat(n):n;"number"==typeof(n=mt.reduce(((n,s)=>s(t,n,this)),n))?n=new wt(n):yt.has(t)&&q.isColor(n)?n=new q(n):n.constructor===Array&&(n=new dt(n)),"leading"===t?this.leading&&this.leading(n):"string"==typeof s?this.node.setAttributeNS(s,t,n.toString()):this.node.setAttribute(t,n.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return rt(t,this.node)},findOne:function(t){return k(this.node.querySelector(t))}}),O(gt,"Dom");class xt extends gt{constructor(t,n){super(t,n),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,n){return this.cx(t).cy(n)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,n){return this.dx(t).dy(n)}dx(t=0){return this.x(new wt(t).plus(this.x()))}dy(t=0){return this.y(new wt(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,n){return this.x(t).y(n)}parents(t=this.root()){const n="string"==typeof t;n||(t=_(t));const s=new st;let i=this;for(;(i=i.parent())&&i.node!==m.document&&"#document-fragment"!==i.nodeName&&(s.push(i),n||i.node!==t.node)&&(!n||!i.matches(t));)if(i.node===this.root().node)return null;return s}reference(t){if(!(t=this.attr(t)))return null;const n=(t+"").match(D);return n?_(n[1]):null}root(){const t=this.parent(x[b]);return t&&t.root()}setData(t){return this.dom=t,this}size(t,n){const s=c(this,t,n);return this.width(new wt(s.width)).height(new wt(s.height))}width(t){return this.attr("width",t)}writeDataToDom(){return p(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}}E(xt,{bbox:function(){const t=nt(this,(t=>t.getBBox()),(t=>{try{const n=t.clone().addTo(W().svg).show(),s=n.node.getBBox();return n.remove(),s}catch(n){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${n.toString()}`)}}));return new tt(t)},rbox:function(t){const n=nt(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),s=new tt(n);return t?s.transform(t.screenCTM().inverseO()):s.addOffset()},inside:function(t,n){const s=this.bbox();return t>s.x&&n>s.y&&t<s.x+s.width&&n<s.y+s.height},point:function(t,n){return new J(t,n).transformO(this.screenCTM().inverseO())},ctm:function(){return new Z(this.node.getCTM())},screenCTM:function(){try{if("function"==typeof this.isRoot&&!this.isRoot()){const t=this.rect(1,1),n=t.node.getScreenCTM();return t.remove(),new Z(n)}return new Z(this.node.getScreenCTM())}catch(t){return console.warn(`Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`),new Z}}}),O(xt,"Element");const bt={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,n){return"color"===n?t:t+"-"+n}};["fill","stroke"].forEach((function(t){const n={};let s;n[t]=function(n){if(void 0===n)return this.attr(t);if("string"==typeof n||n instanceof q||q.isRgb(n)||n instanceof xt)this.attr(t,n);else for(s=bt[t].length-1;s>=0;s--)null!=n[bt[t][s]]&&this.attr(bt.prefix(t,bt[t][s]),n[bt[t][s]]);return this},i(["Element","Runner"],n)})),i(["Element","Runner"],{matrix:function(t,n,s,i,r,e){return null==t?new Z(this):this.attr("transform",new Z(t,n,s,i,r,e))},rotate:function(t,n,s){return this.transform({rotate:t,ox:n,oy:s},!0)},skew:function(t,n,s,i){return this.transform(1===arguments.length||3===arguments.length?{skew:t,ox:n,oy:s}:{skew:[t,n],ox:s,oy:i},!0)},shear:function(t,n,s){return this.transform({shear:t,ox:n,oy:s},!0)},scale:function(t,n,s,i){return this.transform(1===arguments.length||3===arguments.length?{scale:t,ox:n,oy:s}:{scale:[t,n],ox:s,oy:i},!0)},translate:function(t,n){return this.transform({translate:[t,n]},!0)},relative:function(t,n){return this.transform({relative:[t,n]},!0)},flip:function(t="both",n="center"){return-1==="xybothtrue".indexOf(t)&&(n=t,t="both"),this.transform({flip:t,origin:n},!0)},opacity:function(t){return this.attr("opacity",t)}}),i("radius",{radius:function(t,n=t){return"radialGradient"===(this._element||this).type?this.attr("r",new wt(t)):this.rx(t).ry(n)}}),i("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new J(this.node.getPointAtLength(t))}}),i(["Element","Runner"],{font:function(t,n){if("object"==typeof t){for(n in t)this.font(n,t[n]);return this}return"leading"===t?this.leading(n):this.attr("anchor"===t?"text-anchor":"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?"font-"+t:t,n)}}),i("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,n){return t[n]=function(t){return null===t?this.off(n):this.on(n,t),this},t}),{})),i("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(P).slice(0,-1).map((function(t){const n=t.trim().split("(");return[n[0],n[1].split(X).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,n){return"matrix"===n[0]?t.lmultiply(Z.fromArray(n[1])):t[n[0]].apply(t,n[1])}),new Z)},toParent:function(t,n){if(this===t)return this;if(f(this.node))return this.addTo(t,n);const s=this.screenCTM(),i=t.screenCTM().inverse();return this.addTo(t,n).untransform().transform(i.multiply(s)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,n){if(null==t||"string"==typeof t){const n=new Z(this).decompose();return null==t?n:n[t]}Z.isMatrixLike(t)||(t={...t,origin:l(t,this)});const s=new Z(!0===n?this:n||!1).transform(t);return this.attr("transform",s)}});class vt extends xt{flatten(){return this.each((function(){if(this instanceof vt)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),n=t.index(this)){return n=-1===n?t.children().length:n,this.each((function(s,i){return i[i.length-s-1].toParent(t,n)})),this.remove()}}O(vt,"Container");class _t extends vt{constructor(t,n=t){super(M("defs",t),n)}flatten(){return this}ungroup(){return this}}O(_t,"Defs");class Mt extends xt{}function kt(t){return this.attr("rx",t)}function At(t){return this.attr("ry",t)}function Ot(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function jt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Ct(t){return this.attr("cx",t)}function St(t){return this.attr("cy",t)}function Et(t){return null==t?2*this.rx():this.rx(new wt(t).divide(2))}function Tt(t){return null==t?2*this.ry():this.ry(new wt(t).divide(2))}O(Mt,"Shape");var zt=Object.freeze({__proto__:null,cx:Ct,cy:St,height:Tt,rx:kt,ry:At,width:Et,x:Ot,y:jt});class Ft extends Mt{constructor(t,n=t){super(M("ellipse",t),n)}size(t,n){const s=c(this,t,n);return this.rx(new wt(s.width).divide(2)).ry(new wt(s.height).divide(2))}}E(Ft,zt),i("Container",{ellipse:T((function(t=0,n=t){return this.put(new Ft).size(t,n).move(0,0)}))}),O(Ft,"Ellipse");class Nt extends gt{constructor(t=m.document.createDocumentFragment()){super(t)}xml(t,n,s){if("boolean"==typeof t&&(s=n,n=t,t=null),null==t||"function"==typeof t){const t=new gt(v("wrapper",s));return t.add(this.node.cloneNode(!0)),t.xml(!1,s)}return super.xml(t,!1,s)}}function Dt(t,n){return this.attr("radialGradient"===(this._element||this).type?{fx:new wt(t),fy:new wt(n)}:{x1:new wt(t),y1:new wt(n)})}function Pt(t,n){return this.attr("radialGradient"===(this._element||this).type?{cx:new wt(t),cy:new wt(n)}:{x2:new wt(t),y2:new wt(n)})}O(Nt,"Fragment");var It=Object.freeze({__proto__:null,from:Dt,to:Pt});class Rt extends vt{constructor(t,n){super(M(t+"Gradient","string"==typeof t?null:t),n)}attr(t,n,s){return"transform"===t&&(t="gradientTransform"),super.attr(t,n,s)}bbox(){return new tt}targets(){return rt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}E(Rt,It),i({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:T((function(t,n){return this.put(new Rt(t)).update(n)}))}}),O(Rt,"Gradient");class Lt extends vt{constructor(t,n=t){super(M("pattern",t),n)}attr(t,n,s){return"transform"===t&&(t="patternTransform"),super.attr(t,n,s)}bbox(){return new tt}targets(){return rt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}i({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:T((function(t,n,s){return this.put(new Lt).update(s).attr({x:0,y:0,width:t,height:n,patternUnits:"userSpaceOnUse"})}))}}),O(Lt,"Pattern");class $t extends Mt{constructor(t,n=t){super(M("image",t),n)}load(t,n){if(!t)return this;const s=new m.window.Image;return ct(s,"load",(function(t){const i=this.parent(Lt);0===this.width()&&0===this.height()&&this.size(s.width,s.height),i instanceof Lt&&0===i.width()&&0===i.height()&&i.size(this.width(),this.height()),"function"==typeof n&&n.call(this,t)}),this),ct(s,"load error",(function(){lt(s)})),this.attr("href",s.src=t,y)}}mt.push((function(t,n,s){return"fill"!==t&&"stroke"!==t||Y.test(n)&&(n=s.root().defs().image(n)),n instanceof $t&&(n=s.root().defs().pattern(0,0,(t=>{t.add(n)}))),n})),i({Container:{image:T((function(t,n){return this.put(new $t).size(0,0).load(t,n)}))}}),O($t,"Image");class Gt extends dt{bbox(){let t=-1/0,n=-1/0,s=1/0,i=1/0;return this.forEach((function(r){t=Math.max(r[0],t),n=Math.max(r[1],n),s=Math.min(r[0],s),i=Math.min(r[1],i)})),new tt(s,i,t-s,n-i)}move(t,n){const s=this.bbox();if(t-=s.x,n-=s.y,!isNaN(t)&&!isNaN(n))for(let s=this.length-1;s>=0;s--)this[s]=[this[s][0]+t,this[s][1]+n];return this}parse(t=[0,0]){const n=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(X).map(parseFloat)).length%2!=0&&t.pop();for(let s=0,i=t.length;s<i;s+=2)n.push([t[s],t[s+1]]);return n}size(t,n){let s;const i=this.bbox();for(s=this.length-1;s>=0;s--)i.width&&(this[s][0]=(this[s][0]-i.x)*t/i.width+i.x),i.height&&(this[s][1]=(this[s][1]-i.y)*n/i.height+i.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let n=0,s=this.length;n<s;n++)t.push(this[n].join(","));return t.join(" ")}transform(t){return this.clone().transformO(t)}transformO(t){Z.isMatrixLike(t)||(t=new Z(t));for(let n=this.length;n--;){const[s,i]=this[n];this[n][0]=t.a*s+t.c*i+t.e,this[n][1]=t.b*s+t.d*i+t.f}return this}}var Yt=Object.freeze({__proto__:null,MorphArray:Gt,height:function(t){const n=this.bbox();return null==t?n.height:this.size(n.width,t)},width:function(t){const n=this.bbox();return null==t?n.width:this.size(t,n.height)},x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}});class Xt extends Mt{constructor(t,n=t){super(M("line",t),n)}array(){return new Gt([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}move(t,n){return this.attr(this.array().move(t,n).toLine())}plot(t,n,s,i){return null==t?this.array():(t=void 0!==n?{x1:t,y1:n,x2:s,y2:i}:new Gt(t).toLine(),this.attr(t))}size(t,n){const s=c(this,t,n);return this.attr(this.array().size(s.width,s.height).toLine())}}E(Xt,Yt),i({Container:{line:T((function(...t){return Xt.prototype.plot.apply(this.put(new Xt),null!=t[0]?t:[0,0,0,0])}))}}),O(Xt,"Line");class Ht extends vt{constructor(t,n=t){super(M("marker",t),n)}height(t){return this.attr("markerHeight",t)}orient(t){return this.attr("orient",t)}ref(t,n){return this.attr("refX",t).attr("refY",n)}toString(){return"url(#"+this.id()+")"}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}width(t){return this.attr("markerWidth",t)}}function Vt(t,n){return function(s){return null==s?this[t]:(this[t]=s,n&&n.call(this),this)}}i({Container:{marker(...t){return this.defs().marker(...t)}},Defs:{marker:T((function(t,n,s){return this.put(new Ht).size(t,n).ref(t/2,n/2).viewbox(0,0,t,n).attr("orient","auto").update(s)}))},marker:{marker(t,n,s,i){let r=["marker"];return"all"!==t&&r.push(t),r=r.join("-"),t=arguments[1]instanceof Ht?arguments[1]:this.defs().marker(n,s,i),this.attr(r,t)}}}),O(Ht,"Marker");const Bt={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,n,s,i){return function(r){return r<0?t>0?n/t*r:s>0?i/s*r:0:r>1?s<1?(1-i)/(1-s)*r+(i-s)/(1-s):t<1?(1-n)/(1-t)*r+(n-t)/(1-t):1:3*r*(1-r)**2*n+3*r**2*(1-r)*i+r**3}},steps:function(t,n="end"){n=n.split("-").reverse()[0];let s=t;return"none"===n?--s:"both"===n&&++s,(i,r=!1)=>{let e=Math.floor(i*t);const h=i*e%1==0;return"start"!==n&&"both"!==n||++e,r&&h&&--e,i>=0&&e<0&&(e=0),i<=1&&e>s&&(e=s),e/s}}};class Qt{done(){return!1}}class qt extends Qt{constructor(t=">"){super(),this.ease=Bt[t]||t}step(t,n,s){return"number"!=typeof t?s<1?t:n:t+(n-t)*this.ease(s)}}class Jt extends Qt{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,n,s,i){return this.stepper(t,n,s,i)}}function Ut(){const t=(this._duration||500)/1e3,n=Math.PI,s=Math.log((this._overshoot||0)/100+1e-10),i=-s/Math.sqrt(n*n+s*s),r=3.9/(i*t);this.d=2*i*r,this.k=r*r}E(class extends Jt{constructor(t=500,n=0){super(),this.duration(t).overshoot(n)}step(t,n,s,i){if("string"==typeof t)return t;if(i.done=s===1/0,s===1/0)return n;if(0===s)return t;s>100&&(s=16);const r=i.velocity||0,e=-this.d*r-this.k*(t-n),h=t+r*(s/=1e3)+e*s*s/2;return i.velocity=r+e*s,i.done=Math.abs(n-h)+Math.abs(r)<.002,i.done?n:h}},{duration:Vt("_duration",Ut),overshoot:Vt("_overshoot",Ut)}),E(class extends Jt{constructor(t=.1,n=.01,s=0,i=1e3){super(),this.p(t).i(n).d(s).windup(i)}step(t,n,s,i){if("string"==typeof t)return t;if(i.done=s===1/0,s===1/0)return n;if(0===s)return t;const r=n-t;let e=(i.integral||0)+r*s;const h=(r-(i.error||0))/s,u=this._windup;return!1!==u&&(e=Math.max(-u,Math.min(e,u))),i.error=r,i.integral=e,i.done=Math.abs(r)<.001,i.done?n:t+(this.P*r+this.I*e+this.D*h)}},{windup:Vt("_windup"),p:Vt("P"),i:Vt("I"),d:Vt("D")});const Zt={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Wt={M:function(t,n,s){return n.x=s.x=t[0],n.y=s.y=t[1],["M",n.x,n.y]},L:function(t,n){return n.x=t[0],n.y=t[1],["L",t[0],t[1]]},H:function(t,n){return n.x=t[0],["H",t[0]]},V:function(t,n){return n.y=t[0],["V",t[0]]},C:function(t,n){return n.x=t[4],n.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,n){return n.x=t[2],n.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,n){return n.x=t[2],n.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,n){return n.x=t[0],n.y=t[1],["T",t[0],t[1]]},Z:function(t,n,s){return n.x=s.x,n.y=s.y,["Z"]},A:function(t,n){return n.x=t[5],n.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Kt="mlhvqtcsaz".split("");for(let t=0,n=Kt.length;t<n;++t)Wt[Kt[t]]=function(t){return function(n,s,i){if("H"===t)n[0]=n[0]+s.x;else if("V"===t)n[0]=n[0]+s.y;else if("A"===t)n[5]=n[5]+s.x,n[6]=n[6]+s.y;else for(let t=0,i=n.length;t<i;++t)n[t]=n[t]+(t%2?s.y:s.x);return Wt[t](n,s,i)}}(Kt[t].toUpperCase());function tn(t){return t.segment.length&&t.segment.length-1===Zt[t.segment[0].toUpperCase()]}function nn(t,n){t.inNumber&&sn(t,!1);const s=H.test(n);if(s)t.segment=[n];else{const n=t.lastCommand,s=n.toLowerCase();t.segment=["m"===s?n===s?"l":"L":n]}return t.inSegment=!0,t.lastCommand=t.segment[0],s}function sn(t,n){if(!t.inNumber)throw new Error("Parser Error");t.number&&t.segment.push(parseFloat(t.number)),t.inNumber=n,t.number="",t.pointSeen=!1,t.hasExponent=!1,tn(t)&&rn(t)}function rn(t){t.inSegment=!1,t.absolute&&(t.segment=function(t){return Wt[t.segment[0]](t.segment.slice(1),t.p,t.p0)}(t)),t.segments.push(t.segment)}function en(t){if(!t.segment.length)return!1;const n="A"===t.segment[0].toUpperCase(),s=t.segment.length;return n&&(4===s||5===s)}function hn(t){return"E"===t.lastToken.toUpperCase()}const un=new Set([" ",",","\t","\n","\r","\f"]);class on extends dt{bbox(){return W().path.setAttribute("d",this.toString()),new tt(W.nodes.path.getBBox())}move(t,n){const s=this.bbox();if(t-=s.x,n-=s.y,!isNaN(t)&&!isNaN(n))for(let s,i=this.length-1;i>=0;i--)s=this[i][0],"M"===s||"L"===s||"T"===s?(this[i][1]+=t,this[i][2]+=n):"H"===s?this[i][1]+=t:"V"===s?this[i][1]+=n:"C"===s||"S"===s||"Q"===s?(this[i][1]+=t,this[i][2]+=n,this[i][3]+=t,this[i][4]+=n,"C"===s&&(this[i][5]+=t,this[i][6]+=n)):"A"===s&&(this[i][6]+=t,this[i][7]+=n);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,n=!0){let s=0,i="";const r={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:n,p0:new J,p:new J};for(;r.lastToken=i,i=t.charAt(s++);)if(r.inSegment||!nn(r,i))if("."!==i)if(isNaN(parseInt(i)))if(un.has(i))r.inNumber&&sn(r,!1);else if("-"!==i&&"+"!==i)if("E"!==i.toUpperCase()){if(H.test(i)){if(r.inNumber)sn(r,!1);else{if(!tn(r))throw new Error("parser Error");rn(r)}--s}}else r.number+=i,r.hasExponent=!0;else{if(r.inNumber&&!hn(r)){sn(r,!1),--s;continue}r.number+=i,r.inNumber=!0}else{if("0"===r.number||en(r)){r.inNumber=!0,r.number=i,sn(r,!0);continue}r.inNumber=!0,r.number+=i}else{if(r.pointSeen||r.hasExponent){sn(r,!1),--s;continue}r.inNumber=!0,r.pointSeen=!0,r.number+=i}return r.inNumber&&sn(r,!1),r.inSegment&&tn(r)&&rn(r),r.segments}(t)}size(t,n){const s=this.bbox();let i,r;for(s.width=0===s.width?1:s.width,s.height=0===s.height?1:s.height,i=this.length-1;i>=0;i--)r=this[i][0],"M"===r||"L"===r||"T"===r?(this[i][1]=(this[i][1]-s.x)*t/s.width+s.x,this[i][2]=(this[i][2]-s.y)*n/s.height+s.y):"H"===r?this[i][1]=(this[i][1]-s.x)*t/s.width+s.x:"V"===r?this[i][1]=(this[i][1]-s.y)*n/s.height+s.y:"C"===r||"S"===r||"Q"===r?(this[i][1]=(this[i][1]-s.x)*t/s.width+s.x,this[i][2]=(this[i][2]-s.y)*n/s.height+s.y,this[i][3]=(this[i][3]-s.x)*t/s.width+s.x,this[i][4]=(this[i][4]-s.y)*n/s.height+s.y,"C"===r&&(this[i][5]=(this[i][5]-s.x)*t/s.width+s.x,this[i][6]=(this[i][6]-s.y)*n/s.height+s.y)):"A"===r&&(this[i][1]=this[i][1]*t/s.width,this[i][2]=this[i][2]*n/s.height,this[i][6]=(this[i][6]-s.x)*t/s.width+s.x,this[i][7]=(this[i][7]-s.y)*n/s.height+s.y);return this}toString(){return function(t){let n="";for(let s=0,i=t.length;s<i;s++)n+=t[s][0],null!=t[s][1]&&(n+=t[s][1],null!=t[s][2]&&(n+=" ",n+=t[s][2],null!=t[s][3]&&(n+=" ",n+=t[s][3],n+=" ",n+=t[s][4],null!=t[s][5]&&(n+=" ",n+=t[s][5],n+=" ",n+=t[s][6],null!=t[s][7]&&(n+=" ",n+=t[s][7])))));return n+" "}(this)}}const cn=t=>{const n=typeof t;return"number"===n?wt:"string"===n?q.isColor(t)?q:X.test(t)?H.test(t)?on:dt:z.test(t)?wt:an:wn.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?dt:"object"===n?dn:an};class ln{constructor(t){this._stepper=t||new qt("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,n){return t&&n}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(cn(t));let n=new this._type(t);return this._type===q&&(n=this._to?n[this._to[4]]():this._from?n[this._from[4]]():n),this._type===dn&&(n=this._to?n.align(this._to):this._from?n.align(this._from):n),n=n.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object).map((function(t){return t.done=!0,t})),n}}class an{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class fn{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,fn.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}fn.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const pn=(t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0;class dn{constructor(...t){this.init(...t)}align(t){const n=this.values;for(let s=0,i=n.length;s<i;++s){if(n[s+1]===t[s+1]){if(n[s+1]===q&&t[s+7]!==n[s+7]){const n=t[s+7],i=new q(this.values.splice(s+3,5))[n]().toArray();this.values.splice(s+3,0,...i)}s+=n[s+2]+2;continue}if(!t[s+1])return this;const i=(new t[s+1]).toArray();n.splice(s,n[s+2]+3,t[s],t[s+1],t[s+2],...i),s+=n[s+2]+2}return this}init(t){if(this.values=[],Array.isArray(t))return void(this.values=t.slice());t=t||{};const n=[];for(const s in t){const i=cn(t[s]),r=new i(t[s]).toArray();n.push([s,i,r.length,...r])}return n.sort(pn),this.values=n.reduce(((t,n)=>t.concat(n)),[]),this}toArray(){return this.values}valueOf(){const t={},n=this.values;for(;n.length;){const s=n.shift(),i=n.shift(),r=n.shift(),e=n.splice(0,r);t[s]=new i(e)}return t}}const wn=[an,fn,dn];class yn extends Mt{constructor(t,n=t){super(M("path",t),n)}array(){return this._array||(this._array=new on(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,n){return this.attr("d",this.array().move(t,n))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new on(t))}size(t,n){const s=c(this,t,n);return this.attr("d",this.array().size(s.width,s.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}yn.prototype.MorphArray=on,i({Container:{path:T((function(t){return this.put(new yn).plot(t||new on)}))}}),O(yn,"Path");var mn=Object.freeze({__proto__:null,array:function(){return this._array||(this._array=new Gt(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,n){return this.attr("points",this.array().move(t,n))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new Gt(t))},size:function(t,n){const s=c(this,t,n);return this.attr("points",this.array().size(s.width,s.height))}});class gn extends Mt{constructor(t,n=t){super(M("polygon",t),n)}}i({Container:{polygon:T((function(t){return this.put(new gn).plot(t||new Gt)}))}}),E(gn,Yt),E(gn,mn),O(gn,"Polygon");class xn extends Mt{constructor(t,n=t){super(M("polyline",t),n)}}i({Container:{polyline:T((function(t){return this.put(new xn).plot(t||new Gt)}))}}),E(xn,Yt),E(xn,mn),O(xn,"Polyline");class bn extends Mt{constructor(t,n=t){super(M("rect",t),n)}}E(bn,{rx:kt,ry:At}),i({Container:{rect:T((function(t,n){return this.put(new bn).size(t,n)}))}}),O(bn,"Rect");class vn{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const n=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(n.prev=this._last,this._last.next=n,this._last=n):(this._last=n,this._first=n),n}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}}const _n={nextDraw:null,frames:new vn,timeouts:new vn,immediates:new vn,timer:()=>m.window.performance||m.window.Date,transforms:[],frame(t){const n=_n.frames.push({run:t});return null===_n.nextDraw&&(_n.nextDraw=m.window.requestAnimationFrame(_n._draw)),n},timeout(t,n){n=n||0;const s=_n.timer().now()+n,i=_n.timeouts.push({run:t,time:s});return null===_n.nextDraw&&(_n.nextDraw=m.window.requestAnimationFrame(_n._draw)),i},immediate(t){const n=_n.immediates.push(t);return null===_n.nextDraw&&(_n.nextDraw=m.window.requestAnimationFrame(_n._draw)),n},cancelFrame(t){null!=t&&_n.frames.remove(t)},clearTimeout(t){null!=t&&_n.timeouts.remove(t)},cancelImmediate(t){null!=t&&_n.immediates.remove(t)},_draw(t){let n=null;const s=_n.timeouts.last();for(;(n=_n.timeouts.shift())&&(t>=n.time?n.run():_n.timeouts.push(n),n!==s););let i=null;const r=_n.frames.last();for(;i!==r&&(i=_n.frames.shift());)i.run(t);let e=null;for(;e=_n.immediates.shift();)e();_n.nextDraw=_n.timeouts.first()||_n.frames.first()?m.window.requestAnimationFrame(_n._draw):null}},Mn=function(t){const n=t.start,s=t.runner.duration();return{start:n,duration:s,end:n+s,runner:t.runner}},kn=function(){const t=m.window;return(t.performance||t.Date).now()};class An extends at{constructor(t=kn){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),n=t?t.runner.duration():0;return(t?t.start:this._time)+n}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const n=this.speed();if(null==t)return this.speed(-n);const s=Math.abs(n);return this.speed(t?-s:s)}schedule(t,n,s){if(null==t)return this._runners.map(Mn);let i=0;const r=this.getEndTime();if(n=n||0,null==s||"last"===s||"after"===s)i=r;else if("absolute"===s||"start"===s)i=n,n=0;else if("now"===s)i=this._time;else if("relative"===s){const s=this.getRunnerInfoById(t.id);s&&(i=s.start+n,n=0)}else{if("with-last"!==s)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();i=t?t.start:this._time}}t.unschedule(),t.timeline(this);const e=t.persist(),h={persist:null===e?this._persist:e,start:i+n,runner:t};return this._lastRunnerId=t.id,this._runners.push(h),this._runners.sort(((t,n)=>t.start-n.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const n=this._runnerIds.indexOf(t.id);return n<0||(this._runners.splice(n,1),this._runnerIds.splice(n,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return _n.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=_n.frame(this._step)),this)}_stepFn(t=!1){const n=this._timeSource();let s=n-this._lastSourceTime;t&&(s=0);const i=this._speed*s+(this._time-this._lastStepTime);this._lastSourceTime=n,t||(this._time+=i,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let t=this._runners.length;t--;){const n=this._runners[t];this._time-n.start<=0&&n.runner.reset()}let r=!1;for(let t=0,n=this._runners.length;t<n;t++){const s=this._runners[t],e=s.runner;let h=i;const u=this._time-s.start;u<=0?r=!0:(u<h&&(h=u),e.active()&&(e.step(h).done?!0!==s.persist&&e.duration()-e.time()+this._time+s.persist<this._time&&(e.unschedule(),--t,--n):r=!0))}return r&&!(this._speed<0&&0===this._time)||this._runnerIds.length&&this._speed<0&&this._time>0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}}i({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new An,this._timeline):(this._timeline=t,this)}}});class On extends at{constructor(t){super(),this.id=On.id++,t="function"==typeof(t=null==t?400:t)?new Jt(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof Jt,this._stepper=this._isDeclarative?t:new qt,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new Z,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}static sanitise(t,n,s){let i=1,r=!1,e=0;return n=n??0,s=s||"last","object"!=typeof(t=t??400)||t instanceof Qt||(n=t.delay??n,s=t.when??s,r=t.swing||r,i=t.times??i,e=t.wait??e,t=t.duration??400),{duration:t,delay:n,swing:r,times:i,wait:e,when:s}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,n,s){const i=On.sanitise(t,n,s),r=new On(i.duration);return this._timeline&&r.timeline(this._timeline),this._element&&r.element(this._element),r.loop(i).schedule(i.delay,i.when)}clearTransform(){return this.transforms=new Z,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new qt(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,n,s){return"object"==typeof t&&(n=t.swing,s=t.wait,t=t.times),this._times=t||1/0,this._swing=n||!1,this._wait=s||0,!0===this._times&&(this._times=1/0),this}loops(t){const n=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/n);return Math.min(t+(this._time-t*n)/this._duration,this._times)}const s=Math.floor(t);return this.time(n*s+this._duration*(t%1))}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const n=this._time,s=this._duration,i=this._wait,r=this._swing,e=this._reverse;let h;if(null==t){const t=function(t){const n=r*Math.floor(t%(2*(i+s))/(i+s)),h=n&&!e||!n&&e,u=Math.pow(-1,h)*(t%(i+s))/s+h;return Math.max(Math.min(u,1),0)},u=this._times*(i+s)-i;return h=n<=0?Math.round(t(1e-5)):n<u?t(n):Math.round(t(u-1e-5)),h}const u=Math.floor(this.loops()),o=r&&u%2==0;return h=u+(o&&!e||e&&o?t:1-t),this.loops(h)}progress(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}queue(t,n,s,i){return this._queue.push({initialiser:t||ft,runner:n||ft,retarget:s,isTransform:i,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}reset(){return this._reseted||(this.time(0),this._reseted=!0),this}reverse(t){return this._reverse=null==t?!this._reverse:t,this}schedule(t,n,s){if(t instanceof An||(s=n,n=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,n,s),this}step(t){if(!this.enabled)return this;this._time+=t=null==t?16:t;const n=this.position(),s=this._lastPosition!==n&&this._time>=0;this._lastPosition=n;const i=this.duration(),r=this._lastTime<=0&&this._time>0,e=this._lastTime<i&&this._time>=i;this._lastTime=this._time,r&&this.fire("start",this);const h=this._isDeclarative;this.done=!h&&!e&&this._time>=i,this._reseted=!1;let u=!1;return(s||h)&&(this._initialise(s),this.transforms=new Z,u=this._run(h?t:n),this.fire("step",this)),this.done=this.done||u&&h,e&&this.fire("finished",this),this}time(t){return null==t?this._time:(this.step(t-this._time),this)}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let n=0,s=this._queue.length;n<s;++n){const s=this._queue[n],i=this._isDeclarative||!s.initialised&&t;t=!s.finished,i&&t&&(s.initialiser.call(this),s.initialised=!0)}}_rememberMorpher(t,n){if(this._history[t]={morpher:n,caller:this._queue[this._queue.length-1]},this._isDeclarative){const t=this.timeline();t&&t.play()}}_run(t){let n=!0;for(let s=0,i=this._queue.length;s<i;++s){const i=this._queue[s],r=i.runner.call(this,t);i.finished=i.finished||!0===r,n=n&&i.finished}return n}_tryRetarget(t,n,s){if(this._history[t]){if(!this._history[t].caller.initialised){const n=this._queue.indexOf(this._history[t].caller);return this._queue.splice(n,1),!1}this._history[t].caller.retarget?this._history[t].caller.retarget.call(this,n,s):this._history[t].morpher.to(n),this._history[t].caller.finished=!1;const i=this.timeline();return i&&i.play(),!0}return!1}}On.id=0;class jn{constructor(t=new Z,n=-1,s=!0){this.transforms=t,this.id=n,this.done=s}clearTransformsFromQueue(){}}E([On,jn],{mergeWith(t){return new jn(t.transforms.lmultiply(this.transforms),t.id)}});const Cn=(t,n)=>t.lmultiplyO(n),Sn=t=>t.transforms;function En(){const t=this._transformationRunners.runners.map(Sn).reduce(Cn,new Z);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class Tn{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const n=t.id+1;return this.runners.push(t),this.ids.push(n),this}clearBefore(t){const n=this.ids.indexOf(t+1)||1;return this.ids.splice(0,n,0),this.runners.splice(0,n,new jn).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,n){const s=this.ids.indexOf(t+1);return this.ids.splice(s,1,t+1),this.runners.splice(s,1,n),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let n=0;n<this.runners.length;++n){const s=this.runners[n];if(!(t&&s.done&&t.done)||s._timeline&&s._timeline._runnerIds.includes(s.id)||t._timeline&&t._timeline._runnerIds.includes(t.id))t=s;else{this.remove(s.id);const i=s.mergeWith(t);this.edit(t.id,i),t=i,--n}}return this}remove(t){const n=this.ids.indexOf(t+1);return this.ids.splice(n,1),this.runners.splice(n,1),this}}i({Element:{animate(t,n,s){const i=On.sanitise(t,n,s),r=this.timeline();return new On(i.duration).loop(i).element(this).timeline(r.play()).schedule(i.delay,i.when)},delay(t,n){return this.animate(0,t,n)},_clearTransformRunnersBefore(t){this._transformationRunners.clearBefore(t.id)},_currentTransform(t){return this._transformationRunners.runners.filter((n=>n.id<=t.id)).map(Sn).reduce(Cn,new Z)},_addRunner(t){this._transformationRunners.add(t),_n.cancelImmediate(this._frameId),this._frameId=_n.immediate(En.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new Tn).add(new jn(new Z(this))))}}}),E(On,{attr(t,n){return this.styleAttr("attr",t,n)},css(t,n){return this.styleAttr("css",t,n)},styleAttr(t,n,s){if("string"==typeof n)return this.styleAttr(t,{[n]:s});let i=n;if(this._tryRetarget(t,i))return this;let r=new ln(this._stepper).to(i),e=Object.keys(i);return this.queue((function(){r=r.from(this.element()[t](e))}),(function(n){return this.element()[t](r.at(n).valueOf()),r.done()}),(function(n){const s=Object.keys(n),h=(u=e,s.filter((t=>!u.includes(t))));var u;if(h.length){const n=this.element()[t](h),s=new dn(r.from()).valueOf();Object.assign(s,n),r.from(s)}const o=new dn(r.to()).valueOf();Object.assign(o,n),r.to(o),e=s,i=n})),this._rememberMorpher(t,r),this},zoom(t,n){if(this._tryRetarget("zoom",t,n))return this;let s=new ln(this._stepper).to(new wt(t));return this.queue((function(){s=s.from(this.element().zoom())}),(function(t){return this.element().zoom(s.at(t),n),s.done()}),(function(t,i){n=i,s.to(t)})),this._rememberMorpher("zoom",s),this},transform(t,n,s){if(n=t.relative||n,this._isDeclarative&&!n&&this._tryRetarget("transform",t))return this;const i=Z.isMatrixLike(t);s=null!=t.affine?t.affine:null!=s?s:!i;const r=new ln(this._stepper).type(s?fn:Z);let e,h,u,o,c;return this.queue((function(){h=h||this.element(),e=e||l(t,h),c=new Z(n?void 0:h),h._addRunner(this),n||h._clearTransformRunnersBefore(this)}),(function(l){n||this.clearTransform();const{x:a,y:f}=new J(e).transform(h._currentTransform(this));let p=new Z({...t,origin:[a,f]}),d=this._isDeclarative&&u?u:c;if(s){p=p.decompose(a,f),d=d.decompose(a,f);const t=p.rotate,n=d.rotate,s=[t-360,t,t+360],i=s.map((t=>Math.abs(t-n))),r=Math.min(...i),e=i.indexOf(r);p.rotate=s[e]}n&&(i||(p.rotate=t.rotate||0),this._isDeclarative&&o&&(d.rotate=o)),r.from(d),r.to(p);const w=r.at(l);return o=w.rotate,u=new Z(w),this.addTransform(u),h._addRunner(this),r.done()}),(function(n){(n.origin||"center").toString()!==(t.origin||"center").toString()&&(e=l(n,h)),t={...n,origin:e}}),!0),this._isDeclarative&&this._rememberMorpher("transform",r),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,n){return this.dx(t).dy(n)},_queueNumberDelta(t,n){if(n=new wt(n),this._tryRetarget(t,n))return this;const s=new ln(this._stepper).to(n);let i=null;return this.queue((function(){i=this.element()[t](),s.from(i),s.to(i+n)}),(function(n){return this.element()[t](s.at(n)),s.done()}),(function(t){s.to(i+new wt(t))})),this._rememberMorpher(t,s),this},_queueObject(t,n){if(this._tryRetarget(t,n))return this;const s=new ln(this._stepper).to(n);return this.queue((function(){s.from(this.element()[t]())}),(function(n){return this.element()[t](s.at(n)),s.done()})),this._rememberMorpher(t,s),this},_queueNumber(t,n){return this._queueObject(t,new wt(n))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,n){return this.x(t).y(n)},amove(t,n){return this.ax(t).ay(n)},center(t,n){return this.cx(t).cy(n)},size(t,n){let s;return t&&n||(s=this._element.bbox()),t||(t=s.width/s.height*n),n||(n=s.height/s.width*t),this.width(t).height(n)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,n,s,i){if(4===arguments.length)return this.plot([t,n,s,i]);if(this._tryRetarget("plot",t))return this;const r=new ln(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){r.from(this._element.array())}),(function(t){return this._element.plot(r.at(t)),r.done()})),this._rememberMorpher("plot",r),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,n,s,i){return this._queueObject("viewbox",new tt(t,n,s,i))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),E(On,{rx:kt,ry:At,from:Dt,to:Pt}),O(On,"Runner");class zn extends vt{constructor(t,n=t){super(M("svg",t),n),this.namespace()}defs(){return this.isRoot()?k(this.node.querySelector("defs"))||this.put(new _t):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof m.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:d,version:"1.1"}).attr("xmlns:xlink",y,w):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,w).attr("xmlns:svgjs",null,w)}root(){return this.isRoot()?this:super.root()}}i({Container:{nested:T((function(){return this.put(new zn)}))}}),O(zn,"Svg",!0);class Fn extends vt{constructor(t,n=t){super(M("symbol",t),n)}}i({Container:{symbol:T((function(){return this.put(new Fn)}))}}),O(Fn,"Symbol");var Nn=Object.freeze({__proto__:null,amove:function(t,n){return this.ax(t).ay(n)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,n,s=this.bbox()){return this.cx(t,s).cy(n,s)},cx:function(t,n=this.bbox()){return null==t?n.cx:this.attr("x",this.attr("x")+t-n.cx)},cy:function(t,n=this.bbox()){return null==t?n.cy:this.attr("y",this.attr("y")+t-n.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,n,s=this.bbox()){return this.x(t,s).y(n,s)},plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(m.document.createTextNode(t)),this},x:function(t,n=this.bbox()){return null==t?n.x:this.attr("x",this.attr("x")+t-n.x)},y:function(t,n=this.bbox()){return null==t?n.y:this.attr("y",this.attr("y")+t-n.y)}});class Dn extends Mt{constructor(t,n=t){super(M("text",t),n),this.dom.leading=this.dom.leading??new wt(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new wt(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let n=0;const s=this.dom.leading;this.each((function(i){if(f(this.node))return;const r=m.window.getComputedStyle(this.node).getPropertyValue("font-size"),e=s*new wt(r);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?n+=e:(this.attr("dy",i?e+n:0),n=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new wt(t.leading||1.3),this}writeDataToDom(){return p(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const n=this.node.childNodes;let s=0;t="";for(let i=0,r=n.length;i<r;++i)"textPath"===n[i].nodeName||f(n[i])?0===i&&(s=i+1):(i!==s&&3!==n[i].nodeType&&!0===k(n[i]).dom.newLined&&(t+="\n"),t+=n[i].textContent);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(let n=0,s=(t=(t+"").split("\n")).length;n<s;n++)this.newLine(t[n]);return this.build(!1).rebuild()}}E(Dn,Nn),i({Container:{text:T((function(t=""){return this.put(new Dn).text(t)})),plain:T((function(t=""){return this.put(new Dn).plain(t)}))}}),O(Dn,"Text");class Pn extends Mt{constructor(t,n=t){super(M("tspan",t),n),this._build=!1}dx(t){return this.attr("dx",t)}dy(t){return this.attr("dy",t)}newLine(){this.dom.newLined=!0;const t=this.parent();if(!(t instanceof Dn))return this;const n=t.index(this),s=m.window.getComputedStyle(this.node).getPropertyValue("font-size"),i=t.dom.leading*new wt(s);return this.dy(n?i:0).attr("x",t.x())}text(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?(this.clear().build(!0),t.call(this,this),this.build(!1)):this.plain(t),this)}}E(Pn,Nn),i({Tspan:{tspan:T((function(t=""){const n=new Pn;return this._build||this.clear(),this.put(n).text(t)}))},Text:{newLine:function(t=""){return this.tspan(t).newLine()}}}),O(Pn,"Tspan");class In extends Mt{constructor(t,n=t){super(M("circle",t),n)}radius(t){return this.attr("r",t)}rx(t){return this.attr("r",t)}ry(t){return this.rx(t)}size(t){return this.radius(new wt(t).divide(2))}}E(In,{x:Ot,y:jt,cx:Ct,cy:St,width:Et,height:Tt}),i({Container:{circle:T((function(t=0){return this.put(new In).size(t).move(0,0)}))}}),O(In,"Circle");class Rn extends vt{constructor(t,n=t){super(M("clipPath",t),n)}remove(){return this.targets().forEach((function(t){t.unclip()})),super.remove()}targets(){return rt("svg [clip-path*="+this.id()+"]")}}i({Container:{clip:T((function(){return this.defs().put(new Rn)}))},Element:{clipper(){return this.reference("clip-path")},clipWith(t){const n=t instanceof Rn?t:this.parent().clip().add(t);return this.attr("clip-path","url(#"+n.id()+")")},unclip(){return this.attr("clip-path",null)}}}),O(Rn,"ClipPath");class Ln extends xt{constructor(t,n=t){super(M("foreignObject",t),n)}}i({Container:{foreignObject:T((function(t,n){return this.put(new Ln).size(t,n)}))}}),O(Ln,"ForeignObject");var $n=Object.freeze({__proto__:null,dmove:function(t,n){return this.children().forEach((s=>{let i;try{i=s.node instanceof m.window.SVGSVGElement?new tt(s.attr(["x","y","width","height"])):s.bbox()}catch(t){return}const r=new Z(s),e=r.translate(t,n).transform(r.inverse()),h=new J(i.x,i.y).transform(e);s.move(h.x,h.y)})),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,n=this.bbox()){return null==t?n.height:this.size(n.width,t,n)},move:function(t=0,n=0,s=this.bbox()){return this.dmove(t-s.x,n-s.y)},size:function(t,n,s=this.bbox()){const i=c(this,t,n,s),r=i.width/s.width,e=i.height/s.height;return this.children().forEach((t=>{const n=new J(s).transform(new Z(t).inverse());t.scale(r,e,n.x,n.y)})),this},width:function(t,n=this.bbox()){return null==t?n.width:this.size(t,n.height,n)},x:function(t,n=this.bbox()){return null==t?n.x:this.move(t,n.y,n)},y:function(t,n=this.bbox()){return null==t?n.y:this.move(n.x,t,n)}});class Gn extends vt{constructor(t,n=t){super(M("g",t),n)}}E(Gn,$n),i({Container:{group:T((function(){return this.put(new Gn)}))}}),O(Gn,"G");class Yn extends vt{constructor(t,n=t){super(M("a",t),n)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,y)}}E(Yn,$n),i({Container:{link:T((function(t){return this.put(new Yn).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const n=t.parent();if(!n)return this.remove();const s=n.index(t);return n.add(this,s),t.remove(),this},linkTo(t){let n=this.linker();return n||(n=new Yn,this.wrap(n)),"function"==typeof t?t.call(n,n):n.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),O(Yn,"A");class Xn extends vt{constructor(t,n=t){super(M("mask",t),n)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return rt("svg [mask*="+this.id()+"]")}}i({Container:{mask:T((function(){return this.defs().put(new Xn)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const n=t instanceof Xn?t:this.parent().mask().add(t);return this.attr("mask","url(#"+n.id()+")")},unmask(){return this.attr("mask",null)}}}),O(Xn,"Mask");class Hn extends xt{constructor(t,n=t){super(M("stop",t),n)}update(t){return("number"==typeof t||t instanceof wt)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new wt(t.offset)),this}}i({Gradient:{stop:function(t,n,s){return this.put(new Hn).update(t,n,s)}}}),O(Hn,"Stop");class Vn extends xt{constructor(t,n=t){super(M("style",t),n)}addText(t=""){return this.node.textContent+=t,this}font(t,n,s={}){return this.rule("@font-face",{fontFamily:t,src:n,...s})}rule(t,n){return this.addText(function(t,n){if(!t)return"";if(!n)return t;let s=t+"{";for(const t in n)s+=t.replace(/([A-Z])/g,(function(t,n){return"-"+n.toLowerCase()}))+":"+n[t]+";";return s+="}",s}(t,n))}}i("Dom",{style(t,n){return this.put(new Vn).rule(t,n)},fontface(t,n,s){return this.put(new Vn).font(t,n,s)}}),O(Vn,"Style");class Bn extends Dn{constructor(t,n=t){super(M("textPath",t),n)}array(){const t=this.track();return t?t.array():null}plot(t){const n=this.track();let s=null;return n&&(s=n.plot(t)),null==t?s:this}track(){return this.reference("href")}}i({Container:{textPath:T((function(t,n){return t instanceof Dn||(t=this.text(t)),t.path(n)}))},Text:{path:T((function(t,n=!0){const s=new Bn;let i;if(t instanceof yn||(t=this.defs().path(t)),s.attr("href","#"+t,y),n)for(;i=this.node.firstChild;)s.node.appendChild(i);return this.put(s)})),textPath(){return this.findOne("textPath")}},Path:{text:T((function(t){return t instanceof Dn||(t=(new Dn).addTo(this.parent()).text(t)),t.path(this)})),targets(){return rt("svg textPath").filter((t=>(t.attr("href")||"").includes(this.id())))}}}),Bn.prototype.MorphArray=on,O(Bn,"TextPath");class Qn extends Mt{constructor(t,n=t){super(M("use",t),n)}use(t,n){return this.attr("href",(n||"")+"#"+t,y)}}i({Container:{use:T((function(t,n){return this.put(new Qn).use(t,n)}))}}),O(Qn,"Use"),E([zn,Fn,$t,Lt,Ht],r("viewbox")),E([Xt,xn,gn,yn],r("marker")),E(Dn,r("Text")),E(yn,r("Path")),E(_t,r("Defs")),E([Dn,Pn],r("Tspan")),E([bn,Ft,Rt,On],r("radius")),E(at,r("EventTarget")),E(gt,r("Dom")),E(xt,r("Element")),E(Mt,r("Shape")),E([vt,Nt],r("Container")),E(Rt,r("Gradient")),E(On,r("Runner")),st.extend([...new Set(s)]),function(t=[]){wn.push(...[].concat(t))}([wt,q,tt,Z,dt,Gt,on,J]),E(wn,{to(t){return(new ln).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,n,s,i,r){return this.fromArray(t.map((function(t,e){return i.step(t,n[e],s,r[e],r)})))}});const qn=["#808080","#c0c0c0","#000000"],Jn=["#808080","#c0c0c0","#000000"],Un=["pl","fc","pp","ac"];function Zn(t){return t.replace(/\d+$/,"")}function Wn(t){return qn[t%qn.length]}function Kn(t){return Jn[t%Jn.length]}function ts(t){return.299*parseInt(t.slice(1,3),16)+.587*parseInt(t.slice(3,5),16)+.114*parseInt(t.slice(5,7),16)>128?"#000000":"#ffffff"}class ns{constructor(){this.font="16px Arial",this.size=16,this.color="#000000",this.background="#ffffff",this.leading=1.8}}class ss{adapt(n){const s=new ns;return t.isString(n.font)&&(s.font=n.font),t.isNumber(n.size)&&(s.size=n.size),t.isString(n.color)&&(s.color=n.color),t.isString(n.background)&&(s.background=n.background),t.isNumber(n.leading)&&(s.leading=n.leading),s}default(){return new ns}}class is{constructor(t,n,s,i){this.ac=t,this.fc=n,this.pp=s,this.pl=i}getSVGStyle(t){return"ac"===t?this.ac:"fc"===t?this.fc:"pp"===t?this.pp:"pl"===t?this.pl:this.ac}}class rs{constructor(t){this.svgStyleAdapter=t}adapt(n){const s=new is(this.svgStyleAdapter.defaultAC(),this.svgStyleAdapter.defaultFC(),this.svgStyleAdapter.defaultPP(),this.svgStyleAdapter.defaultPL());return t.isExisting(n.ac)&&(s.ac=this.svgStyleAdapter.adapt(n.ac)),t.isExisting(n.fc)&&(s.fc=this.svgStyleAdapter.adapt(n.fc)),t.isExisting(n.pp)&&(s.pp=this.svgStyleAdapter.adapt(n.pp)),t.isExisting(n.pl)&&(s.pl=this.svgStyleAdapter.adapt(n.pl)),s}default(){return new is(this.svgStyleAdapter.defaultAC(),this.svgStyleAdapter.defaultFC(),this.svgStyleAdapter.defaultPP(),this.svgStyleAdapter.defaultPL())}}class es{constructor(){this.top=10,this.left=10,this.right=10,this.bottom=10}}class hs{adapt(n){const s=new es;return t.isNumber(n.top)&&(s.top=n.top),t.isNumber(n.left)&&(s.left=n.left),t.isNumber(n.right)&&(s.right=n.right),t.isNumber(n.bottom)&&(s.bottom=n.bottom),s}default(){return new es}}class us{constructor(t="#000000",n="#000000",s=.1){this.stroke=t,this.fill=n,this.width=s}}class os{adapt(n){const s=new us(n.stroke,n.fill,n.width);return t.isString(n.fillpattern)&&(s.fillpattern=n.fillpattern),t.isString(n.dasharray)&&(s.dasharray=n.dasharray),s}default(){return new us("#000000","#000000",.3)}defaultAC(){return new us("#000000","#000000",.3)}defaultFC(){const t=new us("#000000","#000000",.3);return t.dasharray="10 5 5 5",t.fillpattern="fc",t}defaultPP(){return new us("#999999","#999999",.3)}defaultPL(){return new us("#000000","#ffffff",.3)}defaultPos(){return new us("#00ff00","#00ff00",.3)}defaultNeg(){return new us("#ff0000","#ff0000",.3)}defaultNeu(){return new us("#999999","#999999",.3)}}class cs{constructor(t,n,s){this.pos=t,this.neg=n,this.neu=s,this.needleHeadColour="#000000"}getSVGStyle(t){return"pos"===t?this.pos:"neg"===t?this.neg:this.neu}}class ls{constructor(t){this.svgStyleAdapter=t}adapt(n){const s=new cs(this.svgStyleAdapter.defaultPos(),this.svgStyleAdapter.defaultNeg(),this.svgStyleAdapter.defaultNeu());return t.isExisting(n.pos)&&(s.pos=this.svgStyleAdapter.adapt(n.pos)),t.isExisting(n.neg)&&(s.neg=this.svgStyleAdapter.adapt(n.neg)),t.isExisting(n.pp)&&(s.neu=this.svgStyleAdapter.adapt(n.neu)),t.isString(n.needleHeadColour)&&(s.needleHeadColour=n.needleHeadColour),s}default(){return new cs(this.svgStyleAdapter.defaultPos(),this.svgStyleAdapter.defaultNeg(),this.svgStyleAdapter.defaultNeu())}}export{ss as F,Un as I,hs as P,zn as S,Wn as a,Kn as b,Zn as c,rs as d,os as e,ls as f,ts as g}
@@ -1 +1 @@
1
- import{proxyCustomElement as e,HTMLElement as t,h as i,Host as s,transformTag as a}from"@stencil/core/internal/client";import{v as r,a as n,h as o,j as l,b as c,c as d,k as h,l as p,m as u,n as v,i as g}from"./validate.js";import{w as m,g as f,p as y}from"./scaling.js";import{w as b,a as S}from"./withHasError.js";import{w}from"./withTranslation.js";import{a as O}from"./context-protocol.js";import{w as k}from"./withStyled.js";import{w as x}from"./withComponentStyle.js";import{A as R,b as _,O as T,f as E,g as A}from"./Order.js";import{d as U}from"./ibcs-chart-structure2.js";const M=e(class extends t{validateScenario(e){const t=r(e),i="ERR_scenarios";t.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(t)+"' are not supported."}):this.errors.remove(i)}validateVariances(e){const t="ERR_variances",i=n(e);i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(t)}validateUnitScaling(e){const t="ERR_unitScaling";o(e)||this.pixelPerUnitGroupMap.has(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"unitScaling: invalid value(s) '"+e+"' are not supported."})}validatePercentageScaling(e){const t="ERR_percentageScaling";o(e)||this.pixelPerUnitGroupMap.has(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"percentageScaling: invalid value(s) '"+e+"' are not supported."})}validateLevel(e){const t="ERR_level";l(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"level: invalid value(s) '"+e+"' are not supported."})}validateOrderList(e){const t=c(e),i="ERR_order";t.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(t)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(e){const t="ERR_orderDirection";d(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"orderDirection: invalid value '"+(null==e?void 0:""+e)+"' is not supported."})}validateLimit(e){const t="ERR_limit";h(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"limit: invalid value '"+(null==e?void 0:""+e)+"' is not supported."})}validateShowCategories(e){const t="ERR_showCategories";p(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showCategories: invalid value(s) '"+(null==e?void 0:""+e)+"' are not supported."})}validateMeasureScale(e){const t="ERR_measureScale";u(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"measureScale: invalid value '"+(null==e?void 0:""+e)+"' is not supported."})}validateShowMeasureScale(e){const t="ERR_grouped";p(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==e?void 0:""+e)+"' are not supported."})}validateStack(e){const t="ERR_stack",i=v(e);i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:i.join("; ")}):this.errors.remove(t)}validateScaling(e){if(null==e||""===e||"none"===e||"auto"===e)return void this.errors.remove("ERR_scale");const t=Number(e);isNaN(t)||t<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${e}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.scenariosArray=[""],this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,k(this),b(this),m(this,((e,t)=>{this.data=t||[]}),((e,t)=>{this.datasetMeta=t})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=S(this),this.componentStyle=x(this),this.t=w(this).t}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var e,t;const{mode:i}=y(this.scale);if("auto"!==i&&"empty"!==i){this._autoScaleGuard=!1;const e=f(this.element),t="WARN_overflow";return void(e.width>0&&this.element.scrollWidth>e.width+1?this.errors.addOrReplace({id:t,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(t))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const s=this.element,{height:a}=f(s);if(a<=0)return;const r=this.componentStyle((e=>{var t;return(null===(t=e.global)||void 0===t?void 0:t.fontSizePx)||13.3333}));s.style.setProperty("--bn-font-size",r+"px");const n=null===(e=s.shadowRoot)||void 0===e?void 0:e.querySelector(".container"),o=null!==(t=null==n?void 0:n.scrollHeight)&&void 0!==t?t:s.scrollHeight;if(o<=a+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,this.appliedScaleFactor=1));const l=(a-1)/o;s.style.setProperty("--bn-font-size",r*l+"px"),"empty"===i?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(l-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=l)}prepareDimension(){const e=f(this.element);return this.canvasWidthSegmented=e.width/this.scenariosArray.length,{width:this.canvasWidthSegmented,height:e.height}}prepareScenarios(){var e,t,i,s;const a="auto"===(null===(e=this.scenarios)||void 0===e?void 0:e.trim().toLowerCase());return g(this.scenarios)||a?(null===(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)||void 0===i?void 0:i.length)>0?(a?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((e=>e.trim())))}prepareVariances(){var e;return g(this.variances)?[]:null===(e=this.variances)||void 0===e?void 0:e.split(",").map((e=>e.trim()))}prepareHideCategories(e){return e>=1||"true"!==this.showCategories}prepareI18n(){const e=O,t=new Map([].map((e=>[e,this.t(".".concat(e))]))),i=new Map(e.map((e=>[e,this.t("global.".concat(e))])));return new Map([...i.entries(),...t.entries()])}preparePixelPerUnit(){var e;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(e=this.unitScaling)||void 0===e?void 0:(""+e).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const t=Number(this.unitScaling);return!isNaN(t)&&t>0?(this.errors.remove("AUTO_unitScaling"),t):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var e,t,i;const s="auto"===(null===(e=this.level)||void 0===e?void 0:e.trim().toLowerCase());return g(this.level)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),R[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),R[null===(i=this.level)||void 0===i?void 0:i.toUpperCase()])}prepareOrder(){var e,t,i;const s="auto"===(null===(e=this.order)||void 0===e?void 0:e.trim().toLowerCase());let a;return g(this.order)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(s?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),a=this.datasetMeta.suggestedOrder):a=this.order:(this.errors.remove("AUTO_order"),a=this.order),{hierarchy:null==a?void 0:a.split(",").map((e=>T[null==e?void 0:e.toUpperCase()])),direction:_[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()]}}prepareStyle(){const e=this.getEffectiveScaleFactor();return this.componentStyle((t=>{const i=t.global.fontSizePx*e;return{scaleFactors:{scenarioOffset:t["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:t["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:t["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:t["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:t["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:t["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:t["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:t["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:t["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:t["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:t["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:t["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:t["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:t["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:t["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${i}px ${t.global.fontFamily}`,size:i,color:t.global.fontColor,background:t.global.fontBackgroundColor,leading:1.8},axisStyles:t["bn-chart-structure"].axisStyles,barStyles:t["bn-chart-structure"].barStyles,varianceStyles:t["bn-chart-structure"].varianceStyles,padding:t["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(e){return e>=1?"":this.chartTitle}prepareStackConfig(){if(g(this.stack))return null;try{const e=JSON.parse(this.stack);return{by:e.by,mode:e.mode||A.ABSOLUTE,order:e.order||E.DATASET}}catch(e){return null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return g(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(e){return 0===e&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(e,t){const s=this.getEffectiveScaleFactor(),a=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage();return i("ibcs-chart-structure",{data:this.data,chartTitle:this.prepareChartTitle(t),scenarios:this.prepareScenarios(),variances:[e],hideCategories:this.prepareHideCategories(t),pixelPerUnit:a>0?a*s:0,pixelPerPercentage:r>0?r*s:0,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(t),stackConfig:this.prepareStackConfig(),parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:e,factor:t}=y(this.scale);return"factor"===e?t:"auto"===e||"empty"===e?this.appliedScaleFactor:1}getFontStyles(){const e=this.getEffectiveScaleFactor();return this.componentStyle((t=>{var i,s,a,r;const n=(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*e+"px","--bn-font-color":(null===(a=t.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let e=[""];const t=this.prepareVariances();t.length>0&&(e=[...e,...t]);const a=this.getFontStyles();return i(s,{key:"c8ad939fbe92ab4a01af1e5ce17e097dbb5eab56",style:a},i("div",{key:"d786c49dd808c2dd9093ede7100e16ac52f50689",class:"container"},e.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),C=M,N=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((e=>{switch(e){case"bn-chart-structure":customElements.get(a(e))||customElements.define(a(e),M);break;case"ibcs-chart-structure":customElements.get(a(e))||U()}}))};export{C as BnChartStructure,N as defineCustomElement}
1
+ import{proxyCustomElement as e,HTMLElement as t,h as i,Host as s,transformTag as a}from"@stencil/core/internal/client";import{v as r,a as n,h as o,j as l,b as c,c as d,k as h,l as p,m as u,n as v,i as g}from"./validate.js";import{w as m,g as f,p as y}from"./scaling.js";import{w as b,a as S}from"./withHasError.js";import{w}from"./withTranslation.js";import{a as O}from"./context-protocol.js";import{w as k}from"./withStyled.js";import{w as x}from"./withComponentStyle.js";import{A as R,b as _,O as T,g as E,h as A}from"./Order.js";import{d as U}from"./ibcs-chart-structure2.js";const M=e(class extends t{validateScenario(e){const t=r(e),i="ERR_scenarios";t.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(t)+"' are not supported."}):this.errors.remove(i)}validateVariances(e){const t="ERR_variances",i=n(e);i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(t)}validateUnitScaling(e){const t="ERR_unitScaling";o(e)||this.pixelPerUnitGroupMap.has(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"unitScaling: invalid value(s) '"+e+"' are not supported."})}validatePercentageScaling(e){const t="ERR_percentageScaling";o(e)||this.pixelPerUnitGroupMap.has(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"percentageScaling: invalid value(s) '"+e+"' are not supported."})}validateLevel(e){const t="ERR_level";l(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"level: invalid value(s) '"+e+"' are not supported."})}validateOrderList(e){const t=c(e),i="ERR_order";t.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(t)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(e){const t="ERR_orderDirection";d(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"orderDirection: invalid value '"+(null==e?void 0:""+e)+"' is not supported."})}validateLimit(e){const t="ERR_limit";h(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"limit: invalid value '"+(null==e?void 0:""+e)+"' is not supported."})}validateShowCategories(e){const t="ERR_showCategories";p(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showCategories: invalid value(s) '"+(null==e?void 0:""+e)+"' are not supported."})}validateMeasureScale(e){const t="ERR_measureScale";u(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"measureScale: invalid value '"+(null==e?void 0:""+e)+"' is not supported."})}validateShowMeasureScale(e){const t="ERR_grouped";p(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==e?void 0:""+e)+"' are not supported."})}validateStack(e){const t="ERR_stack",i=v(e);i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:i.join("; ")}):this.errors.remove(t)}validateScaling(e){if(null==e||""===e||"none"===e||"auto"===e)return void this.errors.remove("ERR_scale");const t=Number(e);isNaN(t)||t<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${e}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.scenariosArray=[""],this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,k(this),b(this),m(this,((e,t)=>{this.data=t||[]}),((e,t)=>{this.datasetMeta=t})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=S(this),this.componentStyle=x(this),this.t=w(this).t}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var e,t;const{mode:i}=y(this.scale);if("auto"!==i&&"empty"!==i){this._autoScaleGuard=!1;const e=f(this.element),t="WARN_overflow";return void(e.width>0&&this.element.scrollWidth>e.width+1?this.errors.addOrReplace({id:t,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(t))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const s=this.element,{height:a}=f(s);if(a<=0)return;const r=this.componentStyle((e=>{var t;return(null===(t=e.global)||void 0===t?void 0:t.fontSizePx)||13.3333}));s.style.setProperty("--bn-font-size",r+"px");const n=null===(e=s.shadowRoot)||void 0===e?void 0:e.querySelector(".container"),o=null!==(t=null==n?void 0:n.scrollHeight)&&void 0!==t?t:s.scrollHeight;if(o<=a+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,this.appliedScaleFactor=1));const l=(a-1)/o;s.style.setProperty("--bn-font-size",r*l+"px"),"empty"===i?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(l-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=l)}prepareDimension(){const e=f(this.element);return this.canvasWidthSegmented=e.width/this.scenariosArray.length,{width:this.canvasWidthSegmented,height:e.height}}prepareScenarios(){var e,t,i,s;const a="auto"===(null===(e=this.scenarios)||void 0===e?void 0:e.trim().toLowerCase());return g(this.scenarios)||a?(null===(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)||void 0===i?void 0:i.length)>0?(a?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((e=>e.trim())))}prepareVariances(){var e;return g(this.variances)?[]:null===(e=this.variances)||void 0===e?void 0:e.split(",").map((e=>e.trim()))}prepareHideCategories(e){return e>=1||"true"!==this.showCategories}prepareI18n(){const e=O,t=new Map([].map((e=>[e,this.t(".".concat(e))]))),i=new Map(e.map((e=>[e,this.t("global.".concat(e))])));return new Map([...i.entries(),...t.entries()])}preparePixelPerUnit(){var e;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(e=this.unitScaling)||void 0===e?void 0:(""+e).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const t=Number(this.unitScaling);return!isNaN(t)&&t>0?(this.errors.remove("AUTO_unitScaling"),t):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var e,t,i;const s="auto"===(null===(e=this.level)||void 0===e?void 0:e.trim().toLowerCase());return g(this.level)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),R[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),R[null===(i=this.level)||void 0===i?void 0:i.toUpperCase()])}prepareOrder(){var e,t,i;const s="auto"===(null===(e=this.order)||void 0===e?void 0:e.trim().toLowerCase());let a;return g(this.order)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(s?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),a=this.datasetMeta.suggestedOrder):a=this.order:(this.errors.remove("AUTO_order"),a=this.order),{hierarchy:null==a?void 0:a.split(",").map((e=>T[null==e?void 0:e.toUpperCase()])),direction:_[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()]}}prepareStyle(){const e=this.getEffectiveScaleFactor();return this.componentStyle((t=>{const i=t.global.fontSizePx*e;return{scaleFactors:{scenarioOffset:t["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:t["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:t["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:t["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:t["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:t["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:t["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:t["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:t["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:t["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:t["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:t["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:t["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:t["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:t["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${i}px ${t.global.fontFamily}`,size:i,color:t.global.fontColor,background:t.global.fontBackgroundColor,leading:1.8},axisStyles:t["bn-chart-structure"].axisStyles,barStyles:t["bn-chart-structure"].barStyles,varianceStyles:t["bn-chart-structure"].varianceStyles,padding:t["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(e){return e>=1?"":this.chartTitle}prepareStackConfig(){if(g(this.stack))return null;try{const e=JSON.parse(this.stack);return{by:e.by,mode:e.mode||A.ABSOLUTE,order:e.order||E.DATASET}}catch(e){return null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return g(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(e){return 0===e&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(e,t){const s=this.getEffectiveScaleFactor(),a=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage();return i("ibcs-chart-structure",{data:this.data,chartTitle:this.prepareChartTitle(t),scenarios:this.prepareScenarios(),variances:[e],hideCategories:this.prepareHideCategories(t),pixelPerUnit:a>0?a*s:0,pixelPerPercentage:r>0?r*s:0,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(t),stackConfig:this.prepareStackConfig(),parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:e,factor:t}=y(this.scale);return"factor"===e?t:"auto"===e||"empty"===e?this.appliedScaleFactor:1}getFontStyles(){const e=this.getEffectiveScaleFactor();return this.componentStyle((t=>{var i,s,a,r;const n=(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*e+"px","--bn-font-color":(null===(a=t.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let e=[""];const t=this.prepareVariances();t.length>0&&(e=[...e,...t]);const a=this.getFontStyles();return i(s,{key:"c8ad939fbe92ab4a01af1e5ce17e097dbb5eab56",style:a},i("div",{key:"d786c49dd808c2dd9093ede7100e16ac52f50689",class:"container"},e.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),C=M,N=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((e=>{switch(e){case"bn-chart-structure":customElements.get(a(e))||customElements.define(a(e),M);break;case"ibcs-chart-structure":customElements.get(a(e))||U()}}))};export{C as BnChartStructure,N as defineCustomElement}