@gram-ai/elements 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/elements.cjs CHANGED
@@ -10,10 +10,8 @@ ${U2.map(e=>`- ${e}`).join(`
10
10
  `)}
11
11
  `;function z2(e){return e?`
12
12
  ${Wd}
13
-
14
-
15
13
 
16
- User System Prompt:
14
+ User-provided System Prompt:
17
15
  ${e}`:Wd}const L2=({children:e,config:t})=>{const[r,i]=Q.useState(t.model?.defaultModel??m.MODELS[0]),[n,o]=Q.useState(!1),[a,s]=Q.useState(t.modal?.defaultOpen),c=O2({transport:new Mc({api:t.chatEndpoint??R2,prepareSendMessagesRequest:({id:l,messages:u})=>({body:{messages:u,system:z2(t.systemPrompt),id:l,config:{mcp:t.mcp,environment:t.environment,projectSlug:t.projectSlug,model:r}}})})});return $.jsx(V.AssistantRuntimeProvider,{runtime:c,children:$.jsx(op.Provider,{value:{config:t,setModel:i,model:r,isExpanded:n,setIsExpanded:o,isOpen:a??!1,setIsOpen:s},children:e})})},wt=()=>{const e=Q.useContext(op);if(!e)throw new Error("useElements must be used within a ElementsProvider");return e};const F2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Z2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,i)=>i?i.toUpperCase():r.toLowerCase()),qd=e=>{const t=Z2(e);return t.charAt(0).toUpperCase()+t.slice(1)},ap=(...e)=>e.filter((t,r,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===r).join(" ").trim(),B2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var V2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const W2=Q.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:n="",children:o,iconNode:a,...s},c)=>Q.createElement("svg",{ref:c,...V2,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:ap("lucide",n),...!o&&!B2(s)&&{"aria-hidden":"true"},...s},[...a.map(([l,u])=>Q.createElement(l,u)),...Array.isArray(o)?o:[o]]));const Ue=(e,t)=>{const r=Q.forwardRef(({className:i,...n},o)=>Q.createElement(W2,{ref:o,iconNode:t,className:ap(`lucide-${F2(qd(e))}`,`lucide-${e}`,i),...n}));return r.displayName=qd(e),r};const q2=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],G2=Ue("arrow-down",q2);const Y2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],H2=Ue("arrow-up",Y2);const X2=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],J2=Ue("bot",X2);const K2=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Q2=Ue("brain",K2);const e$=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],$s=Ue("check",e$);const t$=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sp=Ue("chevron-down",t$);const n$=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],r$=Ue("chevron-left",n$);const i$=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],o$=Ue("chevron-right",i$);const a$=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],lp=Ue("copy",a$);const s$=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],l$=Ue("file-text",s$);const c$=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],u$=Ue("maximize-2",c$);const f$=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],d$=Ue("pencil",f$);const h$=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],m$=Ue("plus",h$);const g$=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],p$=Ue("refresh-cw",g$);const v$=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],b$=Ue("settings-2",v$);const y$=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],_$=Ue("square",y$);const x$=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ru=Ue("x",x$);function Gd(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Du(...e){return t=>{let r=!1;const i=e.map(n=>{const o=Gd(n,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let n=0;n<i.length;n++){const o=i[n];typeof o=="function"?o():Gd(e[n],null)}}}}function st(...e){return E.useCallback(Du(...e),e)}var w$=Symbol.for("react.lazy"),Na=E[" use ".trim().toString()];function $$(e){return typeof e=="object"&&e!==null&&"then"in e}function cp(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===w$&&"_payload"in e&&$$(e._payload)}function up(e){const t=k$(e),r=E.forwardRef((i,n)=>{let{children:o,...a}=i;cp(o)&&typeof Na=="function"&&(o=Na(o._payload));const s=E.Children.toArray(o),c=s.find(E$);if(c){const l=c.props.children,u=s.map(f=>f===c?E.Children.count(l)>1?E.Children.only(null):E.isValidElement(l)?l.props.children:null:f);return $.jsx(t,{...a,ref:n,children:E.isValidElement(l)?E.cloneElement(l,void 0,u):null})}return $.jsx(t,{...a,ref:n,children:o})});return r.displayName=`${e}.Slot`,r}var S$=up("Slot");function k$(e){const t=E.forwardRef((r,i)=>{let{children:n,...o}=r;if(cp(n)&&typeof Na=="function"&&(n=Na(n._payload)),E.isValidElement(n)){const a=T$(n),s=M$(o,n.props);return n.type!==E.Fragment&&(s.ref=i?Du(i,a):a),E.cloneElement(n,s)}return E.Children.count(n)>1?E.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fp=Symbol("radix.slottable");function I$(e){const t=({children:r})=>$.jsx($.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=fp,t}var N$=I$("Slottable");function E$(e){return E.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fp}function M$(e,t){const r={...t};for(const i in t){const n=e[i],o=t[i];/^on[A-Z]/.test(i)?n&&o?r[i]=(...s)=>{const c=o(...s);return n(...s),c}:n&&(r[i]=n):i==="style"?r[i]={...n,...o}:i==="className"&&(r[i]=[n,o].filter(Boolean).join(" "))}return{...e,...r}}function T$(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function dp(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=dp(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function hp(){for(var e,t,r=0,i="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=dp(e))&&(i&&(i+=" "),i+=t);return i}const Yd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Hd=hp,C$=(e,t)=>r=>{var i;if(t?.variants==null)return Hd(e,r?.class,r?.className);const{variants:n,defaultVariants:o}=t,a=Object.keys(n).map(l=>{const u=r?.[l],f=o?.[l];if(u===null)return null;const d=Yd(u)||Yd(f);return n[l][d]}),s=r&&Object.entries(r).reduce((l,u)=>{let[f,d]=u;return d===void 0||(l[f]=d),l},{}),c=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((l,u)=>{let{class:f,className:d,...h}=u;return Object.entries(h).every(p=>{let[g,v]=p;return Array.isArray(v)?v.includes({...o,...s}[g]):{...o,...s}[g]===v})?[...l,f,d]:l},[]);return Hd(e,a,c,r?.class,r?.className)},A$=(e,t)=>{const r=new Array(e.length+t.length);for(let i=0;i<e.length;i++)r[i]=e[i];for(let i=0;i<t.length;i++)r[e.length+i]=t[i];return r},j$=(e,t)=>({classGroupId:e,validator:t}),mp=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Ea="-",Xd=[],P$="arbitrary..",O$=e=>{const t=D$(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return R$(a);const s=a.split(Ea),c=s[0]===""&&s.length>1?1:0;return gp(s,c,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const c=i[a],l=r[a];return c?l?A$(l,c):c:l||Xd}return r[a]||Xd}}},gp=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],o=r.nextPart.get(n);if(o){const l=gp(e,t+1,o);if(l)return l}const a=r.validators;if(a===null)return;const s=t===0?e.join(Ea):e.slice(t).join(Ea),c=a.length;for(let l=0;l<c;l++){const u=a[l];if(u.validator(s))return u.classGroupId}},R$=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),i=t.slice(0,r);return i?P$+i:void 0})(),D$=e=>{const{theme:t,classGroups:r}=e;return U$(r,t)},U$=(e,t)=>{const r=mp();for(const i in e){const n=e[i];Uu(n,r,i,t)}return r},Uu=(e,t,r,i)=>{const n=e.length;for(let o=0;o<n;o++){const a=e[o];z$(a,t,r,i)}},z$=(e,t,r,i)=>{if(typeof e=="string"){L$(e,t,r);return}if(typeof e=="function"){F$(e,t,r,i);return}Z$(e,t,r,i)},L$=(e,t,r)=>{const i=e===""?t:pp(t,e);i.classGroupId=r},F$=(e,t,r,i)=>{if(B$(e)){Uu(e(i),t,r,i);return}t.validators===null&&(t.validators=[]),t.validators.push(j$(r,e))},Z$=(e,t,r,i)=>{const n=Object.entries(e),o=n.length;for(let a=0;a<o;a++){const[s,c]=n[a];Uu(c,pp(t,s),r,i)}},pp=(e,t)=>{let r=e;const i=t.split(Ea),n=i.length;for(let o=0;o<n;o++){const a=i[o];let s=r.nextPart.get(a);s||(s=mp(),r.nextPart.set(a,s)),r=s}return r},B$=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,V$=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),i=Object.create(null);const n=(o,a)=>{r[o]=a,t++,t>e&&(t=0,i=r,r=Object.create(null))};return{get(o){let a=r[o];if(a!==void 0)return a;if((a=i[o])!==void 0)return n(o,a),a},set(o,a){o in r?r[o]=a:n(o,a)}}},Tc="!",Jd=":",W$=[],Kd=(e,t,r,i,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:i,isExternal:n}),q$=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=n=>{const o=[];let a=0,s=0,c=0,l;const u=n.length;for(let g=0;g<u;g++){const v=n[g];if(a===0&&s===0){if(v===Jd){o.push(n.slice(c,g)),c=g+1;continue}if(v==="/"){l=g;continue}}v==="["?a++:v==="]"?a--:v==="("?s++:v===")"&&s--}const f=o.length===0?n:n.slice(c);let d=f,h=!1;f.endsWith(Tc)?(d=f.slice(0,-1),h=!0):f.startsWith(Tc)&&(d=f.slice(1),h=!0);const p=l&&l>c?l-c:void 0;return Kd(o,h,d,p)};if(t){const n=t+Jd,o=i;i=a=>a.startsWith(n)?o(a.slice(n.length)):Kd(W$,!1,a,void 0,!0)}if(r){const n=i;i=o=>r({className:o,parseClassName:n})}return i},G$=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{t.set(r,1e6+i)}),r=>{const i=[];let n=[];for(let o=0;o<r.length;o++){const a=r[o],s=a[0]==="[",c=t.has(a);s||c?(n.length>0&&(n.sort(),i.push(...n),n=[]),i.push(a)):n.push(a)}return n.length>0&&(n.sort(),i.push(...n)),i}},Y$=e=>({cache:V$(e.cacheSize),parseClassName:q$(e),sortModifiers:G$(e),...O$(e)}),H$=/\s+/,X$=(e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:n,sortModifiers:o}=t,a=[],s=e.trim().split(H$);let c="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{isExternal:f,modifiers:d,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}=r(u);if(f){c=u+(c.length>0?" "+c:c);continue}let v=!!g,b=i(v?p.substring(0,g):p);if(!b){if(!v){c=u+(c.length>0?" "+c:c);continue}if(b=i(p),!b){c=u+(c.length>0?" "+c:c);continue}v=!1}const _=d.length===0?"":d.length===1?d[0]:o(d).join(":"),x=h?_+Tc:_,y=x+b;if(a.indexOf(y)>-1)continue;a.push(y);const w=n(b,v);for(let S=0;S<w.length;++S){const k=w[S];a.push(x+k)}c=u+(c.length>0?" "+c:c)}return c},J$=(...e)=>{let t=0,r,i,n="";for(;t<e.length;)(r=e[t++])&&(i=vp(r))&&(n&&(n+=" "),n+=i);return n},vp=e=>{if(typeof e=="string")return e;let t,r="";for(let i=0;i<e.length;i++)e[i]&&(t=vp(e[i]))&&(r&&(r+=" "),r+=t);return r},K$=(e,...t)=>{let r,i,n,o;const a=c=>{const l=t.reduce((u,f)=>f(u),e());return r=Y$(l),i=r.cache.get,n=r.cache.set,o=s,s(c)},s=c=>{const l=i(c);if(l)return l;const u=X$(c,r);return n(c,u),u};return o=a,(...c)=>o(J$(...c))},Q$=[],Me=e=>{const t=r=>r[e]||Q$;return t.isThemeGetter=!0,t},bp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,e6=/^\d+\/\d+$/,t6=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,n6=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,r6=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,i6=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,o6=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hr=e=>e6.test(e),le=e=>!!e&&!Number.isNaN(Number(e)),pn=e=>!!e&&Number.isInteger(Number(e)),Tl=e=>e.endsWith("%")&&le(e.slice(0,-1)),Jt=e=>t6.test(e),a6=()=>!0,s6=e=>n6.test(e)&&!r6.test(e),_p=()=>!1,l6=e=>i6.test(e),c6=e=>o6.test(e),u6=e=>!W(e)&&!q(e),f6=e=>oi(e,$p,_p),W=e=>bp.test(e),Rn=e=>oi(e,Sp,s6),Cl=e=>oi(e,p6,le),Qd=e=>oi(e,xp,_p),d6=e=>oi(e,wp,c6),Po=e=>oi(e,kp,l6),q=e=>yp.test(e),gi=e=>ai(e,Sp),h6=e=>ai(e,v6),eh=e=>ai(e,xp),m6=e=>ai(e,$p),g6=e=>ai(e,wp),Oo=e=>ai(e,kp,!0),oi=(e,t,r)=>{const i=bp.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},ai=(e,t,r=!1)=>{const i=yp.exec(e);return i?i[1]?t(i[1]):r:!1},xp=e=>e==="position"||e==="percentage",wp=e=>e==="image"||e==="url",$p=e=>e==="length"||e==="size"||e==="bg-size",Sp=e=>e==="length",p6=e=>e==="number",v6=e=>e==="family-name",kp=e=>e==="shadow",b6=()=>{const e=Me("color"),t=Me("font"),r=Me("text"),i=Me("font-weight"),n=Me("tracking"),o=Me("leading"),a=Me("breakpoint"),s=Me("container"),c=Me("spacing"),l=Me("radius"),u=Me("shadow"),f=Me("inset-shadow"),d=Me("text-shadow"),h=Me("drop-shadow"),p=Me("blur"),g=Me("perspective"),v=Me("aspect"),b=Me("ease"),_=Me("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...y(),q,W],S=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],N=()=>[q,W,c],C=()=>[hr,"full","auto",...N()],j=()=>[pn,"none","subgrid",q,W],M=()=>["auto",{span:["full",pn,q,W]},pn,q,W],D=()=>[pn,"auto",q,W],O=()=>["auto","min","max","fr",q,W],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],A=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...N()],R=()=>[hr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],P=()=>[e,q,W],U=()=>[...y(),eh,Qd,{position:[q,W]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Z=()=>["auto","cover","contain",m6,f6,{size:[q,W]}],G=()=>[Tl,gi,Rn],ne=()=>["","none","full",l,q,W],ee=()=>["",le,gi,Rn],oe=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>[le,Tl,eh,Qd],he=()=>["","none",p,q,W],F=()=>["none",le,q,W],K=()=>["none",le,q,W],re=()=>[le,q,W],z=()=>[hr,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jt],breakpoint:[Jt],color:[a6],container:[Jt],"drop-shadow":[Jt],ease:["in","out","in-out"],font:[u6],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jt],shadow:[Jt],spacing:["px",le],text:[Jt],"text-shadow":[Jt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",hr,W,q,v]}],container:["container"],columns:[{columns:[le,W,q,s]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:C()}],"inset-x":[{"inset-x":C()}],"inset-y":[{"inset-y":C()}],start:[{start:C()}],end:[{end:C()}],top:[{top:C()}],right:[{right:C()}],bottom:[{bottom:C()}],left:[{left:C()}],visibility:["visible","invisible","collapse"],z:[{z:[pn,"auto",q,W]}],basis:[{basis:[hr,"full","auto",s,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[le,hr,"auto","initial","none",W]}],grow:[{grow:["",le,q,W]}],shrink:[{shrink:["",le,q,W]}],order:[{order:[pn,"first","last","none",q,W]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...A(),"normal"]}],"justify-self":[{"justify-self":["auto",...A()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...A(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...A(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...A(),"baseline"]}],"place-self":[{"place-self":["auto",...A()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[s,"screen",...R()]}],"min-w":[{"min-w":[s,"screen","none",...R()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",r,gi,Rn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,q,Cl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Tl,W]}],"font-family":[{font:[h6,W,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,q,W]}],"line-clamp":[{"line-clamp":[le,"none",q,Cl]}],leading:[{leading:[o,...N()]}],"list-image":[{"list-image":["none",q,W]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",q,W]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[le,"from-font","auto",q,Rn]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[le,"auto",q,W]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",q,W]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",q,W]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:Z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pn,q,W],radial:["",q,W],conic:[pn,q,W]},g6,d6]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[le,q,W]}],"outline-w":[{outline:["",le,gi,Rn]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",u,Oo,Po]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",f,Oo,Po]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[le,Rn]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",d,Oo,Po]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[le,q,W]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[le]}],"mask-image-linear-from-pos":[{"mask-linear-from":H()}],"mask-image-linear-to-pos":[{"mask-linear-to":H()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":H()}],"mask-image-t-to-pos":[{"mask-t-to":H()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":H()}],"mask-image-r-to-pos":[{"mask-r-to":H()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":H()}],"mask-image-b-to-pos":[{"mask-b-to":H()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":H()}],"mask-image-l-to-pos":[{"mask-l-to":H()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":H()}],"mask-image-x-to-pos":[{"mask-x-to":H()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":H()}],"mask-image-y-to-pos":[{"mask-y-to":H()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[q,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":H()}],"mask-image-radial-to-pos":[{"mask-radial-to":H()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":y()}],"mask-image-conic-pos":[{"mask-conic":[le]}],"mask-image-conic-from-pos":[{"mask-conic-from":H()}],"mask-image-conic-to-pos":[{"mask-conic-to":H()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:Z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",q,W]}],filter:[{filter:["","none",q,W]}],blur:[{blur:he()}],brightness:[{brightness:[le,q,W]}],contrast:[{contrast:[le,q,W]}],"drop-shadow":[{"drop-shadow":["","none",h,Oo,Po]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",le,q,W]}],"hue-rotate":[{"hue-rotate":[le,q,W]}],invert:[{invert:["",le,q,W]}],saturate:[{saturate:[le,q,W]}],sepia:[{sepia:["",le,q,W]}],"backdrop-filter":[{"backdrop-filter":["","none",q,W]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[le,q,W]}],"backdrop-contrast":[{"backdrop-contrast":[le,q,W]}],"backdrop-grayscale":[{"backdrop-grayscale":["",le,q,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[le,q,W]}],"backdrop-invert":[{"backdrop-invert":["",le,q,W]}],"backdrop-opacity":[{"backdrop-opacity":[le,q,W]}],"backdrop-saturate":[{"backdrop-saturate":[le,q,W]}],"backdrop-sepia":[{"backdrop-sepia":["",le,q,W]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",q,W]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[le,"initial",q,W]}],ease:[{ease:["linear","initial",b,q,W]}],delay:[{delay:[le,q,W]}],animate:[{animate:["none",_,q,W]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,q,W]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:F()}],"rotate-x":[{"rotate-x":F()}],"rotate-y":[{"rotate-y":F()}],"rotate-z":[{"rotate-z":F()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[q,W,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:z()}],"translate-x":[{"translate-x":z()}],"translate-y":[{"translate-y":z()}],"translate-z":[{"translate-z":z()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",q,W]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",q,W]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[le,gi,Rn,Cl]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},y6=K$(b6);function ae(...e){return y6(hp(e))}const _6=C$("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}}),Zt=E.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...n},o)=>{const a=i?S$:"button";return $.jsx(a,{"data-slot":"button",className:ae(_6({variant:t,size:r,className:e})),ref:o,...n})});Zt.displayName="Button";function we(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Ip(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ss(e){let t,r,i;e.length!==2?(t=we,r=(s,c)=>we(e(s),c),i=(s,c)=>e(s)-c):(t=e===we||e===Ip?e:x6,r=e,i=e);function n(s,c,l=0,u=s.length){if(l<u){if(t(c,c)!==0)return u;do{const f=l+u>>>1;r(s[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(s,c,l=0,u=s.length){if(l<u){if(t(c,c)!==0)return u;do{const f=l+u>>>1;r(s[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function a(s,c,l=0,u=s.length){const f=n(s,c,l,u-1);return f>l&&i(s[f-1],c)>-i(s[f],c)?f-1:f}return{left:n,center:a,right:o}}function x6(){return 0}function Ma(e){return e===null?NaN:+e}function*w6(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&(yield i)}}const Np=Ss(we),Sn=Np.right,$6=Np.left,S6=Ss(Ma).center;function k6(e,t){if(!((t=+t)>=0))throw new RangeError("invalid r");let r=e.length;if(!((r=Math.floor(r))>=0))throw new RangeError("invalid length");if(!r||!t)return e;const i=zu(t),n=e.slice();return i(e,n,0,r,1),i(n,e,0,r,1),i(e,n,0,r,1),e}const Ep=Mp(zu),I6=Mp(N6);function Mp(e){return function(t,r,i=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((i=+i)>=0))throw new RangeError("invalid ry");let{data:n,width:o,height:a}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((a=Math.floor(a!==void 0?a:n.length/o))>=0))throw new RangeError("invalid height");if(!o||!a||!r&&!i)return t;const s=r&&e(r),c=i&&e(i),l=n.slice();return s&&c?(mr(s,l,n,o,a),mr(s,n,l,o,a),mr(s,l,n,o,a),gr(c,n,l,o,a),gr(c,l,n,o,a),gr(c,n,l,o,a)):s?(mr(s,n,l,o,a),mr(s,l,n,o,a),mr(s,n,l,o,a)):c&&(gr(c,n,l,o,a),gr(c,l,n,o,a),gr(c,n,l,o,a)),t}}function mr(e,t,r,i,n){for(let o=0,a=i*n;o<a;)e(t,r,o,o+=i,1)}function gr(e,t,r,i,n){for(let o=0,a=i*n;o<i;++o)e(t,r,o,o+a,i)}function N6(e){const t=zu(e);return(r,i,n,o,a)=>{n<<=2,o<<=2,a<<=2,t(r,i,n+0,o+0,a),t(r,i,n+1,o+1,a),t(r,i,n+2,o+2,a),t(r,i,n+3,o+3,a)}}function zu(e){const t=Math.floor(e);if(t===e)return E6(e);const r=e-t,i=2*e+1;return(n,o,a,s,c)=>{if(!((s-=c)>=a))return;let l=t*o[a];const u=c*t,f=u+c;for(let d=a,h=a+u;d<h;d+=c)l+=o[Math.min(s,d)];for(let d=a,h=s;d<=h;d+=c)l+=o[Math.min(s,d+u)],n[d]=(l+r*(o[Math.max(a,d-f)]+o[Math.min(s,d+f)]))/i,l-=o[Math.max(a,d-u)]}}function E6(e){const t=2*e+1;return(r,i,n,o,a)=>{if(!((o-=a)>=n))return;let s=e*i[n];const c=a*e;for(let l=n,u=n+c;l<u;l+=a)s+=i[Math.min(o,l)];for(let l=n,u=o;l<=u;l+=a)s+=i[Math.min(o,l+c)],r[l]=s/t,s-=i[Math.max(n,l-c)]}}function ks(e,t){let r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&++r;else{let i=-1;for(let n of e)(n=t(n,++i,e))!=null&&(n=+n)>=n&&++r}return r}function M6(e){return e.length|0}function T6(e){return!(e>0)}function C6(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function A6(e){return t=>e(...t)}function j6(...e){const t=typeof e[e.length-1]=="function"&&A6(e.pop());e=e.map(C6);const r=e.map(M6),i=e.length-1,n=new Array(i+1).fill(0),o=[];if(i<0||r.some(T6))return o;for(;;){o.push(n.map((s,c)=>e[c][s]));let a=i;for(;++n[a]===r[a];){if(a===0)return t?o.map(t):o;n[a--]=0}}}function P6(e,t){var r=0,i=0;return Float64Array.from(e,t===void 0?n=>r+=+n||0:n=>r+=+t(n,i++,e)||0)}function Tp(e,t){let r=0,i,n=0,o=0;if(t===void 0)for(let a of e)a!=null&&(a=+a)>=a&&(i=a-n,n+=i/++r,o+=i*(a-n));else{let a=-1;for(let s of e)(s=t(s,++a,e))!=null&&(s=+s)>=s&&(i=s-n,n+=i/++r,o+=i*(s-n))}if(r>1)return o/(r-1)}function Cp(e,t){const r=Tp(e,t);return r&&Math.sqrt(r)}function Fi(e,t){let r,i;if(t===void 0)for(const n of e)n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)));else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(r===void 0?o>=o&&(r=i=o):(r>o&&(r=o),i<o&&(i=o)))}return[r,i]}class Ce{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const r=this._partials;let i=0;for(let n=0;n<this._n&&n<32;n++){const o=r[n],a=t+o,s=Math.abs(t)<Math.abs(o)?t-(a-o):o-(a-t);s&&(r[i++]=s),t=a}return r[i]=t,this._n=i+1,this}valueOf(){const t=this._partials;let r=this._n,i,n,o,a=0;if(r>0){for(a=t[--r];r>0&&(i=a,n=t[--r],a=i+n,o=n-(a-i),!o););r>0&&(o<0&&t[r-1]<0||o>0&&t[r-1]>0)&&(n=o*2,i=a+n,n==i-a&&(a=i))}return a}}function O6(e,t){const r=new Ce;if(t===void 0)for(let i of e)(i=+i)&&r.add(i);else{let i=-1;for(let n of e)(n=+t(n,++i,e))&&r.add(n)}return+r}function R6(e,t){const r=new Ce;let i=-1;return Float64Array.from(e,t===void 0?n=>r.add(+n||0):n=>r.add(+t(n,++i,e)||0))}class Yi extends Map{constructor(t,r=Pp){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[i,n]of t)this.set(i,n)}get(t){return super.get(Cc(this,t))}has(t){return super.has(Cc(this,t))}set(t,r){return super.set(Ap(this,t),r)}delete(t){return super.delete(jp(this,t))}}class Gn extends Set{constructor(t,r=Pp){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const i of t)this.add(i)}has(t){return super.has(Cc(this,t))}add(t){return super.add(Ap(this,t))}delete(t){return super.delete(jp(this,t))}}function Cc({_intern:e,_key:t},r){const i=t(r);return e.has(i)?e.get(i):r}function Ap({_intern:e,_key:t},r){const i=t(r);return e.has(i)?e.get(i):(e.set(i,r),r)}function jp({_intern:e,_key:t},r){const i=t(r);return e.has(i)&&(r=e.get(i),e.delete(i)),r}function Pp(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Lr(e){return e}function Op(e,...t){return si(e,Lr,Lr,t)}function Rp(e,...t){return si(e,Array.from,Lr,t)}function Dp(e,t){for(let r=1,i=t.length;r<i;++r)e=e.flatMap(n=>n.pop().map(([o,a])=>[...n,o,a]));return e}function D6(e,...t){return Dp(Rp(e,...t),t)}function U6(e,t,...r){return Dp(zp(e,t,...r),r)}function Up(e,t,...r){return si(e,Lr,t,r)}function zp(e,t,...r){return si(e,Array.from,t,r)}function z6(e,...t){return si(e,Lr,Lp,t)}function L6(e,...t){return si(e,Array.from,Lp,t)}function Lp(e){if(e.length!==1)throw new Error("duplicate key");return e[0]}function si(e,t,r,i){return(function n(o,a){if(a>=i.length)return r(o);const s=new Yi,c=i[a++];let l=-1;for(const u of o){const f=c(u,++l,o),d=s.get(f);d?d.push(u):s.set(f,[u])}for(const[u,f]of s)s.set(u,n(f,a));return t(s)})(e,0)}function Fp(e,t){return Array.from(t,r=>e[r])}function Ac(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[r]=t;if(r&&r.length!==2||t.length>1){const i=Uint32Array.from(e,(n,o)=>o);return t.length>1?(t=t.map(n=>e.map(n)),i.sort((n,o)=>{for(const a of t){const s=Fr(a[n],a[o]);if(s)return s}})):(r=e.map(r),i.sort((n,o)=>Fr(r[n],r[o]))),Fp(e,i)}return e.sort(Lu(r))}function Lu(e=we){if(e===we)return Fr;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const i=e(t,r);return i||i===0?i:(e(r,r)===0)-(e(t,t)===0)}}function Fr(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function F6(e,t,r){return(t.length!==2?Ac(Up(e,t,r),(([i,n],[o,a])=>we(n,a)||we(i,o))):Ac(Op(e,r),(([i,n],[o,a])=>t(n,a)||we(i,o)))).map(([i])=>i)}var Z6=Array.prototype,B6=Z6.slice;function Al(e){return()=>e}const V6=Math.sqrt(50),W6=Math.sqrt(10),q6=Math.sqrt(2);function Ta(e,t,r){const i=(t-e)/Math.max(0,r),n=Math.floor(Math.log10(i)),o=i/Math.pow(10,n),a=o>=V6?10:o>=W6?5:o>=q6?2:1;let s,c,l;return n<0?(l=Math.pow(10,-n)/a,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=Math.pow(10,n)*a,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=r&&r<2?Ta(e,t,r*2):[s,c,l]}function Yn(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const i=t<e,[n,o,a]=i?Ta(t,e,r):Ta(e,t,r);if(!(o>=n))return[];const s=o-n+1,c=new Array(s);if(i)if(a<0)for(let l=0;l<s;++l)c[l]=(o-l)/-a;else for(let l=0;l<s;++l)c[l]=(o-l)*a;else if(a<0)for(let l=0;l<s;++l)c[l]=(n+l)/-a;else for(let l=0;l<s;++l)c[l]=(n+l)*a;return c}function Hn(e,t,r){return t=+t,e=+e,r=+r,Ta(e,t,r)[2]}function Ca(e,t,r){t=+t,e=+e,r=+r;const i=t<e,n=i?Hn(t,e,r):Hn(e,t,r);return(i?-1:1)*(n<0?1/-n:n)}function Fu(e,t,r){let i;for(;;){const n=Hn(e,t,r);if(n===i||n===0||!isFinite(n))return[e,t];n>0?(e=Math.floor(e/n)*n,t=Math.ceil(t/n)*n):n<0&&(e=Math.ceil(e*n)/n,t=Math.floor(t*n)/n),i=n}}function Zu(e){return Math.max(1,Math.ceil(Math.log(ks(e))/Math.LN2)+1)}function th(){var e=Lr,t=Fi,r=Zu;function i(n){Array.isArray(n)||(n=Array.from(n));var o,a=n.length,s,c,l=new Array(a);for(o=0;o<a;++o)l[o]=e(n[o],o,n);var u=t(l),f=u[0],d=u[1],h=r(l,f,d);if(!Array.isArray(h)){const x=d,y=+h;if(t===Fi&&([f,d]=Fu(f,d,y)),h=Yn(f,d,y),h[0]<=f&&(c=Hn(f,d,y)),h[h.length-1]>=d)if(x>=d&&t===Fi){const w=Hn(f,d,y);isFinite(w)&&(w>0?d=(Math.floor(d/w)+1)*w:w<0&&(d=(Math.ceil(d*-w)+1)/-w))}else h.pop()}for(var p=h.length,g=0,v=p;h[g]<=f;)++g;for(;h[v-1]>d;)--v;(g||v<p)&&(h=h.slice(g,v),p=v-g);var b=new Array(p+1),_;for(o=0;o<=p;++o)_=b[o]=[],_.x0=o>0?h[o-1]:f,_.x1=o<p?h[o]:d;if(isFinite(c)){if(c>0)for(o=0;o<a;++o)(s=l[o])!=null&&f<=s&&s<=d&&b[Math.min(p,Math.floor((s-f)/c))].push(n[o]);else if(c<0){for(o=0;o<a;++o)if((s=l[o])!=null&&f<=s&&s<=d){const x=Math.floor((f-s)*c);b[Math.min(p,x+(h[x]<=s))].push(n[o])}}}else for(o=0;o<a;++o)(s=l[o])!=null&&f<=s&&s<=d&&b[Sn(h,s,0,p)].push(n[o]);return b}return i.value=function(n){return arguments.length?(e=typeof n=="function"?n:Al(n),i):e},i.domain=function(n){return arguments.length?(t=typeof n=="function"?n:Al([n[0],n[1]]),i):t},i.thresholds=function(n){return arguments.length?(r=typeof n=="function"?n:Al(Array.isArray(n)?B6.call(n):n),i):r},i}function Hi(e,t){let r;if(t===void 0)for(const i of e)i!=null&&(r<i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let n of e)(n=t(n,++i,e))!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}return r}function Bu(e,t){let r,i=-1,n=-1;if(t===void 0)for(const o of e)++n,o!=null&&(r<o||r===void 0&&o>=o)&&(r=o,i=n);else for(let o of e)(o=t(o,++n,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o,i=n);return i}function Aa(e,t){let r;if(t===void 0)for(const i of e)i!=null&&(r>i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let n of e)(n=t(n,++i,e))!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}return r}function Vu(e,t){let r,i=-1,n=-1;if(t===void 0)for(const o of e)++n,o!=null&&(r>o||r===void 0&&o>=o)&&(r=o,i=n);else for(let o of e)(o=t(o,++n,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o,i=n);return i}function Is(e,t,r=0,i=1/0,n){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),i=Math.floor(Math.min(e.length-1,i)),!(r<=t&&t<=i))return e;for(n=n===void 0?Fr:Lu(n);i>r;){if(i-r>600){const c=i-r+1,l=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(r,Math.floor(t-l*f/c+d)),p=Math.min(i,Math.floor(t+(c-l)*f/c+d));Is(e,t,h,p,n)}const o=e[t];let a=r,s=i;for(pi(e,r,t),n(e[i],o)>0&&pi(e,r,i);a<s;){for(pi(e,a,s),++a,--s;n(e[a],o)<0;)++a;for(;n(e[s],o)>0;)--s}n(e[r],o)===0?pi(e,r,s):(++s,pi(e,s,i)),s<=t&&(r=s+1),t<=s&&(i=s-1)}return e}function pi(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function Zp(e,t=we){let r,i=!1;if(t.length===1){let n;for(const o of e){const a=t(o);(i?we(a,n)>0:we(a,a)===0)&&(r=o,n=a,i=!0)}}else for(const n of e)(i?t(n,r)>0:t(n,n)===0)&&(r=n,i=!0);return r}function Xi(e,t,r){if(e=Float64Array.from(w6(e,r)),!(!(i=e.length)||isNaN(t=+t))){if(t<=0||i<2)return Aa(e);if(t>=1)return Hi(e);var i,n=(i-1)*t,o=Math.floor(n),a=Hi(Is(e,o).subarray(0,o+1)),s=Aa(e.subarray(o+1));return a+(s-a)*(n-o)}}function Bp(e,t,r=Ma){if(!(!(i=e.length)||isNaN(t=+t))){if(t<=0||i<2)return+r(e[0],0,e);if(t>=1)return+r(e[i-1],i-1,e);var i,n=(i-1)*t,o=Math.floor(n),a=+r(e[o],o,e),s=+r(e[o+1],o+1,e);return a+(s-a)*(n-o)}}function Vp(e,t,r=Ma){if(!isNaN(t=+t)){if(i=Float64Array.from(e,(s,c)=>Ma(r(e[c],c,e))),t<=0)return Vu(i);if(t>=1)return Bu(i);var i,n=Uint32Array.from(e,(s,c)=>c),o=i.length-1,a=Math.floor(o*t);return Is(n,a,0,o,(s,c)=>Fr(i[s],i[c])),a=Zp(n.subarray(0,a+1),s=>i[s]),a>=0?a:-1}}function G6(e,t,r){const i=ks(e),n=Xi(e,.75)-Xi(e,.25);return i&&n?Math.ceil((r-t)/(2*n*Math.pow(i,-1/3))):1}function Y6(e,t,r){const i=ks(e),n=Cp(e);return i&&n?Math.ceil((r-t)*Math.cbrt(i)/(3.49*n)):1}function H6(e,t){let r=0,i=0;if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(++r,i+=n);else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(o=+o)>=o&&(++r,i+=o)}if(r)return i/r}function X6(e,t){return Xi(e,.5,t)}function J6(e,t){return Vp(e,.5,t)}function*K6(e){for(const t of e)yield*t}function Wu(e){return Array.from(K6(e))}function Q6(e,t){const r=new Yi;if(t===void 0)for(let o of e)o!=null&&o>=o&&r.set(o,(r.get(o)||0)+1);else{let o=-1;for(let a of e)(a=t(a,++o,e))!=null&&a>=a&&r.set(a,(r.get(a)||0)+1)}let i,n=0;for(const[o,a]of r)a>n&&(n=a,i=o);return i}function e4(e,t=t4){const r=[];let i,n=!1;for(const o of e)n&&r.push(t(i,o)),i=o,n=!0;return r}function t4(e,t){return[e,t]}function xn(e,t,r){e=+e,t=+t,r=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+r;for(var i=-1,n=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(n);++i<n;)o[i]=e+i*r;return o}function n4(e,t=we){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let r=Array.from(e);const i=new Float64Array(r.length);t.length!==2&&(r=r.map(t),t=we);const n=(s,c)=>t(r[s],r[c]);let o,a;return e=Uint32Array.from(r,(s,c)=>c),e.sort(t===we?(s,c)=>Fr(r[s],r[c]):Lu(n)),e.forEach((s,c)=>{const l=n(s,o===void 0?s:o);l>=0?((o===void 0||l>0)&&(o=s,a=c),i[s]=a):i[s]=NaN}),i}function r4(e,t=we){let r,i=!1;if(t.length===1){let n;for(const o of e){const a=t(o);(i?we(a,n)<0:we(a,a)===0)&&(r=o,n=a,i=!0)}}else for(const n of e)(i?t(n,r)<0:t(n,n)===0)&&(r=n,i=!0);return r}function Wp(e,t=we){if(t.length===1)return Vu(e,t);let r,i=-1,n=-1;for(const o of e)++n,(i<0?t(o,o)===0:t(o,r)<0)&&(r=o,i=n);return i}function i4(e,t=we){if(t.length===1)return Bu(e,t);let r,i=-1,n=-1;for(const o of e)++n,(i<0?t(o,o)===0:t(o,r)>0)&&(r=o,i=n);return i}function o4(e,t){const r=Wp(e,t);return r<0?void 0:r}const a4=qp(Math.random);function qp(e){return function(r,i=0,n=r.length){let o=n-(i=+i);for(;o;){const a=e()*o--|0,s=r[o+i];r[o+i]=r[a+i],r[a+i]=s}return r}}function s4(e,t){let r=0;if(t===void 0)for(let i of e)(i=+i)&&(r+=i);else{let i=-1;for(let n of e)(n=+t(n,++i,e))&&(r+=n)}return r}function Gp(e){if(!(o=e.length))return[];for(var t=-1,r=Aa(e,l4),i=new Array(r);++t<r;)for(var n=-1,o,a=i[t]=new Array(o);++n<o;)a[n]=e[n][t];return i}function l4(e){return e.length}function c4(){return Gp(arguments)}function u4(e,t){if(typeof t!="function")throw new TypeError("test is not a function");let r=-1;for(const i of e)if(!t(i,++r,e))return!1;return!0}function f4(e,t){if(typeof t!="function")throw new TypeError("test is not a function");let r=-1;for(const i of e)if(t(i,++r,e))return!0;return!1}function d4(e,t){if(typeof t!="function")throw new TypeError("test is not a function");const r=[];let i=-1;for(const n of e)t(n,++i,e)&&r.push(n);return r}function h4(e,t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");if(typeof t!="function")throw new TypeError("mapper is not a function");return Array.from(e,(r,i)=>t(r,i,e))}function m4(e,t,r){if(typeof t!="function")throw new TypeError("reducer is not a function");const i=e[Symbol.iterator]();let n,o,a=-1;if(arguments.length<3){if({done:n,value:r}=i.next(),n)return;++a}for(;{done:n,value:o}=i.next(),!n;)r=t(r,o,++a,e);return r}function g4(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function p4(e,...t){e=new Gn(e);for(const r of t)for(const i of r)e.delete(i);return e}function v4(e,t){const r=t[Symbol.iterator](),i=new Gn;for(const n of e){if(i.has(n))return!1;let o,a;for(;({value:o,done:a}=r.next())&&!a;){if(Object.is(n,o))return!1;i.add(o)}}return!0}function b4(e,...t){e=new Gn(e),t=t.map(y4);e:for(const r of e)for(const i of t)if(!i.has(r)){e.delete(r);continue e}return e}function y4(e){return e instanceof Gn?e:new Gn(e)}function Yp(e,t){const r=e[Symbol.iterator](),i=new Set;for(const n of t){const o=nh(n);if(i.has(o))continue;let a,s;for(;{value:a,done:s}=r.next();){if(s)return!1;const c=nh(a);if(i.add(c),Object.is(o,c))break}}return!0}function nh(e){return e!==null&&typeof e=="object"?e.valueOf():e}function _4(e,t){return Yp(t,e)}function x4(...e){const t=new Gn;for(const r of e)for(const i of r)t.add(i);return t}function w4(e){return e}var da=1,ha=2,jc=3,Ei=4,rh=1e-6;function $4(e){return"translate("+e+",0)"}function S4(e){return"translate(0,"+e+")"}function k4(e){return t=>+e(t)}function I4(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function N4(){return!this.__axis}function Ns(e,t){var r=[],i=null,n=null,o=6,a=6,s=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===da||e===Ei?-1:1,u=e===Ei||e===ha?"x":"y",f=e===da||e===jc?$4:S4;function d(h){var p=i??(t.ticks?t.ticks.apply(t,r):t.domain()),g=n??(t.tickFormat?t.tickFormat.apply(t,r):w4),v=Math.max(o,0)+s,b=t.range(),_=+b[0]+c,x=+b[b.length-1]+c,y=(t.bandwidth?I4:k4)(t.copy(),c),w=h.selection?h.selection():h,S=w.selectAll(".domain").data([null]),k=w.selectAll(".tick").data(p,t).order(),N=k.exit(),C=k.enter().append("g").attr("class","tick"),j=k.select("line"),M=k.select("text");S=S.merge(S.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(C),j=j.merge(C.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),M=M.merge(C.append("text").attr("fill","currentColor").attr(u,l*v).attr("dy",e===da?"0em":e===jc?"0.71em":"0.32em")),h!==w&&(S=S.transition(h),k=k.transition(h),j=j.transition(h),M=M.transition(h),N=N.transition(h).attr("opacity",rh).attr("transform",function(D){return isFinite(D=y(D))?f(D+c):this.getAttribute("transform")}),C.attr("opacity",rh).attr("transform",function(D){var O=this.parentNode.__axis;return f((O&&isFinite(O=O(D))?O:y(D))+c)})),N.remove(),S.attr("d",e===Ei||e===ha?a?"M"+l*a+","+_+"H"+c+"V"+x+"H"+l*a:"M"+c+","+_+"V"+x:a?"M"+_+","+l*a+"V"+c+"H"+x+"V"+l*a:"M"+_+","+c+"H"+x),k.attr("opacity",1).attr("transform",function(D){return f(y(D)+c)}),j.attr(u+"2",l*o),M.attr(u,l*v).text(g),w.filter(N4).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===ha?"start":e===Ei?"end":"middle"),w.each(function(){this.__axis=y})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(r=h==null?[]:Array.from(h),d):r.slice()},d.tickValues=function(h){return arguments.length?(i=h==null?null:Array.from(h),d):i&&i.slice()},d.tickFormat=function(h){return arguments.length?(n=h,d):n},d.tickSize=function(h){return arguments.length?(o=a=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(a=+h,d):a},d.tickPadding=function(h){return arguments.length?(s=+h,d):s},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function E4(e){return Ns(da,e)}function M4(e){return Ns(ha,e)}function T4(e){return Ns(jc,e)}function C4(e){return Ns(Ei,e)}var A4={value:()=>{}};function sr(){for(var e=0,t=arguments.length,r={},i;e<t;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new ma(r)}function ma(e){this._=e}function j4(e,t){return e.trim().split(/^|\s+/).map(function(r){var i="",n=r.indexOf(".");if(n>=0&&(i=r.slice(n+1),r=r.slice(0,n)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}ma.prototype=sr.prototype={constructor:ma,on:function(e,t){var r=this._,i=j4(e+"",r),n,o=-1,a=i.length;if(arguments.length<2){for(;++o<a;)if((n=(e=i[o]).type)&&(n=P4(r[n],e.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(n=(e=i[o]).type)r[n]=ih(r[n],e.name,t);else if(t==null)for(n in r)r[n]=ih(r[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new ma(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var r=new Array(n),i=0,n,o;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],i=0,n=o.length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],n=0,o=i.length;n<o;++n)i[n].value.apply(t,r)}};function P4(e,t){for(var r=0,i=e.length,n;r<i;++r)if((n=e[r]).name===t)return n.value}function ih(e,t,r){for(var i=0,n=e.length;i<n;++i)if(e[i].name===t){e[i]=A4,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:t,value:r}),e}var Pc="http://www.w3.org/1999/xhtml";const Oc={svg:"http://www.w3.org/2000/svg",xhtml:Pc,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function po(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Oc.hasOwnProperty(t)?{space:Oc[t],local:e}:e}function O4(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Pc&&t.documentElement.namespaceURI===Pc?t.createElement(e):t.createElementNS(r,e)}}function R4(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Es(e){var t=po(e);return(t.local?R4:O4)(t)}function D4(){}function Ms(e){return e==null?D4:function(){return this.querySelector(e)}}function U4(e){typeof e!="function"&&(e=Ms(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n<r;++n)for(var o=t[n],a=o.length,s=i[n]=new Array(a),c,l,u=0;u<a;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),s[u]=l);return new Qe(i,this._parents)}function Hp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function z4(){return[]}function qu(e){return e==null?z4:function(){return this.querySelectorAll(e)}}function L4(e){return function(){return Hp(e.apply(this,arguments))}}function F4(e){typeof e=="function"?e=L4(e):e=qu(e);for(var t=this._groups,r=t.length,i=[],n=[],o=0;o<r;++o)for(var a=t[o],s=a.length,c,l=0;l<s;++l)(c=a[l])&&(i.push(e.call(c,c.__data__,l,a)),n.push(c));return new Qe(i,n)}function Gu(e){return function(){return this.matches(e)}}function Xp(e){return function(t){return t.matches(e)}}var Z4=Array.prototype.find;function B4(e){return function(){return Z4.call(this.children,e)}}function V4(){return this.firstElementChild}function W4(e){return this.select(e==null?V4:B4(typeof e=="function"?e:Xp(e)))}var q4=Array.prototype.filter;function G4(){return Array.from(this.children)}function Y4(e){return function(){return q4.call(this.children,e)}}function H4(e){return this.selectAll(e==null?G4:Y4(typeof e=="function"?e:Xp(e)))}function X4(e){typeof e!="function"&&(e=Gu(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n<r;++n)for(var o=t[n],a=o.length,s=i[n]=[],c,l=0;l<a;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&s.push(c);return new Qe(i,this._parents)}function Jp(e){return new Array(e.length)}function J4(){return new Qe(this._enter||this._groups.map(Jp),this._parents)}function ja(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ja.prototype={constructor:ja,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function K4(e){return function(){return e}}function Q4(e,t,r,i,n,o){for(var a=0,s,c=t.length,l=o.length;a<l;++a)(s=t[a])?(s.__data__=o[a],i[a]=s):r[a]=new ja(e,o[a]);for(;a<c;++a)(s=t[a])&&(n[a]=s)}function eS(e,t,r,i,n,o,a){var s,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(s=0;s<u;++s)(c=t[s])&&(d[s]=h=a.call(c,c.__data__,s,t)+"",l.has(h)?n[s]=c:l.set(h,c));for(s=0;s<f;++s)h=a.call(e,o[s],s,o)+"",(c=l.get(h))?(i[s]=c,c.__data__=o[s],l.delete(h)):r[s]=new ja(e,o[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(d[s])===c&&(n[s]=c)}function tS(e){return e.__data__}function nS(e,t){if(!arguments.length)return Array.from(this,tS);var r=t?eS:Q4,i=this._parents,n=this._groups;typeof e!="function"&&(e=K4(e));for(var o=n.length,a=new Array(o),s=new Array(o),c=new Array(o),l=0;l<o;++l){var u=i[l],f=n[l],d=f.length,h=rS(e.call(u,u&&u.__data__,l,i)),p=h.length,g=s[l]=new Array(p),v=a[l]=new Array(p),b=c[l]=new Array(d);r(u,f,g,v,b,h,t);for(var _=0,x=0,y,w;_<p;++_)if(y=g[_]){for(_>=x&&(x=_+1);!(w=v[x])&&++x<p;);y._next=w||null}}return a=new Qe(a,i),a._enter=s,a._exit=c,a}function rS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function iS(){return new Qe(this._exit||this._groups.map(Jp),this._parents)}function oS(e,t,r){var i=this.enter(),n=this,o=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(n=t(n),n&&(n=n.selection())),r==null?o.remove():r(o),i&&n?i.merge(n).order():n}function aS(e){for(var t=e.selection?e.selection():e,r=this._groups,i=t._groups,n=r.length,o=i.length,a=Math.min(n,o),s=new Array(n),c=0;c<a;++c)for(var l=r[c],u=i[c],f=l.length,d=s[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<n;++c)s[c]=r[c];return new Qe(s,this._parents)}function sS(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var i=e[t],n=i.length-1,o=i[n],a;--n>=0;)(a=i[n])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function lS(e){e||(e=cS);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,i=r.length,n=new Array(i),o=0;o<i;++o){for(var a=r[o],s=a.length,c=n[o]=new Array(s),l,u=0;u<s;++u)(l=a[u])&&(c[u]=l);c.sort(t)}return new Qe(n,this._parents).order()}function cS(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function uS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function fS(){return Array.from(this)}function dS(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],n=0,o=i.length;n<o;++n){var a=i[n];if(a)return a}return null}function hS(){let e=0;for(const t of this)++e;return e}function mS(){return!this.node()}function gS(e){for(var t=this._groups,r=0,i=t.length;r<i;++r)for(var n=t[r],o=0,a=n.length,s;o<a;++o)(s=n[o])&&e.call(s,s.__data__,o,n);return this}function pS(e){return function(){this.removeAttribute(e)}}function vS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bS(e,t){return function(){this.setAttribute(e,t)}}function yS(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function _S(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function xS(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function wS(e,t){var r=po(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((t==null?r.local?vS:pS:typeof t=="function"?r.local?xS:_S:r.local?yS:bS)(r,t))}function Yu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function $S(e){return function(){this.style.removeProperty(e)}}function SS(e,t,r){return function(){this.style.setProperty(e,t,r)}}function kS(e,t,r){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function IS(e,t,r){return arguments.length>1?this.each((t==null?$S:typeof t=="function"?kS:SS)(e,t,r??"")):Xn(this.node(),e)}function Xn(e,t){return e.style.getPropertyValue(t)||Yu(e).getComputedStyle(e,null).getPropertyValue(t)}function NS(e){return function(){delete this[e]}}function ES(e,t){return function(){this[e]=t}}function MS(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function TS(e,t){return arguments.length>1?this.each((t==null?NS:typeof t=="function"?MS:ES)(e,t)):this.node()[e]}function Kp(e){return e.trim().split(/^|\s+/)}function Hu(e){return e.classList||new Qp(e)}function Qp(e){this._node=e,this._names=Kp(e.getAttribute("class")||"")}Qp.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ev(e,t){for(var r=Hu(e),i=-1,n=t.length;++i<n;)r.add(t[i])}function tv(e,t){for(var r=Hu(e),i=-1,n=t.length;++i<n;)r.remove(t[i])}function CS(e){return function(){ev(this,e)}}function AS(e){return function(){tv(this,e)}}function jS(e,t){return function(){(t.apply(this,arguments)?ev:tv)(this,e)}}function PS(e,t){var r=Kp(e+"");if(arguments.length<2){for(var i=Hu(this.node()),n=-1,o=r.length;++n<o;)if(!i.contains(r[n]))return!1;return!0}return this.each((typeof t=="function"?jS:t?CS:AS)(r,t))}function OS(){this.textContent=""}function RS(e){return function(){this.textContent=e}}function DS(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function US(e){return arguments.length?this.each(e==null?OS:(typeof e=="function"?DS:RS)(e)):this.node().textContent}function zS(){this.innerHTML=""}function LS(e){return function(){this.innerHTML=e}}function FS(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ZS(e){return arguments.length?this.each(e==null?zS:(typeof e=="function"?FS:LS)(e)):this.node().innerHTML}function BS(){this.nextSibling&&this.parentNode.appendChild(this)}function VS(){return this.each(BS)}function WS(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qS(){return this.each(WS)}function GS(e){var t=typeof e=="function"?e:Es(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function YS(){return null}function HS(e,t){var r=typeof e=="function"?e:Es(e),i=t==null?YS:typeof t=="function"?t:Ms(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function XS(){var e=this.parentNode;e&&e.removeChild(this)}function JS(){return this.each(XS)}function KS(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function QS(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ek(e){return this.select(e?QS:KS)}function tk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function nk(e){return function(t){e.call(this,t,this.__data__)}}function rk(e){return e.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}})}function ik(e){return function(){var t=this.__on;if(t){for(var r=0,i=-1,n=t.length,o;r<n;++r)o=t[r],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++i]=o;++i?t.length=i:delete this.__on}}}function ok(e,t,r){return function(){var i=this.__on,n,o=nk(t);if(i){for(var a=0,s=i.length;a<s;++a)if((n=i[a]).type===e.type&&n.name===e.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=o,n.options=r),n.value=t;return}}this.addEventListener(e.type,o,r),n={type:e.type,name:e.name,value:t,listener:o,options:r},i?i.push(n):this.__on=[n]}}function ak(e,t,r){var i=rk(e+""),n,o=i.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(n=0,u=s[c];n<o;++n)if((a=i[n]).type===u.type&&a.name===u.name)return u.value}return}for(s=t?ok:ik,n=0;n<o;++n)this.each(s(i[n],t,r));return this}function nv(e,t,r){var i=Yu(e),n=i.CustomEvent;typeof n=="function"?n=new n(t,r):(n=i.document.createEvent("Event"),r?(n.initEvent(t,r.bubbles,r.cancelable),n.detail=r.detail):n.initEvent(t,!1,!1)),e.dispatchEvent(n)}function sk(e,t){return function(){return nv(this,e,t)}}function lk(e,t){return function(){return nv(this,e,t.apply(this,arguments))}}function ck(e,t){return this.each((typeof t=="function"?lk:sk)(e,t))}function*uk(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],n=0,o=i.length,a;n<o;++n)(a=i[n])&&(yield a)}var Xu=[null];function Qe(e,t){this._groups=e,this._parents=t}function lr(){return new Qe([[document.documentElement]],Xu)}function fk(){return this}Qe.prototype=lr.prototype={constructor:Qe,select:U4,selectAll:F4,selectChild:W4,selectChildren:H4,filter:X4,data:nS,enter:J4,exit:iS,join:oS,merge:aS,selection:fk,order:sS,sort:lS,call:uS,nodes:fS,node:dS,size:hS,empty:mS,each:gS,attr:wS,style:IS,property:TS,classed:PS,text:US,html:ZS,raise:VS,lower:qS,append:GS,insert:HS,remove:JS,clone:ek,datum:tk,on:ak,dispatch:ck,[Symbol.iterator]:uk};function je(e){return typeof e=="string"?new Qe([[document.querySelector(e)]],[document.documentElement]):new Qe([[e]],Xu)}function dk(e){return je(Es(e).call(document.documentElement))}var hk=0;function rv(){return new Rc}function Rc(){this._="@"+(++hk).toString(36)}Rc.prototype=rv.prototype={constructor:Rc,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};function iv(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ct(e,t){if(e=iv(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var n=t.getBoundingClientRect();return[e.clientX-n.left-t.clientLeft,e.clientY-n.top-t.clientTop]}}return[e.pageX,e.pageY]}function mk(e,t){return e.target&&(e=iv(e),t===void 0&&(t=e.currentTarget),e=e.touches||[e]),Array.from(e,r=>ct(r,t))}function Dc(e){return typeof e=="string"?new Qe([document.querySelectorAll(e)],[document.documentElement]):new Qe([Hp(e)],Xu)}const gk={passive:!1},Ji={capture:!0,passive:!1};function jl(e){e.stopImmediatePropagation()}function Ar(e){e.preventDefault(),e.stopImmediatePropagation()}function Ts(e){var t=e.document.documentElement,r=je(e).on("dragstart.drag",Ar,Ji);"onselectstart"in t?r.on("selectstart.drag",Ar,Ji):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Cs(e,t){var r=e.document.documentElement,i=je(e).on("dragstart.drag",null);t&&(i.on("click.drag",Ar,Ji),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Ro=e=>()=>e;function Uc(e,{sourceEvent:t,subject:r,target:i,identifier:n,active:o,x:a,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Uc.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pk(e){return!e.ctrlKey&&!e.button}function vk(){return this.parentNode}function bk(e,t){return t??{x:e.x,y:e.y}}function yk(){return navigator.maxTouchPoints||"ontouchstart"in this}function _k(){var e=pk,t=vk,r=bk,i=yk,n={},o=sr("start","drag","end"),a=0,s,c,l,u,f=0;function d(y){y.on("mousedown.drag",h).filter(i).on("touchstart.drag",v).on("touchmove.drag",b,gk).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(y,w){if(!(u||!e.call(this,y,w))){var S=x(this,t.call(this,y,w),y,w,"mouse");S&&(je(y.view).on("mousemove.drag",p,Ji).on("mouseup.drag",g,Ji),Ts(y.view),jl(y),l=!1,s=y.clientX,c=y.clientY,S("start",y))}}function p(y){if(Ar(y),!l){var w=y.clientX-s,S=y.clientY-c;l=w*w+S*S>f}n.mouse("drag",y)}function g(y){je(y.view).on("mousemove.drag mouseup.drag",null),Cs(y.view,l),Ar(y),n.mouse("end",y)}function v(y,w){if(e.call(this,y,w)){var S=y.changedTouches,k=t.call(this,y,w),N=S.length,C,j;for(C=0;C<N;++C)(j=x(this,k,y,w,S[C].identifier,S[C]))&&(jl(y),j("start",y,S[C]))}}function b(y){var w=y.changedTouches,S=w.length,k,N;for(k=0;k<S;++k)(N=n[w[k].identifier])&&(Ar(y),N("drag",y,w[k]))}function _(y){var w=y.changedTouches,S=w.length,k,N;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),k=0;k<S;++k)(N=n[w[k].identifier])&&(jl(y),N("end",y,w[k]))}function x(y,w,S,k,N,C){var j=o.copy(),M=ct(C||S,w),D,O,I;if((I=r.call(y,new Uc("beforestart",{sourceEvent:S,target:d,identifier:N,active:a,x:M[0],y:M[1],dx:0,dy:0,dispatch:j}),k))!=null)return D=I.x-M[0]||0,O=I.y-M[1]||0,function A(T,R,P){var U=M,L;switch(T){case"start":n[N]=A,L=a++;break;case"end":delete n[N],--a;case"drag":M=ct(P||R,w),L=a;break}j.call(T,y,new Uc(T,{sourceEvent:R,subject:I,target:d,identifier:N,active:L,x:M[0]+D,y:M[1]+O,dx:M[0]-U[0],dy:M[1]-U[1],dispatch:j}),k)}}return d.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ro(!!y),d):e},d.container=function(y){return arguments.length?(t=typeof y=="function"?y:Ro(y),d):t},d.subject=function(y){return arguments.length?(r=typeof y=="function"?y:Ro(y),d):r},d.touchable=function(y){return arguments.length?(i=typeof y=="function"?y:Ro(!!y),d):i},d.on=function(){var y=o.on.apply(o,arguments);return y===o?d:y},d.clickDistance=function(y){return arguments.length?(f=(y=+y)*y,d):Math.sqrt(f)},d}function li(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function vo(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}function Cn(){}var Jn=.7,Zr=1/Jn,jr="\\s*([+-]?\\d+)\\s*",Ki="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Lt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xk=/^#([0-9a-f]{3,8})$/,wk=new RegExp(`^rgb\\(${jr},${jr},${jr}\\)$`),$k=new RegExp(`^rgb\\(${Lt},${Lt},${Lt}\\)$`),Sk=new RegExp(`^rgba\\(${jr},${jr},${jr},${Ki}\\)$`),kk=new RegExp(`^rgba\\(${Lt},${Lt},${Lt},${Ki}\\)$`),Ik=new RegExp(`^hsl\\(${Ki},${Lt},${Lt}\\)$`),Nk=new RegExp(`^hsla\\(${Ki},${Lt},${Lt},${Ki}\\)$`),oh={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};li(Cn,kn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ah,formatHex:ah,formatHex8:Ek,formatHsl:Mk,formatRgb:sh,toString:sh});function ah(){return this.rgb().formatHex()}function Ek(){return this.rgb().formatHex8()}function Mk(){return ov(this).formatHsl()}function sh(){return this.rgb().formatRgb()}function kn(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=xk.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?lh(t):r===3?new Pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Do(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Do(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=wk.exec(e))?new Pe(t[1],t[2],t[3],1):(t=$k.exec(e))?new Pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Sk.exec(e))?Do(t[1],t[2],t[3],t[4]):(t=kk.exec(e))?Do(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ik.exec(e))?fh(t[1],t[2]/100,t[3]/100,1):(t=Nk.exec(e))?fh(t[1],t[2]/100,t[3]/100,t[4]):oh.hasOwnProperty(e)?lh(oh[e]):e==="transparent"?new Pe(NaN,NaN,NaN,0):null}function lh(e){return new Pe(e>>16&255,e>>8&255,e&255,1)}function Do(e,t,r,i){return i<=0&&(e=t=r=NaN),new Pe(e,t,r,i)}function Ju(e){return e instanceof Cn||(e=kn(e)),e?(e=e.rgb(),new Pe(e.r,e.g,e.b,e.opacity)):new Pe}function Br(e,t,r,i){return arguments.length===1?Ju(e):new Pe(e,t,r,i??1)}function Pe(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}li(Pe,Br,vo(Cn,{brighter(e){return e=e==null?Zr:Math.pow(Zr,e),new Pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Jn:Math.pow(Jn,e),new Pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Pe(Vn(this.r),Vn(this.g),Vn(this.b),Pa(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:ch,formatHex:ch,formatHex8:Tk,formatRgb:uh,toString:uh}));function ch(){return`#${Zn(this.r)}${Zn(this.g)}${Zn(this.b)}`}function Tk(){return`#${Zn(this.r)}${Zn(this.g)}${Zn(this.b)}${Zn((isNaN(this.opacity)?1:this.opacity)*255)}`}function uh(){const e=Pa(this.opacity);return`${e===1?"rgb(":"rgba("}${Vn(this.r)}, ${Vn(this.g)}, ${Vn(this.b)}${e===1?")":`, ${e})`}`}function Pa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Zn(e){return e=Vn(e),(e<16?"0":"")+e.toString(16)}function fh(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new St(e,t,r,i)}function ov(e){if(e instanceof St)return new St(e.h,e.s,e.l,e.opacity);if(e instanceof Cn||(e=kn(e)),!e)return new St;if(e instanceof St)return e;e=e.rgb();var t=e.r/255,r=e.g/255,i=e.b/255,n=Math.min(t,r,i),o=Math.max(t,r,i),a=NaN,s=o-n,c=(o+n)/2;return s?(t===o?a=(r-i)/s+(r<i)*6:r===o?a=(i-t)/s+2:a=(t-r)/s+4,s/=c<.5?o+n:2-o-n,a*=60):s=c>0&&c<1?0:a,new St(a,s,c,e.opacity)}function Oa(e,t,r,i){return arguments.length===1?ov(e):new St(e,t,r,i??1)}function St(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}li(St,Oa,vo(Cn,{brighter(e){return e=e==null?Zr:Math.pow(Zr,e),new St(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Jn:Math.pow(Jn,e),new St(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*t,n=2*r-i;return new Pe(Pl(e>=240?e-240:e+120,n,i),Pl(e,n,i),Pl(e<120?e+240:e-120,n,i),this.opacity)},clamp(){return new St(dh(this.h),Uo(this.s),Uo(this.l),Pa(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 e=Pa(this.opacity);return`${e===1?"hsl(":"hsla("}${dh(this.h)}, ${Uo(this.s)*100}%, ${Uo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function dh(e){return e=(e||0)%360,e<0?e+360:e}function Uo(e){return Math.max(0,Math.min(1,e||0))}function Pl(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const av=Math.PI/180,sv=180/Math.PI,Ra=18,lv=.96422,cv=1,uv=.82521,fv=4/29,Pr=6/29,dv=3*Pr*Pr,Ck=Pr*Pr*Pr;function hv(e){if(e instanceof Nt)return new Nt(e.l,e.a,e.b,e.opacity);if(e instanceof Dt)return gv(e);e instanceof Pe||(e=Ju(e));var t=Ul(e.r),r=Ul(e.g),i=Ul(e.b),n=Ol((.2225045*t+.7168786*r+.0606169*i)/cv),o,a;return t===r&&r===i?o=a=n:(o=Ol((.4360747*t+.3850649*r+.1430804*i)/lv),a=Ol((.0139322*t+.0971045*r+.7141733*i)/uv)),new Nt(116*n-16,500*(o-n),200*(n-a),e.opacity)}function Ak(e,t){return new Nt(e,0,0,t??1)}function Da(e,t,r,i){return arguments.length===1?hv(e):new Nt(e,t,r,i??1)}function Nt(e,t,r,i){this.l=+e,this.a=+t,this.b=+r,this.opacity=+i}li(Nt,Da,vo(Cn,{brighter(e){return new Nt(this.l+Ra*(e??1),this.a,this.b,this.opacity)},darker(e){return new Nt(this.l-Ra*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=lv*Rl(t),e=cv*Rl(e),r=uv*Rl(r),new Pe(Dl(3.1338561*t-1.6168667*e-.4906146*r),Dl(-.9787684*t+1.9161415*e+.033454*r),Dl(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function Ol(e){return e>Ck?Math.pow(e,1/3):e/dv+fv}function Rl(e){return e>Pr?e*e*e:dv*(e-fv)}function Dl(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Ul(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function mv(e){if(e instanceof Dt)return new Dt(e.h,e.c,e.l,e.opacity);if(e instanceof Nt||(e=hv(e)),e.a===0&&e.b===0)return new Dt(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*sv;return new Dt(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function jk(e,t,r,i){return arguments.length===1?mv(e):new Dt(r,t,e,i??1)}function Ua(e,t,r,i){return arguments.length===1?mv(e):new Dt(e,t,r,i??1)}function Dt(e,t,r,i){this.h=+e,this.c=+t,this.l=+r,this.opacity=+i}function gv(e){if(isNaN(e.h))return new Nt(e.l,0,0,e.opacity);var t=e.h*av;return new Nt(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}li(Dt,Ua,vo(Cn,{brighter(e){return new Dt(this.h,this.c,this.l+Ra*(e??1),this.opacity)},darker(e){return new Dt(this.h,this.c,this.l-Ra*(e??1),this.opacity)},rgb(){return gv(this).rgb()}}));var pv=-.14861,Ku=1.78277,Qu=-.29227,As=-.90649,Qi=1.97294,hh=Qi*As,mh=Qi*Ku,gh=Ku*Qu-As*pv;function Pk(e){if(e instanceof Wn)return new Wn(e.h,e.s,e.l,e.opacity);e instanceof Pe||(e=Ju(e));var t=e.r/255,r=e.g/255,i=e.b/255,n=(gh*i+hh*t-mh*r)/(gh+hh-mh),o=i-n,a=(Qi*(r-n)-Qu*o)/As,s=Math.sqrt(a*a+o*o)/(Qi*n*(1-n)),c=s?Math.atan2(a,o)*sv-120:NaN;return new Wn(c<0?c+360:c,s,n,e.opacity)}function Et(e,t,r,i){return arguments.length===1?Pk(e):new Wn(e,t,r,i??1)}function Wn(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}li(Wn,Et,vo(Cn,{brighter(e){return e=e==null?Zr:Math.pow(Zr,e),new Wn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Jn:Math.pow(Jn,e),new Wn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*av,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),n=Math.sin(e);return new Pe(255*(t+r*(pv*i+Ku*n)),255*(t+r*(Qu*i+As*n)),255*(t+r*(Qi*i)),this.opacity)}}));function vv(e,t,r,i,n){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*r+(1+3*e+3*o-3*a)*i+a*n)/6}function bv(e){var t=e.length-1;return function(r){var i=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),n=e[i],o=e[i+1],a=i>0?e[i-1]:2*n-o,s=i<t-1?e[i+2]:2*o-n;return vv((r-i/t)*t,a,n,o,s)}}function yv(e){var t=e.length;return function(r){var i=Math.floor(((r%=1)<0?++r:r)*t),n=e[(i+t-1)%t],o=e[i%t],a=e[(i+1)%t],s=e[(i+2)%t];return vv((r-i/t)*t,n,o,a,s)}}const js=e=>()=>e;function _v(e,t){return function(r){return e+r*t}}function Ok(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}function Ps(e,t){var r=t-e;return r?_v(e,r>180||r<-180?r-360*Math.round(r/360):r):js(isNaN(e)?t:e)}function Rk(e){return(e=+e)==1?Oe:function(t,r){return r-t?Ok(t,r,e):js(isNaN(t)?r:t)}}function Oe(e,t){var r=t-e;return r?_v(e,r):js(isNaN(e)?t:e)}const eo=(function e(t){var r=Rk(t);function i(n,o){var a=r((n=Br(n)).r,(o=Br(o)).r),s=r(n.g,o.g),c=r(n.b,o.b),l=Oe(n.opacity,o.opacity);return function(u){return n.r=a(u),n.g=s(u),n.b=c(u),n.opacity=l(u),n+""}}return i.gamma=e,i})(1);function xv(e){return function(t){var r=t.length,i=new Array(r),n=new Array(r),o=new Array(r),a,s;for(a=0;a<r;++a)s=Br(t[a]),i[a]=s.r||0,n[a]=s.g||0,o[a]=s.b||0;return i=e(i),n=e(n),o=e(o),s.opacity=1,function(c){return s.r=i(c),s.g=n(c),s.b=o(c),s+""}}}var wv=xv(bv),Dk=xv(yv);function ef(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,i=t.slice(),n;return function(o){for(n=0;n<r;++n)i[n]=e[n]*(1-o)+t[n]*o;return i}}function $v(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Uk(e,t){return($v(t)?ef:Sv)(e,t)}function Sv(e,t){var r=t?t.length:0,i=e?Math.min(r,e.length):0,n=new Array(i),o=new Array(r),a;for(a=0;a<i;++a)n[a]=An(e[a],t[a]);for(;a<r;++a)o[a]=t[a];return function(s){for(a=0;a<i;++a)o[a]=n[a](s);return o}}function kv(e,t){var r=new Date;return e=+e,t=+t,function(i){return r.setTime(e*(1-i)+t*i),r}}function pt(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function Iv(e,t){var r={},i={},n;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(n in t)n in e?r[n]=An(e[n],t[n]):i[n]=t[n];return function(o){for(n in r)i[n]=r[n](o);return i}}var zc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zl=new RegExp(zc.source,"g");function zk(e){return function(){return e}}function Lk(e){return function(t){return e(t)+""}}function tf(e,t){var r=zc.lastIndex=zl.lastIndex=0,i,n,o,a=-1,s=[],c=[];for(e=e+"",t=t+"";(i=zc.exec(e))&&(n=zl.exec(t));)(o=n.index)>r&&(o=t.slice(r,o),s[a]?s[a]+=o:s[++a]=o),(i=i[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,c.push({i:a,x:pt(i,n)})),r=zl.lastIndex;return r<t.length&&(o=t.slice(r),s[a]?s[a]+=o:s[++a]=o),s.length<2?c[0]?Lk(c[0].x):zk(t):(t=c.length,function(l){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(l);return s.join("")})}function An(e,t){var r=typeof t,i;return t==null||r==="boolean"?js(t):(r==="number"?pt:r==="string"?(i=kn(t))?(t=i,eo):tf:t instanceof kn?eo:t instanceof Date?kv:$v(t)?ef:Array.isArray(t)?Sv:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Iv:pt)(e,t)}function Fk(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}function Zk(e,t){var r=Ps(+e,+t);return function(i){var n=r(i);return n-360*Math.floor(n/360)}}function Os(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var ph=180/Math.PI,Lc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Nv(e,t,r,i,n,o){var a,s,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(c=e*r+t*i)&&(r-=e*c,i-=t*c),(s=Math.sqrt(r*r+i*i))&&(r/=s,i/=s,c/=s),e*i<t*r&&(e=-e,t=-t,c=-c,a=-a),{translateX:n,translateY:o,rotate:Math.atan2(t,e)*ph,skewX:Math.atan(c)*ph,scaleX:a,scaleY:s}}var zo;function Bk(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Lc:Nv(t.a,t.b,t.c,t.d,t.e,t.f)}function Vk(e){return e==null||(zo||(zo=document.createElementNS("http://www.w3.org/2000/svg","g")),zo.setAttribute("transform",e),!(e=zo.transform.baseVal.consolidate()))?Lc:(e=e.matrix,Nv(e.a,e.b,e.c,e.d,e.e,e.f))}function Ev(e,t,r,i){function n(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var g=h.push("translate(",null,t,null,r);p.push({i:g-4,x:pt(l,f)},{i:g-2,x:pt(u,d)})}else(f||d)&&h.push("translate("+f+t+d+r)}function a(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(n(f)+"rotate(",null,i)-2,x:pt(l,u)})):u&&f.push(n(f)+"rotate("+u+i)}function s(l,u,f,d){l!==u?d.push({i:f.push(n(f)+"skewX(",null,i)-2,x:pt(l,u)}):u&&f.push(n(f)+"skewX("+u+i)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var g=h.push(n(h)+"scale(",null,",",null,")");p.push({i:g-4,x:pt(l,f)},{i:g-2,x:pt(u,d)})}else(f!==1||d!==1)&&h.push(n(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),a(l.rotate,u.rotate,f,d),s(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,g=d.length,v;++p<g;)f[(v=d[p]).i]=v.x(h);return f.join("")}}}var Mv=Ev(Bk,"px, ","px)","deg)"),Tv=Ev(Vk,", ",")",")"),Wk=1e-12;function vh(e){return((e=Math.exp(e))+1/e)/2}function qk(e){return((e=Math.exp(e))-1/e)/2}function Gk(e){return((e=Math.exp(2*e))-1)/(e+1)}const Cv=(function e(t,r,i){function n(o,a){var s=o[0],c=o[1],l=o[2],u=a[0],f=a[1],d=a[2],h=u-s,p=f-c,g=h*h+p*p,v,b;if(g<Wk)b=Math.log(d/l)/t,v=function(k){return[s+k*h,c+k*p,l*Math.exp(t*k*b)]};else{var _=Math.sqrt(g),x=(d*d-l*l+i*g)/(2*l*r*_),y=(d*d-l*l-i*g)/(2*d*r*_),w=Math.log(Math.sqrt(x*x+1)-x),S=Math.log(Math.sqrt(y*y+1)-y);b=(S-w)/t,v=function(k){var N=k*b,C=vh(w),j=l/(r*_)*(C*Gk(t*N+w)-qk(w));return[s+j*h,c+j*p,l*C/vh(t*N+w)]}}return v.duration=b*1e3*t/Math.SQRT2,v}return n.rho=function(o){var a=Math.max(.001,+o),s=a*a,c=s*s;return e(a,s,c)},n})(Math.SQRT2,2,4);function Av(e){return function(t,r){var i=e((t=Oa(t)).h,(r=Oa(r)).h),n=Oe(t.s,r.s),o=Oe(t.l,r.l),a=Oe(t.opacity,r.opacity);return function(s){return t.h=i(s),t.s=n(s),t.l=o(s),t.opacity=a(s),t+""}}}const Yk=Av(Ps);var Hk=Av(Oe);function Xk(e,t){var r=Oe((e=Da(e)).l,(t=Da(t)).l),i=Oe(e.a,t.a),n=Oe(e.b,t.b),o=Oe(e.opacity,t.opacity);return function(a){return e.l=r(a),e.a=i(a),e.b=n(a),e.opacity=o(a),e+""}}function jv(e){return function(t,r){var i=e((t=Ua(t)).h,(r=Ua(r)).h),n=Oe(t.c,r.c),o=Oe(t.l,r.l),a=Oe(t.opacity,r.opacity);return function(s){return t.h=i(s),t.c=n(s),t.l=o(s),t.opacity=a(s),t+""}}}const Jk=jv(Ps);var Kk=jv(Oe);function Pv(e){return(function t(r){r=+r;function i(n,o){var a=e((n=Et(n)).h,(o=Et(o)).h),s=Oe(n.s,o.s),c=Oe(n.l,o.l),l=Oe(n.opacity,o.opacity);return function(u){return n.h=a(u),n.s=s(u),n.l=c(Math.pow(u,r)),n.opacity=l(u),n+""}}return i.gamma=t,i})(1)}const Qk=Pv(Ps);var Rs=Pv(Oe);function Ov(e,t){t===void 0&&(t=e,e=An);for(var r=0,i=t.length-1,n=t[0],o=new Array(i<0?0:i);r<i;)o[r]=e(n,n=t[++r]);return function(a){var s=Math.max(0,Math.min(i-1,Math.floor(a*=i)));return o[s](a-s)}}function eI(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e(i/(t-1));return r}var Vr=0,Mi=0,vi=0,Rv=1e3,za,Ti,La=0,Kn=0,Ds=0,to=typeof performance=="object"&&performance.now?performance:Date,Dv=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function bo(){return Kn||(Dv(tI),Kn=to.now()+Ds)}function tI(){Kn=0}function no(){this._call=this._time=this._next=null}no.prototype=Us.prototype={constructor:no,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?bo():+r)+(t==null?0:+t),!this._next&&Ti!==this&&(Ti?Ti._next=this:za=this,Ti=this),this._call=e,this._time=r,Fc()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fc())}};function Us(e,t,r){var i=new no;return i.restart(e,t,r),i}function Uv(){bo(),++Vr;for(var e=za,t;e;)(t=Kn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Vr}function bh(){Kn=(La=to.now())+Ds,Vr=Mi=0;try{Uv()}finally{Vr=0,rI(),Kn=0}}function nI(){var e=to.now(),t=e-La;t>Rv&&(Ds-=t,La=e)}function rI(){for(var e,t=za,r,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:za=r);Ti=e,Fc(i)}function Fc(e){if(!Vr){Mi&&(Mi=clearTimeout(Mi));var t=e-Kn;t>24?(e<1/0&&(Mi=setTimeout(bh,e-to.now()-Ds)),vi&&(vi=clearInterval(vi))):(vi||(La=to.now(),vi=setInterval(nI,Rv)),Vr=1,Dv(bh))}}function Zc(e,t,r){var i=new no;return t=t==null?0:+t,i.restart(n=>{i.stop(),e(n+t)},t,r),i}function iI(e,t,r){var i=new no,n=t;return t==null?(i.restart(e,t,r),i):(i._restart=i.restart,i.restart=function(o,a,s){a=+a,s=s==null?bo():+s,i._restart(function c(l){l+=n,i._restart(c,n+=a,s),o(l)},a,s)},i.restart(e,t,r),i)}var oI=sr("start","end","cancel","interrupt"),aI=[],zv=0,Bc=1,Vc=2,ga=3,yh=4,Wc=5,pa=6;function zs(e,t,r,i,n,o){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;sI(e,r,{name:t,index:i,group:n,on:oI,tween:aI,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:zv})}function nf(e,t){var r=Ct(e,t);if(r.state>zv)throw new Error("too late; already scheduled");return r}function Yt(e,t){var r=Ct(e,t);if(r.state>ga)throw new Error("too late; already running");return r}function Ct(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function sI(e,t,r){var i=e.__transition,n;i[t]=r,r.timer=Us(o,0,r.time);function o(l){r.state=Bc,r.timer.restart(a,r.delay,r.time),r.delay<=l&&a(l-r.delay)}function a(l){var u,f,d,h;if(r.state!==Bc)return c();for(u in i)if(h=i[u],h.name===r.name){if(h.state===ga)return Zc(a);h.state===yh?(h.state=pa,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete i[u]):+u<t&&(h.state=pa,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete i[u])}if(Zc(function(){r.state===ga&&(r.state=yh,r.timer.restart(s,r.delay,r.time),s(l))}),r.state=Vc,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Vc){for(r.state=ga,n=new Array(d=r.tween.length),u=0,f=-1;u<d;++u)(h=r.tween[u].value.call(e,e.__data__,r.index,r.group))&&(n[++f]=h);n.length=f+1}}function s(l){for(var u=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(c),r.state=Wc,1),f=-1,d=n.length;++f<d;)n[f].call(e,u);r.state===Wc&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=pa,r.timer.stop(),delete i[t];for(var l in i)return;delete e.__transition}}function qn(e,t){var r=e.__transition,i,n,o=!0,a;if(r){t=t==null?null:t+"";for(a in r){if((i=r[a]).name!==t){o=!1;continue}n=i.state>Vc&&i.state<Wc,i.state=pa,i.timer.stop(),i.on.call(n?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[a]}o&&delete e.__transition}}function lI(e){return this.each(function(){qn(this,e)})}function cI(e,t){var r,i;return function(){var n=Yt(this,e),o=n.tween;if(o!==r){i=r=o;for(var a=0,s=i.length;a<s;++a)if(i[a].name===t){i=i.slice(),i.splice(a,1);break}}n.tween=i}}function uI(e,t,r){var i,n;if(typeof r!="function")throw new Error;return function(){var o=Yt(this,e),a=o.tween;if(a!==i){n=(i=a).slice();for(var s={name:t,value:r},c=0,l=n.length;c<l;++c)if(n[c].name===t){n[c]=s;break}c===l&&n.push(s)}o.tween=n}}function fI(e,t){var r=this._id;if(e+="",arguments.length<2){for(var i=Ct(this.node(),r).tween,n=0,o=i.length,a;n<o;++n)if((a=i[n]).name===e)return a.value;return null}return this.each((t==null?cI:uI)(r,e,t))}function rf(e,t,r){var i=e._id;return e.each(function(){var n=Yt(this,i);(n.value||(n.value={}))[t]=r.apply(this,arguments)}),function(n){return Ct(n,i).value[t]}}function Lv(e,t){var r;return(typeof t=="number"?pt:t instanceof kn?eo:(r=kn(t))?(t=r,eo):tf)(e,t)}function dI(e){return function(){this.removeAttribute(e)}}function hI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mI(e,t,r){var i,n=r+"",o;return function(){var a=this.getAttribute(e);return a===n?null:a===i?o:o=t(i=a,r)}}function gI(e,t,r){var i,n=r+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===n?null:a===i?o:o=t(i=a,r)}}function pI(e,t,r){var i,n,o;return function(){var a,s=r(this),c;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=s+"",a===c?null:a===i&&c===n?o:(n=c,o=t(i=a,s)))}}function vI(e,t,r){var i,n,o;return function(){var a,s=r(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=s+"",a===c?null:a===i&&c===n?o:(n=c,o=t(i=a,s)))}}function bI(e,t){var r=po(e),i=r==="transform"?Tv:Lv;return this.attrTween(e,typeof t=="function"?(r.local?vI:pI)(r,i,rf(this,"attr."+e,t)):t==null?(r.local?hI:dI)(r):(r.local?gI:mI)(r,i,t))}function yI(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function _I(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function xI(e,t){var r,i;function n(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&_I(e,o)),r}return n._value=t,n}function wI(e,t){var r,i;function n(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&yI(e,o)),r}return n._value=t,n}function $I(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var i=po(e);return this.tween(r,(i.local?xI:wI)(i,t))}function SI(e,t){return function(){nf(this,e).delay=+t.apply(this,arguments)}}function kI(e,t){return t=+t,function(){nf(this,e).delay=t}}function II(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?SI:kI)(t,e)):Ct(this.node(),t).delay}function NI(e,t){return function(){Yt(this,e).duration=+t.apply(this,arguments)}}function EI(e,t){return t=+t,function(){Yt(this,e).duration=t}}function MI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?NI:EI)(t,e)):Ct(this.node(),t).duration}function TI(e,t){if(typeof t!="function")throw new Error;return function(){Yt(this,e).ease=t}}function CI(e){var t=this._id;return arguments.length?this.each(TI(t,e)):Ct(this.node(),t).ease}function AI(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Yt(this,e).ease=r}}function jI(e){if(typeof e!="function")throw new Error;return this.each(AI(this._id,e))}function PI(e){typeof e!="function"&&(e=Gu(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n<r;++n)for(var o=t[n],a=o.length,s=i[n]=[],c,l=0;l<a;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&s.push(c);return new Bt(i,this._parents,this._name,this._id)}function OI(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,i=t.length,n=r.length,o=Math.min(i,n),a=new Array(i),s=0;s<o;++s)for(var c=t[s],l=r[s],u=c.length,f=a[s]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;s<i;++s)a[s]=t[s];return new Bt(a,this._parents,this._name,this._id)}function RI(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function DI(e,t,r){var i,n,o=RI(t)?nf:Yt;return function(){var a=o(this,e),s=a.on;s!==i&&(n=(i=s).copy()).on(t,r),a.on=n}}function UI(e,t){var r=this._id;return arguments.length<2?Ct(this.node(),r).on.on(e):this.each(DI(r,e,t))}function zI(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function LI(){return this.on("end.remove",zI(this._id))}function FI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Ms(e));for(var i=this._groups,n=i.length,o=new Array(n),a=0;a<n;++a)for(var s=i[a],c=s.length,l=o[a]=new Array(c),u,f,d=0;d<c;++d)(u=s[d])&&(f=e.call(u,u.__data__,d,s))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,zs(l[d],t,r,d,l,Ct(u,r)));return new Bt(o,this._parents,t,r)}function ZI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=qu(e));for(var i=this._groups,n=i.length,o=[],a=[],s=0;s<n;++s)for(var c=i[s],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=Ct(u,r),g=0,v=d.length;g<v;++g)(h=d[g])&&zs(h,t,r,g,d,p);o.push(d),a.push(u)}return new Bt(o,a,t,r)}var BI=lr.prototype.constructor;function VI(){return new BI(this._groups,this._parents)}function WI(e,t){var r,i,n;return function(){var o=Xn(this,e),a=(this.style.removeProperty(e),Xn(this,e));return o===a?null:o===r&&a===i?n:n=t(r=o,i=a)}}function Fv(e){return function(){this.style.removeProperty(e)}}function qI(e,t,r){var i,n=r+"",o;return function(){var a=Xn(this,e);return a===n?null:a===i?o:o=t(i=a,r)}}function GI(e,t,r){var i,n,o;return function(){var a=Xn(this,e),s=r(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Xn(this,e))),a===c?null:a===i&&c===n?o:(n=c,o=t(i=a,s))}}function YI(e,t){var r,i,n,o="style."+t,a="end."+o,s;return function(){var c=Yt(this,e),l=c.on,u=c.value[o]==null?s||(s=Fv(t)):void 0;(l!==r||n!==u)&&(i=(r=l).copy()).on(a,n=u),c.on=i}}function HI(e,t,r){var i=(e+="")=="transform"?Mv:Lv;return t==null?this.styleTween(e,WI(e,i)).on("end.style."+e,Fv(e)):typeof t=="function"?this.styleTween(e,GI(e,i,rf(this,"style."+e,t))).each(YI(this._id,e)):this.styleTween(e,qI(e,i,t),r).on("end.style."+e,null)}function XI(e,t,r){return function(i){this.style.setProperty(e,t.call(this,i),r)}}function JI(e,t,r){var i,n;function o(){var a=t.apply(this,arguments);return a!==n&&(i=(n=a)&&XI(e,a,r)),i}return o._value=t,o}function KI(e,t,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,JI(e,t,r??""))}function QI(e){return function(){this.textContent=e}}function eN(e){return function(){var t=e(this);this.textContent=t??""}}function tN(e){return this.tween("text",typeof e=="function"?eN(rf(this,"text",e)):QI(e==null?"":e+""))}function nN(e){return function(t){this.textContent=e.call(this,t)}}function rN(e){var t,r;function i(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&nN(n)),t}return i._value=e,i}function iN(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,rN(e))}function oN(){for(var e=this._name,t=this._id,r=Bv(),i=this._groups,n=i.length,o=0;o<n;++o)for(var a=i[o],s=a.length,c,l=0;l<s;++l)if(c=a[l]){var u=Ct(c,t);zs(c,e,r,l,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Bt(i,this._parents,e,r)}function aN(){var e,t,r=this,i=r._id,n=r.size();return new Promise(function(o,a){var s={value:a},c={value:function(){--n===0&&o()}};r.each(function(){var l=Yt(this,i),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),l.on=t}),n===0&&o()})}var sN=0;function Bt(e,t,r,i){this._groups=e,this._parents=t,this._name=r,this._id=i}function Zv(e){return lr().transition(e)}function Bv(){return++sN}var Kt=lr.prototype;Bt.prototype=Zv.prototype={constructor:Bt,select:FI,selectAll:ZI,selectChild:Kt.selectChild,selectChildren:Kt.selectChildren,filter:PI,merge:OI,selection:VI,transition:oN,call:Kt.call,nodes:Kt.nodes,node:Kt.node,size:Kt.size,empty:Kt.empty,each:Kt.each,on:UI,attr:bI,attrTween:$I,style:HI,styleTween:KI,text:tN,textTween:iN,remove:LI,tween:fI,delay:II,duration:MI,ease:CI,easeVarying:jI,end:aN,[Symbol.iterator]:Kt[Symbol.iterator]};const lN=e=>+e;function cN(e){return e*e}function uN(e){return e*(2-e)}function _h(e){return((e*=2)<=1?e*e:--e*(2-e)+1)/2}function fN(e){return e*e*e}function dN(e){return--e*e*e+1}function qc(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var of=3,hN=(function e(t){t=+t;function r(i){return Math.pow(i,t)}return r.exponent=e,r})(of),mN=(function e(t){t=+t;function r(i){return 1-Math.pow(1-i,t)}return r.exponent=e,r})(of),xh=(function e(t){t=+t;function r(i){return((i*=2)<=1?Math.pow(i,t):2-Math.pow(2-i,t))/2}return r.exponent=e,r})(of),Vv=Math.PI,Wv=Vv/2;function gN(e){return+e==1?1:1-Math.cos(e*Wv)}function pN(e){return Math.sin(e*Wv)}function wh(e){return(1-Math.cos(Vv*e))/2}function In(e){return(Math.pow(2,-10*e)-.0009765625)*1.0009775171065494}function vN(e){return In(1-+e)}function bN(e){return 1-In(e)}function $h(e){return((e*=2)<=1?In(1-e):2-In(e-1))/2}function yN(e){return 1-Math.sqrt(1-e*e)}function _N(e){return Math.sqrt(1- --e*e)}function Sh(e){return((e*=2)<=1?1-Math.sqrt(1-e*e):Math.sqrt(1-(e-=2)*e)+1)/2}var Gc=4/11,xN=6/11,wN=8/11,$N=3/4,SN=9/11,kN=10/11,IN=15/16,NN=21/22,EN=63/64,Lo=1/Gc/Gc;function MN(e){return 1-ro(1-e)}function ro(e){return(e=+e)<Gc?Lo*e*e:e<wN?Lo*(e-=xN)*e+$N:e<kN?Lo*(e-=SN)*e+IN:Lo*(e-=NN)*e+EN}function TN(e){return((e*=2)<=1?1-ro(1-e):ro(e-1)+1)/2}var af=1.70158,CN=(function e(t){t=+t;function r(i){return(i=+i)*i*(t*(i-1)+i)}return r.overshoot=e,r})(af),AN=(function e(t){t=+t;function r(i){return--i*i*((i+1)*t+i)+1}return r.overshoot=e,r})(af),kh=(function e(t){t=+t;function r(i){return((i*=2)<1?i*i*((t+1)*i-t):(i-=2)*i*((t+1)*i+t)+2)/2}return r.overshoot=e,r})(af),Wr=2*Math.PI,sf=1,lf=.3,jN=(function e(t,r){var i=Math.asin(1/(t=Math.max(1,t)))*(r/=Wr);function n(o){return t*In(- --o)*Math.sin((i-o)/r)}return n.amplitude=function(o){return e(o,r*Wr)},n.period=function(o){return e(t,o)},n})(sf,lf),Ih=(function e(t,r){var i=Math.asin(1/(t=Math.max(1,t)))*(r/=Wr);function n(o){return 1-t*In(o=+o)*Math.sin((o+i)/r)}return n.amplitude=function(o){return e(o,r*Wr)},n.period=function(o){return e(t,o)},n})(sf,lf),PN=(function e(t,r){var i=Math.asin(1/(t=Math.max(1,t)))*(r/=Wr);function n(o){return((o=o*2-1)<0?t*In(-o)*Math.sin((i-o)/r):2-t*In(o)*Math.sin((i+o)/r))/2}return n.amplitude=function(o){return e(o,r*Wr)},n.period=function(o){return e(t,o)},n})(sf,lf),ON={time:null,delay:0,duration:250,ease:qc};function RN(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function DN(e){var t,r;e instanceof Bt?(t=e._id,e=e._name):(t=Bv(),(r=ON).time=bo(),e=e==null?null:e+"");for(var i=this._groups,n=i.length,o=0;o<n;++o)for(var a=i[o],s=a.length,c,l=0;l<s;++l)(c=a[l])&&zs(c,e,t,l,a,r||RN(c,t));return new Bt(i,this._parents,e,t)}lr.prototype.interrupt=lI;lr.prototype.transition=DN;var UN=[null];function zN(e,t){var r=e.__transition,i,n;if(r){t=t==null?null:t+"";for(n in r)if((i=r[n]).state>Bc&&i.name===t)return new Bt([[e]],UN,t,+n)}return null}const Ll=e=>()=>e;function LN(e,{sourceEvent:t,target:r,selection:i,mode:n,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:i,enumerable:!0,configurable:!0},mode:{value:n,enumerable:!0,configurable:!0},_:{value:o}})}function FN(e){e.stopImmediatePropagation()}function Fl(e){e.preventDefault(),e.stopImmediatePropagation()}var Nh={name:"drag"},Zl={name:"space"},pr={name:"handle"},vr={name:"center"};const{abs:Eh,max:Le,min:Fe}=Math;function Mh(e){return[+e[0],+e[1]]}function Yc(e){return[Mh(e[0]),Mh(e[1])]}var va={name:"x",handles:["w","e"].map(io),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},ba={name:"y",handles:["n","s"].map(io),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},ZN={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(io),input:function(e){return e==null?null:Yc(e)},output:function(e){return e}},Qt={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Th={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Ch={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},BN={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},VN={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function io(e){return{type:e}}function WN(e){return!e.ctrlKey&&!e.button}function qN(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function GN(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bl(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function YN(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function HN(e){var t=e.__brush;return t?t.dim.output(t.selection):null}function XN(){return cf(va)}function JN(){return cf(ba)}function KN(){return cf(ZN)}function cf(e){var t=qN,r=WN,i=GN,n=!0,o=sr("start","brush","end"),a=6,s;function c(v){var b=v.property("__brush",g).selectAll(".overlay").data([io("overlay")]);b.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Qt.overlay).merge(b).each(function(){var x=Bl(this).extent;je(this).attr("x",x[0][0]).attr("y",x[0][1]).attr("width",x[1][0]-x[0][0]).attr("height",x[1][1]-x[0][1])}),v.selectAll(".selection").data([io("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Qt.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var _=v.selectAll(".handle").data(e.handles,function(x){return x.type});_.exit().remove(),_.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return Qt[x.type]}),v.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(i).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(v,b,_){v.tween?v.on("start.brush",function(x){u(this,arguments).beforestart().start(x)}).on("interrupt.brush end.brush",function(x){u(this,arguments).end(x)}).tween("brush",function(){var x=this,y=x.__brush,w=u(x,arguments),S=y.selection,k=e.input(typeof b=="function"?b.apply(this,arguments):b,y.extent),N=An(S,k);function C(j){y.selection=j===1&&k===null?null:N(j),l.call(x),w.brush()}return S!==null&&k!==null?C:C(1)}):v.each(function(){var x=this,y=arguments,w=x.__brush,S=e.input(typeof b=="function"?b.apply(x,y):b,w.extent),k=u(x,y).beforestart();qn(x),w.selection=S===null?null:S,l.call(x),k.start(_).brush(_).end(_)})},c.clear=function(v,b){c.move(v,null,b)};function l(){var v=je(this),b=Bl(this).selection;b?(v.selectAll(".selection").style("display",null).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1]),v.selectAll(".handle").style("display",null).attr("x",function(_){return _.type[_.type.length-1]==="e"?b[1][0]-a/2:b[0][0]-a/2}).attr("y",function(_){return _.type[0]==="s"?b[1][1]-a/2:b[0][1]-a/2}).attr("width",function(_){return _.type==="n"||_.type==="s"?b[1][0]-b[0][0]+a:a}).attr("height",function(_){return _.type==="e"||_.type==="w"?b[1][1]-b[0][1]+a:a})):v.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(v,b,_){var x=v.__brush.emitter;return x&&(!_||!x.clean)?x:new f(v,b,_)}function f(v,b,_){this.that=v,this.args=b,this.state=v.__brush,this.active=0,this.clean=_}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(v,b){return this.starting?(this.starting=!1,this.emit("start",v,b)):this.emit("brush",v),this},brush:function(v,b){return this.emit("brush",v,b),this},end:function(v,b){return--this.active===0&&(delete this.state.emitter,this.emit("end",v,b)),this},emit:function(v,b,_){var x=je(this.that).datum();o.call(v,this.that,new LN(v,{sourceEvent:b,target:c,selection:e.output(this.state.selection),mode:_,dispatch:o}),x)}};function d(v){if(s&&!v.touches||!r.apply(this,arguments))return;var b=this,_=v.target.__data__.type,x=(n&&v.metaKey?_="overlay":_)==="selection"?Nh:n&&v.altKey?vr:pr,y=e===ba?null:BN[_],w=e===va?null:VN[_],S=Bl(b),k=S.extent,N=S.selection,C=k[0][0],j,M,D=k[0][1],O,I,A=k[1][0],T,R,P=k[1][1],U,L,Z=0,G=0,ne,ee=y&&w&&n&&v.shiftKey,oe,ve,H=Array.from(v.touches||[v],te=>{const $e=te.identifier;return te=ct(te,b),te.point0=te.slice(),te.identifier=$e,te});qn(b);var he=u(b,arguments,!0).beforestart();if(_==="overlay"){N&&(ne=!0);const te=[H[0],H[1]||H[0]];S.selection=N=[[j=e===ba?C:Fe(te[0][0],te[1][0]),O=e===va?D:Fe(te[0][1],te[1][1])],[T=e===ba?A:Le(te[0][0],te[1][0]),U=e===va?P:Le(te[0][1],te[1][1])]],H.length>1&&me(v)}else j=N[0][0],O=N[0][1],T=N[1][0],U=N[1][1];M=j,I=O,R=T,L=U;var F=je(b).attr("pointer-events","none"),K=F.selectAll(".overlay").attr("cursor",Qt[_]);if(v.touches)he.moved=z,he.ended=de;else{var re=je(v.view).on("mousemove.brush",z,!0).on("mouseup.brush",de,!0);n&&re.on("keydown.brush",We,!0).on("keyup.brush",qe,!0),Ts(v.view)}l.call(b),he.start(v,x.name);function z(te){for(const $e of te.changedTouches||[te])for(const hi of H)hi.identifier===$e.identifier&&(hi.cur=ct($e,b));if(ee&&!oe&&!ve&&H.length===1){const $e=H[0];Eh($e.cur[0]-$e[0])>Eh($e.cur[1]-$e[1])?ve=!0:oe=!0}for(const $e of H)$e.cur&&($e[0]=$e.cur[0],$e[1]=$e.cur[1]);ne=!0,Fl(te),me(te)}function me(te){const $e=H[0],hi=$e.point0;var gn;switch(Z=$e[0]-hi[0],G=$e[1]-hi[1],x){case Zl:case Nh:{y&&(Z=Le(C-j,Fe(A-T,Z)),M=j+Z,R=T+Z),w&&(G=Le(D-O,Fe(P-U,G)),I=O+G,L=U+G);break}case pr:{H[1]?(y&&(M=Le(C,Fe(A,H[0][0])),R=Le(C,Fe(A,H[1][0])),y=1),w&&(I=Le(D,Fe(P,H[0][1])),L=Le(D,Fe(P,H[1][1])),w=1)):(y<0?(Z=Le(C-j,Fe(A-j,Z)),M=j+Z,R=T):y>0&&(Z=Le(C-T,Fe(A-T,Z)),M=j,R=T+Z),w<0?(G=Le(D-O,Fe(P-O,G)),I=O+G,L=U):w>0&&(G=Le(D-U,Fe(P-U,G)),I=O,L=U+G));break}case vr:{y&&(M=Le(C,Fe(A,j-Z*y)),R=Le(C,Fe(A,T+Z*y))),w&&(I=Le(D,Fe(P,O-G*w)),L=Le(D,Fe(P,U+G*w)));break}}R<M&&(y*=-1,gn=j,j=T,T=gn,gn=M,M=R,R=gn,_ in Th&&K.attr("cursor",Qt[_=Th[_]])),L<I&&(w*=-1,gn=O,O=U,U=gn,gn=I,I=L,L=gn,_ in Ch&&K.attr("cursor",Qt[_=Ch[_]])),S.selection&&(N=S.selection),oe&&(M=N[0][0],R=N[1][0]),ve&&(I=N[0][1],L=N[1][1]),(N[0][0]!==M||N[0][1]!==I||N[1][0]!==R||N[1][1]!==L)&&(S.selection=[[M,I],[R,L]],l.call(b),he.brush(te,x.name))}function de(te){if(FN(te),te.touches){if(te.touches.length)return;s&&clearTimeout(s),s=setTimeout(function(){s=null},500)}else Cs(te.view,ne),re.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);F.attr("pointer-events","all"),K.attr("cursor",Qt.overlay),S.selection&&(N=S.selection),YN(N)&&(S.selection=null,l.call(b)),he.end(te,x.name)}function We(te){switch(te.keyCode){case 16:{ee=y&&w;break}case 18:{x===pr&&(y&&(T=R-Z*y,j=M+Z*y),w&&(U=L-G*w,O=I+G*w),x=vr,me(te));break}case 32:{(x===pr||x===vr)&&(y<0?T=R-Z:y>0&&(j=M-Z),w<0?U=L-G:w>0&&(O=I-G),x=Zl,K.attr("cursor",Qt.selection),me(te));break}default:return}Fl(te)}function qe(te){switch(te.keyCode){case 16:{ee&&(oe=ve=ee=!1,me(te));break}case 18:{x===vr&&(y<0?T=R:y>0&&(j=M),w<0?U=L:w>0&&(O=I),x=pr,me(te));break}case 32:{x===Zl&&(te.altKey?(y&&(T=R-Z*y,j=M+Z*y),w&&(U=L-G*w,O=I+G*w),x=vr):(y<0?T=R:y>0&&(j=M),w<0?U=L:w>0&&(O=I),x=pr),K.attr("cursor",Qt[_]),me(te));break}default:return}Fl(te)}}function h(v){u(this,arguments).moved(v)}function p(v){u(this,arguments).ended(v)}function g(){var v=this.__brush||{selection:null};return v.extent=Yc(t.apply(this,arguments)),v.dim=e,v}return c.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Ll(Yc(v)),c):t},c.filter=function(v){return arguments.length?(r=typeof v=="function"?v:Ll(!!v),c):r},c.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:Ll(!!v),c):i},c.handleSize=function(v){return arguments.length?(a=+v,c):a},c.keyModifiers=function(v){return arguments.length?(n=!!v,c):n},c.on=function(){var v=o.on.apply(o,arguments);return v===o?c:v},c}var Ah=Math.abs,br=Math.cos,yr=Math.sin,qv=Math.PI,Fo=qv/2,jh=qv*2,Ph=Math.max,Vl=1e-12;function Wl(e,t){return Array.from({length:t-e},(r,i)=>e+i)}function QN(e){return function(t,r){return e(t.source.value+t.target.value,r.source.value+r.target.value)}}function eE(){return uf(!1,!1)}function tE(){return uf(!1,!0)}function nE(){return uf(!0,!1)}function uf(e,t){var r=0,i=null,n=null,o=null;function a(s){var c=s.length,l=new Array(c),u=Wl(0,c),f=new Array(c*c),d=new Array(c),h=0,p;s=Float64Array.from({length:c*c},t?(g,v)=>s[v%c][v/c|0]:(g,v)=>s[v/c|0][v%c]);for(let g=0;g<c;++g){let v=0;for(let b=0;b<c;++b)v+=s[g*c+b]+e*s[b*c+g];h+=l[g]=v}h=Ph(0,jh-r*c)/h,p=h?r:jh/c;{let g=0;i&&u.sort((v,b)=>i(l[v],l[b]));for(const v of u){const b=g;if(e){const _=Wl(~c+1,c).filter(x=>x<0?s[~x*c+v]:s[v*c+x]);n&&_.sort((x,y)=>n(x<0?-s[~x*c+v]:s[v*c+x],y<0?-s[~y*c+v]:s[v*c+y]));for(const x of _)if(x<0){const y=f[~x*c+v]||(f[~x*c+v]={source:null,target:null});y.target={index:v,startAngle:g,endAngle:g+=s[~x*c+v]*h,value:s[~x*c+v]}}else{const y=f[v*c+x]||(f[v*c+x]={source:null,target:null});y.source={index:v,startAngle:g,endAngle:g+=s[v*c+x]*h,value:s[v*c+x]}}d[v]={index:v,startAngle:b,endAngle:g,value:l[v]}}else{const _=Wl(0,c).filter(x=>s[v*c+x]||s[x*c+v]);n&&_.sort((x,y)=>n(s[v*c+x],s[v*c+y]));for(const x of _){let y;if(v<x?(y=f[v*c+x]||(f[v*c+x]={source:null,target:null}),y.source={index:v,startAngle:g,endAngle:g+=s[v*c+x]*h,value:s[v*c+x]}):(y=f[x*c+v]||(f[x*c+v]={source:null,target:null}),y.target={index:v,startAngle:g,endAngle:g+=s[v*c+x]*h,value:s[v*c+x]},v===x&&(y.source=y.target)),y.source&&y.target&&y.source.value<y.target.value){const w=y.source;y.source=y.target,y.target=w}}d[v]={index:v,startAngle:b,endAngle:g,value:l[v]}}g+=p}}return f=Object.values(f),f.groups=d,o?f.sort(o):f}return a.padAngle=function(s){return arguments.length?(r=Ph(0,s),a):r},a.sortGroups=function(s){return arguments.length?(i=s,a):i},a.sortSubgroups=function(s){return arguments.length?(n=s,a):n},a.sortChords=function(s){return arguments.length?(s==null?o=null:(o=QN(s))._=s,a):o&&o._},a}const Hc=Math.PI,Xc=2*Hc,zn=1e-6,rE=Xc-zn;function Gv(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function iE(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Gv;const r=10**t;return function(i){this._+=i[0];for(let n=1,o=i.length;n<o;++n)this._+=Math.round(arguments[n]*r)/r+i[n]}}let yo=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Gv:iE(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,i,n){this._append`Q${+t},${+r},${this._x1=+i},${this._y1=+n}`}bezierCurveTo(t,r,i,n,o,a){this._append`C${+t},${+r},${+i},${+n},${this._x1=+o},${this._y1=+a}`}arcTo(t,r,i,n,o){if(t=+t,r=+r,i=+i,n=+n,o=+o,o<0)throw new Error(`negative radius: ${o}`);let a=this._x1,s=this._y1,c=i-t,l=n-r,u=a-t,f=s-r,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>zn)if(!(Math.abs(f*c-l*u)>zn)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let h=i-a,p=n-s,g=c*c+l*l,v=h*h+p*p,b=Math.sqrt(g),_=Math.sqrt(d),x=o*Math.tan((Hc-Math.acos((g+d-v)/(2*b*_)))/2),y=x/_,w=x/b;Math.abs(y-1)>zn&&this._append`L${t+y*u},${r+y*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+w*c},${this._y1=r+w*l}`}}arc(t,r,i,n,o,a){if(t=+t,r=+r,i=+i,a=!!a,i<0)throw new Error(`negative radius: ${i}`);let s=i*Math.cos(n),c=i*Math.sin(n),l=t+s,u=r+c,f=1^a,d=a?n-o:o-n;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>zn||Math.abs(this._y1-u)>zn)&&this._append`L${l},${u}`,i&&(d<0&&(d=d%Xc+Xc),d>rE?this._append`A${i},${i},0,1,${f},${t-s},${r-c}A${i},${i},0,1,${f},${this._x1=l},${this._y1=u}`:d>zn&&this._append`A${i},${i},0,${+(d>=Hc)},${f},${this._x1=t+i*Math.cos(o)},${this._y1=r+i*Math.sin(o)}`)}rect(t,r,i,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${i=+i}v${+n}h${-i}Z`}toString(){return this._}};function ff(){return new yo}ff.prototype=yo.prototype;function oE(e=3){return new yo(+e)}var aE=Array.prototype.slice;function Dn(e){return function(){return e}}function sE(e){return e.source}function lE(e){return e.target}function Oh(e){return e.radius}function cE(e){return e.startAngle}function uE(e){return e.endAngle}function fE(){return 0}function dE(){return 10}function Yv(e){var t=sE,r=lE,i=Oh,n=Oh,o=cE,a=uE,s=fE,c=null;function l(){var u,f=t.apply(this,arguments),d=r.apply(this,arguments),h=s.apply(this,arguments)/2,p=aE.call(arguments),g=+i.apply(this,(p[0]=f,p)),v=o.apply(this,p)-Fo,b=a.apply(this,p)-Fo,_=+n.apply(this,(p[0]=d,p)),x=o.apply(this,p)-Fo,y=a.apply(this,p)-Fo;if(c||(c=u=ff()),h>Vl&&(Ah(b-v)>h*2+Vl?b>v?(v+=h,b-=h):(v-=h,b+=h):v=b=(v+b)/2,Ah(y-x)>h*2+Vl?y>x?(x+=h,y-=h):(x-=h,y+=h):x=y=(x+y)/2),c.moveTo(g*br(v),g*yr(v)),c.arc(0,0,g,v,b),v!==x||b!==y)if(e){var w=+e.apply(this,arguments),S=_-w,k=(x+y)/2;c.quadraticCurveTo(0,0,S*br(x),S*yr(x)),c.lineTo(_*br(k),_*yr(k)),c.lineTo(S*br(y),S*yr(y))}else c.quadraticCurveTo(0,0,_*br(x),_*yr(x)),c.arc(0,0,_,x,y);if(c.quadraticCurveTo(0,0,g*br(v),g*yr(v)),c.closePath(),u)return c=null,u+""||null}return e&&(l.headRadius=function(u){return arguments.length?(e=typeof u=="function"?u:Dn(+u),l):e}),l.radius=function(u){return arguments.length?(i=n=typeof u=="function"?u:Dn(+u),l):i},l.sourceRadius=function(u){return arguments.length?(i=typeof u=="function"?u:Dn(+u),l):i},l.targetRadius=function(u){return arguments.length?(n=typeof u=="function"?u:Dn(+u),l):n},l.startAngle=function(u){return arguments.length?(o=typeof u=="function"?u:Dn(+u),l):o},l.endAngle=function(u){return arguments.length?(a=typeof u=="function"?u:Dn(+u),l):a},l.padAngle=function(u){return arguments.length?(s=typeof u=="function"?u:Dn(+u),l):s},l.source=function(u){return arguments.length?(t=u,l):t},l.target=function(u){return arguments.length?(r=u,l):r},l.context=function(u){return arguments.length?(c=u??null,l):c},l}function hE(){return Yv()}function mE(){return Yv(dE)}var gE=Array.prototype,Hv=gE.slice;function pE(e,t){return e-t}function vE(e){for(var t=0,r=e.length,i=e[r-1][1]*e[0][0]-e[r-1][0]*e[0][1];++t<r;)i+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return i}const yn=e=>()=>e;function bE(e,t){for(var r=-1,i=t.length,n;++r<i;)if(n=yE(e,t[r]))return n;return 0}function yE(e,t){for(var r=t[0],i=t[1],n=-1,o=0,a=e.length,s=a-1;o<a;s=o++){var c=e[o],l=c[0],u=c[1],f=e[s],d=f[0],h=f[1];if(_E(c,f,t))return 0;u>i!=h>i&&r<(d-l)*(i-u)/(h-u)+l&&(n=-n)}return n}function _E(e,t,r){var i;return xE(e,t,r)&&wE(e[i=+(e[0]===t[0])],r[i],t[i])}function xE(e,t,r){return(t[0]-e[0])*(r[1]-e[1])===(r[0]-e[0])*(t[1]-e[1])}function wE(e,t,r){return e<=t&&t<=r||r<=t&&t<=e}function $E(){}var en=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Jc(){var e=1,t=1,r=Zu,i=c;function n(l){var u=r(l);if(Array.isArray(u))u=u.slice().sort(pE);else{const f=Fi(l,SE);for(u=Yn(...Fu(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){const f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return a(l,f,function(p){i(p,l,f),vE(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var g=0,v=d.length,b;g<v;++g)if(bE((b=d[g])[0],p)!==-1){b.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function a(l,u,f){var d=new Array,h=new Array,p,g,v,b,_,x;for(p=g=-1,b=Un(l[0],u),en[b<<1].forEach(y);++p<e-1;)v=b,b=Un(l[p+1],u),en[v|b<<1].forEach(y);for(en[b<<0].forEach(y);++g<t-1;){for(p=-1,b=Un(l[g*e+e],u),_=Un(l[g*e],u),en[b<<1|_<<2].forEach(y);++p<e-1;)v=b,b=Un(l[g*e+e+p+1],u),x=_,_=Un(l[g*e+p+1],u),en[v|b<<1|_<<2|x<<3].forEach(y);en[b|_<<3].forEach(y)}for(p=-1,_=l[g*e]>=u,en[_<<2].forEach(y);++p<e-1;)x=_,_=Un(l[g*e+p+1],u),en[_<<2|x<<3].forEach(y);en[_<<3].forEach(y);function y(w){var S=[w[0][0]+p,w[0][1]+g],k=[w[1][0]+p,w[1][1]+g],N=s(S),C=s(k),j,M;(j=h[N])?(M=d[C])?(delete h[j.end],delete d[M.start],j===M?(j.ring.push(k),f(j.ring)):d[j.start]=h[M.end]={start:j.start,end:M.end,ring:j.ring.concat(M.ring)}):(delete h[j.end],j.ring.push(k),h[j.end=C]=j):(j=d[C])?(M=h[N])?(delete d[j.start],delete h[M.end],j===M?(j.ring.push(k),f(j.ring)):d[M.start]=h[j.end]={start:M.start,end:j.end,ring:M.ring.concat(j.ring)}):(delete d[j.start],j.ring.unshift(S),d[j.start=N]=j):d[N]=h[C]={start:N,end:C,ring:[S,k]}}}function s(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],g=h|0,v=p|0,b=ql(u[v*e+g]);h>0&&h<e&&g===h&&(d[0]=Rh(h,ql(u[v*e+g-1]),b,f)),p>0&&p<t&&v===p&&(d[1]=Rh(p,ql(u[(v-1)*e+g]),b,f))})}return n.contour=o,n.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,n},n.thresholds=function(l){return arguments.length?(r=typeof l=="function"?l:Array.isArray(l)?yn(Hv.call(l)):yn(l),n):r},n.smooth=function(l){return arguments.length?(i=l?c:$E,n):i===c},n}function SE(e){return isFinite(e)?e:NaN}function Un(e,t){return e==null?!1:+e>=t}function ql(e){return e==null||isNaN(e=+e)?-1/0:e}function Rh(e,t,r,i){const n=i-t,o=r-t,a=isFinite(n)||isFinite(o)?n/o:Math.sign(n)/Math.sign(o);return isNaN(a)?e:e+a-.5}function kE(e){return e[0]}function IE(e){return e[1]}function NE(){return 1}function EE(){var e=kE,t=IE,r=NE,i=960,n=500,o=20,a=2,s=o*3,c=i+s*2>>a,l=n+s*2>>a,u=yn(20);function f(_){var x=new Float32Array(c*l),y=Math.pow(2,-a),w=-1;for(const O of _){var S=(e(O,++w,_)+s)*y,k=(t(O,w,_)+s)*y,N=+r(O,w,_);if(N&&S>=0&&S<c&&k>=0&&k<l){var C=Math.floor(S),j=Math.floor(k),M=S-C-.5,D=k-j-.5;x[C+j*c]+=(1-M)*(1-D)*N,x[C+1+j*c]+=M*(1-D)*N,x[C+1+(j+1)*c]+=M*D*N,x[C+(j+1)*c]+=(1-M)*D*N}}return Ep({data:x,width:c,height:l},o*y),x}function d(_){var x=f(_),y=u(x),w=Math.pow(2,2*a);return Array.isArray(y)||(y=Yn(Number.MIN_VALUE,Hi(x)/w,y)),Jc().size([c,l]).thresholds(y.map(S=>S*w))(x).map((S,k)=>(S.value=+y[k],h(S)))}d.contours=function(_){var x=f(_),y=Jc().size([c,l]),w=Math.pow(2,2*a),S=k=>{k=+k;var N=h(y.contour(x,k*w));return N.value=k,N};return Object.defineProperty(S,"max",{get:()=>Hi(x)/w}),S};function h(_){return _.coordinates.forEach(p),_}function p(_){_.forEach(g)}function g(_){_.forEach(v)}function v(_){_[0]=_[0]*Math.pow(2,a)-s,_[1]=_[1]*Math.pow(2,a)-s}function b(){return s=o*3,c=i+s*2>>a,l=n+s*2>>a,d}return d.x=function(_){return arguments.length?(e=typeof _=="function"?_:yn(+_),d):e},d.y=function(_){return arguments.length?(t=typeof _=="function"?_:yn(+_),d):t},d.weight=function(_){return arguments.length?(r=typeof _=="function"?_:yn(+_),d):r},d.size=function(_){if(!arguments.length)return[i,n];var x=+_[0],y=+_[1];if(!(x>=0&&y>=0))throw new Error("invalid size");return i=x,n=y,b()},d.cellSize=function(_){if(!arguments.length)return 1<<a;if(!((_=+_)>=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(_)/Math.LN2),b()},d.thresholds=function(_){return arguments.length?(u=typeof _=="function"?_:Array.isArray(_)?yn(Hv.call(_)):yn(_),d):u},d.bandwidth=function(_){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((_=+_)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*_*_+1)-1)/2,b()},d}const ln=11102230246251565e-32,Ze=134217729,ME=(3+8*ln)*ln;function Gl(e,t,r,i,n){let o,a,s,c,l=t[0],u=i[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=i[++d]);let h=0;if(f<e&&d<r)for(u>l==u>-l?(a=l+o,s=o-(a-l),l=t[++f]):(a=u+o,s=o-(a-u),u=i[++d]),o=a,s!==0&&(n[h++]=s);f<e&&d<r;)u>l==u>-l?(a=o+l,c=a-o,s=o-(a-c)+(l-c),l=t[++f]):(a=o+u,c=a-o,s=o-(a-c)+(u-c),u=i[++d]),o=a,s!==0&&(n[h++]=s);for(;f<e;)a=o+l,c=a-o,s=o-(a-c)+(l-c),l=t[++f],o=a,s!==0&&(n[h++]=s);for(;d<r;)a=o+u,c=a-o,s=o-(a-c)+(u-c),u=i[++d],o=a,s!==0&&(n[h++]=s);return(o!==0||h===0)&&(n[h++]=o),h}function TE(e,t){let r=t[0];for(let i=1;i<e;i++)r+=t[i];return r}function _o(e){return new Float64Array(e)}const CE=(3+16*ln)*ln,AE=(2+12*ln)*ln,jE=(9+64*ln)*ln*ln,_r=_o(4),Dh=_o(8),Uh=_o(12),zh=_o(16),Ge=_o(4);function PE(e,t,r,i,n,o,a){let s,c,l,u,f,d,h,p,g,v,b,_,x,y,w,S,k,N;const C=e-n,j=r-n,M=t-o,D=i-o;y=C*D,d=Ze*C,h=d-(d-C),p=C-h,d=Ze*D,g=d-(d-D),v=D-g,w=p*v-(y-h*g-p*g-h*v),S=M*j,d=Ze*M,h=d-(d-M),p=M-h,d=Ze*j,g=d-(d-j),v=j-g,k=p*v-(S-h*g-p*g-h*v),b=w-k,f=w-b,_r[0]=w-(b+f)+(f-k),_=y+b,f=_-y,x=y-(_-f)+(b-f),b=x-S,f=x-b,_r[1]=x-(b+f)+(f-S),N=_+b,f=N-_,_r[2]=_-(N-f)+(b-f),_r[3]=N;let O=TE(4,_r),I=AE*a;if(O>=I||-O>=I||(f=e-C,s=e-(C+f)+(f-n),f=r-j,l=r-(j+f)+(f-n),f=t-M,c=t-(M+f)+(f-o),f=i-D,u=i-(D+f)+(f-o),s===0&&c===0&&l===0&&u===0)||(I=jE*a+ME*Math.abs(O),O+=C*u+D*s-(M*l+j*c),O>=I||-O>=I))return O;y=s*D,d=Ze*s,h=d-(d-s),p=s-h,d=Ze*D,g=d-(d-D),v=D-g,w=p*v-(y-h*g-p*g-h*v),S=c*j,d=Ze*c,h=d-(d-c),p=c-h,d=Ze*j,g=d-(d-j),v=j-g,k=p*v-(S-h*g-p*g-h*v),b=w-k,f=w-b,Ge[0]=w-(b+f)+(f-k),_=y+b,f=_-y,x=y-(_-f)+(b-f),b=x-S,f=x-b,Ge[1]=x-(b+f)+(f-S),N=_+b,f=N-_,Ge[2]=_-(N-f)+(b-f),Ge[3]=N;const A=Gl(4,_r,4,Ge,Dh);y=C*u,d=Ze*C,h=d-(d-C),p=C-h,d=Ze*u,g=d-(d-u),v=u-g,w=p*v-(y-h*g-p*g-h*v),S=M*l,d=Ze*M,h=d-(d-M),p=M-h,d=Ze*l,g=d-(d-l),v=l-g,k=p*v-(S-h*g-p*g-h*v),b=w-k,f=w-b,Ge[0]=w-(b+f)+(f-k),_=y+b,f=_-y,x=y-(_-f)+(b-f),b=x-S,f=x-b,Ge[1]=x-(b+f)+(f-S),N=_+b,f=N-_,Ge[2]=_-(N-f)+(b-f),Ge[3]=N;const T=Gl(A,Dh,4,Ge,Uh);y=s*u,d=Ze*s,h=d-(d-s),p=s-h,d=Ze*u,g=d-(d-u),v=u-g,w=p*v-(y-h*g-p*g-h*v),S=c*l,d=Ze*c,h=d-(d-c),p=c-h,d=Ze*l,g=d-(d-l),v=l-g,k=p*v-(S-h*g-p*g-h*v),b=w-k,f=w-b,Ge[0]=w-(b+f)+(f-k),_=y+b,f=_-y,x=y-(_-f)+(b-f),b=x-S,f=x-b,Ge[1]=x-(b+f)+(f-S),N=_+b,f=N-_,Ge[2]=_-(N-f)+(b-f),Ge[3]=N;const R=Gl(T,Uh,4,Ge,zh);return zh[R-1]}function Zo(e,t,r,i,n,o){const a=(t-o)*(r-n),s=(e-n)*(i-o),c=a-s,l=Math.abs(a+s);return Math.abs(c)>=CE*l?c:-PE(e,t,r,i,n,o,l)}const Lh=Math.pow(2,-52),Bo=new Uint32Array(512);class Fa{static from(t,r=zE,i=LE){const n=t.length,o=new Float64Array(n*2);for(let a=0;a<n;a++){const s=t[a];o[2*a]=r(s),o[2*a+1]=i(s)}return new Fa(o)}constructor(t){const r=t.length>>1;if(r>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*r-5,0);this._triangles=new Uint32Array(i*3),this._halfedges=new Int32Array(i*3),this._hashSize=Math.ceil(Math.sqrt(r)),this._hullPrev=new Uint32Array(r),this._hullNext=new Uint32Array(r),this._hullTri=new Uint32Array(r),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(r),this._dists=new Float64Array(r),this.update()}update(){const{coords:t,_hullPrev:r,_hullNext:i,_hullTri:n,_hullHash:o}=this,a=t.length>>1;let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let C=0;C<a;C++){const j=t[2*C],M=t[2*C+1];j<s&&(s=j),M<c&&(c=M),j>l&&(l=j),M>u&&(u=M),this._ids[C]=C}const f=(s+l)/2,d=(c+u)/2;let h,p,g;for(let C=0,j=1/0;C<a;C++){const M=Yl(f,d,t[2*C],t[2*C+1]);M<j&&(h=C,j=M)}const v=t[2*h],b=t[2*h+1];for(let C=0,j=1/0;C<a;C++){if(C===h)continue;const M=Yl(v,b,t[2*C],t[2*C+1]);M<j&&M>0&&(p=C,j=M)}let _=t[2*p],x=t[2*p+1],y=1/0;for(let C=0;C<a;C++){if(C===h||C===p)continue;const j=DE(v,b,_,x,t[2*C],t[2*C+1]);j<y&&(g=C,y=j)}let w=t[2*g],S=t[2*g+1];if(y===1/0){for(let M=0;M<a;M++)this._dists[M]=t[2*M]-t[0]||t[2*M+1]-t[1];Tr(this._ids,this._dists,0,a-1);const C=new Uint32Array(a);let j=0;for(let M=0,D=-1/0;M<a;M++){const O=this._ids[M],I=this._dists[O];I>D&&(C[j++]=O,D=I)}this.hull=C.subarray(0,j),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Zo(v,b,_,x,w,S)<0){const C=p,j=_,M=x;p=g,_=w,x=S,g=C,w=j,S=M}const k=UE(v,b,_,x,w,S);this._cx=k.x,this._cy=k.y;for(let C=0;C<a;C++)this._dists[C]=Yl(t[2*C],t[2*C+1],k.x,k.y);Tr(this._ids,this._dists,0,a-1),this._hullStart=h;let N=3;i[h]=r[g]=p,i[p]=r[h]=g,i[g]=r[p]=h,n[h]=0,n[p]=1,n[g]=2,o.fill(-1),o[this._hashKey(v,b)]=h,o[this._hashKey(_,x)]=p,o[this._hashKey(w,S)]=g,this.trianglesLen=0,this._addTriangle(h,p,g,-1,-1,-1);for(let C=0,j,M;C<this._ids.length;C++){const D=this._ids[C],O=t[2*D],I=t[2*D+1];if(C>0&&Math.abs(O-j)<=Lh&&Math.abs(I-M)<=Lh||(j=O,M=I,D===h||D===p||D===g))continue;let A=0;for(let L=0,Z=this._hashKey(O,I);L<this._hashSize&&(A=o[(Z+L)%this._hashSize],!(A!==-1&&A!==i[A]));L++);A=r[A];let T=A,R;for(;R=i[T],Zo(O,I,t[2*T],t[2*T+1],t[2*R],t[2*R+1])>=0;)if(T=R,T===A){T=-1;break}if(T===-1)continue;let P=this._addTriangle(T,D,i[T],-1,-1,n[T]);n[D]=this._legalize(P+2),n[T]=P,N++;let U=i[T];for(;R=i[U],Zo(O,I,t[2*U],t[2*U+1],t[2*R],t[2*R+1])<0;)P=this._addTriangle(U,D,R,n[D],-1,n[U]),n[D]=this._legalize(P+2),i[U]=U,N--,U=R;if(T===A)for(;R=r[T],Zo(O,I,t[2*R],t[2*R+1],t[2*T],t[2*T+1])<0;)P=this._addTriangle(R,D,T,-1,n[T],n[R]),this._legalize(P+2),n[R]=P,i[T]=T,N--,T=R;this._hullStart=r[D]=T,i[T]=r[U]=D,i[D]=U,o[this._hashKey(O,I)]=D,o[this._hashKey(t[2*T],t[2*T+1])]=T}this.hull=new Uint32Array(N);for(let C=0,j=this._hullStart;C<N;C++)this.hull[C]=j,j=i[j];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,r){return Math.floor(OE(t-this._cx,r-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:r,_halfedges:i,coords:n}=this;let o=0,a=0;for(;;){const s=i[t],c=t-t%3;if(a=c+(t+2)%3,s===-1){if(o===0)break;t=Bo[--o];continue}const l=s-s%3,u=c+(t+1)%3,f=l+(s+2)%3,d=r[a],h=r[t],p=r[u],g=r[f];if(RE(n[2*d],n[2*d+1],n[2*h],n[2*h+1],n[2*p],n[2*p+1],n[2*g],n[2*g+1])){r[t]=g,r[s]=d;const b=i[f];if(b===-1){let x=this._hullStart;do{if(this._hullTri[x]===f){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,b),this._link(s,i[a]),this._link(a,f);const _=l+(s+1)%3;o<Bo.length&&(Bo[o++]=_)}else{if(o===0)break;t=Bo[--o]}}return a}_link(t,r){this._halfedges[t]=r,r!==-1&&(this._halfedges[r]=t)}_addTriangle(t,r,i,n,o,a){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=r,this._triangles[s+2]=i,this._link(s,n),this._link(s+1,o),this._link(s+2,a),this.trianglesLen+=3,s}}function OE(e,t){const r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}function Yl(e,t,r,i){const n=e-r,o=t-i;return n*n+o*o}function RE(e,t,r,i,n,o,a,s){const c=e-a,l=t-s,u=r-a,f=i-s,d=n-a,h=o-s,p=c*c+l*l,g=u*u+f*f,v=d*d+h*h;return c*(f*v-g*h)-l*(u*v-g*d)+p*(u*h-f*d)<0}function DE(e,t,r,i,n,o){const a=r-e,s=i-t,c=n-e,l=o-t,u=a*a+s*s,f=c*c+l*l,d=.5/(a*l-s*c),h=(l*u-s*f)*d,p=(a*f-c*u)*d;return h*h+p*p}function UE(e,t,r,i,n,o){const a=r-e,s=i-t,c=n-e,l=o-t,u=a*a+s*s,f=c*c+l*l,d=.5/(a*l-s*c),h=e+(l*u-s*f)*d,p=t+(a*f-c*u)*d;return{x:h,y:p}}function Tr(e,t,r,i){if(i-r<=20)for(let n=r+1;n<=i;n++){const o=e[n],a=t[o];let s=n-1;for(;s>=r&&t[e[s]]>a;)e[s+1]=e[s--];e[s+1]=o}else{const n=r+i>>1;let o=r+1,a=i;bi(e,n,o),t[e[r]]>t[e[i]]&&bi(e,r,i),t[e[o]]>t[e[i]]&&bi(e,o,i),t[e[r]]>t[e[o]]&&bi(e,r,o);const s=e[o],c=t[s];for(;;){do o++;while(t[e[o]]<c);do a--;while(t[e[a]]>c);if(a<o)break;bi(e,o,a)}e[r+1]=e[a],e[a]=s,i-o+1>=a-r?(Tr(e,t,o,i),Tr(e,t,r,a-1)):(Tr(e,t,r,a-1),Tr(e,t,o,i))}}function bi(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function zE(e){return e[0]}function LE(e){return e[1]}const Fh=1e-6;class Bn{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,r){this._+=`L${this._x1=+t},${this._y1=+r}`}arc(t,r,i){t=+t,r=+r,i=+i;const n=t+i,o=r;if(i<0)throw new Error("negative radius");this._x1===null?this._+=`M${n},${o}`:(Math.abs(this._x1-n)>Fh||Math.abs(this._y1-o)>Fh)&&(this._+="L"+n+","+o),i&&(this._+=`A${i},${i},0,1,1,${t-i},${r}A${i},${i},0,1,1,${this._x1=n},${this._y1=o}`)}rect(t,r,i,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${+i}v${+n}h${-i}Z`}value(){return this._||null}}class Kc{constructor(){this._=[]}moveTo(t,r){this._.push([t,r])}closePath(){this._.push(this._[0].slice())}lineTo(t,r){this._.push([t,r])}value(){return this._.length?this._:null}}class Xv{constructor(t,[r,i,n,o]=[0,0,960,500]){if(!((n=+n)>=(r=+r))||!((o=+o)>=(i=+i)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=n,this.xmin=r,this.ymax=o,this.ymin=i,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:r,triangles:i},vectors:n}=this;let o,a;const s=this.circumcenters=this._circumcenters.subarray(0,i.length/3*2);for(let g=0,v=0,b=i.length,_,x;g<b;g+=3,v+=2){const y=i[g]*2,w=i[g+1]*2,S=i[g+2]*2,k=t[y],N=t[y+1],C=t[w],j=t[w+1],M=t[S],D=t[S+1],O=C-k,I=j-N,A=M-k,T=D-N,R=(O*T-I*A)*2;if(Math.abs(R)<1e-9){if(o===void 0){o=a=0;for(const U of r)o+=t[U*2],a+=t[U*2+1];o/=r.length,a/=r.length}const P=1e9*Math.sign((o-k)*T-(a-N)*A);_=(k+M)/2-P*T,x=(N+D)/2+P*A}else{const P=1/R,U=O*O+I*I,L=A*A+T*T;_=k+(T*U-I*L)*P,x=N+(O*L-A*U)*P}s[v]=_,s[v+1]=x}let c=r[r.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];n.fill(0);for(let g=0;g<r.length;++g)c=r[g],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],n[l+2]=n[u]=h-p,n[l+3]=n[u+1]=d-f}render(t){const r=t==null?t=new Bn:void 0,{delaunay:{halfedges:i,inedges:n,hull:o},circumcenters:a,vectors:s}=this;if(o.length<=1)return null;for(let u=0,f=i.length;u<f;++u){const d=i[u];if(d<u)continue;const h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,g=a[h],v=a[h+1],b=a[p],_=a[p+1];this._renderSegment(g,v,b,_,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];const f=Math.floor(n[l]/3)*2,d=a[f],h=a[f+1],p=c*4,g=this._project(d,h,s[p+2],s[p+3]);g&&this._renderSegment(d,h,g[0],g[1],t)}return r&&r.value()}renderBounds(t){const r=t==null?t=new Bn:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),r&&r.value()}renderCell(t,r){const i=r==null?r=new Bn:void 0,n=this._clip(t);if(n===null||!n.length)return;r.moveTo(n[0],n[1]);let o=n.length;for(;n[0]===n[o-2]&&n[1]===n[o-1]&&o>1;)o-=2;for(let a=2;a<o;a+=2)(n[a]!==n[a-2]||n[a+1]!==n[a-1])&&r.lineTo(n[a],n[a+1]);return r.closePath(),i&&i.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let r=0,i=t.length/2;r<i;++r){const n=this.cellPolygon(r);n&&(n.index=r,yield n)}}cellPolygon(t){const r=new Kc;return this.renderCell(t,r),r.value()}_renderSegment(t,r,i,n,o){let a;const s=this._regioncode(t,r),c=this._regioncode(i,n);s===0&&c===0?(o.moveTo(t,r),o.lineTo(i,n)):(a=this._clipSegment(t,r,i,n,s,c))&&(o.moveTo(a[0],a[1]),o.lineTo(a[2],a[3]))}contains(t,r,i){return r=+r,r!==r||(i=+i,i!==i)?!1:this.delaunay._step(t,r,i)===t}*neighbors(t){const r=this._clip(t);if(r)for(const i of this.delaunay.neighbors(t)){const n=this._clip(i);if(n){e:for(let o=0,a=r.length;o<a;o+=2)for(let s=0,c=n.length;s<c;s+=2)if(r[o]===n[s]&&r[o+1]===n[s+1]&&r[(o+2)%a]===n[(s+c-2)%c]&&r[(o+3)%a]===n[(s+c-1)%c]){yield i;break e}}}}_cell(t){const{circumcenters:r,delaunay:{inedges:i,halfedges:n,triangles:o}}=this,a=i[t];if(a===-1)return null;const s=[];let c=a;do{const l=Math.floor(c/3);if(s.push(r[l*2],r[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=n[c]}while(c!==a&&c!==-1);return s}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const r=this._cell(t);if(r===null)return null;const{vectors:i}=this,n=t*4;return this._simplify(i[n]||i[n+1]?this._clipInfinite(t,r,i[n],i[n+1],i[n+2],i[n+3]):this._clipFinite(t,r))}_clipFinite(t,r){const i=r.length;let n=null,o,a,s=r[i-2],c=r[i-1],l,u=this._regioncode(s,c),f,d=0;for(let h=0;h<i;h+=2)if(o=s,a=c,s=r[h],c=r[h+1],l=u,u=this._regioncode(s,c),l===0&&u===0)f=d,d=0,n?n.push(s,c):n=[s,c];else{let p,g,v,b,_;if(l===0){if((p=this._clipSegment(o,a,s,c,l,u))===null)continue;[g,v,b,_]=p}else{if((p=this._clipSegment(s,c,o,a,u,l))===null)continue;[b,_,g,v]=p,f=d,d=this._edgecode(g,v),f&&d&&this._edge(t,f,d,n,n.length),n?n.push(g,v):n=[g,v]}f=d,d=this._edgecode(b,_),f&&d&&this._edge(t,f,d,n,n.length),n?n.push(b,_):n=[b,_]}if(n)f=d,d=this._edgecode(n[0],n[1]),f&&d&&this._edge(t,f,d,n,n.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return n}_clipSegment(t,r,i,n,o,a){const s=o<a;for(s&&([t,r,i,n,o,a]=[i,n,t,r,a,o]);;){if(o===0&&a===0)return s?[i,n,t,r]:[t,r,i,n];if(o&a)return null;let c,l,u=o||a;u&8?(c=t+(i-t)*(this.ymax-r)/(n-r),l=this.ymax):u&4?(c=t+(i-t)*(this.ymin-r)/(n-r),l=this.ymin):u&2?(l=r+(n-r)*(this.xmax-t)/(i-t),c=this.xmax):(l=r+(n-r)*(this.xmin-t)/(i-t),c=this.xmin),o?(t=c,r=l,o=this._regioncode(t,r)):(i=c,n=l,a=this._regioncode(i,n))}}_clipInfinite(t,r,i,n,o,a){let s=Array.from(r),c;if((c=this._project(s[0],s[1],i,n))&&s.unshift(c[0],c[1]),(c=this._project(s[s.length-2],s[s.length-1],o,a))&&s.push(c[0],c[1]),s=this._clipFinite(t,s))for(let l=0,u=s.length,f,d=this._edgecode(s[u-2],s[u-1]);l<u;l+=2)f=d,d=this._edgecode(s[l],s[l+1]),f&&d&&(l=this._edge(t,f,d,s,l),u=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,r,i,n,o){for(;r!==i;){let a,s;switch(r){case 5:r=4;continue;case 4:r=6,a=this.xmax,s=this.ymin;break;case 6:r=2;continue;case 2:r=10,a=this.xmax,s=this.ymax;break;case 10:r=8;continue;case 8:r=9,a=this.xmin,s=this.ymax;break;case 9:r=1;continue;case 1:r=5,a=this.xmin,s=this.ymin;break}(n[o]!==a||n[o+1]!==s)&&this.contains(t,a,s)&&(n.splice(o,0,a,s),o+=2)}return o}_project(t,r,i,n){let o=1/0,a,s,c;if(n<0){if(r<=this.ymin)return null;(a=(this.ymin-r)/n)<o&&(c=this.ymin,s=t+(o=a)*i)}else if(n>0){if(r>=this.ymax)return null;(a=(this.ymax-r)/n)<o&&(c=this.ymax,s=t+(o=a)*i)}if(i>0){if(t>=this.xmax)return null;(a=(this.xmax-t)/i)<o&&(s=this.xmax,c=r+(o=a)*n)}else if(i<0){if(t<=this.xmin)return null;(a=(this.xmin-t)/i)<o&&(s=this.xmin,c=r+(o=a)*n)}return[s,c]}_edgecode(t,r){return(t===this.xmin?1:t===this.xmax?2:0)|(r===this.ymin?4:r===this.ymax?8:0)}_regioncode(t,r){return(t<this.xmin?1:t>this.xmax?2:0)|(r<this.ymin?4:r>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let r=0;r<t.length;r+=2){const i=(r+2)%t.length,n=(r+4)%t.length;(t[r]===t[i]&&t[i]===t[n]||t[r+1]===t[i+1]&&t[i+1]===t[n+1])&&(t.splice(i,2),r-=2)}t.length||(t=null)}return t}}const FE=2*Math.PI,xr=Math.pow;function ZE(e){return e[0]}function BE(e){return e[1]}function VE(e){const{triangles:t,coords:r}=e;for(let i=0;i<t.length;i+=3){const n=2*t[i],o=2*t[i+1],a=2*t[i+2];if((r[a]-r[n])*(r[o+1]-r[n+1])-(r[o]-r[n])*(r[a+1]-r[n+1])>1e-10)return!1}return!0}function WE(e,t,r){return[e+Math.sin(e+t)*r,t+Math.cos(e-t)*r]}class df{static from(t,r=ZE,i=BE,n){return new df("length"in t?qE(t,r,i,n):Float64Array.from(GE(t,r,i,n)))}constructor(t){this._delaunator=new Fa(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,r=this.points;if(t.hull&&t.hull.length>2&&VE(t)){this.collinear=Int32Array.from({length:r.length/2},(d,h)=>h).sort((d,h)=>r[2*d]-r[2*h]||r[2*d+1]-r[2*h+1]);const c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[r[2*c],r[2*c+1],r[2*l],r[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=r.length/2;d<h;++d){const p=WE(r[2*d],r[2*d+1],f);r[2*d]=p[0],r[2*d+1]=p[1]}this._delaunator=new Fa(r)}else delete this.collinear;const i=this.halfedges=this._delaunator.halfedges,n=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),s=this._hullIndex.fill(-1);for(let c=0,l=i.length;c<l;++c){const u=o[c%3===2?c-2:c+1];(i[c]===-1||a[u]===-1)&&(a[u]=c)}for(let c=0,l=n.length;c<l;++c)s[n[c]]=c;n.length<=2&&n.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=n[0],a[n[0]]=1,n.length===2&&(a[n[1]]=0,this.triangles[1]=n[1],this.triangles[2]=n[1]))}voronoi(t){return new Xv(this,t)}*neighbors(t){const{inedges:r,hull:i,_hullIndex:n,halfedges:o,triangles:a,collinear:s}=this;if(s){const f=s.indexOf(t);f>0&&(yield s[f-1]),f<s.length-1&&(yield s[f+1]);return}const c=r[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=a[l],l=l%3===2?l-2:l+1,a[l]!==t)return;if(l=o[l],l===-1){const f=i[(n[t]+1)%i.length];f!==u&&(yield f);return}}while(l!==c)}find(t,r,i=0){if(t=+t,t!==t||(r=+r,r!==r))return-1;const n=i;let o;for(;(o=this._step(i,t,r))>=0&&o!==i&&o!==n;)i=o;return o}_step(t,r,i){const{inedges:n,hull:o,_hullIndex:a,halfedges:s,triangles:c,points:l}=this;if(n[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=xr(r-l[t*2],2)+xr(i-l[t*2+1],2);const d=n[t];let h=d;do{let p=c[h];const g=xr(r-l[p*2],2)+xr(i-l[p*2+1],2);if(g<f&&(f=g,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=s[h],h===-1){if(h=o[(a[t]+1)%o.length],h!==p&&xr(r-l[h*2],2)+xr(i-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){const r=t==null?t=new Bn:void 0,{points:i,halfedges:n,triangles:o}=this;for(let a=0,s=n.length;a<s;++a){const c=n[a];if(c<a)continue;const l=o[a]*2,u=o[c]*2;t.moveTo(i[l],i[l+1]),t.lineTo(i[u],i[u+1])}return this.renderHull(t),r&&r.value()}renderPoints(t,r){r===void 0&&(!t||typeof t.moveTo!="function")&&(r=t,t=null),r=r==null?2:+r;const i=t==null?t=new Bn:void 0,{points:n}=this;for(let o=0,a=n.length;o<a;o+=2){const s=n[o],c=n[o+1];t.moveTo(s+r,c),t.arc(s,c,r,0,FE)}return i&&i.value()}renderHull(t){const r=t==null?t=new Bn:void 0,{hull:i,points:n}=this,o=i[0]*2,a=i.length;t.moveTo(n[o],n[o+1]);for(let s=1;s<a;++s){const c=2*i[s];t.lineTo(n[c],n[c+1])}return t.closePath(),r&&r.value()}hullPolygon(){const t=new Kc;return this.renderHull(t),t.value()}renderTriangle(t,r){const i=r==null?r=new Bn:void 0,{points:n,triangles:o}=this,a=o[t*=3]*2,s=o[t+1]*2,c=o[t+2]*2;return r.moveTo(n[a],n[a+1]),r.lineTo(n[s],n[s+1]),r.lineTo(n[c],n[c+1]),r.closePath(),i&&i.value()}*trianglePolygons(){const{triangles:t}=this;for(let r=0,i=t.length/3;r<i;++r)yield this.trianglePolygon(r)}trianglePolygon(t){const r=new Kc;return this.renderTriangle(t,r),r.value()}}function qE(e,t,r,i){const n=e.length,o=new Float64Array(n*2);for(let a=0;a<n;++a){const s=e[a];o[a*2]=t.call(i,s,a,e),o[a*2+1]=r.call(i,s,a,e)}return o}function*GE(e,t,r,i){let n=0;for(const o of e)yield t.call(i,o,n,e),yield r.call(i,o,n,e),++n}var Zh={},Hl={},Xl=34,yi=10,Jl=13;function Jv(e){return new Function("d","return {"+e.map(function(t,r){return JSON.stringify(t)+": d["+r+'] || ""'}).join(",")+"}")}function YE(e,t){var r=Jv(e);return function(i,n){return t(r(i),n,e)}}function Bh(e){var t=Object.create(null),r=[];return e.forEach(function(i){for(var n in i)n in t||r.push(t[n]=n)}),r}function it(e,t){var r=e+"",i=r.length;return i<t?new Array(t-i+1).join(0)+r:r}function HE(e){return e<0?"-"+it(-e,6):e>9999?"+"+it(e,6):it(e,4)}function XE(e){var t=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),n=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":HE(e.getUTCFullYear())+"-"+it(e.getUTCMonth()+1,2)+"-"+it(e.getUTCDate(),2)+(n?"T"+it(t,2)+":"+it(r,2)+":"+it(i,2)+"."+it(n,3)+"Z":i?"T"+it(t,2)+":"+it(r,2)+":"+it(i,2)+"Z":r||t?"T"+it(t,2)+":"+it(r,2)+"Z":"")}function Ls(e){var t=new RegExp('["'+e+`
