@hpcc-js/tree 3.2.19 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/tree"]={},t["@hpcc-js/api"],t["@hpcc-js/common"])}(this,function(t,e,n){"use strict";var r=Object.defineProperty,i=(t,e)=>r(t,"name",{value:e,configurable:!0});function o(t,e){return t.parent===e.parent?1:2}function a(t){return t.reduce(l,0)/t.length}function l(t,e){return t+e.x}function s(t){return 1+t.reduce(c,0)}function c(t,e){return Math.max(t,e.y)}function u(t){for(var e;e=t.children;)t=e[0];return t}function h(t){for(var e;e=t.children;)t=e[e.length-1];return t}function p(){var t=o,e=1,n=1,r=!1;function l(i){var o,l=0;i.eachAfter(function(e){var n=e.children;n?(e.x=a(n),e.y=s(n)):(e.x=o?l+=t(e,o):0,e.y=0,o=e)});var c=u(i),p=h(i),d=c.x-t(c,p)/2,f=p.x+t(p,c)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-d)/(f-d)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i(l,"cluster"),l.separation=function(e){return arguments.length?(t=e,l):t},l.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],l):r?null:[e,n]},l.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],l):r?[e,n]:null},l}function d(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function f(){return this.eachAfter(d)}function y(t){var e,n,r,i,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(r=0,i=n.length;r<i;++r)a.push(n[r])}while(a.length);return this}function m(t){for(var e,n,r=this,i=[r];r=i.pop();)if(t(r),e=r.children)for(n=e.length-1;n>=0;--n)i.push(e[n]);return this}function g(t){for(var e,n,r,i=this,o=[i],a=[];i=o.pop();)if(a.push(i),e=i.children)for(n=0,r=e.length;n<r;++n)o.push(e[n]);for(;i=a.pop();)t(i);return this}function x(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})}function _(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function b(t){for(var e=this,n=v(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r}function v(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}function w(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function S(){var t=[];return this.each(function(e){t.push(e)}),t}function T(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function C(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function z(t,e){var n,r,i,o,a,l=new A(t),s=+t.value&&(l.value=t.value),c=[l];for(null==e&&(e=k);n=c.pop();)if(s&&(n.value=+n.data.value),(i=e(n.data))&&(a=i.length))for(n.children=new Array(a),o=a-1;o>=0;--o)c.push(r=n.children[o]=new A(i[o])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(I)}function M(){return z(this).eachBefore(D)}function k(t){return t.children}function D(t){t.data=t.data.data}function I(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function A(t){this.data=t,this.depth=this.height=0,this.parent=null}i(o,"defaultSeparation$1"),i(a,"meanX"),i(l,"meanXReduce"),i(s,"maxY"),i(c,"maxYReduce"),i(u,"leafLeft"),i(h,"leafRight"),i(p,"d3Cluster"),i(d,"count"),i(f,"node_count"),i(y,"node_each"),i(m,"node_eachBefore"),i(g,"node_eachAfter"),i(x,"node_sum"),i(_,"node_sort"),i(b,"node_path"),i(v,"leastCommonAncestor"),i(w,"node_ancestors"),i(S,"node_descendants"),i(T,"node_leaves"),i(C,"node_links"),i(z,"hierarchy"),i(M,"node_copy"),i(k,"defaultChildren"),i(D,"copyData"),i(I,"computeHeight"),i(A,"Node$1"),A.prototype=z.prototype={constructor:A,count:f,each:y,eachAfter:g,eachBefore:m,sum:x,sort:_,path:b,ancestors:w,descendants:S,leaves:T,links:C,copy:M};var P=Array.prototype.slice;function R(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}function L(t){for(var e,n,r=0,i=(t=R(P.call(t))).length,o=[];r<i;)e=t[r],n&&N(n,e)?++r:(n=O(o=B(o,e)),r=0);return n}function B(t,e){var n,r;if(q(e,t))return[e];for(n=0;n<t.length;++n)if(E(e,t[n])&&q(F(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(E(F(t[n],t[r]),e)&&E(F(t[n],e),t[r])&&E(F(t[r],e),t[n])&&q(W(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function E(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function N(t,e){var n=t.r-e.r+1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function q(t,e){for(var n=0;n<e.length;++n)if(!N(t,e[n]))return!1;return!0}function O(t){switch(t.length){case 1:return V(t[0]);case 2:return F(t[0],t[1]);case 3:return W(t[0],t[1],t[2])}}function V(t){return{x:t.x,y:t.y,r:t.r}}function F(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,l=e.r,s=o-n,c=a-r,u=l-i,h=Math.sqrt(s*s+c*c);return{x:(n+o+s/h*u)/2,y:(r+a+c/h*u)/2,r:(h+i+l)/2}}function W(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,l=e.y,s=e.r,c=n.x,u=n.y,h=n.r,p=r-a,d=r-c,f=i-l,y=i-u,m=s-o,g=h-o,x=r*r+i*i-o*o,_=x-a*a-l*l+s*s,b=x-c*c-u*u+h*h,v=d*f-p*y,w=(f*b-y*_)/(2*v)-r,S=(y*m-f*g)/v,T=(d*_-p*b)/(2*v)-i,C=(p*g-d*m)/v,z=S*S+C*C-1,M=2*(o+w*S+T*C),k=w*w+T*T-o*o,D=-(z?(M+Math.sqrt(M*M-4*z*k))/(2*z):k/M);return{x:r+w+S*D,y:i+T+C*D,r:D}}function j(t,e,n){var r,i,o,a,l=t.x-e.x,s=t.y-e.y,c=l*l+s*s;c?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*l-o*s,n.y=t.y-r*s+o*l):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*l-o*s,n.y=e.y+r*s+o*l)):(n.x=e.x+n.r,n.y=e.y)}function $(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function H(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function U(t){this._=t,this.next=null,this.previous=null}function G(t){if(!(i=t.length))return 0;var e,n,r,i,o,a,l,s,c,u,h;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;j(n,e,r=t[2]),e=new U(e),n=new U(n),r=new U(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(l=3;l<i;++l){j(e._,n._,r=t[l]),r=new U(r),s=n.next,c=e.previous,u=n._.r,h=e._.r;do{if(u<=h){if($(s._,r._)){n=s,e.next=n,n.previous=e,--l;continue t}u+=s._.r,s=s.next}else{if($(c._,r._)){(e=c).next=n,n.previous=e,--l;continue t}h+=c._.r,c=c.previous}}while(s!==c.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,o=H(e);(r=r.next)!==n;)(a=H(r))<o&&(e=r,o=a);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=L(e),l=0;l<i;++l)(e=t[l]).x-=r.x,e.y-=r.y;return r.r}function Z(t){return null==t?null:J(t)}function J(t){if("function"!=typeof t)throw new Error;return t}function K(){return 0}function X(t){return function(){return t}}function Y(t){return Math.sqrt(t.value)}function Q(){var t=null,e=1,n=1,r=K;function o(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(tt(t)).eachAfter(et(r,.5)).eachBefore(nt(1)):i.eachBefore(tt(Y)).eachAfter(et(K,1)).eachAfter(et(r,i.r/Math.min(e,n))).eachBefore(nt(Math.min(e,n)/(2*i.r))),i}return i(o,"pack"),o.radius=function(e){return arguments.length?(t=Z(e),o):t},o.size=function(t){return arguments.length?(e=+t[0],n=+t[1],o):[e,n]},o.padding=function(t){return arguments.length?(r="function"==typeof t?t:X(+t),o):r},o}function tt(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function et(t,e){return function(n){if(r=n.children){var r,i,o,a=r.length,l=t(n)*e||0;if(l)for(i=0;i<a;++i)r[i].r+=l;if(o=G(r),l)for(i=0;i<a;++i)r[i].r-=l;n.r=o+l}}}function nt(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function rt(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function it(t,e,n,r,i){for(var o,a=t.children,l=-1,s=a.length,c=t.value&&(r-e)/t.value;++l<s;)(o=a[l]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*c}function ot(){var t=1,e=1,n=0,r=!1;function o(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(a(e,o)),r&&i.eachBefore(rt),i}function a(t,e){return function(r){r.children&&it(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,l=r.y1-n;a<i&&(i=a=(i+a)/2),l<o&&(o=l=(o+l)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=l}}return i(o,"partition"),i(a,"positionNode"),o.round=function(t){return arguments.length?(r=!!t,o):r},o.size=function(n){return arguments.length?(t=+n[0],e=+n[1],o):[t,e]},o.padding=function(t){return arguments.length?(n=+t,o):n},o}function at(t,e){return t.parent===e.parent?1:2}function lt(t){var e=t.children;return e?e[0]:t.t}function st(t){var e=t.children;return e?e[e.length-1]:t.t}function ct(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function ut(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}function ht(t,e,n){return t.a.parent===e.parent?t.a:n}function pt(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function dt(t){for(var e,n,r,i,o,a=new pt(t,0),l=[a];e=l.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)l.push(n=e.children[i]=new pt(r[i],i)),n.parent=e;return(a.parent=new pt(null,0)).children=[a],a}function ft(){var t=at,e=1,n=1,r=null;function o(i){var o=dt(i);if(o.eachAfter(a),o.parent.m=-o.z,o.eachBefore(l),r)i.eachBefore(c);else{var s=i,u=i,h=i;i.eachBefore(function(t){t.x<s.x&&(s=t),t.x>u.x&&(u=t),t.depth>h.depth&&(h=t)});var p=s===u?1:t(s,u)/2,d=p-s.x,f=e/(u.x+p+d),y=n/(h.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*f,t.y=t.depth*y})}return i}function a(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){ut(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=s(e,i,e.parent.A||r[0])}function l(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(e,n,r){if(n){for(var i,o=e,a=e,l=n,s=o.parent.children[0],c=o.m,u=a.m,h=l.m,p=s.m;l=st(l),o=lt(o),l&&o;)s=lt(s),(a=st(a)).a=e,(i=l.z+h-o.z-c+t(l._,o._))>0&&(ct(ht(l,e,r),e,i),c+=i,u+=i),h+=l.m,c+=o.m,p+=s.m,u+=a.m;l&&!st(a)&&(a.t=l,a.m+=h-u),o&&!lt(s)&&(s.t=o,s.m+=c-p,r=e)}return r}function c(t){t.x*=e,t.y=t.depth*n}return i(o,"tree"),i(a,"firstWalk"),i(l,"secondWalk"),i(s,"apportion"),i(c,"sizeNode"),o.separation=function(e){return arguments.length?(t=e,o):t},o.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],o):r?null:[e,n]},o.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],o):r?[e,n]:null},o}function yt(t,e,n,r,i){for(var o,a=t.children,l=-1,s=a.length,c=t.value&&(i-n)/t.value;++l<s;)(o=a[l]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*c}i(R,"shuffle"),i(L,"enclose"),i(B,"extendBasis"),i(E,"enclosesNot"),i(N,"enclosesWeak"),i(q,"enclosesWeakAll"),i(O,"encloseBasis"),i(V,"encloseBasis1"),i(F,"encloseBasis2"),i(W,"encloseBasis3"),i(j,"place"),i($,"intersects"),i(H,"score"),i(U,"Node"),i(G,"packEnclose"),i(Z,"optional"),i(J,"required"),i(K,"constantZero"),i(X,"constant$1"),i(Y,"defaultRadius"),i(Q,"d3Pack"),i(tt,"radiusLeaf"),i(et,"packChildren"),i(nt,"translateChild"),i(rt,"roundNode"),i(it,"d3treemapDice"),i(ot,"d3Parition"),i(at,"defaultSeparation"),i(lt,"nextLeft"),i(st,"nextRight"),i(ct,"moveSubtree"),i(ut,"executeShifts"),i(ht,"nextAncestor"),i(pt,"TreeNode"),pt.prototype=Object.create(A.prototype),i(dt,"treeRoot"),i(ft,"d3Tree"),i(yt,"d3treemapSlice");var mt=(1+Math.sqrt(5))/2;function gt(t,e,n,r,i,o){for(var a,l,s,c,u,h,p,d,f,y,m,g=[],x=e.children,_=0,b=0,v=x.length,w=e.value;_<v;){s=i-n,c=o-r;do{u=x[b++].value}while(!u&&b<v);for(h=p=u,m=u*u*(y=Math.max(c/s,s/c)/(w*t)),f=Math.max(p/m,m/h);b<v;++b){if(u+=l=x[b].value,l<h&&(h=l),l>p&&(p=l),m=u*u*y,(d=Math.max(p/m,m/h))>f){u-=l;break}f=d}g.push(a={value:u,dice:s<c,children:x.slice(_,b)}),a.dice?it(a,n,r,i,w?r+=c*u/w:o):yt(a,n,r,w?n+=s*u/w:i,o),w-=u,_=b}return g}i(gt,"squarifyRatio");const xt=i(function t(e){function n(t,n,r,i,o){gt(e,t,n,r,i,o)}return i(n,"squarify"),n.ratio=function(e){return t((e=+e)>1?e:1)},n},"custom")(mt);function _t(){var t=xt,e=!1,n=1,r=1,o=[0],a=K,l=K,s=K,c=K,u=K;function h(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(p),o=[0],e&&t.eachBefore(rt),t}function p(e){var n=o[e.depth],r=e.x0+n,i=e.y0+n,h=e.x1-n,p=e.y1-n;h<r&&(r=h=(r+h)/2),p<i&&(i=p=(i+p)/2),e.x0=r,e.y0=i,e.x1=h,e.y1=p,e.children&&(n=o[e.depth+1]=a(e)/2,r+=u(e)-n,i+=l(e)-n,(h-=s(e)-n)<r&&(r=h=(r+h)/2),(p-=c(e)-n)<i&&(i=p=(i+p)/2),t(e,r,i,h,p))}return i(h,"treemap"),i(p,"positionNode"),h.round=function(t){return arguments.length?(e=!!t,h):e},h.size=function(t){return arguments.length?(n=+t[0],r=+t[1],h):[n,r]},h.tile=function(e){return arguments.length?(t=J(e),h):t},h.padding=function(t){return arguments.length?h.paddingInner(t).paddingOuter(t):h.paddingInner()},h.paddingInner=function(t){return arguments.length?(a="function"==typeof t?t:X(+t),h):a},h.paddingOuter=function(t){return arguments.length?h.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):h.paddingTop()},h.paddingTop=function(t){return arguments.length?(l="function"==typeof t?t:X(+t),h):l},h.paddingRight=function(t){return arguments.length?(s="function"==typeof t?t:X(+t),h):s},h.paddingBottom=function(t){return arguments.length?(c="function"==typeof t?t:X(+t),h):c},h.paddingLeft=function(t){return arguments.length?(u="function"==typeof t?t:X(+t),h):u},h}function bt(t,e,n,r,o){var a,l,s=t.children,c=s.length,u=new Array(c+1);for(u[0]=l=a=0;a<c;++a)u[a+1]=l+=s[a].value;function h(t,e,n,r,i,o,a){if(t>=e-1){var l=s[t];return l.x0=r,l.y0=i,l.x1=o,void(l.y1=a)}for(var c=u[t],p=n/2+c,d=t+1,f=e-1;d<f;){var y=d+f>>>1;u[y]<p?d=y+1:f=y}p-u[d-1]<u[d]-p&&t+1<d&&--d;var m=u[d]-c,g=n-m;if(o-r>a-i){var x=(r*g+o*m)/n;h(t,d,m,r,i,x,a),h(d,e,g,x,i,o,a)}else{var _=(i*g+a*m)/n;h(t,d,m,r,i,o,_),h(d,e,g,r,_,o,a)}}h(0,c,t.value,e,n,r,o),i(h,"partition")}function vt(t,e,n,r,i){(1&t.depth?yt:it)(t,e,n,r,i)}i(_t,"d3Treemap"),i(bt,"d3treemapBinary"),i(vt,"d3treemapSliceDice");const wt=i(function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,l,s,c,u,h=-1,p=a.length,d=t.value;++h<p;){for(s=(l=a[h]).children,c=l.value=0,u=s.length;c<u;++c)l.value+=s[c].value;l.dice?it(l,n,r,i,r+=(o-r)*l.value/d):yt(l,n,r,n+=(i-n)*l.value/d,o),d-=l.value}else t._squarify=a=gt(e,t,n,r,i,o),a.ratio=e}return i(n,"resquarify"),n.ratio=function(e){return t((e=+e)>1?e:1)},n},"custom")(mt),St=class _CirclePacking extends n.SVGWidget{diameter;pack;svg;_focus;circle;view;_node;constructor(){super(),e.ITree.call(this)}enter(t,e){this.diameter=Math.min(this.width(),this.height()),this.pack=Q().size([this.diameter-4,this.diameter-4]).padding(1.5),this.svg=e.append("g")}update(t,e){const r=this;this.diameter=Math.min(this.width(),this.height()),this.pack.size([this.diameter-4,this.diameter-4]).padding(1.5),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this.svg.selectAll("circle").remove(),this.svg.selectAll("text").remove();const i=z(this.data()).sum(function(t){return t&&t.size?t.size:1}).sort(function(t,e){return t.value<e.value?-1:t.value>e.value?1:0});this._focus=i,this.pack(i),this.circle=this.svg.selectAll("circle").data(i.descendants()).enter().append("circle").attr("class",function(t){return t.parent?t.children?"node":"node leaf":"node root"}).style("fill",function(t){return t.color=r.paletteDepthLevel_exists()&&t.depth>r.paletteDepthLevel()?n.rgb(t.parent.color)[r.paletteDepthVariant()](1):r._palette(t.data.label),t.color}).on("click",function(t){r.click(t.data,null,null)}).on("dblclick",function(t){this._focus!==t&&r.zoom(t),n.d3Event().stopPropagation()}),this.circle.append("title").text(function(t){return t.data.label}),this.svg.selectAll("text").data(i.descendants()).enter().append("text").attr("class","label").style("fill-opacity",function(t){return t.parent===i?1:0}).style("display",function(t){return t.parent===i?null:"none"}).text(function(t){return t.data.label+(r.showSize()&&void 0!==t.data.size?" "+t.data.size:"")}),this._node=this.svg.selectAll("circle,text"),this.zoomTo([i.x,i.y,2*i.r])}zoom(t){this._focus=t;const e=this,r=this.svg.transition().duration(n.d3Event().altKey?7500:750).tween("zoom",function(){const t=n.interpolateZoom(e.view,[e._focus.x,e._focus.y,2*e._focus.r]);return function(n){e.zoomTo(t(n))}});function o(t){return t===e._focus&&!t.children||t.parent===e._focus}i(o,"showText"),r.selectAll("text").filter(function(t){return o(t)||"inline"===this.style.display}).style("fill-opacity",function(t){return o(t)?1:0}).on("start",function(t){o(t)&&(this.style.display="inline")}).on("end",function(t){o(t)||(this.style.display="none")})}zoomTo(t){const e=this.diameter/t[2];this.view=t,this._node.attr("transform",function(n){return"translate("+(n.x-t[0])*e+","+(n.y-t[1])*e+")"}),this.circle.attr("r",function(t){return t.r*e})}};i(St,"CirclePacking");let Tt=St;Tt.prototype._class+=" tree_CirclePacking",Tt.prototype.implements(e.ITree.prototype),Tt.prototype.publish("showSize",!0,"boolean","Show size along with label"),Tt.prototype.publish("paletteDepthLevel",null,"number","If not null then beyond this depth number the child node colors are based on parent",null,{optional:!0}),Tt.prototype.publish("paletteDepthVariant","brighter","set","Determines paletteDepthLevel decendant color shade variant",["brighter","darker"],{disable:i(t=>t.paletteDepthLevel_exists(),"disable")}),Tt.prototype.publish("paletteID","default","set","Color palette for this widget",Tt.prototype._palette.switch(),{tags:["Basic","Shared"]}),Tt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});const Ct=class _DendrogramColumn extends n.PropertyExt{_owner;constructor(){super()}owner(t){return arguments.length?(this._owner=t,this):this._owner}valid(){return!!this.column()}column};i(Ct,"DendrogramColumn");let zt=Ct;zt.prototype._class+=" tree_Dendrogram.DendrogramColumn",zt.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});const Mt=class _Dendrogram extends n.SVGZoomWidget{Column;_d3LayoutCluster;_d3LayoutTree;_d3Layout;constructor(){super(),e.ITree.call(this),n.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this._d3LayoutCluster=p(),this._d3LayoutTree=ft()}dendrogramData(){if(0===this.data().length)return[];if(!this.mappings().filter(t=>t.valid()).length)return this.data();return t({key:"root",values:this._db.rollupView(this.mappings().map(function(t){return t.column()})).entries()});function t(e){return{label:e.key,children:e.values.filter(function(t){return!(t instanceof Array)}).map(function(e){return t(e)}),origRows:e.values}}}enter(t,e){super.enter(t,e),this._renderElement.attr("opacity",0).transition().duration(500).attr("opacity",1),this._selection.widgetElement(this._renderElement)}update(t,e){super.update(t,e);const r=this,o="vertical"===this.orientation();this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._d3Layout=this.dendrogram()?this._d3LayoutCluster:this._d3LayoutTree,this.radial()?(this._d3Layout.size([360,2*this.separation()]),this._d3Layout.separation(i(function(t,e){return(t.parent===e.parent?1:2)/t.depth},"separation"))):(this._d3Layout.nodeSize([14,this.separation()]),this._d3Layout.separation(i(function(t,e){return t.parent===e.parent?1:2},"separation")));const a=z(this.dendrogramData());this._d3Layout(a);const l=a.descendants(),s=a.descendants().slice(1);function c(t){return"M"+t.parent.x+","+t.parent.y+"C"+t.parent.x+","+(t.parent.y+t.y)/2+" "+t.x+","+(t.parent.y+t.y)/2+" "+t.x+","+t.y}function u(t){return"M"+t.y+","+t.x+"C"+(t.y+t.parent.y)/2+","+t.x+" "+(t.y+t.parent.y)/2+","+t.parent.x+" "+t.parent.y+","+t.parent.x}function h(t){return o?c(t):u(t)}function p(t,e){const n=(t-90)/180*Math.PI,r=e;return[r*Math.cos(n),r*Math.sin(n)]}function d(t){return"M"+p(t.x,t.y)+"C"+p(t.x,(t.y+t.parent.y)/2)+" "+p(t.parent.x,(t.y+t.parent.y)/2)+" "+p(t.parent.x,t.parent.y)}i(c,"linkVertical"),i(u,"linkHorizontal"),i(h,"diagonal"),i(p,"project"),i(d,"radialDiagonal");const f=this._renderCount?500:0,y=this._renderElement.selectAll(".link").data(s);y.enter().append("path").attr("class","link").attr("d",this.radial()?d:h),y.transition().duration(f).attr("d",this.radial()?d:h),y.exit().remove();const m=this.circleRadius()+2;function g(t){return r.radial()?"rotate("+(t.x-90)+")translate("+t.y+")":"horizontal"===r.orientation()?"translate("+t.y+","+t.x+")":"translate("+t.x+","+t.y+")"}i(g,"nodeTransform");const x=this._renderElement.selectAll(".node").data(l);x.transition().duration(f).attr("transform",g);const _=x.enter().append("g").attr("class","node").attr("transform",g).call(this._selection.enter.bind(this._selection)).on("click",function(t){let e=t;for(;e.children;)e=e.children[0];t.depth>0&&(e.origRows?r.click(r.rowToObj(e.origRows[0]),r.mappings()[t.depth-1].column(),!0):r.click(e.data,r.mappings()[t.depth-1].column(),!0))}).on("dblclick",function(t){let e=t;for(;e.children;)e=e.children[0];t.depth>0&&(e.origRows?r.dblclick(r.rowToObj(e.origRows[0]),r.mappings()[t.depth-1].column(),!0):r.dblclick(e.data,r.mappings()[t.depth-1].column(),!0))}).each(function(){const t=n.select(this);t.append("circle"),t.append("text")});_.merge(x).select("circle").attr("r",this.circleRadius()).style("fill",function(t){return r._palette(t.data.label)}).append("title").text(function(t){return t.data.label}),_.merge(x).select("text").attr("dx",function(t){return r.radial()?t.children?t.x<180?-m:m:t.x<180?m:-m:o?t.children?m:-m:t.children?-m:m}).attr("dy","0.25em").style("text-anchor",function(t){return r.radial()?t.children?t.x<180?"end":"start":t.x<180?"start":"end":o?t.children?"start":"end":t.children?"end":"start"}).attr("transform",function(t){return r.radial()?t.x<180?null:"rotate(180)":o?"rotate(-66)":null}).text(function(t){return t.data.label}),x.exit().remove(),this._renderCount||r.zoomToFit()}};i(Mt,"Dendrogram");let kt=Mt;kt.prototype._class+=" tree_Dendrogram",kt.prototype.implements(e.ITree.prototype),kt.prototype.mixin(n.Utility.SimpleSelectionMixin),kt.prototype.Column=zt,kt.prototype.publish("paletteID","default","set","Color palette for this widget",kt.prototype._palette.switch(),{tags:["Basic","Shared"]}),kt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),kt.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:zt}),kt.prototype.publish("circleRadius",4.5,"number","Text offset from circle"),kt.prototype.publish("separation",240,"number","Leaf Separation"),kt.prototype.publish("dendrogram",!0,"boolean","Dendrogram"),kt.prototype.publish("radial",!1,"boolean","Radial"),kt.prototype.publish("orientation","horizontal","set","Orientation",["horizontal","vertical"],{tags:["Private"],disable:i(t=>t.radial(),"disable")});const Dt=class _DirectoryTree extends n.HTMLWidget{constructor(){super()}flattenData(t){const e=this,n=z(t),r=[];return this.omitRoot()?n.children&&n.children.forEach(i):i(n),r;function i(t){const n=t.data.markers&&t.data.markers.length?t.data.markers.length:"";r.push({label:t.data.label,depth:t.depth-(e.omitRoot()?1:0),content:t.data.content,isFolder:!!t.data.children,iconClass:t.data.iconClass,color:t.data.color,bold:t.data.bold,weightValue:n,markers:t.data.markers,selected:t.data.selected}),t.children&&t.children.forEach(i)}}iconClass(t){return"error"===t.label?"fa fa-exclamation":t.isFolder?this.folderIconOpen():this.textFileIcon()}calcRequiredWidth(){const t=this.flattenData(this.data());let e=0;const r=this.rowItemPadding(),i=this.iconSize()+2*r,o=n.Platform.getScrollbarWidth();return t.forEach(t=>{const a=t.depth*i+2*r,l=n.Utility.textSize(t.label,this.fontFamily(),this.fontSize(),!!t.bold).width+2*r+i+a+o;e<l&&(e=l)}),e}rowClick(t,e){}enter(t,e){super.enter(t,e),e.style("width","100%").style("height","100%")}update(t,e){super.update(t,e),this._palette=this._palette.switch(this.paletteID()),e.style("overflow-y",this.verticalScroll()?"scroll":null);const r=this.flattenData(this.data()),i=n.max(r,t=>Number(t.weightValue));r.forEach(t=>{t.weightValue?t.weightColor=this._palette(t.weightValue,1,i):t.weightColor="transparent"});const o=this,a=this.rowItemPadding(),l=this.iconSize()+a,s=Math.max(o.iconSize(),o.fontSize()),c=e.selectAll(".directory-row").data(r),u=this.fontFamily(),h=this.fontSize(),p=n.max(r,t=>this.textSize(t.weightValue,u,h).width),d=`${a}px ${a}px ${a/2}px ${a}px`;c.enter().append("div").attr("class",t=>`directory-row directory-row-depth-${t.depth}`).style("display","flex").style("cursor","pointer").each(function(t){const r=n.select(this),i=t.color?t.color:o.fontColor(),c=t.weightColor?t.weightColor:"transparent",f=n.Palette.textColor(c),y=r.append("div").attr("class","row-weight").style("padding",d).style("color",f).style("box-shadow",`inset 0 0 100px ${c}`).style("font-weight",t.bold?"bold":"normal").style("font-family",u).style("font-size",h+"px").text(t.weightValue).attr("title",t.weightValue).style("overflow","hidden").style("width",p+2*a+"px").style("text-overflow","ellipsis").style("text-align","right").style("line-height",s+"px");r.append("div").attr("class","row-depth").style("width",o.depthSize()*t.depth+"px").style("opacity",1).style("line-height",s+"px");const m=r.append("div").attr("class","row-icon "+(t.iconClass?t.iconClass:o.iconClass(t))).style("width",l+"px").style("height",s+"px").style("color",i).style("background-color",t.selected?o.selectionBackgroundColor():"transparent").style("font-size",o.iconSize()+"px").style("padding",d).style("line-height",s+"px"),g=r.append("div").attr("class","row-label").style("padding",d).style("color",i).style("background-color",t.selected?o.selectionBackgroundColor():"transparent").style("font-weight",t.bold?"bold":"normal").style("font-family",o.fontFamily()).style("font-size",o.fontSize()+"px").text(t.label).attr("title",t.label).style("flex",1).style("overflow","hidden").style("text-overflow","ellipsis").style("line-height",s+"px");r.on("mouseenter",()=>{g.style("font-weight","bold")}).on("mouseleave",()=>{g.style("font-weight",t.bold?"bold":"normal")}),y.on("mouseenter",()=>{o.weight_mouseenter(t)}).on("mouseleave",()=>{o.weight_mouseleave(t)}),t.isFolder?r.on("click",function(t){let e=this.nextSibling;const i=r.classed("folder-closed");for(i?(r.classed("folder-closed",!1),r.classed("folder-open",!0),m.attr("class","row-icon "+o.folderIconOpen())):(r.classed("folder-closed",!0),r.classed("folder-open",!1),m.attr("class","row-icon "+o.folderIconClosed()));null!==e;){n.select(e).datum().depth>t.depth?(e.style.display=i?"flex":"none",e=e.nextSibling):e=null}}):r.on("click",()=>{e.selectAll(".row-label").style("background-color","transparent"),e.selectAll(".row-icon").style("background-color","transparent"),m.style("background-color",o.selectionBackgroundColor()),g.style("background-color",o.selectionBackgroundColor());const n=t.label.split(".").pop().toLowerCase();o.rowClick("json"===n?JSON.stringify(JSON.parse(t.content),null,4):t.content,t.markers)})}).merge(c).style("background-color",o.backgroundColor()),c.exit().remove()}weight_mouseenter(t){}weight_mouseleave(t){}};i(Dt,"DirectoryTree");let It=Dt;It.prototype._class+=" tree_DirectoryTree",It.prototype._palette=n.Palette.rainbow("Blues"),It.prototype.publish("depthSize",14,"number","Width of indentation per file or folder depth (pixels)"),It.prototype.publish("paletteID","Blues","set","Color palette for the weight backgrounds",It.prototype._palette.switch(),{tags:["Basic"]}),It.prototype.publish("omitRoot",!1,"boolean","If true, root node will not display"),It.prototype.publish("rowItemPadding",2,"number","Top, bottom, left and right row item padding"),It.prototype.publish("selectionBackgroundColor","#CCC","html-color","Background color of selected directory rows"),It.prototype.publish("backgroundColor","#FFF","html-color","Directory item background color"),It.prototype.publish("fontColor","#000","html-color","Directory item font color"),It.prototype.publish("fontFamily","Arial","string","Directory item font family"),It.prototype.publish("fontSize",12,"number","Directory item font size (pixels)"),It.prototype.publish("iconSize",12,"number","Directory folder and file icon size (pixels)"),It.prototype.publish("folderIconOpen","fa fa-folder-open","string","Open folder icon class"),It.prototype.publish("folderIconClosed","fa fa-folder","string","Closed folder icon class"),It.prototype.publish("textFileIcon","fa fa-file-text-o","string","Text file icon class"),It.prototype.publish("verticalScroll",!0,"boolean","If true, vertical scroll bar will be shown");const At=class _IndentedColumn extends n.PropertyExt{_owner;constructor(){super()}owner(t){return arguments.length?(this._owner=t,this):this._owner}valid(){return!!this.column()}column};i(At,"IndentedColumn");let Pt=At;Pt.prototype._class+=" tree_Dendrogram.IndentedColumn",Pt.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});const Rt=class _Indented extends n.SVGZoomWidget{Column;_d3Tree;_xml;_svgLinks;_svgNodes;_treeData;_collapsed={};constructor(){super(),e.ITree.call(this),n.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this._d3Tree=ft()}xmlToData(t,e=""){if(DOMParser){return Bt((new DOMParser).parseFromString(t,"text/xml"),e).children[0]}return[]}xml(t){return arguments.length?(this._xml=t,this.data(this.xmlToData(this._xml)),this):this._xml}IndentedData(){if(0===this.data().length)return[];if(this.xmlColumn_exists()){const t=this.columns().indexOf(this.xmlColumn()),e={label:this.xmlColumn(),children:this.data().map(function(e,n){return this.xmlToData(e[t],"["+n+"]")},this)};return 1===e.children.length?e.children[0]:e}if(!this.mappings().filter(t=>t.valid()).length)return this.data();return t({key:"root",values:this._db.rollupView(this.mappings().map(function(t){return t.column()})).entries()});function t(e){if(e.values instanceof Array){const n=e.values.filter(function(t){return!(t instanceof Array)}).map(function(e){return t(e)}),r={label:e.key};return n.length?r.children=n:r.size=22,r}return{label:e.key,size:e.values.aggregate,origRows:e.values}}}enter(t,e){super.enter(t,e),this._svgLinks=this._renderElement.append("g"),this._svgNodes=this._renderElement.append("g"),this._selection.widgetElement(this._svgNodes)}_prevDataChecksum;update(t,e){super.update(t,e);const r=this;this._d3Tree.nodeSize([0,this.barHeight()]);const o=this._db.dataChecksum();function a(t){return(t.parent?a(t.parent)+".":"")+t.data.label}this._prevDataChecksum!==o&&(this._treeData=this.IndentedData(),this._prevDataChecksum=o),i(a,"getID");const l=z(this.data()).sum(function(t){return t.size||50}).each(t=>{this._collapsed[a(t)]&&delete t.children}),s=this._d3Tree(l).descendants(),c=this._d3Tree(l).descendants().slice(1);let u=0;l.eachBefore(t=>{t.x=u*r.barHeight(),++u});const h=this.barHeight()-4,p=this._renderCount?500:0,d=this._svgLinks.selectAll(".link").data(c,function(t){return a(t)});function f(t){return"M"+t.parent.y+","+t.parent.x+"V"+t.x+", H"+t.y}d.enter().append("path").attr("class","link").attr("d",f),d.transition().duration(p).attr("d",f),d.exit().remove(),i(f,"elbow");const y=this._svgNodes.selectAll(".node").data(s,function(t){return a(t)});y.transition().duration(p).attr("transform",function(t){return"translate("+t.y+","+t.x+")"});const m=y.enter().append("g").attr("class","node").attr("transform",function(t){return"translate("+t.y+","+t.x+")"}).call(this._selection.enter.bind(this._selection)).each(function(){const t=n.select(this);t.append("rect").attr("height",h).attr("width",h).on("click",function(t){r._collapsed[a(t)]?delete r._collapsed[a(t)]:t.children&&(r._collapsed[a(t)]=!0),r.lazyRender()}),t.append("text")}).style("opacity",0);function g(t){return r._collapsed[a(t)]?"#3182bd":t.children?"#c6dbef":"#fd8d3c"}m.transition().style("opacity",1),m.merge(y).select("rect").attr("x",-h/2).attr("y",-h/2).style("fill",g),m.merge(y).select("text").attr("dx",h/2+4+"px").attr("dy","0.33em").text(function(t){return t.data.label}),y.exit().transition().style("opacity",0).remove(),this._renderCount||r.zoomToFit(),i(g,"color")}};i(Rt,"Indented");let Lt=Rt;function Bt(t,e=""){const n={id:e,label:"",attributes:{},children:[]};if(n.label=t.nodeName,1===t.nodeType){if(t.attributes.length>0)for(let r=0;r<t.attributes.length;r++){const e=t.attributes.item(r);n.attributes[e.nodeName]=e.nodeValue}}else 3===t.nodeType&&(n.label=t.nodeValue);if(t.hasChildNodes())for(let r=0;r<t.childNodes.length;r++){const i=Bt(t.childNodes.item(r),e+"["+n.children.length+"]");n.children.push(i)}return n}Lt.prototype._class+=" tree_Indented",Lt.prototype.implements(e.ITree.prototype),Lt.prototype.mixin(n.Utility.SimpleSelectionMixin),Lt.prototype.Column=Pt,Lt.prototype.publish("xmlColumn",null,"set","Field",function(){return this.columns()},{optional:!0}),Lt.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:Pt,disable:i(t=>t.xmlColumn_exists(),"disable")}),Lt.prototype.publish("barHeight",16,"number","Bar height"),i(Bt,"xmlToJson");var Et=Math.PI,Nt=2*Et,qt=1e-6,Ot=Nt-qt;function Vt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Ft(){return new Vt}function Wt(t){return i(function(){return t},"constant")}i(Vt,"Path"),i(Ft,"path"),Vt.prototype=Ft.prototype={constructor:Vt,moveTo:i(function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},"moveTo"),closePath:i(function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},"closePath"),lineTo:i(function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},"lineTo"),quadraticCurveTo:i(function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},"quadraticCurveTo"),bezierCurveTo:i(function(t,e,n,r,i,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},"bezierCurveTo"),arcTo:i(function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var o=this._x1,a=this._y1,l=n-t,s=r-e,c=o-t,u=a-e,h=c*c+u*u;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(h>qt)if(Math.abs(u*l-s*c)>qt&&i){var p=n-o,d=r-a,f=l*l+s*s,y=p*p+d*d,m=Math.sqrt(f),g=Math.sqrt(h),x=i*Math.tan((Et-Math.acos((f+h-y)/(2*m*g)))/2),_=x/g,b=x/m;Math.abs(_-1)>qt&&(this._+="L"+(t+_*c)+","+(e+_*u)),this._+="A"+i+","+i+",0,0,"+ +(u*p>c*d)+","+(this._x1=t+b*l)+","+(this._y1=e+b*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},"arcTo"),arc:i(function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),l=n*Math.sin(r),s=t+a,c=e+l,u=1^o,h=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+c:(Math.abs(this._x1-s)>qt||Math.abs(this._y1-c)>qt)&&(this._+="L"+s+","+c),n&&(h<0&&(h=h%Nt+Nt),h>Ot?this._+="A"+n+","+n+",0,1,"+u+","+(t-a)+","+(e-l)+"A"+n+","+n+",0,1,"+u+","+(this._x1=s)+","+(this._y1=c):h>qt&&(this._+="A"+n+","+n+",0,"+ +(h>=Et)+","+u+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},"arc"),rect:i(function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},"rect"),toString:i(function(){return this._},"toString")},i(Wt,"constant");var jt=Math.abs,$t=Math.atan2,Ht=Math.cos,Ut=Math.max,Gt=Math.min,Zt=Math.sin,Jt=Math.sqrt,Kt=1e-12,Xt=Math.PI,Yt=Xt/2,Qt=2*Xt;function te(t){return t>1?0:t<-1?Xt:Math.acos(t)}function ee(t){return t>=1?Yt:t<=-1?-Yt:Math.asin(t)}function ne(t){return t.innerRadius}function re(t){return t.outerRadius}function ie(t){return t.startAngle}function oe(t){return t.endAngle}function ae(t){return t&&t.padAngle}function le(t,e,n,r,i,o,a,l){var s=n-t,c=r-e,u=a-i,h=l-o,p=h*s-u*c;if(!(p*p<Kt))return[t+(p=(u*(e-o)-h*(t-i))/p)*s,e+p*c]}function se(t,e,n,r,i,o,a){var l=t-n,s=e-r,c=(a?o:-o)/Jt(l*l+s*s),u=c*s,h=-c*l,p=t+u,d=e+h,f=n+u,y=r+h,m=(p+f)/2,g=(d+y)/2,x=f-p,_=y-d,b=x*x+_*_,v=i-o,w=p*y-f*d,S=(_<0?-1:1)*Jt(Ut(0,v*v*b-w*w)),T=(w*_-x*S)/b,C=(-w*x-_*S)/b,z=(w*_+x*S)/b,M=(-w*x+_*S)/b,k=T-m,D=C-g,I=z-m,A=M-g;return k*k+D*D>I*I+A*A&&(T=z,C=M),{cx:T,cy:C,x01:-u,y01:-h,x11:T*(i/v-1),y11:C*(i/v-1)}}function ce(){var t=ne,e=re,n=Wt(0),r=null,o=ie,a=oe,l=ae,s=null;function c(){var i,c,u=+t.apply(this,arguments),h=+e.apply(this,arguments),p=o.apply(this,arguments)-Yt,d=a.apply(this,arguments)-Yt,f=jt(d-p),y=d>p;if(s||(s=i=Ft()),h<u&&(c=h,h=u,u=c),h>Kt)if(f>Qt-Kt)s.moveTo(h*Ht(p),h*Zt(p)),s.arc(0,0,h,p,d,!y),u>Kt&&(s.moveTo(u*Ht(d),u*Zt(d)),s.arc(0,0,u,d,p,y));else{var m,g,x=p,_=d,b=p,v=d,w=f,S=f,T=l.apply(this,arguments)/2,C=T>Kt&&(r?+r.apply(this,arguments):Jt(u*u+h*h)),z=Gt(jt(h-u)/2,+n.apply(this,arguments)),M=z,k=z;if(C>Kt){var D=ee(C/u*Zt(T)),I=ee(C/h*Zt(T));(w-=2*D)>Kt?(b+=D*=y?1:-1,v-=D):(w=0,b=v=(p+d)/2),(S-=2*I)>Kt?(x+=I*=y?1:-1,_-=I):(S=0,x=_=(p+d)/2)}var A=h*Ht(x),P=h*Zt(x),R=u*Ht(v),L=u*Zt(v);if(z>Kt){var B,E=h*Ht(_),N=h*Zt(_),q=u*Ht(b),O=u*Zt(b);if(f<Xt&&(B=le(A,P,q,O,E,N,R,L))){var V=A-B[0],F=P-B[1],W=E-B[0],j=N-B[1],$=1/Zt(te((V*W+F*j)/(Jt(V*V+F*F)*Jt(W*W+j*j)))/2),H=Jt(B[0]*B[0]+B[1]*B[1]);M=Gt(z,(u-H)/($-1)),k=Gt(z,(h-H)/($+1))}}S>Kt?k>Kt?(m=se(q,O,A,P,h,k,y),g=se(E,N,R,L,h,k,y),s.moveTo(m.cx+m.x01,m.cy+m.y01),k<z?s.arc(m.cx,m.cy,k,$t(m.y01,m.x01),$t(g.y01,g.x01),!y):(s.arc(m.cx,m.cy,k,$t(m.y01,m.x01),$t(m.y11,m.x11),!y),s.arc(0,0,h,$t(m.cy+m.y11,m.cx+m.x11),$t(g.cy+g.y11,g.cx+g.x11),!y),s.arc(g.cx,g.cy,k,$t(g.y11,g.x11),$t(g.y01,g.x01),!y))):(s.moveTo(A,P),s.arc(0,0,h,x,_,!y)):s.moveTo(A,P),u>Kt&&w>Kt?M>Kt?(m=se(R,L,E,N,u,-M,y),g=se(A,P,q,O,u,-M,y),s.lineTo(m.cx+m.x01,m.cy+m.y01),M<z?s.arc(m.cx,m.cy,M,$t(m.y01,m.x01),$t(g.y01,g.x01),!y):(s.arc(m.cx,m.cy,M,$t(m.y01,m.x01),$t(m.y11,m.x11),!y),s.arc(0,0,u,$t(m.cy+m.y11,m.cx+m.x11),$t(g.cy+g.y11,g.cx+g.x11),y),s.arc(g.cx,g.cy,M,$t(g.y11,g.x11),$t(g.y01,g.x01),!y))):s.arc(0,0,u,v,b,y):s.lineTo(R,L)}else s.moveTo(0,0);if(s.closePath(),i)return s=null,i+""||null}return i(c,"arc"),c.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Xt/2;return[Ht(r)*n,Zt(r)*n]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:Wt(+e),c):t},c.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Wt(+t),c):e},c.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Wt(+t),c):n},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Wt(+t),c):r},c.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:Wt(+t),c):o},c.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:Wt(+t),c):a},c.padAngle=function(t){return arguments.length?(l="function"==typeof t?t:Wt(+t),c):l},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}i(te,"acos"),i(ee,"asin"),i(ne,"arcInnerRadius"),i(re,"arcOuterRadius"),i(ie,"arcStartAngle"),i(oe,"arcEndAngle"),i(ae,"arcPadAngle"),i(le,"intersect"),i(se,"cornerTangents"),i(ce,"d3Arc");const ue=class _SunburstPartition extends n.SVGWidget{svg;radius;_xScale;_yScale;partition;arc;_resetRoot;constructor(){super(),e.ITree.call(this)}data(t){const e=n.SVGWidget.prototype.data.apply(this,arguments);return arguments.length&&(this._resetRoot=!0),e}enter(t,e){const r=this;this.radius=Math.min(this.width(),this.height())/2,this._xScale=n.scaleLinear().range([0,2*Math.PI]),this._yScale=n.scaleSqrt().range([0,this.radius]),this.partition=ot(),this.arc=ce().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,r._xScale(t.x0)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,r._xScale(t.x1)))}).innerRadius(function(t){return Math.max(0,r._yScale(t.y0))}).outerRadius(function(t){return Math.max(0,r._yScale(t.y1))}),this.svg=e.append("g")}update(t,e){const r=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this.radius=Math.min(this.width(),this.height())/2,this._yScale.range([0,this.radius]);const i=z(this.data()).sum(function(t){return void 0!==t.size?t.size:1}),o=this.svg.selectAll("path").data(this.partition(i).descendants(),function(t,e){return void 0!==t.data.label?t.data.label:e});o.enter().append("path").on("click",function(t){r.click(t.data,null,null)}).on("dblclick",function(t){const e=n.d3Event();e&&e.stopPropagation(),r.zoomTo(t)}).each(function(){n.select(this).append("title")}).merge(o).attr("d",this.arc).style("fill",function(t){return t.data.__viz_fill?t.data.__viz_fill:r._palette(t.data.label)}).style("stroke",function(t){return t.value>16?"white":"none"}).select("title").text(function(t){return t.data.label}),o.exit().remove(),this._resetRoot&&(this._resetRoot=!1,this.zoomTo(i))}zoomTo(t){const e=this;this.svg.transition().duration(750).tween("scale",function(){const r=n.interpolate(e._xScale.domain(),[t.x0,t.x1]),i=n.interpolate(e._yScale.domain(),[t.y0,1]),o=n.interpolate(e._yScale.range(),[t.y0?20:0,e.radius]);return function(t){e._xScale.domain(r(t)),e._yScale.domain(i(t)).range(o(t))}}).selectAll("path").attrTween("d",function(t){return function(){return e.arc(t)}})}};i(ue,"SunburstPartition");let he=ue;he.prototype._class+=" tree_SunburstPartition",he.prototype.implements(e.ITree.prototype),he.prototype.publish("paletteID","default","set","Color palette for this widget",he.prototype._palette.switch(),{tags:["Basic","Shared"]}),he.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});const pe=class _TreemapColumn extends n.PropertyExt{_owner;constructor(){super()}owner(t){return arguments.length?(this._owner=t,this):this._owner}valid(){return!!this.column()}column};i(pe,"TreemapColumn");let de=pe;de.prototype._class+=" tree_Dendrogram.TreemapColumn",de.prototype.publish("column",null,"set","Field",function(){return this._owner?this._owner.columns():[]},{optional:!0});const fe=class _Treemap extends n.HTMLWidget{Column;_d3Treemap;_elementDIV;_selection;constructor(){super(),e.ITree.call(this),n.Utility.SimpleSelectionMixin.call(this,!0)}getTilingMethod(){switch(this.tilingMethod()){case"treemapBinary":return bt;case"treemapDice":return it;case"treemapSlice":return yt;case"treemapSliceDice":return vt;case"treemapResquarify":return wt;default:return xt}}treemapData(){if(!this.mappings().filter(t=>t.valid()).length)return this.data();return t({key:"root",values:this._db.aggregateView(this.mappings().map(function(t){return t.column()}),this.aggrType(),this.aggrColumn()).entries()});function t(e){if(e.values instanceof Array){const n=e.values.filter(function(t){return!(t instanceof Array)}).map(function(e){return t(e)}),r={label:e.key};return n.length?r.children=n:r.size=22,r}return{label:e.key,size:e.values.aggregate,origRows:e.values}}}enter(t,e){super.enter(t,e),this._d3Treemap=_t(),this._elementDIV=e.append("div"),this._selection.widgetElement(this._elementDIV)}update(t,e){super.update(t,e);const r=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const o=z(this.treemapData()).sum(this.nodeWeight);this._d3Treemap.size([this.width(),this.height()]).paddingInner(this.paddingInner()).paddingOuter(this.paddingOuter()).paddingTop(this.paddingTop()),-1!==["treemapSquarify","treemapResquarify"].indexOf(this.tilingMethod())?this._d3Treemap.tile(this.getTilingMethod().ratio(this.squarifyRatio())):this._d3Treemap.tile(this.getTilingMethod()),this._d3Treemap(o),this._elementDIV.style("font-size",this.fontSize_exists()?this.fontSize()+"px":null).style("line-height",this.fontSize_exists()?this.fontSize()+2+"px":null);const a=this._elementDIV.selectAll(".node").data(o.descendants());function l(t){if(t.children&&!r.enableParentTooltips())return null;let e=t.data.label+" ("+t.value+")";for(;t.parent&&t.parent.parent;)e=t.parent.data.label+" -> "+e,t=t.parent;return e}a.enter().append("div").attr("class","node").call(this._selection.enter.bind(this._selection)).on("click",function(t){if(t){let e="";r.mappings().forEach(function(t){t.column()&&(e=t.column())}),t.origRows?r.click(r.rowToObj(t.origRows[0]),e,r._selection.selected(this)):r.click(t.data,e,r._selection.selected(this))}}).on("dblclick",function(t){if(t){let e="";r.mappings().forEach(function(t){t.column()&&(e=t.column())}),t.origRows?r.dblclick(r.rowToObj(t.origRows[0]),e,r._selection.selected(this)):r.dblclick(t.data,e,r._selection.selected(this))}}).merge(a).style("left",function(t){return t.x0+Math.max(0,t.x1-t.x0)/2+"px"}).style("top",function(t){return t.y0+Math.max(0,t.y1-t.y0)/2+"px"}).style("width",function(){return"0px"}).style("height",function(){return"0px"}).style("font-size",function(t){return(t.children?r.parentFontSize():r.leafFontSize())+"px"}).style("line-height",function(t){return(t.children?r.parentFontSize():r.leafFontSize())+"px"}).attr("title",l).html(function(t){return r.showRoot()||0!==t.depth?t.children?r.enableParentLabels()?r.parentWeightHTML(t):null:r.leafWeightHTML(t):null}).style("background",function(t){if(!r.showRoot()&&0===t.depth)return this.style.color="transparent","transparent";const e=r.brighterLeafNodes()?"brighter":"darker";let i;return r.usePaletteOnParentNodes()?i=t.children?r._palette(t.data.label):n.rgb(r._palette(t.parent.data.label))[e](1):(i=t.depth>r.depthColorLimit()?n.rgb(t.parent.color)[e](1):r._palette(t.data.label),t.color=i),this.style.color=n.Palette.textColor(i),i}).transition().duration(this.transitionDuration()).style("pointer-events",function(t){return r.showRoot()||0!==t.depth?"all":"none"}).style("opacity",function(t){return t.children?1:null}).style("left",function(t){return t.x0+"px"}).style("top",function(t){return t.y0+"px"}).style("width",function(t){return Math.max(0,t.x1-t.x0)+"px"}).style("height",function(t){return Math.max(0,t.y1-t.y0)+"px"}).each(function(t){0===t.depth&&(this.style.color=r.showRoot()?"":"transparent",this.style.borderColor=r.showRoot()?"":"transparent")}),a.exit().transition().duration(this.transitionDuration()).style("opacity",0).remove(),i(l,"tooltip")}exit(t,e){super.exit(t,e)}nodeWeight(t){return t.size||1}parentWeightHTML(t){return this.showParentWeight()?`<span class="treemap-parent-label">${t.data.label}</span><span class="treemap-parent-value">${t.value}${this.weightSuffix()}</span>`:`<span class="treemap-parent-label">${t.data.label}</span>`}leafWeightHTML(t){return this.showLeafWeight()?`<span class="treemap-leaf-label">${t.data.label}</span><span class="treemap-leaf-value">${t.value}${this.weightSuffix()}</span>`:`<span class="treemap-leaf-label">${t.data.label}</span>`}};i(fe,"Treemap");let ye=fe;ye.prototype._class+=" tree_Treemap",ye.prototype.implements(e.ITree.prototype),ye.prototype.mixin(n.Utility.SimpleSelectionMixin),ye.prototype.Column=de,ye.prototype.publish("paletteID","default","set","Color palette for this widget",ye.prototype._palette.switch(),{tags:["Basic","Shared"]}),ye.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),ye.prototype.publish("mappings",[],"propertyArray","Source Columns",null,{autoExpand:de}),ye.prototype.publish("aggrType",null,"set","Aggregation Type",[null,"mean","median","sum","min","max"],{optional:!0}),ye.prototype.publish("aggrColumn",null,"set","Aggregation Field",function(){return this.columns()},{optional:!0,disable:i(t=>!t.aggrType(),"disable")}),ye.prototype.publish("fontSize",null,"number","Font Size",null,{optional:!0}),ye.prototype.publish("paddingInner",18.6,"number","Pixel spacing between each sibling node"),ye.prototype.publish("paddingOuter",30,"number","Pixel padding of parent nodes"),ye.prototype.publish("paddingTop",41.4,"number","Additional top pixel padding of parent nodes"),ye.prototype.publish("showRoot",!1,"boolean","Show root element"),ye.prototype.publish("parentFontSize",18,"number","Parent font-size"),ye.prototype.publish("leafFontSize",16,"number","Leaf font-size"),ye.prototype.publish("usePaletteOnParentNodes",!1,"boolean","Assign a color from the palette to every parent node"),ye.prototype.publish("depthColorLimit",1,"number","Assign a color from the palette to node with depth lower than this value",null,{optional:!0,disable:i(t=>t.usePaletteOnParentNodes(),"disable")}),ye.prototype.publish("squarifyRatio",1,"number","Specifies the desired aspect ratio of the generated rectangles (must be >= 1)",null,{optional:!0,disable:i(t=>-1===["treemapSquarify","treemapResquarify"].indexOf(t.tilingMethod()),"disable")}),ye.prototype.publish("showParentWeight",!0,"boolean","Show weight of parent nodes"),ye.prototype.publish("showLeafWeight",!0,"boolean","Show weight of leaf nodes"),ye.prototype.publish("weightSuffix","","string","Weight suffix (ex: 'ms')"),ye.prototype.publish("brighterLeafNodes",!1,"boolean","Brighter/darker leaf node color (false = darker)"),ye.prototype.publish("enableParentLabels",!0,"boolean","Enable parent labels"),ye.prototype.publish("enableParentTooltips",!0,"boolean","Enable parent tooltips"),ye.prototype.publish("transitionDuration",250,"number","Transition Duration"),ye.prototype.publish("tilingMethod","treemapSquarify","set","Transition Duration",["treemapBinary","treemapDice","treemapResquarify","treemapSlice","treemapSliceDice","treemapSquarify"]),t.BUILD_VERSION="3.24.0",t.CirclePacking=Tt,t.Dendrogram=kt,t.DendrogramColumn=zt,t.DirectoryTree=It,t.Indented=Lt,t.IndentedColumn=Pt,t.PKG_NAME="@hpcc-js/tree",t.PKG_VERSION="3.2.19",t.SunburstPartition=he,t.Treemap=ye,t.TreemapColumn=de,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@hpcc-js/api"),require("@hpcc-js/common")):typeof define==`function`&&define.amd?define([`exports`,`@hpcc-js/api`,`@hpcc-js/common`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`@hpcc-js/tree`]={},e[`@hpcc-js/api`],e[`@hpcc-js/common`]))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.defineProperty,__name=(e,t)=>r(e,`name`,{value:t,configurable:!0}),i=`@hpcc-js/tree`,a=`3.3.0`,o=`3.26.0`;function defaultSeparation$1(e,t){return e.parent===t.parent?1:2}__name(defaultSeparation$1,`defaultSeparation`);function meanX(e){return e.reduce(meanXReduce,0)/e.length}function meanXReduce(e,t){return e+t.x}function maxY(e){return 1+e.reduce(maxYReduce,0)}function maxYReduce(e,t){return Math.max(e,t.y)}function leafLeft(e){for(var t;t=e.children;)e=t[0];return e}function leafRight(e){for(var t;t=e.children;)e=t[t.length-1];return e}__name(cluster_default,`default`);function cluster_default(){var e=defaultSeparation$1,t=1,n=1,r=!1;function cluster(i){var a,o=0;i.eachAfter(function(t){var n=t.children;n?(t.x=meanX(n),t.y=maxY(n)):(t.x=a?o+=e(t,a):0,t.y=0,a=t)});var s=leafLeft(i),c=leafRight(i),l=s.x-e(s,c)/2,u=c.x+e(c,s)/2;return i.eachAfter(r?function(e){e.x=(e.x-i.x)*t,e.y=(i.y-e.y)*n}:function(e){e.x=(e.x-l)/(u-l)*t,e.y=(1-(i.y?e.y/i.y:1))*n})}return cluster.separation=function(t){return arguments.length?(e=t,cluster):e},cluster.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],cluster):r?null:[t,n]},cluster.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],cluster):r?[t,n]:null},cluster}function count(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function count_default(){return this.eachAfter(count)}__name(count_default,`default`);function each_default(e){var t=this,n,r=[t],i,a,o;do for(n=r.reverse(),r=[];t=n.pop();)if(e(t),i=t.children,i)for(a=0,o=i.length;a<o;++a)r.push(i[a]);while(r.length);return this}__name(each_default,`default`);function eachBefore_default(e){for(var t=this,n=[t],r,i;t=n.pop();)if(e(t),r=t.children,r)for(i=r.length-1;i>=0;--i)n.push(r[i]);return this}__name(eachBefore_default,`default`);function eachAfter_default(e){for(var t=this,n=[t],r=[],i,a,o;t=n.pop();)if(r.push(t),i=t.children,i)for(a=0,o=i.length;a<o;++a)n.push(i[a]);for(;t=r.pop();)e(t);return this}__name(eachAfter_default,`default`);function sum_default(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}__name(sum_default,`default`);function sort_default(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}__name(sort_default,`default`);function path_default(e){for(var t=this,n=leastCommonAncestor(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}__name(path_default,`default`);function leastCommonAncestor(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function ancestors_default(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}__name(ancestors_default,`default`);function descendants_default(){var e=[];return this.each(function(t){e.push(t)}),e}__name(descendants_default,`default`);function leaves_default(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}__name(leaves_default,`default`);function links_default(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}__name(links_default,`default`);function hierarchy(e,t){var n=new Node$1(e),r=+e.value&&(n.value=e.value),i,a=[n],o,s,c,l;for(t??=defaultChildren;i=a.pop();)if(r&&(i.value=+i.data.value),(s=t(i.data))&&(l=s.length))for(i.children=Array(l),c=l-1;c>=0;--c)a.push(o=i.children[c]=new Node$1(s[c])),o.parent=i,o.depth=i.depth+1;return n.eachBefore(computeHeight)}function node_copy(){return hierarchy(this).eachBefore(copyData)}function defaultChildren(e){return e.children}function copyData(e){e.data=e.data.data}function computeHeight(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Node$1(e){this.data=e,this.depth=this.height=0,this.parent=null}__name(Node$1,`Node`),Node$1.prototype=hierarchy.prototype={constructor:Node$1,count:count_default,each:each_default,eachAfter:eachAfter_default,eachBefore:eachBefore_default,sum:sum_default,sort:sort_default,path:path_default,ancestors:ancestors_default,descendants:descendants_default,leaves:leaves_default,links:links_default,copy:node_copy};var s=Array.prototype.slice;function shuffle(e){for(var t=e.length,n,r;t;)r=Math.random()*t--|0,n=e[t],e[t]=e[r],e[r]=n;return e}function enclose_default(e){for(var t=0,n=(e=shuffle(s.call(e))).length,r=[],i,a;t<n;)i=e[t],a&&enclosesWeak(a,i)?++t:(a=encloseBasis(r=extendBasis(r,i)),t=0);return a}__name(enclose_default,`default`);function extendBasis(e,t){var n,r;if(enclosesWeakAll(t,e))return[t];for(n=0;n<e.length;++n)if(enclosesNot(t,e[n])&&enclosesWeakAll(encloseBasis2(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(r=n+1;r<e.length;++r)if(enclosesNot(encloseBasis2(e[n],e[r]),t)&&enclosesNot(encloseBasis2(e[n],t),e[r])&&enclosesNot(encloseBasis2(e[r],t),e[n])&&enclosesWeakAll(encloseBasis3(e[n],e[r],t),e))return[e[n],e[r],t];throw Error()}function enclosesNot(e,t){var n=e.r-t.r,r=t.x-e.x,i=t.y-e.y;return n<0||n*n<r*r+i*i}function enclosesWeak(e,t){var n=e.r-t.r+1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function enclosesWeakAll(e,t){for(var n=0;n<t.length;++n)if(!enclosesWeak(e,t[n]))return!1;return!0}function encloseBasis(e){switch(e.length){case 1:return encloseBasis1(e[0]);case 2:return encloseBasis2(e[0],e[1]);case 3:return encloseBasis3(e[0],e[1],e[2])}}function encloseBasis1(e){return{x:e.x,y:e.y,r:e.r}}function encloseBasis2(e,t){var n=e.x,r=e.y,i=e.r,a=t.x,o=t.y,s=t.r,c=a-n,l=o-r,u=s-i,d=Math.sqrt(c*c+l*l);return{x:(n+a+c/d*u)/2,y:(r+o+l/d*u)/2,r:(d+i+s)/2}}function encloseBasis3(e,t,n){var r=e.x,i=e.y,a=e.r,o=t.x,s=t.y,c=t.r,l=n.x,u=n.y,d=n.r,f=r-o,p=r-l,m=i-s,h=i-u,g=c-a,_=d-a,v=r*r+i*i-a*a,y=v-o*o-s*s+c*c,b=v-l*l-u*u+d*d,x=p*m-f*h,S=(m*b-h*y)/(x*2)-r,C=(h*g-m*_)/x,w=(p*y-f*b)/(x*2)-i,T=(f*_-p*g)/x,E=C*C+T*T-1,D=2*(a+S*C+w*T),O=S*S+w*w-a*a,k=-(E?(D+Math.sqrt(D*D-4*E*O))/(2*E):O/D);return{x:r+S+C*k,y:i+w+T*k,r:k}}function place(e,t,n){var r=e.x-t.x,i,a,o=e.y-t.y,s,c,l=r*r+o*o;l?(a=t.r+n.r,a*=a,c=e.r+n.r,c*=c,a>c?(i=(l+c-a)/(2*l),s=Math.sqrt(Math.max(0,c/l-i*i)),n.x=e.x-i*r-s*o,n.y=e.y-i*o+s*r):(i=(l+a-c)/(2*l),s=Math.sqrt(Math.max(0,a/l-i*i)),n.x=t.x+i*r-s*o,n.y=t.y+i*o+s*r)):(n.x=t.x+n.r,n.y=t.y)}function intersects(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function score(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,a=(t.y*n.r+n.y*t.r)/r;return i*i+a*a}function Node(e){this._=e,this.next=null,this.previous=null}function packEnclose(e){if(!(i=e.length))return 0;var t=e[0],n,r,i,a,o,s,c,l,u,d;if(t.x=0,t.y=0,!(i>1))return t.r;if(n=e[1],t.x=-n.r,n.x=t.r,n.y=0,!(i>2))return t.r+n.r;place(n,t,r=e[2]),t=new Node(t),n=new Node(n),r=new Node(r),t.next=r.previous=n,n.next=t.previous=r,r.next=n.previous=t;pack:for(s=3;s<i;++s){place(t._,n._,r=e[s]),r=new Node(r),c=n.next,l=t.previous,u=n._.r,d=t._.r;do if(u<=d){if(intersects(c._,r._)){n=c,t.next=n,n.previous=t,--s;continue pack}u+=c._.r,c=c.next}else{if(intersects(l._,r._)){t=l,t.next=n,n.previous=t,--s;continue pack}d+=l._.r,l=l.previous}while(c!==l.next);for(r.previous=t,r.next=n,t.next=n.previous=n=r,a=score(t);(r=r.next)!==n;)(o=score(r))<a&&(t=r,a=o);n=t.next}for(t=[n._],r=n;(r=r.next)!==n;)t.push(r._);for(r=enclose_default(t),s=0;s<i;++s)t=e[s],t.x-=r.x,t.y-=r.y;return r.r}function optional(e){return e==null?null:required(e)}function required(e){if(typeof e!=`function`)throw Error();return e}function constantZero(){return 0}function constant_default$1(e){return function(){return e}}__name(constant_default$1,`default`);function defaultRadius(e){return Math.sqrt(e.value)}function pack_default(){var e=null,t=1,n=1,r=constantZero;function pack(i){return i.x=t/2,i.y=n/2,e?i.eachBefore(radiusLeaf(e)).eachAfter(packChildren(r,.5)).eachBefore(translateChild(1)):i.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildren(constantZero,1)).eachAfter(packChildren(r,i.r/Math.min(t,n))).eachBefore(translateChild(Math.min(t,n)/(2*i.r))),i}return pack.radius=function(t){return arguments.length?(e=optional(t),pack):e},pack.size=function(e){return arguments.length?(t=+e[0],n=+e[1],pack):[t,n]},pack.padding=function(e){return arguments.length?(r=typeof e==`function`?e:constant_default$1(+e),pack):r},pack}__name(pack_default,`default`);function radiusLeaf(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function packChildren(e,t){return function(n){if(r=n.children){var r,i,a=r.length,o=e(n)*t||0,s;if(o)for(i=0;i<a;++i)r[i].r+=o;if(s=packEnclose(r),o)for(i=0;i<a;++i)r[i].r-=o;n.r=s+o}}}function translateChild(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function round_default(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}__name(round_default,`default`);function dice_default(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}__name(dice_default,`default`);function partition_default(){var e=1,t=1,n=0,r=!1;function partition(i){var a=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/a,i.eachBefore(positionNode(t,a)),r&&i.eachBefore(round_default),i}function positionNode(e,t){return function(r){r.children&&dice_default(r,r.x0,e*(r.depth+1)/t,r.x1,e*(r.depth+2)/t);var i=r.x0,a=r.y0,o=r.x1-n,s=r.y1-n;o<i&&(i=o=(i+o)/2),s<a&&(a=s=(a+s)/2),r.x0=i,r.y0=a,r.x1=o,r.y1=s}}return partition.round=function(e){return arguments.length?(r=!!e,partition):r},partition.size=function(n){return arguments.length?(e=+n[0],t=+n[1],partition):[e,t]},partition.padding=function(e){return arguments.length?(n=+e,partition):n},partition}__name(partition_default,`default`);function defaultSeparation(e,t){return e.parent===t.parent?1:2}function nextLeft(e){var t=e.children;return t?t[0]:e.t}function nextRight(e){var t=e.children;return t?t[t.length-1]:e.t}function moveSubtree(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function executeShifts(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function nextAncestor(e,t,n){return e.a.parent===t.parent?e.a:n}function TreeNode(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}TreeNode.prototype=Object.create(Node$1.prototype);function treeRoot(e){for(var t=new TreeNode(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new TreeNode(a[o],o)),i.parent=n;return(t.parent=new TreeNode(null,0)).children=[t],t}function tree_default(){var e=defaultSeparation,t=1,n=1,r=null;function tree(i){var a=treeRoot(i);if(a.eachAfter(firstWalk),a.parent.m=-a.z,a.eachBefore(secondWalk),r)i.eachBefore(sizeNode);else{var o=i,s=i,c=i;i.eachBefore(function(e){e.x<o.x&&(o=e),e.x>s.x&&(s=e),e.depth>c.depth&&(c=e)});var l=o===s?1:e(o,s)/2,u=l-o.x,d=t/(s.x+l+u),f=n/(c.depth||1);i.eachBefore(function(e){e.x=(e.x+u)*d,e.y=e.depth*f})}return i}function firstWalk(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){executeShifts(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=apportion(t,i,t.parent.A||r[0])}function secondWalk(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function apportion(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=nextRight(o),i=nextLeft(i),o&&i;)s=nextLeft(s),a=nextRight(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(moveSubtree(nextAncestor(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!nextRight(a)&&(a.t=o,a.m+=u-l),i&&!nextLeft(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function sizeNode(e){e.x*=t,e.y=e.depth*n}return tree.separation=function(t){return arguments.length?(e=t,tree):e},tree.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],tree):r?null:[t,n]},tree.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],tree):r?[t,n]:null},tree}__name(tree_default,`default`);function slice_default(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}__name(slice_default,`default`);var c=(1+Math.sqrt(5))/2;function squarifyRatio(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?dice_default(c,n,r,i,h?r+=m*g/h:a):slice_default(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var l=(function custom(e){function squarify(t,n,r,i,a){squarifyRatio(e,t,n,r,i,a)}return squarify.ratio=function(e){return custom((e=+e)>1?e:1)},squarify})(c);function treemap_default(){var e=l,t=!1,n=1,r=1,i=[0],a=constantZero,o=constantZero,s=constantZero,c=constantZero,u=constantZero;function treemap(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(positionNode),i=[0],t&&e.eachBefore(round_default),e}function positionNode(t){var n=i[t.depth],r=t.x0+n,l=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<l&&(l=f=(l+f)/2),t.x0=r,t.y0=l,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=u(t)-n,l+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<l&&(l=f=(l+f)/2),e(t,r,l,d,f))}return treemap.round=function(e){return arguments.length?(t=!!e,treemap):t},treemap.size=function(e){return arguments.length?(n=+e[0],r=+e[1],treemap):[n,r]},treemap.tile=function(t){return arguments.length?(e=required(t),treemap):e},treemap.padding=function(e){return arguments.length?treemap.paddingInner(e).paddingOuter(e):treemap.paddingInner()},treemap.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:constant_default$1(+e),treemap):a},treemap.paddingOuter=function(e){return arguments.length?treemap.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):treemap.paddingTop()},treemap.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:constant_default$1(+e),treemap):o},treemap.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:constant_default$1(+e),treemap):s},treemap.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:constant_default$1(+e),treemap):c},treemap.paddingLeft=function(e){return arguments.length?(u=typeof e==`function`?e:constant_default$1(+e),treemap):u},treemap}__name(treemap_default,`default`);function binary_default(e,t,n,r,i){var a=e.children,o,s=a.length,c,l=Array(s+1);for(l[0]=c=o=0;o<s;++o)l[o+1]=c+=a[o].value;partition(0,s,e.value,t,n,r,i);function partition(e,t,n,r,i,o,s){if(e>=t-1){var c=a[e];c.x0=r,c.y0=i,c.x1=o,c.y1=s;return}for(var u=l[e],d=n/2+u,f=e+1,p=t-1;f<p;){var m=f+p>>>1;l[m]<d?f=m+1:p=m}d-l[f-1]<l[f]-d&&e+1<f&&--f;var h=l[f]-u,g=n-h;if(o-r>s-i){var _=(r*g+o*h)/n;partition(e,f,h,r,i,_,s),partition(f,t,g,_,i,o,s)}else{var v=(i*g+s*h)/n;partition(e,f,h,r,i,o,v),partition(f,t,g,r,v,o,s)}}}__name(binary_default,`default`);function sliceDice_default(e,t,n,r,i){(e.depth&1?slice_default:dice_default)(e,t,n,r,i)}__name(sliceDice_default,`default`);var u=(function custom(e){function resquarify(t,n,r,i,a){if((o=t._squarify)&&o.ratio===e)for(var o,s,c,l,u=-1,d,f=o.length,p=t.value;++u<f;){for(s=o[u],c=s.children,l=s.value=0,d=c.length;l<d;++l)s.value+=c[l].value;s.dice?dice_default(s,n,r,i,r+=(a-r)*s.value/p):slice_default(s,n,r,n+=(i-n)*s.value/p,a),p-=s.value}else t._squarify=o=squarifyRatio(e,t,n,r,i,a),o.ratio=e}return resquarify.ratio=function(e){return custom((e=+e)>1?e:1)},resquarify})(c),CirclePacking=class extends n.SVGWidget{diameter;pack;svg;_focus;circle;view;_node;constructor(){super(),t.ITree.call(this)}enter(e,t){this.diameter=Math.min(this.width(),this.height()),this.pack=pack_default().size([this.diameter-4,this.diameter-4]).padding(1.5),this.svg=t.append(`g`)}update(e,t){let r=this;this.diameter=Math.min(this.width(),this.height()),this.pack.size([this.diameter-4,this.diameter-4]).padding(1.5),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+`_`+this.id())),this.svg.selectAll(`circle`).remove(),this.svg.selectAll(`text`).remove();let i=hierarchy(this.data()).sum(function(e){return e&&e.size?e.size:1}).sort(function(e,t){return e.value<t.value?-1:+(e.value>t.value)});this._focus=i,this.pack(i),this.circle=this.svg.selectAll(`circle`).data(i.descendants()).enter().append(`circle`).attr(`class`,function(e){return e.parent?e.children?`node`:`node leaf`:`node root`}).style(`fill`,function(e){return e.color=r.paletteDepthLevel_exists()&&e.depth>r.paletteDepthLevel()?(0,n.rgb)(e.parent.color)[r.paletteDepthVariant()](1):r._palette(e.data.label),e.color}).on(`click`,function(e){r.click(e.data,null,null)}).on(`dblclick`,function(e){this._focus!==e&&r.zoom(e),(0,n.d3Event)().stopPropagation()}),this.circle.append(`title`).text(function(e){return e.data.label}),this.svg.selectAll(`text`).data(i.descendants()).enter().append(`text`).attr(`class`,`label`).style(`fill-opacity`,function(e){return+(e.parent===i)}).style(`display`,function(e){return e.parent===i?null:`none`}).text(function(e){return e.data.label+(r.showSize()&&e.data.size!==void 0?` `+e.data.size:``)}),this._node=this.svg.selectAll(`circle,text`),this.zoomTo([i.x,i.y,i.r*2])}zoom(e){this._focus=e;let t=this,r=this.svg.transition().duration((0,n.d3Event)().altKey?7500:750).tween(`zoom`,function(){let e=(0,n.interpolateZoom)(t.view,[t._focus.x,t._focus.y,t._focus.r*2]);return function(n){t.zoomTo(e(n))}});function showText(e){return e===t._focus&&!e.children||e.parent===t._focus}r.selectAll(`text`).filter(function(e){return showText(e)||this.style.display===`inline`}).style(`fill-opacity`,function(e){return+!!showText(e)}).on(`start`,function(e){showText(e)&&(this.style.display=`inline`)}).on(`end`,function(e){showText(e)||(this.style.display=`none`)})}zoomTo(e){let t=this.diameter/e[2];this.view=e,this._node.attr(`transform`,function(n){return`translate(`+(n.x-e[0])*t+`,`+(n.y-e[1])*t+`)`}),this.circle.attr(`r`,function(e){return e.r*t})}};CirclePacking.prototype._class+=` tree_CirclePacking`,CirclePacking.prototype.implements(t.ITree.prototype),CirclePacking.prototype.publish(`showSize`,!0,`boolean`,`Show size along with label`),CirclePacking.prototype.publish(`paletteDepthLevel`,null,`number`,`If not null then beyond this depth number the child node colors are based on parent`,null,{optional:!0}),CirclePacking.prototype.publish(`paletteDepthVariant`,`brighter`,`set`,`Determines paletteDepthLevel decendant color shade variant`,[`brighter`,`darker`],{disable:e=>e.paletteDepthLevel_exists()}),CirclePacking.prototype.publish(`paletteID`,`default`,`set`,`Color palette for this widget`,CirclePacking.prototype._palette.switch(),{tags:[`Basic`,`Shared`]}),CirclePacking.prototype.publish(`useClonedPalette`,!1,`boolean`,`Enable or disable using a cloned palette`,null,{tags:[`Intermediate`,`Shared`]});var DendrogramColumn=class extends n.PropertyExt{_owner;constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.column()}column};DendrogramColumn.prototype._class+=` tree_Dendrogram.DendrogramColumn`,DendrogramColumn.prototype.publish(`column`,null,`set`,`Field`,function(){return this._owner?this._owner.columns():[]},{optional:!0});var Dendrogram=class extends n.SVGZoomWidget{Column;_d3LayoutCluster;_d3LayoutTree;_d3Layout;constructor(){super(),t.ITree.call(this),n.Utility.SimpleSelectionMixin.call(this),this._drawStartPos=`origin`,this._d3LayoutCluster=cluster_default(),this._d3LayoutTree=tree_default()}dendrogramData(){if(this.data().length===0)return[];if(!this.mappings().filter(e=>e.valid()).length)return this.data();return formatData({key:`root`,values:this._db.rollupView(this.mappings().map(function(e){return e.column()})).entries()});function formatData(e){return{label:e.key,children:e.values.filter(function(e){return!(e instanceof Array)}).map(function(e){return formatData(e)}),origRows:e.values}}}enter(e,t){super.enter(e,t),this._renderElement.attr(`opacity`,0).transition().duration(500).attr(`opacity`,1),this._selection.widgetElement(this._renderElement)}update(e,t){super.update(e,t);let r=this,i=this.orientation()===`vertical`;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+`_`+this.id())),this._d3Layout=this.dendrogram()?this._d3LayoutCluster:this._d3LayoutTree,this.radial()?(this._d3Layout.size([360,this.separation()*2]),this._d3Layout.separation(function separation(e,t){return(e.parent===t.parent?1:2)/e.depth})):(this._d3Layout.nodeSize([14,this.separation()]),this._d3Layout.separation(function separation(e,t){return e.parent===t.parent?1:2}));let a=hierarchy(this.dendrogramData());this._d3Layout(a);let o=a.descendants(),s=a.descendants().slice(1);function linkVertical(e){return`M`+e.parent.x+`,`+e.parent.y+`C`+e.parent.x+`,`+(e.parent.y+e.y)/2+` `+e.x+`,`+(e.parent.y+e.y)/2+` `+e.x+`,`+e.y}function linkHorizontal(e){return`M`+e.y+`,`+e.x+`C`+(e.y+e.parent.y)/2+`,`+e.x+` `+(e.y+e.parent.y)/2+`,`+e.parent.x+` `+e.parent.y+`,`+e.parent.x}function diagonal(e){return i?linkVertical(e):linkHorizontal(e)}function project(e,t){let n=(e-90)/180*Math.PI,r=t;return[r*Math.cos(n),r*Math.sin(n)]}function radialDiagonal(e){return`M`+project(e.x,e.y)+`C`+project(e.x,(e.y+e.parent.y)/2)+` `+project(e.parent.x,(e.y+e.parent.y)/2)+` `+project(e.parent.x,e.parent.y)}let c=this._renderCount?500:0,l=this._renderElement.selectAll(`.link`).data(s);l.enter().append(`path`).attr(`class`,`link`).attr(`d`,this.radial()?radialDiagonal:diagonal),l.transition().duration(c).attr(`d`,this.radial()?radialDiagonal:diagonal),l.exit().remove();let u=this.circleRadius()+2;function nodeTransform(e){return r.radial()?`rotate(`+(e.x-90)+`)translate(`+e.y+`)`:r.orientation()===`horizontal`?`translate(`+e.y+`,`+e.x+`)`:`translate(`+e.x+`,`+e.y+`)`}let d=this._renderElement.selectAll(`.node`).data(o);d.transition().duration(c).attr(`transform`,nodeTransform);let f=d.enter().append(`g`).attr(`class`,`node`).attr(`transform`,nodeTransform).call(this._selection.enter.bind(this._selection)).on(`click`,function(e){let t=e;for(;t.children;)t=t.children[0];e.depth>0&&(t.origRows?r.click(r.rowToObj(t.origRows[0]),r.mappings()[e.depth-1].column(),!0):r.click(t.data,r.mappings()[e.depth-1].column(),!0))}).on(`dblclick`,function(e){let t=e;for(;t.children;)t=t.children[0];e.depth>0&&(t.origRows?r.dblclick(r.rowToObj(t.origRows[0]),r.mappings()[e.depth-1].column(),!0):r.dblclick(t.data,r.mappings()[e.depth-1].column(),!0))}).each(function(){let e=(0,n.select)(this);e.append(`circle`),e.append(`text`)});f.merge(d).select(`circle`).attr(`r`,this.circleRadius()).style(`fill`,function(e){return r._palette(e.data.label)}).append(`title`).text(function(e){return e.data.label}),f.merge(d).select(`text`).attr(`dx`,function(e){return r.radial()?e.children?e.x<180?-u:u:e.x<180?u:-u:i?e.children?u:-u:e.children?-u:u}).attr(`dy`,`0.25em`).style(`text-anchor`,function(e){return r.radial()?e.children?e.x<180?`end`:`start`:e.x<180?`start`:`end`:i?e.children?`start`:`end`:e.children?`end`:`start`}).attr(`transform`,function(e){return r.radial()?e.x<180?null:`rotate(180)`:i?`rotate(-66)`:null}).text(function(e){return e.data.label}),d.exit().remove(),this._renderCount||r.zoomToFit()}};Dendrogram.prototype._class+=` tree_Dendrogram`,Dendrogram.prototype.implements(t.ITree.prototype),Dendrogram.prototype.mixin(n.Utility.SimpleSelectionMixin),Dendrogram.prototype.Column=DendrogramColumn,Dendrogram.prototype.publish(`paletteID`,`default`,`set`,`Color palette for this widget`,Dendrogram.prototype._palette.switch(),{tags:[`Basic`,`Shared`]}),Dendrogram.prototype.publish(`useClonedPalette`,!1,`boolean`,`Enable or disable using a cloned palette`,null,{tags:[`Intermediate`,`Shared`]}),Dendrogram.prototype.publish(`mappings`,[],`propertyArray`,`Source Columns`,null,{autoExpand:DendrogramColumn}),Dendrogram.prototype.publish(`circleRadius`,4.5,`number`,`Text offset from circle`),Dendrogram.prototype.publish(`separation`,240,`number`,`Leaf Separation`),Dendrogram.prototype.publish(`dendrogram`,!0,`boolean`,`Dendrogram`),Dendrogram.prototype.publish(`radial`,!1,`boolean`,`Radial`),Dendrogram.prototype.publish(`orientation`,`horizontal`,`set`,`Orientation`,[`horizontal`,`vertical`],{tags:[`Private`],disable:e=>e.radial()});var DirectoryTree=class extends n.HTMLWidget{constructor(){super()}flattenData(e){let t=this,n=hierarchy(e),r=[];return this.omitRoot()?n.children&&n.children.forEach(visitNode):visitNode(n),r;function visitNode(e){let n=e.data.markers&&e.data.markers.length?e.data.markers.length:``;r.push({label:e.data.label,depth:e.depth-+!!t.omitRoot(),content:e.data.content,isFolder:!!e.data.children,iconClass:e.data.iconClass,color:e.data.color,bold:e.data.bold,weightValue:n,markers:e.data.markers,selected:e.data.selected}),e.children&&e.children.forEach(visitNode)}}iconClass(e){return e.label===`error`?`fa fa-exclamation`:e.isFolder?this.folderIconOpen():this.textFileIcon()}calcRequiredWidth(){let e=this.flattenData(this.data()),t=0,r=this.rowItemPadding(),i=this.iconSize()+r*2,a=n.Platform.getScrollbarWidth();return e.forEach(e=>{let o=e.depth*i+r*2,s=n.Utility.textSize(e.label,this.fontFamily(),this.fontSize(),!!e.bold).width+r*2+i+o+a;t<s&&(t=s)}),t}rowClick(e,t){}enter(e,t){super.enter(e,t),t.style(`width`,`100%`).style(`height`,`100%`)}update(e,t){super.update(e,t),this._palette=this._palette.switch(this.paletteID()),t.style(`overflow-y`,this.verticalScroll()?`scroll`:null);let r=this.flattenData(this.data()),i=(0,n.max)(r,e=>Number(e.weightValue));r.forEach(e=>{e.weightValue?e.weightColor=this._palette(e.weightValue,1,i):e.weightColor=`transparent`});let a=this,o=this.rowItemPadding(),s=this.iconSize()+o,c=Math.max(a.iconSize(),a.fontSize()),l=t.selectAll(`.directory-row`).data(r),u=this.fontFamily(),d=this.fontSize(),f=(0,n.max)(r,e=>this.textSize(e.weightValue,u,d).width),p=`${o}px ${o}px ${o/2}px ${o}px`;l.enter().append(`div`).attr(`class`,e=>`directory-row directory-row-depth-${e.depth}`).style(`display`,`flex`).style(`cursor`,`pointer`).each(function(e){let r=(0,n.select)(this),i=e.color?e.color:a.fontColor(),l=e.weightColor?e.weightColor:`transparent`,m=n.Palette.textColor(l),h=r.append(`div`).attr(`class`,`row-weight`).style(`padding`,p).style(`color`,m).style(`box-shadow`,`inset 0 0 100px ${l}`).style(`font-weight`,e.bold?`bold`:`normal`).style(`font-family`,u).style(`font-size`,d+`px`).text(e.weightValue).attr(`title`,e.weightValue).style(`overflow`,`hidden`).style(`width`,f+o*2+`px`).style(`text-overflow`,`ellipsis`).style(`text-align`,`right`).style(`line-height`,c+`px`);r.append(`div`).attr(`class`,`row-depth`).style(`width`,a.depthSize()*e.depth+`px`).style(`opacity`,1).style(`line-height`,c+`px`);let g=r.append(`div`).attr(`class`,`row-icon `+(e.iconClass?e.iconClass:a.iconClass(e))).style(`width`,s+`px`).style(`height`,c+`px`).style(`color`,i).style(`background-color`,e.selected?a.selectionBackgroundColor():`transparent`).style(`font-size`,a.iconSize()+`px`).style(`padding`,p).style(`line-height`,c+`px`),_=r.append(`div`).attr(`class`,`row-label`).style(`padding`,p).style(`color`,i).style(`background-color`,e.selected?a.selectionBackgroundColor():`transparent`).style(`font-weight`,e.bold?`bold`:`normal`).style(`font-family`,a.fontFamily()).style(`font-size`,a.fontSize()+`px`).text(e.label).attr(`title`,e.label).style(`flex`,1).style(`overflow`,`hidden`).style(`text-overflow`,`ellipsis`).style(`line-height`,c+`px`);r.on(`mouseenter`,()=>{_.style(`font-weight`,`bold`)}).on(`mouseleave`,()=>{_.style(`font-weight`,e.bold?`bold`:`normal`)}),h.on(`mouseenter`,()=>{a.weight_mouseenter(e)}).on(`mouseleave`,()=>{a.weight_mouseleave(e)}),e.isFolder?r.on(`click`,function(e){let t=this.nextSibling,i=r.classed(`folder-closed`);for(i?(r.classed(`folder-closed`,!1),r.classed(`folder-open`,!0),g.attr(`class`,`row-icon `+a.folderIconOpen())):(r.classed(`folder-closed`,!0),r.classed(`folder-open`,!1),g.attr(`class`,`row-icon `+a.folderIconClosed()));t!==null;)(0,n.select)(t).datum().depth>e.depth?(t.style.display=i?`flex`:`none`,t=t.nextSibling):t=null}):r.on(`click`,()=>{t.selectAll(`.row-label`).style(`background-color`,`transparent`),t.selectAll(`.row-icon`).style(`background-color`,`transparent`),g.style(`background-color`,a.selectionBackgroundColor()),_.style(`background-color`,a.selectionBackgroundColor());let n=e.label.split(`.`).pop().toLowerCase();a.rowClick(n===`json`?JSON.stringify(JSON.parse(e.content),null,4):e.content,e.markers)})}).merge(l).style(`background-color`,a.backgroundColor()),l.exit().remove()}weight_mouseenter(e){}weight_mouseleave(e){}};DirectoryTree.prototype._class+=` tree_DirectoryTree`,DirectoryTree.prototype._palette=n.Palette.rainbow(`Blues`),DirectoryTree.prototype.publish(`depthSize`,14,`number`,`Width of indentation per file or folder depth (pixels)`),DirectoryTree.prototype.publish(`paletteID`,`Blues`,`set`,`Color palette for the weight backgrounds`,DirectoryTree.prototype._palette.switch(),{tags:[`Basic`]}),DirectoryTree.prototype.publish(`omitRoot`,!1,`boolean`,`If true, root node will not display`),DirectoryTree.prototype.publish(`rowItemPadding`,2,`number`,`Top, bottom, left and right row item padding`),DirectoryTree.prototype.publish(`selectionBackgroundColor`,`#CCC`,`html-color`,`Background color of selected directory rows`),DirectoryTree.prototype.publish(`backgroundColor`,`#FFF`,`html-color`,`Directory item background color`),DirectoryTree.prototype.publish(`fontColor`,`#000`,`html-color`,`Directory item font color`),DirectoryTree.prototype.publish(`fontFamily`,`Arial`,`string`,`Directory item font family`),DirectoryTree.prototype.publish(`fontSize`,12,`number`,`Directory item font size (pixels)`),DirectoryTree.prototype.publish(`iconSize`,12,`number`,`Directory folder and file icon size (pixels)`),DirectoryTree.prototype.publish(`folderIconOpen`,`fa fa-folder-open`,`string`,`Open folder icon class`),DirectoryTree.prototype.publish(`folderIconClosed`,`fa fa-folder`,`string`,`Closed folder icon class`),DirectoryTree.prototype.publish(`textFileIcon`,`fa fa-file-text-o`,`string`,`Text file icon class`),DirectoryTree.prototype.publish(`verticalScroll`,!0,`boolean`,`If true, vertical scroll bar will be shown`);var IndentedColumn=class extends n.PropertyExt{_owner;constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.column()}column};IndentedColumn.prototype._class+=` tree_Dendrogram.IndentedColumn`,IndentedColumn.prototype.publish(`column`,null,`set`,`Field`,function(){return this._owner?this._owner.columns():[]},{optional:!0});var Indented=class extends n.SVGZoomWidget{Column;_d3Tree;_xml;_svgLinks;_svgNodes;_treeData;_collapsed={};constructor(){super(),t.ITree.call(this),n.Utility.SimpleSelectionMixin.call(this),this._drawStartPos=`origin`,this._d3Tree=tree_default()}xmlToData(e,t=``){return DOMParser?xmlToJson(new DOMParser().parseFromString(e,`text/xml`),t).children[0]:[]}xml(e){return arguments.length?(this._xml=e,this.data(this.xmlToData(this._xml)),this):this._xml}IndentedData(){if(this.data().length===0)return[];if(this.xmlColumn_exists()){let e=this.columns().indexOf(this.xmlColumn()),t={label:this.xmlColumn(),children:this.data().map(function(t,n){return this.xmlToData(t[e],`[`+n+`]`)},this)};return t.children.length===1?t.children[0]:t}else return this.mappings().filter(e=>e.valid()).length?formatData({key:`root`,values:this._db.rollupView(this.mappings().map(function(e){return e.column()})).entries()}):this.data();function formatData(e){if(e.values instanceof Array){let t=e.values.filter(function(e){return!(e instanceof Array)}).map(function(e){return formatData(e)}),n={label:e.key};return t.length?n.children=t:n.size=22,n}return{label:e.key,size:e.values.aggregate,origRows:e.values}}}enter(e,t){super.enter(e,t),this._svgLinks=this._renderElement.append(`g`),this._svgNodes=this._renderElement.append(`g`),this._selection.widgetElement(this._svgNodes)}_prevDataChecksum;update(e,t){super.update(e,t);let r=this;this._d3Tree.nodeSize([0,this.barHeight()]);let i=this._db.dataChecksum();this._prevDataChecksum!==i&&(this._treeData=this.IndentedData(),this._prevDataChecksum=i);function getID(e){return(e.parent?getID(e.parent)+`.`:``)+e.data.label}let a=hierarchy(this.data()).sum(function(e){return e.size||50}).each(e=>{this._collapsed[getID(e)]&&delete e.children}),o=this._d3Tree(a).descendants(),s=this._d3Tree(a).descendants().slice(1),c=0;a.eachBefore(e=>{e.x=c*r.barHeight(),++c});let l=this.barHeight()-4,u=this._renderCount?500:0,d=this._svgLinks.selectAll(`.link`).data(s,function(e){return getID(e)});d.enter().append(`path`).attr(`class`,`link`).attr(`d`,elbow),d.transition().duration(u).attr(`d`,elbow),d.exit().remove();function elbow(e){return`M`+e.parent.y+`,`+e.parent.x+`V`+e.x+`, H`+e.y}let f=this._svgNodes.selectAll(`.node`).data(o,function(e){return getID(e)});f.transition().duration(u).attr(`transform`,function(e){return`translate(`+e.y+`,`+e.x+`)`});let p=f.enter().append(`g`).attr(`class`,`node`).attr(`transform`,function(e){return`translate(`+e.y+`,`+e.x+`)`}).call(this._selection.enter.bind(this._selection)).each(function(){let e=(0,n.select)(this);e.append(`rect`).attr(`height`,l).attr(`width`,l).on(`click`,function(e){r._collapsed[getID(e)]?delete r._collapsed[getID(e)]:e.children&&(r._collapsed[getID(e)]=!0),r.lazyRender()}),e.append(`text`)}).style(`opacity`,0);p.transition().style(`opacity`,1),p.merge(f).select(`rect`).attr(`x`,-l/2).attr(`y`,-l/2).style(`fill`,color),p.merge(f).select(`text`).attr(`dx`,l/2+4+`px`).attr(`dy`,`0.33em`).text(function(e){return e.data.label}),f.exit().transition().style(`opacity`,0).remove(),this._renderCount||r.zoomToFit();function color(e){return r._collapsed[getID(e)]?`#3182bd`:e.children?`#c6dbef`:`#fd8d3c`}}};Indented.prototype._class+=` tree_Indented`,Indented.prototype.implements(t.ITree.prototype),Indented.prototype.mixin(n.Utility.SimpleSelectionMixin),Indented.prototype.Column=IndentedColumn,Indented.prototype.publish(`xmlColumn`,null,`set`,`Field`,function(){return this.columns()},{optional:!0}),Indented.prototype.publish(`mappings`,[],`propertyArray`,`Source Columns`,null,{autoExpand:IndentedColumn,disable:e=>e.xmlColumn_exists()}),Indented.prototype.publish(`barHeight`,16,`number`,`Bar height`);function xmlToJson(e,t=``){let n={id:t,label:``,attributes:{},children:[]};if(n.label=e.nodeName,e.nodeType===1){if(e.attributes.length>0)for(let t=0;t<e.attributes.length;t++){let r=e.attributes.item(t);n.attributes[r.nodeName]=r.nodeValue}}else e.nodeType===3&&(n.label=e.nodeValue);if(e.hasChildNodes())for(let r=0;r<e.childNodes.length;r++){let i=xmlToJson(e.childNodes.item(r),t+`[`+n.children.length+`]`);n.children.push(i)}return n}var d=Math.PI,f=2*d,p=1e-6,m=f-p;function Path(){this._x0=this._y0=this._x1=this._y1=null,this._=``}function path(){return new Path}Path.prototype=path.prototype={constructor:Path,moveTo:function(e,t){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)},lineTo:function(e,t){this._+=`L`+(this._x1=+e)+`,`+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+=`Q`+ +e+`,`+ +t+`,`+(this._x1=+n)+`,`+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,a){this._+=`C`+ +e+`,`+ +t+`,`+ +n+`,`+ +r+`,`+(this._x1=+i)+`,`+(this._y1=+a)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,f=l*l+u*u;if(i<0)throw Error(`negative radius: `+i);if(this._x1===null)this._+=`M`+(this._x1=e)+`,`+(this._y1=t);else if(f>p)if(!(Math.abs(u*s-c*l)>p)||!i)this._+=`L`+(this._x1=e)+`,`+(this._y1=t);else{var m=n-a,h=r-o,g=s*s+c*c,_=m*m+h*h,v=Math.sqrt(g),y=Math.sqrt(f),b=i*Math.tan((d-Math.acos((g+f-_)/(2*v*y)))/2),x=b/y,S=b/v;Math.abs(x-1)>p&&(this._+=`L`+(e+x*l)+`,`+(t+x*u)),this._+=`A`+i+`,`+i+`,0,0,`+ +(u*m>l*h)+`,`+(this._x1=e+S*s)+`,`+(this._y1=t+S*c)}},arc:function(e,t,n,r,i,a){e=+e,t=+t,n=+n,a=!!a;var o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,h=a?r-i:i-r;if(n<0)throw Error(`negative radius: `+n);this._x1===null?this._+=`M`+c+`,`+l:(Math.abs(this._x1-c)>p||Math.abs(this._y1-l)>p)&&(this._+=`L`+c+`,`+l),n&&(h<0&&(h=h%f+f),h>m?this._+=`A`+n+`,`+n+`,0,1,`+u+`,`+(e-o)+`,`+(t-s)+`A`+n+`,`+n+`,0,1,`+u+`,`+(this._x1=c)+`,`+(this._y1=l):h>p&&(this._+=`A`+n+`,`+n+`,0,`+ +(h>=d)+`,`+u+`,`+(this._x1=e+n*Math.cos(i))+`,`+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)+`h`+ +n+`v`+ +r+`h`+-n+`Z`},toString:function(){return this._}};function constant_default(e){return function constant(){return e}}__name(constant_default,`default`);var h=Math.abs,g=Math.atan2,_=Math.cos,v=Math.max,y=Math.min,b=Math.sin,x=Math.sqrt,S=Math.PI,C=S/2,w=2*S;function acos(e){return e>1?0:e<-1?S:Math.acos(e)}function asin(e){return e>=1?C:e<=-1?-C:Math.asin(e)}function arcInnerRadius(e){return e.innerRadius}function arcOuterRadius(e){return e.outerRadius}function arcStartAngle(e){return e.startAngle}function arcEndAngle(e){return e.endAngle}function arcPadAngle(e){return e&&e.padAngle}function intersect(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function cornerTangents(e,t,n,r,i,a,o){var s=e-n,c=t-r,l=(o?a:-a)/x(s*s+c*c),u=l*c,d=-l*s,f=e+u,p=t+d,m=n+u,h=r+d,g=(f+m)/2,_=(p+h)/2,y=m-f,b=h-p,S=y*y+b*b,C=i-a,w=f*h-m*p,T=(b<0?-1:1)*x(v(0,C*C*S-w*w)),E=(w*b-y*T)/S,D=(-w*y-b*T)/S,O=(w*b+y*T)/S,k=(-w*y+b*T)/S,A=E-g,j=D-_,M=O-g,N=k-_;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-u,y01:-d,x11:E*(i/C-1),y11:D*(i/C-1)}}function arc_default(){var e=arcInnerRadius,t=arcOuterRadius,n=constant_default(0),r=null,i=arcStartAngle,a=arcEndAngle,o=arcPadAngle,s=null;function arc(){var c,l,u=+e.apply(this,arguments),d=+t.apply(this,arguments),f=i.apply(this,arguments)-C,p=a.apply(this,arguments)-C,m=h(p-f),v=p>f;if(s||=c=path(),d<u&&(l=d,d=u,u=l),!(d>1e-12))s.moveTo(0,0);else if(m>w-1e-12)s.moveTo(d*_(f),d*b(f)),s.arc(0,0,d,f,p,!v),u>1e-12&&(s.moveTo(u*_(p),u*b(p)),s.arc(0,0,u,p,f,v));else{var T=f,E=p,D=f,O=p,k=m,A=m,j=o.apply(this,arguments)/2,M=j>1e-12&&(r?+r.apply(this,arguments):x(u*u+d*d)),N=y(h(d-u)/2,+n.apply(this,arguments)),P=N,F=N,I,L;if(M>1e-12){var R=asin(M/u*b(j)),z=asin(M/d*b(j));(k-=R*2)>1e-12?(R*=v?1:-1,D+=R,O-=R):(k=0,D=O=(f+p)/2),(A-=z*2)>1e-12?(z*=v?1:-1,T+=z,E-=z):(A=0,T=E=(f+p)/2)}var B=d*_(T),V=d*b(T),H=u*_(O),U=u*b(O);if(N>1e-12){var W=d*_(E),G=d*b(E),K=u*_(D),q=u*b(D),J;if(m<S&&(J=intersect(B,V,K,q,W,G,H,U))){var Y=B-J[0],X=V-J[1],Z=W-J[0],Q=G-J[1],$=1/b(acos((Y*Z+X*Q)/(x(Y*Y+X*X)*x(Z*Z+Q*Q)))/2),ee=x(J[0]*J[0]+J[1]*J[1]);P=y(N,(u-ee)/($-1)),F=y(N,(d-ee)/($+1))}}A>1e-12?F>1e-12?(I=cornerTangents(K,q,B,V,d,F,v),L=cornerTangents(W,G,H,U,d,F,v),s.moveTo(I.cx+I.x01,I.cy+I.y01),F<N?s.arc(I.cx,I.cy,F,g(I.y01,I.x01),g(L.y01,L.x01),!v):(s.arc(I.cx,I.cy,F,g(I.y01,I.x01),g(I.y11,I.x11),!v),s.arc(0,0,d,g(I.cy+I.y11,I.cx+I.x11),g(L.cy+L.y11,L.cx+L.x11),!v),s.arc(L.cx,L.cy,F,g(L.y11,L.x11),g(L.y01,L.x01),!v))):(s.moveTo(B,V),s.arc(0,0,d,T,E,!v)):s.moveTo(B,V),!(u>1e-12)||!(k>1e-12)?s.lineTo(H,U):P>1e-12?(I=cornerTangents(H,U,W,G,u,-P,v),L=cornerTangents(B,V,K,q,u,-P,v),s.lineTo(I.cx+I.x01,I.cy+I.y01),P<N?s.arc(I.cx,I.cy,P,g(I.y01,I.x01),g(L.y01,L.x01),!v):(s.arc(I.cx,I.cy,P,g(I.y01,I.x01),g(I.y11,I.x11),!v),s.arc(0,0,u,g(I.cy+I.y11,I.cx+I.x11),g(L.cy+L.y11,L.cx+L.x11),v),s.arc(L.cx,L.cy,P,g(L.y11,L.x11),g(L.y01,L.x01),!v))):s.arc(0,0,u,O,D,v)}if(s.closePath(),c)return s=null,c+``||null}return arc.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-S/2;return[_(r)*n,b(r)*n]},arc.innerRadius=function(t){return arguments.length?(e=typeof t==`function`?t:constant_default(+t),arc):e},arc.outerRadius=function(e){return arguments.length?(t=typeof e==`function`?e:constant_default(+e),arc):t},arc.cornerRadius=function(e){return arguments.length?(n=typeof e==`function`?e:constant_default(+e),arc):n},arc.padRadius=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:constant_default(+e),arc):r},arc.startAngle=function(e){return arguments.length?(i=typeof e==`function`?e:constant_default(+e),arc):i},arc.endAngle=function(e){return arguments.length?(a=typeof e==`function`?e:constant_default(+e),arc):a},arc.padAngle=function(e){return arguments.length?(o=typeof e==`function`?e:constant_default(+e),arc):o},arc.context=function(e){return arguments.length?(s=e??null,arc):s},arc}__name(arc_default,`default`);var SunburstPartition=class extends n.SVGWidget{svg;radius;_xScale;_yScale;partition;arc;_resetRoot;constructor(){super(),t.ITree.call(this)}data(e){let t=n.SVGWidget.prototype.data.apply(this,arguments);return arguments.length&&(this._resetRoot=!0),t}enter(e,t){let r=this;this.radius=Math.min(this.width(),this.height())/2,this._xScale=(0,n.scaleLinear)().range([0,2*Math.PI]),this._yScale=(0,n.scaleSqrt)().range([0,this.radius]),this.partition=partition_default(),this.arc=arc_default().startAngle(function(e){return Math.max(0,Math.min(2*Math.PI,r._xScale(e.x0)))}).endAngle(function(e){return Math.max(0,Math.min(2*Math.PI,r._xScale(e.x1)))}).innerRadius(function(e){return Math.max(0,r._yScale(e.y0))}).outerRadius(function(e){return Math.max(0,r._yScale(e.y1))}),this.svg=t.append(`g`)}update(e,t){let r=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+`_`+this.id())),this.radius=Math.min(this.width(),this.height())/2,this._yScale.range([0,this.radius]);let i=hierarchy(this.data()).sum(function(e){return e.size===void 0?1:e.size}),a=this.svg.selectAll(`path`).data(this.partition(i).descendants(),function(e,t){return e.data.label===void 0?t:e.data.label});a.enter().append(`path`).on(`click`,function(e){r.click(e.data,null,null)}).on(`dblclick`,function(e){let t=(0,n.d3Event)();t&&t.stopPropagation(),r.zoomTo(e)}).each(function(){(0,n.select)(this).append(`title`)}).merge(a).attr(`d`,this.arc).style(`fill`,function(e){return e.data.__viz_fill?e.data.__viz_fill:r._palette(e.data.label)}).style(`stroke`,function(e){return e.value>16?`white`:`none`}).select(`title`).text(function(e){return e.data.label}),a.exit().remove(),this._resetRoot&&(this._resetRoot=!1,this.zoomTo(i))}zoomTo(e){let t=this;this.svg.transition().duration(750).tween(`scale`,function(){let r=(0,n.interpolate)(t._xScale.domain(),[e.x0,e.x1]),i=(0,n.interpolate)(t._yScale.domain(),[e.y0,1]),a=(0,n.interpolate)(t._yScale.range(),[e.y0?20:0,t.radius]);return function(e){t._xScale.domain(r(e)),t._yScale.domain(i(e)).range(a(e))}}).selectAll(`path`).attrTween(`d`,function(e){return function(){return t.arc(e)}})}};SunburstPartition.prototype._class+=` tree_SunburstPartition`,SunburstPartition.prototype.implements(t.ITree.prototype),SunburstPartition.prototype.publish(`paletteID`,`default`,`set`,`Color palette for this widget`,SunburstPartition.prototype._palette.switch(),{tags:[`Basic`,`Shared`]}),SunburstPartition.prototype.publish(`useClonedPalette`,!1,`boolean`,`Enable or disable using a cloned palette`,null,{tags:[`Intermediate`,`Shared`]});var TreemapColumn=class extends n.PropertyExt{_owner;constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.column()}column};TreemapColumn.prototype._class+=` tree_Dendrogram.TreemapColumn`,TreemapColumn.prototype.publish(`column`,null,`set`,`Field`,function(){return this._owner?this._owner.columns():[]},{optional:!0});var Treemap=class extends n.HTMLWidget{Column;_d3Treemap;_elementDIV;_selection;constructor(){super(),t.ITree.call(this),n.Utility.SimpleSelectionMixin.call(this,!0)}getTilingMethod(){switch(this.tilingMethod()){case`treemapBinary`:return binary_default;case`treemapDice`:return dice_default;case`treemapSlice`:return slice_default;case`treemapSliceDice`:return sliceDice_default;case`treemapResquarify`:return u;default:return l}}treemapData(){if(!this.mappings().filter(e=>e.valid()).length)return this.data();return formatData({key:`root`,values:this._db.aggregateView(this.mappings().map(function(e){return e.column()}),this.aggrType(),this.aggrColumn()).entries()});function formatData(e){if(e.values instanceof Array){let t=e.values.filter(function(e){return!(e instanceof Array)}).map(function(e){return formatData(e)}),n={label:e.key};return t.length?n.children=t:n.size=22,n}return{label:e.key,size:e.values.aggregate,origRows:e.values}}}enter(e,t){super.enter(e,t),this._d3Treemap=treemap_default(),this._elementDIV=t.append(`div`),this._selection.widgetElement(this._elementDIV)}update(e,t){super.update(e,t);let r=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+`_`+this.id()));let i=hierarchy(this.treemapData()).sum(this.nodeWeight);this._d3Treemap.size([this.width(),this.height()]).paddingInner(this.paddingInner()).paddingOuter(this.paddingOuter()).paddingTop(this.paddingTop()),[`treemapSquarify`,`treemapResquarify`].indexOf(this.tilingMethod())===-1?this._d3Treemap.tile(this.getTilingMethod()):this._d3Treemap.tile(this.getTilingMethod().ratio(this.squarifyRatio())),this._d3Treemap(i),this._elementDIV.style(`font-size`,this.fontSize_exists()?this.fontSize()+`px`:null).style(`line-height`,this.fontSize_exists()?this.fontSize()+2+`px`:null);let a=this._elementDIV.selectAll(`.node`).data(i.descendants());a.enter().append(`div`).attr(`class`,`node`).call(this._selection.enter.bind(this._selection)).on(`click`,function(e){if(e){let t=``;r.mappings().forEach(function(e){e.column()&&(t=e.column())}),e.origRows?r.click(r.rowToObj(e.origRows[0]),t,r._selection.selected(this)):r.click(e.data,t,r._selection.selected(this))}}).on(`dblclick`,function(e){if(e){let t=``;r.mappings().forEach(function(e){e.column()&&(t=e.column())}),e.origRows?r.dblclick(r.rowToObj(e.origRows[0]),t,r._selection.selected(this)):r.dblclick(e.data,t,r._selection.selected(this))}}).merge(a).style(`left`,function(e){return e.x0+Math.max(0,e.x1-e.x0)/2+`px`}).style(`top`,function(e){return e.y0+Math.max(0,e.y1-e.y0)/2+`px`}).style(`width`,function(){return`0px`}).style(`height`,function(){return`0px`}).style(`font-size`,function(e){return(e.children?r.parentFontSize():r.leafFontSize())+`px`}).style(`line-height`,function(e){return(e.children?r.parentFontSize():r.leafFontSize())+`px`}).attr(`title`,tooltip).html(function(e){return!r.showRoot()&&e.depth===0?null:e.children?r.enableParentLabels()?r.parentWeightHTML(e):null:r.leafWeightHTML(e)}).style(`background`,function(e){if(!r.showRoot()&&e.depth===0)return this.style.color=`transparent`,`transparent`;let t=r.brighterLeafNodes()?`brighter`:`darker`,i;return r.usePaletteOnParentNodes()?i=e.children?r._palette(e.data.label):(0,n.rgb)(r._palette(e.parent.data.label))[t](1):(i=e.depth>r.depthColorLimit()?(0,n.rgb)(e.parent.color)[t](1):r._palette(e.data.label),e.color=i),this.style.color=n.Palette.textColor(i),i}).transition().duration(this.transitionDuration()).style(`pointer-events`,function(e){return!r.showRoot()&&e.depth===0?`none`:`all`}).style(`opacity`,function(e){return e.children?1:null}).style(`left`,function(e){return e.x0+`px`}).style(`top`,function(e){return e.y0+`px`}).style(`width`,function(e){return Math.max(0,e.x1-e.x0)+`px`}).style(`height`,function(e){return Math.max(0,e.y1-e.y0)+`px`}).each(function(e){e.depth===0&&(this.style.color=r.showRoot()?``:`transparent`,this.style.borderColor=r.showRoot()?``:`transparent`)}),a.exit().transition().duration(this.transitionDuration()).style(`opacity`,0).remove();function tooltip(e){if(e.children&&!r.enableParentTooltips())return null;let t=e.data.label+` (`+e.value+`)`;for(;e.parent&&e.parent.parent;)t=e.parent.data.label+` -> `+t,e=e.parent;return t}}exit(e,t){super.exit(e,t)}nodeWeight(e){return e.size||1}parentWeightHTML(e){return this.showParentWeight()?`<span class="treemap-parent-label">${e.data.label}</span><span class="treemap-parent-value">${e.value}${this.weightSuffix()}</span>`:`<span class="treemap-parent-label">${e.data.label}</span>`}leafWeightHTML(e){return this.showLeafWeight()?`<span class="treemap-leaf-label">${e.data.label}</span><span class="treemap-leaf-value">${e.value}${this.weightSuffix()}</span>`:`<span class="treemap-leaf-label">${e.data.label}</span>`}};Treemap.prototype._class+=` tree_Treemap`,Treemap.prototype.implements(t.ITree.prototype),Treemap.prototype.mixin(n.Utility.SimpleSelectionMixin),Treemap.prototype.Column=TreemapColumn,Treemap.prototype.publish(`paletteID`,`default`,`set`,`Color palette for this widget`,Treemap.prototype._palette.switch(),{tags:[`Basic`,`Shared`]}),Treemap.prototype.publish(`useClonedPalette`,!1,`boolean`,`Enable or disable using a cloned palette`,null,{tags:[`Intermediate`,`Shared`]}),Treemap.prototype.publish(`mappings`,[],`propertyArray`,`Source Columns`,null,{autoExpand:TreemapColumn}),Treemap.prototype.publish(`aggrType`,null,`set`,`Aggregation Type`,[null,`mean`,`median`,`sum`,`min`,`max`],{optional:!0}),Treemap.prototype.publish(`aggrColumn`,null,`set`,`Aggregation Field`,function(){return this.columns()},{optional:!0,disable:e=>!e.aggrType()}),Treemap.prototype.publish(`fontSize`,null,`number`,`Font Size`,null,{optional:!0}),Treemap.prototype.publish(`paddingInner`,18.6,`number`,`Pixel spacing between each sibling node`),Treemap.prototype.publish(`paddingOuter`,30,`number`,`Pixel padding of parent nodes`),Treemap.prototype.publish(`paddingTop`,41.4,`number`,`Additional top pixel padding of parent nodes`),Treemap.prototype.publish(`showRoot`,!1,`boolean`,`Show root element`),Treemap.prototype.publish(`parentFontSize`,18,`number`,`Parent font-size`),Treemap.prototype.publish(`leafFontSize`,16,`number`,`Leaf font-size`),Treemap.prototype.publish(`usePaletteOnParentNodes`,!1,`boolean`,`Assign a color from the palette to every parent node`),Treemap.prototype.publish(`depthColorLimit`,1,`number`,`Assign a color from the palette to node with depth lower than this value`,null,{optional:!0,disable:e=>e.usePaletteOnParentNodes()}),Treemap.prototype.publish(`squarifyRatio`,1,`number`,`Specifies the desired aspect ratio of the generated rectangles (must be >= 1)`,null,{optional:!0,disable:e=>[`treemapSquarify`,`treemapResquarify`].indexOf(e.tilingMethod())===-1}),Treemap.prototype.publish(`showParentWeight`,!0,`boolean`,`Show weight of parent nodes`),Treemap.prototype.publish(`showLeafWeight`,!0,`boolean`,`Show weight of leaf nodes`),Treemap.prototype.publish(`weightSuffix`,``,`string`,`Weight suffix (ex: 'ms')`),Treemap.prototype.publish(`brighterLeafNodes`,!1,`boolean`,`Brighter/darker leaf node color (false = darker)`),Treemap.prototype.publish(`enableParentLabels`,!0,`boolean`,`Enable parent labels`),Treemap.prototype.publish(`enableParentTooltips`,!0,`boolean`,`Enable parent tooltips`),Treemap.prototype.publish(`transitionDuration`,250,`number`,`Transition Duration`),Treemap.prototype.publish(`tilingMethod`,`treemapSquarify`,`set`,`Transition Duration`,[`treemapBinary`,`treemapDice`,`treemapResquarify`,`treemapSlice`,`treemapSliceDice`,`treemapSquarify`]),e.BUILD_VERSION=o,e.CirclePacking=CirclePacking,e.Dendrogram=Dendrogram,e.DendrogramColumn=DendrogramColumn,e.DirectoryTree=DirectoryTree,e.Indented=Indented,e.IndentedColumn=IndentedColumn,e.PKG_NAME=i,e.PKG_VERSION=a,e.SunburstPartition=SunburstPartition,e.Treemap=Treemap,e.TreemapColumn=TreemapColumn});
2
2
  //# sourceMappingURL=index.umd.cjs.map
