@john-guerra/fisheye-nav 0.1.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.
@@ -0,0 +1 @@
1
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).fisheyeNav={})}(this,function(t){"use strict";var n="http://www.w3.org/1999/xhtml",e={svg:"http://www.w3.org/2000/svg",xhtml:n,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var n=t+="",r=n.indexOf(":");return r>=0&&"xmlns"!==(n=t.slice(0,r))&&(t=t.slice(r+1)),e.hasOwnProperty(n)?{space:e[n],local:t}:t}function i(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===n&&e.documentElement.namespaceURI===n?e.createElement(t):e.createElementNS(r,t)}}function o(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function a(t){var n=r(t);return(n.local?o:i)(n)}function s(){}function l(t){return null==t?s:function(){return this.querySelector(t)}}function u(){return[]}function c(t){return function(){return null==(n=t.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}function f(t){return function(n){return n.matches(t)}}var h=Array.prototype.find;function d(){return this.firstElementChild}var p=Array.prototype.filter;function g(){return Array.from(this.children)}function y(t){return new Array(t.length)}function m(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function v(t,n,e,r,i,o){for(var a,s=0,l=n.length,u=o.length;s<u;++s)(a=n[s])?(a.__data__=o[s],r[s]=a):e[s]=new m(t,o[s]);for(;s<l;++s)(a=n[s])&&(i[s]=a)}function b(t,n,e,r,i,o,a){var s,l,u,c=new Map,f=n.length,h=o.length,d=new Array(f);for(s=0;s<f;++s)(l=n[s])&&(d[s]=u=a.call(l,l.__data__,s,n)+"",c.has(u)?i[s]=l:c.set(u,l));for(s=0;s<h;++s)u=a.call(t,o[s],s,o)+"",(l=c.get(u))?(r[s]=l,l.__data__=o[s],c.delete(u)):e[s]=new m(t,o[s]);for(s=0;s<f;++s)(l=n[s])&&c.get(d[s])===l&&(i[s]=l)}function w(t){return t.__data__}function x(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function k(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function _(t){return function(){this.removeAttribute(t)}}function M(t){return function(){this.removeAttributeNS(t.space,t.local)}}function S(t,n){return function(){this.setAttribute(t,n)}}function A(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function N(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function E(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function C(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function $(t){return function(){this.style.removeProperty(t)}}function L(t,n,e){return function(){this.style.setProperty(t,n,e)}}function P(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function z(t){return function(){delete this[t]}}function B(t,n){return function(){this[t]=n}}function R(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function q(t){return t.trim().split(/^|\s+/)}function W(t){return t.classList||new j(t)}function j(t){this._node=t,this._names=q(t.getAttribute("class")||"")}function O(t,n){for(var e=W(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function I(t,n){for(var e=W(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function T(t){return function(){O(this,t)}}function D(t){return function(){I(this,t)}}function H(t,n){return function(){(n.apply(this,arguments)?O:I)(this,t)}}function V(){this.textContent=""}function F(t){return function(){this.textContent=t}}function U(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function Y(){this.innerHTML=""}function X(t){return function(){this.innerHTML=t}}function G(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function J(){this.nextSibling&&this.parentNode.appendChild(this)}function K(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Z(){return null}function Q(){var t=this.parentNode;t&&t.removeChild(this)}function tt(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function nt(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function et(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function rt(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function it(t,n,e){var r=C(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function ot(t,n){return function(){return it(this,t,n)}}function at(t,n){return function(){return it(this,t,n.apply(this,arguments))}}m.prototype={constructor:m,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},j.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var st=[null];function lt(t,n){this._groups=t,this._parents=n}function ut(t){return"string"==typeof t?new lt([[document.querySelector(t)]],[document.documentElement]):new lt([[t]],st)}function ct(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function ft(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=dt)):void 0===n&&(n=ht);for(var e,r,i,o,a,s=new yt(t),l=[s];e=l.pop();)if((i=n(e.data))&&(a=(i=Array.from(i)).length))for(e.children=i,o=a-1;o>=0;--o)l.push(r=i[o]=new yt(i[o])),r.parent=e,r.depth=e.depth+1;return s.eachBefore(gt)}function ht(t){return t.children}function dt(t){return Array.isArray(t)?t[1]:null}function pt(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function gt(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function yt(t){this.data=t,this.depth=this.height=0,this.parent=null}lt.prototype={constructor:lt,select:function(t){"function"!=typeof t&&(t=l(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,s=n[i],u=s.length,c=r[i]=new Array(u),f=0;f<u;++f)(o=s[f])&&(a=t.call(o,o.__data__,f,s))&&("__data__"in o&&(a.__data__=o.__data__),c[f]=a);return new lt(r,this._parents)},selectAll:function(t){t="function"==typeof t?c(t):function(t){return null==t?u:function(){return this.querySelectorAll(t)}}(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,s=n[o],l=s.length,f=0;f<l;++f)(a=s[f])&&(r.push(t.call(a,a.__data__,f,s)),i.push(a));return new lt(r,i)},selectChild:function(t){return this.select(null==t?d:function(t){return function(){return h.call(this.children,t)}}("function"==typeof t?t:f(t)))},selectChildren:function(t){return this.selectAll(null==t?g:function(t){return function(){return p.call(this.children,t)}}("function"==typeof t?t:f(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],s=a.length,l=r[i]=[],u=0;u<s;++u)(o=a[u])&&t.call(o,o.__data__,u,a)&&l.push(o);return new lt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,w);var e,r=n?b:v,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,s=new Array(a),l=new Array(a),u=new Array(a),c=0;c<a;++c){var f=i[c],h=o[c],d=h.length,p=x(t.call(f,f&&f.__data__,c,i)),g=p.length,y=l[c]=new Array(g),m=s[c]=new Array(g);r(f,h,y,m,u[c]=new Array(d),p,n);for(var k,_,M=0,S=0;M<g;++M)if(k=y[M]){for(M>=S&&(S=M+1);!(_=m[S])&&++S<g;);k._next=_||null}}return(s=new lt(s,i))._enter=l,s._exit=u,s},enter:function(){return new lt(this._enter||this._groups.map(y),this._parents)},exit:function(){return new lt(this._exit||this._groups.map(y),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var u,c=e[l],f=r[l],h=c.length,d=s[l]=new Array(h),p=0;p<h;++p)(u=c[p]||f[p])&&(d[p]=u);for(;l<i;++l)s[l]=e[l];return new lt(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=k);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,s=e[o],l=s.length,u=i[o]=new Array(l),c=0;c<l;++c)(a=s[c])&&(u[c]=a);u.sort(n)}return new lt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=r(t);if(arguments.length<2){var i=this.node();return e.local?i.getAttributeNS(e.space,e.local):i.getAttribute(e)}return this.each((null==n?e.local?M:_:"function"==typeof n?e.local?E:N:e.local?A:S)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?$:"function"==typeof n?P:L)(t,n,null==e?"":e)):function(t,n){return t.style.getPropertyValue(n)||C(t).getComputedStyle(t,null).getPropertyValue(n)}(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?z:"function"==typeof n?R:B)(t,n)):this.node()[t]},classed:function(t,n){var e=q(t+"");if(arguments.length<2){for(var r=W(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?H:n?T:D)(e,n))},text:function(t){return arguments.length?this.each(null==t?V:("function"==typeof t?U:F)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Y:("function"==typeof t?G:X)(t)):this.node().innerHTML},raise:function(){return this.each(J)},lower:function(){return this.each(K)},append:function(t){var n="function"==typeof t?t:a(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:a(t),r=null==n?Z:"function"==typeof n?n:l(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Q)},clone:function(t){return this.select(t?nt:tt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),a=o.length;if(!(arguments.length<2)){for(s=n?rt:et,r=0;r<a;++r)this.each(s(o[r],n,e));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(r=0,l=s[u];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,n){return this.each(("function"==typeof n?at:ot)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}},yt.prototype=ft.prototype={constructor:yt,count:function(){return this.eachAfter(ct)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r]);for(;o=s.pop();)t.call(n,o,++l,this);return this},eachBefore:function(t,n){for(var e,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(n,i,++a,this),e=i.children)for(r=e.length-1;r>=0;--r)o.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;t=e.pop(),n=r.pop();for(;t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return ft(this).eachBefore(pt)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e])}while(o.length)}};const mt=t=>t.map(t=>t.key+"="+t.value).join("\0");function vt(t,n,e=!0){const r=n(t);if(!r?.length)return t;const i=r.map(t=>vt(t,n,!1));return e?{...t,children:i}:{...t,children:[{__header:!0,__of:t,children:null},...i]}}function bt(t,n){if(n(t),t.children)for(const e of t.children)bt(e,n)}const wt=t=>null==t?"":String(t);function xt(t={}){const{data:n,keys:e,root:r,children:i=t=>t.children,value:o=(t,n)=>t[n],count:a=t=>t.count??1,label:s=wt,headers:l=!1}=t,u=(t,n)=>l?vt(t,n):t;let c;return null!=r?(c=ft(u(r,i),t=>l?t.children:i(t)),c.each(t=>{const n=t.data??{},e=n.__header?n.__of:n;t.data={key:e.key??null,value:e.value??e.name??e.id??null,row:e,header:!!n.__header,ownCount:n.__header?0:t.children?.length?void 0:a(e)}})):Array.isArray(n)&&Array.isArray(e)?(c=ft(u(function(t,n,e,r){const i={key:null,value:null,children:[],row:null},o=new Map([["",i]]);for(const a of t){let t=i,s="";for(const r of n){const n=e(a,r);s+="\0"+r+"="+n;let i=o.get(s);i||(i={key:r,value:n,children:[],row:null},o.set(s,i),t.children.push(i)),t=i}t.row=a,t.ownCount=(t.ownCount??0)+r(a)}return i}(n,e,o,a),t=>t.children),t=>t.children),l&&c.each(t=>{if(!t.data.__header)return;const n=t.data.__of;t.data={key:n.key,value:n.value,row:n.row,header:!0,ownCount:0}})):c=ft({key:null,value:null,children:[],ownCount:0}),function(t,n){const e=[];return bt(t,t=>{t.children?.length||e.push(t)}),e.forEach((t,n)=>{t.leafStart=n,t.leafEnd=n+1}),t.eachBefore(t=>{const e=t.data;if(t.label=String(n(e.value,e.key,t)??e.value??""),e.header)return t.keyPath=t.parent.keyPath,void(t.id=t.parent.id+"#header");t.keyPath=0===t.depth?[]:[...t.parent.keyPath,{key:e.key,value:e.value}],t.id=mt(t.keyPath)}),t.eachAfter(t=>{if(t.children?.length){t.count=0,t.leafStart=1/0,t.leafEnd=-1/0;for(const n of t.children)t.count+=n.count,n.leafStart<t.leafStart&&(t.leafStart=n.leafStart),n.leafEnd>t.leafEnd&&(t.leafEnd=n.leafEnd)}else t.count=t.data.ownCount??t.data.count??0}),t.leaves_=e,t}(c,s)}function kt(t){return t.leaves_??t.leaves()}function _t(t){return kt(t).map(t=>({node:t,leafStart:t.leafStart,leafEnd:t.leafEnd,count:t.count}))}function Mt(t,n){return n>=t.leafStart&&n<t.leafEnd?0:n<t.leafStart?t.leafStart-n:n-(t.leafEnd-1)}function St(t,n,e){const r=-Math.abs(t.depth-n.node.depth)*e.apiWeight,i=Math.log1p(Mt(t,n.leaf)),o=function(t,n){let e=t,r=n,i=0;for(;e.depth>r.depth;)e=e.parent,i++;for(;r.depth>e.depth;)r=r.parent,i++;for(;e!==r&&e.parent&&r.parent;)e=e.parent,r=r.parent,i+=2;return i}(t,n.node),a=e.treeWeight;return r-((1-a)*i+a*o)*e.distanceWeight+Math.log1p(t.count)*e.countWeight}function At(t,n){const e=kt(t),r=e.length;if(!r)return[];const i=Math.max(1,Math.floor(n.budget??r));if(r<=i)return _t(t);const o=Math.max(0,Math.min(n.focusLeaf??0,r-1)),a={leaf:o,node:e[o]},s=e.map((t,e)=>({leaf:t,i:e,score:St(t,a,n)})).filter(({leaf:t})=>!t.data?.header).sort((t,n)=>n.score-t.score||Math.abs(t.i-o)-Math.abs(n.i-o)||t.i-n.i);for(let n=Math.min(i,r);n>=1;n--){const e=new Set(s.slice(0,n).map(t=>t.leaf));e.add(a.node);const r=Nt(t,e);if(r.length<=i)return r}return Nt(t,new Set([a.node]))}function Nt(t,n){const e=new Map;t.eachAfter(t=>{if(!t.children?.length)return e.set(t,n.has(t));e.set(t,t.children.some(t=>e.get(t)))});const r=[];let i=null;const o=()=>{i&&(r.push(1===i.nodes.length?{node:i.nodes[0],leafStart:i.leafStart,leafEnd:i.leafEnd,count:i.count}:{node:null,parent:i.parent,nodes:i.nodes,leafStart:i.leafStart,leafEnd:i.leafEnd,count:i.count}),i=null)};return function t(n){for(const a of n.children??[]){const s=a.data?.header,l=e.get(a)&&a.children?.length,u=s||e.get(a)&&!a.children?.length;l||u?(o(),l?t(a):r.push({node:a,leafStart:a.leafStart,leafEnd:a.leafEnd,count:a.count})):i&&i.parent===n?(i.nodes.push(a),i.leafEnd=a.leafEnd,i.count+=a.count):(o(),i={parent:n,nodes:[a],leafStart:a.leafStart,leafEnd:a.leafEnd,count:a.count})}o()}(t),r}const Et=["slots","count"];function Ct(t,n,e,r,i){const o=t<n;let a=o?n-e:r-n;0===a&&(a=r-e);const s=Math.abs(t-n);return s<1e-9?n:a*(i+1)*(o?-1:1)/(i+a/s)+n}const $t=(t,n,e)=>Math.max(n,Math.min(e,t));function Lt(t,{min:n,max:e,sizeBy:r="slots",sizeFloor:i=.25}){const o=t.length,a=e-n,s=new Array(o+1);if(s[0]=n,"count"!==r){for(let t=1;t<=o;t++)s[t]=n+a*t/o;return s[o]=e,s}const l=t.reduce((t,n)=>t+Math.max(0,n.count??0),0),u=l>0?$t(i,0,1):1;let c=n;for(let n=0;n<o;n++){c+=a*((1-u)*(l>0?Math.max(0,t[n].count??0)/l:0)+u/o),s[n+1]=c}return s[o]=e,s}function Pt(t,n){const e=t.length-1;if(e<=0)return 0;let r=0,i=e-1;for(;r<i;){const e=r+i+1>>1;t[e]<=n?r=e:i=e-1}return r}function zt(t,{focusPx:n,distortion:e}){const r=t.length-1,i=t[0],o=t[r],a=$t(n,i,o),s=t.map(t=>Ct(t,a,i,o,e));return s[0]=i,s[r]=o,s}function Bt(t,n,e,r={}){const i=n.length;if(!i)return{rows:[],maxCount:0};const o=n[i-1].leafEnd,a=new Int32Array(o);for(let t=0;t<i;t++)for(let e=n[t].leafStart;e<n[t].leafEnd;e++)a[e]=t;const s=new Set,l=t=>t.each?.(n=>n!==t&&s.add(n));for(const t of n)if(t.node?.children?.length&&l(t.node),t.nodes)for(const n of t.nodes)n.each(t=>s.add(t));const u=r.focusSlot,c=[];let f=0;const h=t=>{c.push(t),t.terminal&&t.count>f&&(f=t.count)},d=(t,r)=>{const i=e[t],o=e[r];return{slotStart:t,slotEnd:r,leafStart:n[t].leafStart,leafEnd:n[r-1].leafEnd,focused:null!=u&&u>=t&&u<r,y0:i,y1:o,y:(i+o)/2,thickness:o-i}};return t.each(t=>{if(0===t.depth)return;if(s.has(t))return;if(t.leafStart>=o)return;const e=a[t.leafStart],r=a[t.leafEnd-1]+1;if(!(n[e].leafStart===t.leafStart&&n[r-1].leafEnd===t.leafEnd))return;const i=n[e],l=r-e===1&&i.node===t&&!!t.children?.length,u=l||!t.children?.length;h({node:t,parentNode:t.parent,id:t.id,depth:t.depth,label:t.label,path:t.keyPath,count:t.count,kind:t.data?.header?"header":l?"collapsed":u?"leaf":"branch",terminal:u,elided:l?t.leafEnd-t.leafStart:0,...d(e,r)})}),n.forEach((t,n)=>{if(t.node||!t.nodes)return;const e=t.nodes[0];h({node:null,parentNode:t.parent,nodes:t.nodes,id:`elision:${e.id}+${t.nodes.length}`,depth:e.depth,label:`${t.nodes.length} more`,path:t.parent.keyPath,count:t.count,kind:"elision",terminal:!0,elided:t.leafEnd-t.leafStart,...d(n,n+1)})}),c.sort((t,n)=>t.y0-n.y0||t.depth-n.depth),{rows:c,maxCount:f}}function Rt(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function qt(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function Wt(t){let n,e,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<0?i=n+1:o=n}while(i<o)}return i}return 2!==t.length?(n=Rt,e=(n,e)=>Rt(t(n),e),r=(n,e)=>t(n)-e):(n=t===Rt||t===qt?t:jt,e=t,r=t),{left:i,center:function(t,n,e=0,o=t.length){const a=i(t,n,e,o-1);return a>e&&r(t[a-1],n)>-r(t[a],n)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<=0?i=n+1:o=n}while(i<o)}return i}}}function jt(){return 0}const Ot=Wt(Rt).right;Wt(function(t){return null===t?NaN:+t}).center;const It=Math.sqrt(50),Tt=Math.sqrt(10),Dt=Math.sqrt(2);function Ht(t,n,e){const r=(n-t)/Math.max(0,e),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=It?10:o>=Tt?5:o>=Dt?2:1;let s,l,u;return i<0?(u=Math.pow(10,-i)/a,s=Math.round(t*u),l=Math.round(n*u),s/u<t&&++s,l/u>n&&--l,u=-u):(u=Math.pow(10,i)*a,s=Math.round(t/u),l=Math.round(n/u),s*u<t&&++s,l*u>n&&--l),l<s&&.5<=e&&e<2?Ht(t,n,2*e):[s,l,u]}function Vt(t,n,e){return Ht(t=+t,n=+n,e=+e)[2]}function Ft(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function Ut(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Yt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Xt(){}var Gt=.7,Jt=1/Gt,Kt="\\s*([+-]?\\d+)\\s*",Zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",tn=/^#([0-9a-f]{3,8})$/,nn=new RegExp(`^rgb\\(${Kt},${Kt},${Kt}\\)$`),en=new RegExp(`^rgb\\(${Qt},${Qt},${Qt}\\)$`),rn=new RegExp(`^rgba\\(${Kt},${Kt},${Kt},${Zt}\\)$`),on=new RegExp(`^rgba\\(${Qt},${Qt},${Qt},${Zt}\\)$`),an=new RegExp(`^hsl\\(${Zt},${Qt},${Qt}\\)$`),sn=new RegExp(`^hsla\\(${Zt},${Qt},${Qt},${Zt}\\)$`),ln={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function un(){return this.rgb().formatHex()}function cn(){return this.rgb().formatRgb()}function fn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=tn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?hn(n):3===e?new gn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?dn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?dn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=nn.exec(t))?new gn(n[1],n[2],n[3],1):(n=en.exec(t))?new gn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=rn.exec(t))?dn(n[1],n[2],n[3],n[4]):(n=on.exec(t))?dn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=an.exec(t))?xn(n[1],n[2]/100,n[3]/100,1):(n=sn.exec(t))?xn(n[1],n[2]/100,n[3]/100,n[4]):ln.hasOwnProperty(t)?hn(ln[t]):"transparent"===t?new gn(NaN,NaN,NaN,0):null}function hn(t){return new gn(t>>16&255,t>>8&255,255&t,1)}function dn(t,n,e,r){return r<=0&&(t=n=e=NaN),new gn(t,n,e,r)}function pn(t,n,e,r){return 1===arguments.length?((i=t)instanceof Xt||(i=fn(i)),i?new gn((i=i.rgb()).r,i.g,i.b,i.opacity):new gn):new gn(t,n,e,null==r?1:r);var i}function gn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function yn(){return`#${wn(this.r)}${wn(this.g)}${wn(this.b)}`}function mn(){const t=vn(this.opacity);return`${1===t?"rgb(":"rgba("}${bn(this.r)}, ${bn(this.g)}, ${bn(this.b)}${1===t?")":`, ${t})`}`}function vn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function bn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function wn(t){return((t=bn(t))<16?"0":"")+t.toString(16)}function xn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new _n(t,n,e,r)}function kn(t){if(t instanceof _n)return new _n(t.h,t.s,t.l,t.opacity);if(t instanceof Xt||(t=fn(t)),!t)return new _n;if(t instanceof _n)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new _n(a,s,l,t.opacity)}function _n(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Mn(t){return(t=(t||0)%360)<0?t+360:t}function Sn(t){return Math.max(0,Math.min(1,t||0))}function An(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Ut(Xt,fn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:un,formatHex:un,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return kn(this).formatHsl()},formatRgb:cn,toString:cn}),Ut(gn,pn,Yt(Xt,{brighter(t){return t=null==t?Jt:Math.pow(Jt,t),new gn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Gt:Math.pow(Gt,t),new gn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new gn(bn(this.r),bn(this.g),bn(this.b),vn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:yn,formatHex:yn,formatHex8:function(){return`#${wn(this.r)}${wn(this.g)}${wn(this.b)}${wn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:mn,toString:mn})),Ut(_n,function(t,n,e,r){return 1===arguments.length?kn(t):new _n(t,n,e,null==r?1:r)},Yt(Xt,{brighter(t){return t=null==t?Jt:Math.pow(Jt,t),new _n(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Gt:Math.pow(Gt,t),new _n(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new gn(An(t>=240?t-240:t+120,i,r),An(t,i,r),An(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new _n(Mn(this.h),Sn(this.s),Sn(this.l),vn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=vn(this.opacity);return`${1===t?"hsl(":"hsla("}${Mn(this.h)}, ${100*Sn(this.s)}%, ${100*Sn(this.l)}%${1===t?")":`, ${t})`}`}}));var Nn=t=>()=>t;function En(t){return 1===(t=+t)?Cn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Nn(isNaN(n)?e:n)}}function Cn(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):Nn(isNaN(t)?n:t)}var $n=function t(n){var e=En(n);function r(t,n){var r=e((t=pn(t)).r,(n=pn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Cn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Ln(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function Pn(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=On(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function zn(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Bn(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function Rn(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=On(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var qn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wn=new RegExp(qn.source,"g");function jn(t,n){var e,r,i,o=qn.lastIndex=Wn.lastIndex=0,a=-1,s=[],l=[];for(t+="",n+="";(e=qn.exec(t))&&(r=Wn.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(e=e[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:Bn(e,r)})),o=Wn.lastIndex;return o<n.length&&(i=n.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(n){return t(n)+""}}(l[0].x):function(t){return function(){return t}}(n):(n=l.length,function(t){for(var e,r=0;r<n;++r)s[(e=l[r]).i]=e.x(t);return s.join("")})}function On(t,n){var e,r,i=typeof n;return null==n||"boolean"===i?Nn(n):("number"===i?Bn:"string"===i?(e=fn(n))?(n=e,$n):jn:n instanceof fn?$n:n instanceof Date?zn:(r=n,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(n)?Pn:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Rn:Bn:Ln))(t,n)}function In(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}function Tn(t){return+t}var Dn=[0,1];function Hn(t){return t}function Vn(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:(e=isNaN(n)?NaN:.5,function(){return e});var e}function Fn(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i<r?(r=Vn(i,r),o=e(a,o)):(r=Vn(r,i),o=e(o,a)),function(t){return o(r(t))}}function Un(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<r;)i[a]=Vn(t[a],t[a+1]),o[a]=e(n[a],n[a+1]);return function(n){var e=Ot(t,n,1,r)-1;return o[e](i[e](n))}}function Yn(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Xn(){var t,n,e,r,i,o,a=Dn,s=Dn,l=On,u=Hn;function c(){var t,n,e,l=Math.min(a.length,s.length);return u!==Hn&&(t=a[0],n=a[l-1],t>n&&(e=t,t=n,n=e),u=function(e){return Math.max(t,Math.min(n,e))}),r=l>2?Un:Fn,i=o=null,f}function f(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),s,l)))(t(u(n)))}return f.invert=function(e){return u(n((o||(o=r(s,a.map(t),Bn)))(e)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Tn),c()):a.slice()},f.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},f.rangeRound=function(t){return s=Array.from(t),l=In,c()},f.clamp=function(t){return arguments.length?(u=!!t||Hn,c()):u!==Hn},f.interpolate=function(t){return arguments.length?(l=t,c()):l},f.unknown=function(t){return arguments.length?(e=t,f):e},function(e,r){return t=e,n=r,c()}}function Gn(t,n){if(!isFinite(t)||0===t)return null;var e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"),r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Jn(t){return(t=Gn(Math.abs(t)))?t[1]:NaN}var Kn,Zn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Qn(t){if(!(n=Zn.exec(t)))throw new Error("invalid format: "+t);var n;return new te({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function te(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ne(t,n){var e=Gn(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Qn.prototype=te.prototype,te.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var ee={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>ne(100*t,n),r:ne,s:function(t,n){var e=Gn(t,n);if(!e)return Kn=void 0,t.toPrecision(n);var r=e[0],i=e[1],o=i-(Kn=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Gn(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function re(t){return t}var ie,oe,ae,se=Array.prototype.map,le=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ue(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?re:(n=se.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?re:function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(se.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",u=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t,n){var e=(t=Qn(t)).fill,f=t.align,h=t.sign,d=t.symbol,p=t.zero,g=t.width,y=t.comma,m=t.precision,v=t.trim,b=t.type;"n"===b?(y=!0,b="g"):ee[b]||(void 0===m&&(m=12),v=!0,b="g"),(p||"0"===e&&"="===f)&&(p=!0,e="0",f="=");var w=(n&&void 0!==n.prefix?n.prefix:"")+("$"===d?i:"#"===d&&/[boxX]/.test(b)?"0"+b.toLowerCase():""),x=("$"===d?o:/[%p]/.test(b)?l:"")+(n&&void 0!==n.suffix?n.suffix:""),k=ee[b],_=/[defgprs%]/.test(b);function M(t){var n,i,o,l=w,d=x;if("c"===b)d=k(t)+d,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:k(Math.abs(t),m),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0===+t&&"+"!==h&&(M=!1),l=(M?"("===h?h:u:"-"===h||"("===h?"":h)+l,d=("s"!==b||isNaN(t)||void 0===Kn?"":le[8+Kn/3])+d+(M&&"("===h?")":""),_)for(n=-1,i=t.length;++n<i;)if(48>(o=t.charCodeAt(n))||o>57){d=(46===o?a+t.slice(n+1):t.slice(n))+d,t=t.slice(0,n);break}}y&&!p&&(t=r(t,1/0));var S=l.length+t.length+d.length,A=S<g?new Array(g-S+1).join(e):"";switch(y&&p&&(t=r(A+t,A.length?g-d.length:1/0),A=""),f){case"<":t=l+t+d+A;break;case"=":t=l+A+t+d;break;case"^":t=A.slice(0,S=A.length>>1)+l+t+d+A.slice(S);break;default:t=A+l+t+d}return s(t)}return m=void 0===m?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:f,formatPrefix:function(t,n){var e=3*Math.max(-8,Math.min(8,Math.floor(Jn(n)/3))),r=Math.pow(10,-e),i=f(((t=Qn(t)).type="f",t),{suffix:le[8+e/3]});return function(t){return i(r*t)}}}}function ce(t,n,e,r){var i,o=function(t,n,e){e=+e;const r=(n=+n)<(t=+t),i=r?Vt(n,t,e):Vt(t,n,e);return(r?-1:1)*(i<0?1/-i:i)}(t,n,e);switch((r=Qn(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Jn(n)/3)))-Jn(Math.abs(t)))}(o,a))||(r.precision=i),ae(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Jn(n)-Jn(t))+1}(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Jn(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return oe(r)}function fe(t){var n=t.domain;return t.ticks=function(t){var e=n();return function(t,n,e){if(!((e=+e)>0))return[];if((t=+t)===(n=+n))return[t];const r=n<t,[i,o,a]=r?Ht(n,t,e):Ht(t,n,e);if(!(o>=i))return[];const s=o-i+1,l=new Array(s);if(r)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(i+t)/-a;else for(let t=0;t<s;++t)l[t]=(i+t)*a;return l}(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return ce(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,s=o.length-1,l=o[a],u=o[s],c=10;for(u<l&&(i=l,l=u,u=i,i=a,a=s,s=i);c-- >0;){if((i=Vt(l,u,e))===r)return o[a]=l,o[s]=u,n(o);if(i>0)l=Math.floor(l/i)*i,u=Math.ceil(u/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,u=Math.floor(u*i)/i}r=i}return t},t}function he(){var t=Xn()(Hn,Hn);return t.copy=function(){return Yn(t,he())},Ft.apply(t,arguments),fe(t)}function de(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function pe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function ge(t){return t<0?-t*t:t*t}function ye(t){var n=t(Hn,Hn),e=1;return n.exponent=function(n){return arguments.length?1===(e=+n)?t(Hn,Hn):.5===e?t(pe,ge):t(de(e),de(1/e)):e},fe(n)}function me(){var t=ye(Xn());return t.copy=function(){return Yn(t,me()).exponent(t.exponent())},Ft.apply(t,arguments),t}function ve(){return me.apply(null,arguments).exponent(.5)}ie=ue({thousands:",",grouping:[3],currency:["$",""]}),oe=ie.format,ae=ie.formatPrefix;const be=["log","sqrt","linear"];function we(t,n,e={}){const{minLenPx:r=4,type:i="log"}=e,o=Math.max(1,t);if("log"===i){const t=Math.log1p(o);return e=>{const i=Math.max(0,Math.min(e,o)),a=t>0?Math.log1p(i)/t:0;return r+(n-r)*a}}return("linear"===i?he():ve()).domain([0,o]).range([r,n]).clamp(!0)}const xe=["fisheye","doi","hybrid","uniform"],ke={distortion:4,pad:6,minRowPx:16,sizeBy:"slots",sizeFloor:.25,apiWeight:.5,distanceWeight:1,treeWeight:.6,countWeight:.25};function _e(t,n={}){const e={...ke,...n},r=e.height??0,i=kt(t),o=i.length,a=e.pad,s=r-e.pad;if(!o||s<=a)return{rows:[],maxCount:0,focusLeaf:0,focusPx:a,slots:0,leaves:o};const l=xe.includes(e.layout)?e.layout:"fisheye",u="doi"===l||"hybrid"===l,c="fisheye"===l||"hybrid"===l,f={min:a,max:s,sizeBy:Et.includes(e.sizeBy)?e.sizeBy:"slots",sizeFloor:e.sizeFloor},h=Math.max(4,Math.floor((s-a)/e.minRowPx)),d=null!=e.focus?.px?$t(e.focus.px,a,s):null,p=null!=e.focus?.leaf?$t(e.focus.leaf,0,o-1):null!=d?function(t,n){const e=n.length-1,r=n[0],i=n[e];if(e<=0)return{px:r,slot:0};if(null!=t?.px){const e=$t(t.px,r,i);return{px:e,slot:Pt(n,e)}}const o=$t(t?.slot??0,0,e-1);return{px:(n[o]+n[o+1])/2,slot:o}}({px:d},Lt(i,f)).slot:0,g=u?At(t,{...e,budget:h,focusLeaf:p}):_t(t),y=g.length,m=Lt(g,f),v=null!=d?Pt(m,d):function(t,n){let e=0,r=t.length-1;for(;e<r;){const i=e+r>>1;t[i].leafEnd<=n?e=i+1:r=i}return e}(g,p),b=null!=d?g[v].leafStart:p,w={px:d??(m[v]+m[v+1])/2,slot:v},x=c?zt(m,{focusPx:w.px,distortion:e.distortion}):m,{rows:k,maxCount:_}=Bt(t,g,x,{focusSlot:w.slot});return{rows:k,maxCount:_,focusLeaf:b,focusPx:w.px,focusSlot:w.slot,slots:y,leaves:o}}let Me=!1;function Se(t=globalThis.document){if(Me||!t?.head)return;const n=t.createElement("style");n.setAttribute("data-fisheye-nav",""),n.textContent='\n.fisheye-nav {\n --fn-accent: #3b82f6;\n --fn-fg: currentColor;\n --fn-muted: color-mix(in oklab, currentColor 55%, transparent);\n --fn-band: color-mix(in oklab, currentColor 8%, transparent);\n --fn-band-hover: color-mix(in oklab, currentColor 16%, transparent);\n --fn-rule: color-mix(in oklab, currentColor 18%, transparent);\n --fn-bar: color-mix(in oklab, var(--fn-accent) 45%, transparent);\n --fn-font: system-ui, -apple-system, "Segoe UI", sans-serif;\n --fn-size: 11px;\n\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n font-family: var(--fn-font);\n font-size: var(--fn-size);\n color: var(--fn-fg);\n user-select: none;\n}\n.fisheye-nav svg { display: block; width: 100%; height: 100%; overflow: hidden; }\n.fisheye-nav .fn-row { cursor: pointer; }\n.fisheye-nav .fn-band {\n fill: var(--fn-band);\n stroke: var(--fn-rule);\n stroke-width: 0.5;\n shape-rendering: crispEdges;\n}\n.fisheye-nav .fn-row:hover .fn-band { fill: var(--fn-band-hover); }\n.fisheye-nav .fn-row[data-kind="branch"] .fn-band { fill: color-mix(in oklab, currentColor 4%, transparent); }\n.fisheye-nav .fn-row[data-kind="elision"] .fn-band { fill: none; stroke-dasharray: 2 2; }\n.fisheye-nav .fn-row[data-focused="true"] .fn-band {\n fill: color-mix(in oklab, var(--fn-accent) 22%, transparent);\n stroke: var(--fn-accent);\n stroke-width: 1;\n}\n.fisheye-nav .fn-selected .fn-band {\n stroke: var(--fn-accent);\n stroke-width: 1.5;\n}\n.fisheye-nav .fn-bar { fill: var(--fn-bar); }\n.fisheye-nav .fn-label {\n fill: var(--fn-fg);\n dominant-baseline: middle;\n pointer-events: none;\n white-space: pre;\n}\n.fisheye-nav .fn-row[data-kind="branch"] .fn-label,\n.fisheye-nav .fn-row[data-kind="elision"] .fn-label { fill: var(--fn-muted); }\n.fisheye-nav .fn-count { fill: var(--fn-muted); text-anchor: end; dominant-baseline: middle; pointer-events: none; }\n.fisheye-nav .fn-spine { fill: var(--fn-rule); }\n.fisheye-nav .fn-empty { fill: var(--fn-muted); text-anchor: middle; }\n\n/* ── Settings gear + popover (opt out with controls: false) ──────────────────\n Neutral defaults driven by the same --fn-* variables as the chart, so a host\n restyles the panel without patching the library. */\n.fisheye-nav .fn-gear {\n position: absolute; top: 2px; right: 4px; z-index: 6;\n width: 18px; height: 18px; padding: 0; border: none; border-radius: 4px;\n background: transparent; color: var(--fn-muted);\n font-size: 12px; line-height: 18px; cursor: pointer;\n}\n.fisheye-nav .fn-gear:hover,\n.fisheye-nav .fn-gear.on { color: var(--fn-fg); background: var(--fn-band-hover); }\n/* Visibility is driven by the .fn-open CLASS, not by the hidden attribute: the\n UA\'s "[hidden] { display: none }" is a single-attribute selector, so any rule\n here that sets display outranks it and setting .hidden silently does nothing.\n (It did exactly that — every popover in the demo rendered open.) The hidden\n attribute is still kept in sync, for assistive tech.\n NB: no backticks in this comment — the whole stylesheet is a JS template\n literal, and a backtick here would terminate it. */\n/* The popover is the ONE place the widget paints its own background, so it is\n the one place "inherit the host\'s color" stops working: an inherited\n foreground over a system background is a coin toss (a dark app\'s near-white\n text landed on Canvas-white and vanished). Background and foreground must\n come from the same place — so they are a system PAIR by default, and a host\n overriding one is expected to override the other. color-scheme makes the\n pair, and the native selects and sliders inside, follow the host\'s theme. */\n.fisheye-nav .fn-panel {\n position: absolute; top: 22px; right: 4px; z-index: 7;\n width: 220px; padding: 8px; display: none; flex-direction: column; gap: 6px;\n color-scheme: var(--fn-scheme, light dark);\n background: var(--fn-panel, Canvas);\n color: var(--fn-panel-fg, CanvasText);\n border: 1px solid var(--fn-rule); border-radius: 6px;\n box-shadow: 0 6px 20px rgb(0 0 0 / 0.28);\n}\n.fisheye-nav .fn-panel.fn-open { display: flex; }\n.fisheye-nav .fn-row-ctl { display: flex; align-items: center; gap: 6px; }\n.fisheye-nav .fn-ctl-label { flex: 0 0 76px; opacity: 0.75; }\n.fisheye-nav .fn-ctl-select {\n flex: 1; min-width: 0; font: inherit; padding: 2px 4px;\n color: inherit; background: transparent;\n border: 1px solid var(--fn-rule); border-radius: 4px;\n}\n.fisheye-nav .fn-ctl-slider { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }\n.fisheye-nav .fn-ctl-slider input { flex: 1; min-width: 0; accent-color: var(--fn-accent); }\n.fisheye-nav .fn-ctl-val {\n flex: 0 0 30px; text-align: right; opacity: 0.6;\n font-variant-numeric: tabular-nums;\n}\n.fisheye-nav .fn-ctl-more summary { cursor: pointer; opacity: 0.75; margin-bottom: 4px; }\n.fisheye-nav .fn-ctl-more[open] { border-top: 1px solid var(--fn-rule); padding-top: 6px; }\n.fisheye-nav .fn-ctl-reset {\n align-self: flex-start; font: inherit; padding: 2px 8px; cursor: pointer;\n color: inherit; background: transparent;\n border: 1px solid var(--fn-rule); border-radius: 4px;\n}\n/* A control that cannot affect the current lens says so, rather than silently\n doing nothing when dragged. */\n.fisheye-nav .fn-disabled { opacity: 0.4; }\n',t.head.appendChild(n),Me=!0}const Ae=["flat","icicle"],Ne={indent:11,bars:!0,gutter:6,minLabelPx:9,barScale:"log",format:t=>t.toLocaleString()};function Ee(t,n,e){const r={...Ne,...e};Se(t.ownerDocument);const i=ut(t),{rows:o,maxCount:a}=n,{width:s,height:l,style:u}=r;if(i.attr("viewBox",`0 0 ${s} ${l}`),!o.length)return i.selectAll(".fn-row").remove(),void i.selectAll(".fn-empty").data([0]).join("text").attr("class","fn-empty").attr("x",s/2).attr("y",l/2).text(r.emptyLabel??"Nothing to show");i.selectAll(".fn-empty").remove();const c=s-r.gutter,f=o.reduce((t,n)=>Math.max(t,n.depth),1),h="icicle"===u?$e(f,c):Ce(r.indent,c),d=t=>r.bars&&t.count>0&&(t.terminal||"icicle"===u&&"branch"===t.kind),p=we(a,Math.max(1,c),{type:r.barScale}),g=new Map;if("icicle"===u){const t=new Map;for(const n of o)d(n)&&t.set(n.depth,Math.max(t.get(n.depth)??0,n.count));for(const[n,e]of t)g.set(n,we(e,1,{type:r.barScale,minLenPx:.05}))}const y=i.selectAll("g.fn-row").data(o,t=>t.id).join(t=>{const n=t.append("g").attr("class","fn-row");return n.append("rect").attr("class","fn-band"),n.append("rect").attr("class","fn-bar"),n.append("text").attr("class","fn-label"),n.append("title"),n});y.attr("data-kind",t=>t.kind).attr("data-depth",t=>t.depth).attr("data-id",t=>t.id).attr("data-focused",t=>t.focused?"true":null).classed("fn-selected",t=>t.id===r.selectedId),y.select("title").text(t=>`${t.label}\n${r.format(t.count)}`+(t.elided?` · ${t.elided} groups collapsed`:"")),y.select("rect.fn-band").attr("x",t=>h.x(t)).attr("y",t=>t.y0).attr("width",t=>Math.max(0,h.w(t))).attr("height",t=>Math.max(1,t.thickness)).style("stroke-width",t=>t.thickness>=2?.5:0),y.select("rect.fn-bar").attr("x",t=>h.x(t)).attr("y",t=>t.y0).attr("width",t=>{if(!d(t))return 0;const n=Math.max(0,h.w(t));return"icicle"===u?(g.get(t.depth)?.(t.count)??0)*n:Math.min(p(t.count),n)}).attr("height",t=>Math.max(1,t.thickness)),y.select("text.fn-label").attr("x",t=>h.x(t)+4).attr("y",t=>t.y).attr("font-weight",t=>"header"===t.kind||"branch"===t.kind?600:400).attr("opacity",t=>Le(t,u,r)?1:0).text(t=>Le(t,u,r)?function(t,n){const e="elision"===t.kind?`⋯ ${t.label}`:t.label??"",r=Math.max(0,Math.floor((n-8)/6));return e.length>r?e.slice(0,Math.max(1,r-1))+"…":e}(t,h.w(t)):"")}const Ce=(t,n)=>({x:n=>(n.depth-1)*t,w:e=>n-(e.depth-1)*t}),$e=(t,n)=>{const e=n/t;return{x:t=>(t.depth-1)*e,w:t=>t.terminal?n-(t.depth-1)*e:e}};function Le(t,n,e){return("icicle"===n||"branch"!==t.kind)&&(!(!t.focused&&t.id!==e.selectedId)||t.thickness>=e.minLabelPx)}const Pe=["style","layout","sizeBy","distortion","minRowPx","barScale","apiWeight","distanceWeight","treeWeight","countWeight"];function ze(t,n){const e={};if(!t)return e;const r=(t,n,e)=>{const r=Number(t);return Number.isFinite(r)?Math.min(e,Math.max(n,r)):void 0},i=(t,n)=>n.includes(t)?t:void 0,o=(t,n)=>{void 0!==n&&(e[t]=n)};return o("style",i(t.style,Ae)),o("layout",i(t.layout,xe)),o("sizeBy",i(t.sizeBy,Et)),o("barScale",i(t.barScale,be)),o("distortion",r(t.distortion,1,12)),o("minRowPx",r(t.minRowPx,8,48)),o("apiWeight",r(t.apiWeight,0,3)),o("distanceWeight",r(t.distanceWeight,0,3)),o("treeWeight",r(t.treeWeight,0,1)),o("countWeight",r(t.countWeight,0,2)),{...n,...e}}const Be=[{key:"style",label:"View",options:[["flat","List (indented)"],["icicle","Icicle (columns)"]]},{key:"layout",label:"Lens",options:[["hybrid","Hybrid — magnify + fold"],["fisheye","Fisheye — every group"],["doi","Interest — full rows"],["uniform","Uniform — no lens"]]},{key:"sizeBy",label:"Band size",options:[["slots","Interest (equal)"],["count","Photos (mass)"]]},{key:"barScale",label:"Bars",options:[["log","Log"],["sqrt","Square root"],["linear","Linear"]]}],Re=[{key:"distortion",label:"Distortion",min:1,max:12,step:.5},{key:"minRowPx",label:"Row size",min:8,max:48,step:1,unit:"px"}],qe=[{key:"distanceWeight",label:"Focus falloff",min:0,max:3,step:.1},{key:"treeWeight",label:"Structure vs. list",min:0,max:1,step:.05},{key:"countWeight",label:"Busy groups",min:0,max:2,step:.05},{key:"apiWeight",label:"Same-level bias",min:0,max:3,step:.1}];const We={...ke,...Ne,style:"flat",controls:!0,persistKey:null,layout:"hybrid",width:null,height:null};function je(t={}){const n=t.document??globalThis.document,e=n.createElement("div");e.className="fisheye-nav",Se(n);const r=n.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("preserveAspectRatio","none"),r.setAttribute("role","listbox"),e.appendChild(r);const i=ze(function(t){if(!t||"undefined"==typeof localStorage)return null;try{const n=JSON.parse(localStorage.getItem(t)??"null");return n&&"object"==typeof n?n:null}catch{return null}}(t.persistKey),{});let o={...We,...i,...t},a=null,s=null,l=null,u=null,c={width:0,height:0},f=null;const h=()=>{a=xt({data:o.data,keys:o.keys,root:o.root,children:o.children,value:o.value,count:o.count,label:o.label,headers:"flat"===o.style})},d=()=>{const t=e.value;if(!t?.length||!a)return 0;let n=a;for(const e of t){const t=(n.children??[]).find(t=>!t.data.header&&t.data.key===e.key&&t.data.value===e.value);if(!t)break;n=t}return n.leafStart??0},p=()=>{const t=e.value;return t?.length?mt(t):null},g=()=>{a||h(),(()=>{const t=o.width??e.clientWidth,n=o.height??e.clientHeight;c={width:Math.max(0,t),height:Math.max(0,n)}})(),c.width&&c.height&&(s=_e(a,{...o,height:c.height,focus:{px:l??void 0,leaf:u??d()}}),Ee(r,s,{...o,...c,selectedId:p()}))};r.addEventListener("pointermove",t=>{l=function(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}(t,r)[1],g()}),r.addEventListener("pointerleave",()=>{l=null,g()}),r.addEventListener("click",t=>{const n=t.target.closest?.("g.fn-row");if(!n)return;const r=s?.rows.find(t=>t.id===n.getAttribute("data-id"));if(!r)return;u=r.leafStart;const i=r.path;i?.length?e.setValue(i.map(t=>({...t}))):g()});const y=function(t,{showValue:n=()=>{},value:e}={}){let r=e;return Object.defineProperty(t,"value",{get:()=>r,set(t){r=t,n()}}),t.addEventListener("input",t=>{t.preventDefault(),t.stopPropagation(),n(t)}),t.setValue=function(n){r=n,t.dispatchEvent(new CustomEvent("input",{bubbles:!0}))},t}(e,{value:t.selected??null,showValue:()=>g()});e.update=(t={})=>{const n="data"in t&&t.data!==o.data||"root"in t&&t.root!==o.root||"keys"in t&&String(t.keys)!==String(o.keys)||"style"in t&&t.style!==o.style;o={...o,...t},Ae.includes(o.style)||(o.style="flat"),n&&h(),f?.sync(),g()};const m=t=>{e.update(t),function(t,n){if(t&&"undefined"!=typeof localStorage)try{const e={};for(const t of Pe)t in n&&(e[t]=n[t]);localStorage.setItem(t,JSON.stringify(e))}catch{}}(o.persistKey,o),e.dispatchEvent(new CustomEvent("settings",{detail:e.getSettings(),bubbles:!0}))};if(e.getSettings=()=>{const t={};for(const n of Pe)t[n]=o[n];return t},e.setSettings=t=>m(ze({...e.getSettings(),...t},{})),e.resetSettings=()=>{const t={};for(const n of Pe)t[n]=We[n];m(t)},!1!==o.controls&&(f=function(t,n){const e=t.ownerDocument,r=(t,n,r)=>Object.assign(e.createElement(t),{className:n,...r}),i=r("button","fn-gear",{type:"button",innerHTML:"&#9881;",title:"Lens settings"});i.setAttribute("aria-label","Lens settings"),i.setAttribute("aria-expanded","false");const o=r("div","fn-panel");o.hidden=!0,o.setAttribute("role","group"),o.setAttribute("aria-label","Lens settings");const a=new Map,s=(t,n)=>{const e=r("label","fn-row-ctl");return e.appendChild(r("span","fn-ctl-label",{textContent:t})),e.appendChild(n),e};for(const t of Be){const e=r("select","fn-ctl-select");for(const[n,i]of t.options)e.appendChild(r("option","",{value:n,textContent:i}));e.addEventListener("change",()=>n.set({[t.key]:e.value})),a.set(t.key,e),o.appendChild(s(t.label,e))}const l=t=>{const e=r("span","fn-ctl-slider"),i=r("input","",{type:"range",min:String(t.min),max:String(t.max),step:String(t.step)}),o=r("span","fn-ctl-val");return i.addEventListener("input",()=>{o.textContent=i.value+(t.unit??""),n.set({[t.key]:Number(i.value)})}),e.append(i,o),a.set(t.key,i),{wrap:e,input:i,out:o,spec:t}},u=[];for(const t of Re){const n=l(t);u.push(n),o.appendChild(s(t.label,n.wrap))}const c=r("details","fn-ctl-more");c.appendChild(r("summary","",{textContent:"Interest weights"}));for(const t of qe){const n=l(t);u.push(n),c.appendChild(s(t.label,n.wrap))}o.appendChild(c);const f=r("button","fn-ctl-reset",{type:"button",textContent:"Reset"});f.addEventListener("click",()=>n.reset()),o.appendChild(f);const h=(t=o.hidden)=>{o.hidden=!t,o.classList.toggle("fn-open",t),i.classList.toggle("on",t),i.setAttribute("aria-expanded",String(t))};i.addEventListener("click",()=>h());const d=t=>{"Escape"!==t.key||o.hidden||h(!1)},p=t=>{o.hidden||o.contains(t.target)||t.target===i||h(!1)};t.addEventListener("keydown",d),e.addEventListener("click",p,!0),t.append(i,o);const g=()=>{const t=n.get();for(const[n,e]of a){const r=t[n];e.tagName,e.value=String(r)}for(const n of u)n.out.textContent=String(t[n.spec.key])+(n.spec.unit??"");const e="fisheye"===t.layout||"hybrid"===t.layout,r=a.get("distortion");r.disabled=!e,r.closest(".fn-row-ctl").classList.toggle("fn-disabled",!e);const i="doi"===t.layout||"hybrid"===t.layout;c.classList.toggle("fn-disabled",!i);for(const t of qe)a.get(t.key).disabled=!i};return g(),{sync:g,destroy(){t.removeEventListener("keydown",d),e.removeEventListener("click",p,!0),i.remove(),o.remove()}}}(e,{get:()=>o,set:m,reset:()=>e.resetSettings()})),e.getRows=()=>s?.rows??[],e.getRoot=()=>a,e.getLeafCount=()=>a?kt(a).filter(t=>!t.data.header).length:0,"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>g());t.observe(e),e.destroy=()=>{t.disconnect(),f?.destroy()}}else e.destroy=()=>f?.destroy();return h(),g(),y}t.LAYOUTS=xe,t.LAYOUT_DEFAULTS=ke,t.STYLES=Ae,t.basePositions=Lt,t.buildRows=Bt,t.default=je,t.distort=zt,t.doiScore=St,t.fisheyeNav=je,t.fisheyePosition=Ct,t.layout=_e,t.leafDistance=Mt,t.leavesOf=kt,t.makeBarScale=we,t.nodesOf=function(t){const n=[];return bt(t,t=>{t.depth>0&&n.push(t)}),n},t.normalize=xt,t.selectAll=_t,t.selectDOI=At,t.slotAtPixel=Pt,Object.defineProperty(t,"__esModule",{value:!0})});