18
16
  \r]`),r=e.charCodeAt(0);function i(f,d){var h,p,g=n(f,function(v,b){if(h)return h(v,b-1);p=v,h=d?YE(v,d):Jv(v)});return g.columns=p||[],g}function n(f,d){var h=[],p=f.length,g=0,v=0,b,_=p<=0,x=!1;f.charCodeAt(p-1)===yi&&--p,f.charCodeAt(p-1)===Jl&&--p;function y(){if(_)return Hl;if(x)return x=!1,Zh;var S,k=g,N;if(f.charCodeAt(k)===Xl){for(;g++<p&&f.charCodeAt(g)!==Xl||f.charCodeAt(++g)===Xl;);return(S=g)>=p?_=!0:(N=f.charCodeAt(g++))===yi?x=!0:N===Jl&&(x=!0,f.charCodeAt(g)===yi&&++g),f.slice(k+1,S-1).replace(/""/g,'"')}for(;g<p;){if((N=f.charCodeAt(S=g++))===yi)x=!0;else if(N===Jl)x=!0,f.charCodeAt(g)===yi&&++g;else if(N!==r)continue;return f.slice(k,S)}return _=!0,f.slice(k,p)}for(;(b=y())!==Hl;){for(var w=[];b!==Zh&&b!==Hl;)w.push(b),b=y();d&&(w=d(w,v++))==null||h.push(w)}return h}function o(f,d){return f.map(function(h){return d.map(function(p){return u(h[p])}).join(e)})}function a(f,d){return d==null&&(d=Bh(f)),[d.map(u).join(e)].concat(o(f,d)).join(`
19
17
  `)}function s(f,d){return d==null&&(d=Bh(f)),o(f,d).join(`
package/dist/elements.js CHANGED
@@ -7316,10 +7316,8 @@ ${ZE.map((e) => `- ${e}`).join(`
7316
7316
  function VE(e) {
7317
7317
  return e ? `
7318
7318
  ${Th}
7319
-
7320
-
7321
7319
 
7322
- User System Prompt:
7320
+ User-provided System Prompt:
7323
7321
  ${e}` : Th;
7324
7322
  }
7325
7323
  const dV = ({
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gram-ai/elements",
3
3
  "description": "Gram Elements is a library of UI primitives for building chat-like experiences for MCP Servers.",
4
4
  "type": "module",
5
- "version": "1.8.0",
5
+ "version": "1.8.1",
6
6
  "main": "dist/index.js",
7
7
  "exports": {
8
8
  ".": {