3
- !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode(".tree_CirclePacking circle{fill:#1f77b4;fill-opacity:.25;stroke:#1f77b4;stroke-width:1px}.tree_CirclePacking .leaf circle{fill:#ff7f0e;fill-opacity:1}.tree_CirclePacking .label{fill:#fff;text-anchor:middle}.tree_Dendrogram .node circle{fill:#dcf1ff;stroke:#1f77b4;stroke-width:1px}.tree_Dendrogram .node.selected circle{stroke:red}.tree_Dendrogram .node.over circle{stroke:orange}.tree_Dendrogram .node.selected.over circle{stroke:red}.tree_Dendrogram .node.selected text{fill:red}.tree_Dendrogram .node.over text{fill:orange}.tree_Dendrogram .node.selected.over text{fill:red}.tree_Dendrogram .node text{font-size:14px}.tree_Dendrogram .link{fill:none;stroke:#656565;stroke-width:1px}.tree_Indented .node rect{cursor:pointer;fill:#fff;stroke:#3182bd;stroke-width:1px}.tree_Indented .node text{font:10px sans-serif;pointer-events:none}.tree_Indented path.link{fill:none;stroke:#9ecae1;stroke-width:1.5px}.tree_Sunburst path{stroke:#fff;stroke-width:.5px;fill-rule:evenodd}.tree_Treemap *{box-sizing:border-box}.tree_Treemap .node{border:solid 1px #333;overflow:hidden;text-overflow:ellipsis;position:absolute}.tree_Treemap .node.selected{border-color:red}.tree_Treemap .node.over{border-color:orange}.tree_Treemap .node.selected.over{border-color:red}.tree_Treemap .node>span.treemap-parent-label{font-weight:700;display:inline-block;margin:4px 4px 0}.tree_Treemap .node>span.treemap-parent-value{font-weight:400;font-style:italic;margin:4px 0 0}.tree_Treemap .node>span.treemap-singleton-label{font-weight:400;display:block;margin:4px 0 0 4px}.tree_Treemap .node>span.treemap-singleton-value{font-style:italic;display:block;margin:0 0 0 4px}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}}();
3
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.tree_CirclePacking circle{fill:#1f77b4;fill-opacity:.25;stroke:#1f77b4;stroke-width:1px}.tree_CirclePacking .leaf circle{fill:#ff7f0e;fill-opacity:1}.tree_CirclePacking .label{fill:#fff;text-anchor:middle}.tree_Dendrogram .node circle{fill:#dcf1ff;stroke:#1f77b4;stroke-width:1px}.tree_Dendrogram .node.selected circle{stroke:red}.tree_Dendrogram .node.over circle{stroke:orange}.tree_Dendrogram .node.selected.over circle{stroke:red}.tree_Dendrogram .node.selected text{fill:red}.tree_Dendrogram .node.over text{fill:orange}.tree_Dendrogram .node.selected.over text{fill:red}.tree_Dendrogram .node text{font-size:14px}.tree_Dendrogram .link{fill:none;stroke:#656565;stroke-width:1px}.tree_Indented .node rect{cursor:pointer;fill:#fff;stroke:#3182bd;stroke-width:1px}.tree_Indented .node text{pointer-events:none;font:10px sans-serif}.tree_Indented path.link{fill:none;stroke:#9ecae1;stroke-width:1.5px}.tree_Sunburst path{stroke:#fff;stroke-width:.5px;fill-rule:evenodd}.tree_Treemap *{box-sizing:border-box}.tree_Treemap .node{text-overflow:ellipsis;border:1px solid #333;position:absolute;overflow:hidden}.tree_Treemap .node.selected{border-color:red}.tree_Treemap .node.over{border-color:orange}.tree_Treemap .node.selected.over{border-color:red}.tree_Treemap .node>span.treemap-parent-label{margin:4px 4px 0;font-weight:700;display:inline-block}.tree_Treemap .node>span.treemap-parent-value{margin:4px 0 0;font-style:italic;font-weight:400}.tree_Treemap .node>span.treemap-singleton-label{margin:4px 0 0 4px;font-weight:400;display:block}.tree_Treemap .node>span.treemap-singleton-value{margin:0 0 0 4px;font-style:italic;display:block}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();