@modelcontextprotocol/server-wiki-explorer 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp-app.html +20 -20
- package/dist/server.js +115 -112
- package/package.json +1 -1
package/dist/mcp-app.html
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<meta name="color-scheme" content="light dark">
|
|
7
7
|
<title>Wiki Explorer</title>
|
|
8
|
-
<script type="module" crossorigin>var Ku=Object.defineProperty;var Yu=(e,n,r)=>n in e?Ku(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var be=(e,n,r)=>Yu(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function r(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(o){if(o.ep)return;o.ep=!0;const s=r(o);fetch(o.href,s)}})();function A(e,n,r){function i(u,c){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),n(u,c);const l=a.prototype,h=Object.keys(l);for(let f=0;f<h.length;f++){const d=h[f];d in u||(u[d]=l[d].bind(u))}}const o=(r==null?void 0:r.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(u){var c;const l=r!=null&&r.Parent?new s:this;i(l,u),(c=l._zod).deferred??(c.deferred=[]);for(const h of l._zod.deferred)h();return l}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var c,l;return r!=null&&r.Parent&&u instanceof r.Parent?!0:(l=(c=u==null?void 0:u._zod)==null?void 0:c.traits)==null?void 0:l.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Mt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ns extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}const Ds={};function mt(e){return Ds}function js(e){const n=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,o])=>n.indexOf(+i)===-1).map(([i,o])=>o)}function Ur(e,n){return typeof n=="bigint"?n.toString():n}function dr(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function hi(e){return e==null}function di(e){const n=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(n,r)}function Qu(e,n){const r=(e.toString().split(".")[1]||"").length,i=n.toString();let o=(i.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(i)){const c=i.match(/\d?e-(\d?)/);c!=null&&c[1]&&(o=Number.parseInt(c[1]))}const s=r>o?r:o,a=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(n.toFixed(s).replace(".",""));return a%u/10**s}const uo=Symbol("evaluating");function Q(e,n,r){let i;Object.defineProperty(e,n,{get(){if(i!==uo)return i===void 0&&(i=uo,i=r()),i},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function Et(e,n,r){Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!0,configurable:!0})}function yt(...e){const n={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(n,i)}return Object.defineProperties({},n)}function co(e){return JSON.stringify(e)}function ec(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Zs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const tc=dr(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function Dt(e){if(cn(e)===!1)return!1;const n=e.constructor;if(n===void 0||typeof n!="function")return!0;const r=n.prototype;return!(cn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function qs(e){return Dt(e)?{...e}:Array.isArray(e)?[...e]:e}const nc=new Set(["string","number","symbol"]);function jt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vt(e,n,r){const i=new e._zod.constr(n??e._zod.def);return(!n||r!=null&&r.parent)&&(i._zod.parent=e),i}function Z(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if((n==null?void 0:n.message)!==void 0){if((n==null?void 0:n.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function rc(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}const ic={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function oc(e,n){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=yt(e._zod.def,{get shape(){const a={};for(const u in n){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(a[u]=r.shape[u])}return Et(this,"shape",a),a},checks:[]});return vt(e,s)}function sc(e,n){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=yt(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const u in n){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);n[u]&&delete a[u]}return Et(this,"shape",a),a},checks:[]});return vt(e,s)}function ac(e,n){if(!Dt(n))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const s=e._zod.def.shape;for(const a in n)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=yt(e._zod.def,{get shape(){const s={...e._zod.def.shape,...n};return Et(this,"shape",s),s}});return vt(e,o)}function uc(e,n){if(!Dt(n))throw new Error("Invalid input to safeExtend: expected a plain object");const r=yt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n};return Et(this,"shape",i),i}});return vt(e,r)}function cc(e,n){const r=yt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n._zod.def.shape};return Et(this,"shape",i),i},get catchall(){return n._zod.def.catchall},checks:[]});return vt(e,r)}function lc(e,n,r){const o=n._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=yt(n._zod.def,{get shape(){const u=n._zod.def.shape,c={...u};if(r)for(const l in r){if(!(l in u))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(c[l]=e?new e({type:"optional",innerType:u[l]}):u[l])}else for(const l in u)c[l]=e?new e({type:"optional",innerType:u[l]}):u[l];return Et(this,"shape",c),c},checks:[]});return vt(n,a)}function fc(e,n,r){const i=yt(n._zod.def,{get shape(){const o=n._zod.def.shape,s={...o};if(r)for(const a in r){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return Et(this,"shape",s),s}});return vt(n,i)}function $t(e,n=0){var r;if(e.aborted===!0)return!0;for(let i=n;i<e.issues.length;i++)if(((r=e.issues[i])==null?void 0:r.continue)!==!0)return!0;return!1}function It(e,n){return n.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function $n(e){return typeof e=="string"?e:e==null?void 0:e.message}function _t(e,n,r){var o,s,a,u,c,l;const i={...e,path:e.path??[]};if(!e.message){const h=$n((a=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,e))??$n((u=n==null?void 0:n.error)==null?void 0:u.call(n,e))??$n((c=r.customError)==null?void 0:c.call(r,e))??$n((l=r.localeError)==null?void 0:l.call(r,e))??"Invalid input";i.message=h}return delete i.inst,delete i.continue,n!=null&&n.reportInput||delete i.input,i}function pi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ln(...e){const[n,r,i]=e;return typeof n=="string"?{message:n,code:"custom",input:r,inst:i}:{...n}}const Us=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,Ur,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ls=A("$ZodError",Us),Fs=A("$ZodError",Us,{Parent:Error});function hc(e,n=r=>r.message){const r={},i=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(n(o))):i.push(n(o));return{formErrors:i,fieldErrors:r}}function dc(e,n=r=>r.message){const r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>i({issues:a}));else if(s.code==="invalid_key")i({issues:s.issues});else if(s.code==="invalid_element")i({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,u=0;for(;u<s.path.length;){const c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return i(e),r}const gi=e=>(n,r,i,o)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new Mt;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(c=>_t(c,s,mt())));throw Zs(u,o==null?void 0:o.callee),u}return a.value},mi=e=>async(n,r,i,o)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(c=>_t(c,s,mt())));throw Zs(u,o==null?void 0:o.callee),u}return a.value},pr=e=>(n,r,i)=>{const o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Mt;return s.issues.length?{success:!1,error:new(e??Ls)(s.issues.map(a=>_t(a,o,mt())))}:{success:!0,data:s.value}},Hs=pr(Fs),gr=e=>async(n,r,i)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let s=n._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>_t(a,o,mt())))}:{success:!0,data:s.value}},pc=gr(Fs),gc=e=>(n,r,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return gi(e)(n,r,o)},mc=e=>(n,r,i)=>gi(e)(n,r,i),_c=e=>async(n,r,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return mi(e)(n,r,o)},yc=e=>async(n,r,i)=>mi(e)(n,r,i),vc=e=>(n,r,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return pr(e)(n,r,o)},bc=e=>(n,r,i)=>pr(e)(n,r,i),wc=e=>async(n,r,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return gr(e)(n,r,o)},xc=e=>async(n,r,i)=>gr(e)(n,r,i),kc=/^[cC][^\s-]{8,}$/,Sc=/^[0-9a-z]+$/,zc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Tc=/^[0-9a-vA-V]{20}$/,Cc=/^[A-Za-z0-9]{27}$/,Pc=/^[a-zA-Z0-9_-]{21}$/,Ec=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ac=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Rc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$c="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ic(){return new RegExp($c,"u")}const Mc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Oc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Nc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Dc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vs=/^[A-Za-z0-9_-]*$/,Zc=/^\+[1-9]\d{6,14}$/,Bs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",qc=new RegExp(`^${Bs}$`);function Ws(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${n}`:e.precision===0?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Uc(e){return new RegExp(`^${Ws(e)}$`)}function Lc(e){const n=Ws({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${n}(?:${r.join("|")})`;return new RegExp(`^${Bs}T(?:${i})$`)}const Fc=e=>{const n=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},Hc=/^-?\d+$/,Js=/^-?\d+(?:\.\d+)?$/,Vc=/^(?:true|false)$/i,Bc=/^null$/i,Wc=/^undefined$/i,Jc=/^[^A-Z]*$/,Gc=/^[^a-z]*$/,Ce=A("$ZodCheck",(e,n)=>{var r;e._zod??(e._zod={}),e._zod.def=n,(r=e._zod).onattach??(r.onattach=[])}),Gs={number:"number",bigint:"bigint",object:"date"},Xs=A("$ZodCheckLessThan",(e,n)=>{Ce.init(e,n);const r=Gs[typeof n.value];e._zod.onattach.push(i=>{const o=i._zod.bag,s=(n.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;n.value<s&&(n.inclusive?o.maximum=n.value:o.exclusiveMaximum=n.value)}),e._zod.check=i=>{(n.inclusive?i.value<=n.value:i.value<n.value)||i.issues.push({origin:r,code:"too_big",maximum:typeof n.value=="object"?n.value.getTime():n.value,input:i.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Ks=A("$ZodCheckGreaterThan",(e,n)=>{Ce.init(e,n);const r=Gs[typeof n.value];e._zod.onattach.push(i=>{const o=i._zod.bag,s=(n.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;n.value>s&&(n.inclusive?o.minimum=n.value:o.exclusiveMinimum=n.value)}),e._zod.check=i=>{(n.inclusive?i.value>=n.value:i.value>n.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof n.value=="object"?n.value.getTime():n.value,input:i.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Xc=A("$ZodCheckMultipleOf",(e,n)=>{Ce.init(e,n),e._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=n.value)}),e._zod.check=r=>{if(typeof r.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%n.value===BigInt(0):Qu(r.value,n.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:n.value,input:r.value,inst:e,continue:!n.abort})}}),Kc=A("$ZodCheckNumberFormat",(e,n)=>{var a;Ce.init(e,n),n.format=n.format||"float64";const r=(a=n.format)==null?void 0:a.includes("int"),i=r?"int":"number",[o,s]=ic[n.format];e._zod.onattach.push(u=>{const c=u._zod.bag;c.format=n.format,c.minimum=o,c.maximum=s,r&&(c.pattern=Hc)}),e._zod.check=u=>{const c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:i,format:n.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!n.abort}):u.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!n.abort});return}}c<o&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!n.abort}),c>s&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!n.abort})}}),Yc=A("$ZodCheckMaxLength",(e,n)=>{var r;Ce.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<o&&(i._zod.bag.maximum=n.maximum)}),e._zod.check=i=>{const o=i.value;if(o.length<=n.maximum)return;const a=pi(o);i.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Qc=A("$ZodCheckMinLength",(e,n)=>{var r;Ce.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>o&&(i._zod.bag.minimum=n.minimum)}),e._zod.check=i=>{const o=i.value;if(o.length>=n.minimum)return;const a=pi(o);i.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),el=A("$ZodCheckLengthEquals",(e,n)=>{var r;Ce.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=n.length,o.maximum=n.length,o.length=n.length}),e._zod.check=i=>{const o=i.value,s=o.length;if(s===n.length)return;const a=pi(o),u=s>n.length;i.issues.push({origin:a,...u?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!n.abort})}}),mr=A("$ZodCheckStringFormat",(e,n)=>{var r,i;Ce.init(e,n),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=n.format,n.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(n.pattern))}),n.pattern?(r=e._zod).check??(r.check=o=>{n.pattern.lastIndex=0,!n.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:n.format,input:o.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(i=e._zod).check??(i.check=()=>{})}),tl=A("$ZodCheckRegex",(e,n)=>{mr.init(e,n),e._zod.check=r=>{n.pattern.lastIndex=0,!n.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),nl=A("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=Jc),mr.init(e,n)}),rl=A("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=Gc),mr.init(e,n)}),il=A("$ZodCheckIncludes",(e,n)=>{Ce.init(e,n);const r=jt(n.includes),i=new RegExp(typeof n.position=="number"?`^.{${n.position}}${r}`:r);n.pattern=i,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),e._zod.check=o=>{o.value.includes(n.includes,n.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:o.value,inst:e,continue:!n.abort})}}),ol=A("$ZodCheckStartsWith",(e,n)=>{Ce.init(e,n);const r=new RegExp(`^${jt(n.prefix)}.*`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(n.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:i.value,inst:e,continue:!n.abort})}}),sl=A("$ZodCheckEndsWith",(e,n)=>{Ce.init(e,n);const r=new RegExp(`.*${jt(n.suffix)}$`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(n.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:i.value,inst:e,continue:!n.abort})}}),al=A("$ZodCheckOverwrite",(e,n)=>{Ce.init(e,n),e._zod.check=r=>{r.value=n.tx(r.value)}});class ul{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const i=n.split(`
|
|
8
|
+
<script type="module" crossorigin>var Yu=Object.defineProperty;var Qu=(e,n,r)=>n in e?Yu(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var be=(e,n,r)=>Qu(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function r(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(o){if(o.ep)return;o.ep=!0;const s=r(o);fetch(o.href,s)}})();function A(e,n,r){function i(u,c){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),n(u,c);const l=a.prototype,h=Object.keys(l);for(let f=0;f<h.length;f++){const d=h[f];d in u||(u[d]=l[d].bind(u))}}const o=(r==null?void 0:r.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(u){var c;const l=r!=null&&r.Parent?new s:this;i(l,u),(c=l._zod).deferred??(c.deferred=[]);for(const h of l._zod.deferred)h();return l}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var c,l;return r!=null&&r.Parent&&u instanceof r.Parent?!0:(l=(c=u==null?void 0:u._zod)==null?void 0:c.traits)==null?void 0:l.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Mt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class js extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}const Zs={};function mt(e){return Zs}function qs(e){const n=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,o])=>n.indexOf(+i)===-1).map(([i,o])=>o)}function Ur(e,n){return typeof n=="bigint"?n.toString():n}function dr(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function hi(e){return e==null}function di(e){const n=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(n,r)}function ec(e,n){const r=(e.toString().split(".")[1]||"").length,i=n.toString();let o=(i.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(i)){const c=i.match(/\d?e-(\d?)/);c!=null&&c[1]&&(o=Number.parseInt(c[1]))}const s=r>o?r:o,a=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(n.toFixed(s).replace(".",""));return a%u/10**s}const co=Symbol("evaluating");function Q(e,n,r){let i;Object.defineProperty(e,n,{get(){if(i!==co)return i===void 0&&(i=co,i=r()),i},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function Et(e,n,r){Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!0,configurable:!0})}function yt(...e){const n={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(n,i)}return Object.defineProperties({},n)}function lo(e){return JSON.stringify(e)}function tc(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Us="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const nc=dr(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function Dt(e){if(cn(e)===!1)return!1;const n=e.constructor;if(n===void 0||typeof n!="function")return!0;const r=n.prototype;return!(cn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ls(e){return Dt(e)?{...e}:Array.isArray(e)?[...e]:e}const rc=new Set(["string","number","symbol"]);function jt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vt(e,n,r){const i=new e._zod.constr(n??e._zod.def);return(!n||r!=null&&r.parent)&&(i._zod.parent=e),i}function Z(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if((n==null?void 0:n.message)!==void 0){if((n==null?void 0:n.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function ic(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}const oc={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sc(e,n){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=yt(e._zod.def,{get shape(){const a={};for(const u in n){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(a[u]=r.shape[u])}return Et(this,"shape",a),a},checks:[]});return vt(e,s)}function ac(e,n){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=yt(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const u in n){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);n[u]&&delete a[u]}return Et(this,"shape",a),a},checks:[]});return vt(e,s)}function uc(e,n){if(!Dt(n))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const s=e._zod.def.shape;for(const a in n)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=yt(e._zod.def,{get shape(){const s={...e._zod.def.shape,...n};return Et(this,"shape",s),s}});return vt(e,o)}function cc(e,n){if(!Dt(n))throw new Error("Invalid input to safeExtend: expected a plain object");const r=yt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n};return Et(this,"shape",i),i}});return vt(e,r)}function lc(e,n){const r=yt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n._zod.def.shape};return Et(this,"shape",i),i},get catchall(){return n._zod.def.catchall},checks:[]});return vt(e,r)}function fc(e,n,r){const o=n._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=yt(n._zod.def,{get shape(){const u=n._zod.def.shape,c={...u};if(r)for(const l in r){if(!(l in u))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(c[l]=e?new e({type:"optional",innerType:u[l]}):u[l])}else for(const l in u)c[l]=e?new e({type:"optional",innerType:u[l]}):u[l];return Et(this,"shape",c),c},checks:[]});return vt(n,a)}function hc(e,n,r){const i=yt(n._zod.def,{get shape(){const o=n._zod.def.shape,s={...o};if(r)for(const a in r){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return Et(this,"shape",s),s}});return vt(n,i)}function $t(e,n=0){var r;if(e.aborted===!0)return!0;for(let i=n;i<e.issues.length;i++)if(((r=e.issues[i])==null?void 0:r.continue)!==!0)return!0;return!1}function It(e,n){return n.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function $n(e){return typeof e=="string"?e:e==null?void 0:e.message}function _t(e,n,r){var o,s,a,u,c,l;const i={...e,path:e.path??[]};if(!e.message){const h=$n((a=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,e))??$n((u=n==null?void 0:n.error)==null?void 0:u.call(n,e))??$n((c=r.customError)==null?void 0:c.call(r,e))??$n((l=r.localeError)==null?void 0:l.call(r,e))??"Invalid input";i.message=h}return delete i.inst,delete i.continue,n!=null&&n.reportInput||delete i.input,i}function pi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ln(...e){const[n,r,i]=e;return typeof n=="string"?{message:n,code:"custom",input:r,inst:i}:{...n}}const Fs=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,Ur,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Hs=A("$ZodError",Fs),Vs=A("$ZodError",Fs,{Parent:Error});function dc(e,n=r=>r.message){const r={},i=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(n(o))):i.push(n(o));return{formErrors:i,fieldErrors:r}}function pc(e,n=r=>r.message){const r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>i({issues:a}));else if(s.code==="invalid_key")i({issues:s.issues});else if(s.code==="invalid_element")i({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,u=0;for(;u<s.path.length;){const c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return i(e),r}const gi=e=>(n,r,i,o)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new Mt;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(c=>_t(c,s,mt())));throw Us(u,o==null?void 0:o.callee),u}return a.value},mi=e=>async(n,r,i,o)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(c=>_t(c,s,mt())));throw Us(u,o==null?void 0:o.callee),u}return a.value},pr=e=>(n,r,i)=>{const o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Mt;return s.issues.length?{success:!1,error:new(e??Hs)(s.issues.map(a=>_t(a,o,mt())))}:{success:!0,data:s.value}},Bs=pr(Vs),gr=e=>async(n,r,i)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let s=n._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>_t(a,o,mt())))}:{success:!0,data:s.value}},gc=gr(Vs),mc=e=>(n,r,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return gi(e)(n,r,o)},_c=e=>(n,r,i)=>gi(e)(n,r,i),yc=e=>async(n,r,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return mi(e)(n,r,o)},vc=e=>async(n,r,i)=>mi(e)(n,r,i),bc=e=>(n,r,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return pr(e)(n,r,o)},wc=e=>(n,r,i)=>pr(e)(n,r,i),xc=e=>async(n,r,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return gr(e)(n,r,o)},kc=e=>async(n,r,i)=>gr(e)(n,r,i),Sc=/^[cC][^\s-]{8,}$/,zc=/^[0-9a-z]+$/,Tc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cc=/^[0-9a-vA-V]{20}$/,Pc=/^[A-Za-z0-9]{27}$/,Ec=/^[a-zA-Z0-9_-]{21}$/,Ac=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,fo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,$c=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ic="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mc(){return new RegExp(Ic,"u")}const Oc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Dc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,jc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Zc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ws=/^[A-Za-z0-9_-]*$/,qc=/^\+[1-9]\d{6,14}$/,Gs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Uc=new RegExp(`^${Gs}$`);function Js(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${n}`:e.precision===0?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Lc(e){return new RegExp(`^${Js(e)}$`)}function Fc(e){const n=Js({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${n}(?:${r.join("|")})`;return new RegExp(`^${Gs}T(?:${i})$`)}const Hc=e=>{const n=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},Vc=/^-?\d+$/,Xs=/^-?\d+(?:\.\d+)?$/,Bc=/^(?:true|false)$/i,Wc=/^null$/i,Gc=/^undefined$/i,Jc=/^[^A-Z]*$/,Xc=/^[^a-z]*$/,Ce=A("$ZodCheck",(e,n)=>{var r;e._zod??(e._zod={}),e._zod.def=n,(r=e._zod).onattach??(r.onattach=[])}),Ks={number:"number",bigint:"bigint",object:"date"},Ys=A("$ZodCheckLessThan",(e,n)=>{Ce.init(e,n);const r=Ks[typeof n.value];e._zod.onattach.push(i=>{const o=i._zod.bag,s=(n.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;n.value<s&&(n.inclusive?o.maximum=n.value:o.exclusiveMaximum=n.value)}),e._zod.check=i=>{(n.inclusive?i.value<=n.value:i.value<n.value)||i.issues.push({origin:r,code:"too_big",maximum:typeof n.value=="object"?n.value.getTime():n.value,input:i.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Qs=A("$ZodCheckGreaterThan",(e,n)=>{Ce.init(e,n);const r=Ks[typeof n.value];e._zod.onattach.push(i=>{const o=i._zod.bag,s=(n.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;n.value>s&&(n.inclusive?o.minimum=n.value:o.exclusiveMinimum=n.value)}),e._zod.check=i=>{(n.inclusive?i.value>=n.value:i.value>n.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof n.value=="object"?n.value.getTime():n.value,input:i.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Kc=A("$ZodCheckMultipleOf",(e,n)=>{Ce.init(e,n),e._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=n.value)}),e._zod.check=r=>{if(typeof r.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%n.value===BigInt(0):ec(r.value,n.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:n.value,input:r.value,inst:e,continue:!n.abort})}}),Yc=A("$ZodCheckNumberFormat",(e,n)=>{var a;Ce.init(e,n),n.format=n.format||"float64";const r=(a=n.format)==null?void 0:a.includes("int"),i=r?"int":"number",[o,s]=oc[n.format];e._zod.onattach.push(u=>{const c=u._zod.bag;c.format=n.format,c.minimum=o,c.maximum=s,r&&(c.pattern=Vc)}),e._zod.check=u=>{const c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:i,format:n.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!n.abort}):u.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!n.abort});return}}c<o&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!n.abort}),c>s&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!n.abort})}}),Qc=A("$ZodCheckMaxLength",(e,n)=>{var r;Ce.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<o&&(i._zod.bag.maximum=n.maximum)}),e._zod.check=i=>{const o=i.value;if(o.length<=n.maximum)return;const a=pi(o);i.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),el=A("$ZodCheckMinLength",(e,n)=>{var r;Ce.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>o&&(i._zod.bag.minimum=n.minimum)}),e._zod.check=i=>{const o=i.value;if(o.length>=n.minimum)return;const a=pi(o);i.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),tl=A("$ZodCheckLengthEquals",(e,n)=>{var r;Ce.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=n.length,o.maximum=n.length,o.length=n.length}),e._zod.check=i=>{const o=i.value,s=o.length;if(s===n.length)return;const a=pi(o),u=s>n.length;i.issues.push({origin:a,...u?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!n.abort})}}),mr=A("$ZodCheckStringFormat",(e,n)=>{var r,i;Ce.init(e,n),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=n.format,n.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(n.pattern))}),n.pattern?(r=e._zod).check??(r.check=o=>{n.pattern.lastIndex=0,!n.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:n.format,input:o.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(i=e._zod).check??(i.check=()=>{})}),nl=A("$ZodCheckRegex",(e,n)=>{mr.init(e,n),e._zod.check=r=>{n.pattern.lastIndex=0,!n.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),rl=A("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=Jc),mr.init(e,n)}),il=A("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=Xc),mr.init(e,n)}),ol=A("$ZodCheckIncludes",(e,n)=>{Ce.init(e,n);const r=jt(n.includes),i=new RegExp(typeof n.position=="number"?`^.{${n.position}}${r}`:r);n.pattern=i,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),e._zod.check=o=>{o.value.includes(n.includes,n.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:o.value,inst:e,continue:!n.abort})}}),sl=A("$ZodCheckStartsWith",(e,n)=>{Ce.init(e,n);const r=new RegExp(`^${jt(n.prefix)}.*`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(n.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:i.value,inst:e,continue:!n.abort})}}),al=A("$ZodCheckEndsWith",(e,n)=>{Ce.init(e,n);const r=new RegExp(`.*${jt(n.suffix)}$`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(n.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:i.value,inst:e,continue:!n.abort})}}),ul=A("$ZodCheckOverwrite",(e,n)=>{Ce.init(e,n),e._zod.check=r=>{r.value=n.tx(r.value)}});class cl{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const i=n.split(`
|
|
9
9
|
`).filter(a=>a),o=Math.min(...i.map(a=>a.length-a.trimStart().length)),s=i.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const n=Function,r=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new n(...r,o.join(`
|
|
10
|
-
`))}}const cl={major:4,minor:3,patch:5},ae=A("$ZodType",(e,n)=>{var o;var r;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=cl;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const s of i)for(const a of s._zod.onattach)a(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,c,l)=>{let h=$t(u),f;for(const d of c){if(d._zod.def.when){if(!d._zod.def.when(u))continue}else if(h)continue;const p=u.issues.length,g=d._zod.check(u);if(g instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Mt;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,u.issues.length!==p&&(h||(h=$t(u,p)))});else{if(u.issues.length===p)continue;h||(h=$t(u,p))}}return f?f.then(()=>u):u},a=(u,c,l)=>{if($t(u))return u.aborted=!0,u;const h=s(c,i,l);if(h instanceof Promise){if(l.async===!1)throw new Mt;return h.then(f=>e._zod.parse(f,l))}return e._zod.parse(h,l)};e._zod.run=(u,c)=>{if(c.skipChecks)return e._zod.parse(u,c);if(c.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(f=>a(f,u,c)):a(h,u,c)}const l=e._zod.parse(u,c);if(l instanceof Promise){if(c.async===!1)throw new Mt;return l.then(h=>s(h,i,c))}return s(l,i,c)}}Q(e,"~standard",()=>({validate:s=>{var a;try{const u=Hs(e,s);return u.success?{value:u.data}:{issues:(a=u.error)==null?void 0:a.issues}}catch{return pc(e,s).then(c=>{var l;return c.success?{value:c.data}:{issues:(l=c.error)==null?void 0:l.issues}})}},vendor:"zod",version:1}))}),_i=A("$ZodString",(e,n)=>{var r;ae.init(e,n),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??Fc(e._zod.bag),e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),fe=A("$ZodStringFormat",(e,n)=>{mr.init(e,n),_i.init(e,n)}),ll=A("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=Ac),fe.init(e,n)}),fl=A("$ZodUUID",(e,n)=>{if(n.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(i===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=lo(i))}else n.pattern??(n.pattern=lo());fe.init(e,n)}),hl=A("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=Rc),fe.init(e,n)}),dl=A("$ZodURL",(e,n)=>{fe.init(e,n),e._zod.check=r=>{try{const i=r.value.trim(),o=new URL(i);n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:r.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:r.value,inst:e,continue:!n.abort})),n.normalize?r.value=o.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!n.abort})}}}),pl=A("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=Ic()),fe.init(e,n)}),gl=A("$ZodNanoID",(e,n)=>{n.pattern??(n.pattern=Pc),fe.init(e,n)}),ml=A("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=kc),fe.init(e,n)}),_l=A("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=Sc),fe.init(e,n)}),yl=A("$ZodULID",(e,n)=>{n.pattern??(n.pattern=zc),fe.init(e,n)}),vl=A("$ZodXID",(e,n)=>{n.pattern??(n.pattern=Tc),fe.init(e,n)}),bl=A("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=Cc),fe.init(e,n)}),wl=A("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Lc(n)),fe.init(e,n)}),xl=A("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=qc),fe.init(e,n)}),kl=A("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=Uc(n)),fe.init(e,n)}),Sl=A("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=Ec),fe.init(e,n)}),zl=A("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=Mc),fe.init(e,n),e._zod.bag.format="ipv4"}),Tl=A("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=Oc),fe.init(e,n),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!n.abort})}}}),Cl=A("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=Nc),fe.init(e,n)}),Pl=A("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=Dc),fe.init(e,n),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[o,s]=i;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!n.abort})}}});function Ys(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const El=A("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=jc),fe.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ys(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!n.abort})}});function Al(e){if(!Vs.test(e))return!1;const n=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return Ys(r)}const Rl=A("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=Vs),fe.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Al(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!n.abort})}}),$l=A("$ZodE164",(e,n)=>{n.pattern??(n.pattern=Zc),fe.init(e,n)});function Il(e,n=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||n&&(!("alg"in o)||o.alg!==n))}catch{return!1}}const Ml=A("$ZodJWT",(e,n)=>{fe.init(e,n),e._zod.check=r=>{Il(r.value,n.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!n.abort})}}),Qs=A("$ZodNumber",(e,n)=>{ae.init(e,n),e._zod.pattern=e._zod.bag.pattern??Js,e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Ol=A("$ZodNumberFormat",(e,n)=>{Kc.init(e,n),Qs.init(e,n)}),Nl=A("$ZodBoolean",(e,n)=>{ae.init(e,n),e._zod.pattern=Vc,e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Dl=A("$ZodUndefined",(e,n)=>{ae.init(e,n),e._zod.pattern=Wc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,i)=>{const o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),jl=A("$ZodNull",(e,n)=>{ae.init(e,n),e._zod.pattern=Bc,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{const o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Zl=A("$ZodUnknown",(e,n)=>{ae.init(e,n),e._zod.parse=r=>r}),ql=A("$ZodNever",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function fo(e,n,r){e.issues.length&&n.issues.push(...It(r,e.issues)),n.value[r]=e.value}const Ul=A("$ZodArray",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let a=0;a<o.length;a++){const u=o[a],c=n.element._zod.run({value:u,issues:[]},i);c instanceof Promise?s.push(c.then(l=>fo(l,r,a))):fo(c,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function Gn(e,n,r,i,o){if(e.issues.length){if(o&&!(r in i))return;n.issues.push(...It(r,e.issues))}e.value===void 0?r in i&&(n.value[r]=void 0):n.value[r]=e.value}function ea(e){var i,o,s,a;const n=Object.keys(e.shape);for(const u of n)if(!((a=(s=(o=(i=e.shape)==null?void 0:i[u])==null?void 0:o._zod)==null?void 0:s.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const r=rc(e.shape);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function ta(e,n,r,i,o,s){const a=[],u=o.keySet,c=o.catchall._zod,l=c.def.type,h=c.optout==="optional";for(const f in n){if(u.has(f))continue;if(l==="never"){a.push(f);continue}const d=c.run({value:n[f],issues:[]},i);d instanceof Promise?e.push(d.then(p=>Gn(p,r,f,n,h))):Gn(d,r,f,n,h)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:n,inst:s}),e.length?Promise.all(e).then(()=>r):r}const Ll=A("$ZodObject",(e,n)=>{ae.init(e,n);const r=Object.getOwnPropertyDescriptor(n,"shape");if(!(r!=null&&r.get)){const u=n.shape;Object.defineProperty(n,"shape",{get:()=>{const c={...u};return Object.defineProperty(n,"shape",{value:c}),c}})}const i=dr(()=>ea(n));Q(e._zod,"propValues",()=>{const u=n.shape,c={};for(const l in u){const h=u[l]._zod;if(h.values){c[l]??(c[l]=new Set);for(const f of h.values)c[l].add(f)}}return c});const o=cn,s=n.catchall;let a;e._zod.parse=(u,c)=>{a??(a=i.value);const l=u.value;if(!o(l))return u.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),u;u.value={};const h=[],f=a.shape;for(const d of a.keys){const p=f[d],g=p._zod.optout==="optional",_=p._zod.run({value:l[d],issues:[]},c);_ instanceof Promise?h.push(_.then(y=>Gn(y,u,d,l,g))):Gn(_,u,d,l,g)}return s?ta(h,l,u,c,i.value,e):h.length?Promise.all(h).then(()=>u):u}}),Fl=A("$ZodObjectJIT",(e,n)=>{Ll.init(e,n);const r=e._zod.parse,i=dr(()=>ea(n)),o=d=>{var C;const p=new ul(["shape","payload","ctx"]),g=i.value,_=b=>{const v=co(b);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};p.write("const input = payload.value;");const y=Object.create(null);let m=0;for(const b of g.keys)y[b]=`key_${m++}`;p.write("const newResult = {};");for(const b of g.keys){const v=y[b],k=co(b),x=d[b],P=((C=x==null?void 0:x._zod)==null?void 0:C.optout)==="optional";p.write(`const ${v} = ${_(b)};`),P?p.write(`
|
|
10
|
+
`))}}const ll={major:4,minor:3,patch:5},ae=A("$ZodType",(e,n)=>{var o;var r;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=ll;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const s of i)for(const a of s._zod.onattach)a(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,c,l)=>{let h=$t(u),f;for(const d of c){if(d._zod.def.when){if(!d._zod.def.when(u))continue}else if(h)continue;const p=u.issues.length,g=d._zod.check(u);if(g instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Mt;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,u.issues.length!==p&&(h||(h=$t(u,p)))});else{if(u.issues.length===p)continue;h||(h=$t(u,p))}}return f?f.then(()=>u):u},a=(u,c,l)=>{if($t(u))return u.aborted=!0,u;const h=s(c,i,l);if(h instanceof Promise){if(l.async===!1)throw new Mt;return h.then(f=>e._zod.parse(f,l))}return e._zod.parse(h,l)};e._zod.run=(u,c)=>{if(c.skipChecks)return e._zod.parse(u,c);if(c.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(f=>a(f,u,c)):a(h,u,c)}const l=e._zod.parse(u,c);if(l instanceof Promise){if(c.async===!1)throw new Mt;return l.then(h=>s(h,i,c))}return s(l,i,c)}}Q(e,"~standard",()=>({validate:s=>{var a;try{const u=Bs(e,s);return u.success?{value:u.data}:{issues:(a=u.error)==null?void 0:a.issues}}catch{return gc(e,s).then(c=>{var l;return c.success?{value:c.data}:{issues:(l=c.error)==null?void 0:l.issues}})}},vendor:"zod",version:1}))}),_i=A("$ZodString",(e,n)=>{var r;ae.init(e,n),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??Hc(e._zod.bag),e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),fe=A("$ZodStringFormat",(e,n)=>{mr.init(e,n),_i.init(e,n)}),fl=A("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=Rc),fe.init(e,n)}),hl=A("$ZodUUID",(e,n)=>{if(n.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(i===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=fo(i))}else n.pattern??(n.pattern=fo());fe.init(e,n)}),dl=A("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=$c),fe.init(e,n)}),pl=A("$ZodURL",(e,n)=>{fe.init(e,n),e._zod.check=r=>{try{const i=r.value.trim(),o=new URL(i);n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:r.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:r.value,inst:e,continue:!n.abort})),n.normalize?r.value=o.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!n.abort})}}}),gl=A("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=Mc()),fe.init(e,n)}),ml=A("$ZodNanoID",(e,n)=>{n.pattern??(n.pattern=Ec),fe.init(e,n)}),_l=A("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=Sc),fe.init(e,n)}),yl=A("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=zc),fe.init(e,n)}),vl=A("$ZodULID",(e,n)=>{n.pattern??(n.pattern=Tc),fe.init(e,n)}),bl=A("$ZodXID",(e,n)=>{n.pattern??(n.pattern=Cc),fe.init(e,n)}),wl=A("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=Pc),fe.init(e,n)}),xl=A("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Fc(n)),fe.init(e,n)}),kl=A("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=Uc),fe.init(e,n)}),Sl=A("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=Lc(n)),fe.init(e,n)}),zl=A("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=Ac),fe.init(e,n)}),Tl=A("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=Oc),fe.init(e,n),e._zod.bag.format="ipv4"}),Cl=A("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=Nc),fe.init(e,n),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!n.abort})}}}),Pl=A("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=Dc),fe.init(e,n)}),El=A("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=jc),fe.init(e,n),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[o,s]=i;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!n.abort})}}});function ea(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Al=A("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=Zc),fe.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{ea(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!n.abort})}});function Rl(e){if(!Ws.test(e))return!1;const n=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return ea(r)}const $l=A("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=Ws),fe.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Rl(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!n.abort})}}),Il=A("$ZodE164",(e,n)=>{n.pattern??(n.pattern=qc),fe.init(e,n)});function Ml(e,n=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||n&&(!("alg"in o)||o.alg!==n))}catch{return!1}}const Ol=A("$ZodJWT",(e,n)=>{fe.init(e,n),e._zod.check=r=>{Ml(r.value,n.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!n.abort})}}),ta=A("$ZodNumber",(e,n)=>{ae.init(e,n),e._zod.pattern=e._zod.bag.pattern??Xs,e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Nl=A("$ZodNumberFormat",(e,n)=>{Yc.init(e,n),ta.init(e,n)}),Dl=A("$ZodBoolean",(e,n)=>{ae.init(e,n),e._zod.pattern=Bc,e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),jl=A("$ZodUndefined",(e,n)=>{ae.init(e,n),e._zod.pattern=Gc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,i)=>{const o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Zl=A("$ZodNull",(e,n)=>{ae.init(e,n),e._zod.pattern=Wc,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{const o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),ql=A("$ZodUnknown",(e,n)=>{ae.init(e,n),e._zod.parse=r=>r}),Ul=A("$ZodNever",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ho(e,n,r){e.issues.length&&n.issues.push(...It(r,e.issues)),n.value[r]=e.value}const Ll=A("$ZodArray",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let a=0;a<o.length;a++){const u=o[a],c=n.element._zod.run({value:u,issues:[]},i);c instanceof Promise?s.push(c.then(l=>ho(l,r,a))):ho(c,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function Jn(e,n,r,i,o){if(e.issues.length){if(o&&!(r in i))return;n.issues.push(...It(r,e.issues))}e.value===void 0?r in i&&(n.value[r]=void 0):n.value[r]=e.value}function na(e){var i,o,s,a;const n=Object.keys(e.shape);for(const u of n)if(!((a=(s=(o=(i=e.shape)==null?void 0:i[u])==null?void 0:o._zod)==null?void 0:s.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const r=ic(e.shape);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function ra(e,n,r,i,o,s){const a=[],u=o.keySet,c=o.catchall._zod,l=c.def.type,h=c.optout==="optional";for(const f in n){if(u.has(f))continue;if(l==="never"){a.push(f);continue}const d=c.run({value:n[f],issues:[]},i);d instanceof Promise?e.push(d.then(p=>Jn(p,r,f,n,h))):Jn(d,r,f,n,h)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:n,inst:s}),e.length?Promise.all(e).then(()=>r):r}const Fl=A("$ZodObject",(e,n)=>{ae.init(e,n);const r=Object.getOwnPropertyDescriptor(n,"shape");if(!(r!=null&&r.get)){const u=n.shape;Object.defineProperty(n,"shape",{get:()=>{const c={...u};return Object.defineProperty(n,"shape",{value:c}),c}})}const i=dr(()=>na(n));Q(e._zod,"propValues",()=>{const u=n.shape,c={};for(const l in u){const h=u[l]._zod;if(h.values){c[l]??(c[l]=new Set);for(const f of h.values)c[l].add(f)}}return c});const o=cn,s=n.catchall;let a;e._zod.parse=(u,c)=>{a??(a=i.value);const l=u.value;if(!o(l))return u.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),u;u.value={};const h=[],f=a.shape;for(const d of a.keys){const p=f[d],g=p._zod.optout==="optional",_=p._zod.run({value:l[d],issues:[]},c);_ instanceof Promise?h.push(_.then(y=>Jn(y,u,d,l,g))):Jn(_,u,d,l,g)}return s?ra(h,l,u,c,i.value,e):h.length?Promise.all(h).then(()=>u):u}}),Hl=A("$ZodObjectJIT",(e,n)=>{Fl.init(e,n);const r=e._zod.parse,i=dr(()=>na(n)),o=d=>{var C;const p=new cl(["shape","payload","ctx"]),g=i.value,_=b=>{const v=lo(b);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};p.write("const input = payload.value;");const y=Object.create(null);let m=0;for(const b of g.keys)y[b]=`key_${m++}`;p.write("const newResult = {};");for(const b of g.keys){const v=y[b],k=lo(b),x=d[b],P=((C=x==null?void 0:x._zod)==null?void 0:C.optout)==="optional";p.write(`const ${v} = ${_(b)};`),P?p.write(`
|
|
11
11
|
if (${v}.issues.length) {
|
|
12
12
|
if (${k} in input) {
|
|
13
13
|
payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
newResult[${k}] = ${v}.value;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");const w=p.compile();return(b,v)=>w(d,b,v)};let s;const a=cn,u=!Ds.jitless,l=u&&tc.value,h=n.catchall;let f;e._zod.parse=(d,p)=>{f??(f=i.value);const g=d.value;return a(g)?u&&l&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(s||(s=o(n.shape)),d=s(d,p),h?ta([],g,d,p,f,e):d):r(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),d)}});function ho(e,n,r,i){for(const s of e)if(s.issues.length===0)return n.value=s.value,n;const o=e.filter(s=>!$t(s));return o.length===1?(n.value=o[0].value,o[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:r,errors:e.map(s=>s.issues.map(a=>_t(a,i,mt())))}),n)}const na=A("$ZodUnion",(e,n)=>{ae.init(e,n),Q(e._zod,"optin",()=>n.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Q(e._zod,"optout",()=>n.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Q(e._zod,"values",()=>{if(n.options.every(o=>o._zod.values))return new Set(n.options.flatMap(o=>Array.from(o._zod.values)))}),Q(e._zod,"pattern",()=>{if(n.options.every(o=>o._zod.pattern)){const o=n.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>di(s.source)).join("|")})$`)}});const r=n.options.length===1,i=n.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return i(o,s);let a=!1;const u=[];for(const c of n.options){const l=c._zod.run({value:o.value,issues:[]},s);if(l instanceof Promise)u.push(l),a=!0;else{if(l.issues.length===0)return l;u.push(l)}}return a?Promise.all(u).then(c=>ho(c,o,e,s)):ho(u,o,e,s)}}),Hl=A("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,na.init(e,n);const r=e._zod.parse;Q(e._zod,"propValues",()=>{const o={};for(const s of n.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(s)}"`);for(const[u,c]of Object.entries(a)){o[u]||(o[u]=new Set);for(const l of c)o[u].add(l)}}return o});const i=dr(()=>{var a;const o=n.options,s=new Map;for(const u of o){const c=(a=u._zod.propValues)==null?void 0:a[n.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(u)}"`);for(const l of c){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,u)}}return s});e._zod.parse=(o,s)=>{const a=o.value;if(!cn(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const u=i.value.get(a==null?void 0:a[n.discriminator]);return u?u._zod.run(o,s):n.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,input:a,path:[n.discriminator],inst:e}),o)}}),Vl=A("$ZodIntersection",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>{const o=r.value,s=n.left._zod.run({value:o,issues:[]},i),a=n.right._zod.run({value:o,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([c,l])=>po(r,c,l)):po(r,s,a)}});function Lr(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(Dt(e)&&Dt(n)){const r=Object.keys(n),i=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...n};for(const s of i){const a=Lr(e[s],n[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<e.length;i++){const o=e[i],s=n[i],a=Lr(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function po(e,n,r){const i=new Map;let o;for(const u of n.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const c of u.keys)i.has(c)||i.set(c,{}),i.get(c).l=!0}else e.issues.push(u);for(const u of r.issues)if(u.code==="unrecognized_keys")for(const c of u.keys)i.has(c)||i.set(c,{}),i.get(c).r=!0;else e.issues.push(u);const s=[...i].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&e.issues.push({...o,keys:s}),$t(e))return e;const a=Lr(n.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Bl=A("$ZodRecord",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>{const o=r.value;if(!Dt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[],a=n.keyType._zod.values;if(a){r.value={};const u=new Set;for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){u.add(typeof l=="number"?l.toString():l);const h=n.valueType._zod.run({value:o[l],issues:[]},i);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...It(l,f.issues)),r.value[l]=f.value})):(h.issues.length&&r.issues.push(...It(l,h.issues)),r.value[l]=h.value)}let c;for(const l in o)u.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let c=n.keyType._zod.run({value:u,issues:[]},i);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Js.test(u)&&c.issues.length&&c.issues.some(f=>f.code==="invalid_type"&&f.expected==="number")){const f=n.keyType._zod.run({value:Number(u),issues:[]},i);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){n.mode==="loose"?r.value[u]=o[u]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>_t(f,i,mt())),input:u,path:[u],inst:e});continue}const h=n.valueType._zod.run({value:o[u],issues:[]},i);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...It(u,f.issues)),r.value[c.value]=f.value})):(h.issues.length&&r.issues.push(...It(u,h.issues)),r.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Wl=A("$ZodEnum",(e,n)=>{ae.init(e,n);const r=js(n.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(o=>nc.has(typeof o)).map(o=>typeof o=="string"?jt(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const a=o.value;return i.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),Jl=A("$ZodLiteral",(e,n)=>{if(ae.init(e,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(n.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.values.map(i=>typeof i=="string"?jt(i):i?jt(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,o)=>{const s=i.value;return r.has(s)||i.issues.push({code:"invalid_value",values:n.values,input:s,inst:e}),i}}),Gl=A("$ZodTransform",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Ns(e.constructor.name);const o=n.transform(r.value,r);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new Mt;return r.value=o,r}});function go(e,n){return e.issues.length&&n===void 0?{issues:[],value:void 0}:e}const ra=A("$ZodOptional",(e,n)=>{ae.init(e,n),e._zod.optin="optional",e._zod.optout="optional",Q(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),Q(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${di(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(n.innerType._zod.optin==="optional"){const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>go(s,r.value)):go(o,r.value)}return r.value===void 0?r:n.innerType._zod.run(r,i)}}),Xl=A("$ZodExactOptional",(e,n)=>{ra.init(e,n),Q(e._zod,"values",()=>n.innerType._zod.values),Q(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(r,i)=>n.innerType._zod.run(r,i)}),Kl=A("$ZodNullable",(e,n)=>{ae.init(e,n),Q(e._zod,"optin",()=>n.innerType._zod.optin),Q(e._zod,"optout",()=>n.innerType._zod.optout),Q(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${di(r.source)}|null)$`):void 0}),Q(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:n.innerType._zod.run(r,i)}),Yl=A("$ZodDefault",(e,n)=>{ae.init(e,n),e._zod.optin="optional",Q(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);if(r.value===void 0)return r.value=n.defaultValue,r;const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>mo(s,n)):mo(o,n)}});function mo(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const Ql=A("$ZodPrefault",(e,n)=>{ae.init(e,n),e._zod.optin="optional",Q(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=n.defaultValue),n.innerType._zod.run(r,i))}),ef=A("$ZodNonOptional",(e,n)=>{ae.init(e,n),Q(e._zod,"values",()=>{const r=n.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(r,i)=>{const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>_o(s,e)):_o(o,e)}});function _o(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const tf=A("$ZodCatch",(e,n)=>{ae.init(e,n),Q(e._zod,"optin",()=>n.innerType._zod.optin),Q(e._zod,"optout",()=>n.innerType._zod.optout),Q(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=n.catchValue({...r,error:{issues:s.issues.map(a=>_t(a,i,mt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=n.catchValue({...r,error:{issues:o.issues.map(s=>_t(s,i,mt()))},input:r.value}),r.issues=[]),r)}}),nf=A("$ZodPipe",(e,n)=>{ae.init(e,n),Q(e._zod,"values",()=>n.in._zod.values),Q(e._zod,"optin",()=>n.in._zod.optin),Q(e._zod,"optout",()=>n.out._zod.optout),Q(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){const s=n.out._zod.run(r,i);return s instanceof Promise?s.then(a=>In(a,n.in,i)):In(s,n.in,i)}const o=n.in._zod.run(r,i);return o instanceof Promise?o.then(s=>In(s,n.out,i)):In(o,n.out,i)}});function In(e,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},r)}const rf=A("$ZodReadonly",(e,n)=>{ae.init(e,n),Q(e._zod,"propValues",()=>n.innerType._zod.propValues),Q(e._zod,"values",()=>n.innerType._zod.values),Q(e._zod,"optin",()=>{var r,i;return(i=(r=n.innerType)==null?void 0:r._zod)==null?void 0:i.optin}),Q(e._zod,"optout",()=>{var r,i;return(i=(r=n.innerType)==null?void 0:r._zod)==null?void 0:i.optout}),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(yo):yo(o)}});function yo(e){return e.value=Object.freeze(e.value),e}const of=A("$ZodCustom",(e,n)=>{Ce.init(e,n),ae.init(e,n),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,o=n.fn(i);if(o instanceof Promise)return o.then(s=>vo(s,r,i,e));vo(o,r,i,e)}});function vo(e,n,r,i){if(!e){const o={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(o.params=i._zod.def.params),n.issues.push(ln(o))}}var bo;class sf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...r){const i=r[0];return this._map.set(n,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const r=this._map.get(n);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(n),this}get(n){const r=n._zod.parent;if(r){const i={...this.get(r)??{}};delete i.id;const o={...i,...this._map.get(n)};return Object.keys(o).length?o:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function af(){return new sf}(bo=globalThis).__zod_globalRegistry??(bo.__zod_globalRegistry=af());const Qt=globalThis.__zod_globalRegistry;function uf(e,n){return new e({type:"string",...Z(n)})}function cf(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Z(n)})}function wo(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Z(n)})}function lf(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(n)})}function ff(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(n)})}function hf(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(n)})}function df(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(n)})}function pf(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Z(n)})}function gf(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(n)})}function mf(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(n)})}function _f(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(n)})}function yf(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(n)})}function vf(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(n)})}function bf(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Z(n)})}function wf(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(n)})}function xf(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(n)})}function kf(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(n)})}function Sf(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(n)})}function zf(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(n)})}function Tf(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Z(n)})}function Cf(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(n)})}function Pf(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Z(n)})}function Ef(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(n)})}function Af(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(n)})}function Rf(e,n){return new e({type:"string",format:"date",check:"string_format",...Z(n)})}function $f(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...Z(n)})}function If(e,n){return new e({type:"string",format:"duration",check:"string_format",...Z(n)})}function Mf(e,n){return new e({type:"number",checks:[],...Z(n)})}function Of(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(n)})}function Nf(e,n){return new e({type:"boolean",...Z(n)})}function Df(e,n){return new e({type:"undefined",...Z(n)})}function jf(e,n){return new e({type:"null",...Z(n)})}function Zf(e){return new e({type:"unknown"})}function qf(e,n){return new e({type:"never",...Z(n)})}function xo(e,n){return new Xs({check:"less_than",...Z(n),value:e,inclusive:!1})}function Pr(e,n){return new Xs({check:"less_than",...Z(n),value:e,inclusive:!0})}function ko(e,n){return new Ks({check:"greater_than",...Z(n),value:e,inclusive:!1})}function Er(e,n){return new Ks({check:"greater_than",...Z(n),value:e,inclusive:!0})}function So(e,n){return new Xc({check:"multiple_of",...Z(n),value:e})}function ia(e,n){return new Yc({check:"max_length",...Z(n),maximum:e})}function Xn(e,n){return new Qc({check:"min_length",...Z(n),minimum:e})}function oa(e,n){return new el({check:"length_equals",...Z(n),length:e})}function Uf(e,n){return new tl({check:"string_format",format:"regex",...Z(n),pattern:e})}function Lf(e){return new nl({check:"string_format",format:"lowercase",...Z(e)})}function Ff(e){return new rl({check:"string_format",format:"uppercase",...Z(e)})}function Hf(e,n){return new il({check:"string_format",format:"includes",...Z(n),includes:e})}function Vf(e,n){return new ol({check:"string_format",format:"starts_with",...Z(n),prefix:e})}function Bf(e,n){return new sl({check:"string_format",format:"ends_with",...Z(n),suffix:e})}function Ft(e){return new al({check:"overwrite",tx:e})}function Wf(e){return Ft(n=>n.normalize(e))}function Jf(){return Ft(e=>e.trim())}function Gf(){return Ft(e=>e.toLowerCase())}function Xf(){return Ft(e=>e.toUpperCase())}function Kf(){return Ft(e=>ec(e))}function Yf(e,n,r){return new e({type:"array",element:n,...Z(r)})}function Qf(e,n,r){const i=Z(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:n,...i})}function eh(e,n,r){return new e({type:"custom",check:"custom",fn:n,...Z(r)})}function th(e){const n=nh(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(ln(i,r.value,n._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(ln(o))}},e(r.value,r)));return n}function nh(e,n){const r=new Ce({check:"custom",...Z(n)});return r._zod.check=e,r}function sa(e){let n=(e==null?void 0:e.target)??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Qt,target:n,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function ge(e,n,r={path:[],schemaPath:[]}){var h,f;var i;const o=e._zod.def,s=n.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};n.seen.set(e,a);const u=(f=(h=e._zod).toJSONSchema)==null?void 0:f.call(h);if(u)a.schema=u;else{const d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,a.schema,d);else{const g=a.schema,_=n.processors[o.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);_(e,n,g,d)}const p=e._zod.parent;p&&(a.ref||(a.ref=p),ge(p,n,d),n.seen.get(p).isParent=!0)}const c=n.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),n.io==="input"&&xe(e)&&(delete a.schema.examples,delete a.schema.default),n.io==="input"&&a.schema._prefault&&((i=a.schema).default??(i.default=a.schema._prefault)),delete a.schema._prefault,n.seen.get(e).schema}function aa(e,n){var a,u,c,l;const r=e.seen.get(n);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const h of e.seen.entries()){const f=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(f){const d=i.get(f);if(d&&d!==h[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(f,h[0])}}const o=h=>{var _;const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=(_=e.external.registry.get(h[0]))==null?void 0:_.id,m=e.external.uri??(C=>C);if(y)return{ref:m(y)};const w=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=w,{defId:w,ref:`${m("__shared")}#/${f}/${w}`}}if(h[1]===r)return{ref:"#"};const p=`#/${f}/`,g=h[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:p+g}},s=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:d,defId:p}=o(h);f.def={...f.schema},p&&(f.defId=p);const g=f.schema;for(const _ in g)delete g[_];g.$ref=d};if(e.cycles==="throw")for(const h of e.seen.entries()){const f=h[1];if(f.cycle)throw new Error(`Cycle detected: #/${(u=f.cycle)==null?void 0:u.join("/")}/<root>
|
|
44
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");const w=p.compile();return(b,v)=>w(d,b,v)};let s;const a=cn,u=!Zs.jitless,l=u&&nc.value,h=n.catchall;let f;e._zod.parse=(d,p)=>{f??(f=i.value);const g=d.value;return a(g)?u&&l&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(s||(s=o(n.shape)),d=s(d,p),h?ra([],g,d,p,f,e):d):r(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),d)}});function po(e,n,r,i){for(const s of e)if(s.issues.length===0)return n.value=s.value,n;const o=e.filter(s=>!$t(s));return o.length===1?(n.value=o[0].value,o[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:r,errors:e.map(s=>s.issues.map(a=>_t(a,i,mt())))}),n)}const ia=A("$ZodUnion",(e,n)=>{ae.init(e,n),Q(e._zod,"optin",()=>n.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Q(e._zod,"optout",()=>n.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Q(e._zod,"values",()=>{if(n.options.every(o=>o._zod.values))return new Set(n.options.flatMap(o=>Array.from(o._zod.values)))}),Q(e._zod,"pattern",()=>{if(n.options.every(o=>o._zod.pattern)){const o=n.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>di(s.source)).join("|")})$`)}});const r=n.options.length===1,i=n.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return i(o,s);let a=!1;const u=[];for(const c of n.options){const l=c._zod.run({value:o.value,issues:[]},s);if(l instanceof Promise)u.push(l),a=!0;else{if(l.issues.length===0)return l;u.push(l)}}return a?Promise.all(u).then(c=>po(c,o,e,s)):po(u,o,e,s)}}),Vl=A("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,ia.init(e,n);const r=e._zod.parse;Q(e._zod,"propValues",()=>{const o={};for(const s of n.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(s)}"`);for(const[u,c]of Object.entries(a)){o[u]||(o[u]=new Set);for(const l of c)o[u].add(l)}}return o});const i=dr(()=>{var a;const o=n.options,s=new Map;for(const u of o){const c=(a=u._zod.propValues)==null?void 0:a[n.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(u)}"`);for(const l of c){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,u)}}return s});e._zod.parse=(o,s)=>{const a=o.value;if(!cn(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const u=i.value.get(a==null?void 0:a[n.discriminator]);return u?u._zod.run(o,s):n.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,input:a,path:[n.discriminator],inst:e}),o)}}),Bl=A("$ZodIntersection",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>{const o=r.value,s=n.left._zod.run({value:o,issues:[]},i),a=n.right._zod.run({value:o,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([c,l])=>go(r,c,l)):go(r,s,a)}});function Lr(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(Dt(e)&&Dt(n)){const r=Object.keys(n),i=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...n};for(const s of i){const a=Lr(e[s],n[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<e.length;i++){const o=e[i],s=n[i],a=Lr(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function go(e,n,r){const i=new Map;let o;for(const u of n.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const c of u.keys)i.has(c)||i.set(c,{}),i.get(c).l=!0}else e.issues.push(u);for(const u of r.issues)if(u.code==="unrecognized_keys")for(const c of u.keys)i.has(c)||i.set(c,{}),i.get(c).r=!0;else e.issues.push(u);const s=[...i].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&e.issues.push({...o,keys:s}),$t(e))return e;const a=Lr(n.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Wl=A("$ZodRecord",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>{const o=r.value;if(!Dt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[],a=n.keyType._zod.values;if(a){r.value={};const u=new Set;for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){u.add(typeof l=="number"?l.toString():l);const h=n.valueType._zod.run({value:o[l],issues:[]},i);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...It(l,f.issues)),r.value[l]=f.value})):(h.issues.length&&r.issues.push(...It(l,h.issues)),r.value[l]=h.value)}let c;for(const l in o)u.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let c=n.keyType._zod.run({value:u,issues:[]},i);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Xs.test(u)&&c.issues.length&&c.issues.some(f=>f.code==="invalid_type"&&f.expected==="number")){const f=n.keyType._zod.run({value:Number(u),issues:[]},i);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){n.mode==="loose"?r.value[u]=o[u]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>_t(f,i,mt())),input:u,path:[u],inst:e});continue}const h=n.valueType._zod.run({value:o[u],issues:[]},i);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...It(u,f.issues)),r.value[c.value]=f.value})):(h.issues.length&&r.issues.push(...It(u,h.issues)),r.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Gl=A("$ZodEnum",(e,n)=>{ae.init(e,n);const r=qs(n.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(o=>rc.has(typeof o)).map(o=>typeof o=="string"?jt(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const a=o.value;return i.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),Jl=A("$ZodLiteral",(e,n)=>{if(ae.init(e,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(n.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.values.map(i=>typeof i=="string"?jt(i):i?jt(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,o)=>{const s=i.value;return r.has(s)||i.issues.push({code:"invalid_value",values:n.values,input:s,inst:e}),i}}),Xl=A("$ZodTransform",(e,n)=>{ae.init(e,n),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new js(e.constructor.name);const o=n.transform(r.value,r);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new Mt;return r.value=o,r}});function mo(e,n){return e.issues.length&&n===void 0?{issues:[],value:void 0}:e}const oa=A("$ZodOptional",(e,n)=>{ae.init(e,n),e._zod.optin="optional",e._zod.optout="optional",Q(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),Q(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${di(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(n.innerType._zod.optin==="optional"){const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>mo(s,r.value)):mo(o,r.value)}return r.value===void 0?r:n.innerType._zod.run(r,i)}}),Kl=A("$ZodExactOptional",(e,n)=>{oa.init(e,n),Q(e._zod,"values",()=>n.innerType._zod.values),Q(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(r,i)=>n.innerType._zod.run(r,i)}),Yl=A("$ZodNullable",(e,n)=>{ae.init(e,n),Q(e._zod,"optin",()=>n.innerType._zod.optin),Q(e._zod,"optout",()=>n.innerType._zod.optout),Q(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${di(r.source)}|null)$`):void 0}),Q(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:n.innerType._zod.run(r,i)}),Ql=A("$ZodDefault",(e,n)=>{ae.init(e,n),e._zod.optin="optional",Q(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);if(r.value===void 0)return r.value=n.defaultValue,r;const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>_o(s,n)):_o(o,n)}});function _o(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const ef=A("$ZodPrefault",(e,n)=>{ae.init(e,n),e._zod.optin="optional",Q(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=n.defaultValue),n.innerType._zod.run(r,i))}),tf=A("$ZodNonOptional",(e,n)=>{ae.init(e,n),Q(e._zod,"values",()=>{const r=n.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(r,i)=>{const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>yo(s,e)):yo(o,e)}});function yo(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const nf=A("$ZodCatch",(e,n)=>{ae.init(e,n),Q(e._zod,"optin",()=>n.innerType._zod.optin),Q(e._zod,"optout",()=>n.innerType._zod.optout),Q(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=n.catchValue({...r,error:{issues:s.issues.map(a=>_t(a,i,mt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=n.catchValue({...r,error:{issues:o.issues.map(s=>_t(s,i,mt()))},input:r.value}),r.issues=[]),r)}}),rf=A("$ZodPipe",(e,n)=>{ae.init(e,n),Q(e._zod,"values",()=>n.in._zod.values),Q(e._zod,"optin",()=>n.in._zod.optin),Q(e._zod,"optout",()=>n.out._zod.optout),Q(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){const s=n.out._zod.run(r,i);return s instanceof Promise?s.then(a=>In(a,n.in,i)):In(s,n.in,i)}const o=n.in._zod.run(r,i);return o instanceof Promise?o.then(s=>In(s,n.out,i)):In(o,n.out,i)}});function In(e,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},r)}const of=A("$ZodReadonly",(e,n)=>{ae.init(e,n),Q(e._zod,"propValues",()=>n.innerType._zod.propValues),Q(e._zod,"values",()=>n.innerType._zod.values),Q(e._zod,"optin",()=>{var r,i;return(i=(r=n.innerType)==null?void 0:r._zod)==null?void 0:i.optin}),Q(e._zod,"optout",()=>{var r,i;return(i=(r=n.innerType)==null?void 0:r._zod)==null?void 0:i.optout}),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(vo):vo(o)}});function vo(e){return e.value=Object.freeze(e.value),e}const sf=A("$ZodCustom",(e,n)=>{Ce.init(e,n),ae.init(e,n),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,o=n.fn(i);if(o instanceof Promise)return o.then(s=>bo(s,r,i,e));bo(o,r,i,e)}});function bo(e,n,r,i){if(!e){const o={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(o.params=i._zod.def.params),n.issues.push(ln(o))}}var wo;class af{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...r){const i=r[0];return this._map.set(n,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const r=this._map.get(n);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(n),this}get(n){const r=n._zod.parent;if(r){const i={...this.get(r)??{}};delete i.id;const o={...i,...this._map.get(n)};return Object.keys(o).length?o:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function uf(){return new af}(wo=globalThis).__zod_globalRegistry??(wo.__zod_globalRegistry=uf());const Qt=globalThis.__zod_globalRegistry;function cf(e,n){return new e({type:"string",...Z(n)})}function lf(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Z(n)})}function xo(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Z(n)})}function ff(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(n)})}function hf(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(n)})}function df(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(n)})}function pf(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(n)})}function gf(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Z(n)})}function mf(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(n)})}function _f(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(n)})}function yf(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(n)})}function vf(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(n)})}function bf(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(n)})}function wf(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Z(n)})}function xf(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(n)})}function kf(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(n)})}function Sf(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(n)})}function zf(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(n)})}function Tf(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(n)})}function Cf(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Z(n)})}function Pf(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(n)})}function Ef(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Z(n)})}function Af(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(n)})}function Rf(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(n)})}function $f(e,n){return new e({type:"string",format:"date",check:"string_format",...Z(n)})}function If(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...Z(n)})}function Mf(e,n){return new e({type:"string",format:"duration",check:"string_format",...Z(n)})}function Of(e,n){return new e({type:"number",checks:[],...Z(n)})}function Nf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(n)})}function Df(e,n){return new e({type:"boolean",...Z(n)})}function jf(e,n){return new e({type:"undefined",...Z(n)})}function Zf(e,n){return new e({type:"null",...Z(n)})}function qf(e){return new e({type:"unknown"})}function Uf(e,n){return new e({type:"never",...Z(n)})}function ko(e,n){return new Ys({check:"less_than",...Z(n),value:e,inclusive:!1})}function Pr(e,n){return new Ys({check:"less_than",...Z(n),value:e,inclusive:!0})}function So(e,n){return new Qs({check:"greater_than",...Z(n),value:e,inclusive:!1})}function Er(e,n){return new Qs({check:"greater_than",...Z(n),value:e,inclusive:!0})}function zo(e,n){return new Kc({check:"multiple_of",...Z(n),value:e})}function sa(e,n){return new Qc({check:"max_length",...Z(n),maximum:e})}function Xn(e,n){return new el({check:"min_length",...Z(n),minimum:e})}function aa(e,n){return new tl({check:"length_equals",...Z(n),length:e})}function Lf(e,n){return new nl({check:"string_format",format:"regex",...Z(n),pattern:e})}function Ff(e){return new rl({check:"string_format",format:"lowercase",...Z(e)})}function Hf(e){return new il({check:"string_format",format:"uppercase",...Z(e)})}function Vf(e,n){return new ol({check:"string_format",format:"includes",...Z(n),includes:e})}function Bf(e,n){return new sl({check:"string_format",format:"starts_with",...Z(n),prefix:e})}function Wf(e,n){return new al({check:"string_format",format:"ends_with",...Z(n),suffix:e})}function Ft(e){return new ul({check:"overwrite",tx:e})}function Gf(e){return Ft(n=>n.normalize(e))}function Jf(){return Ft(e=>e.trim())}function Xf(){return Ft(e=>e.toLowerCase())}function Kf(){return Ft(e=>e.toUpperCase())}function Yf(){return Ft(e=>tc(e))}function Qf(e,n,r){return new e({type:"array",element:n,...Z(r)})}function eh(e,n,r){const i=Z(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:n,...i})}function th(e,n,r){return new e({type:"custom",check:"custom",fn:n,...Z(r)})}function nh(e){const n=rh(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(ln(i,r.value,n._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(ln(o))}},e(r.value,r)));return n}function rh(e,n){const r=new Ce({check:"custom",...Z(n)});return r._zod.check=e,r}function ua(e){let n=(e==null?void 0:e.target)??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Qt,target:n,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function ge(e,n,r={path:[],schemaPath:[]}){var h,f;var i;const o=e._zod.def,s=n.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};n.seen.set(e,a);const u=(f=(h=e._zod).toJSONSchema)==null?void 0:f.call(h);if(u)a.schema=u;else{const d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,a.schema,d);else{const g=a.schema,_=n.processors[o.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);_(e,n,g,d)}const p=e._zod.parent;p&&(a.ref||(a.ref=p),ge(p,n,d),n.seen.get(p).isParent=!0)}const c=n.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),n.io==="input"&&xe(e)&&(delete a.schema.examples,delete a.schema.default),n.io==="input"&&a.schema._prefault&&((i=a.schema).default??(i.default=a.schema._prefault)),delete a.schema._prefault,n.seen.get(e).schema}function ca(e,n){var a,u,c,l;const r=e.seen.get(n);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const h of e.seen.entries()){const f=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(f){const d=i.get(f);if(d&&d!==h[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(f,h[0])}}const o=h=>{var _;const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=(_=e.external.registry.get(h[0]))==null?void 0:_.id,m=e.external.uri??(C=>C);if(y)return{ref:m(y)};const w=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=w,{defId:w,ref:`${m("__shared")}#/${f}/${w}`}}if(h[1]===r)return{ref:"#"};const p=`#/${f}/`,g=h[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:p+g}},s=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:d,defId:p}=o(h);f.def={...f.schema},p&&(f.defId=p);const g=f.schema;for(const _ in g)delete g[_];g.$ref=d};if(e.cycles==="throw")for(const h of e.seen.entries()){const f=h[1];if(f.cycle)throw new Error(`Cycle detected: #/${(u=f.cycle)==null?void 0:u.join("/")}/<root>
|
|
45
45
|
|
|
46
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const f=h[1];if(n===h[0]){s(h);continue}if(e.external){const p=(c=e.external.registry.get(h[0]))==null?void 0:c.id;if(n!==h[0]&&p){s(h);continue}}if((l=e.metadataRegistry.get(h[0]))==null?void 0:l.id){s(h);continue}if(f.cycle){s(h);continue}if(f.count>1&&e.reused==="ref"){s(h);continue}}}function ua(e,n){var a,u,c;const r=e.seen.get(n);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=l=>{const h=e.seen.get(l);if(h.ref===null)return;const f=h.def??h.schema,d={...f},p=h.ref;if(h.ref=null,p){i(p);const _=e.seen.get(p),y=_.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(y)):Object.assign(f,y),Object.assign(f,d),l._zod.parent===p)for(const w in f)w==="$ref"||w==="allOf"||w in d||delete f[w];if(y.$ref)for(const w in f)w==="$ref"||w==="allOf"||w in _.def&&JSON.stringify(f[w])===JSON.stringify(_.def[w])&&delete f[w]}const g=l._zod.parent;if(g&&g!==p){i(g);const _=e.seen.get(g);if(_!=null&&_.schema.$ref&&(f.$ref=_.schema.$ref,_.def))for(const y in f)y==="$ref"||y==="allOf"||y in _.def&&JSON.stringify(f[y])===JSON.stringify(_.def[y])&&delete f[y]}e.override({zodSchema:l,jsonSchema:f,path:h.path??[]})};for(const l of[...e.seen.entries()].reverse())i(l[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const l=(u=e.external.registry.get(n))==null?void 0:u.id;if(!l)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(l)}Object.assign(o,r.def??r.schema);const s=((c=e.external)==null?void 0:c.defs)??{};for(const l of e.seen.entries()){const h=l[1];h.def&&h.defId&&(s[h.defId]=h.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const l=JSON.parse(JSON.stringify(o));return Object.defineProperty(l,"~standard",{value:{...n["~standard"],jsonSchema:{input:Kn(n,"input",e.processors),output:Kn(n,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function xe(e,n){const r=n??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return xe(i.element,r);if(i.type==="set")return xe(i.valueType,r);if(i.type==="lazy")return xe(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return xe(i.innerType,r);if(i.type==="intersection")return xe(i.left,r)||xe(i.right,r);if(i.type==="record"||i.type==="map")return xe(i.keyType,r)||xe(i.valueType,r);if(i.type==="pipe")return xe(i.in,r)||xe(i.out,r);if(i.type==="object"){for(const o in i.shape)if(xe(i.shape[o],r))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(xe(o,r))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(xe(o,r))return!0;return!!(i.rest&&xe(i.rest,r))}return!1}const rh=(e,n={})=>r=>{const i=sa({...r,processors:n});return ge(e,i),aa(i,e),ua(i,e)},Kn=(e,n,r={})=>i=>{const{libraryOptions:o,target:s}=i??{},a=sa({...o??{},target:s,io:n,processors:r});return ge(e,a),aa(a,e),ua(a,e)},ih={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oh=(e,n,r,i)=>{const o=r;o.type="string";const{minimum:s,maximum:a,format:u,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),u&&(o.format=ih[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),l&&(o.contentEncoding=l),c&&c.size>0){const h=[...c];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(f=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},sh=(e,n,r,i)=>{const o=r,{minimum:s,maximum:a,format:u,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof s=="number"&&(o.minimum=s,typeof h=="number"&&n.target!=="draft-04"&&(h>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof l=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l),typeof a=="number"&&(o.maximum=a,typeof l=="number"&&n.target!=="draft-04"&&(l<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},ah=(e,n,r,i)=>{r.type="boolean"},uh=(e,n,r,i)=>{n.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ch=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},lh=(e,n,r,i)=>{r.not={}},fh=(e,n,r,i)=>{},hh=(e,n,r,i)=>{const o=e._zod.def,s=js(o.entries);s.every(a=>typeof a=="number")&&(r.type="number"),s.every(a=>typeof a=="string")&&(r.type="string"),r.enum=s},dh=(e,n,r,i)=>{const o=e._zod.def,s=[];for(const a of o.values)if(a===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];r.type=a===null?"null":typeof a,n.target==="draft-04"||n.target==="openapi-3.0"?r.enum=[a]:r.const=a}else s.every(a=>typeof a=="number")&&(r.type="number"),s.every(a=>typeof a=="string")&&(r.type="string"),s.every(a=>typeof a=="boolean")&&(r.type="boolean"),s.every(a=>a===null)&&(r.type="null"),r.enum=s},ph=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},gh=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},mh=(e,n,r,i)=>{const o=r,s=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=ge(s.element,n,{...i,path:[...i.path,"items"]})},_h=(e,n,r,i)=>{var l;const o=r,s=e._zod.def;o.type="object",o.properties={};const a=s.shape;for(const h in a)o.properties[h]=ge(a[h],n,{...i,path:[...i.path,"properties",h]});const u=new Set(Object.keys(a)),c=new Set([...u].filter(h=>{const f=s.shape[h]._zod;return n.io==="input"?f.optin===void 0:f.optout===void 0}));c.size>0&&(o.required=Array.from(c)),((l=s.catchall)==null?void 0:l._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=ge(s.catchall,n,{...i,path:[...i.path,"additionalProperties"]})):n.io==="output"&&(o.additionalProperties=!1)},yh=(e,n,r,i)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((u,c)=>ge(u,n,{...i,path:[...i.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=a:r.anyOf=a},vh=(e,n,r,i)=>{const o=e._zod.def,s=ge(o.left,n,{...i,path:[...i.path,"allOf",0]}),a=ge(o.right,n,{...i,path:[...i.path,"allOf",1]}),u=l=>"allOf"in l&&Object.keys(l).length===1,c=[...u(s)?s.allOf:[s],...u(a)?a.allOf:[a]];r.allOf=c},bh=(e,n,r,i)=>{const o=r,s=e._zod.def;o.type="object";const a=s.keyType,u=a._zod.bag,c=u==null?void 0:u.patterns;if(s.mode==="loose"&&c&&c.size>0){const h=ge(s.valueType,n,{...i,path:[...i.path,"patternProperties","*"]});o.patternProperties={};for(const f of c)o.patternProperties[f.source]=h}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(o.propertyNames=ge(s.keyType,n,{...i,path:[...i.path,"propertyNames"]})),o.additionalProperties=ge(s.valueType,n,{...i,path:[...i.path,"additionalProperties"]});const l=a._zod.values;if(l){const h=[...l].filter(f=>typeof f=="string"||typeof f=="number");h.length>0&&(o.required=h)}},wh=(e,n,r,i)=>{const o=e._zod.def,s=ge(o.innerType,n,i),a=n.seen.get(e);n.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},xh=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType},kh=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Sh=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType,n.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},zh=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Th=(e,n,r,i)=>{const o=e._zod.def,s=n.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;ge(s,n,i);const a=n.seen.get(e);a.ref=s},Ch=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType,r.readOnly=!0},ca=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType};function yi(e){return!!e._zod}function la(e,n){return yi(e)?Hs(e,n):e.safeParse(n)}function Ph(e){var r,i;if(!e)return;let n;if(yi(e)?n=(i=(r=e._zod)==null?void 0:r.def)==null?void 0:i.shape:n=e.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Eh(e){var o;if(yi(e)){const a=(o=e._zod)==null?void 0:o.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const i=e.value;if(i!==void 0)return i}const Ah=A("ZodISODateTime",(e,n)=>{wl.init(e,n),de.init(e,n)});function fa(e){return Af(Ah,e)}const Rh=A("ZodISODate",(e,n)=>{xl.init(e,n),de.init(e,n)});function $h(e){return Rf(Rh,e)}const Ih=A("ZodISOTime",(e,n)=>{kl.init(e,n),de.init(e,n)});function Mh(e){return $f(Ih,e)}const Oh=A("ZodISODuration",(e,n)=>{Sl.init(e,n),de.init(e,n)});function Nh(e){return If(Oh,e)}const Dh=(e,n)=>{Ls.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>dc(e,r)},flatten:{value:r=>hc(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ur,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ur,2)}},isEmpty:{get(){return e.issues.length===0}}})},qe=A("ZodError",Dh,{Parent:Error}),jh=gi(qe),Zh=mi(qe),qh=pr(qe),Uh=gr(qe),Lh=gc(qe),Fh=mc(qe),Hh=_c(qe),Vh=yc(qe),Bh=vc(qe),Wh=bc(qe),Jh=wc(qe),Gh=xc(qe),ue=A("ZodType",(e,n)=>(ae.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:Kn(e,"input"),output:Kn(e,"output")}}),e.toJSONSchema=rh(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...r)=>e.clone(yt(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0}),e.with=e.check,e.clone=(r,i)=>vt(e,r,i),e.brand=()=>e,e.register=((r,i)=>(r.add(e,i),e)),e.parse=(r,i)=>jh(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>qh(e,r,i),e.parseAsync=async(r,i)=>Zh(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Uh(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>Lh(e,r,i),e.decode=(r,i)=>Fh(e,r,i),e.encodeAsync=async(r,i)=>Hh(e,r,i),e.decodeAsync=async(r,i)=>Vh(e,r,i),e.safeEncode=(r,i)=>Bh(e,r,i),e.safeDecode=(r,i)=>Wh(e,r,i),e.safeEncodeAsync=async(r,i)=>Jh(e,r,i),e.safeDecodeAsync=async(r,i)=>Gh(e,r,i),e.refine=(r,i)=>e.check(Ud(r,i)),e.superRefine=r=>e.check(Ld(r)),e.overwrite=r=>e.check(Ft(r)),e.optional=()=>pe(e),e.exactOptional=()=>Pd(e),e.nullable=()=>Co(e),e.nullish=()=>pe(Co(e)),e.nonoptional=r=>Md(e,r),e.array=()=>B(e),e.or=r=>G([e,r]),e.and=r=>vi(e,r),e.transform=r=>Vr(e,ya(r)),e.default=r=>Rd(e,r),e.prefault=r=>Id(e,r),e.catch=r=>Nd(e,r),e.pipe=r=>Vr(e,r),e.readonly=()=>Zd(e),e.describe=r=>{const i=e.clone();return Qt.add(i,{description:r}),i},Object.defineProperty(e,"description",{get(){var r;return(r=Qt.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Qt.get(e);const i=e.clone();return Qt.add(i,r[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),ha=A("_ZodString",(e,n)=>{_i.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(i,o,s)=>oh(e,i,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...i)=>e.check(Uf(...i)),e.includes=(...i)=>e.check(Hf(...i)),e.startsWith=(...i)=>e.check(Vf(...i)),e.endsWith=(...i)=>e.check(Bf(...i)),e.min=(...i)=>e.check(Xn(...i)),e.max=(...i)=>e.check(ia(...i)),e.length=(...i)=>e.check(oa(...i)),e.nonempty=(...i)=>e.check(Xn(1,...i)),e.lowercase=i=>e.check(Lf(i)),e.uppercase=i=>e.check(Ff(i)),e.trim=()=>e.check(Jf()),e.normalize=(...i)=>e.check(Wf(...i)),e.toLowerCase=()=>e.check(Gf()),e.toUpperCase=()=>e.check(Xf()),e.slugify=()=>e.check(Kf())}),Xh=A("ZodString",(e,n)=>{_i.init(e,n),ha.init(e,n),e.email=r=>e.check(cf(Kh,r)),e.url=r=>e.check(pf(Yh,r)),e.jwt=r=>e.check(Ef(dd,r)),e.emoji=r=>e.check(gf(Qh,r)),e.guid=r=>e.check(wo(zo,r)),e.uuid=r=>e.check(lf(Mn,r)),e.uuidv4=r=>e.check(ff(Mn,r)),e.uuidv6=r=>e.check(hf(Mn,r)),e.uuidv7=r=>e.check(df(Mn,r)),e.nanoid=r=>e.check(mf(ed,r)),e.guid=r=>e.check(wo(zo,r)),e.cuid=r=>e.check(_f(td,r)),e.cuid2=r=>e.check(yf(nd,r)),e.ulid=r=>e.check(vf(rd,r)),e.base64=r=>e.check(Tf(ld,r)),e.base64url=r=>e.check(Cf(fd,r)),e.xid=r=>e.check(bf(id,r)),e.ksuid=r=>e.check(wf(od,r)),e.ipv4=r=>e.check(xf(sd,r)),e.ipv6=r=>e.check(kf(ad,r)),e.cidrv4=r=>e.check(Sf(ud,r)),e.cidrv6=r=>e.check(zf(cd,r)),e.e164=r=>e.check(Pf(hd,r)),e.datetime=r=>e.check(fa(r)),e.date=r=>e.check($h(r)),e.time=r=>e.check(Mh(r)),e.duration=r=>e.check(Nh(r))});function T(e){return uf(Xh,e)}const de=A("ZodStringFormat",(e,n)=>{fe.init(e,n),ha.init(e,n)}),Kh=A("ZodEmail",(e,n)=>{hl.init(e,n),de.init(e,n)}),zo=A("ZodGUID",(e,n)=>{ll.init(e,n),de.init(e,n)}),Mn=A("ZodUUID",(e,n)=>{fl.init(e,n),de.init(e,n)}),Yh=A("ZodURL",(e,n)=>{dl.init(e,n),de.init(e,n)}),Qh=A("ZodEmoji",(e,n)=>{pl.init(e,n),de.init(e,n)}),ed=A("ZodNanoID",(e,n)=>{gl.init(e,n),de.init(e,n)}),td=A("ZodCUID",(e,n)=>{ml.init(e,n),de.init(e,n)}),nd=A("ZodCUID2",(e,n)=>{_l.init(e,n),de.init(e,n)}),rd=A("ZodULID",(e,n)=>{yl.init(e,n),de.init(e,n)}),id=A("ZodXID",(e,n)=>{vl.init(e,n),de.init(e,n)}),od=A("ZodKSUID",(e,n)=>{bl.init(e,n),de.init(e,n)}),sd=A("ZodIPv4",(e,n)=>{zl.init(e,n),de.init(e,n)}),ad=A("ZodIPv6",(e,n)=>{Tl.init(e,n),de.init(e,n)}),ud=A("ZodCIDRv4",(e,n)=>{Cl.init(e,n),de.init(e,n)}),cd=A("ZodCIDRv6",(e,n)=>{Pl.init(e,n),de.init(e,n)}),ld=A("ZodBase64",(e,n)=>{El.init(e,n),de.init(e,n)}),fd=A("ZodBase64URL",(e,n)=>{Rl.init(e,n),de.init(e,n)}),hd=A("ZodE164",(e,n)=>{$l.init(e,n),de.init(e,n)}),dd=A("ZodJWT",(e,n)=>{Ml.init(e,n),de.init(e,n)}),da=A("ZodNumber",(e,n)=>{Qs.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(i,o,s)=>sh(e,i,o),e.gt=(i,o)=>e.check(ko(i,o)),e.gte=(i,o)=>e.check(Er(i,o)),e.min=(i,o)=>e.check(Er(i,o)),e.lt=(i,o)=>e.check(xo(i,o)),e.lte=(i,o)=>e.check(Pr(i,o)),e.max=(i,o)=>e.check(Pr(i,o)),e.int=i=>e.check(To(i)),e.safe=i=>e.check(To(i)),e.positive=i=>e.check(ko(0,i)),e.nonnegative=i=>e.check(Er(0,i)),e.negative=i=>e.check(xo(0,i)),e.nonpositive=i=>e.check(Pr(0,i)),e.multipleOf=(i,o)=>e.check(So(i,o)),e.step=(i,o)=>e.check(So(i,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function J(e){return Mf(da,e)}const pd=A("ZodNumberFormat",(e,n)=>{Ol.init(e,n),da.init(e,n)});function To(e){return Of(pd,e)}const gd=A("ZodBoolean",(e,n)=>{Nl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>ah(e,r,i)});function oe(e){return Nf(gd,e)}const md=A("ZodUndefined",(e,n)=>{Dl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>ch(e,r)});function Fr(e){return Df(md,e)}const _d=A("ZodNull",(e,n)=>{jl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>uh(e,r,i)});function pa(e){return jf(_d,e)}const yd=A("ZodUnknown",(e,n)=>{Zl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>fh()});function ie(){return Zf(yd)}const vd=A("ZodNever",(e,n)=>{ql.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>lh(e,r,i)});function bd(e){return qf(vd,e)}const wd=A("ZodArray",(e,n)=>{Ul.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>mh(e,r,i,o),e.element=n.element,e.min=(r,i)=>e.check(Xn(r,i)),e.nonempty=r=>e.check(Xn(1,r)),e.max=(r,i)=>e.check(ia(r,i)),e.length=(r,i)=>e.check(oa(r,i)),e.unwrap=()=>e.element});function B(e,n){return Yf(wd,e,n)}const ga=A("ZodObject",(e,n)=>{Fl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>_h(e,r,i,o),Q(e,"shape",()=>n.shape),e.keyof=()=>$e(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ie()}),e.loose=()=>e.clone({...e._zod.def,catchall:ie()}),e.strict=()=>e.clone({...e._zod.def,catchall:bd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>ac(e,r),e.safeExtend=r=>uc(e,r),e.merge=r=>cc(e,r),e.pick=r=>oc(e,r),e.omit=r=>sc(e,r),e.partial=(...r)=>lc(va,e,r[0]),e.required=(...r)=>fc(ba,e,r[0])});function E(e,n){const r={type:"object",shape:e??{},...Z(n)};return new ga(r)}function ze(e,n){return new ga({type:"object",shape:e,catchall:ie(),...Z(n)})}const ma=A("ZodUnion",(e,n)=>{na.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>yh(e,r,i,o),e.options=n.options});function G(e,n){return new ma({type:"union",options:e,...Z(n)})}const xd=A("ZodDiscriminatedUnion",(e,n)=>{ma.init(e,n),Hl.init(e,n)});function _a(e,n,r){return new xd({type:"union",options:n,discriminator:e,...Z(r)})}const kd=A("ZodIntersection",(e,n)=>{Vl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>vh(e,r,i,o)});function vi(e,n){return new kd({type:"intersection",left:e,right:n})}const Sd=A("ZodRecord",(e,n)=>{Bl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>bh(e,r,i,o),e.keyType=n.keyType,e.valueType=n.valueType});function ne(e,n,r){return new Sd({type:"record",keyType:e,valueType:n,...Z(r)})}const Hr=A("ZodEnum",(e,n)=>{Wl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(i,o,s)=>hh(e,i,o),e.enum=n.entries,e.options=Object.values(n.entries);const r=new Set(Object.keys(n.entries));e.extract=(i,o)=>{const s={};for(const a of i)if(r.has(a))s[a]=n.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Hr({...n,checks:[],...Z(o),entries:s})},e.exclude=(i,o)=>{const s={...n.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new Hr({...n,checks:[],...Z(o),entries:s})}});function $e(e,n){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Hr({type:"enum",entries:r,...Z(n)})}const zd=A("ZodLiteral",(e,n)=>{Jl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>dh(e,r,i),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function S(e,n){return new zd({type:"literal",values:Array.isArray(e)?e:[e],...Z(n)})}const Td=A("ZodTransform",(e,n)=>{Gl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>gh(e,r),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Ns(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ln(s,r.value,n));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(ln(a))}};const o=n.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function ya(e){return new Td({type:"transform",transform:e})}const va=A("ZodOptional",(e,n)=>{ra.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>ca(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function pe(e){return new va({type:"optional",innerType:e})}const Cd=A("ZodExactOptional",(e,n)=>{Xl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>ca(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Pd(e){return new Cd({type:"optional",innerType:e})}const Ed=A("ZodNullable",(e,n)=>{Kl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>wh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Co(e){return new Ed({type:"nullable",innerType:e})}const Ad=A("ZodDefault",(e,n)=>{Yl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>kh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Rd(e,n){return new Ad({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():qs(n)}})}const $d=A("ZodPrefault",(e,n)=>{Ql.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>Sh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Id(e,n){return new $d({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():qs(n)}})}const ba=A("ZodNonOptional",(e,n)=>{ef.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>xh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Md(e,n){return new ba({type:"nonoptional",innerType:e,...Z(n)})}const Od=A("ZodCatch",(e,n)=>{tf.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>zh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Nd(e,n){return new Od({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const Dd=A("ZodPipe",(e,n)=>{nf.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>Th(e,r,i,o),e.in=n.in,e.out=n.out});function Vr(e,n){return new Dd({type:"pipe",in:e,out:n})}const jd=A("ZodReadonly",(e,n)=>{rf.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>Ch(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Zd(e){return new jd({type:"readonly",innerType:e})}const wa=A("ZodCustom",(e,n)=>{of.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>ph(e,r)});function qd(e,n){return Qf(wa,e??(()=>!0),n)}function Ud(e,n={}){return eh(wa,e,n)}function Ld(e){return th(e)}function xa(e,n){return Vr(ya(e),n)}const xt="io.modelcontextprotocol/related-task",_r="2.0",me=qd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),ka=G([T(),J().int()]),Sa=T();ze({ttl:G([J(),pa()]).optional(),pollInterval:J().optional()});const Fd=E({ttl:J().optional()}),Hd=E({taskId:T()}),bi=ze({progressToken:ka.optional(),[xt]:Hd.optional()}),Ie=E({_meta:bi.optional()}),vn=Ie.extend({task:Fd.optional()}),Vd=e=>vn.safeParse(e).success,_e=E({method:T(),params:Ie.loose().optional()}),Ue=E({_meta:bi.optional()}),Le=E({method:T(),params:Ue.loose().optional()}),ye=ze({_meta:bi.optional()}),bn=G([T(),J().int()]),za=E({jsonrpc:S(_r),id:bn,..._e.shape}).strict(),Po=e=>za.safeParse(e).success,Ta=E({jsonrpc:S(_r),...Le.shape}).strict(),Bd=e=>Ta.safeParse(e).success,wi=E({jsonrpc:S(_r),id:bn,result:ye}).strict(),On=e=>wi.safeParse(e).success;var te;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(te||(te={}));const xi=E({jsonrpc:S(_r),id:bn.optional(),error:E({code:J().int(),message:T(),data:ie().optional()})}).strict(),Wd=e=>xi.safeParse(e).success,Jd=G([za,Ta,wi,xi]);G([wi,xi]);const ki=ye.strict(),Gd=Ue.extend({requestId:bn.optional(),reason:T().optional()}),Si=Le.extend({method:S("notifications/cancelled"),params:Gd}),Xd=E({src:T(),mimeType:T().optional(),sizes:B(T()).optional(),theme:$e(["light","dark"]).optional()}),wn=E({icons:B(Xd).optional()}),Zt=E({name:T(),title:T().optional()}),yr=Zt.extend({...Zt.shape,...wn.shape,version:T(),websiteUrl:T().optional(),description:T().optional()}),Kd=vi(E({applyDefaults:oe().optional()}),ne(T(),ie())),Yd=xa(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,vi(E({form:Kd.optional(),url:me.optional()}),ne(T(),ie()).optional())),Qd=ze({list:me.optional(),cancel:me.optional(),requests:ze({sampling:ze({createMessage:me.optional()}).optional(),elicitation:ze({create:me.optional()}).optional()}).optional()}),ep=ze({list:me.optional(),cancel:me.optional(),requests:ze({tools:ze({call:me.optional()}).optional()}).optional()}),tp=E({experimental:ne(T(),me).optional(),sampling:E({context:me.optional(),tools:me.optional()}).optional(),elicitation:Yd.optional(),roots:E({listChanged:oe().optional()}).optional(),tasks:Qd.optional()}),np=Ie.extend({protocolVersion:T(),capabilities:tp,clientInfo:yr}),rp=_e.extend({method:S("initialize"),params:np}),ip=E({experimental:ne(T(),me).optional(),logging:me.optional(),completions:me.optional(),prompts:E({listChanged:oe().optional()}).optional(),resources:E({subscribe:oe().optional(),listChanged:oe().optional()}).optional(),tools:E({listChanged:oe().optional()}).optional(),tasks:ep.optional()}),op=ye.extend({protocolVersion:T(),capabilities:ip,serverInfo:yr,instructions:T().optional()}),sp=Le.extend({method:S("notifications/initialized"),params:Ue.optional()}),vr=_e.extend({method:S("ping"),params:Ie.optional()}),ap=E({progress:J(),total:pe(J()),message:pe(T())}),up=E({...Ue.shape,...ap.shape,progressToken:ka}),zi=Le.extend({method:S("notifications/progress"),params:up}),cp=Ie.extend({cursor:Sa.optional()}),xn=_e.extend({params:cp.optional()}),kn=ye.extend({nextCursor:Sa.optional()}),lp=$e(["working","input_required","completed","failed","cancelled"]),Sn=E({taskId:T(),status:lp,ttl:G([J(),pa()]),createdAt:T(),lastUpdatedAt:T(),pollInterval:pe(J()),statusMessage:pe(T())}),Ti=ye.extend({task:Sn}),fp=Ue.merge(Sn),Yn=Le.extend({method:S("notifications/tasks/status"),params:fp}),Ci=_e.extend({method:S("tasks/get"),params:Ie.extend({taskId:T()})}),Pi=ye.merge(Sn),Ei=_e.extend({method:S("tasks/result"),params:Ie.extend({taskId:T()})});ye.loose();const Ai=xn.extend({method:S("tasks/list")}),Ri=kn.extend({tasks:B(Sn)}),$i=_e.extend({method:S("tasks/cancel"),params:Ie.extend({taskId:T()})}),hp=ye.merge(Sn),Ca=E({uri:T(),mimeType:pe(T()),_meta:ne(T(),ie()).optional()}),Pa=Ca.extend({text:T()}),Ii=T().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ea=Ca.extend({blob:Ii}),zn=$e(["user","assistant"]),Ht=E({audience:B(zn).optional(),priority:J().min(0).max(1).optional(),lastModified:fa({offset:!0}).optional()}),Aa=E({...Zt.shape,...wn.shape,uri:T(),description:pe(T()),mimeType:pe(T()),annotations:Ht.optional(),_meta:pe(ze({}))}),dp=E({...Zt.shape,...wn.shape,uriTemplate:T(),description:pe(T()),mimeType:pe(T()),annotations:Ht.optional(),_meta:pe(ze({}))}),pp=xn.extend({method:S("resources/list")}),Ra=kn.extend({resources:B(Aa)}),gp=xn.extend({method:S("resources/templates/list")}),mp=kn.extend({resourceTemplates:B(dp)}),Mi=Ie.extend({uri:T()}),_p=Mi,yp=_e.extend({method:S("resources/read"),params:_p}),$a=ye.extend({contents:B(G([Pa,Ea]))}),vp=Le.extend({method:S("notifications/resources/list_changed"),params:Ue.optional()}),bp=Mi,wp=_e.extend({method:S("resources/subscribe"),params:bp}),xp=Mi,kp=_e.extend({method:S("resources/unsubscribe"),params:xp}),Sp=Ue.extend({uri:T()}),zp=Le.extend({method:S("notifications/resources/updated"),params:Sp}),Tp=E({name:T(),description:pe(T()),required:pe(oe())}),Cp=E({...Zt.shape,...wn.shape,description:pe(T()),arguments:pe(B(Tp)),_meta:pe(ze({}))}),Pp=xn.extend({method:S("prompts/list")}),Ep=kn.extend({prompts:B(Cp)}),Ap=Ie.extend({name:T(),arguments:ne(T(),T()).optional()}),Rp=_e.extend({method:S("prompts/get"),params:Ap}),Oi=E({type:S("text"),text:T(),annotations:Ht.optional(),_meta:ne(T(),ie()).optional()}),Ni=E({type:S("image"),data:Ii,mimeType:T(),annotations:Ht.optional(),_meta:ne(T(),ie()).optional()}),Di=E({type:S("audio"),data:Ii,mimeType:T(),annotations:Ht.optional(),_meta:ne(T(),ie()).optional()}),$p=E({type:S("tool_use"),name:T(),id:T(),input:ne(T(),ie()),_meta:ne(T(),ie()).optional()}),Ia=E({type:S("resource"),resource:G([Pa,Ea]),annotations:Ht.optional(),_meta:ne(T(),ie()).optional()}),Ma=Aa.extend({type:S("resource_link")}),Tn=G([Oi,Ni,Di,Ma,Ia]),Ip=E({role:zn,content:Tn}),Mp=ye.extend({description:T().optional(),messages:B(Ip)}),Op=Le.extend({method:S("notifications/prompts/list_changed"),params:Ue.optional()}),Np=E({title:T().optional(),readOnlyHint:oe().optional(),destructiveHint:oe().optional(),idempotentHint:oe().optional(),openWorldHint:oe().optional()}),Dp=E({taskSupport:$e(["required","optional","forbidden"]).optional()}),ji=E({...Zt.shape,...wn.shape,description:T().optional(),inputSchema:E({type:S("object"),properties:ne(T(),me).optional(),required:B(T()).optional()}).catchall(ie()),outputSchema:E({type:S("object"),properties:ne(T(),me).optional(),required:B(T()).optional()}).catchall(ie()).optional(),annotations:Np.optional(),execution:Dp.optional(),_meta:ne(T(),ie()).optional()}),Oa=xn.extend({method:S("tools/list")}),jp=kn.extend({tools:B(ji)}),br=ye.extend({content:B(Tn).default([]),structuredContent:ne(T(),ie()).optional(),isError:oe().optional()});br.or(ye.extend({toolResult:ie()}));const Zp=vn.extend({name:T(),arguments:ne(T(),ie()).optional()}),Na=_e.extend({method:S("tools/call"),params:Zp}),qp=Le.extend({method:S("notifications/tools/list_changed"),params:Ue.optional()});E({autoRefresh:oe().default(!0),debounceMs:J().int().nonnegative().default(300)});const Da=$e(["debug","info","notice","warning","error","critical","alert","emergency"]),Up=Ie.extend({level:Da}),Lp=_e.extend({method:S("logging/setLevel"),params:Up}),Fp=Ue.extend({level:Da,logger:T().optional(),data:ie()}),Hp=Le.extend({method:S("notifications/message"),params:Fp}),Vp=E({name:T().optional()}),Bp=E({hints:B(Vp).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),Wp=E({mode:$e(["auto","required","none"]).optional()}),Jp=E({type:S("tool_result"),toolUseId:T().describe("The unique identifier for the corresponding tool call."),content:B(Tn).default([]),structuredContent:E({}).loose().optional(),isError:oe().optional(),_meta:ne(T(),ie()).optional()}),Gp=_a("type",[Oi,Ni,Di]),Qn=_a("type",[Oi,Ni,Di,$p,Jp]),Xp=E({role:zn,content:G([Qn,B(Qn)]),_meta:ne(T(),ie()).optional()}),Kp=vn.extend({messages:B(Xp),modelPreferences:Bp.optional(),systemPrompt:T().optional(),includeContext:$e(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:B(T()).optional(),metadata:me.optional(),tools:B(ji).optional(),toolChoice:Wp.optional()}),Yp=_e.extend({method:S("sampling/createMessage"),params:Kp}),Qp=ye.extend({model:T(),stopReason:pe($e(["endTurn","stopSequence","maxTokens"]).or(T())),role:zn,content:Gp}),eg=ye.extend({model:T(),stopReason:pe($e(["endTurn","stopSequence","maxTokens","toolUse"]).or(T())),role:zn,content:G([Qn,B(Qn)])}),tg=E({type:S("boolean"),title:T().optional(),description:T().optional(),default:oe().optional()}),ng=E({type:S("string"),title:T().optional(),description:T().optional(),minLength:J().optional(),maxLength:J().optional(),format:$e(["email","uri","date","date-time"]).optional(),default:T().optional()}),rg=E({type:$e(["number","integer"]),title:T().optional(),description:T().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),ig=E({type:S("string"),title:T().optional(),description:T().optional(),enum:B(T()),default:T().optional()}),og=E({type:S("string"),title:T().optional(),description:T().optional(),oneOf:B(E({const:T(),title:T()})),default:T().optional()}),sg=E({type:S("string"),title:T().optional(),description:T().optional(),enum:B(T()),enumNames:B(T()).optional(),default:T().optional()}),ag=G([ig,og]),ug=E({type:S("array"),title:T().optional(),description:T().optional(),minItems:J().optional(),maxItems:J().optional(),items:E({type:S("string"),enum:B(T())}),default:B(T()).optional()}),cg=E({type:S("array"),title:T().optional(),description:T().optional(),minItems:J().optional(),maxItems:J().optional(),items:E({anyOf:B(E({const:T(),title:T()}))}),default:B(T()).optional()}),lg=G([ug,cg]),fg=G([sg,ag,lg]),hg=G([fg,tg,ng,rg]),dg=vn.extend({mode:S("form").optional(),message:T(),requestedSchema:E({type:S("object"),properties:ne(T(),hg),required:B(T()).optional()})}),pg=vn.extend({mode:S("url"),message:T(),elicitationId:T(),url:T().url()}),gg=G([dg,pg]),mg=_e.extend({method:S("elicitation/create"),params:gg}),_g=Ue.extend({elicitationId:T()}),yg=Le.extend({method:S("notifications/elicitation/complete"),params:_g}),vg=ye.extend({action:$e(["accept","decline","cancel"]),content:xa(e=>e===null?void 0:e,ne(T(),G([T(),J(),oe(),B(T())])).optional())}),bg=E({type:S("ref/resource"),uri:T()}),wg=E({type:S("ref/prompt"),name:T()}),xg=Ie.extend({ref:G([wg,bg]),argument:E({name:T(),value:T()}),context:E({arguments:ne(T(),T()).optional()}).optional()}),kg=_e.extend({method:S("completion/complete"),params:xg}),Sg=ye.extend({completion:ze({values:B(T()).max(100),total:pe(J().int()),hasMore:pe(oe())})}),zg=E({uri:T().startsWith("file://"),name:T().optional(),_meta:ne(T(),ie()).optional()}),Tg=_e.extend({method:S("roots/list"),params:Ie.optional()}),Cg=ye.extend({roots:B(zg)}),Pg=Le.extend({method:S("notifications/roots/list_changed"),params:Ue.optional()});G([vr,rp,kg,Lp,Rp,Pp,pp,gp,yp,wp,kp,Na,Oa,Ci,Ei,Ai,$i]);G([Si,zi,sp,Pg,Yn]);G([ki,Qp,eg,vg,Cg,Pi,Ri,Ti]);G([vr,Yp,mg,Tg,Ci,Ei,Ai,$i]);G([Si,zi,Hp,zp,vp,qp,Op,Yn,yg]);G([ki,op,Sg,Mp,Ep,Ra,mp,$a,br,jp,Pi,Ri,Ti]);class X extends Error{constructor(n,r,i){super(`MCP error ${n}: ${r}`),this.code=n,this.data=i,this.name="McpError"}static fromError(n,r,i){if(n===te.UrlElicitationRequired&&i){const o=i;if(o.elicitations)return new Eg(o.elicitations,r)}return new X(n,r,i)}}class Eg extends X{constructor(n,r=`URL elicitation${n.length>1?"s":""} required`){super(te.UrlElicitationRequired,r,{elicitations:n})}get elicitations(){var n;return((n=this.data)==null?void 0:n.elicitations)??[]}}function bt(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Eo(e){const n=Ph(e),r=n==null?void 0:n.method;if(!r)throw new Error("Schema is missing a method literal");const i=Eh(r);if(typeof i!="string")throw new Error("Schema method literal must be a string");return i}function Ao(e,n){const r=la(e,n);if(!r.success)throw r.error;return r.data}const Ag=6e4;class Rg{constructor(n){this._options=n,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Si,r=>{this._oncancel(r)}),this.setNotificationHandler(zi,r=>{this._onprogress(r)}),this.setRequestHandler(vr,r=>({})),this._taskStore=n==null?void 0:n.taskStore,this._taskMessageQueue=n==null?void 0:n.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ci,async(r,i)=>{const o=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!o)throw new X(te.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ei,async(r,i)=>{const o=async()=>{var u;const s=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,i.sessionId);){if(c.type==="response"||c.type==="error"){const l=c.message,h=l.id,f=this._requestResolvers.get(h);if(f)if(this._requestResolvers.delete(h),c.type==="response")f(l);else{const d=l,p=new X(d.error.code,d.error.message,d.error.data);f(p)}else{const d=c.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${h}`))}continue}await((u=this._transport)==null?void 0:u.send(c.message,{relatedRequestId:i.requestId}))}}const a=await this._taskStore.getTask(s,i.sessionId);if(!a)throw new X(te.InvalidParams,`Task not found: ${s}`);if(!bt(a.status))return await this._waitForTaskUpdate(s,i.signal),await o();if(bt(a.status)){const c=await this._taskStore.getTaskResult(s,i.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[xt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Ai,async(r,i)=>{var o;try{const{tasks:s,nextCursor:a}=await this._taskStore.listTasks((o=r.params)==null?void 0:o.cursor,i.sessionId);return{tasks:s,nextCursor:a,_meta:{}}}catch(s){throw new X(te.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler($i,async(r,i)=>{try{const o=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!o)throw new X(te.InvalidParams,`Task not found: ${r.params.taskId}`);if(bt(o.status))throw new X(te.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(r.params.taskId);const s=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!s)throw new X(te.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof X?o:new X(te.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(n){if(!n.params.requestId)return;const r=this._requestHandlerAbortControllers.get(n.params.requestId);r==null||r.abort(n.params.reason)}_setupTimeout(n,r,i,o,s=!1){this._timeoutInfo.set(n,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:i,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(n){const r=this._timeoutInfo.get(n);if(!r)return!1;const i=Date.now()-r.startTime;if(r.maxTotalTimeout&&i>=r.maxTotalTimeout)throw this._timeoutInfo.delete(n),X.fromError(te.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:i});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(n){const r=this._timeoutInfo.get(n);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(n))}async connect(n){var s,a,u;this._transport=n;const r=(s=this.transport)==null?void 0:s.onclose;this._transport.onclose=()=>{r==null||r(),this._onclose()};const i=(a=this.transport)==null?void 0:a.onerror;this._transport.onerror=c=>{i==null||i(c),this._onerror(c)};const o=(u=this._transport)==null?void 0:u.onmessage;this._transport.onmessage=(c,l)=>{o==null||o(c,l),On(c)||Wd(c)?this._onresponse(c):Po(c)?this._onrequest(c,l):Bd(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var i;const n=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const r=X.fromError(te.ConnectionClosed,"Connection closed");this._transport=void 0,(i=this.onclose)==null||i.call(this);for(const o of n.values())o(r)}_onerror(n){var r;(r=this.onerror)==null||r.call(this,n)}_onnotification(n){const r=this._notificationHandlers.get(n.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(n)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(n,r){var h,f,d,p;const i=this._requestHandlers.get(n.method)??this.fallbackRequestHandler,o=this._transport,s=(d=(f=(h=n.params)==null?void 0:h._meta)==null?void 0:f[xt])==null?void 0:d.taskId;if(i===void 0){const g={jsonrpc:"2.0",id:n.id,error:{code:te.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:g,timestamp:Date.now()},o==null?void 0:o.sessionId).catch(_=>this._onerror(new Error(`Failed to enqueue error response: ${_}`))):o==null||o.send(g).catch(_=>this._onerror(new Error(`Failed to send an error response: ${_}`)));return}const a=new AbortController;this._requestHandlerAbortControllers.set(n.id,a);const u=Vd(n.params)?n.params.task:void 0,c=this._taskStore?this.requestTaskStore(n,o==null?void 0:o.sessionId):void 0,l={signal:a.signal,sessionId:o==null?void 0:o.sessionId,_meta:(p=n.params)==null?void 0:p._meta,sendNotification:async g=>{const _={relatedRequestId:n.id};s&&(_.relatedTask={taskId:s}),await this.notification(g,_)},sendRequest:async(g,_,y)=>{var C;const m={...y,relatedRequestId:n.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});const w=((C=m.relatedTask)==null?void 0:C.taskId)??s;return w&&c&&await c.updateTaskStatus(w,"input_required"),await this.request(g,_,m)},authInfo:r==null?void 0:r.authInfo,requestId:n.id,requestInfo:r==null?void 0:r.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:u==null?void 0:u.ttl,closeSSEStream:r==null?void 0:r.closeSSEStream,closeStandaloneSSEStream:r==null?void 0:r.closeStandaloneSSEStream};Promise.resolve().then(()=>{u&&this.assertTaskHandlerCapability(n.method)}).then(()=>i(n,l)).then(async g=>{if(a.signal.aborted)return;const _={result:g,jsonrpc:"2.0",id:n.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:_,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(_))},async g=>{if(a.signal.aborted)return;const _={jsonrpc:"2.0",id:n.id,error:{code:Number.isSafeInteger(g.code)?g.code:te.InternalError,message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:_,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(_))}).catch(g=>this._onerror(new Error(`Failed to send response: ${g}`))).finally(()=>{this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(n){const{progressToken:r,...i}=n.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(n)}`));return}const a=this._responseHandlers.get(o),u=this._timeoutInfo.get(o);if(u&&a&&u.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}s(i)}_onresponse(n){const r=Number(n.id),i=this._requestResolvers.get(r);if(i){if(this._requestResolvers.delete(r),On(n))i(n);else{const a=new X(n.error.code,n.error.message,n.error.data);i(a)}return}const o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(n)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(On(n)&&n.result&&typeof n.result=="object"){const a=n.result;if(a.task&&typeof a.task=="object"){const u=a.task;typeof u.taskId=="string"&&(s=!0,this._taskProgressTokens.set(u.taskId,r))}}if(s||this._progressHandlers.delete(r),On(n))o(n);else{const a=X.fromError(n.error.code,n.error.message,n.error.data);o(a)}}get transport(){return this._transport}async close(){var n;await((n=this._transport)==null?void 0:n.close())}async*requestStream(n,r,i){var a,u;const{task:o}=i??{};if(!o){try{yield{type:"result",result:await this.request(n,r,i)}}catch(c){yield{type:"error",error:c instanceof X?c:new X(te.InternalError,String(c))}}return}let s;try{const c=await this.request(n,Ti,i);if(c.task)s=c.task.taskId,yield{type:"taskCreated",task:c.task};else throw new X(te.InternalError,"Task creation did not return a task");for(;;){const l=await this.getTask({taskId:s},i);if(yield{type:"taskStatus",task:l},bt(l.status)){l.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,i)}:l.status==="failed"?yield{type:"error",error:new X(te.InternalError,`Task ${s} failed`)}:l.status==="cancelled"&&(yield{type:"error",error:new X(te.InternalError,`Task ${s} was cancelled`)});return}if(l.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,i)};return}const h=l.pollInterval??((a=this._options)==null?void 0:a.defaultTaskPollInterval)??1e3;await new Promise(f=>setTimeout(f,h)),(u=i==null?void 0:i.signal)==null||u.throwIfAborted()}}catch(c){yield{type:"error",error:c instanceof X?c:new X(te.InternalError,String(c))}}}request(n,r,i){const{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a,task:u,relatedTask:c}=i??{};return new Promise((l,h)=>{var w,C,b,v,k;const f=x=>{h(x)};if(!this._transport){f(new Error("Not connected"));return}if(((w=this._options)==null?void 0:w.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(n.method),u&&this.assertTaskCapability(n.method)}catch(x){f(x);return}(C=i==null?void 0:i.signal)==null||C.throwIfAborted();const d=this._requestMessageId++,p={...n,jsonrpc:"2.0",id:d};i!=null&&i.onprogress&&(this._progressHandlers.set(d,i.onprogress),p.params={...n.params,_meta:{...((b=n.params)==null?void 0:b._meta)||{},progressToken:d}}),u&&(p.params={...p.params,task:u}),c&&(p.params={...p.params,_meta:{...((v=p.params)==null?void 0:v._meta)||{},[xt]:c}});const g=x=>{var M;this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),(M=this._transport)==null||M.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(x)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a}).catch($=>this._onerror(new Error(`Failed to send cancellation: ${$}`)));const P=x instanceof X?x:new X(te.RequestTimeout,String(x));h(P)};this._responseHandlers.set(d,x=>{var P;if(!((P=i==null?void 0:i.signal)!=null&&P.aborted)){if(x instanceof Error)return h(x);try{const M=la(r,x.result);M.success?l(M.data):h(M.error)}catch(M){h(M)}}}),(k=i==null?void 0:i.signal)==null||k.addEventListener("abort",()=>{var x;g((x=i==null?void 0:i.signal)==null?void 0:x.reason)});const _=(i==null?void 0:i.timeout)??Ag,y=()=>g(X.fromError(te.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(d,_,i==null?void 0:i.maxTotalTimeout,y,(i==null?void 0:i.resetTimeoutOnProgress)??!1);const m=c==null?void 0:c.taskId;if(m){const x=P=>{const M=this._responseHandlers.get(d);M?M(P):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,x),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(d),h(P)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a}).catch(x=>{this._cleanupTimeout(d),h(x)})})}async getTask(n,r){return this.request({method:"tasks/get",params:n},Pi,r)}async getTaskResult(n,r,i){return this.request({method:"tasks/result",params:n},r,i)}async listTasks(n,r){return this.request({method:"tasks/list",params:n},Ri,r)}async cancelTask(n,r){return this.request({method:"tasks/cancel",params:n},hp,r)}async notification(n,r){var u,c,l,h;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(n.method);const i=(u=r==null?void 0:r.relatedTask)==null?void 0:u.taskId;if(i){const f={...n,jsonrpc:"2.0",params:{...n.params,_meta:{...((c=n.params)==null?void 0:c._meta)||{},[xt]:r.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:f,timestamp:Date.now()});return}if((((l=this._options)==null?void 0:l.debouncedNotificationMethods)??[]).includes(n.method)&&!n.params&&!(r!=null&&r.relatedRequestId)&&!(r!=null&&r.relatedTask)){if(this._pendingDebouncedNotifications.has(n.method))return;this._pendingDebouncedNotifications.add(n.method),Promise.resolve().then(()=>{var d,p;if(this._pendingDebouncedNotifications.delete(n.method),!this._transport)return;let f={...n,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(f={...f,params:{...f.params,_meta:{...((d=f.params)==null?void 0:d._meta)||{},[xt]:r.relatedTask}}}),(p=this._transport)==null||p.send(f,r).catch(g=>this._onerror(g))});return}let a={...n,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(a={...a,params:{...a.params,_meta:{...((h=a.params)==null?void 0:h._meta)||{},[xt]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(n,r){const i=Eo(n);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(o,s)=>{const a=Ao(n,o);return Promise.resolve(r(a,s))})}removeRequestHandler(n){this._requestHandlers.delete(n)}assertCanSetRequestHandler(n){if(this._requestHandlers.has(n))throw new Error(`A request handler for ${n} already exists, which would be overridden`)}setNotificationHandler(n,r){const i=Eo(n);this._notificationHandlers.set(i,o=>{const s=Ao(n,o);return Promise.resolve(r(s))})}removeNotificationHandler(n){this._notificationHandlers.delete(n)}_cleanupTaskProgressHandler(n){const r=this._taskProgressTokens.get(n);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(n))}async _enqueueTaskMessage(n,r,i){var s;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=(s=this._options)==null?void 0:s.maxTaskQueueSize;await this._taskMessageQueue.enqueue(n,r,i,o)}async _clearTaskQueue(n,r){if(this._taskMessageQueue){const i=await this._taskMessageQueue.dequeueAll(n,r);for(const o of i)if(o.type==="request"&&Po(o.message)){const s=o.message.id,a=this._requestResolvers.get(s);a?(a(new X(te.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${n} cleanup`))}}}async _waitForTaskUpdate(n,r){var o,s;let i=((o=this._options)==null?void 0:o.defaultTaskPollInterval)??1e3;try{const a=await((s=this._taskStore)==null?void 0:s.getTask(n));a!=null&&a.pollInterval&&(i=a.pollInterval)}catch{}return new Promise((a,u)=>{if(r.aborted){u(new X(te.InvalidRequest,"Request cancelled"));return}const c=setTimeout(a,i);r.addEventListener("abort",()=>{clearTimeout(c),u(new X(te.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(n,r){const i=this._taskStore;if(!i)throw new Error("No task store configured");return{createTask:async o=>{if(!n)throw new Error("No request provided");return await i.createTask(o,n.id,{method:n.method,params:n.params},r)},getTask:async o=>{const s=await i.getTask(o,r);if(!s)throw new X(te.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,a)=>{await i.storeTaskResult(o,s,a,r);const u=await i.getTask(o,r);if(u){const c=Yn.parse({method:"notifications/tasks/status",params:u});await this.notification(c),bt(u.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>i.getTaskResult(o,r),updateTaskStatus:async(o,s,a)=>{const u=await i.getTask(o,r);if(!u)throw new X(te.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(bt(u.status))throw new X(te.InvalidParams,`Cannot update task "${o}" from terminal status "${u.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(o,s,a,r);const c=await i.getTask(o,r);if(c){const l=Yn.parse({method:"notifications/tasks/status",params:c});await this.notification(l),bt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>i.listTasks(o,r)}}}var $g="2026-01-26",Ig="ui/notifications/tool-input-partial";let Mg=class{constructor(n=window.parent,r){be(this,"eventTarget");be(this,"eventSource");be(this,"messageListener");be(this,"onclose");be(this,"onerror");be(this,"onmessage");be(this,"sessionId");be(this,"setProtocolVersion");this.eventTarget=n,this.eventSource=r,this.messageListener=i=>{var s,a,u;if(r&&i.source!==this.eventSource){console.debug("Ignoring message from unknown source",i);return}let o=Jd.safeParse(i.data);o.success?(console.debug("Parsed message",o.data),(s=this.onmessage)==null||s.call(this,o.data)):((a=i.data)==null?void 0:a.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,i):(console.error("Failed to parse message",o.error.message,i),(u=this.onerror)==null||u.call(this,Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(n,r){n.method!==Ig&&console.debug("Sending message",n),this.eventTarget.postMessage(n,"*")}async close(){var n;window.removeEventListener("message",this.messageListener),(n=this.onclose)==null||n.call(this)}};var Og=G([S("light"),S("dark")]).describe("Color theme preference for the host environment."),fn=G([S("inline"),S("fullscreen"),S("pip")]).describe("Display mode for UI presentation."),Ng=G([S("--color-background-primary"),S("--color-background-secondary"),S("--color-background-tertiary"),S("--color-background-inverse"),S("--color-background-ghost"),S("--color-background-info"),S("--color-background-danger"),S("--color-background-success"),S("--color-background-warning"),S("--color-background-disabled"),S("--color-text-primary"),S("--color-text-secondary"),S("--color-text-tertiary"),S("--color-text-inverse"),S("--color-text-ghost"),S("--color-text-info"),S("--color-text-danger"),S("--color-text-success"),S("--color-text-warning"),S("--color-text-disabled"),S("--color-border-primary"),S("--color-border-secondary"),S("--color-border-tertiary"),S("--color-border-inverse"),S("--color-border-ghost"),S("--color-border-info"),S("--color-border-danger"),S("--color-border-success"),S("--color-border-warning"),S("--color-border-disabled"),S("--color-ring-primary"),S("--color-ring-secondary"),S("--color-ring-inverse"),S("--color-ring-info"),S("--color-ring-danger"),S("--color-ring-success"),S("--color-ring-warning"),S("--font-sans"),S("--font-mono"),S("--font-weight-normal"),S("--font-weight-medium"),S("--font-weight-semibold"),S("--font-weight-bold"),S("--font-text-xs-size"),S("--font-text-sm-size"),S("--font-text-md-size"),S("--font-text-lg-size"),S("--font-heading-xs-size"),S("--font-heading-sm-size"),S("--font-heading-md-size"),S("--font-heading-lg-size"),S("--font-heading-xl-size"),S("--font-heading-2xl-size"),S("--font-heading-3xl-size"),S("--font-text-xs-line-height"),S("--font-text-sm-line-height"),S("--font-text-md-line-height"),S("--font-text-lg-line-height"),S("--font-heading-xs-line-height"),S("--font-heading-sm-line-height"),S("--font-heading-md-line-height"),S("--font-heading-lg-line-height"),S("--font-heading-xl-line-height"),S("--font-heading-2xl-line-height"),S("--font-heading-3xl-line-height"),S("--border-radius-xs"),S("--border-radius-sm"),S("--border-radius-md"),S("--border-radius-lg"),S("--border-radius-xl"),S("--border-radius-full"),S("--border-width-regular"),S("--shadow-hairline"),S("--shadow-sm"),S("--shadow-md"),S("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Dg=ne(Ng.describe(`Style variables for theming MCP apps.
|
|
46
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const f=h[1];if(n===h[0]){s(h);continue}if(e.external){const p=(c=e.external.registry.get(h[0]))==null?void 0:c.id;if(n!==h[0]&&p){s(h);continue}}if((l=e.metadataRegistry.get(h[0]))==null?void 0:l.id){s(h);continue}if(f.cycle){s(h);continue}if(f.count>1&&e.reused==="ref"){s(h);continue}}}function la(e,n){var a,u,c;const r=e.seen.get(n);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=l=>{const h=e.seen.get(l);if(h.ref===null)return;const f=h.def??h.schema,d={...f},p=h.ref;if(h.ref=null,p){i(p);const _=e.seen.get(p),y=_.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(y)):Object.assign(f,y),Object.assign(f,d),l._zod.parent===p)for(const w in f)w==="$ref"||w==="allOf"||w in d||delete f[w];if(y.$ref)for(const w in f)w==="$ref"||w==="allOf"||w in _.def&&JSON.stringify(f[w])===JSON.stringify(_.def[w])&&delete f[w]}const g=l._zod.parent;if(g&&g!==p){i(g);const _=e.seen.get(g);if(_!=null&&_.schema.$ref&&(f.$ref=_.schema.$ref,_.def))for(const y in f)y==="$ref"||y==="allOf"||y in _.def&&JSON.stringify(f[y])===JSON.stringify(_.def[y])&&delete f[y]}e.override({zodSchema:l,jsonSchema:f,path:h.path??[]})};for(const l of[...e.seen.entries()].reverse())i(l[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const l=(u=e.external.registry.get(n))==null?void 0:u.id;if(!l)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(l)}Object.assign(o,r.def??r.schema);const s=((c=e.external)==null?void 0:c.defs)??{};for(const l of e.seen.entries()){const h=l[1];h.def&&h.defId&&(s[h.defId]=h.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const l=JSON.parse(JSON.stringify(o));return Object.defineProperty(l,"~standard",{value:{...n["~standard"],jsonSchema:{input:Kn(n,"input",e.processors),output:Kn(n,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function xe(e,n){const r=n??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return xe(i.element,r);if(i.type==="set")return xe(i.valueType,r);if(i.type==="lazy")return xe(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return xe(i.innerType,r);if(i.type==="intersection")return xe(i.left,r)||xe(i.right,r);if(i.type==="record"||i.type==="map")return xe(i.keyType,r)||xe(i.valueType,r);if(i.type==="pipe")return xe(i.in,r)||xe(i.out,r);if(i.type==="object"){for(const o in i.shape)if(xe(i.shape[o],r))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(xe(o,r))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(xe(o,r))return!0;return!!(i.rest&&xe(i.rest,r))}return!1}const ih=(e,n={})=>r=>{const i=ua({...r,processors:n});return ge(e,i),ca(i,e),la(i,e)},Kn=(e,n,r={})=>i=>{const{libraryOptions:o,target:s}=i??{},a=ua({...o??{},target:s,io:n,processors:r});return ge(e,a),ca(a,e),la(a,e)},oh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sh=(e,n,r,i)=>{const o=r;o.type="string";const{minimum:s,maximum:a,format:u,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),u&&(o.format=oh[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),l&&(o.contentEncoding=l),c&&c.size>0){const h=[...c];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(f=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},ah=(e,n,r,i)=>{const o=r,{minimum:s,maximum:a,format:u,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof s=="number"&&(o.minimum=s,typeof h=="number"&&n.target!=="draft-04"&&(h>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof l=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l),typeof a=="number"&&(o.maximum=a,typeof l=="number"&&n.target!=="draft-04"&&(l<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},uh=(e,n,r,i)=>{r.type="boolean"},ch=(e,n,r,i)=>{n.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},lh=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},fh=(e,n,r,i)=>{r.not={}},hh=(e,n,r,i)=>{},dh=(e,n,r,i)=>{const o=e._zod.def,s=qs(o.entries);s.every(a=>typeof a=="number")&&(r.type="number"),s.every(a=>typeof a=="string")&&(r.type="string"),r.enum=s},ph=(e,n,r,i)=>{const o=e._zod.def,s=[];for(const a of o.values)if(a===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];r.type=a===null?"null":typeof a,n.target==="draft-04"||n.target==="openapi-3.0"?r.enum=[a]:r.const=a}else s.every(a=>typeof a=="number")&&(r.type="number"),s.every(a=>typeof a=="string")&&(r.type="string"),s.every(a=>typeof a=="boolean")&&(r.type="boolean"),s.every(a=>a===null)&&(r.type="null"),r.enum=s},gh=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mh=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},_h=(e,n,r,i)=>{const o=r,s=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=ge(s.element,n,{...i,path:[...i.path,"items"]})},yh=(e,n,r,i)=>{var l;const o=r,s=e._zod.def;o.type="object",o.properties={};const a=s.shape;for(const h in a)o.properties[h]=ge(a[h],n,{...i,path:[...i.path,"properties",h]});const u=new Set(Object.keys(a)),c=new Set([...u].filter(h=>{const f=s.shape[h]._zod;return n.io==="input"?f.optin===void 0:f.optout===void 0}));c.size>0&&(o.required=Array.from(c)),((l=s.catchall)==null?void 0:l._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=ge(s.catchall,n,{...i,path:[...i.path,"additionalProperties"]})):n.io==="output"&&(o.additionalProperties=!1)},vh=(e,n,r,i)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((u,c)=>ge(u,n,{...i,path:[...i.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=a:r.anyOf=a},bh=(e,n,r,i)=>{const o=e._zod.def,s=ge(o.left,n,{...i,path:[...i.path,"allOf",0]}),a=ge(o.right,n,{...i,path:[...i.path,"allOf",1]}),u=l=>"allOf"in l&&Object.keys(l).length===1,c=[...u(s)?s.allOf:[s],...u(a)?a.allOf:[a]];r.allOf=c},wh=(e,n,r,i)=>{const o=r,s=e._zod.def;o.type="object";const a=s.keyType,u=a._zod.bag,c=u==null?void 0:u.patterns;if(s.mode==="loose"&&c&&c.size>0){const h=ge(s.valueType,n,{...i,path:[...i.path,"patternProperties","*"]});o.patternProperties={};for(const f of c)o.patternProperties[f.source]=h}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(o.propertyNames=ge(s.keyType,n,{...i,path:[...i.path,"propertyNames"]})),o.additionalProperties=ge(s.valueType,n,{...i,path:[...i.path,"additionalProperties"]});const l=a._zod.values;if(l){const h=[...l].filter(f=>typeof f=="string"||typeof f=="number");h.length>0&&(o.required=h)}},xh=(e,n,r,i)=>{const o=e._zod.def,s=ge(o.innerType,n,i),a=n.seen.get(e);n.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},kh=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType},Sh=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},zh=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType,n.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Th=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Ch=(e,n,r,i)=>{const o=e._zod.def,s=n.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;ge(s,n,i);const a=n.seen.get(e);a.ref=s},Ph=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType,r.readOnly=!0},fa=(e,n,r,i)=>{const o=e._zod.def;ge(o.innerType,n,i);const s=n.seen.get(e);s.ref=o.innerType};function yi(e){return!!e._zod}function ha(e,n){return yi(e)?Bs(e,n):e.safeParse(n)}function Eh(e){var r,i;if(!e)return;let n;if(yi(e)?n=(i=(r=e._zod)==null?void 0:r.def)==null?void 0:i.shape:n=e.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Ah(e){var o;if(yi(e)){const a=(o=e._zod)==null?void 0:o.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const i=e.value;if(i!==void 0)return i}const Rh=A("ZodISODateTime",(e,n)=>{xl.init(e,n),de.init(e,n)});function da(e){return Rf(Rh,e)}const $h=A("ZodISODate",(e,n)=>{kl.init(e,n),de.init(e,n)});function Ih(e){return $f($h,e)}const Mh=A("ZodISOTime",(e,n)=>{Sl.init(e,n),de.init(e,n)});function Oh(e){return If(Mh,e)}const Nh=A("ZodISODuration",(e,n)=>{zl.init(e,n),de.init(e,n)});function Dh(e){return Mf(Nh,e)}const jh=(e,n)=>{Hs.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>pc(e,r)},flatten:{value:r=>dc(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ur,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ur,2)}},isEmpty:{get(){return e.issues.length===0}}})},qe=A("ZodError",jh,{Parent:Error}),Zh=gi(qe),qh=mi(qe),Uh=pr(qe),Lh=gr(qe),Fh=mc(qe),Hh=_c(qe),Vh=yc(qe),Bh=vc(qe),Wh=bc(qe),Gh=wc(qe),Jh=xc(qe),Xh=kc(qe),ue=A("ZodType",(e,n)=>(ae.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:Kn(e,"input"),output:Kn(e,"output")}}),e.toJSONSchema=ih(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...r)=>e.clone(yt(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0}),e.with=e.check,e.clone=(r,i)=>vt(e,r,i),e.brand=()=>e,e.register=((r,i)=>(r.add(e,i),e)),e.parse=(r,i)=>Zh(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Uh(e,r,i),e.parseAsync=async(r,i)=>qh(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Lh(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>Fh(e,r,i),e.decode=(r,i)=>Hh(e,r,i),e.encodeAsync=async(r,i)=>Vh(e,r,i),e.decodeAsync=async(r,i)=>Bh(e,r,i),e.safeEncode=(r,i)=>Wh(e,r,i),e.safeDecode=(r,i)=>Gh(e,r,i),e.safeEncodeAsync=async(r,i)=>Jh(e,r,i),e.safeDecodeAsync=async(r,i)=>Xh(e,r,i),e.refine=(r,i)=>e.check(Ld(r,i)),e.superRefine=r=>e.check(Fd(r)),e.overwrite=r=>e.check(Ft(r)),e.optional=()=>pe(e),e.exactOptional=()=>Ed(e),e.nullable=()=>Po(e),e.nullish=()=>pe(Po(e)),e.nonoptional=r=>Od(e,r),e.array=()=>B(e),e.or=r=>J([e,r]),e.and=r=>vi(e,r),e.transform=r=>Vr(e,ba(r)),e.default=r=>$d(e,r),e.prefault=r=>Md(e,r),e.catch=r=>Dd(e,r),e.pipe=r=>Vr(e,r),e.readonly=()=>qd(e),e.describe=r=>{const i=e.clone();return Qt.add(i,{description:r}),i},Object.defineProperty(e,"description",{get(){var r;return(r=Qt.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Qt.get(e);const i=e.clone();return Qt.add(i,r[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),pa=A("_ZodString",(e,n)=>{_i.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(i,o,s)=>sh(e,i,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...i)=>e.check(Lf(...i)),e.includes=(...i)=>e.check(Vf(...i)),e.startsWith=(...i)=>e.check(Bf(...i)),e.endsWith=(...i)=>e.check(Wf(...i)),e.min=(...i)=>e.check(Xn(...i)),e.max=(...i)=>e.check(sa(...i)),e.length=(...i)=>e.check(aa(...i)),e.nonempty=(...i)=>e.check(Xn(1,...i)),e.lowercase=i=>e.check(Ff(i)),e.uppercase=i=>e.check(Hf(i)),e.trim=()=>e.check(Jf()),e.normalize=(...i)=>e.check(Gf(...i)),e.toLowerCase=()=>e.check(Xf()),e.toUpperCase=()=>e.check(Kf()),e.slugify=()=>e.check(Yf())}),Kh=A("ZodString",(e,n)=>{_i.init(e,n),pa.init(e,n),e.email=r=>e.check(lf(Yh,r)),e.url=r=>e.check(gf(Qh,r)),e.jwt=r=>e.check(Af(pd,r)),e.emoji=r=>e.check(mf(ed,r)),e.guid=r=>e.check(xo(To,r)),e.uuid=r=>e.check(ff(Mn,r)),e.uuidv4=r=>e.check(hf(Mn,r)),e.uuidv6=r=>e.check(df(Mn,r)),e.uuidv7=r=>e.check(pf(Mn,r)),e.nanoid=r=>e.check(_f(td,r)),e.guid=r=>e.check(xo(To,r)),e.cuid=r=>e.check(yf(nd,r)),e.cuid2=r=>e.check(vf(rd,r)),e.ulid=r=>e.check(bf(id,r)),e.base64=r=>e.check(Cf(fd,r)),e.base64url=r=>e.check(Pf(hd,r)),e.xid=r=>e.check(wf(od,r)),e.ksuid=r=>e.check(xf(sd,r)),e.ipv4=r=>e.check(kf(ad,r)),e.ipv6=r=>e.check(Sf(ud,r)),e.cidrv4=r=>e.check(zf(cd,r)),e.cidrv6=r=>e.check(Tf(ld,r)),e.e164=r=>e.check(Ef(dd,r)),e.datetime=r=>e.check(da(r)),e.date=r=>e.check(Ih(r)),e.time=r=>e.check(Oh(r)),e.duration=r=>e.check(Dh(r))});function T(e){return cf(Kh,e)}const de=A("ZodStringFormat",(e,n)=>{fe.init(e,n),pa.init(e,n)}),Yh=A("ZodEmail",(e,n)=>{dl.init(e,n),de.init(e,n)}),To=A("ZodGUID",(e,n)=>{fl.init(e,n),de.init(e,n)}),Mn=A("ZodUUID",(e,n)=>{hl.init(e,n),de.init(e,n)}),Qh=A("ZodURL",(e,n)=>{pl.init(e,n),de.init(e,n)}),ed=A("ZodEmoji",(e,n)=>{gl.init(e,n),de.init(e,n)}),td=A("ZodNanoID",(e,n)=>{ml.init(e,n),de.init(e,n)}),nd=A("ZodCUID",(e,n)=>{_l.init(e,n),de.init(e,n)}),rd=A("ZodCUID2",(e,n)=>{yl.init(e,n),de.init(e,n)}),id=A("ZodULID",(e,n)=>{vl.init(e,n),de.init(e,n)}),od=A("ZodXID",(e,n)=>{bl.init(e,n),de.init(e,n)}),sd=A("ZodKSUID",(e,n)=>{wl.init(e,n),de.init(e,n)}),ad=A("ZodIPv4",(e,n)=>{Tl.init(e,n),de.init(e,n)}),ud=A("ZodIPv6",(e,n)=>{Cl.init(e,n),de.init(e,n)}),cd=A("ZodCIDRv4",(e,n)=>{Pl.init(e,n),de.init(e,n)}),ld=A("ZodCIDRv6",(e,n)=>{El.init(e,n),de.init(e,n)}),fd=A("ZodBase64",(e,n)=>{Al.init(e,n),de.init(e,n)}),hd=A("ZodBase64URL",(e,n)=>{$l.init(e,n),de.init(e,n)}),dd=A("ZodE164",(e,n)=>{Il.init(e,n),de.init(e,n)}),pd=A("ZodJWT",(e,n)=>{Ol.init(e,n),de.init(e,n)}),ga=A("ZodNumber",(e,n)=>{ta.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(i,o,s)=>ah(e,i,o),e.gt=(i,o)=>e.check(So(i,o)),e.gte=(i,o)=>e.check(Er(i,o)),e.min=(i,o)=>e.check(Er(i,o)),e.lt=(i,o)=>e.check(ko(i,o)),e.lte=(i,o)=>e.check(Pr(i,o)),e.max=(i,o)=>e.check(Pr(i,o)),e.int=i=>e.check(Co(i)),e.safe=i=>e.check(Co(i)),e.positive=i=>e.check(So(0,i)),e.nonnegative=i=>e.check(Er(0,i)),e.negative=i=>e.check(ko(0,i)),e.nonpositive=i=>e.check(Pr(0,i)),e.multipleOf=(i,o)=>e.check(zo(i,o)),e.step=(i,o)=>e.check(zo(i,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function G(e){return Of(ga,e)}const gd=A("ZodNumberFormat",(e,n)=>{Nl.init(e,n),ga.init(e,n)});function Co(e){return Nf(gd,e)}const md=A("ZodBoolean",(e,n)=>{Dl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>uh(e,r,i)});function oe(e){return Df(md,e)}const _d=A("ZodUndefined",(e,n)=>{jl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>lh(e,r)});function Fr(e){return jf(_d,e)}const yd=A("ZodNull",(e,n)=>{Zl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>ch(e,r,i)});function ma(e){return Zf(yd,e)}const vd=A("ZodUnknown",(e,n)=>{ql.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>hh()});function ie(){return qf(vd)}const bd=A("ZodNever",(e,n)=>{Ul.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>fh(e,r,i)});function wd(e){return Uf(bd,e)}const xd=A("ZodArray",(e,n)=>{Ll.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>_h(e,r,i,o),e.element=n.element,e.min=(r,i)=>e.check(Xn(r,i)),e.nonempty=r=>e.check(Xn(1,r)),e.max=(r,i)=>e.check(sa(r,i)),e.length=(r,i)=>e.check(aa(r,i)),e.unwrap=()=>e.element});function B(e,n){return Qf(xd,e,n)}const _a=A("ZodObject",(e,n)=>{Hl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>yh(e,r,i,o),Q(e,"shape",()=>n.shape),e.keyof=()=>$e(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ie()}),e.loose=()=>e.clone({...e._zod.def,catchall:ie()}),e.strict=()=>e.clone({...e._zod.def,catchall:wd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>uc(e,r),e.safeExtend=r=>cc(e,r),e.merge=r=>lc(e,r),e.pick=r=>sc(e,r),e.omit=r=>ac(e,r),e.partial=(...r)=>fc(wa,e,r[0]),e.required=(...r)=>hc(xa,e,r[0])});function E(e,n){const r={type:"object",shape:e??{},...Z(n)};return new _a(r)}function ze(e,n){return new _a({type:"object",shape:e,catchall:ie(),...Z(n)})}const ya=A("ZodUnion",(e,n)=>{ia.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>vh(e,r,i,o),e.options=n.options});function J(e,n){return new ya({type:"union",options:e,...Z(n)})}const kd=A("ZodDiscriminatedUnion",(e,n)=>{ya.init(e,n),Vl.init(e,n)});function va(e,n,r){return new kd({type:"union",options:n,discriminator:e,...Z(r)})}const Sd=A("ZodIntersection",(e,n)=>{Bl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>bh(e,r,i,o)});function vi(e,n){return new Sd({type:"intersection",left:e,right:n})}const zd=A("ZodRecord",(e,n)=>{Wl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>wh(e,r,i,o),e.keyType=n.keyType,e.valueType=n.valueType});function ne(e,n,r){return new zd({type:"record",keyType:e,valueType:n,...Z(r)})}const Hr=A("ZodEnum",(e,n)=>{Gl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(i,o,s)=>dh(e,i,o),e.enum=n.entries,e.options=Object.values(n.entries);const r=new Set(Object.keys(n.entries));e.extract=(i,o)=>{const s={};for(const a of i)if(r.has(a))s[a]=n.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Hr({...n,checks:[],...Z(o),entries:s})},e.exclude=(i,o)=>{const s={...n.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new Hr({...n,checks:[],...Z(o),entries:s})}});function $e(e,n){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Hr({type:"enum",entries:r,...Z(n)})}const Td=A("ZodLiteral",(e,n)=>{Jl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>ph(e,r,i),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function S(e,n){return new Td({type:"literal",values:Array.isArray(e)?e:[e],...Z(n)})}const Cd=A("ZodTransform",(e,n)=>{Xl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>mh(e,r),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new js(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ln(s,r.value,n));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(ln(a))}};const o=n.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function ba(e){return new Cd({type:"transform",transform:e})}const wa=A("ZodOptional",(e,n)=>{oa.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>fa(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function pe(e){return new wa({type:"optional",innerType:e})}const Pd=A("ZodExactOptional",(e,n)=>{Kl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>fa(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Ed(e){return new Pd({type:"optional",innerType:e})}const Ad=A("ZodNullable",(e,n)=>{Yl.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>xh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Po(e){return new Ad({type:"nullable",innerType:e})}const Rd=A("ZodDefault",(e,n)=>{Ql.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>Sh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $d(e,n){return new Rd({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():Ls(n)}})}const Id=A("ZodPrefault",(e,n)=>{ef.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>zh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Md(e,n){return new Id({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():Ls(n)}})}const xa=A("ZodNonOptional",(e,n)=>{tf.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>kh(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Od(e,n){return new xa({type:"nonoptional",innerType:e,...Z(n)})}const Nd=A("ZodCatch",(e,n)=>{nf.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>Th(e,r,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dd(e,n){return new Nd({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const jd=A("ZodPipe",(e,n)=>{rf.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>Ch(e,r,i,o),e.in=n.in,e.out=n.out});function Vr(e,n){return new jd({type:"pipe",in:e,out:n})}const Zd=A("ZodReadonly",(e,n)=>{of.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>Ph(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function qd(e){return new Zd({type:"readonly",innerType:e})}const ka=A("ZodCustom",(e,n)=>{sf.init(e,n),ue.init(e,n),e._zod.processJSONSchema=(r,i,o)=>gh(e,r)});function Ud(e,n){return eh(ka,e??(()=>!0),n)}function Ld(e,n={}){return th(ka,e,n)}function Fd(e){return nh(e)}function Sa(e,n){return Vr(ba(e),n)}const xt="io.modelcontextprotocol/related-task",_r="2.0",me=Ud(e=>e!==null&&(typeof e=="object"||typeof e=="function")),za=J([T(),G().int()]),Ta=T();ze({ttl:J([G(),ma()]).optional(),pollInterval:G().optional()});const Hd=E({ttl:G().optional()}),Vd=E({taskId:T()}),bi=ze({progressToken:za.optional(),[xt]:Vd.optional()}),Ie=E({_meta:bi.optional()}),vn=Ie.extend({task:Hd.optional()}),Bd=e=>vn.safeParse(e).success,_e=E({method:T(),params:Ie.loose().optional()}),Ue=E({_meta:bi.optional()}),Le=E({method:T(),params:Ue.loose().optional()}),ye=ze({_meta:bi.optional()}),bn=J([T(),G().int()]),Ca=E({jsonrpc:S(_r),id:bn,..._e.shape}).strict(),Eo=e=>Ca.safeParse(e).success,Pa=E({jsonrpc:S(_r),...Le.shape}).strict(),Wd=e=>Pa.safeParse(e).success,wi=E({jsonrpc:S(_r),id:bn,result:ye}).strict(),On=e=>wi.safeParse(e).success;var te;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(te||(te={}));const xi=E({jsonrpc:S(_r),id:bn.optional(),error:E({code:G().int(),message:T(),data:ie().optional()})}).strict(),Gd=e=>xi.safeParse(e).success,Jd=J([Ca,Pa,wi,xi]);J([wi,xi]);const ki=ye.strict(),Xd=Ue.extend({requestId:bn.optional(),reason:T().optional()}),Si=Le.extend({method:S("notifications/cancelled"),params:Xd}),Kd=E({src:T(),mimeType:T().optional(),sizes:B(T()).optional(),theme:$e(["light","dark"]).optional()}),wn=E({icons:B(Kd).optional()}),Zt=E({name:T(),title:T().optional()}),yr=Zt.extend({...Zt.shape,...wn.shape,version:T(),websiteUrl:T().optional(),description:T().optional()}),Yd=vi(E({applyDefaults:oe().optional()}),ne(T(),ie())),Qd=Sa(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,vi(E({form:Yd.optional(),url:me.optional()}),ne(T(),ie()).optional())),ep=ze({list:me.optional(),cancel:me.optional(),requests:ze({sampling:ze({createMessage:me.optional()}).optional(),elicitation:ze({create:me.optional()}).optional()}).optional()}),tp=ze({list:me.optional(),cancel:me.optional(),requests:ze({tools:ze({call:me.optional()}).optional()}).optional()}),np=E({experimental:ne(T(),me).optional(),sampling:E({context:me.optional(),tools:me.optional()}).optional(),elicitation:Qd.optional(),roots:E({listChanged:oe().optional()}).optional(),tasks:ep.optional()}),rp=Ie.extend({protocolVersion:T(),capabilities:np,clientInfo:yr}),ip=_e.extend({method:S("initialize"),params:rp}),op=E({experimental:ne(T(),me).optional(),logging:me.optional(),completions:me.optional(),prompts:E({listChanged:oe().optional()}).optional(),resources:E({subscribe:oe().optional(),listChanged:oe().optional()}).optional(),tools:E({listChanged:oe().optional()}).optional(),tasks:tp.optional()}),sp=ye.extend({protocolVersion:T(),capabilities:op,serverInfo:yr,instructions:T().optional()}),ap=Le.extend({method:S("notifications/initialized"),params:Ue.optional()}),vr=_e.extend({method:S("ping"),params:Ie.optional()}),up=E({progress:G(),total:pe(G()),message:pe(T())}),cp=E({...Ue.shape,...up.shape,progressToken:za}),zi=Le.extend({method:S("notifications/progress"),params:cp}),lp=Ie.extend({cursor:Ta.optional()}),xn=_e.extend({params:lp.optional()}),kn=ye.extend({nextCursor:Ta.optional()}),fp=$e(["working","input_required","completed","failed","cancelled"]),Sn=E({taskId:T(),status:fp,ttl:J([G(),ma()]),createdAt:T(),lastUpdatedAt:T(),pollInterval:pe(G()),statusMessage:pe(T())}),Ti=ye.extend({task:Sn}),hp=Ue.merge(Sn),Yn=Le.extend({method:S("notifications/tasks/status"),params:hp}),Ci=_e.extend({method:S("tasks/get"),params:Ie.extend({taskId:T()})}),Pi=ye.merge(Sn),Ei=_e.extend({method:S("tasks/result"),params:Ie.extend({taskId:T()})});ye.loose();const Ai=xn.extend({method:S("tasks/list")}),Ri=kn.extend({tasks:B(Sn)}),$i=_e.extend({method:S("tasks/cancel"),params:Ie.extend({taskId:T()})}),dp=ye.merge(Sn),Ea=E({uri:T(),mimeType:pe(T()),_meta:ne(T(),ie()).optional()}),Aa=Ea.extend({text:T()}),Ii=T().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ra=Ea.extend({blob:Ii}),zn=$e(["user","assistant"]),Ht=E({audience:B(zn).optional(),priority:G().min(0).max(1).optional(),lastModified:da({offset:!0}).optional()}),$a=E({...Zt.shape,...wn.shape,uri:T(),description:pe(T()),mimeType:pe(T()),annotations:Ht.optional(),_meta:pe(ze({}))}),pp=E({...Zt.shape,...wn.shape,uriTemplate:T(),description:pe(T()),mimeType:pe(T()),annotations:Ht.optional(),_meta:pe(ze({}))}),gp=xn.extend({method:S("resources/list")}),Ia=kn.extend({resources:B($a)}),mp=xn.extend({method:S("resources/templates/list")}),_p=kn.extend({resourceTemplates:B(pp)}),Mi=Ie.extend({uri:T()}),yp=Mi,vp=_e.extend({method:S("resources/read"),params:yp}),Ma=ye.extend({contents:B(J([Aa,Ra]))}),bp=Le.extend({method:S("notifications/resources/list_changed"),params:Ue.optional()}),wp=Mi,xp=_e.extend({method:S("resources/subscribe"),params:wp}),kp=Mi,Sp=_e.extend({method:S("resources/unsubscribe"),params:kp}),zp=Ue.extend({uri:T()}),Tp=Le.extend({method:S("notifications/resources/updated"),params:zp}),Cp=E({name:T(),description:pe(T()),required:pe(oe())}),Pp=E({...Zt.shape,...wn.shape,description:pe(T()),arguments:pe(B(Cp)),_meta:pe(ze({}))}),Ep=xn.extend({method:S("prompts/list")}),Ap=kn.extend({prompts:B(Pp)}),Rp=Ie.extend({name:T(),arguments:ne(T(),T()).optional()}),$p=_e.extend({method:S("prompts/get"),params:Rp}),Oi=E({type:S("text"),text:T(),annotations:Ht.optional(),_meta:ne(T(),ie()).optional()}),Ni=E({type:S("image"),data:Ii,mimeType:T(),annotations:Ht.optional(),_meta:ne(T(),ie()).optional()}),Di=E({type:S("audio"),data:Ii,mimeType:T(),annotations:Ht.optional(),_meta:ne(T(),ie()).optional()}),Ip=E({type:S("tool_use"),name:T(),id:T(),input:ne(T(),ie()),_meta:ne(T(),ie()).optional()}),Oa=E({type:S("resource"),resource:J([Aa,Ra]),annotations:Ht.optional(),_meta:ne(T(),ie()).optional()}),Na=$a.extend({type:S("resource_link")}),Tn=J([Oi,Ni,Di,Na,Oa]),Mp=E({role:zn,content:Tn}),Op=ye.extend({description:T().optional(),messages:B(Mp)}),Np=Le.extend({method:S("notifications/prompts/list_changed"),params:Ue.optional()}),Dp=E({title:T().optional(),readOnlyHint:oe().optional(),destructiveHint:oe().optional(),idempotentHint:oe().optional(),openWorldHint:oe().optional()}),jp=E({taskSupport:$e(["required","optional","forbidden"]).optional()}),ji=E({...Zt.shape,...wn.shape,description:T().optional(),inputSchema:E({type:S("object"),properties:ne(T(),me).optional(),required:B(T()).optional()}).catchall(ie()),outputSchema:E({type:S("object"),properties:ne(T(),me).optional(),required:B(T()).optional()}).catchall(ie()).optional(),annotations:Dp.optional(),execution:jp.optional(),_meta:ne(T(),ie()).optional()}),Da=xn.extend({method:S("tools/list")}),Zp=kn.extend({tools:B(ji)}),br=ye.extend({content:B(Tn).default([]),structuredContent:ne(T(),ie()).optional(),isError:oe().optional()});br.or(ye.extend({toolResult:ie()}));const qp=vn.extend({name:T(),arguments:ne(T(),ie()).optional()}),ja=_e.extend({method:S("tools/call"),params:qp}),Up=Le.extend({method:S("notifications/tools/list_changed"),params:Ue.optional()});E({autoRefresh:oe().default(!0),debounceMs:G().int().nonnegative().default(300)});const Za=$e(["debug","info","notice","warning","error","critical","alert","emergency"]),Lp=Ie.extend({level:Za}),Fp=_e.extend({method:S("logging/setLevel"),params:Lp}),Hp=Ue.extend({level:Za,logger:T().optional(),data:ie()}),Vp=Le.extend({method:S("notifications/message"),params:Hp}),Bp=E({name:T().optional()}),Wp=E({hints:B(Bp).optional(),costPriority:G().min(0).max(1).optional(),speedPriority:G().min(0).max(1).optional(),intelligencePriority:G().min(0).max(1).optional()}),Gp=E({mode:$e(["auto","required","none"]).optional()}),Jp=E({type:S("tool_result"),toolUseId:T().describe("The unique identifier for the corresponding tool call."),content:B(Tn).default([]),structuredContent:E({}).loose().optional(),isError:oe().optional(),_meta:ne(T(),ie()).optional()}),Xp=va("type",[Oi,Ni,Di]),Qn=va("type",[Oi,Ni,Di,Ip,Jp]),Kp=E({role:zn,content:J([Qn,B(Qn)]),_meta:ne(T(),ie()).optional()}),Yp=vn.extend({messages:B(Kp),modelPreferences:Wp.optional(),systemPrompt:T().optional(),includeContext:$e(["none","thisServer","allServers"]).optional(),temperature:G().optional(),maxTokens:G().int(),stopSequences:B(T()).optional(),metadata:me.optional(),tools:B(ji).optional(),toolChoice:Gp.optional()}),Qp=_e.extend({method:S("sampling/createMessage"),params:Yp}),eg=ye.extend({model:T(),stopReason:pe($e(["endTurn","stopSequence","maxTokens"]).or(T())),role:zn,content:Xp}),tg=ye.extend({model:T(),stopReason:pe($e(["endTurn","stopSequence","maxTokens","toolUse"]).or(T())),role:zn,content:J([Qn,B(Qn)])}),ng=E({type:S("boolean"),title:T().optional(),description:T().optional(),default:oe().optional()}),rg=E({type:S("string"),title:T().optional(),description:T().optional(),minLength:G().optional(),maxLength:G().optional(),format:$e(["email","uri","date","date-time"]).optional(),default:T().optional()}),ig=E({type:$e(["number","integer"]),title:T().optional(),description:T().optional(),minimum:G().optional(),maximum:G().optional(),default:G().optional()}),og=E({type:S("string"),title:T().optional(),description:T().optional(),enum:B(T()),default:T().optional()}),sg=E({type:S("string"),title:T().optional(),description:T().optional(),oneOf:B(E({const:T(),title:T()})),default:T().optional()}),ag=E({type:S("string"),title:T().optional(),description:T().optional(),enum:B(T()),enumNames:B(T()).optional(),default:T().optional()}),ug=J([og,sg]),cg=E({type:S("array"),title:T().optional(),description:T().optional(),minItems:G().optional(),maxItems:G().optional(),items:E({type:S("string"),enum:B(T())}),default:B(T()).optional()}),lg=E({type:S("array"),title:T().optional(),description:T().optional(),minItems:G().optional(),maxItems:G().optional(),items:E({anyOf:B(E({const:T(),title:T()}))}),default:B(T()).optional()}),fg=J([cg,lg]),hg=J([ag,ug,fg]),dg=J([hg,ng,rg,ig]),pg=vn.extend({mode:S("form").optional(),message:T(),requestedSchema:E({type:S("object"),properties:ne(T(),dg),required:B(T()).optional()})}),gg=vn.extend({mode:S("url"),message:T(),elicitationId:T(),url:T().url()}),mg=J([pg,gg]),_g=_e.extend({method:S("elicitation/create"),params:mg}),yg=Ue.extend({elicitationId:T()}),vg=Le.extend({method:S("notifications/elicitation/complete"),params:yg}),bg=ye.extend({action:$e(["accept","decline","cancel"]),content:Sa(e=>e===null?void 0:e,ne(T(),J([T(),G(),oe(),B(T())])).optional())}),wg=E({type:S("ref/resource"),uri:T()}),xg=E({type:S("ref/prompt"),name:T()}),kg=Ie.extend({ref:J([xg,wg]),argument:E({name:T(),value:T()}),context:E({arguments:ne(T(),T()).optional()}).optional()}),Sg=_e.extend({method:S("completion/complete"),params:kg}),zg=ye.extend({completion:ze({values:B(T()).max(100),total:pe(G().int()),hasMore:pe(oe())})}),Tg=E({uri:T().startsWith("file://"),name:T().optional(),_meta:ne(T(),ie()).optional()}),Cg=_e.extend({method:S("roots/list"),params:Ie.optional()}),Pg=ye.extend({roots:B(Tg)}),Eg=Le.extend({method:S("notifications/roots/list_changed"),params:Ue.optional()});J([vr,ip,Sg,Fp,$p,Ep,gp,mp,vp,xp,Sp,ja,Da,Ci,Ei,Ai,$i]);J([Si,zi,ap,Eg,Yn]);J([ki,eg,tg,bg,Pg,Pi,Ri,Ti]);J([vr,Qp,_g,Cg,Ci,Ei,Ai,$i]);J([Si,zi,Vp,Tp,bp,Up,Np,Yn,vg]);J([ki,sp,zg,Op,Ap,Ia,_p,Ma,br,Zp,Pi,Ri,Ti]);class X extends Error{constructor(n,r,i){super(`MCP error ${n}: ${r}`),this.code=n,this.data=i,this.name="McpError"}static fromError(n,r,i){if(n===te.UrlElicitationRequired&&i){const o=i;if(o.elicitations)return new Ag(o.elicitations,r)}return new X(n,r,i)}}class Ag extends X{constructor(n,r=`URL elicitation${n.length>1?"s":""} required`){super(te.UrlElicitationRequired,r,{elicitations:n})}get elicitations(){var n;return((n=this.data)==null?void 0:n.elicitations)??[]}}function bt(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ao(e){const n=Eh(e),r=n==null?void 0:n.method;if(!r)throw new Error("Schema is missing a method literal");const i=Ah(r);if(typeof i!="string")throw new Error("Schema method literal must be a string");return i}function Ro(e,n){const r=ha(e,n);if(!r.success)throw r.error;return r.data}const Rg=6e4;class $g{constructor(n){this._options=n,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Si,r=>{this._oncancel(r)}),this.setNotificationHandler(zi,r=>{this._onprogress(r)}),this.setRequestHandler(vr,r=>({})),this._taskStore=n==null?void 0:n.taskStore,this._taskMessageQueue=n==null?void 0:n.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ci,async(r,i)=>{const o=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!o)throw new X(te.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ei,async(r,i)=>{const o=async()=>{var u;const s=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,i.sessionId);){if(c.type==="response"||c.type==="error"){const l=c.message,h=l.id,f=this._requestResolvers.get(h);if(f)if(this._requestResolvers.delete(h),c.type==="response")f(l);else{const d=l,p=new X(d.error.code,d.error.message,d.error.data);f(p)}else{const d=c.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${h}`))}continue}await((u=this._transport)==null?void 0:u.send(c.message,{relatedRequestId:i.requestId}))}}const a=await this._taskStore.getTask(s,i.sessionId);if(!a)throw new X(te.InvalidParams,`Task not found: ${s}`);if(!bt(a.status))return await this._waitForTaskUpdate(s,i.signal),await o();if(bt(a.status)){const c=await this._taskStore.getTaskResult(s,i.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[xt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Ai,async(r,i)=>{var o;try{const{tasks:s,nextCursor:a}=await this._taskStore.listTasks((o=r.params)==null?void 0:o.cursor,i.sessionId);return{tasks:s,nextCursor:a,_meta:{}}}catch(s){throw new X(te.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler($i,async(r,i)=>{try{const o=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!o)throw new X(te.InvalidParams,`Task not found: ${r.params.taskId}`);if(bt(o.status))throw new X(te.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(r.params.taskId);const s=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!s)throw new X(te.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof X?o:new X(te.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(n){if(!n.params.requestId)return;const r=this._requestHandlerAbortControllers.get(n.params.requestId);r==null||r.abort(n.params.reason)}_setupTimeout(n,r,i,o,s=!1){this._timeoutInfo.set(n,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:i,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(n){const r=this._timeoutInfo.get(n);if(!r)return!1;const i=Date.now()-r.startTime;if(r.maxTotalTimeout&&i>=r.maxTotalTimeout)throw this._timeoutInfo.delete(n),X.fromError(te.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:i});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(n){const r=this._timeoutInfo.get(n);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(n))}async connect(n){var s,a,u;this._transport=n;const r=(s=this.transport)==null?void 0:s.onclose;this._transport.onclose=()=>{r==null||r(),this._onclose()};const i=(a=this.transport)==null?void 0:a.onerror;this._transport.onerror=c=>{i==null||i(c),this._onerror(c)};const o=(u=this._transport)==null?void 0:u.onmessage;this._transport.onmessage=(c,l)=>{o==null||o(c,l),On(c)||Gd(c)?this._onresponse(c):Eo(c)?this._onrequest(c,l):Wd(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var i;const n=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const r=X.fromError(te.ConnectionClosed,"Connection closed");this._transport=void 0,(i=this.onclose)==null||i.call(this);for(const o of n.values())o(r)}_onerror(n){var r;(r=this.onerror)==null||r.call(this,n)}_onnotification(n){const r=this._notificationHandlers.get(n.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(n)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(n,r){var h,f,d,p;const i=this._requestHandlers.get(n.method)??this.fallbackRequestHandler,o=this._transport,s=(d=(f=(h=n.params)==null?void 0:h._meta)==null?void 0:f[xt])==null?void 0:d.taskId;if(i===void 0){const g={jsonrpc:"2.0",id:n.id,error:{code:te.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:g,timestamp:Date.now()},o==null?void 0:o.sessionId).catch(_=>this._onerror(new Error(`Failed to enqueue error response: ${_}`))):o==null||o.send(g).catch(_=>this._onerror(new Error(`Failed to send an error response: ${_}`)));return}const a=new AbortController;this._requestHandlerAbortControllers.set(n.id,a);const u=Bd(n.params)?n.params.task:void 0,c=this._taskStore?this.requestTaskStore(n,o==null?void 0:o.sessionId):void 0,l={signal:a.signal,sessionId:o==null?void 0:o.sessionId,_meta:(p=n.params)==null?void 0:p._meta,sendNotification:async g=>{const _={relatedRequestId:n.id};s&&(_.relatedTask={taskId:s}),await this.notification(g,_)},sendRequest:async(g,_,y)=>{var C;const m={...y,relatedRequestId:n.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});const w=((C=m.relatedTask)==null?void 0:C.taskId)??s;return w&&c&&await c.updateTaskStatus(w,"input_required"),await this.request(g,_,m)},authInfo:r==null?void 0:r.authInfo,requestId:n.id,requestInfo:r==null?void 0:r.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:u==null?void 0:u.ttl,closeSSEStream:r==null?void 0:r.closeSSEStream,closeStandaloneSSEStream:r==null?void 0:r.closeStandaloneSSEStream};Promise.resolve().then(()=>{u&&this.assertTaskHandlerCapability(n.method)}).then(()=>i(n,l)).then(async g=>{if(a.signal.aborted)return;const _={result:g,jsonrpc:"2.0",id:n.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:_,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(_))},async g=>{if(a.signal.aborted)return;const _={jsonrpc:"2.0",id:n.id,error:{code:Number.isSafeInteger(g.code)?g.code:te.InternalError,message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:_,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(_))}).catch(g=>this._onerror(new Error(`Failed to send response: ${g}`))).finally(()=>{this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(n){const{progressToken:r,...i}=n.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(n)}`));return}const a=this._responseHandlers.get(o),u=this._timeoutInfo.get(o);if(u&&a&&u.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}s(i)}_onresponse(n){const r=Number(n.id),i=this._requestResolvers.get(r);if(i){if(this._requestResolvers.delete(r),On(n))i(n);else{const a=new X(n.error.code,n.error.message,n.error.data);i(a)}return}const o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(n)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(On(n)&&n.result&&typeof n.result=="object"){const a=n.result;if(a.task&&typeof a.task=="object"){const u=a.task;typeof u.taskId=="string"&&(s=!0,this._taskProgressTokens.set(u.taskId,r))}}if(s||this._progressHandlers.delete(r),On(n))o(n);else{const a=X.fromError(n.error.code,n.error.message,n.error.data);o(a)}}get transport(){return this._transport}async close(){var n;await((n=this._transport)==null?void 0:n.close())}async*requestStream(n,r,i){var a,u;const{task:o}=i??{};if(!o){try{yield{type:"result",result:await this.request(n,r,i)}}catch(c){yield{type:"error",error:c instanceof X?c:new X(te.InternalError,String(c))}}return}let s;try{const c=await this.request(n,Ti,i);if(c.task)s=c.task.taskId,yield{type:"taskCreated",task:c.task};else throw new X(te.InternalError,"Task creation did not return a task");for(;;){const l=await this.getTask({taskId:s},i);if(yield{type:"taskStatus",task:l},bt(l.status)){l.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,i)}:l.status==="failed"?yield{type:"error",error:new X(te.InternalError,`Task ${s} failed`)}:l.status==="cancelled"&&(yield{type:"error",error:new X(te.InternalError,`Task ${s} was cancelled`)});return}if(l.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,i)};return}const h=l.pollInterval??((a=this._options)==null?void 0:a.defaultTaskPollInterval)??1e3;await new Promise(f=>setTimeout(f,h)),(u=i==null?void 0:i.signal)==null||u.throwIfAborted()}}catch(c){yield{type:"error",error:c instanceof X?c:new X(te.InternalError,String(c))}}}request(n,r,i){const{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a,task:u,relatedTask:c}=i??{};return new Promise((l,h)=>{var w,C,b,v,k;const f=x=>{h(x)};if(!this._transport){f(new Error("Not connected"));return}if(((w=this._options)==null?void 0:w.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(n.method),u&&this.assertTaskCapability(n.method)}catch(x){f(x);return}(C=i==null?void 0:i.signal)==null||C.throwIfAborted();const d=this._requestMessageId++,p={...n,jsonrpc:"2.0",id:d};i!=null&&i.onprogress&&(this._progressHandlers.set(d,i.onprogress),p.params={...n.params,_meta:{...((b=n.params)==null?void 0:b._meta)||{},progressToken:d}}),u&&(p.params={...p.params,task:u}),c&&(p.params={...p.params,_meta:{...((v=p.params)==null?void 0:v._meta)||{},[xt]:c}});const g=x=>{var M;this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),(M=this._transport)==null||M.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(x)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a}).catch($=>this._onerror(new Error(`Failed to send cancellation: ${$}`)));const P=x instanceof X?x:new X(te.RequestTimeout,String(x));h(P)};this._responseHandlers.set(d,x=>{var P;if(!((P=i==null?void 0:i.signal)!=null&&P.aborted)){if(x instanceof Error)return h(x);try{const M=ha(r,x.result);M.success?l(M.data):h(M.error)}catch(M){h(M)}}}),(k=i==null?void 0:i.signal)==null||k.addEventListener("abort",()=>{var x;g((x=i==null?void 0:i.signal)==null?void 0:x.reason)});const _=(i==null?void 0:i.timeout)??Rg,y=()=>g(X.fromError(te.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(d,_,i==null?void 0:i.maxTotalTimeout,y,(i==null?void 0:i.resetTimeoutOnProgress)??!1);const m=c==null?void 0:c.taskId;if(m){const x=P=>{const M=this._responseHandlers.get(d);M?M(P):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,x),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(d),h(P)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a}).catch(x=>{this._cleanupTimeout(d),h(x)})})}async getTask(n,r){return this.request({method:"tasks/get",params:n},Pi,r)}async getTaskResult(n,r,i){return this.request({method:"tasks/result",params:n},r,i)}async listTasks(n,r){return this.request({method:"tasks/list",params:n},Ri,r)}async cancelTask(n,r){return this.request({method:"tasks/cancel",params:n},dp,r)}async notification(n,r){var u,c,l,h;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(n.method);const i=(u=r==null?void 0:r.relatedTask)==null?void 0:u.taskId;if(i){const f={...n,jsonrpc:"2.0",params:{...n.params,_meta:{...((c=n.params)==null?void 0:c._meta)||{},[xt]:r.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:f,timestamp:Date.now()});return}if((((l=this._options)==null?void 0:l.debouncedNotificationMethods)??[]).includes(n.method)&&!n.params&&!(r!=null&&r.relatedRequestId)&&!(r!=null&&r.relatedTask)){if(this._pendingDebouncedNotifications.has(n.method))return;this._pendingDebouncedNotifications.add(n.method),Promise.resolve().then(()=>{var d,p;if(this._pendingDebouncedNotifications.delete(n.method),!this._transport)return;let f={...n,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(f={...f,params:{...f.params,_meta:{...((d=f.params)==null?void 0:d._meta)||{},[xt]:r.relatedTask}}}),(p=this._transport)==null||p.send(f,r).catch(g=>this._onerror(g))});return}let a={...n,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(a={...a,params:{...a.params,_meta:{...((h=a.params)==null?void 0:h._meta)||{},[xt]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(n,r){const i=Ao(n);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(o,s)=>{const a=Ro(n,o);return Promise.resolve(r(a,s))})}removeRequestHandler(n){this._requestHandlers.delete(n)}assertCanSetRequestHandler(n){if(this._requestHandlers.has(n))throw new Error(`A request handler for ${n} already exists, which would be overridden`)}setNotificationHandler(n,r){const i=Ao(n);this._notificationHandlers.set(i,o=>{const s=Ro(n,o);return Promise.resolve(r(s))})}removeNotificationHandler(n){this._notificationHandlers.delete(n)}_cleanupTaskProgressHandler(n){const r=this._taskProgressTokens.get(n);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(n))}async _enqueueTaskMessage(n,r,i){var s;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=(s=this._options)==null?void 0:s.maxTaskQueueSize;await this._taskMessageQueue.enqueue(n,r,i,o)}async _clearTaskQueue(n,r){if(this._taskMessageQueue){const i=await this._taskMessageQueue.dequeueAll(n,r);for(const o of i)if(o.type==="request"&&Eo(o.message)){const s=o.message.id,a=this._requestResolvers.get(s);a?(a(new X(te.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${n} cleanup`))}}}async _waitForTaskUpdate(n,r){var o,s;let i=((o=this._options)==null?void 0:o.defaultTaskPollInterval)??1e3;try{const a=await((s=this._taskStore)==null?void 0:s.getTask(n));a!=null&&a.pollInterval&&(i=a.pollInterval)}catch{}return new Promise((a,u)=>{if(r.aborted){u(new X(te.InvalidRequest,"Request cancelled"));return}const c=setTimeout(a,i);r.addEventListener("abort",()=>{clearTimeout(c),u(new X(te.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(n,r){const i=this._taskStore;if(!i)throw new Error("No task store configured");return{createTask:async o=>{if(!n)throw new Error("No request provided");return await i.createTask(o,n.id,{method:n.method,params:n.params},r)},getTask:async o=>{const s=await i.getTask(o,r);if(!s)throw new X(te.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,a)=>{await i.storeTaskResult(o,s,a,r);const u=await i.getTask(o,r);if(u){const c=Yn.parse({method:"notifications/tasks/status",params:u});await this.notification(c),bt(u.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>i.getTaskResult(o,r),updateTaskStatus:async(o,s,a)=>{const u=await i.getTask(o,r);if(!u)throw new X(te.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(bt(u.status))throw new X(te.InvalidParams,`Cannot update task "${o}" from terminal status "${u.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(o,s,a,r);const c=await i.getTask(o,r);if(c){const l=Yn.parse({method:"notifications/tasks/status",params:c});await this.notification(l),bt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>i.listTasks(o,r)}}}var Ig="2026-01-26",Mg="ui/notifications/tool-input-partial";let Og=class{constructor(n=window.parent,r){be(this,"eventTarget");be(this,"eventSource");be(this,"messageListener");be(this,"onclose");be(this,"onerror");be(this,"onmessage");be(this,"sessionId");be(this,"setProtocolVersion");this.eventTarget=n,this.eventSource=r,this.messageListener=i=>{var s,a,u;if(r&&i.source!==this.eventSource){console.debug("Ignoring message from unknown source",i);return}let o=Jd.safeParse(i.data);o.success?(console.debug("Parsed message",o.data),(s=this.onmessage)==null||s.call(this,o.data)):((a=i.data)==null?void 0:a.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,i):(console.error("Failed to parse message",o.error.message,i),(u=this.onerror)==null||u.call(this,Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(n,r){n.method!==Mg&&console.debug("Sending message",n),this.eventTarget.postMessage(n,"*")}async close(){var n;window.removeEventListener("message",this.messageListener),(n=this.onclose)==null||n.call(this)}};var Ng=J([S("light"),S("dark")]).describe("Color theme preference for the host environment."),fn=J([S("inline"),S("fullscreen"),S("pip")]).describe("Display mode for UI presentation."),Dg=J([S("--color-background-primary"),S("--color-background-secondary"),S("--color-background-tertiary"),S("--color-background-inverse"),S("--color-background-ghost"),S("--color-background-info"),S("--color-background-danger"),S("--color-background-success"),S("--color-background-warning"),S("--color-background-disabled"),S("--color-text-primary"),S("--color-text-secondary"),S("--color-text-tertiary"),S("--color-text-inverse"),S("--color-text-ghost"),S("--color-text-info"),S("--color-text-danger"),S("--color-text-success"),S("--color-text-warning"),S("--color-text-disabled"),S("--color-border-primary"),S("--color-border-secondary"),S("--color-border-tertiary"),S("--color-border-inverse"),S("--color-border-ghost"),S("--color-border-info"),S("--color-border-danger"),S("--color-border-success"),S("--color-border-warning"),S("--color-border-disabled"),S("--color-ring-primary"),S("--color-ring-secondary"),S("--color-ring-inverse"),S("--color-ring-info"),S("--color-ring-danger"),S("--color-ring-success"),S("--color-ring-warning"),S("--font-sans"),S("--font-mono"),S("--font-weight-normal"),S("--font-weight-medium"),S("--font-weight-semibold"),S("--font-weight-bold"),S("--font-text-xs-size"),S("--font-text-sm-size"),S("--font-text-md-size"),S("--font-text-lg-size"),S("--font-heading-xs-size"),S("--font-heading-sm-size"),S("--font-heading-md-size"),S("--font-heading-lg-size"),S("--font-heading-xl-size"),S("--font-heading-2xl-size"),S("--font-heading-3xl-size"),S("--font-text-xs-line-height"),S("--font-text-sm-line-height"),S("--font-text-md-line-height"),S("--font-text-lg-line-height"),S("--font-heading-xs-line-height"),S("--font-heading-sm-line-height"),S("--font-heading-md-line-height"),S("--font-heading-lg-line-height"),S("--font-heading-xl-line-height"),S("--font-heading-2xl-line-height"),S("--font-heading-3xl-line-height"),S("--border-radius-xs"),S("--border-radius-sm"),S("--border-radius-md"),S("--border-radius-lg"),S("--border-radius-xl"),S("--border-radius-full"),S("--border-width-regular"),S("--shadow-hairline"),S("--shadow-sm"),S("--shadow-md"),S("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),jg=ne(Dg.describe(`Style variables for theming MCP apps.
|
|
47
47
|
|
|
48
48
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
49
49
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
50
50
|
|
|
51
51
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
52
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
52
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),J([T(),Fr()]).describe(`Style variables for theming MCP apps.
|
|
53
53
|
|
|
54
54
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
55
55
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -61,10 +61,10 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
61
61
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
62
62
|
|
|
63
63
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
64
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);E({method:S("ui/open-link"),params:E({url:T().describe("URL to open in the host's browser")})});var
|
|
64
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);E({method:S("ui/open-link"),params:E({url:T().describe("URL to open in the host's browser")})});var Zg=E({isError:oe().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),qg=E({isError:oe().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),Ug=E({isError:oe().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();E({method:S("ui/notifications/sandbox-proxy-ready"),params:E({})});var Zi=E({connectDomains:B(T()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
65
65
|
|
|
66
66
|
- Maps to CSP \`connect-src\` directive
|
|
67
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:B(T()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:B(T()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:B(T()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),qi=E({camera:E({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:E({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:E({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:E({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});E({method:S("ui/notifications/size-changed"),params:E({width:
|
|
67
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:B(T()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:B(T()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:B(T()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),qi=E({camera:E({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:E({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:E({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:E({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});E({method:S("ui/notifications/size-changed"),params:E({width:G().optional().describe("New width in pixels."),height:G().optional().describe("New height in pixels.")})});var Lg=E({method:S("ui/notifications/tool-input"),params:E({arguments:ne(T(),ie().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Fg=E({method:S("ui/notifications/tool-input-partial"),params:E({arguments:ne(T(),ie().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Hg=E({method:S("ui/notifications/tool-cancelled"),params:E({reason:T().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Vg=E({fonts:T().optional()}),Bg=E({variables:jg.optional().describe("CSS variables for theming the app."),css:Vg.optional().describe("CSS blocks that apps can inject.")}),Wg=E({method:S("ui/resource-teardown"),params:E({})});ne(T(),ie());var $o=E({text:E({}).optional().describe("Host supports text content blocks."),image:E({}).optional().describe("Host supports image content blocks."),audio:E({}).optional().describe("Host supports audio content blocks."),resource:E({}).optional().describe("Host supports resource content blocks."),resourceLink:E({}).optional().describe("Host supports resource link content blocks."),structuredContent:E({}).optional().describe("Host supports structured content.")});E({method:S("ui/notifications/request-teardown"),params:E({}).optional()});var Gg=E({experimental:E({}).optional().describe("Experimental features (structure TBD)."),openLinks:E({}).optional().describe("Host supports opening external URLs."),downloadFile:E({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:E({listChanged:oe().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:E({listChanged:oe().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:E({}).optional().describe("Host accepts log messages."),sandbox:E({permissions:qi.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Zi.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:$o.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:$o.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),Jg=E({experimental:E({}).optional().describe("Experimental features (structure TBD)."),tools:E({listChanged:oe().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:B(fn).optional().describe("Display modes the app supports.")});E({method:S("ui/notifications/initialized"),params:E({}).optional()});E({csp:Zi.optional().describe("Content Security Policy configuration for UI resources."),permissions:qi.optional().describe("Sandbox permissions requested by the UI resource."),domain:T().optional().describe(`Dedicated origin for view sandbox.
|
|
68
68
|
|
|
69
69
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
70
70
|
|
|
@@ -78,13 +78,13 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
78
78
|
|
|
79
79
|
- \`true\`: request visible border + background
|
|
80
80
|
- \`false\`: request no visible border + background
|
|
81
|
-
- omitted: host decides border`)});E({method:S("ui/request-display-mode"),params:E({mode:fn.describe("The display mode being requested.")})});var
|
|
81
|
+
- omitted: host decides border`)});E({method:S("ui/request-display-mode"),params:E({mode:fn.describe("The display mode being requested.")})});var Xg=E({mode:fn.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Kg=J([S("model"),S("app")]).describe("Tool visibility scope - who can access the tool.");E({resourceUri:T().optional(),visibility:B(Kg).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
82
82
|
- "model": Tool visible to and callable by the agent
|
|
83
|
-
- "app": Tool callable by the app from this server only`)});E({mimeTypes:B(T()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});E({method:S("ui/download-file"),params:E({contents:B(
|
|
84
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:T().optional().describe("User's language and region preference in BCP 47 format."),timeZone:T().optional().describe("User's timezone in IANA format."),userAgent:T().optional().describe("Host application identifier."),platform:G([S("web"),S("desktop"),S("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:E({touch:oe().optional().describe("Whether the device supports touch input."),hover:oe().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:E({top:J().describe("Top safe area inset in pixels."),right:J().describe("Right safe area inset in pixels."),bottom:J().describe("Bottom safe area inset in pixels."),left:J().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Yg=E({method:S("ui/notifications/host-context-changed"),params:ja.describe("Partial context update containing only changed fields.")});E({method:S("ui/update-model-context"),params:E({content:B(Tn).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:ne(T(),ie().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});E({method:S("ui/initialize"),params:E({appInfo:yr.describe("App identification (name and version)."),appCapabilities:Jg.describe("Features and capabilities this app provides."),protocolVersion:T().describe("Protocol version this app supports.")})});var Qg=E({protocolVersion:T().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:yr.describe("Host application identification and version."),hostCapabilities:Wg.describe("Features and capabilities provided by the host."),hostContext:ja.describe("Rich context about the host environment.")}).passthrough();class em extends Rg{constructor(r,i={},o={autoResize:!0}){super(o);be(this,"_appInfo");be(this,"_capabilities");be(this,"options");be(this,"_hostCapabilities");be(this,"_hostInfo");be(this,"_hostContext");be(this,"sendOpenLink",this.openLink);this._appInfo=r,this._capabilities=i,this.options=o,this.setRequestHandler(vr,s=>(console.log("Received ping:",s.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(r){this.setNotificationHandler(Ug,i=>r(i.params))}set ontoolinputpartial(r){this.setNotificationHandler(Lg,i=>r(i.params))}set ontoolresult(r){this.setNotificationHandler(Kg,i=>r(i.params))}set ontoolcancelled(r){this.setNotificationHandler(Fg,i=>r(i.params))}set onhostcontextchanged(r){this.setNotificationHandler(Yg,i=>{this._hostContext={...this._hostContext,...i.params},r(i.params)})}set onteardown(r){this.setRequestHandler(Bg,(i,o)=>r(i.params,o))}set oncalltool(r){this.setRequestHandler(Na,(i,o)=>r(i.params,o))}set onlisttools(r){this.setRequestHandler(Oa,(i,o)=>r(i.params,o))}assertCapabilityForMethod(r){}assertRequestHandlerCapability(r){switch(r){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${r})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${r} registered`)}}assertNotificationCapability(r){}assertTaskCapability(r){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(r){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(r,i){if(typeof r=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${r}"). Did you mean: callServerTool({ name: "${r}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:r},br,i)}async readServerResource(r,i){return await this.request({method:"resources/read",params:r},$a,i)}async listServerResources(r,i){return await this.request({method:"resources/list",params:r},Ra,i)}sendMessage(r,i){return this.request({method:"ui/message",params:r},qg,i)}sendLog(r){return this.notification({method:"notifications/message",params:r})}updateModelContext(r,i){return this.request({method:"ui/update-model-context",params:r},ki,i)}openLink(r,i){return this.request({method:"ui/open-link",params:r},jg,i)}downloadFile(r,i){return this.request({method:"ui/download-file",params:r},Zg,i)}requestDisplayMode(r,i){return this.request({method:"ui/request-display-mode",params:r},Gg,i)}sendSizeChanged(r){return this.notification({method:"ui/notifications/size-changed",params:r})}setupSizeChangedNotifications(){let r=!1,i=0,o=0,s=()=>{r||(r=!0,requestAnimationFrame(()=>{r=!1;let u=document.documentElement,c=u.style.width,l=u.style.height;u.style.width="fit-content",u.style.height="max-content";let h=u.getBoundingClientRect();u.style.width=c,u.style.height=l;let f=window.innerWidth-u.clientWidth,d=Math.ceil(h.width+f),p=Math.ceil(h.height);(d!==i||p!==o)&&(i=d,o=p,this.sendSizeChanged({width:d,height:p}))}))};s();let a=new ResizeObserver(s);return a.observe(document.documentElement),a.observe(document.body),()=>a.disconnect()}async connect(r=new Mg(window.parent,window.parent),i){var o;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(r);try{let s=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:$g}},Qg,i);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);this._hostCapabilities=s.hostCapabilities,this._hostInfo=s.hostInfo,this._hostContext=s.hostContext,await this.notification({method:"ui/notifications/initialized"}),(o=this.options)!=null&&o.autoResize&&this.setupSizeChangedNotifications()}catch(s){throw this.close(),s}}}function Za(e,n,r){var i,o=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function s(){var a,u=i.length,c,l=0,h=0,f=0;for(a=0;a<u;++a)c=i[a],l+=c.x||0,h+=c.y||0,f+=c.z||0;for(l=(l/u-e)*o,h=(h/u-n)*o,f=(f/u-r)*o,a=0;a<u;++a)c=i[a],l&&(c.x-=l),h&&(c.y-=h),f&&(c.z-=f)}return s.initialize=function(a){i=a},s.x=function(a){return arguments.length?(e=+a,s):e},s.y=function(a){return arguments.length?(n=+a,s):n},s.z=function(a){return arguments.length?(r=+a,s):r},s.strength=function(a){return arguments.length?(o=+a,s):o},s}function tm(e){const n=+this._x.call(null,e);return qa(this.cover(n),n,e)}function qa(e,n,r){if(isNaN(n))return e;var i,o=e._root,s={data:r},a=e._x0,u=e._x1,c,l,h,f,d;if(!o)return e._root=s,e;for(;o.length;)if((h=n>=(c=(a+u)/2))?a=c:u=c,i=o,!(o=o[f=+h]))return i[f]=s,e;if(l=+e._x.call(null,o.data),n===l)return s.next=o,i?i[f]=s:e._root=s,e;do i=i?i[f]=new Array(2):e._root=new Array(2),(h=n>=(c=(a+u)/2))?a=c:u=c;while((f=+h)==(d=+(l>=c)));return i[d]=o,i[f]=s,e}function nm(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let i=1/0,o=-1/0;for(let s=0,a;s<n;++s)isNaN(a=+this._x.call(null,e[s]))||(r[s]=a,a<i&&(i=a),a>o&&(o=a));if(i>o)return this;this.cover(i).cover(o);for(let s=0;s<n;++s)qa(this,r[s],e[s]);return this}function rm(e){if(isNaN(e=+e))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(e))+1;else{for(var i=r-n||1,o=this._root,s,a;n>e||e>=r;)switch(a=+(e<n),s=new Array(2),s[a]=o,o=s,i*=2,a){case 0:r=n+i;break;case 1:n=r-i;break}this._root&&this._root.length&&(this._root=o)}return this._x0=n,this._x1=r,this}function im(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function om(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function ct(e,n,r){this.node=e,this.x0=n,this.x1=r}function sm(e,n){var r,i=this._x0,o,s,a=this._x1,u=[],c=this._root,l,h;for(c&&u.push(new ct(c,i,a)),n==null?n=1/0:(i=e-n,a=e+n);l=u.pop();)if(!(!(c=l.node)||(o=l.x0)>a||(s=l.x1)<i))if(c.length){var f=(o+s)/2;u.push(new ct(c[1],f,s),new ct(c[0],o,f)),(h=+(e>=f))&&(l=u[u.length-1],u[u.length-1]=u[u.length-1-h],u[u.length-1-h]=l)}else{var d=Math.abs(e-+this._x.call(null,c.data));d<n&&(n=d,i=e-d,a=e+d,r=c.data)}return r}function am(e){if(isNaN(c=+this._x.call(null,e)))return this;var n,r=this._root,i,o,s,a=this._x0,u=this._x1,c,l,h,f,d;if(!r)return this;if(r.length)for(;;){if((h=c>=(l=(a+u)/2))?a=l:u=l,n=r,!(r=r[f=+h]))return this;if(!r.length)break;n[f+1&1]&&(i=n,d=f)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,o?(s?o.next=s:delete o.next,this):n?(s?n[f]=s:delete n[f],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(i?i[d]=r:this._root=r),this):(this._root=s,this)}function um(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function cm(){return this._root}function lm(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function fm(e){var n=[],r,i=this._root,o,s,a;for(i&&n.push(new ct(i,this._x0,this._x1));r=n.pop();)if(!e(i=r.node,s=r.x0,a=r.x1)&&i.length){var u=(s+a)/2;(o=i[1])&&n.push(new ct(o,u,a)),(o=i[0])&&n.push(new ct(o,s,u))}return this}function hm(e){var n=[],r=[],i;for(this._root&&n.push(new ct(this._root,this._x0,this._x1));i=n.pop();){var o=i.node;if(o.length){var s,a=i.x0,u=i.x1,c=(a+u)/2;(s=o[0])&&n.push(new ct(s,a,c)),(s=o[1])&&n.push(new ct(s,c,u))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.x1);return this}function dm(e){return e[0]}function pm(e){return arguments.length?(this._x=e,this):this._x}function Ui(e,n){var r=new Li(n??dm,NaN,NaN);return e==null?r:r.addAll(e)}function Li(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function $o(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Pe=Ui.prototype=Li.prototype;Pe.copy=function(){var e=new Li(this._x,this._x0,this._x1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=$o(n),e;for(r=[{source:n,target:e._root=new Array(2)}];n=r.pop();)for(var o=0;o<2;++o)(i=n.source[o])&&(i.length?r.push({source:i,target:n.target[o]=new Array(2)}):n.target[o]=$o(i));return e};Pe.add=tm;Pe.addAll=nm;Pe.cover=rm;Pe.data=im;Pe.extent=om;Pe.find=sm;Pe.remove=am;Pe.removeAll=um;Pe.root=cm;Pe.size=lm;Pe.visit=fm;Pe.visitAfter=hm;Pe.x=pm;function gm(e){const n=+this._x.call(null,e),r=+this._y.call(null,e);return Ua(this.cover(n,r),n,r,e)}function Ua(e,n,r,i){if(isNaN(n)||isNaN(r))return e;var o,s=e._root,a={data:i},u=e._x0,c=e._y0,l=e._x1,h=e._y1,f,d,p,g,_,y,m,w;if(!s)return e._root=a,e;for(;s.length;)if((_=n>=(f=(u+l)/2))?u=f:l=f,(y=r>=(d=(c+h)/2))?c=d:h=d,o=s,!(s=s[m=y<<1|_]))return o[m]=a,e;if(p=+e._x.call(null,s.data),g=+e._y.call(null,s.data),n===p&&r===g)return a.next=s,o?o[m]=a:e._root=a,e;do o=o?o[m]=new Array(4):e._root=new Array(4),(_=n>=(f=(u+l)/2))?u=f:l=f,(y=r>=(d=(c+h)/2))?c=d:h=d;while((m=y<<1|_)===(w=(g>=d)<<1|p>=f));return o[w]=s,o[m]=a,e}function mm(e){var n,r,i=e.length,o,s,a=new Array(i),u=new Array(i),c=1/0,l=1/0,h=-1/0,f=-1/0;for(r=0;r<i;++r)isNaN(o=+this._x.call(null,n=e[r]))||isNaN(s=+this._y.call(null,n))||(a[r]=o,u[r]=s,o<c&&(c=o),o>h&&(h=o),s<l&&(l=s),s>f&&(f=s));if(c>h||l>f)return this;for(this.cover(c,l).cover(h,f),r=0;r<i;++r)Ua(this,a[r],u[r],e[r]);return this}function _m(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._x1,s=this._y1;if(isNaN(r))o=(r=Math.floor(e))+1,s=(i=Math.floor(n))+1;else{for(var a=o-r||1,u=this._root,c,l;r>e||e>=o||i>n||n>=s;)switch(l=(n<i)<<1|e<r,c=new Array(4),c[l]=u,u=c,a*=2,l){case 0:o=r+a,s=i+a;break;case 1:r=o-a,s=i+a;break;case 2:o=r+a,i=s-a;break;case 3:r=o-a,i=s-a;break}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=i,this._x1=o,this._y1=s,this}function ym(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function vm(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function ke(e,n,r,i,o){this.node=e,this.x0=n,this.y0=r,this.x1=i,this.y1=o}function bm(e,n,r){var i,o=this._x0,s=this._y0,a,u,c,l,h=this._x1,f=this._y1,d=[],p=this._root,g,_;for(p&&d.push(new ke(p,o,s,h,f)),r==null?r=1/0:(o=e-r,s=n-r,h=e+r,f=n+r,r*=r);g=d.pop();)if(!(!(p=g.node)||(a=g.x0)>h||(u=g.y0)>f||(c=g.x1)<o||(l=g.y1)<s))if(p.length){var y=(a+c)/2,m=(u+l)/2;d.push(new ke(p[3],y,m,c,l),new ke(p[2],a,m,y,l),new ke(p[1],y,u,c,m),new ke(p[0],a,u,y,m)),(_=(n>=m)<<1|e>=y)&&(g=d[d.length-1],d[d.length-1]=d[d.length-1-_],d[d.length-1-_]=g)}else{var w=e-+this._x.call(null,p.data),C=n-+this._y.call(null,p.data),b=w*w+C*C;if(b<r){var v=Math.sqrt(r=b);o=e-v,s=n-v,h=e+v,f=n+v,i=p.data}}return i}function wm(e){if(isNaN(h=+this._x.call(null,e))||isNaN(f=+this._y.call(null,e)))return this;var n,r=this._root,i,o,s,a=this._x0,u=this._y0,c=this._x1,l=this._y1,h,f,d,p,g,_,y,m;if(!r)return this;if(r.length)for(;;){if((g=h>=(d=(a+c)/2))?a=d:c=d,(_=f>=(p=(u+l)/2))?u=p:l=p,n=r,!(r=r[y=_<<1|g]))return this;if(!r.length)break;(n[y+1&3]||n[y+2&3]||n[y+3&3])&&(i=n,m=y)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,o?(s?o.next=s:delete o.next,this):n?(s?n[y]=s:delete n[y],(r=n[0]||n[1]||n[2]||n[3])&&r===(n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[m]=r:this._root=r),this):(this._root=s,this)}function xm(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function km(){return this._root}function Sm(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function zm(e){var n=[],r,i=this._root,o,s,a,u,c;for(i&&n.push(new ke(i,this._x0,this._y0,this._x1,this._y1));r=n.pop();)if(!e(i=r.node,s=r.x0,a=r.y0,u=r.x1,c=r.y1)&&i.length){var l=(s+u)/2,h=(a+c)/2;(o=i[3])&&n.push(new ke(o,l,h,u,c)),(o=i[2])&&n.push(new ke(o,s,h,l,c)),(o=i[1])&&n.push(new ke(o,l,a,u,h)),(o=i[0])&&n.push(new ke(o,s,a,l,h))}return this}function Tm(e){var n=[],r=[],i;for(this._root&&n.push(new ke(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var o=i.node;if(o.length){var s,a=i.x0,u=i.y0,c=i.x1,l=i.y1,h=(a+c)/2,f=(u+l)/2;(s=o[0])&&n.push(new ke(s,a,u,h,f)),(s=o[1])&&n.push(new ke(s,h,u,c,f)),(s=o[2])&&n.push(new ke(s,a,f,h,l)),(s=o[3])&&n.push(new ke(s,h,f,c,l))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Cm(e){return e[0]}function Pm(e){return arguments.length?(this._x=e,this):this._x}function Em(e){return e[1]}function Am(e){return arguments.length?(this._y=e,this):this._y}function Fi(e,n,r){var i=new Hi(n??Cm,r??Em,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Hi(e,n,r,i,o,s){this._x=e,this._y=n,this._x0=r,this._y0=i,this._x1=o,this._y1=s,this._root=void 0}function Io(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Se=Fi.prototype=Hi.prototype;Se.copy=function(){var e=new Hi(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=Io(n),e;for(r=[{source:n,target:e._root=new Array(4)}];n=r.pop();)for(var o=0;o<4;++o)(i=n.source[o])&&(i.length?r.push({source:i,target:n.target[o]=new Array(4)}):n.target[o]=Io(i));return e};Se.add=gm;Se.addAll=mm;Se.cover=_m;Se.data=ym;Se.extent=vm;Se.find=bm;Se.remove=wm;Se.removeAll=xm;Se.root=km;Se.size=Sm;Se.visit=zm;Se.visitAfter=Tm;Se.x=Pm;Se.y=Am;function Rm(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),i=+this._z.call(null,e);return La(this.cover(n,r,i),n,r,i,e)}function La(e,n,r,i,o){if(isNaN(n)||isNaN(r)||isNaN(i))return e;var s,a=e._root,u={data:o},c=e._x0,l=e._y0,h=e._z0,f=e._x1,d=e._y1,p=e._z1,g,_,y,m,w,C,b,v,k,x,P;if(!a)return e._root=u,e;for(;a.length;)if((b=n>=(g=(c+f)/2))?c=g:f=g,(v=r>=(_=(l+d)/2))?l=_:d=_,(k=i>=(y=(h+p)/2))?h=y:p=y,s=a,!(a=a[x=k<<2|v<<1|b]))return s[x]=u,e;if(m=+e._x.call(null,a.data),w=+e._y.call(null,a.data),C=+e._z.call(null,a.data),n===m&&r===w&&i===C)return u.next=a,s?s[x]=u:e._root=u,e;do s=s?s[x]=new Array(8):e._root=new Array(8),(b=n>=(g=(c+f)/2))?c=g:f=g,(v=r>=(_=(l+d)/2))?l=_:d=_,(k=i>=(y=(h+p)/2))?h=y:p=y;while((x=k<<2|v<<1|b)===(P=(C>=y)<<2|(w>=_)<<1|m>=g));return s[P]=a,s[x]=u,e}function $m(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),i=new Float64Array(n),o=new Float64Array(n);let s=1/0,a=1/0,u=1/0,c=-1/0,l=-1/0,h=-1/0;for(let f=0,d,p,g,_;f<n;++f)isNaN(p=+this._x.call(null,d=e[f]))||isNaN(g=+this._y.call(null,d))||isNaN(_=+this._z.call(null,d))||(r[f]=p,i[f]=g,o[f]=_,p<s&&(s=p),p>c&&(c=p),g<a&&(a=g),g>l&&(l=g),_<u&&(u=_),_>h&&(h=_));if(s>c||a>l||u>h)return this;this.cover(s,a,u).cover(c,l,h);for(let f=0;f<n;++f)La(this,r[f],i[f],o[f],e[f]);return this}function Im(e,n,r){if(isNaN(e=+e)||isNaN(n=+n)||isNaN(r=+r))return this;var i=this._x0,o=this._y0,s=this._z0,a=this._x1,u=this._y1,c=this._z1;if(isNaN(i))a=(i=Math.floor(e))+1,u=(o=Math.floor(n))+1,c=(s=Math.floor(r))+1;else{for(var l=a-i||1,h=this._root,f,d;i>e||e>=a||o>n||n>=u||s>r||r>=c;)switch(d=(r<s)<<2|(n<o)<<1|e<i,f=new Array(8),f[d]=h,h=f,l*=2,d){case 0:a=i+l,u=o+l,c=s+l;break;case 1:i=a-l,u=o+l,c=s+l;break;case 2:a=i+l,o=u-l,c=s+l;break;case 3:i=a-l,o=u-l,c=s+l;break;case 4:a=i+l,u=o+l,s=c-l;break;case 5:i=a-l,u=o+l,s=c-l;break;case 6:a=i+l,o=u-l,s=c-l;break;case 7:i=a-l,o=u-l,s=c-l;break}this._root&&this._root.length&&(this._root=h)}return this._x0=i,this._y0=o,this._z0=s,this._x1=a,this._y1=u,this._z1=c,this}function Mm(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function Om(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function re(e,n,r,i,o,s,a){this.node=e,this.x0=n,this.y0=r,this.z0=i,this.x1=o,this.y1=s,this.z1=a}function Nm(e,n,r,i){var o,s=this._x0,a=this._y0,u=this._z0,c,l,h,f,d,p,g=this._x1,_=this._y1,y=this._z1,m=[],w=this._root,C,b;for(w&&m.push(new re(w,s,a,u,g,_,y)),i==null?i=1/0:(s=e-i,a=n-i,u=r-i,g=e+i,_=n+i,y=r+i,i*=i);C=m.pop();)if(!(!(w=C.node)||(c=C.x0)>g||(l=C.y0)>_||(h=C.z0)>y||(f=C.x1)<s||(d=C.y1)<a||(p=C.z1)<u))if(w.length){var v=(c+f)/2,k=(l+d)/2,x=(h+p)/2;m.push(new re(w[7],v,k,x,f,d,p),new re(w[6],c,k,x,v,d,p),new re(w[5],v,l,x,f,k,p),new re(w[4],c,l,x,v,k,p),new re(w[3],v,k,h,f,d,x),new re(w[2],c,k,h,v,d,x),new re(w[1],v,l,h,f,k,x),new re(w[0],c,l,h,v,k,x)),(b=(r>=x)<<2|(n>=k)<<1|e>=v)&&(C=m[m.length-1],m[m.length-1]=m[m.length-1-b],m[m.length-1-b]=C)}else{var P=e-+this._x.call(null,w.data),M=n-+this._y.call(null,w.data),$=r-+this._z.call(null,w.data),N=P*P+M*M+$*$;if(N<i){var D=Math.sqrt(i=N);s=e-D,a=n-D,u=r-D,g=e+D,_=n+D,y=r+D,o=w.data}}return o}const Dm=(e,n,r,i,o,s)=>Math.sqrt((e-i)**2+(n-o)**2+(r-s)**2);function jm(e,n,r,i){const o=[],s=e-i,a=n-i,u=r-i,c=e+i,l=n+i,h=r+i;return this.visit((f,d,p,g,_,y,m)=>{if(!f.length)do{const w=f.data;Dm(e,n,r,this._x(w),this._y(w),this._z(w))<=i&&o.push(w)}while(f=f.next);return d>c||p>l||g>h||_<s||y<a||m<u}),o}function Zm(e){if(isNaN(d=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(g=+this._z.call(null,e)))return this;var n,r=this._root,i,o,s,a=this._x0,u=this._y0,c=this._z0,l=this._x1,h=this._y1,f=this._z1,d,p,g,_,y,m,w,C,b,v,k;if(!r)return this;if(r.length)for(;;){if((w=d>=(_=(a+l)/2))?a=_:l=_,(C=p>=(y=(u+h)/2))?u=y:h=y,(b=g>=(m=(c+f)/2))?c=m:f=m,n=r,!(r=r[v=b<<2|C<<1|w]))return this;if(!r.length)break;(n[v+1&7]||n[v+2&7]||n[v+3&7]||n[v+4&7]||n[v+5&7]||n[v+6&7]||n[v+7&7])&&(i=n,k=v)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,o?(s?o.next=s:delete o.next,this):n?(s?n[v]=s:delete n[v],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[k]=r:this._root=r),this):(this._root=s,this)}function qm(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function Um(){return this._root}function Lm(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Fm(e){var n=[],r,i=this._root,o,s,a,u,c,l,h;for(i&&n.push(new re(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=n.pop();)if(!e(i=r.node,s=r.x0,a=r.y0,u=r.z0,c=r.x1,l=r.y1,h=r.z1)&&i.length){var f=(s+c)/2,d=(a+l)/2,p=(u+h)/2;(o=i[7])&&n.push(new re(o,f,d,p,c,l,h)),(o=i[6])&&n.push(new re(o,s,d,p,f,l,h)),(o=i[5])&&n.push(new re(o,f,a,p,c,d,h)),(o=i[4])&&n.push(new re(o,s,a,p,f,d,h)),(o=i[3])&&n.push(new re(o,f,d,u,c,l,p)),(o=i[2])&&n.push(new re(o,s,d,u,f,l,p)),(o=i[1])&&n.push(new re(o,f,a,u,c,d,p)),(o=i[0])&&n.push(new re(o,s,a,u,f,d,p))}return this}function Hm(e){var n=[],r=[],i;for(this._root&&n.push(new re(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=n.pop();){var o=i.node;if(o.length){var s,a=i.x0,u=i.y0,c=i.z0,l=i.x1,h=i.y1,f=i.z1,d=(a+l)/2,p=(u+h)/2,g=(c+f)/2;(s=o[0])&&n.push(new re(s,a,u,c,d,p,g)),(s=o[1])&&n.push(new re(s,d,u,c,l,p,g)),(s=o[2])&&n.push(new re(s,a,p,c,d,h,g)),(s=o[3])&&n.push(new re(s,d,p,c,l,h,g)),(s=o[4])&&n.push(new re(s,a,u,g,d,p,f)),(s=o[5])&&n.push(new re(s,d,u,g,l,p,f)),(s=o[6])&&n.push(new re(s,a,p,g,d,h,f)),(s=o[7])&&n.push(new re(s,d,p,g,l,h,f))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function Vm(e){return e[0]}function Bm(e){return arguments.length?(this._x=e,this):this._x}function Wm(e){return e[1]}function Jm(e){return arguments.length?(this._y=e,this):this._y}function Gm(e){return e[2]}function Xm(e){return arguments.length?(this._z=e,this):this._z}function Vi(e,n,r,i){var o=new Bi(n??Vm,r??Wm,i??Gm,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function Bi(e,n,r,i,o,s,a,u,c){this._x=e,this._y=n,this._z=r,this._x0=i,this._y0=o,this._z0=s,this._x1=a,this._y1=u,this._z1=c,this._root=void 0}function Mo(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var ve=Vi.prototype=Bi.prototype;ve.copy=function(){var e=new Bi(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=Mo(n),e;for(r=[{source:n,target:e._root=new Array(8)}];n=r.pop();)for(var o=0;o<8;++o)(i=n.source[o])&&(i.length?r.push({source:i,target:n.target[o]=new Array(8)}):n.target[o]=Mo(i));return e};ve.add=Rm;ve.addAll=$m;ve.cover=Im;ve.data=Mm;ve.extent=Om;ve.find=Nm;ve.findAllWithinRadius=jm;ve.remove=Zm;ve.removeAll=qm;ve.root=Um;ve.size=Lm;ve.visit=Fm;ve.visitAfter=Hm;ve.x=Bm;ve.y=Jm;ve.z=Xm;function We(e){return function(){return e}}function Ne(e){return(e()-.5)*1e-6}function Ar(e){return e.x+e.vx}function Oo(e){return e.y+e.vy}function Km(e){return e.z+e.vz}function Ym(e){var n,r,i,o,s=1,a=1;typeof e!="function"&&(e=We(e==null?1:+e));function u(){for(var h,f=n.length,d,p,g,_,y,m,w,C=0;C<a;++C)for(d=(r===1?Ui(n,Ar):r===2?Fi(n,Ar,Oo):r===3?Vi(n,Ar,Oo,Km):null).visitAfter(c),h=0;h<f;++h)p=n[h],m=i[p.index],w=m*m,g=p.x+p.vx,r>1&&(_=p.y+p.vy),r>2&&(y=p.z+p.vz),d.visit(b);function b(v,k,x,P,M,$,N){var D=[k,x,P,M,$,N],H=D[0],z=D[1],O=D[2],R=D[r],j=D[r+1],F=D[r+2],q=v.data,V=v.r,L=m+V;if(q){if(q.index>p.index){var W=g-q.x-q.vx,ee=r>1?_-q.y-q.vy:0,K=r>2?y-q.z-q.vz:0,he=W*W+ee*ee+K*K;he<L*L&&(W===0&&(W=Ne(o),he+=W*W),r>1&&ee===0&&(ee=Ne(o),he+=ee*ee),r>2&&K===0&&(K=Ne(o),he+=K*K),he=(L-(he=Math.sqrt(he)))/he*s,p.vx+=(W*=he)*(L=(V*=V)/(w+V)),r>1&&(p.vy+=(ee*=he)*L),r>2&&(p.vz+=(K*=he)*L),q.vx-=W*(L=1-L),r>1&&(q.vy-=ee*L),r>2&&(q.vz-=K*L))}return}return H>g+L||R<g-L||r>1&&(z>_+L||j<_-L)||r>2&&(O>y+L||F<y-L)}}function c(h){if(h.data)return h.r=i[h.data.index];for(var f=h.r=0;f<Math.pow(2,r);++f)h[f]&&h[f].r>h.r&&(h.r=h[f].r)}function l(){if(n){var h,f=n.length,d;for(i=new Array(f),h=0;h<f;++h)d=n[h],i[d.index]=+e(d,h,n)}}return u.initialize=function(h,...f){n=h,o=f.find(d=>typeof d=="function")||Math.random,r=f.find(d=>[1,2,3].includes(d))||2,l()},u.iterations=function(h){return arguments.length?(a=+h,u):a},u.strength=function(h){return arguments.length?(s=+h,u):s},u.radius=function(h){return arguments.length?(e=typeof h=="function"?h:We(+h),l(),u):e},u}function Qm(e){return e.index}function No(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function Fa(e){var n=Qm,r=d,i,o=We(30),s,a,u,c,l,h,f=1;e==null&&(e=[]);function d(m){return 1/Math.min(c[m.source.index],c[m.target.index])}function p(m){for(var w=0,C=e.length;w<f;++w)for(var b=0,v,k,x,P=0,M=0,$=0,N,D;b<C;++b)v=e[b],k=v.source,x=v.target,P=x.x+x.vx-k.x-k.vx||Ne(h),u>1&&(M=x.y+x.vy-k.y-k.vy||Ne(h)),u>2&&($=x.z+x.vz-k.z-k.vz||Ne(h)),N=Math.sqrt(P*P+M*M+$*$),N=(N-s[b])/N*m*i[b],P*=N,M*=N,$*=N,x.vx-=P*(D=l[b]),u>1&&(x.vy-=M*D),u>2&&(x.vz-=$*D),k.vx+=P*(D=1-D),u>1&&(k.vy+=M*D),u>2&&(k.vz+=$*D)}function g(){if(a){var m,w=a.length,C=e.length,b=new Map(a.map((k,x)=>[n(k,x,a),k])),v;for(m=0,c=new Array(w);m<C;++m)v=e[m],v.index=m,typeof v.source!="object"&&(v.source=No(b,v.source)),typeof v.target!="object"&&(v.target=No(b,v.target)),c[v.source.index]=(c[v.source.index]||0)+1,c[v.target.index]=(c[v.target.index]||0)+1;for(m=0,l=new Array(C);m<C;++m)v=e[m],l[m]=c[v.source.index]/(c[v.source.index]+c[v.target.index]);i=new Array(C),_(),s=new Array(C),y()}}function _(){if(a)for(var m=0,w=e.length;m<w;++m)i[m]=+r(e[m],m,e)}function y(){if(a)for(var m=0,w=e.length;m<w;++m)s[m]=+o(e[m],m,e)}return p.initialize=function(m,...w){a=m,h=w.find(C=>typeof C=="function")||Math.random,u=w.find(C=>[1,2,3].includes(C))||2,g()},p.links=function(m){return arguments.length?(e=m,g(),p):e},p.id=function(m){return arguments.length?(n=m,p):n},p.iterations=function(m){return arguments.length?(f=+m,p):f},p.strength=function(m){return arguments.length?(r=typeof m=="function"?m:We(+m),_(),p):r},p.distance=function(m){return arguments.length?(o=typeof m=="function"?m:We(+m),y(),p):o},p}var e_={value:()=>{}};function Cn(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new Hn(r)}function Hn(e){this._=e}function t_(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Hn.prototype=Cn.prototype={constructor:Hn,on:function(e,n){var r=this._,i=t_(e+"",r),o,s=-1,a=i.length;if(arguments.length<2){for(;++s<a;)if((o=(e=i[s]).type)&&(o=n_(r[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++s<a;)if(o=(e=i[s]).type)r[o]=Do(r[o],e.name,n);else if(n==null)for(o in r)r[o]=Do(r[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new Hn(e)},call:function(e,n){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,s;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],i=0,o=s.length;i<o;++i)s[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,s=i.length;o<s;++o)i[o].value.apply(n,r)}};function n_(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function Do(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=e_,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var qt=0,en=0,Vt=0,Ha=1e3,er,tn,tr=0,Ct=0,wr=0,hn=typeof performance=="object"&&performance.now?performance:Date,Va=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Wi(){return Ct||(Va(r_),Ct=hn.now()+wr)}function r_(){Ct=0}function nr(){this._call=this._time=this._next=null}nr.prototype=Ji.prototype={constructor:nr,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Wi():+r)+(n==null?0:+n),!this._next&&tn!==this&&(tn?tn._next=this:er=this,tn=this),this._call=e,this._time=r,Br()},stop:function(){this._call&&(this._call=null,this._time=1/0,Br())}};function Ji(e,n,r){var i=new nr;return i.restart(e,n,r),i}function i_(){Wi(),++qt;for(var e=er,n;e;)(n=Ct-e._time)>=0&&e._call.call(void 0,n),e=e._next;--qt}function jo(){Ct=(tr=hn.now())+wr,qt=en=0;try{i_()}finally{qt=0,s_(),Ct=0}}function o_(){var e=hn.now(),n=e-tr;n>Ha&&(wr-=n,tr=e)}function s_(){for(var e,n=er,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:er=r);tn=e,Br(i)}function Br(e){if(!qt){en&&(en=clearTimeout(en));var n=e-Ct;n>24?(e<1/0&&(en=setTimeout(jo,e-hn.now()-wr)),Vt&&(Vt=clearInterval(Vt))):(Vt||(tr=hn.now(),Vt=setInterval(o_,Ha)),qt=1,Va(jo))}}function Zo(e,n,r){var i=new nr;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}const a_=1664525,u_=1013904223,qo=4294967296;function c_(){let e=1;return()=>(e=(a_*e+u_)%qo)/qo}var Uo=3;function Rr(e){return e.x}function Lo(e){return e.y}function l_(e){return e.z}var f_=10,h_=Math.PI*(3-Math.sqrt(5)),d_=Math.PI*20/(9+Math.sqrt(221));function p_(e,n){n=n||2;var r=Math.min(Uo,Math.max(1,Math.round(n))),i,o=1,s=.001,a=1-Math.pow(s,1/300),u=0,c=.6,l=new Map,h=Ji(p),f=Cn("tick","end"),d=c_();e==null&&(e=[]);function p(){g(),f.call("tick",i),o<s&&(h.stop(),f.call("end",i))}function g(m){var w,C=e.length,b;m===void 0&&(m=1);for(var v=0;v<m;++v)for(o+=(u-o)*a,l.forEach(function(k){k(o)}),w=0;w<C;++w)b=e[w],b.fx==null?b.x+=b.vx*=c:(b.x=b.fx,b.vx=0),r>1&&(b.fy==null?b.y+=b.vy*=c:(b.y=b.fy,b.vy=0)),r>2&&(b.fz==null?b.z+=b.vz*=c:(b.z=b.fz,b.vz=0));return i}function _(){for(var m=0,w=e.length,C;m<w;++m){if(C=e[m],C.index=m,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),C.fz!=null&&(C.z=C.fz),isNaN(C.x)||r>1&&isNaN(C.y)||r>2&&isNaN(C.z)){var b=f_*(r>2?Math.cbrt(.5+m):r>1?Math.sqrt(.5+m):m),v=m*h_,k=m*d_;r===1?C.x=b:r===2?(C.x=b*Math.cos(v),C.y=b*Math.sin(v)):(C.x=b*Math.sin(v)*Math.cos(k),C.y=b*Math.cos(v),C.z=b*Math.sin(v)*Math.sin(k))}(isNaN(C.vx)||r>1&&isNaN(C.vy)||r>2&&isNaN(C.vz))&&(C.vx=0,r>1&&(C.vy=0),r>2&&(C.vz=0))}}function y(m){return m.initialize&&m.initialize(e,d,r),m}return _(),i={tick:g,restart:function(){return h.restart(p),i},stop:function(){return h.stop(),i},numDimensions:function(m){return arguments.length?(r=Math.min(Uo,Math.max(1,Math.round(m))),l.forEach(y),i):r},nodes:function(m){return arguments.length?(e=m,_(),l.forEach(y),i):e},alpha:function(m){return arguments.length?(o=+m,i):o},alphaMin:function(m){return arguments.length?(s=+m,i):s},alphaDecay:function(m){return arguments.length?(a=+m,i):+a},alphaTarget:function(m){return arguments.length?(u=+m,i):u},velocityDecay:function(m){return arguments.length?(c=1-m,i):1-c},randomSource:function(m){return arguments.length?(d=m,l.forEach(y),i):d},force:function(m,w){return arguments.length>1?(w==null?l.delete(m):l.set(m,y(w)),i):l.get(m)},find:function(){var m=Array.prototype.slice.call(arguments),w=m.shift()||0,C=(r>1?m.shift():null)||0,b=(r>2?m.shift():null)||0,v=m.shift()||1/0,k=0,x=e.length,P,M,$,N,D,H;for(v*=v,k=0;k<x;++k)D=e[k],P=w-D.x,M=C-(D.y||0),$=b-(D.z||0),N=P*P+M*M+$*$,N<v&&(H=D,v=N);return H},on:function(m,w){return arguments.length>1?(f.on(m,w),i):f.on(m)}}}function Ba(){var e,n,r,i,o,s=We(-30),a,u=1,c=1/0,l=.81;function h(g){var _,y=e.length,m=(n===1?Ui(e,Rr):n===2?Fi(e,Rr,Lo):n===3?Vi(e,Rr,Lo,l_):null).visitAfter(d);for(o=g,_=0;_<y;++_)r=e[_],m.visit(p)}function f(){if(e){var g,_=e.length,y;for(a=new Array(_),g=0;g<_;++g)y=e[g],a[y.index]=+s(y,g,e)}}function d(g){var _=0,y,m,w=0,C,b,v,k,x=g.length;if(x){for(C=b=v=k=0;k<x;++k)(y=g[k])&&(m=Math.abs(y.value))&&(_+=y.value,w+=m,C+=m*(y.x||0),b+=m*(y.y||0),v+=m*(y.z||0));_*=Math.sqrt(4/x),g.x=C/w,n>1&&(g.y=b/w),n>2&&(g.z=v/w)}else{y=g,y.x=y.data.x,n>1&&(y.y=y.data.y),n>2&&(y.z=y.data.z);do _+=a[y.data.index];while(y=y.next)}g.value=_}function p(g,_,y,m,w){if(!g.value)return!0;var C=[y,m,w][n-1],b=g.x-r.x,v=n>1?g.y-r.y:0,k=n>2?g.z-r.z:0,x=C-_,P=b*b+v*v+k*k;if(x*x/l<P)return P<c&&(b===0&&(b=Ne(i),P+=b*b),n>1&&v===0&&(v=Ne(i),P+=v*v),n>2&&k===0&&(k=Ne(i),P+=k*k),P<u&&(P=Math.sqrt(u*P)),r.vx+=b*g.value*o/P,n>1&&(r.vy+=v*g.value*o/P),n>2&&(r.vz+=k*g.value*o/P)),!0;if(g.length||P>=c)return;(g.data!==r||g.next)&&(b===0&&(b=Ne(i),P+=b*b),n>1&&v===0&&(v=Ne(i),P+=v*v),n>2&&k===0&&(k=Ne(i),P+=k*k),P<u&&(P=Math.sqrt(u*P)));do g.data!==r&&(x=a[g.data.index]*o/P,r.vx+=b*x,n>1&&(r.vy+=v*x),n>2&&(r.vz+=k*x));while(g=g.next)}return h.initialize=function(g,..._){e=g,i=_.find(y=>typeof y=="function")||Math.random,n=_.find(y=>[1,2,3].includes(y))||2,f()},h.strength=function(g){return arguments.length?(s=typeof g=="function"?g:We(+g),f(),h):s},h.distanceMin=function(g){return arguments.length?(u=g*g,h):Math.sqrt(u)},h.distanceMax=function(g){return arguments.length?(c=g*g,h):Math.sqrt(c)},h.theta=function(g){return arguments.length?(l=g*g,h):Math.sqrt(l)},h}function g_(e,n,r,i){var o,s,a=We(.1),u,c;typeof e!="function"&&(e=We(+e)),n==null&&(n=0),r==null&&(r=0),i==null&&(i=0);function l(f){for(var d=0,p=o.length;d<p;++d){var g=o[d],_=g.x-n||1e-6,y=(g.y||0)-r||1e-6,m=(g.z||0)-i||1e-6,w=Math.sqrt(_*_+y*y+m*m),C=(c[d]-w)*u[d]*f/w;g.vx+=_*C,s>1&&(g.vy+=y*C),s>2&&(g.vz+=m*C)}}function h(){if(o){var f,d=o.length;for(u=new Array(d),c=new Array(d),f=0;f<d;++f)c[f]=+e(o[f],f,o),u[f]=isNaN(c[f])?0:+a(o[f],f,o)}}return l.initialize=function(f,...d){o=f,s=d.find(p=>[1,2,3].includes(p))||2,h()},l.strength=function(f){return arguments.length?(a=typeof f=="function"?f:We(+f),h(),l):a},l.radius=function(f){return arguments.length?(e=typeof f=="function"?f:We(+f),h(),l):e},l.x=function(f){return arguments.length?(n=+f,l):n},l.y=function(f){return arguments.length?(r=+f,l):r},l.z=function(f){return arguments.length?(i=+f,l):i},l}var Wr="http://www.w3.org/1999/xhtml";const Fo={svg:"http://www.w3.org/2000/svg",xhtml:Wr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function xr(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Fo.hasOwnProperty(n)?{space:Fo[n],local:e}:e}function m_(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===Wr&&n.documentElement.namespaceURI===Wr?n.createElement(e):n.createElementNS(r,e)}}function __(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Wa(e){var n=xr(e);return(n.local?__:m_)(n)}function y_(){}function Gi(e){return e==null?y_:function(){return this.querySelector(e)}}function v_(e){typeof e!="function"&&(e=Gi(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var s=n[o],a=s.length,u=i[o]=new Array(a),c,l,h=0;h<a;++h)(c=s[h])&&(l=e.call(c,c.__data__,h,s))&&("__data__"in c&&(l.__data__=c.__data__),u[h]=l);return new Ae(i,this._parents)}function b_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function w_(){return[]}function Ja(e){return e==null?w_:function(){return this.querySelectorAll(e)}}function x_(e){return function(){return b_(e.apply(this,arguments))}}function k_(e){typeof e=="function"?e=x_(e):e=Ja(e);for(var n=this._groups,r=n.length,i=[],o=[],s=0;s<r;++s)for(var a=n[s],u=a.length,c,l=0;l<u;++l)(c=a[l])&&(i.push(e.call(c,c.__data__,l,a)),o.push(c));return new Ae(i,o)}function Ga(e){return function(){return this.matches(e)}}function Xa(e){return function(n){return n.matches(e)}}var S_=Array.prototype.find;function z_(e){return function(){return S_.call(this.children,e)}}function T_(){return this.firstElementChild}function C_(e){return this.select(e==null?T_:z_(typeof e=="function"?e:Xa(e)))}var P_=Array.prototype.filter;function E_(){return Array.from(this.children)}function A_(e){return function(){return P_.call(this.children,e)}}function R_(e){return this.selectAll(e==null?E_:A_(typeof e=="function"?e:Xa(e)))}function $_(e){typeof e!="function"&&(e=Ga(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var s=n[o],a=s.length,u=i[o]=[],c,l=0;l<a;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&u.push(c);return new Ae(i,this._parents)}function Ka(e){return new Array(e.length)}function I_(){return new Ae(this._enter||this._groups.map(Ka),this._parents)}function rr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}rr.prototype={constructor:rr,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function M_(e){return function(){return e}}function O_(e,n,r,i,o,s){for(var a=0,u,c=n.length,l=s.length;a<l;++a)(u=n[a])?(u.__data__=s[a],i[a]=u):r[a]=new rr(e,s[a]);for(;a<c;++a)(u=n[a])&&(o[a]=u)}function N_(e,n,r,i,o,s,a){var u,c,l=new Map,h=n.length,f=s.length,d=new Array(h),p;for(u=0;u<h;++u)(c=n[u])&&(d[u]=p=a.call(c,c.__data__,u,n)+"",l.has(p)?o[u]=c:l.set(p,c));for(u=0;u<f;++u)p=a.call(e,s[u],u,s)+"",(c=l.get(p))?(i[u]=c,c.__data__=s[u],l.delete(p)):r[u]=new rr(e,s[u]);for(u=0;u<h;++u)(c=n[u])&&l.get(d[u])===c&&(o[u]=c)}function D_(e){return e.__data__}function j_(e,n){if(!arguments.length)return Array.from(this,D_);var r=n?N_:O_,i=this._parents,o=this._groups;typeof e!="function"&&(e=M_(e));for(var s=o.length,a=new Array(s),u=new Array(s),c=new Array(s),l=0;l<s;++l){var h=i[l],f=o[l],d=f.length,p=Z_(e.call(h,h&&h.__data__,l,i)),g=p.length,_=u[l]=new Array(g),y=a[l]=new Array(g),m=c[l]=new Array(d);r(h,f,_,y,m,p,n);for(var w=0,C=0,b,v;w<g;++w)if(b=_[w]){for(w>=C&&(C=w+1);!(v=y[C])&&++C<g;);b._next=v||null}}return a=new Ae(a,i),a._enter=u,a._exit=c,a}function Z_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function q_(){return new Ae(this._exit||this._groups.map(Ka),this._parents)}function U_(e,n,r){var i=this.enter(),o=this,s=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?s.remove():r(s),i&&o?i.merge(o).order():o}function L_(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,s=i.length,a=Math.min(o,s),u=new Array(o),c=0;c<a;++c)for(var l=r[c],h=i[c],f=l.length,d=u[c]=new Array(f),p,g=0;g<f;++g)(p=l[g]||h[g])&&(d[g]=p);for(;c<o;++c)u[c]=r[c];return new Ae(u,this._parents)}function F_(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],o=i.length-1,s=i[o],a;--o>=0;)(a=i[o])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function H_(e){e||(e=V_);function n(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s){for(var a=r[s],u=a.length,c=o[s]=new Array(u),l,h=0;h<u;++h)(l=a[h])&&(c[h]=l);c.sort(n)}return new Ae(o,this._parents).order()}function V_(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function B_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function W_(){return Array.from(this)}function J_(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,s=i.length;o<s;++o){var a=i[o];if(a)return a}return null}function G_(){let e=0;for(const n of this)++e;return e}function X_(){return!this.node()}function K_(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var o=n[r],s=0,a=o.length,u;s<a;++s)(u=o[s])&&e.call(u,u.__data__,s,o);return this}function Y_(e){return function(){this.removeAttribute(e)}}function Q_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function e0(e,n){return function(){this.setAttribute(e,n)}}function t0(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function n0(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function r0(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function i0(e,n){var r=xr(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?Q_:Y_:typeof n=="function"?r.local?r0:n0:r.local?t0:e0)(r,n))}function Ya(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function o0(e){return function(){this.style.removeProperty(e)}}function s0(e,n,r){return function(){this.style.setProperty(e,n,r)}}function a0(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function u0(e,n,r){return arguments.length>1?this.each((n==null?o0:typeof n=="function"?a0:s0)(e,n,r??"")):Ut(this.node(),e)}function Ut(e,n){return e.style.getPropertyValue(n)||Ya(e).getComputedStyle(e,null).getPropertyValue(n)}function c0(e){return function(){delete this[e]}}function l0(e,n){return function(){this[e]=n}}function f0(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function h0(e,n){return arguments.length>1?this.each((n==null?c0:typeof n=="function"?f0:l0)(e,n)):this.node()[e]}function Qa(e){return e.trim().split(/^|\s+/)}function Xi(e){return e.classList||new eu(e)}function eu(e){this._node=e,this._names=Qa(e.getAttribute("class")||"")}eu.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function tu(e,n){for(var r=Xi(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function nu(e,n){for(var r=Xi(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function d0(e){return function(){tu(this,e)}}function p0(e){return function(){nu(this,e)}}function g0(e,n){return function(){(n.apply(this,arguments)?tu:nu)(this,e)}}function m0(e,n){var r=Qa(e+"");if(arguments.length<2){for(var i=Xi(this.node()),o=-1,s=r.length;++o<s;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?g0:n?d0:p0)(r,n))}function _0(){this.textContent=""}function y0(e){return function(){this.textContent=e}}function v0(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function b0(e){return arguments.length?this.each(e==null?_0:(typeof e=="function"?v0:y0)(e)):this.node().textContent}function w0(){this.innerHTML=""}function x0(e){return function(){this.innerHTML=e}}function k0(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function S0(e){return arguments.length?this.each(e==null?w0:(typeof e=="function"?k0:x0)(e)):this.node().innerHTML}function z0(){this.nextSibling&&this.parentNode.appendChild(this)}function T0(){return this.each(z0)}function C0(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function P0(){return this.each(C0)}function E0(e){var n=typeof e=="function"?e:Wa(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function A0(){return null}function R0(e,n){var r=typeof e=="function"?e:Wa(e),i=n==null?A0:typeof n=="function"?n:Gi(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function $0(){var e=this.parentNode;e&&e.removeChild(this)}function I0(){return this.each($0)}function M0(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function O0(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function N0(e){return this.select(e?O0:M0)}function D0(e){return arguments.length?this.property("__data__",e):this.node().__data__}function j0(e){return function(n){e.call(this,n,this.__data__)}}function Z0(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function q0(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,s;r<o;++r)s=n[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):n[++i]=s;++i?n.length=i:delete this.__on}}}function U0(e,n,r){return function(){var i=this.__on,o,s=j0(n);if(i){for(var a=0,u=i.length;a<u;++a)if((o=i[a]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=r),o.value=n;return}}this.addEventListener(e.type,s,r),o={type:e.type,name:e.name,value:n,listener:s,options:r},i?i.push(o):this.__on=[o]}}function L0(e,n,r){var i=Z0(e+""),o,s=i.length,a;if(arguments.length<2){var u=this.node().__on;if(u){for(var c=0,l=u.length,h;c<l;++c)for(o=0,h=u[c];o<s;++o)if((a=i[o]).type===h.type&&a.name===h.name)return h.value}return}for(u=n?U0:q0,o=0;o<s;++o)this.each(u(i[o],n,r));return this}function ru(e,n,r){var i=Ya(e),o=i.CustomEvent;typeof o=="function"?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function F0(e,n){return function(){return ru(this,e,n)}}function H0(e,n){return function(){return ru(this,e,n.apply(this,arguments))}}function V0(e,n){return this.each((typeof n=="function"?H0:F0)(e,n))}function*B0(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&(yield a)}var iu=[null];function Ae(e,n){this._groups=e,this._parents=n}function Pn(){return new Ae([[document.documentElement]],iu)}function W0(){return this}Ae.prototype=Pn.prototype={constructor:Ae,select:v_,selectAll:k_,selectChild:C_,selectChildren:R_,filter:$_,data:j_,enter:I_,exit:q_,join:U_,merge:L_,selection:W0,order:F_,sort:H_,call:B_,nodes:W_,node:J_,size:G_,empty:X_,each:K_,attr:i0,style:u0,property:h0,classed:m0,text:b0,html:S0,raise:T0,lower:P0,append:E0,insert:R0,remove:I0,clone:N0,datum:D0,on:L0,dispatch:V0,[Symbol.iterator]:B0};function De(e){return typeof e=="string"?new Ae([[document.querySelector(e)]],[document.documentElement]):new Ae([[e]],iu)}function J0(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Ke(e,n){if(e=J0(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}const G0={passive:!1},dn={capture:!0,passive:!1};function $r(e){e.stopImmediatePropagation()}function Ot(e){e.preventDefault(),e.stopImmediatePropagation()}function ou(e){var n=e.document.documentElement,r=De(e).on("dragstart.drag",Ot,dn);"onselectstart"in n?r.on("selectstart.drag",Ot,dn):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function su(e,n){var r=e.document.documentElement,i=De(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ot,dn),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 Nn=e=>()=>e;function Jr(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:s,x:a,y:u,dx:c,dy:l,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:h}})}Jr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function X0(e){return!e.ctrlKey&&!e.button}function K0(){return this.parentNode}function Y0(e,n){return n??{x:e.x,y:e.y}}function Q0(){return navigator.maxTouchPoints||"ontouchstart"in this}function ey(){var e=X0,n=K0,r=Y0,i=Q0,o={},s=Cn("start","drag","end"),a=0,u,c,l,h,f=0;function d(b){b.on("mousedown.drag",p).filter(i).on("touchstart.drag",y).on("touchmove.drag",m,G0).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(b,v){if(!(h||!e.call(this,b,v))){var k=C(this,n.call(this,b,v),b,v,"mouse");k&&(De(b.view).on("mousemove.drag",g,dn).on("mouseup.drag",_,dn),ou(b.view),$r(b),l=!1,u=b.clientX,c=b.clientY,k("start",b))}}function g(b){if(Ot(b),!l){var v=b.clientX-u,k=b.clientY-c;l=v*v+k*k>f}o.mouse("drag",b)}function _(b){De(b.view).on("mousemove.drag mouseup.drag",null),su(b.view,l),Ot(b),o.mouse("end",b)}function y(b,v){if(e.call(this,b,v)){var k=b.changedTouches,x=n.call(this,b,v),P=k.length,M,$;for(M=0;M<P;++M)($=C(this,x,b,v,k[M].identifier,k[M]))&&($r(b),$("start",b,k[M]))}}function m(b){var v=b.changedTouches,k=v.length,x,P;for(x=0;x<k;++x)(P=o[v[x].identifier])&&(Ot(b),P("drag",b,v[x]))}function w(b){var v=b.changedTouches,k=v.length,x,P;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),x=0;x<k;++x)(P=o[v[x].identifier])&&($r(b),P("end",b,v[x]))}function C(b,v,k,x,P,M){var $=s.copy(),N=Ke(M||k,v),D,H,z;if((z=r.call(b,new Jr("beforestart",{sourceEvent:k,target:d,identifier:P,active:a,x:N[0],y:N[1],dx:0,dy:0,dispatch:$}),x))!=null)return D=z.x-N[0]||0,H=z.y-N[1]||0,function O(R,j,F){var q=N,V;switch(R){case"start":o[P]=O,V=a++;break;case"end":delete o[P],--a;case"drag":N=Ke(F||j,v),V=a;break}$.call(R,b,new Jr(R,{sourceEvent:j,subject:z,target:d,identifier:P,active:V,x:N[0]+D,y:N[1]+H,dx:N[0]-q[0],dy:N[1]-q[1],dispatch:$}),x)}}return d.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Nn(!!b),d):e},d.container=function(b){return arguments.length?(n=typeof b=="function"?b:Nn(b),d):n},d.subject=function(b){return arguments.length?(r=typeof b=="function"?b:Nn(b),d):r},d.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:Nn(!!b),d):i},d.on=function(){var b=s.on.apply(s,arguments);return b===s?d:b},d.clickDistance=function(b){return arguments.length?(f=(b=+b)*b,d):Math.sqrt(f)},d}function Ki(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function au(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function En(){}var pn=.7,ir=1/pn,Nt="\\s*([+-]?\\d+)\\s*",gn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ty=/^#([0-9a-f]{3,8})$/,ny=new RegExp(`^rgb\\(${Nt},${Nt},${Nt}\\)$`),ry=new RegExp(`^rgb\\(${Qe},${Qe},${Qe}\\)$`),iy=new RegExp(`^rgba\\(${Nt},${Nt},${Nt},${gn}\\)$`),oy=new RegExp(`^rgba\\(${Qe},${Qe},${Qe},${gn}\\)$`),sy=new RegExp(`^hsl\\(${gn},${Qe},${Qe}\\)$`),ay=new RegExp(`^hsla\\(${gn},${Qe},${Qe},${gn}\\)$`),Ho={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};Ki(En,mn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vo,formatHex:Vo,formatHex8:uy,formatHsl:cy,formatRgb:Bo,toString:Bo});function Vo(){return this.rgb().formatHex()}function uy(){return this.rgb().formatHex8()}function cy(){return uu(this).formatHsl()}function Bo(){return this.rgb().formatRgb()}function mn(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=ty.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Wo(n):r===3?new Te(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?Dn(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?Dn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=ny.exec(e))?new Te(n[1],n[2],n[3],1):(n=ry.exec(e))?new Te(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=iy.exec(e))?Dn(n[1],n[2],n[3],n[4]):(n=oy.exec(e))?Dn(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=sy.exec(e))?Xo(n[1],n[2]/100,n[3]/100,1):(n=ay.exec(e))?Xo(n[1],n[2]/100,n[3]/100,n[4]):Ho.hasOwnProperty(e)?Wo(Ho[e]):e==="transparent"?new Te(NaN,NaN,NaN,0):null}function Wo(e){return new Te(e>>16&255,e>>8&255,e&255,1)}function Dn(e,n,r,i){return i<=0&&(e=n=r=NaN),new Te(e,n,r,i)}function ly(e){return e instanceof En||(e=mn(e)),e?(e=e.rgb(),new Te(e.r,e.g,e.b,e.opacity)):new Te}function Gr(e,n,r,i){return arguments.length===1?ly(e):new Te(e,n,r,i??1)}function Te(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}Ki(Te,Gr,au(En,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pn:Math.pow(pn,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Te(zt(this.r),zt(this.g),zt(this.b),or(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:Jo,formatHex:Jo,formatHex8:fy,formatRgb:Go,toString:Go}));function Jo(){return`#${St(this.r)}${St(this.g)}${St(this.b)}`}function fy(){return`#${St(this.r)}${St(this.g)}${St(this.b)}${St((isNaN(this.opacity)?1:this.opacity)*255)}`}function Go(){const e=or(this.opacity);return`${e===1?"rgb(":"rgba("}${zt(this.r)}, ${zt(this.g)}, ${zt(this.b)}${e===1?")":`, ${e})`}`}function or(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function zt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function St(e){return e=zt(e),(e<16?"0":"")+e.toString(16)}function Xo(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Be(e,n,r,i)}function uu(e){if(e instanceof Be)return new Be(e.h,e.s,e.l,e.opacity);if(e instanceof En||(e=mn(e)),!e)return new Be;if(e instanceof Be)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(n,r,i),s=Math.max(n,r,i),a=NaN,u=s-o,c=(s+o)/2;return u?(n===s?a=(r-i)/u+(r<i)*6:r===s?a=(i-n)/u+2:a=(n-r)/u+4,u/=c<.5?s+o:2-s-o,a*=60):u=c>0&&c<1?0:a,new Be(a,u,c,e.opacity)}function hy(e,n,r,i){return arguments.length===1?uu(e):new Be(e,n,r,i??1)}function Be(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Ki(Be,hy,au(En,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new Be(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pn:Math.pow(pn,e),new Be(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,o=2*r-i;return new Te(Ir(e>=240?e-240:e+120,o,i),Ir(e,o,i),Ir(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new Be(Ko(this.h),jn(this.s),jn(this.l),or(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=or(this.opacity);return`${e===1?"hsl(":"hsla("}${Ko(this.h)}, ${jn(this.s)*100}%, ${jn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ko(e){return e=(e||0)%360,e<0?e+360:e}function jn(e){return Math.max(0,Math.min(1,e||0))}function Ir(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const cu=e=>()=>e;function dy(e,n){return function(r){return e+r*n}}function py(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function gy(e){return(e=+e)==1?lu:function(n,r){return r-n?py(n,r,e):cu(isNaN(n)?r:n)}}function lu(e,n){var r=n-e;return r?dy(e,r):cu(isNaN(e)?n:e)}const Yo=(function e(n){var r=gy(n);function i(o,s){var a=r((o=Gr(o)).r,(s=Gr(s)).r),u=r(o.g,s.g),c=r(o.b,s.b),l=lu(o.opacity,s.opacity);return function(h){return o.r=a(h),o.g=u(h),o.b=c(h),o.opacity=l(h),o+""}}return i.gamma=e,i})(1);function pt(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var Xr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mr=new RegExp(Xr.source,"g");function my(e){return function(){return e}}function _y(e){return function(n){return e(n)+""}}function yy(e,n){var r=Xr.lastIndex=Mr.lastIndex=0,i,o,s,a=-1,u=[],c=[];for(e=e+"",n=n+"";(i=Xr.exec(e))&&(o=Mr.exec(n));)(s=o.index)>r&&(s=n.slice(r,s),u[a]?u[a]+=s:u[++a]=s),(i=i[0])===(o=o[0])?u[a]?u[a]+=o:u[++a]=o:(u[++a]=null,c.push({i:a,x:pt(i,o)})),r=Mr.lastIndex;return r<n.length&&(s=n.slice(r),u[a]?u[a]+=s:u[++a]=s),u.length<2?c[0]?_y(c[0].x):my(n):(n=c.length,function(l){for(var h=0,f;h<n;++h)u[(f=c[h]).i]=f.x(l);return u.join("")})}var Qo=180/Math.PI,Kr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fu(e,n,r,i,o,s){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*r+n*i)&&(r-=e*c,i-=n*c),(u=Math.sqrt(r*r+i*i))&&(r/=u,i/=u,c/=u),e*i<n*r&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:s,rotate:Math.atan2(n,e)*Qo,skewX:Math.atan(c)*Qo,scaleX:a,scaleY:u}}var Zn;function vy(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Kr:fu(n.a,n.b,n.c,n.d,n.e,n.f)}function by(e){return e==null||(Zn||(Zn=document.createElementNS("http://www.w3.org/2000/svg","g")),Zn.setAttribute("transform",e),!(e=Zn.transform.baseVal.consolidate()))?Kr:(e=e.matrix,fu(e.a,e.b,e.c,e.d,e.e,e.f))}function hu(e,n,r,i){function o(l){return l.length?l.pop()+" ":""}function s(l,h,f,d,p,g){if(l!==f||h!==d){var _=p.push("translate(",null,n,null,r);g.push({i:_-4,x:pt(l,f)},{i:_-2,x:pt(h,d)})}else(f||d)&&p.push("translate("+f+n+d+r)}function a(l,h,f,d){l!==h?(l-h>180?h+=360:h-l>180&&(l+=360),d.push({i:f.push(o(f)+"rotate(",null,i)-2,x:pt(l,h)})):h&&f.push(o(f)+"rotate("+h+i)}function u(l,h,f,d){l!==h?d.push({i:f.push(o(f)+"skewX(",null,i)-2,x:pt(l,h)}):h&&f.push(o(f)+"skewX("+h+i)}function c(l,h,f,d,p,g){if(l!==f||h!==d){var _=p.push(o(p)+"scale(",null,",",null,")");g.push({i:_-4,x:pt(l,f)},{i:_-2,x:pt(h,d)})}else(f!==1||d!==1)&&p.push(o(p)+"scale("+f+","+d+")")}return function(l,h){var f=[],d=[];return l=e(l),h=e(h),s(l.translateX,l.translateY,h.translateX,h.translateY,f,d),a(l.rotate,h.rotate,f,d),u(l.skewX,h.skewX,f,d),c(l.scaleX,l.scaleY,h.scaleX,h.scaleY,f,d),l=h=null,function(p){for(var g=-1,_=d.length,y;++g<_;)f[(y=d[g]).i]=y.x(p);return f.join("")}}}var wy=hu(vy,"px, ","px)","deg)"),xy=hu(by,", ",")",")"),ky=1e-12;function es(e){return((e=Math.exp(e))+1/e)/2}function Sy(e){return((e=Math.exp(e))-1/e)/2}function zy(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ty=(function e(n,r,i){function o(s,a){var u=s[0],c=s[1],l=s[2],h=a[0],f=a[1],d=a[2],p=h-u,g=f-c,_=p*p+g*g,y,m;if(_<ky)m=Math.log(d/l)/n,y=function(x){return[u+x*p,c+x*g,l*Math.exp(n*x*m)]};else{var w=Math.sqrt(_),C=(d*d-l*l+i*_)/(2*l*r*w),b=(d*d-l*l-i*_)/(2*d*r*w),v=Math.log(Math.sqrt(C*C+1)-C),k=Math.log(Math.sqrt(b*b+1)-b);m=(k-v)/n,y=function(x){var P=x*m,M=es(v),$=l/(r*w)*(M*zy(n*P+v)-Sy(v));return[u+$*p,c+$*g,l*M/es(n*P+v)]}}return y.duration=m*1e3*n/Math.SQRT2,y}return o.rho=function(s){var a=Math.max(.001,+s),u=a*a,c=u*u;return e(a,u,c)},o})(Math.SQRT2,2,4);var Cy=Cn("start","end","cancel","interrupt"),Py=[],du=0,ts=1,Yr=2,Vn=3,ns=4,Qr=5,Bn=6;function kr(e,n,r,i,o,s){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;Ey(e,r,{name:n,index:i,group:o,on:Cy,tween:Py,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:du})}function Yi(e,n){var r=Ge(e,n);if(r.state>du)throw new Error("too late; already scheduled");return r}function tt(e,n){var r=Ge(e,n);if(r.state>Vn)throw new Error("too late; already running");return r}function Ge(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function Ey(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=Ji(s,0,r.time);function s(l){r.state=ts,r.timer.restart(a,r.delay,r.time),r.delay<=l&&a(l-r.delay)}function a(l){var h,f,d,p;if(r.state!==ts)return c();for(h in i)if(p=i[h],p.name===r.name){if(p.state===Vn)return Zo(a);p.state===ns?(p.state=Bn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[h]):+h<n&&(p.state=Bn,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[h])}if(Zo(function(){r.state===Vn&&(r.state=ns,r.timer.restart(u,r.delay,r.time),u(l))}),r.state=Yr,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Yr){for(r.state=Vn,o=new Array(d=r.tween.length),h=0,f=-1;h<d;++h)(p=r.tween[h].value.call(e,e.__data__,r.index,r.group))&&(o[++f]=p);o.length=f+1}}function u(l){for(var h=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(c),r.state=Qr,1),f=-1,d=o.length;++f<d;)o[f].call(e,h);r.state===Qr&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Bn,r.timer.stop(),delete i[n];for(var l in i)return;delete e.__transition}}function Wn(e,n){var r=e.__transition,i,o,s=!0,a;if(r){n=n==null?null:n+"";for(a in r){if((i=r[a]).name!==n){s=!1;continue}o=i.state>Yr&&i.state<Qr,i.state=Bn,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[a]}s&&delete e.__transition}}function Ay(e){return this.each(function(){Wn(this,e)})}function Ry(e,n){var r,i;return function(){var o=tt(this,e),s=o.tween;if(s!==r){i=r=s;for(var a=0,u=i.length;a<u;++a)if(i[a].name===n){i=i.slice(),i.splice(a,1);break}}o.tween=i}}function $y(e,n,r){var i,o;if(typeof r!="function")throw new Error;return function(){var s=tt(this,e),a=s.tween;if(a!==i){o=(i=a).slice();for(var u={name:n,value:r},c=0,l=o.length;c<l;++c)if(o[c].name===n){o[c]=u;break}c===l&&o.push(u)}s.tween=o}}function Iy(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=Ge(this.node(),r).tween,o=0,s=i.length,a;o<s;++o)if((a=i[o]).name===e)return a.value;return null}return this.each((n==null?Ry:$y)(r,e,n))}function Qi(e,n,r){var i=e._id;return e.each(function(){var o=tt(this,i);(o.value||(o.value={}))[n]=r.apply(this,arguments)}),function(o){return Ge(o,i).value[n]}}function pu(e,n){var r;return(typeof n=="number"?pt:n instanceof mn?Yo:(r=mn(n))?(n=r,Yo):yy)(e,n)}function My(e){return function(){this.removeAttribute(e)}}function Oy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ny(e,n,r){var i,o=r+"",s;return function(){var a=this.getAttribute(e);return a===o?null:a===i?s:s=n(i=a,r)}}function Dy(e,n,r){var i,o=r+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===o?null:a===i?s:s=n(i=a,r)}}function jy(e,n,r){var i,o,s;return function(){var a,u=r(this),c;return u==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=u+"",a===c?null:a===i&&c===o?s:(o=c,s=n(i=a,u)))}}function Zy(e,n,r){var i,o,s;return function(){var a,u=r(this),c;return u==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=u+"",a===c?null:a===i&&c===o?s:(o=c,s=n(i=a,u)))}}function qy(e,n){var r=xr(e),i=r==="transform"?xy:pu;return this.attrTween(e,typeof n=="function"?(r.local?Zy:jy)(r,i,Qi(this,"attr."+e,n)):n==null?(r.local?Oy:My)(r):(r.local?Dy:Ny)(r,i,n))}function Uy(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function Ly(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function Fy(e,n){var r,i;function o(){var s=n.apply(this,arguments);return s!==i&&(r=(i=s)&&Ly(e,s)),r}return o._value=n,o}function Hy(e,n){var r,i;function o(){var s=n.apply(this,arguments);return s!==i&&(r=(i=s)&&Uy(e,s)),r}return o._value=n,o}function Vy(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=xr(e);return this.tween(r,(i.local?Fy:Hy)(i,n))}function By(e,n){return function(){Yi(this,e).delay=+n.apply(this,arguments)}}function Wy(e,n){return n=+n,function(){Yi(this,e).delay=n}}function Jy(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?By:Wy)(n,e)):Ge(this.node(),n).delay}function Gy(e,n){return function(){tt(this,e).duration=+n.apply(this,arguments)}}function Xy(e,n){return n=+n,function(){tt(this,e).duration=n}}function Ky(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Gy:Xy)(n,e)):Ge(this.node(),n).duration}function Yy(e,n){if(typeof n!="function")throw new Error;return function(){tt(this,e).ease=n}}function Qy(e){var n=this._id;return arguments.length?this.each(Yy(n,e)):Ge(this.node(),n).ease}function ev(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;tt(this,e).ease=r}}function tv(e){if(typeof e!="function")throw new Error;return this.each(ev(this._id,e))}function nv(e){typeof e!="function"&&(e=Ga(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var s=n[o],a=s.length,u=i[o]=[],c,l=0;l<a;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&u.push(c);return new lt(i,this._parents,this._name,this._id)}function rv(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),u=0;u<s;++u)for(var c=n[u],l=r[u],h=c.length,f=a[u]=new Array(h),d,p=0;p<h;++p)(d=c[p]||l[p])&&(f[p]=d);for(;u<i;++u)a[u]=n[u];return new lt(a,this._parents,this._name,this._id)}function iv(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function ov(e,n,r){var i,o,s=iv(n)?Yi:tt;return function(){var a=s(this,e),u=a.on;u!==i&&(o=(i=u).copy()).on(n,r),a.on=o}}function sv(e,n){var r=this._id;return arguments.length<2?Ge(this.node(),r).on.on(e):this.each(ov(r,e,n))}function av(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function uv(){return this.on("end.remove",av(this._id))}function cv(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Gi(e));for(var i=this._groups,o=i.length,s=new Array(o),a=0;a<o;++a)for(var u=i[a],c=u.length,l=s[a]=new Array(c),h,f,d=0;d<c;++d)(h=u[d])&&(f=e.call(h,h.__data__,d,u))&&("__data__"in h&&(f.__data__=h.__data__),l[d]=f,kr(l[d],n,r,d,l,Ge(h,r)));return new lt(s,this._parents,n,r)}function lv(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Ja(e));for(var i=this._groups,o=i.length,s=[],a=[],u=0;u<o;++u)for(var c=i[u],l=c.length,h,f=0;f<l;++f)if(h=c[f]){for(var d=e.call(h,h.__data__,f,c),p,g=Ge(h,r),_=0,y=d.length;_<y;++_)(p=d[_])&&kr(p,n,r,_,d,g);s.push(d),a.push(h)}return new lt(s,a,n,r)}var fv=Pn.prototype.constructor;function hv(){return new fv(this._groups,this._parents)}function dv(e,n){var r,i,o;return function(){var s=Ut(this,e),a=(this.style.removeProperty(e),Ut(this,e));return s===a?null:s===r&&a===i?o:o=n(r=s,i=a)}}function gu(e){return function(){this.style.removeProperty(e)}}function pv(e,n,r){var i,o=r+"",s;return function(){var a=Ut(this,e);return a===o?null:a===i?s:s=n(i=a,r)}}function gv(e,n,r){var i,o,s;return function(){var a=Ut(this,e),u=r(this),c=u+"";return u==null&&(c=u=(this.style.removeProperty(e),Ut(this,e))),a===c?null:a===i&&c===o?s:(o=c,s=n(i=a,u))}}function mv(e,n){var r,i,o,s="style."+n,a="end."+s,u;return function(){var c=tt(this,e),l=c.on,h=c.value[s]==null?u||(u=gu(n)):void 0;(l!==r||o!==h)&&(i=(r=l).copy()).on(a,o=h),c.on=i}}function _v(e,n,r){var i=(e+="")=="transform"?wy:pu;return n==null?this.styleTween(e,dv(e,i)).on("end.style."+e,gu(e)):typeof n=="function"?this.styleTween(e,gv(e,i,Qi(this,"style."+e,n))).each(mv(this._id,e)):this.styleTween(e,pv(e,i,n),r).on("end.style."+e,null)}function yv(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function vv(e,n,r){var i,o;function s(){var a=n.apply(this,arguments);return a!==o&&(i=(o=a)&&yv(e,a,r)),i}return s._value=n,s}function bv(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,vv(e,n,r??""))}function wv(e){return function(){this.textContent=e}}function xv(e){return function(){var n=e(this);this.textContent=n??""}}function kv(e){return this.tween("text",typeof e=="function"?xv(Qi(this,"text",e)):wv(e==null?"":e+""))}function Sv(e){return function(n){this.textContent=e.call(this,n)}}function zv(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Sv(o)),n}return i._value=e,i}function Tv(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,zv(e))}function Cv(){for(var e=this._name,n=this._id,r=mu(),i=this._groups,o=i.length,s=0;s<o;++s)for(var a=i[s],u=a.length,c,l=0;l<u;++l)if(c=a[l]){var h=Ge(c,n);kr(c,e,r,l,a,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new lt(i,this._parents,e,r)}function Pv(){var e,n,r=this,i=r._id,o=r.size();return new Promise(function(s,a){var u={value:a},c={value:function(){--o===0&&s()}};r.each(function(){var l=tt(this,i),h=l.on;h!==e&&(n=(e=h).copy(),n._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),l.on=n}),o===0&&s()})}var Ev=0;function lt(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function mu(){return++Ev}var it=Pn.prototype;lt.prototype={constructor:lt,select:cv,selectAll:lv,selectChild:it.selectChild,selectChildren:it.selectChildren,filter:nv,merge:rv,selection:hv,transition:Cv,call:it.call,nodes:it.nodes,node:it.node,size:it.size,empty:it.empty,each:it.each,on:sv,attr:qy,attrTween:Vy,style:_v,styleTween:bv,text:kv,textTween:Tv,remove:uv,tween:Iy,delay:Jy,duration:Ky,ease:Qy,easeVarying:tv,end:Pv,[Symbol.iterator]:it[Symbol.iterator]};function Av(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Rv={time:null,delay:0,duration:250,ease:Av};function $v(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function Iv(e){var n,r;e instanceof lt?(n=e._id,e=e._name):(n=mu(),(r=Rv).time=Wi(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,s=0;s<o;++s)for(var a=i[s],u=a.length,c,l=0;l<u;++l)(c=a[l])&&kr(c,e,n,l,a,r||$v(c,n));return new lt(i,this._parents,e,n)}Pn.prototype.interrupt=Ay;Pn.prototype.transition=Iv;const qn=e=>()=>e;function Mv(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function ut(e,n,r){this.k=e,this.x=n,this.y=r}ut.prototype={constructor:ut,scale:function(e){return e===1?this:new ut(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new ut(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var eo=new ut(1,0,0);Xe.prototype=ut.prototype;function Xe(e){for(;!e.__zoom;)if(!(e=e.parentNode))return eo;return e.__zoom}function Or(e){e.stopImmediatePropagation()}function Bt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ov(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Nv(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,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]]):[[0,0],[e.clientWidth,e.clientHeight]]}function rs(){return this.__zoom||eo}function Dv(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jv(){return navigator.maxTouchPoints||"ontouchstart"in this}function Zv(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],s=e.invertY(n[0][1])-r[0][1],a=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function qv(){var e=Ov,n=Nv,r=Zv,i=Dv,o=jv,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],u=250,c=Ty,l=Cn("start","zoom","end"),h,f,d,p=500,g=150,_=0,y=10;function m(z){z.property("__zoom",rs).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",$).filter(o).on("touchstart.zoom",N).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(z,O,R,j){var F=z.selection?z.selection():z;F.property("__zoom",rs),z!==F?v(z,O,R,j):F.interrupt().each(function(){k(this,arguments).event(j).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},m.scaleBy=function(z,O,R,j){m.scaleTo(z,function(){var F=this.__zoom.k,q=typeof O=="function"?O.apply(this,arguments):O;return F*q},R,j)},m.scaleTo=function(z,O,R,j){m.transform(z,function(){var F=n.apply(this,arguments),q=this.__zoom,V=R==null?b(F):typeof R=="function"?R.apply(this,arguments):R,L=q.invert(V),W=typeof O=="function"?O.apply(this,arguments):O;return r(C(w(q,W),V,L),F,a)},R,j)},m.translateBy=function(z,O,R,j){m.transform(z,function(){return r(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof R=="function"?R.apply(this,arguments):R),n.apply(this,arguments),a)},null,j)},m.translateTo=function(z,O,R,j,F){m.transform(z,function(){var q=n.apply(this,arguments),V=this.__zoom,L=j==null?b(q):typeof j=="function"?j.apply(this,arguments):j;return r(eo.translate(L[0],L[1]).scale(V.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof R=="function"?-R.apply(this,arguments):-R),q,a)},j,F)};function w(z,O){return O=Math.max(s[0],Math.min(s[1],O)),O===z.k?z:new ut(O,z.x,z.y)}function C(z,O,R){var j=O[0]-R[0]*z.k,F=O[1]-R[1]*z.k;return j===z.x&&F===z.y?z:new ut(z.k,j,F)}function b(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function v(z,O,R,j){z.on("start.zoom",function(){k(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(j).end()}).tween("zoom",function(){var F=this,q=arguments,V=k(F,q).event(j),L=n.apply(F,q),W=R==null?b(L):typeof R=="function"?R.apply(F,q):R,ee=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),K=F.__zoom,he=typeof O=="function"?O.apply(F,q):O,nt=c(K.invert(W).concat(ee/K.k),he.invert(W).concat(ee/he.k));return function(Fe){if(Fe===1)Fe=he;else{var rt=nt(Fe),Cr=ee/rt[2];Fe=new ut(Cr,W[0]-rt[0]*Cr,W[1]-rt[1]*Cr)}V.zoom(null,Fe)}})}function k(z,O,R){return!R&&z.__zooming||new x(z,O)}function x(z,O){this.that=z,this.args=O,this.active=0,this.sourceEvent=null,this.extent=n.apply(z,O),this.taps=0}x.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,O){return this.mouse&&z!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var O=De(this.that).datum();l.call(z,this.that,new Mv(z,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),O)}};function P(z,...O){if(!e.apply(this,arguments))return;var R=k(this,O).event(z),j=this.__zoom,F=Math.max(s[0],Math.min(s[1],j.k*Math.pow(2,i.apply(this,arguments)))),q=Ke(z);if(R.wheel)(R.mouse[0][0]!==q[0]||R.mouse[0][1]!==q[1])&&(R.mouse[1]=j.invert(R.mouse[0]=q)),clearTimeout(R.wheel);else{if(j.k===F)return;R.mouse=[q,j.invert(q)],Wn(this),R.start()}Bt(z),R.wheel=setTimeout(V,g),R.zoom("mouse",r(C(w(j,F),R.mouse[0],R.mouse[1]),R.extent,a));function V(){R.wheel=null,R.end()}}function M(z,...O){if(d||!e.apply(this,arguments))return;var R=z.currentTarget,j=k(this,O,!0).event(z),F=De(z.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",ee,!0),q=Ke(z,R),V=z.clientX,L=z.clientY;ou(z.view),Or(z),j.mouse=[q,this.__zoom.invert(q)],Wn(this),j.start();function W(K){if(Bt(K),!j.moved){var he=K.clientX-V,nt=K.clientY-L;j.moved=he*he+nt*nt>_}j.event(K).zoom("mouse",r(C(j.that.__zoom,j.mouse[0]=Ke(K,R),j.mouse[1]),j.extent,a))}function ee(K){F.on("mousemove.zoom mouseup.zoom",null),su(K.view,j.moved),Bt(K),j.event(K).end()}}function $(z,...O){if(e.apply(this,arguments)){var R=this.__zoom,j=Ke(z.changedTouches?z.changedTouches[0]:z,this),F=R.invert(j),q=R.k*(z.shiftKey?.5:2),V=r(C(w(R,q),j,F),n.apply(this,O),a);Bt(z),u>0?De(this).transition().duration(u).call(v,V,j,z):De(this).call(m.transform,V,j,z)}}function N(z,...O){if(e.apply(this,arguments)){var R=z.touches,j=R.length,F=k(this,O,z.changedTouches.length===j).event(z),q,V,L,W;for(Or(z),V=0;V<j;++V)L=R[V],W=Ke(L,this),W=[W,this.__zoom.invert(W),L.identifier],F.touch0?!F.touch1&&F.touch0[2]!==W[2]&&(F.touch1=W,F.taps=0):(F.touch0=W,q=!0,F.taps=1+!!h);h&&(h=clearTimeout(h)),q&&(F.taps<2&&(f=W[0],h=setTimeout(function(){h=null},p)),Wn(this),F.start())}}function D(z,...O){if(this.__zooming){var R=k(this,O).event(z),j=z.changedTouches,F=j.length,q,V,L,W;for(Bt(z),q=0;q<F;++q)V=j[q],L=Ke(V,this),R.touch0&&R.touch0[2]===V.identifier?R.touch0[0]=L:R.touch1&&R.touch1[2]===V.identifier&&(R.touch1[0]=L);if(V=R.that.__zoom,R.touch1){var ee=R.touch0[0],K=R.touch0[1],he=R.touch1[0],nt=R.touch1[1],Fe=(Fe=he[0]-ee[0])*Fe+(Fe=he[1]-ee[1])*Fe,rt=(rt=nt[0]-K[0])*rt+(rt=nt[1]-K[1])*rt;V=w(V,Math.sqrt(Fe/rt)),L=[(ee[0]+he[0])/2,(ee[1]+he[1])/2],W=[(K[0]+nt[0])/2,(K[1]+nt[1])/2]}else if(R.touch0)L=R.touch0[0],W=R.touch0[1];else return;R.zoom("touch",r(C(V,L,W),R.extent,a))}}function H(z,...O){if(this.__zooming){var R=k(this,O).event(z),j=z.changedTouches,F=j.length,q,V;for(Or(z),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),q=0;q<F;++q)V=j[q],R.touch0&&R.touch0[2]===V.identifier?delete R.touch0:R.touch1&&R.touch1[2]===V.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(V=Ke(V,this),Math.hypot(f[0]-V[0],f[1]-V[1])<y)){var L=De(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return m.wheelDelta=function(z){return arguments.length?(i=typeof z=="function"?z:qn(+z),m):i},m.filter=function(z){return arguments.length?(e=typeof z=="function"?z:qn(!!z),m):e},m.touchable=function(z){return arguments.length?(o=typeof z=="function"?z:qn(!!z),m):o},m.extent=function(z){return arguments.length?(n=typeof z=="function"?z:qn([[+z[0][0],+z[0][1]],[+z[1][0],+z[1][1]]]),m):n},m.scaleExtent=function(z){return arguments.length?(s[0]=+z[0],s[1]=+z[1],m):[s[0],s[1]]},m.translateExtent=function(z){return arguments.length?(a[0][0]=+z[0][0],a[1][0]=+z[1][0],a[0][1]=+z[0][1],a[1][1]=+z[1][1],m):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},m.constrain=function(z){return arguments.length?(r=z,m):r},m.duration=function(z){return arguments.length?(u=+z,m):u},m.interpolate=function(z){return arguments.length?(c=z,m):c},m.on=function(){var z=l.on.apply(l,arguments);return z===l?m:z},m.clickDistance=function(z){return arguments.length?(_=(z=+z)*z,m):Math.sqrt(_)},m.tapDistance=function(z){return arguments.length?(y=+z,m):y},m}class is extends Map{constructor(n,r=Fv){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),n!=null)for(const[i,o]of n)this.set(i,o)}get(n){return super.get(os(this,n))}has(n){return super.has(os(this,n))}set(n,r){return super.set(Uv(this,n),r)}delete(n){return super.delete(Lv(this,n))}}function os({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):r}function Uv({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):(e.set(i,r),r)}function Lv({_intern:e,_key:n},r){const i=n(r);return e.has(i)&&(r=e.get(i),e.delete(i)),r}function Fv(e){return e!==null&&typeof e=="object"?e.valueOf():e}function ss(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r<i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let o of e)(o=n(o,++i,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}return r}function as(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r>i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let o of e)(o=n(o,++i,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}return r}function Hv(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var Vv=typeof global=="object"&&global&&global.Object===Object&&global,Bv=typeof self=="object"&&self&&self.Object===Object&&self,_u=Vv||Bv||Function("return this")(),sr=_u.Symbol,yu=Object.prototype,Wv=yu.hasOwnProperty,Jv=yu.toString,Wt=sr?sr.toStringTag:void 0;function Gv(e){var n=Wv.call(e,Wt),r=e[Wt];try{e[Wt]=void 0;var i=!0}catch{}var o=Jv.call(e);return i&&(n?e[Wt]=r:delete e[Wt]),o}var Xv=Object.prototype,Kv=Xv.toString;function Yv(e){return Kv.call(e)}var Qv="[object Null]",eb="[object Undefined]",us=sr?sr.toStringTag:void 0;function tb(e){return e==null?e===void 0?eb:Qv:us&&us in Object(e)?Gv(e):Yv(e)}function nb(e){return e!=null&&typeof e=="object"}var rb="[object Symbol]";function ib(e){return typeof e=="symbol"||nb(e)&&tb(e)==rb}var ob=/\s/;function sb(e){for(var n=e.length;n--&&ob.test(e.charAt(n)););return n}var ab=/^\s+/;function ub(e){return e&&e.slice(0,sb(e)+1).replace(ab,"")}function ar(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var cs=NaN,cb=/^[-+]0x[0-9a-f]+$/i,lb=/^0b[01]+$/i,fb=/^0o[0-7]+$/i,hb=parseInt;function ls(e){if(typeof e=="number")return e;if(ib(e))return cs;if(ar(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=ar(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=ub(e);var r=lb.test(e);return r||fb.test(e)?hb(e.slice(2),r?2:8):cb.test(e)?cs:+e}var Nr=function(){return _u.Date.now()},db="Expected a function",pb=Math.max,gb=Math.min;function vu(e,n,r){var i,o,s,a,u,c,l=0,h=!1,f=!1,d=!0;if(typeof e!="function")throw new TypeError(db);n=ls(n)||0,ar(r)&&(h=!!r.leading,f="maxWait"in r,s=f?pb(ls(r.maxWait)||0,n):s,d="trailing"in r?!!r.trailing:d);function p(k){var x=i,P=o;return i=o=void 0,l=k,a=e.apply(P,x),a}function g(k){return l=k,u=setTimeout(m,n),h?p(k):a}function _(k){var x=k-c,P=k-l,M=n-x;return f?gb(M,s-P):M}function y(k){var x=k-c,P=k-l;return c===void 0||x>=n||x<0||f&&P>=s}function m(){var k=Nr();if(y(k))return w(k);u=setTimeout(m,_(k))}function w(k){return u=void 0,d&&i?p(k):(i=o=void 0,a)}function C(){u!==void 0&&clearTimeout(u),l=0,i=c=o=u=void 0}function b(){return u===void 0?a:w(Nr())}function v(){var k=Nr(),x=y(k);if(i=arguments,o=this,c=k,x){if(u===void 0)return g(c);if(f)return clearTimeout(u),u=setTimeout(m,n),p(c)}return u===void 0&&(u=setTimeout(m,n)),a}return v.cancel=C,v.flush=b,v}var mb="Expected a function";function _b(e,n,r){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(mb);return ar(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),vu(e,n,{leading:i,maxWait:n,trailing:o})}var Tt=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Tt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Tt.Bounce.In(e*2)*.5:Tt.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),nn=function(){return performance.now()},bu=(function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(n){this._tweens[n.getId()]=n,this._tweensAddedDuringUpdate[n.getId()]=n},e.prototype.remove=function(n){delete this._tweens[n.getId()],delete this._tweensAddedDuringUpdate[n.getId()]},e.prototype.update=function(n,r){n===void 0&&(n=nn()),r===void 0&&(r=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<i.length;o++){var s=this._tweens[i[o]],a=!r;s&&s.update(n,a)===!1&&!r&&delete this._tweens[i[o]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},e})(),ei={Linear:function(e,n){var r=e.length-1,i=r*n,o=Math.floor(i),s=ei.Utils.Linear;return n<0?s(e[0],e[1],i):n>1?s(e[r],e[r-1],r-i):s(e[o],e[o+1>r?r:o+1],i-o)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},wu=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),ti=new bu,fs=(function(){function e(n,r){r===void 0&&(r=ti),this._object=n,this._group=r,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Tt.Linear.None,this._interpolationFunction=ei.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=wu.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=nn()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var s in this._valuesEnd)o[s]=this._valuesEnd[s];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,i,o,s){for(var a in i){var u=n[a],c=Array.isArray(u),l=c?"array":typeof u,h=!c&&Array.isArray(i[a]);if(!(l==="undefined"||l==="function")){if(h){var f=i[a];if(f.length===0)continue;for(var d=[u],p=0,g=f.length;p<g;p+=1){var _=this._handleRelativeValue(u,f[p]);if(isNaN(_)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(_)}h&&(i[a]=d)}if((l==="object"||c)&&u&&!h){r[a]=c?[]:{};var y=u;for(var m in y)r[a][m]=y[m];o[a]=c?[]:{};var f=i[a];if(!this._isDynamic){var w={};for(var m in f)w[m]=f[m];i[a]=f=w}this._setupProperties(y,r[a],f,o[a],s)}else(typeof r[a]>"u"||s)&&(r[a]=u),c||(r[a]*=1),h?o[a]=i[a].slice().reverse():o[a]=r[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(n){return n===void 0&&(n=nn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this._group&&this._group.remove(this),this)},e.prototype.resume=function(n){return n===void 0&&(n=nn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;n<r;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n===void 0&&(n=ti),this._group=n,this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Tt.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=ei.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,r){var i=this,o;if(n===void 0&&(n=nn()),r===void 0&&(r=!0),this._isPaused)return!0;var s,a=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(n>a)return!1;r&&this.start(n,!0)}if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var u=n-this._startTime,c=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),l=this._duration+this._repeat*c,h=function(){if(i._duration===0||u>l)return 1;var y=Math.trunc(u/c),m=u-y*c,w=Math.min(m/i._duration,1);return w===0&&u===i._duration?1:w},f=h(),d=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||u>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((u-this._duration)/c)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=c*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var g=0,_=this._chainedTweens.length;g<_;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,r,i,o){for(var s in i)if(r[s]!==void 0){var a=r[s]||0,u=i[s],c=Array.isArray(n[s]),l=Array.isArray(u),h=!c&&l;h?n[s]=this._interpolationFunction(u,o):typeof u=="object"&&u?this._updateProperties(n[s],a,u,o):(u=this._handleRelativeValue(a,u),typeof u=="number"&&(n[s]=a+(u-a)*o))}},e.prototype._handleRelativeValue=function(n,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?n+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(n){var r=this._valuesStartRepeat[n],i=this._valuesEnd[n];typeof i=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(i):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=r},e})();wu.nextId;var et=ti;et.getAll.bind(et);et.removeAll.bind(et);et.add.bind(et);et.remove.bind(et);et.update.bind(et);function hs(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function yb(e){if(Array.isArray(e))return e}function vb(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function bb(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function wb(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,s,a,u=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(i=s.call(r)).done)&&(u.push(i.value),u.length!==n);c=!0);}catch(h){l=!0,o=h}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}function xb(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
85
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kb(e,n){return yb(e)||wb(e,n)||Sb(e,n)||xb()}function Sb(e,n){if(e){if(typeof e=="string")return hs(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?hs(e,n):void 0}}var zb=bb(function e(n,r){var i=r.default,o=i===void 0?null:i,s=r.triggerUpdate,a=s===void 0?!0:s,u=r.onChange,c=u===void 0?function(l,h){}:u;vb(this,e),this.name=n,this.defaultVal=o,this.triggerUpdate=a,this.onChange=c});function to(e){var n=e.stateInit,r=n===void 0?function(){return{}}:n,i=e.props,o=i===void 0?{}:i,s=e.methods,a=s===void 0?{}:s,u=e.aliases,c=u===void 0?{}:u,l=e.init,h=l===void 0?function(){}:l,f=e.update,d=f===void 0?function(){}:f,p=Object.keys(o).map(function(g){return new zb(g,o[g])});return function g(){for(var _=arguments.length,y=new Array(_),m=0;m<_;m++)y[m]=arguments[m];var w=!!(this instanceof g&&this.constructor),C=w?y.shift():void 0,b=y[0],v=b===void 0?{}:b,k=Object.assign({},r instanceof Function?r(v):r,{initialised:!1}),x={};function P(N){return M(N,v),$(),P}var M=function(D,H){h.call(P,D,k,H),k.initialised=!0},$=vu(function(){k.initialised&&(d.call(P,k,x),x={})},1);return p.forEach(function(N){P[N.name]=D(N);function D(H){var z=H.name,O=H.triggerUpdate,R=O===void 0?!1:O,j=H.onChange,F=j===void 0?function(L,W){}:j,q=H.defaultVal,V=q===void 0?null:q;return function(L){var W=k[z];if(!arguments.length)return W;var ee=L===void 0?V:L;return k[z]=ee,F.call(P,ee,k,W),!x.hasOwnProperty(z)&&(x[z]=W),R&&$(),P}}}),Object.keys(a).forEach(function(N){P[N]=function(){for(var D,H=arguments.length,z=new Array(H),O=0;O<H;O++)z[O]=arguments[O];return(D=a[N]).call.apply(D,[P,k].concat(z))}}),Object.entries(c).forEach(function(N){var D=kb(N,2),H=D[0],z=D[1];return P[H]=P[z]}),P.resetProps=function(){return p.forEach(function(N){P[N.name](N.defaultVal)}),P},P.resetProps(),k._rerender=$,w&&C&&P(C),P}}var Y=(function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}});function ur(e){"@babel/helpers - typeof";return ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ur(e)}var Tb=/^\s+/,Cb=/\s+$/;function U(e,n){if(e=e||"",n=n||{},e instanceof U)return e;if(!(this instanceof U))return new U(e,n);var r=Pb(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||r.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}U.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),r,i,o,s,a,u;return r=n.r/255,i=n.g/255,o=n.b/255,r<=.03928?s=r/12.92:s=Math.pow((r+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),o<=.03928?u=o/12.92:u=Math.pow((o+.055)/1.055,2.4),.2126*s+.7152*a+.0722*u},setAlpha:function(n){return this._a=xu(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=ps(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=ps(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),o=Math.round(n.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+o+"%)":"hsva("+r+", "+i+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var n=ds(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=ds(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),o=Math.round(n.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+o+"%)":"hsla("+r+", "+i+"%, "+o+"%, "+this._roundA+")"},toHex:function(n){return gs(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return $b(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(ce(this._r,255)*100)+"%",g:Math.round(ce(this._g,255)*100)+"%",b:Math.round(ce(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(ce(this._r,255)*100)+"%, "+Math.round(ce(this._g,255)*100)+"%, "+Math.round(ce(this._b,255)*100)+"%)":"rgba("+Math.round(ce(this._r,255)*100)+"%, "+Math.round(ce(this._g,255)*100)+"%, "+Math.round(ce(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Hb[gs(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+ms(this._r,this._g,this._b,this._a),i=r,o=this._gradientType?"GradientType = 1, ":"";if(n){var s=U(n);i="#"+ms(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+r+",endColorstr="+i+")"},toString:function(n){var r=!!n;n=n||this._format;var i=!1,o=this._a<1&&this._a>=0,s=!r&&o&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return s?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(i=this.toRgbString()),n==="prgb"&&(i=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(i=this.toHexString()),n==="hex3"&&(i=this.toHexString(!0)),n==="hex4"&&(i=this.toHex8String(!0)),n==="hex8"&&(i=this.toHex8String()),n==="name"&&(i=this.toName()),n==="hsl"&&(i=this.toHslString()),n==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return U(this.toString())},_applyModification:function(n,r){var i=n.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(Nb,arguments)},brighten:function(){return this._applyModification(Db,arguments)},darken:function(){return this._applyModification(jb,arguments)},desaturate:function(){return this._applyModification(Ib,arguments)},saturate:function(){return this._applyModification(Mb,arguments)},greyscale:function(){return this._applyModification(Ob,arguments)},spin:function(){return this._applyModification(Zb,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(Lb,arguments)},complement:function(){return this._applyCombination(qb,arguments)},monochromatic:function(){return this._applyCombination(Fb,arguments)},splitcomplement:function(){return this._applyCombination(Ub,arguments)},triad:function(){return this._applyCombination(_s,[3])},tetrad:function(){return this._applyCombination(_s,[4])}};U.fromRatio=function(e,n){if(ur(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=rn(e[i]));e=r}return U(e,n)};function Pb(e){var n={r:0,g:0,b:0},r=1,i=null,o=null,s=null,a=!1,u=!1;return typeof e=="string"&&(e=Jb(e)),ur(e)=="object"&&(ot(e.r)&&ot(e.g)&&ot(e.b)?(n=Eb(e.r,e.g,e.b),a=!0,u=String(e.r).substr(-1)==="%"?"prgb":"rgb"):ot(e.h)&&ot(e.s)&&ot(e.v)?(i=rn(e.s),o=rn(e.v),n=Rb(e.h,i,o),a=!0,u="hsv"):ot(e.h)&&ot(e.s)&&ot(e.l)&&(i=rn(e.s),s=rn(e.l),n=Ab(e.h,i,s),a=!0,u="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=xu(r),{ok:a,format:e.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function Eb(e,n,r){return{r:ce(e,255)*255,g:ce(n,255)*255,b:ce(r,255)*255}}function ds(e,n,r){e=ce(e,255),n=ce(n,255),r=ce(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),s,a,u=(i+o)/2;if(i==o)s=a=0;else{var c=i-o;switch(a=u>.5?c/(2-i-o):c/(i+o),i){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;case r:s=(e-n)/c+4;break}s/=6}return{h:s,s:a,l:u}}function Ab(e,n,r){var i,o,s;e=ce(e,360),n=ce(n,100),r=ce(r,100);function a(l,h,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?l+(h-l)*6*f:f<1/2?h:f<2/3?l+(h-l)*(2/3-f)*6:l}if(n===0)i=o=s=r;else{var u=r<.5?r*(1+n):r+n-r*n,c=2*r-u;i=a(c,u,e+1/3),o=a(c,u,e),s=a(c,u,e-1/3)}return{r:i*255,g:o*255,b:s*255}}function ps(e,n,r){e=ce(e,255),n=ce(n,255),r=ce(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),s,a,u=i,c=i-o;if(a=i===0?0:c/i,i==o)s=0;else{switch(i){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;case r:s=(e-n)/c+4;break}s/=6}return{h:s,s:a,v:u}}function Rb(e,n,r){e=ce(e,360)*6,n=ce(n,100),r=ce(r,100);var i=Math.floor(e),o=e-i,s=r*(1-n),a=r*(1-o*n),u=r*(1-(1-o)*n),c=i%6,l=[r,a,s,s,u,r][c],h=[u,r,r,a,s,s][c],f=[s,s,u,r,r,a][c];return{r:l*255,g:h*255,b:f*255}}function gs(e,n,r,i){var o=[Je(Math.round(e).toString(16)),Je(Math.round(n).toString(16)),Je(Math.round(r).toString(16))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function $b(e,n,r,i,o){var s=[Je(Math.round(e).toString(16)),Je(Math.round(n).toString(16)),Je(Math.round(r).toString(16)),Je(ku(i))];return o&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function ms(e,n,r,i){var o=[Je(ku(i)),Je(Math.round(e).toString(16)),Je(Math.round(n).toString(16)),Je(Math.round(r).toString(16))];return o.join("")}U.equals=function(e,n){return!e||!n?!1:U(e).toRgbString()==U(n).toRgbString()};U.random=function(){return U.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Ib(e,n){n=n===0?0:n||10;var r=U(e).toHsl();return r.s-=n/100,r.s=Sr(r.s),U(r)}function Mb(e,n){n=n===0?0:n||10;var r=U(e).toHsl();return r.s+=n/100,r.s=Sr(r.s),U(r)}function Ob(e){return U(e).desaturate(100)}function Nb(e,n){n=n===0?0:n||10;var r=U(e).toHsl();return r.l+=n/100,r.l=Sr(r.l),U(r)}function Db(e,n){n=n===0?0:n||10;var r=U(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(n/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(n/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(n/100)))),U(r)}function jb(e,n){n=n===0?0:n||10;var r=U(e).toHsl();return r.l-=n/100,r.l=Sr(r.l),U(r)}function Zb(e,n){var r=U(e).toHsl(),i=(r.h+n)%360;return r.h=i<0?360+i:i,U(r)}function qb(e){var n=U(e).toHsl();return n.h=(n.h+180)%360,U(n)}function _s(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=U(e).toHsl(),i=[U(e)],o=360/n,s=1;s<n;s++)i.push(U({h:(r.h+s*o)%360,s:r.s,l:r.l}));return i}function Ub(e){var n=U(e).toHsl(),r=n.h;return[U(e),U({h:(r+72)%360,s:n.s,l:n.l}),U({h:(r+216)%360,s:n.s,l:n.l})]}function Lb(e,n,r){n=n||6,r=r||30;var i=U(e).toHsl(),o=360/r,s=[U(e)];for(i.h=(i.h-(o*n>>1)+720)%360;--n;)i.h=(i.h+o)%360,s.push(U(i));return s}function Fb(e,n){n=n||6;for(var r=U(e).toHsv(),i=r.h,o=r.s,s=r.v,a=[],u=1/n;n--;)a.push(U({h:i,s:o,v:s})),s=(s+u)%1;return a}U.mix=function(e,n,r){r=r===0?0:r||50;var i=U(e).toRgb(),o=U(n).toRgb(),s=r/100,a={r:(o.r-i.r)*s+i.r,g:(o.g-i.g)*s+i.g,b:(o.b-i.b)*s+i.b,a:(o.a-i.a)*s+i.a};return U(a)};U.readability=function(e,n){var r=U(e),i=U(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};U.isReadable=function(e,n,r){var i=U.readability(e,n),o,s;switch(s=!1,o=Gb(r),o.level+o.size){case"AAsmall":case"AAAlarge":s=i>=4.5;break;case"AAlarge":s=i>=3;break;case"AAAsmall":s=i>=7;break}return s};U.mostReadable=function(e,n,r){var i=null,o=0,s,a,u,c;r=r||{},a=r.includeFallbackColors,u=r.level,c=r.size;for(var l=0;l<n.length;l++)s=U.readability(e,n[l]),s>o&&(o=s,i=U(n[l]));return U.isReadable(e,i,{level:u,size:c})||!a?i:(r.includeFallbackColors=!1,U.mostReadable(e,["#fff","#000"],r))};var ni=U.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Hb=U.hexNames=Vb(ni);function Vb(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function xu(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function ce(e,n){Bb(e)&&(e="100%");var r=Wb(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function Sr(e){return Math.min(1,Math.max(0,e))}function Ee(e){return parseInt(e,16)}function Bb(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Wb(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Je(e){return e.length==1?"0"+e:""+e}function rn(e){return e<=1&&(e=e*100+"%"),e}function ku(e){return Math.round(parseFloat(e)*255).toString(16)}function ys(e){return Ee(e)/255}var He=(function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function ot(e){return!!He.CSS_UNIT.exec(e)}function Jb(e){e=e.replace(Tb,"").replace(Cb,"").toLowerCase();var n=!1;if(ni[e])e=ni[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=He.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=He.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=He.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=He.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=He.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=He.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=He.hex8.exec(e))?{r:Ee(r[1]),g:Ee(r[2]),b:Ee(r[3]),a:ys(r[4]),format:n?"name":"hex8"}:(r=He.hex6.exec(e))?{r:Ee(r[1]),g:Ee(r[2]),b:Ee(r[3]),format:n?"name":"hex"}:(r=He.hex4.exec(e))?{r:Ee(r[1]+""+r[1]),g:Ee(r[2]+""+r[2]),b:Ee(r[3]+""+r[3]),a:ys(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=He.hex3.exec(e))?{r:Ee(r[1]+""+r[1]),g:Ee(r[2]+""+r[2]),b:Ee(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function Gb(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function ri(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function Xb(e){if(Array.isArray(e))return ri(e)}function Su(e,n,r){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:r;throw new TypeError("Private element is not present on this object")}function Kb(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Yb(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function Me(e,n){return e.get(Su(e,n))}function vs(e,n,r){Kb(e,n),n.set(e,r)}function bs(e,n,r){return e.set(Su(e,n),r),r}function Qb(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,o1(i.key),i)}}function e1(e,n,r){return n&&Qb(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function t1(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function n1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
86
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r1(e){return Xb(e)||t1(e)||s1(e)||n1()}function i1(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function o1(e){var n=i1(e,"string");return typeof n=="symbol"?n:n+""}function s1(e,n){if(e){if(typeof e=="string")return ri(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ri(e,n):void 0}}var a1=123,u1=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},zu=function(n,r,i){return(n<<16)+(r<<8)+i},c1=function(n){var r=U(n).toRgb(),i=r.r,o=r.g,s=r.b;return zu(i,o,s)},ws=function(n,r){return n*a1%Math.pow(2,r)},wt=new WeakMap,st=new WeakMap,l1=(function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;Yb(this,e),vs(this,wt,void 0),vs(this,st,void 0),bs(st,this,n),this.reset()}return e1(e,[{key:"reset",value:function(){bs(wt,this,["__reserved for background__"])}},{key:"register",value:function(r){if(Me(wt,this).length>=Math.pow(2,24-Me(st,this)))return null;var i=Me(wt,this).length,o=ws(i,Me(st,this)),s=u1(i+(o<<24-Me(st,this)));return Me(wt,this).push(r),s}},{key:"lookup",value:function(r){if(!r)return null;var i=typeof r=="string"?c1(r):zu.apply(void 0,r1(r));if(!i)return null;var o=i&Math.pow(2,24-Me(st,this))-1,s=i>>24-Me(st,this)&Math.pow(2,Me(st,this))-1;return ws(o,Me(st,this))!==s||o>=Me(wt,this).length?null:Me(wt,this)[o]}}])})(),An,le,Tu,Cu,kt,xs,Pu,Eu,Au,no,ii,oi,_n={},Ru=[],f1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zr=Array.isArray;function Ye(e,n){for(var r in n)e[r]=n[r];return e}function ro(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function h1(e,n,r){var i,o,s,a={};for(s in n)s=="key"?i=n[s]:s=="ref"?o=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?An.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)a[s]===void 0&&(a[s]=e.defaultProps[s]);return sn(e,a,i,o,null)}function sn(e,n,r,i,o){var s={type:e,props:n,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Tu,__i:-1,__u:0};return o==null&&le.vnode!=null&&le.vnode(s),s}function Tr(e){return e.children}function Jn(e,n){this.props=e,this.context=n}function Lt(e,n){if(n==null)return e.__?Lt(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Lt(e):null}function $u(e){var n,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return $u(e)}}function ks(e){(!e.__d&&(e.__d=!0)&&kt.push(e)&&!cr.__r++||xs!=le.debounceRendering)&&((xs=le.debounceRendering)||Pu)(cr)}function cr(){for(var e,n,r,i,o,s,a,u=1;kt.length;)kt.length>u&&kt.sort(Eu),e=kt.shift(),u=kt.length,e.__d&&(r=void 0,i=void 0,o=(i=(n=e).__v).__e,s=[],a=[],n.__P&&((r=Ye({},i)).__v=i.__v+1,le.vnode&&le.vnode(r),io(n.__P,r,i,n.__n,n.__P.namespaceURI,32&i.__u?[o]:null,s,o??Lt(i),!!(32&i.__u),a),r.__v=i.__v,r.__.__k[r.__i]=r,Ou(s,r,a),i.__e=i.__=null,r.__e!=o&&$u(r)));cr.__r=0}function Iu(e,n,r,i,o,s,a,u,c,l,h){var f,d,p,g,_,y,m,w=i&&i.__k||Ru,C=n.length;for(c=d1(r,n,w,c,C),f=0;f<C;f++)(p=r.__k[f])!=null&&(d=p.__i==-1?_n:w[p.__i]||_n,p.__i=f,y=io(e,p,d,o,s,a,u,c,l,h),g=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&oo(d.ref,null,p),h.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),(m=!!(4&p.__u))||d.__k===p.__k?c=Mu(p,c,e,m):typeof p.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),p.__u&=-7);return r.__e=_,c}function d1(e,n,r,i,o){var s,a,u,c,l,h=r.length,f=h,d=0;for(e.__k=new Array(o),s=0;s<o;s++)(a=n[s])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[s]=sn(null,a,null,null,null):zr(a)?a=e.__k[s]=sn(Tr,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[s]=sn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[s]=a,c=s+d,a.__=e,a.__b=e.__b+1,u=null,(l=a.__i=p1(a,r,c,f))!=-1&&(f--,(u=r[l])&&(u.__u|=2)),u==null||u.__v==null?(l==-1&&(o>h?d--:o<h&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,a.__u|=4))):e.__k[s]=null;if(f)for(s=0;s<h;s++)(u=r[s])!=null&&(2&u.__u)==0&&(u.__e==i&&(i=Lt(u)),Du(u,u));return i}function Mu(e,n,r,i){var o,s;if(typeof e.type=="function"){for(o=e.__k,s=0;o&&s<o.length;s++)o[s]&&(o[s].__=e,n=Mu(o[s],n,r,i));return n}e.__e!=n&&(i&&(n&&e.type&&!n.parentNode&&(n=Lt(e)),r.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function p1(e,n,r,i){var o,s,a,u=e.key,c=e.type,l=n[r],h=l!=null&&(2&l.__u)==0;if(l===null&&u==null||h&&u==l.key&&c==l.type)return r;if(i>(h?1:0)){for(o=r-1,s=r+1;o>=0||s<n.length;)if((l=n[a=o>=0?o--:s++])!=null&&(2&l.__u)==0&&u==l.key&&c==l.type)return a}return-1}function Ss(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||f1.test(n)?r:r+"px"}function Un(e,n,r,i,o){var s,a;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(n in i)r&&n in r||Ss(e.style,n,"");if(r)for(n in r)i&&r[n]==i[n]||Ss(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")s=n!=(n=n.replace(Au,"$1")),a=n.toLowerCase(),n=a in e||n=="onFocusOut"||n=="onFocusIn"?a.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+s]=r,r?i?r.u=i.u:(r.u=no,e.addEventListener(n,s?oi:ii,s)):e.removeEventListener(n,s?oi:ii,s);else{if(o=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function zs(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n.t==null)n.t=no++;else if(n.t<r.u)return;return r(le.event?le.event(n):n)}}}function io(e,n,r,i,o,s,a,u,c,l){var h,f,d,p,g,_,y,m,w,C,b,v,k,x,P,M,$,N=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(c=!!(32&r.__u),s=[u=n.__e=r.__e]),(h=le.__b)&&h(n);e:if(typeof N=="function")try{if(m=n.props,w="prototype"in N&&N.prototype.render,C=(h=N.contextType)&&i[h.__c],b=h?C?C.props.value:h.__:i,r.__c?y=(f=n.__c=r.__c).__=f.__E:(w?n.__c=f=new N(m,b):(n.__c=f=new Jn(m,b),f.constructor=N,f.render=m1),C&&C.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),w&&f.__s==null&&(f.__s=f.state),w&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ye({},f.__s)),Ye(f.__s,N.getDerivedStateFromProps(m,f.__s))),p=f.props,g=f.state,f.__v=n,d)w&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),w&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(w&&N.getDerivedStateFromProps==null&&m!==p&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(m,b),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(m,f.__s,b)===!1){for(n.__v!=r.__v&&(f.props=m,f.state=f.__s,f.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(D){D&&(D.__=n)}),v=0;v<f._sb.length;v++)f.__h.push(f._sb[v]);f._sb=[],f.__h.length&&a.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(m,f.__s,b),w&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(p,g,_)})}if(f.context=b,f.props=m,f.__P=e,f.__e=!1,k=le.__r,x=0,w){for(f.state=f.__s,f.__d=!1,k&&k(n),h=f.render(f.props,f.state,f.context),P=0;P<f._sb.length;P++)f.__h.push(f._sb[P]);f._sb=[]}else do f.__d=!1,k&&k(n),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++x<25);f.state=f.__s,f.getChildContext!=null&&(i=Ye(Ye({},i),f.getChildContext())),w&&!d&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(p,g)),M=h,h!=null&&h.type===Tr&&h.key==null&&(M=Nu(h.props.children)),u=Iu(e,zr(M)?M:[M],n,r,i,o,s,a,u,c,l),f.base=n.__e,n.__u&=-161,f.__h.length&&a.push(f),y&&(f.__E=f.__=null)}catch(D){if(n.__v=null,c||s!=null)if(D.then){for(n.__u|=c?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;s[s.indexOf(u)]=null,n.__e=u}else{for($=s.length;$--;)ro(s[$]);si(n)}else n.__e=r.__e,n.__k=r.__k,D.then||si(n);le.__e(D,n,r)}else s==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):u=n.__e=g1(r.__e,n,r,i,o,s,a,c,l);return(h=le.diffed)&&h(n),128&n.__u?void 0:u}function si(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(si)}function Ou(e,n,r){for(var i=0;i<r.length;i++)oo(r[i],r[++i],r[++i]);le.__c&&le.__c(n,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(s){s.call(o)})}catch(s){le.__e(s,o.__v)}})}function Nu(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:zr(e)?e.map(Nu):Ye({},e)}function g1(e,n,r,i,o,s,a,u,c){var l,h,f,d,p,g,_,y=r.props||_n,m=n.props,w=n.type;if(w=="svg"?o="http://www.w3.org/2000/svg":w=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),s!=null){for(l=0;l<s.length;l++)if((p=s[l])&&"setAttribute"in p==!!w&&(w?p.localName==w:p.nodeType==3)){e=p,s[l]=null;break}}if(e==null){if(w==null)return document.createTextNode(m);e=document.createElementNS(o,w,m.is&&m),u&&(le.__m&&le.__m(n,s),u=!1),s=null}if(w==null)y===m||u&&e.data==m||(e.data=m);else{if(s=s&&An.call(e.childNodes),!u&&s!=null)for(y={},l=0;l<e.attributes.length;l++)y[(p=e.attributes[l]).name]=p.value;for(l in y)if(p=y[l],l!="children"){if(l=="dangerouslySetInnerHTML")f=p;else if(!(l in m)){if(l=="value"&&"defaultValue"in m||l=="checked"&&"defaultChecked"in m)continue;Un(e,l,null,p,o)}}for(l in m)p=m[l],l=="children"?d=p:l=="dangerouslySetInnerHTML"?h=p:l=="value"?g=p:l=="checked"?_=p:u&&typeof p!="function"||y[l]===p||Un(e,l,p,y[l],o);if(h)u||f&&(h.__html==f.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(f&&(e.innerHTML=""),Iu(n.type=="template"?e.content:e,zr(d)?d:[d],n,r,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":o,s,a,s?s[0]:r.__k&&Lt(r,0),u,c),s!=null)for(l=s.length;l--;)ro(s[l]);u||(l="value",w=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||w=="progress"&&!g||w=="option"&&g!=y[l])&&Un(e,l,g,y[l],o),l="checked",_!=null&&_!=e[l]&&Un(e,l,_,y[l],o))}return e}function oo(e,n,r){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(o){le.__e(o,r)}}function Du(e,n,r){var i,o;if(le.unmount&&le.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||oo(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(s){le.__e(s,n)}i.base=i.__P=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&Du(i[o],n,r||typeof e.type!="function");r||ro(e.__e),e.__c=e.__=e.__e=void 0}function m1(e,n,r){return this.constructor(e,r)}function _1(e,n,r){var i,o,s,a;n==document&&(n=document.documentElement),le.__&&le.__(e,n),o=(i=!1)?null:n.__k,s=[],a=[],io(n,e=n.__k=h1(Tr,null,[e]),o||_n,_n,n.namespaceURI,o?null:n.firstChild?An.call(n.childNodes):null,s,o?o.__e:n.firstChild,i,a),Ou(s,e,a)}function ju(e,n,r){var i,o,s,a,u=Ye({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),n)s=="key"?i=n[s]:s=="ref"?o=n[s]:u[s]=n[s]===void 0&&a!=null?a[s]:n[s];return arguments.length>2&&(u.children=arguments.length>3?An.call(arguments,2):r),sn(e.type,u,i||e.key,o||e.ref,null)}An=Ru.slice,le={__e:function(e,n,r,i){for(var o,s,a;n=n.__;)if((o=n.__c)&&!o.__)try{if((s=o.constructor)&&s.getDerivedStateFromError!=null&&(o.setState(s.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(u){e=u}throw e}},Tu=0,Cu=function(e){return e!=null&&e.constructor===void 0},Jn.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ye({},this.state),typeof e=="function"&&(e=e(Ye({},r),this.props)),e&&Ye(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),ks(this))},Jn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ks(this))},Jn.prototype.render=Tr,kt=[],Pu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Eu=function(e,n){return e.__v.__b-n.__v.__b},cr.__r=0,Au=/(PointerCapture)$|Capture$/i,no=0,ii=zs(!1),oi=zs(!0);function Ts(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function y1(e){if(Array.isArray(e))return e}function v1(e,n,r){return(n=z1(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function b1(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,s,a,u=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(i=s.call(r)).done)&&(u.push(i.value),u.length!==n);c=!0);}catch(h){l=!0,o=h}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}function w1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
87
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
83
|
+
- "app": Tool callable by the app from this server only`)});E({mimeTypes:B(T()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});E({method:S("ui/download-file"),params:E({contents:B(J([Oa,Na])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});E({method:S("ui/message"),params:E({role:S("user").describe('Message role, currently only "user" is supported.'),content:B(Tn).describe("Message content blocks (text, image, etc.).")})});E({method:S("ui/notifications/sandbox-resource-ready"),params:E({html:T().describe("HTML content to load into the inner iframe."),sandbox:T().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Zi.optional().describe("CSP configuration from resource metadata."),permissions:qi.optional().describe("Sandbox permissions from resource metadata.")})});var Yg=E({method:S("ui/notifications/tool-result"),params:br.describe("Standard MCP tool execution result.")}),qa=E({toolInfo:E({id:bn.optional().describe("JSON-RPC id of the tools/call request."),tool:ji.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Ng.optional().describe("Current color theme preference."),styles:Bg.optional().describe("Style configuration for theming the app."),displayMode:fn.optional().describe("How the UI is currently displayed."),availableDisplayModes:B(fn).optional().describe("Display modes the host supports."),containerDimensions:J([E({height:G().describe("Fixed container height in pixels.")}),E({maxHeight:J([G(),Fr()]).optional().describe("Maximum container height in pixels.")})]).and(J([E({width:G().describe("Fixed container width in pixels.")}),E({maxWidth:J([G(),Fr()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
84
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:T().optional().describe("User's language and region preference in BCP 47 format."),timeZone:T().optional().describe("User's timezone in IANA format."),userAgent:T().optional().describe("Host application identifier."),platform:J([S("web"),S("desktop"),S("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:E({touch:oe().optional().describe("Whether the device supports touch input."),hover:oe().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:E({top:G().describe("Top safe area inset in pixels."),right:G().describe("Right safe area inset in pixels."),bottom:G().describe("Bottom safe area inset in pixels."),left:G().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Qg=E({method:S("ui/notifications/host-context-changed"),params:qa.describe("Partial context update containing only changed fields.")});E({method:S("ui/update-model-context"),params:E({content:B(Tn).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:ne(T(),ie().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});E({method:S("ui/initialize"),params:E({appInfo:yr.describe("App identification (name and version)."),appCapabilities:Jg.describe("Features and capabilities this app provides."),protocolVersion:T().describe("Protocol version this app supports.")})});var em=E({protocolVersion:T().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:yr.describe("Host application identification and version."),hostCapabilities:Gg.describe("Features and capabilities provided by the host."),hostContext:qa.describe("Rich context about the host environment.")}).passthrough();class tm extends $g{constructor(r,i={},o={autoResize:!0}){super(o);be(this,"_appInfo");be(this,"_capabilities");be(this,"options");be(this,"_hostCapabilities");be(this,"_hostInfo");be(this,"_hostContext");be(this,"sendOpenLink",this.openLink);this._appInfo=r,this._capabilities=i,this.options=o,this.setRequestHandler(vr,s=>(console.log("Received ping:",s.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(r){this.setNotificationHandler(Lg,i=>r(i.params))}set ontoolinputpartial(r){this.setNotificationHandler(Fg,i=>r(i.params))}set ontoolresult(r){this.setNotificationHandler(Yg,i=>r(i.params))}set ontoolcancelled(r){this.setNotificationHandler(Hg,i=>r(i.params))}set onhostcontextchanged(r){this.setNotificationHandler(Qg,i=>{this._hostContext={...this._hostContext,...i.params},r(i.params)})}set onteardown(r){this.setRequestHandler(Wg,(i,o)=>r(i.params,o))}set oncalltool(r){this.setRequestHandler(ja,(i,o)=>r(i.params,o))}set onlisttools(r){this.setRequestHandler(Da,(i,o)=>r(i.params,o))}assertCapabilityForMethod(r){}assertRequestHandlerCapability(r){switch(r){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${r})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${r} registered`)}}assertNotificationCapability(r){}assertTaskCapability(r){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(r){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(r,i){if(typeof r=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${r}"). Did you mean: callServerTool({ name: "${r}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:r},br,i)}async readServerResource(r,i){return await this.request({method:"resources/read",params:r},Ma,i)}async listServerResources(r,i){return await this.request({method:"resources/list",params:r},Ia,i)}sendMessage(r,i){return this.request({method:"ui/message",params:r},Ug,i)}sendLog(r){return this.notification({method:"notifications/message",params:r})}updateModelContext(r,i){return this.request({method:"ui/update-model-context",params:r},ki,i)}openLink(r,i){return this.request({method:"ui/open-link",params:r},Zg,i)}downloadFile(r,i){return this.request({method:"ui/download-file",params:r},qg,i)}requestTeardown(r={}){return this.notification({method:"ui/notifications/request-teardown",params:r})}requestDisplayMode(r,i){return this.request({method:"ui/request-display-mode",params:r},Xg,i)}sendSizeChanged(r){return this.notification({method:"ui/notifications/size-changed",params:r})}setupSizeChangedNotifications(){let r=!1,i=0,o=0,s=()=>{r||(r=!0,requestAnimationFrame(()=>{r=!1;let u=document.documentElement,c=u.style.width,l=u.style.height;u.style.width="fit-content",u.style.height="max-content";let h=u.getBoundingClientRect();u.style.width=c,u.style.height=l;let f=window.innerWidth-u.clientWidth,d=Math.ceil(h.width+f),p=Math.ceil(h.height);(d!==i||p!==o)&&(i=d,o=p,this.sendSizeChanged({width:d,height:p}))}))};s();let a=new ResizeObserver(s);return a.observe(document.documentElement),a.observe(document.body),()=>a.disconnect()}async connect(r=new Og(window.parent,window.parent),i){var o;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(r);try{let s=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Ig}},em,i);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);this._hostCapabilities=s.hostCapabilities,this._hostInfo=s.hostInfo,this._hostContext=s.hostContext,await this.notification({method:"ui/notifications/initialized"}),(o=this.options)!=null&&o.autoResize&&this.setupSizeChangedNotifications()}catch(s){throw this.close(),s}}}function Ua(e,n,r){var i,o=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function s(){var a,u=i.length,c,l=0,h=0,f=0;for(a=0;a<u;++a)c=i[a],l+=c.x||0,h+=c.y||0,f+=c.z||0;for(l=(l/u-e)*o,h=(h/u-n)*o,f=(f/u-r)*o,a=0;a<u;++a)c=i[a],l&&(c.x-=l),h&&(c.y-=h),f&&(c.z-=f)}return s.initialize=function(a){i=a},s.x=function(a){return arguments.length?(e=+a,s):e},s.y=function(a){return arguments.length?(n=+a,s):n},s.z=function(a){return arguments.length?(r=+a,s):r},s.strength=function(a){return arguments.length?(o=+a,s):o},s}function nm(e){const n=+this._x.call(null,e);return La(this.cover(n),n,e)}function La(e,n,r){if(isNaN(n))return e;var i,o=e._root,s={data:r},a=e._x0,u=e._x1,c,l,h,f,d;if(!o)return e._root=s,e;for(;o.length;)if((h=n>=(c=(a+u)/2))?a=c:u=c,i=o,!(o=o[f=+h]))return i[f]=s,e;if(l=+e._x.call(null,o.data),n===l)return s.next=o,i?i[f]=s:e._root=s,e;do i=i?i[f]=new Array(2):e._root=new Array(2),(h=n>=(c=(a+u)/2))?a=c:u=c;while((f=+h)==(d=+(l>=c)));return i[d]=o,i[f]=s,e}function rm(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let i=1/0,o=-1/0;for(let s=0,a;s<n;++s)isNaN(a=+this._x.call(null,e[s]))||(r[s]=a,a<i&&(i=a),a>o&&(o=a));if(i>o)return this;this.cover(i).cover(o);for(let s=0;s<n;++s)La(this,r[s],e[s]);return this}function im(e){if(isNaN(e=+e))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(e))+1;else{for(var i=r-n||1,o=this._root,s,a;n>e||e>=r;)switch(a=+(e<n),s=new Array(2),s[a]=o,o=s,i*=2,a){case 0:r=n+i;break;case 1:n=r-i;break}this._root&&this._root.length&&(this._root=o)}return this._x0=n,this._x1=r,this}function om(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function sm(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function ct(e,n,r){this.node=e,this.x0=n,this.x1=r}function am(e,n){var r,i=this._x0,o,s,a=this._x1,u=[],c=this._root,l,h;for(c&&u.push(new ct(c,i,a)),n==null?n=1/0:(i=e-n,a=e+n);l=u.pop();)if(!(!(c=l.node)||(o=l.x0)>a||(s=l.x1)<i))if(c.length){var f=(o+s)/2;u.push(new ct(c[1],f,s),new ct(c[0],o,f)),(h=+(e>=f))&&(l=u[u.length-1],u[u.length-1]=u[u.length-1-h],u[u.length-1-h]=l)}else{var d=Math.abs(e-+this._x.call(null,c.data));d<n&&(n=d,i=e-d,a=e+d,r=c.data)}return r}function um(e){if(isNaN(c=+this._x.call(null,e)))return this;var n,r=this._root,i,o,s,a=this._x0,u=this._x1,c,l,h,f,d;if(!r)return this;if(r.length)for(;;){if((h=c>=(l=(a+u)/2))?a=l:u=l,n=r,!(r=r[f=+h]))return this;if(!r.length)break;n[f+1&1]&&(i=n,d=f)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,o?(s?o.next=s:delete o.next,this):n?(s?n[f]=s:delete n[f],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(i?i[d]=r:this._root=r),this):(this._root=s,this)}function cm(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function lm(){return this._root}function fm(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function hm(e){var n=[],r,i=this._root,o,s,a;for(i&&n.push(new ct(i,this._x0,this._x1));r=n.pop();)if(!e(i=r.node,s=r.x0,a=r.x1)&&i.length){var u=(s+a)/2;(o=i[1])&&n.push(new ct(o,u,a)),(o=i[0])&&n.push(new ct(o,s,u))}return this}function dm(e){var n=[],r=[],i;for(this._root&&n.push(new ct(this._root,this._x0,this._x1));i=n.pop();){var o=i.node;if(o.length){var s,a=i.x0,u=i.x1,c=(a+u)/2;(s=o[0])&&n.push(new ct(s,a,c)),(s=o[1])&&n.push(new ct(s,c,u))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.x1);return this}function pm(e){return e[0]}function gm(e){return arguments.length?(this._x=e,this):this._x}function Ui(e,n){var r=new Li(n??pm,NaN,NaN);return e==null?r:r.addAll(e)}function Li(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function Io(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Pe=Ui.prototype=Li.prototype;Pe.copy=function(){var e=new Li(this._x,this._x0,this._x1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=Io(n),e;for(r=[{source:n,target:e._root=new Array(2)}];n=r.pop();)for(var o=0;o<2;++o)(i=n.source[o])&&(i.length?r.push({source:i,target:n.target[o]=new Array(2)}):n.target[o]=Io(i));return e};Pe.add=nm;Pe.addAll=rm;Pe.cover=im;Pe.data=om;Pe.extent=sm;Pe.find=am;Pe.remove=um;Pe.removeAll=cm;Pe.root=lm;Pe.size=fm;Pe.visit=hm;Pe.visitAfter=dm;Pe.x=gm;function mm(e){const n=+this._x.call(null,e),r=+this._y.call(null,e);return Fa(this.cover(n,r),n,r,e)}function Fa(e,n,r,i){if(isNaN(n)||isNaN(r))return e;var o,s=e._root,a={data:i},u=e._x0,c=e._y0,l=e._x1,h=e._y1,f,d,p,g,_,y,m,w;if(!s)return e._root=a,e;for(;s.length;)if((_=n>=(f=(u+l)/2))?u=f:l=f,(y=r>=(d=(c+h)/2))?c=d:h=d,o=s,!(s=s[m=y<<1|_]))return o[m]=a,e;if(p=+e._x.call(null,s.data),g=+e._y.call(null,s.data),n===p&&r===g)return a.next=s,o?o[m]=a:e._root=a,e;do o=o?o[m]=new Array(4):e._root=new Array(4),(_=n>=(f=(u+l)/2))?u=f:l=f,(y=r>=(d=(c+h)/2))?c=d:h=d;while((m=y<<1|_)===(w=(g>=d)<<1|p>=f));return o[w]=s,o[m]=a,e}function _m(e){var n,r,i=e.length,o,s,a=new Array(i),u=new Array(i),c=1/0,l=1/0,h=-1/0,f=-1/0;for(r=0;r<i;++r)isNaN(o=+this._x.call(null,n=e[r]))||isNaN(s=+this._y.call(null,n))||(a[r]=o,u[r]=s,o<c&&(c=o),o>h&&(h=o),s<l&&(l=s),s>f&&(f=s));if(c>h||l>f)return this;for(this.cover(c,l).cover(h,f),r=0;r<i;++r)Fa(this,a[r],u[r],e[r]);return this}function ym(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._x1,s=this._y1;if(isNaN(r))o=(r=Math.floor(e))+1,s=(i=Math.floor(n))+1;else{for(var a=o-r||1,u=this._root,c,l;r>e||e>=o||i>n||n>=s;)switch(l=(n<i)<<1|e<r,c=new Array(4),c[l]=u,u=c,a*=2,l){case 0:o=r+a,s=i+a;break;case 1:r=o-a,s=i+a;break;case 2:o=r+a,i=s-a;break;case 3:r=o-a,i=s-a;break}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=i,this._x1=o,this._y1=s,this}function vm(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function bm(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function ke(e,n,r,i,o){this.node=e,this.x0=n,this.y0=r,this.x1=i,this.y1=o}function wm(e,n,r){var i,o=this._x0,s=this._y0,a,u,c,l,h=this._x1,f=this._y1,d=[],p=this._root,g,_;for(p&&d.push(new ke(p,o,s,h,f)),r==null?r=1/0:(o=e-r,s=n-r,h=e+r,f=n+r,r*=r);g=d.pop();)if(!(!(p=g.node)||(a=g.x0)>h||(u=g.y0)>f||(c=g.x1)<o||(l=g.y1)<s))if(p.length){var y=(a+c)/2,m=(u+l)/2;d.push(new ke(p[3],y,m,c,l),new ke(p[2],a,m,y,l),new ke(p[1],y,u,c,m),new ke(p[0],a,u,y,m)),(_=(n>=m)<<1|e>=y)&&(g=d[d.length-1],d[d.length-1]=d[d.length-1-_],d[d.length-1-_]=g)}else{var w=e-+this._x.call(null,p.data),C=n-+this._y.call(null,p.data),b=w*w+C*C;if(b<r){var v=Math.sqrt(r=b);o=e-v,s=n-v,h=e+v,f=n+v,i=p.data}}return i}function xm(e){if(isNaN(h=+this._x.call(null,e))||isNaN(f=+this._y.call(null,e)))return this;var n,r=this._root,i,o,s,a=this._x0,u=this._y0,c=this._x1,l=this._y1,h,f,d,p,g,_,y,m;if(!r)return this;if(r.length)for(;;){if((g=h>=(d=(a+c)/2))?a=d:c=d,(_=f>=(p=(u+l)/2))?u=p:l=p,n=r,!(r=r[y=_<<1|g]))return this;if(!r.length)break;(n[y+1&3]||n[y+2&3]||n[y+3&3])&&(i=n,m=y)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,o?(s?o.next=s:delete o.next,this):n?(s?n[y]=s:delete n[y],(r=n[0]||n[1]||n[2]||n[3])&&r===(n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[m]=r:this._root=r),this):(this._root=s,this)}function km(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function Sm(){return this._root}function zm(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Tm(e){var n=[],r,i=this._root,o,s,a,u,c;for(i&&n.push(new ke(i,this._x0,this._y0,this._x1,this._y1));r=n.pop();)if(!e(i=r.node,s=r.x0,a=r.y0,u=r.x1,c=r.y1)&&i.length){var l=(s+u)/2,h=(a+c)/2;(o=i[3])&&n.push(new ke(o,l,h,u,c)),(o=i[2])&&n.push(new ke(o,s,h,l,c)),(o=i[1])&&n.push(new ke(o,l,a,u,h)),(o=i[0])&&n.push(new ke(o,s,a,l,h))}return this}function Cm(e){var n=[],r=[],i;for(this._root&&n.push(new ke(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var o=i.node;if(o.length){var s,a=i.x0,u=i.y0,c=i.x1,l=i.y1,h=(a+c)/2,f=(u+l)/2;(s=o[0])&&n.push(new ke(s,a,u,h,f)),(s=o[1])&&n.push(new ke(s,h,u,c,f)),(s=o[2])&&n.push(new ke(s,a,f,h,l)),(s=o[3])&&n.push(new ke(s,h,f,c,l))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Pm(e){return e[0]}function Em(e){return arguments.length?(this._x=e,this):this._x}function Am(e){return e[1]}function Rm(e){return arguments.length?(this._y=e,this):this._y}function Fi(e,n,r){var i=new Hi(n??Pm,r??Am,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Hi(e,n,r,i,o,s){this._x=e,this._y=n,this._x0=r,this._y0=i,this._x1=o,this._y1=s,this._root=void 0}function Mo(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Se=Fi.prototype=Hi.prototype;Se.copy=function(){var e=new Hi(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=Mo(n),e;for(r=[{source:n,target:e._root=new Array(4)}];n=r.pop();)for(var o=0;o<4;++o)(i=n.source[o])&&(i.length?r.push({source:i,target:n.target[o]=new Array(4)}):n.target[o]=Mo(i));return e};Se.add=mm;Se.addAll=_m;Se.cover=ym;Se.data=vm;Se.extent=bm;Se.find=wm;Se.remove=xm;Se.removeAll=km;Se.root=Sm;Se.size=zm;Se.visit=Tm;Se.visitAfter=Cm;Se.x=Em;Se.y=Rm;function $m(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),i=+this._z.call(null,e);return Ha(this.cover(n,r,i),n,r,i,e)}function Ha(e,n,r,i,o){if(isNaN(n)||isNaN(r)||isNaN(i))return e;var s,a=e._root,u={data:o},c=e._x0,l=e._y0,h=e._z0,f=e._x1,d=e._y1,p=e._z1,g,_,y,m,w,C,b,v,k,x,P;if(!a)return e._root=u,e;for(;a.length;)if((b=n>=(g=(c+f)/2))?c=g:f=g,(v=r>=(_=(l+d)/2))?l=_:d=_,(k=i>=(y=(h+p)/2))?h=y:p=y,s=a,!(a=a[x=k<<2|v<<1|b]))return s[x]=u,e;if(m=+e._x.call(null,a.data),w=+e._y.call(null,a.data),C=+e._z.call(null,a.data),n===m&&r===w&&i===C)return u.next=a,s?s[x]=u:e._root=u,e;do s=s?s[x]=new Array(8):e._root=new Array(8),(b=n>=(g=(c+f)/2))?c=g:f=g,(v=r>=(_=(l+d)/2))?l=_:d=_,(k=i>=(y=(h+p)/2))?h=y:p=y;while((x=k<<2|v<<1|b)===(P=(C>=y)<<2|(w>=_)<<1|m>=g));return s[P]=a,s[x]=u,e}function Im(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),i=new Float64Array(n),o=new Float64Array(n);let s=1/0,a=1/0,u=1/0,c=-1/0,l=-1/0,h=-1/0;for(let f=0,d,p,g,_;f<n;++f)isNaN(p=+this._x.call(null,d=e[f]))||isNaN(g=+this._y.call(null,d))||isNaN(_=+this._z.call(null,d))||(r[f]=p,i[f]=g,o[f]=_,p<s&&(s=p),p>c&&(c=p),g<a&&(a=g),g>l&&(l=g),_<u&&(u=_),_>h&&(h=_));if(s>c||a>l||u>h)return this;this.cover(s,a,u).cover(c,l,h);for(let f=0;f<n;++f)Ha(this,r[f],i[f],o[f],e[f]);return this}function Mm(e,n,r){if(isNaN(e=+e)||isNaN(n=+n)||isNaN(r=+r))return this;var i=this._x0,o=this._y0,s=this._z0,a=this._x1,u=this._y1,c=this._z1;if(isNaN(i))a=(i=Math.floor(e))+1,u=(o=Math.floor(n))+1,c=(s=Math.floor(r))+1;else{for(var l=a-i||1,h=this._root,f,d;i>e||e>=a||o>n||n>=u||s>r||r>=c;)switch(d=(r<s)<<2|(n<o)<<1|e<i,f=new Array(8),f[d]=h,h=f,l*=2,d){case 0:a=i+l,u=o+l,c=s+l;break;case 1:i=a-l,u=o+l,c=s+l;break;case 2:a=i+l,o=u-l,c=s+l;break;case 3:i=a-l,o=u-l,c=s+l;break;case 4:a=i+l,u=o+l,s=c-l;break;case 5:i=a-l,u=o+l,s=c-l;break;case 6:a=i+l,o=u-l,s=c-l;break;case 7:i=a-l,o=u-l,s=c-l;break}this._root&&this._root.length&&(this._root=h)}return this._x0=i,this._y0=o,this._z0=s,this._x1=a,this._y1=u,this._z1=c,this}function Om(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function Nm(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function re(e,n,r,i,o,s,a){this.node=e,this.x0=n,this.y0=r,this.z0=i,this.x1=o,this.y1=s,this.z1=a}function Dm(e,n,r,i){var o,s=this._x0,a=this._y0,u=this._z0,c,l,h,f,d,p,g=this._x1,_=this._y1,y=this._z1,m=[],w=this._root,C,b;for(w&&m.push(new re(w,s,a,u,g,_,y)),i==null?i=1/0:(s=e-i,a=n-i,u=r-i,g=e+i,_=n+i,y=r+i,i*=i);C=m.pop();)if(!(!(w=C.node)||(c=C.x0)>g||(l=C.y0)>_||(h=C.z0)>y||(f=C.x1)<s||(d=C.y1)<a||(p=C.z1)<u))if(w.length){var v=(c+f)/2,k=(l+d)/2,x=(h+p)/2;m.push(new re(w[7],v,k,x,f,d,p),new re(w[6],c,k,x,v,d,p),new re(w[5],v,l,x,f,k,p),new re(w[4],c,l,x,v,k,p),new re(w[3],v,k,h,f,d,x),new re(w[2],c,k,h,v,d,x),new re(w[1],v,l,h,f,k,x),new re(w[0],c,l,h,v,k,x)),(b=(r>=x)<<2|(n>=k)<<1|e>=v)&&(C=m[m.length-1],m[m.length-1]=m[m.length-1-b],m[m.length-1-b]=C)}else{var P=e-+this._x.call(null,w.data),M=n-+this._y.call(null,w.data),$=r-+this._z.call(null,w.data),N=P*P+M*M+$*$;if(N<i){var D=Math.sqrt(i=N);s=e-D,a=n-D,u=r-D,g=e+D,_=n+D,y=r+D,o=w.data}}return o}const jm=(e,n,r,i,o,s)=>Math.sqrt((e-i)**2+(n-o)**2+(r-s)**2);function Zm(e,n,r,i){const o=[],s=e-i,a=n-i,u=r-i,c=e+i,l=n+i,h=r+i;return this.visit((f,d,p,g,_,y,m)=>{if(!f.length)do{const w=f.data;jm(e,n,r,this._x(w),this._y(w),this._z(w))<=i&&o.push(w)}while(f=f.next);return d>c||p>l||g>h||_<s||y<a||m<u}),o}function qm(e){if(isNaN(d=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(g=+this._z.call(null,e)))return this;var n,r=this._root,i,o,s,a=this._x0,u=this._y0,c=this._z0,l=this._x1,h=this._y1,f=this._z1,d,p,g,_,y,m,w,C,b,v,k;if(!r)return this;if(r.length)for(;;){if((w=d>=(_=(a+l)/2))?a=_:l=_,(C=p>=(y=(u+h)/2))?u=y:h=y,(b=g>=(m=(c+f)/2))?c=m:f=m,n=r,!(r=r[v=b<<2|C<<1|w]))return this;if(!r.length)break;(n[v+1&7]||n[v+2&7]||n[v+3&7]||n[v+4&7]||n[v+5&7]||n[v+6&7]||n[v+7&7])&&(i=n,k=v)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,o?(s?o.next=s:delete o.next,this):n?(s?n[v]=s:delete n[v],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[k]=r:this._root=r),this):(this._root=s,this)}function Um(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function Lm(){return this._root}function Fm(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Hm(e){var n=[],r,i=this._root,o,s,a,u,c,l,h;for(i&&n.push(new re(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=n.pop();)if(!e(i=r.node,s=r.x0,a=r.y0,u=r.z0,c=r.x1,l=r.y1,h=r.z1)&&i.length){var f=(s+c)/2,d=(a+l)/2,p=(u+h)/2;(o=i[7])&&n.push(new re(o,f,d,p,c,l,h)),(o=i[6])&&n.push(new re(o,s,d,p,f,l,h)),(o=i[5])&&n.push(new re(o,f,a,p,c,d,h)),(o=i[4])&&n.push(new re(o,s,a,p,f,d,h)),(o=i[3])&&n.push(new re(o,f,d,u,c,l,p)),(o=i[2])&&n.push(new re(o,s,d,u,f,l,p)),(o=i[1])&&n.push(new re(o,f,a,u,c,d,p)),(o=i[0])&&n.push(new re(o,s,a,u,f,d,p))}return this}function Vm(e){var n=[],r=[],i;for(this._root&&n.push(new re(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=n.pop();){var o=i.node;if(o.length){var s,a=i.x0,u=i.y0,c=i.z0,l=i.x1,h=i.y1,f=i.z1,d=(a+l)/2,p=(u+h)/2,g=(c+f)/2;(s=o[0])&&n.push(new re(s,a,u,c,d,p,g)),(s=o[1])&&n.push(new re(s,d,u,c,l,p,g)),(s=o[2])&&n.push(new re(s,a,p,c,d,h,g)),(s=o[3])&&n.push(new re(s,d,p,c,l,h,g)),(s=o[4])&&n.push(new re(s,a,u,g,d,p,f)),(s=o[5])&&n.push(new re(s,d,u,g,l,p,f)),(s=o[6])&&n.push(new re(s,a,p,g,d,h,f)),(s=o[7])&&n.push(new re(s,d,p,g,l,h,f))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function Bm(e){return e[0]}function Wm(e){return arguments.length?(this._x=e,this):this._x}function Gm(e){return e[1]}function Jm(e){return arguments.length?(this._y=e,this):this._y}function Xm(e){return e[2]}function Km(e){return arguments.length?(this._z=e,this):this._z}function Vi(e,n,r,i){var o=new Bi(n??Bm,r??Gm,i??Xm,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function Bi(e,n,r,i,o,s,a,u,c){this._x=e,this._y=n,this._z=r,this._x0=i,this._y0=o,this._z0=s,this._x1=a,this._y1=u,this._z1=c,this._root=void 0}function Oo(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var ve=Vi.prototype=Bi.prototype;ve.copy=function(){var e=new Bi(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=Oo(n),e;for(r=[{source:n,target:e._root=new Array(8)}];n=r.pop();)for(var o=0;o<8;++o)(i=n.source[o])&&(i.length?r.push({source:i,target:n.target[o]=new Array(8)}):n.target[o]=Oo(i));return e};ve.add=$m;ve.addAll=Im;ve.cover=Mm;ve.data=Om;ve.extent=Nm;ve.find=Dm;ve.findAllWithinRadius=Zm;ve.remove=qm;ve.removeAll=Um;ve.root=Lm;ve.size=Fm;ve.visit=Hm;ve.visitAfter=Vm;ve.x=Wm;ve.y=Jm;ve.z=Km;function We(e){return function(){return e}}function Ne(e){return(e()-.5)*1e-6}function Ar(e){return e.x+e.vx}function No(e){return e.y+e.vy}function Ym(e){return e.z+e.vz}function Qm(e){var n,r,i,o,s=1,a=1;typeof e!="function"&&(e=We(e==null?1:+e));function u(){for(var h,f=n.length,d,p,g,_,y,m,w,C=0;C<a;++C)for(d=(r===1?Ui(n,Ar):r===2?Fi(n,Ar,No):r===3?Vi(n,Ar,No,Ym):null).visitAfter(c),h=0;h<f;++h)p=n[h],m=i[p.index],w=m*m,g=p.x+p.vx,r>1&&(_=p.y+p.vy),r>2&&(y=p.z+p.vz),d.visit(b);function b(v,k,x,P,M,$,N){var D=[k,x,P,M,$,N],H=D[0],z=D[1],O=D[2],R=D[r],j=D[r+1],F=D[r+2],q=v.data,V=v.r,L=m+V;if(q){if(q.index>p.index){var W=g-q.x-q.vx,ee=r>1?_-q.y-q.vy:0,K=r>2?y-q.z-q.vz:0,he=W*W+ee*ee+K*K;he<L*L&&(W===0&&(W=Ne(o),he+=W*W),r>1&&ee===0&&(ee=Ne(o),he+=ee*ee),r>2&&K===0&&(K=Ne(o),he+=K*K),he=(L-(he=Math.sqrt(he)))/he*s,p.vx+=(W*=he)*(L=(V*=V)/(w+V)),r>1&&(p.vy+=(ee*=he)*L),r>2&&(p.vz+=(K*=he)*L),q.vx-=W*(L=1-L),r>1&&(q.vy-=ee*L),r>2&&(q.vz-=K*L))}return}return H>g+L||R<g-L||r>1&&(z>_+L||j<_-L)||r>2&&(O>y+L||F<y-L)}}function c(h){if(h.data)return h.r=i[h.data.index];for(var f=h.r=0;f<Math.pow(2,r);++f)h[f]&&h[f].r>h.r&&(h.r=h[f].r)}function l(){if(n){var h,f=n.length,d;for(i=new Array(f),h=0;h<f;++h)d=n[h],i[d.index]=+e(d,h,n)}}return u.initialize=function(h,...f){n=h,o=f.find(d=>typeof d=="function")||Math.random,r=f.find(d=>[1,2,3].includes(d))||2,l()},u.iterations=function(h){return arguments.length?(a=+h,u):a},u.strength=function(h){return arguments.length?(s=+h,u):s},u.radius=function(h){return arguments.length?(e=typeof h=="function"?h:We(+h),l(),u):e},u}function e_(e){return e.index}function Do(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function Va(e){var n=e_,r=d,i,o=We(30),s,a,u,c,l,h,f=1;e==null&&(e=[]);function d(m){return 1/Math.min(c[m.source.index],c[m.target.index])}function p(m){for(var w=0,C=e.length;w<f;++w)for(var b=0,v,k,x,P=0,M=0,$=0,N,D;b<C;++b)v=e[b],k=v.source,x=v.target,P=x.x+x.vx-k.x-k.vx||Ne(h),u>1&&(M=x.y+x.vy-k.y-k.vy||Ne(h)),u>2&&($=x.z+x.vz-k.z-k.vz||Ne(h)),N=Math.sqrt(P*P+M*M+$*$),N=(N-s[b])/N*m*i[b],P*=N,M*=N,$*=N,x.vx-=P*(D=l[b]),u>1&&(x.vy-=M*D),u>2&&(x.vz-=$*D),k.vx+=P*(D=1-D),u>1&&(k.vy+=M*D),u>2&&(k.vz+=$*D)}function g(){if(a){var m,w=a.length,C=e.length,b=new Map(a.map((k,x)=>[n(k,x,a),k])),v;for(m=0,c=new Array(w);m<C;++m)v=e[m],v.index=m,typeof v.source!="object"&&(v.source=Do(b,v.source)),typeof v.target!="object"&&(v.target=Do(b,v.target)),c[v.source.index]=(c[v.source.index]||0)+1,c[v.target.index]=(c[v.target.index]||0)+1;for(m=0,l=new Array(C);m<C;++m)v=e[m],l[m]=c[v.source.index]/(c[v.source.index]+c[v.target.index]);i=new Array(C),_(),s=new Array(C),y()}}function _(){if(a)for(var m=0,w=e.length;m<w;++m)i[m]=+r(e[m],m,e)}function y(){if(a)for(var m=0,w=e.length;m<w;++m)s[m]=+o(e[m],m,e)}return p.initialize=function(m,...w){a=m,h=w.find(C=>typeof C=="function")||Math.random,u=w.find(C=>[1,2,3].includes(C))||2,g()},p.links=function(m){return arguments.length?(e=m,g(),p):e},p.id=function(m){return arguments.length?(n=m,p):n},p.iterations=function(m){return arguments.length?(f=+m,p):f},p.strength=function(m){return arguments.length?(r=typeof m=="function"?m:We(+m),_(),p):r},p.distance=function(m){return arguments.length?(o=typeof m=="function"?m:We(+m),y(),p):o},p}var t_={value:()=>{}};function Cn(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new Hn(r)}function Hn(e){this._=e}function n_(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Hn.prototype=Cn.prototype={constructor:Hn,on:function(e,n){var r=this._,i=n_(e+"",r),o,s=-1,a=i.length;if(arguments.length<2){for(;++s<a;)if((o=(e=i[s]).type)&&(o=r_(r[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++s<a;)if(o=(e=i[s]).type)r[o]=jo(r[o],e.name,n);else if(n==null)for(o in r)r[o]=jo(r[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new Hn(e)},call:function(e,n){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,s;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],i=0,o=s.length;i<o;++i)s[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,s=i.length;o<s;++o)i[o].value.apply(n,r)}};function r_(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function jo(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=t_,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var qt=0,en=0,Vt=0,Ba=1e3,er,tn,tr=0,Ct=0,wr=0,hn=typeof performance=="object"&&performance.now?performance:Date,Wa=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Wi(){return Ct||(Wa(i_),Ct=hn.now()+wr)}function i_(){Ct=0}function nr(){this._call=this._time=this._next=null}nr.prototype=Gi.prototype={constructor:nr,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Wi():+r)+(n==null?0:+n),!this._next&&tn!==this&&(tn?tn._next=this:er=this,tn=this),this._call=e,this._time=r,Br()},stop:function(){this._call&&(this._call=null,this._time=1/0,Br())}};function Gi(e,n,r){var i=new nr;return i.restart(e,n,r),i}function o_(){Wi(),++qt;for(var e=er,n;e;)(n=Ct-e._time)>=0&&e._call.call(void 0,n),e=e._next;--qt}function Zo(){Ct=(tr=hn.now())+wr,qt=en=0;try{o_()}finally{qt=0,a_(),Ct=0}}function s_(){var e=hn.now(),n=e-tr;n>Ba&&(wr-=n,tr=e)}function a_(){for(var e,n=er,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:er=r);tn=e,Br(i)}function Br(e){if(!qt){en&&(en=clearTimeout(en));var n=e-Ct;n>24?(e<1/0&&(en=setTimeout(Zo,e-hn.now()-wr)),Vt&&(Vt=clearInterval(Vt))):(Vt||(tr=hn.now(),Vt=setInterval(s_,Ba)),qt=1,Wa(Zo))}}function qo(e,n,r){var i=new nr;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}const u_=1664525,c_=1013904223,Uo=4294967296;function l_(){let e=1;return()=>(e=(u_*e+c_)%Uo)/Uo}var Lo=3;function Rr(e){return e.x}function Fo(e){return e.y}function f_(e){return e.z}var h_=10,d_=Math.PI*(3-Math.sqrt(5)),p_=Math.PI*20/(9+Math.sqrt(221));function g_(e,n){n=n||2;var r=Math.min(Lo,Math.max(1,Math.round(n))),i,o=1,s=.001,a=1-Math.pow(s,1/300),u=0,c=.6,l=new Map,h=Gi(p),f=Cn("tick","end"),d=l_();e==null&&(e=[]);function p(){g(),f.call("tick",i),o<s&&(h.stop(),f.call("end",i))}function g(m){var w,C=e.length,b;m===void 0&&(m=1);for(var v=0;v<m;++v)for(o+=(u-o)*a,l.forEach(function(k){k(o)}),w=0;w<C;++w)b=e[w],b.fx==null?b.x+=b.vx*=c:(b.x=b.fx,b.vx=0),r>1&&(b.fy==null?b.y+=b.vy*=c:(b.y=b.fy,b.vy=0)),r>2&&(b.fz==null?b.z+=b.vz*=c:(b.z=b.fz,b.vz=0));return i}function _(){for(var m=0,w=e.length,C;m<w;++m){if(C=e[m],C.index=m,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),C.fz!=null&&(C.z=C.fz),isNaN(C.x)||r>1&&isNaN(C.y)||r>2&&isNaN(C.z)){var b=h_*(r>2?Math.cbrt(.5+m):r>1?Math.sqrt(.5+m):m),v=m*d_,k=m*p_;r===1?C.x=b:r===2?(C.x=b*Math.cos(v),C.y=b*Math.sin(v)):(C.x=b*Math.sin(v)*Math.cos(k),C.y=b*Math.cos(v),C.z=b*Math.sin(v)*Math.sin(k))}(isNaN(C.vx)||r>1&&isNaN(C.vy)||r>2&&isNaN(C.vz))&&(C.vx=0,r>1&&(C.vy=0),r>2&&(C.vz=0))}}function y(m){return m.initialize&&m.initialize(e,d,r),m}return _(),i={tick:g,restart:function(){return h.restart(p),i},stop:function(){return h.stop(),i},numDimensions:function(m){return arguments.length?(r=Math.min(Lo,Math.max(1,Math.round(m))),l.forEach(y),i):r},nodes:function(m){return arguments.length?(e=m,_(),l.forEach(y),i):e},alpha:function(m){return arguments.length?(o=+m,i):o},alphaMin:function(m){return arguments.length?(s=+m,i):s},alphaDecay:function(m){return arguments.length?(a=+m,i):+a},alphaTarget:function(m){return arguments.length?(u=+m,i):u},velocityDecay:function(m){return arguments.length?(c=1-m,i):1-c},randomSource:function(m){return arguments.length?(d=m,l.forEach(y),i):d},force:function(m,w){return arguments.length>1?(w==null?l.delete(m):l.set(m,y(w)),i):l.get(m)},find:function(){var m=Array.prototype.slice.call(arguments),w=m.shift()||0,C=(r>1?m.shift():null)||0,b=(r>2?m.shift():null)||0,v=m.shift()||1/0,k=0,x=e.length,P,M,$,N,D,H;for(v*=v,k=0;k<x;++k)D=e[k],P=w-D.x,M=C-(D.y||0),$=b-(D.z||0),N=P*P+M*M+$*$,N<v&&(H=D,v=N);return H},on:function(m,w){return arguments.length>1?(f.on(m,w),i):f.on(m)}}}function Ga(){var e,n,r,i,o,s=We(-30),a,u=1,c=1/0,l=.81;function h(g){var _,y=e.length,m=(n===1?Ui(e,Rr):n===2?Fi(e,Rr,Fo):n===3?Vi(e,Rr,Fo,f_):null).visitAfter(d);for(o=g,_=0;_<y;++_)r=e[_],m.visit(p)}function f(){if(e){var g,_=e.length,y;for(a=new Array(_),g=0;g<_;++g)y=e[g],a[y.index]=+s(y,g,e)}}function d(g){var _=0,y,m,w=0,C,b,v,k,x=g.length;if(x){for(C=b=v=k=0;k<x;++k)(y=g[k])&&(m=Math.abs(y.value))&&(_+=y.value,w+=m,C+=m*(y.x||0),b+=m*(y.y||0),v+=m*(y.z||0));_*=Math.sqrt(4/x),g.x=C/w,n>1&&(g.y=b/w),n>2&&(g.z=v/w)}else{y=g,y.x=y.data.x,n>1&&(y.y=y.data.y),n>2&&(y.z=y.data.z);do _+=a[y.data.index];while(y=y.next)}g.value=_}function p(g,_,y,m,w){if(!g.value)return!0;var C=[y,m,w][n-1],b=g.x-r.x,v=n>1?g.y-r.y:0,k=n>2?g.z-r.z:0,x=C-_,P=b*b+v*v+k*k;if(x*x/l<P)return P<c&&(b===0&&(b=Ne(i),P+=b*b),n>1&&v===0&&(v=Ne(i),P+=v*v),n>2&&k===0&&(k=Ne(i),P+=k*k),P<u&&(P=Math.sqrt(u*P)),r.vx+=b*g.value*o/P,n>1&&(r.vy+=v*g.value*o/P),n>2&&(r.vz+=k*g.value*o/P)),!0;if(g.length||P>=c)return;(g.data!==r||g.next)&&(b===0&&(b=Ne(i),P+=b*b),n>1&&v===0&&(v=Ne(i),P+=v*v),n>2&&k===0&&(k=Ne(i),P+=k*k),P<u&&(P=Math.sqrt(u*P)));do g.data!==r&&(x=a[g.data.index]*o/P,r.vx+=b*x,n>1&&(r.vy+=v*x),n>2&&(r.vz+=k*x));while(g=g.next)}return h.initialize=function(g,..._){e=g,i=_.find(y=>typeof y=="function")||Math.random,n=_.find(y=>[1,2,3].includes(y))||2,f()},h.strength=function(g){return arguments.length?(s=typeof g=="function"?g:We(+g),f(),h):s},h.distanceMin=function(g){return arguments.length?(u=g*g,h):Math.sqrt(u)},h.distanceMax=function(g){return arguments.length?(c=g*g,h):Math.sqrt(c)},h.theta=function(g){return arguments.length?(l=g*g,h):Math.sqrt(l)},h}function m_(e,n,r,i){var o,s,a=We(.1),u,c;typeof e!="function"&&(e=We(+e)),n==null&&(n=0),r==null&&(r=0),i==null&&(i=0);function l(f){for(var d=0,p=o.length;d<p;++d){var g=o[d],_=g.x-n||1e-6,y=(g.y||0)-r||1e-6,m=(g.z||0)-i||1e-6,w=Math.sqrt(_*_+y*y+m*m),C=(c[d]-w)*u[d]*f/w;g.vx+=_*C,s>1&&(g.vy+=y*C),s>2&&(g.vz+=m*C)}}function h(){if(o){var f,d=o.length;for(u=new Array(d),c=new Array(d),f=0;f<d;++f)c[f]=+e(o[f],f,o),u[f]=isNaN(c[f])?0:+a(o[f],f,o)}}return l.initialize=function(f,...d){o=f,s=d.find(p=>[1,2,3].includes(p))||2,h()},l.strength=function(f){return arguments.length?(a=typeof f=="function"?f:We(+f),h(),l):a},l.radius=function(f){return arguments.length?(e=typeof f=="function"?f:We(+f),h(),l):e},l.x=function(f){return arguments.length?(n=+f,l):n},l.y=function(f){return arguments.length?(r=+f,l):r},l.z=function(f){return arguments.length?(i=+f,l):i},l}var Wr="http://www.w3.org/1999/xhtml";const Ho={svg:"http://www.w3.org/2000/svg",xhtml:Wr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function xr(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Ho.hasOwnProperty(n)?{space:Ho[n],local:e}:e}function __(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===Wr&&n.documentElement.namespaceURI===Wr?n.createElement(e):n.createElementNS(r,e)}}function y_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ja(e){var n=xr(e);return(n.local?y_:__)(n)}function v_(){}function Ji(e){return e==null?v_:function(){return this.querySelector(e)}}function b_(e){typeof e!="function"&&(e=Ji(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var s=n[o],a=s.length,u=i[o]=new Array(a),c,l,h=0;h<a;++h)(c=s[h])&&(l=e.call(c,c.__data__,h,s))&&("__data__"in c&&(l.__data__=c.__data__),u[h]=l);return new Ae(i,this._parents)}function w_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function x_(){return[]}function Xa(e){return e==null?x_:function(){return this.querySelectorAll(e)}}function k_(e){return function(){return w_(e.apply(this,arguments))}}function S_(e){typeof e=="function"?e=k_(e):e=Xa(e);for(var n=this._groups,r=n.length,i=[],o=[],s=0;s<r;++s)for(var a=n[s],u=a.length,c,l=0;l<u;++l)(c=a[l])&&(i.push(e.call(c,c.__data__,l,a)),o.push(c));return new Ae(i,o)}function Ka(e){return function(){return this.matches(e)}}function Ya(e){return function(n){return n.matches(e)}}var z_=Array.prototype.find;function T_(e){return function(){return z_.call(this.children,e)}}function C_(){return this.firstElementChild}function P_(e){return this.select(e==null?C_:T_(typeof e=="function"?e:Ya(e)))}var E_=Array.prototype.filter;function A_(){return Array.from(this.children)}function R_(e){return function(){return E_.call(this.children,e)}}function $_(e){return this.selectAll(e==null?A_:R_(typeof e=="function"?e:Ya(e)))}function I_(e){typeof e!="function"&&(e=Ka(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var s=n[o],a=s.length,u=i[o]=[],c,l=0;l<a;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&u.push(c);return new Ae(i,this._parents)}function Qa(e){return new Array(e.length)}function M_(){return new Ae(this._enter||this._groups.map(Qa),this._parents)}function rr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}rr.prototype={constructor:rr,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function O_(e){return function(){return e}}function N_(e,n,r,i,o,s){for(var a=0,u,c=n.length,l=s.length;a<l;++a)(u=n[a])?(u.__data__=s[a],i[a]=u):r[a]=new rr(e,s[a]);for(;a<c;++a)(u=n[a])&&(o[a]=u)}function D_(e,n,r,i,o,s,a){var u,c,l=new Map,h=n.length,f=s.length,d=new Array(h),p;for(u=0;u<h;++u)(c=n[u])&&(d[u]=p=a.call(c,c.__data__,u,n)+"",l.has(p)?o[u]=c:l.set(p,c));for(u=0;u<f;++u)p=a.call(e,s[u],u,s)+"",(c=l.get(p))?(i[u]=c,c.__data__=s[u],l.delete(p)):r[u]=new rr(e,s[u]);for(u=0;u<h;++u)(c=n[u])&&l.get(d[u])===c&&(o[u]=c)}function j_(e){return e.__data__}function Z_(e,n){if(!arguments.length)return Array.from(this,j_);var r=n?D_:N_,i=this._parents,o=this._groups;typeof e!="function"&&(e=O_(e));for(var s=o.length,a=new Array(s),u=new Array(s),c=new Array(s),l=0;l<s;++l){var h=i[l],f=o[l],d=f.length,p=q_(e.call(h,h&&h.__data__,l,i)),g=p.length,_=u[l]=new Array(g),y=a[l]=new Array(g),m=c[l]=new Array(d);r(h,f,_,y,m,p,n);for(var w=0,C=0,b,v;w<g;++w)if(b=_[w]){for(w>=C&&(C=w+1);!(v=y[C])&&++C<g;);b._next=v||null}}return a=new Ae(a,i),a._enter=u,a._exit=c,a}function q_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function U_(){return new Ae(this._exit||this._groups.map(Qa),this._parents)}function L_(e,n,r){var i=this.enter(),o=this,s=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?s.remove():r(s),i&&o?i.merge(o).order():o}function F_(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,s=i.length,a=Math.min(o,s),u=new Array(o),c=0;c<a;++c)for(var l=r[c],h=i[c],f=l.length,d=u[c]=new Array(f),p,g=0;g<f;++g)(p=l[g]||h[g])&&(d[g]=p);for(;c<o;++c)u[c]=r[c];return new Ae(u,this._parents)}function H_(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],o=i.length-1,s=i[o],a;--o>=0;)(a=i[o])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function V_(e){e||(e=B_);function n(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s){for(var a=r[s],u=a.length,c=o[s]=new Array(u),l,h=0;h<u;++h)(l=a[h])&&(c[h]=l);c.sort(n)}return new Ae(o,this._parents).order()}function B_(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function W_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function G_(){return Array.from(this)}function J_(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,s=i.length;o<s;++o){var a=i[o];if(a)return a}return null}function X_(){let e=0;for(const n of this)++e;return e}function K_(){return!this.node()}function Y_(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var o=n[r],s=0,a=o.length,u;s<a;++s)(u=o[s])&&e.call(u,u.__data__,s,o);return this}function Q_(e){return function(){this.removeAttribute(e)}}function e0(e){return function(){this.removeAttributeNS(e.space,e.local)}}function t0(e,n){return function(){this.setAttribute(e,n)}}function n0(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function r0(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function i0(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function o0(e,n){var r=xr(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?e0:Q_:typeof n=="function"?r.local?i0:r0:r.local?n0:t0)(r,n))}function eu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function s0(e){return function(){this.style.removeProperty(e)}}function a0(e,n,r){return function(){this.style.setProperty(e,n,r)}}function u0(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function c0(e,n,r){return arguments.length>1?this.each((n==null?s0:typeof n=="function"?u0:a0)(e,n,r??"")):Ut(this.node(),e)}function Ut(e,n){return e.style.getPropertyValue(n)||eu(e).getComputedStyle(e,null).getPropertyValue(n)}function l0(e){return function(){delete this[e]}}function f0(e,n){return function(){this[e]=n}}function h0(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function d0(e,n){return arguments.length>1?this.each((n==null?l0:typeof n=="function"?h0:f0)(e,n)):this.node()[e]}function tu(e){return e.trim().split(/^|\s+/)}function Xi(e){return e.classList||new nu(e)}function nu(e){this._node=e,this._names=tu(e.getAttribute("class")||"")}nu.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ru(e,n){for(var r=Xi(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function iu(e,n){for(var r=Xi(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function p0(e){return function(){ru(this,e)}}function g0(e){return function(){iu(this,e)}}function m0(e,n){return function(){(n.apply(this,arguments)?ru:iu)(this,e)}}function _0(e,n){var r=tu(e+"");if(arguments.length<2){for(var i=Xi(this.node()),o=-1,s=r.length;++o<s;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?m0:n?p0:g0)(r,n))}function y0(){this.textContent=""}function v0(e){return function(){this.textContent=e}}function b0(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function w0(e){return arguments.length?this.each(e==null?y0:(typeof e=="function"?b0:v0)(e)):this.node().textContent}function x0(){this.innerHTML=""}function k0(e){return function(){this.innerHTML=e}}function S0(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function z0(e){return arguments.length?this.each(e==null?x0:(typeof e=="function"?S0:k0)(e)):this.node().innerHTML}function T0(){this.nextSibling&&this.parentNode.appendChild(this)}function C0(){return this.each(T0)}function P0(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function E0(){return this.each(P0)}function A0(e){var n=typeof e=="function"?e:Ja(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function R0(){return null}function $0(e,n){var r=typeof e=="function"?e:Ja(e),i=n==null?R0:typeof n=="function"?n:Ji(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function I0(){var e=this.parentNode;e&&e.removeChild(this)}function M0(){return this.each(I0)}function O0(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function N0(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function D0(e){return this.select(e?N0:O0)}function j0(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Z0(e){return function(n){e.call(this,n,this.__data__)}}function q0(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function U0(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,s;r<o;++r)s=n[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):n[++i]=s;++i?n.length=i:delete this.__on}}}function L0(e,n,r){return function(){var i=this.__on,o,s=Z0(n);if(i){for(var a=0,u=i.length;a<u;++a)if((o=i[a]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=r),o.value=n;return}}this.addEventListener(e.type,s,r),o={type:e.type,name:e.name,value:n,listener:s,options:r},i?i.push(o):this.__on=[o]}}function F0(e,n,r){var i=q0(e+""),o,s=i.length,a;if(arguments.length<2){var u=this.node().__on;if(u){for(var c=0,l=u.length,h;c<l;++c)for(o=0,h=u[c];o<s;++o)if((a=i[o]).type===h.type&&a.name===h.name)return h.value}return}for(u=n?L0:U0,o=0;o<s;++o)this.each(u(i[o],n,r));return this}function ou(e,n,r){var i=eu(e),o=i.CustomEvent;typeof o=="function"?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function H0(e,n){return function(){return ou(this,e,n)}}function V0(e,n){return function(){return ou(this,e,n.apply(this,arguments))}}function B0(e,n){return this.each((typeof n=="function"?V0:H0)(e,n))}function*W0(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&(yield a)}var su=[null];function Ae(e,n){this._groups=e,this._parents=n}function Pn(){return new Ae([[document.documentElement]],su)}function G0(){return this}Ae.prototype=Pn.prototype={constructor:Ae,select:b_,selectAll:S_,selectChild:P_,selectChildren:$_,filter:I_,data:Z_,enter:M_,exit:U_,join:L_,merge:F_,selection:G0,order:H_,sort:V_,call:W_,nodes:G_,node:J_,size:X_,empty:K_,each:Y_,attr:o0,style:c0,property:d0,classed:_0,text:w0,html:z0,raise:C0,lower:E0,append:A0,insert:$0,remove:M0,clone:D0,datum:j0,on:F0,dispatch:B0,[Symbol.iterator]:W0};function De(e){return typeof e=="string"?new Ae([[document.querySelector(e)]],[document.documentElement]):new Ae([[e]],su)}function J0(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Ke(e,n){if(e=J0(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}const X0={passive:!1},dn={capture:!0,passive:!1};function $r(e){e.stopImmediatePropagation()}function Ot(e){e.preventDefault(),e.stopImmediatePropagation()}function au(e){var n=e.document.documentElement,r=De(e).on("dragstart.drag",Ot,dn);"onselectstart"in n?r.on("selectstart.drag",Ot,dn):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function uu(e,n){var r=e.document.documentElement,i=De(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ot,dn),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 Nn=e=>()=>e;function Gr(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:s,x:a,y:u,dx:c,dy:l,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:h}})}Gr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function K0(e){return!e.ctrlKey&&!e.button}function Y0(){return this.parentNode}function Q0(e,n){return n??{x:e.x,y:e.y}}function ey(){return navigator.maxTouchPoints||"ontouchstart"in this}function ty(){var e=K0,n=Y0,r=Q0,i=ey,o={},s=Cn("start","drag","end"),a=0,u,c,l,h,f=0;function d(b){b.on("mousedown.drag",p).filter(i).on("touchstart.drag",y).on("touchmove.drag",m,X0).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(b,v){if(!(h||!e.call(this,b,v))){var k=C(this,n.call(this,b,v),b,v,"mouse");k&&(De(b.view).on("mousemove.drag",g,dn).on("mouseup.drag",_,dn),au(b.view),$r(b),l=!1,u=b.clientX,c=b.clientY,k("start",b))}}function g(b){if(Ot(b),!l){var v=b.clientX-u,k=b.clientY-c;l=v*v+k*k>f}o.mouse("drag",b)}function _(b){De(b.view).on("mousemove.drag mouseup.drag",null),uu(b.view,l),Ot(b),o.mouse("end",b)}function y(b,v){if(e.call(this,b,v)){var k=b.changedTouches,x=n.call(this,b,v),P=k.length,M,$;for(M=0;M<P;++M)($=C(this,x,b,v,k[M].identifier,k[M]))&&($r(b),$("start",b,k[M]))}}function m(b){var v=b.changedTouches,k=v.length,x,P;for(x=0;x<k;++x)(P=o[v[x].identifier])&&(Ot(b),P("drag",b,v[x]))}function w(b){var v=b.changedTouches,k=v.length,x,P;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),x=0;x<k;++x)(P=o[v[x].identifier])&&($r(b),P("end",b,v[x]))}function C(b,v,k,x,P,M){var $=s.copy(),N=Ke(M||k,v),D,H,z;if((z=r.call(b,new Gr("beforestart",{sourceEvent:k,target:d,identifier:P,active:a,x:N[0],y:N[1],dx:0,dy:0,dispatch:$}),x))!=null)return D=z.x-N[0]||0,H=z.y-N[1]||0,function O(R,j,F){var q=N,V;switch(R){case"start":o[P]=O,V=a++;break;case"end":delete o[P],--a;case"drag":N=Ke(F||j,v),V=a;break}$.call(R,b,new Gr(R,{sourceEvent:j,subject:z,target:d,identifier:P,active:V,x:N[0]+D,y:N[1]+H,dx:N[0]-q[0],dy:N[1]-q[1],dispatch:$}),x)}}return d.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Nn(!!b),d):e},d.container=function(b){return arguments.length?(n=typeof b=="function"?b:Nn(b),d):n},d.subject=function(b){return arguments.length?(r=typeof b=="function"?b:Nn(b),d):r},d.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:Nn(!!b),d):i},d.on=function(){var b=s.on.apply(s,arguments);return b===s?d:b},d.clickDistance=function(b){return arguments.length?(f=(b=+b)*b,d):Math.sqrt(f)},d}function Ki(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function cu(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function En(){}var pn=.7,ir=1/pn,Nt="\\s*([+-]?\\d+)\\s*",gn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ny=/^#([0-9a-f]{3,8})$/,ry=new RegExp(`^rgb\\(${Nt},${Nt},${Nt}\\)$`),iy=new RegExp(`^rgb\\(${Qe},${Qe},${Qe}\\)$`),oy=new RegExp(`^rgba\\(${Nt},${Nt},${Nt},${gn}\\)$`),sy=new RegExp(`^rgba\\(${Qe},${Qe},${Qe},${gn}\\)$`),ay=new RegExp(`^hsl\\(${gn},${Qe},${Qe}\\)$`),uy=new RegExp(`^hsla\\(${gn},${Qe},${Qe},${gn}\\)$`),Vo={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};Ki(En,mn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Bo,formatHex:Bo,formatHex8:cy,formatHsl:ly,formatRgb:Wo,toString:Wo});function Bo(){return this.rgb().formatHex()}function cy(){return this.rgb().formatHex8()}function ly(){return lu(this).formatHsl()}function Wo(){return this.rgb().formatRgb()}function mn(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=ny.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Go(n):r===3?new Te(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?Dn(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?Dn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=ry.exec(e))?new Te(n[1],n[2],n[3],1):(n=iy.exec(e))?new Te(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=oy.exec(e))?Dn(n[1],n[2],n[3],n[4]):(n=sy.exec(e))?Dn(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=ay.exec(e))?Ko(n[1],n[2]/100,n[3]/100,1):(n=uy.exec(e))?Ko(n[1],n[2]/100,n[3]/100,n[4]):Vo.hasOwnProperty(e)?Go(Vo[e]):e==="transparent"?new Te(NaN,NaN,NaN,0):null}function Go(e){return new Te(e>>16&255,e>>8&255,e&255,1)}function Dn(e,n,r,i){return i<=0&&(e=n=r=NaN),new Te(e,n,r,i)}function fy(e){return e instanceof En||(e=mn(e)),e?(e=e.rgb(),new Te(e.r,e.g,e.b,e.opacity)):new Te}function Jr(e,n,r,i){return arguments.length===1?fy(e):new Te(e,n,r,i??1)}function Te(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}Ki(Te,Jr,cu(En,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pn:Math.pow(pn,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Te(zt(this.r),zt(this.g),zt(this.b),or(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:Jo,formatHex:Jo,formatHex8:hy,formatRgb:Xo,toString:Xo}));function Jo(){return`#${St(this.r)}${St(this.g)}${St(this.b)}`}function hy(){return`#${St(this.r)}${St(this.g)}${St(this.b)}${St((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xo(){const e=or(this.opacity);return`${e===1?"rgb(":"rgba("}${zt(this.r)}, ${zt(this.g)}, ${zt(this.b)}${e===1?")":`, ${e})`}`}function or(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function zt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function St(e){return e=zt(e),(e<16?"0":"")+e.toString(16)}function Ko(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Be(e,n,r,i)}function lu(e){if(e instanceof Be)return new Be(e.h,e.s,e.l,e.opacity);if(e instanceof En||(e=mn(e)),!e)return new Be;if(e instanceof Be)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(n,r,i),s=Math.max(n,r,i),a=NaN,u=s-o,c=(s+o)/2;return u?(n===s?a=(r-i)/u+(r<i)*6:r===s?a=(i-n)/u+2:a=(n-r)/u+4,u/=c<.5?s+o:2-s-o,a*=60):u=c>0&&c<1?0:a,new Be(a,u,c,e.opacity)}function dy(e,n,r,i){return arguments.length===1?lu(e):new Be(e,n,r,i??1)}function Be(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Ki(Be,dy,cu(En,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new Be(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pn:Math.pow(pn,e),new Be(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,o=2*r-i;return new Te(Ir(e>=240?e-240:e+120,o,i),Ir(e,o,i),Ir(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new Be(Yo(this.h),jn(this.s),jn(this.l),or(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=or(this.opacity);return`${e===1?"hsl(":"hsla("}${Yo(this.h)}, ${jn(this.s)*100}%, ${jn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Yo(e){return e=(e||0)%360,e<0?e+360:e}function jn(e){return Math.max(0,Math.min(1,e||0))}function Ir(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const fu=e=>()=>e;function py(e,n){return function(r){return e+r*n}}function gy(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function my(e){return(e=+e)==1?hu:function(n,r){return r-n?gy(n,r,e):fu(isNaN(n)?r:n)}}function hu(e,n){var r=n-e;return r?py(e,r):fu(isNaN(e)?n:e)}const Qo=(function e(n){var r=my(n);function i(o,s){var a=r((o=Jr(o)).r,(s=Jr(s)).r),u=r(o.g,s.g),c=r(o.b,s.b),l=hu(o.opacity,s.opacity);return function(h){return o.r=a(h),o.g=u(h),o.b=c(h),o.opacity=l(h),o+""}}return i.gamma=e,i})(1);function pt(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var Xr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mr=new RegExp(Xr.source,"g");function _y(e){return function(){return e}}function yy(e){return function(n){return e(n)+""}}function vy(e,n){var r=Xr.lastIndex=Mr.lastIndex=0,i,o,s,a=-1,u=[],c=[];for(e=e+"",n=n+"";(i=Xr.exec(e))&&(o=Mr.exec(n));)(s=o.index)>r&&(s=n.slice(r,s),u[a]?u[a]+=s:u[++a]=s),(i=i[0])===(o=o[0])?u[a]?u[a]+=o:u[++a]=o:(u[++a]=null,c.push({i:a,x:pt(i,o)})),r=Mr.lastIndex;return r<n.length&&(s=n.slice(r),u[a]?u[a]+=s:u[++a]=s),u.length<2?c[0]?yy(c[0].x):_y(n):(n=c.length,function(l){for(var h=0,f;h<n;++h)u[(f=c[h]).i]=f.x(l);return u.join("")})}var es=180/Math.PI,Kr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function du(e,n,r,i,o,s){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*r+n*i)&&(r-=e*c,i-=n*c),(u=Math.sqrt(r*r+i*i))&&(r/=u,i/=u,c/=u),e*i<n*r&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:s,rotate:Math.atan2(n,e)*es,skewX:Math.atan(c)*es,scaleX:a,scaleY:u}}var Zn;function by(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Kr:du(n.a,n.b,n.c,n.d,n.e,n.f)}function wy(e){return e==null||(Zn||(Zn=document.createElementNS("http://www.w3.org/2000/svg","g")),Zn.setAttribute("transform",e),!(e=Zn.transform.baseVal.consolidate()))?Kr:(e=e.matrix,du(e.a,e.b,e.c,e.d,e.e,e.f))}function pu(e,n,r,i){function o(l){return l.length?l.pop()+" ":""}function s(l,h,f,d,p,g){if(l!==f||h!==d){var _=p.push("translate(",null,n,null,r);g.push({i:_-4,x:pt(l,f)},{i:_-2,x:pt(h,d)})}else(f||d)&&p.push("translate("+f+n+d+r)}function a(l,h,f,d){l!==h?(l-h>180?h+=360:h-l>180&&(l+=360),d.push({i:f.push(o(f)+"rotate(",null,i)-2,x:pt(l,h)})):h&&f.push(o(f)+"rotate("+h+i)}function u(l,h,f,d){l!==h?d.push({i:f.push(o(f)+"skewX(",null,i)-2,x:pt(l,h)}):h&&f.push(o(f)+"skewX("+h+i)}function c(l,h,f,d,p,g){if(l!==f||h!==d){var _=p.push(o(p)+"scale(",null,",",null,")");g.push({i:_-4,x:pt(l,f)},{i:_-2,x:pt(h,d)})}else(f!==1||d!==1)&&p.push(o(p)+"scale("+f+","+d+")")}return function(l,h){var f=[],d=[];return l=e(l),h=e(h),s(l.translateX,l.translateY,h.translateX,h.translateY,f,d),a(l.rotate,h.rotate,f,d),u(l.skewX,h.skewX,f,d),c(l.scaleX,l.scaleY,h.scaleX,h.scaleY,f,d),l=h=null,function(p){for(var g=-1,_=d.length,y;++g<_;)f[(y=d[g]).i]=y.x(p);return f.join("")}}}var xy=pu(by,"px, ","px)","deg)"),ky=pu(wy,", ",")",")"),Sy=1e-12;function ts(e){return((e=Math.exp(e))+1/e)/2}function zy(e){return((e=Math.exp(e))-1/e)/2}function Ty(e){return((e=Math.exp(2*e))-1)/(e+1)}const Cy=(function e(n,r,i){function o(s,a){var u=s[0],c=s[1],l=s[2],h=a[0],f=a[1],d=a[2],p=h-u,g=f-c,_=p*p+g*g,y,m;if(_<Sy)m=Math.log(d/l)/n,y=function(x){return[u+x*p,c+x*g,l*Math.exp(n*x*m)]};else{var w=Math.sqrt(_),C=(d*d-l*l+i*_)/(2*l*r*w),b=(d*d-l*l-i*_)/(2*d*r*w),v=Math.log(Math.sqrt(C*C+1)-C),k=Math.log(Math.sqrt(b*b+1)-b);m=(k-v)/n,y=function(x){var P=x*m,M=ts(v),$=l/(r*w)*(M*Ty(n*P+v)-zy(v));return[u+$*p,c+$*g,l*M/ts(n*P+v)]}}return y.duration=m*1e3*n/Math.SQRT2,y}return o.rho=function(s){var a=Math.max(.001,+s),u=a*a,c=u*u;return e(a,u,c)},o})(Math.SQRT2,2,4);var Py=Cn("start","end","cancel","interrupt"),Ey=[],gu=0,ns=1,Yr=2,Vn=3,rs=4,Qr=5,Bn=6;function kr(e,n,r,i,o,s){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;Ay(e,r,{name:n,index:i,group:o,on:Py,tween:Ey,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:gu})}function Yi(e,n){var r=Je(e,n);if(r.state>gu)throw new Error("too late; already scheduled");return r}function tt(e,n){var r=Je(e,n);if(r.state>Vn)throw new Error("too late; already running");return r}function Je(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function Ay(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=Gi(s,0,r.time);function s(l){r.state=ns,r.timer.restart(a,r.delay,r.time),r.delay<=l&&a(l-r.delay)}function a(l){var h,f,d,p;if(r.state!==ns)return c();for(h in i)if(p=i[h],p.name===r.name){if(p.state===Vn)return qo(a);p.state===rs?(p.state=Bn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[h]):+h<n&&(p.state=Bn,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[h])}if(qo(function(){r.state===Vn&&(r.state=rs,r.timer.restart(u,r.delay,r.time),u(l))}),r.state=Yr,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Yr){for(r.state=Vn,o=new Array(d=r.tween.length),h=0,f=-1;h<d;++h)(p=r.tween[h].value.call(e,e.__data__,r.index,r.group))&&(o[++f]=p);o.length=f+1}}function u(l){for(var h=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(c),r.state=Qr,1),f=-1,d=o.length;++f<d;)o[f].call(e,h);r.state===Qr&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Bn,r.timer.stop(),delete i[n];for(var l in i)return;delete e.__transition}}function Wn(e,n){var r=e.__transition,i,o,s=!0,a;if(r){n=n==null?null:n+"";for(a in r){if((i=r[a]).name!==n){s=!1;continue}o=i.state>Yr&&i.state<Qr,i.state=Bn,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[a]}s&&delete e.__transition}}function Ry(e){return this.each(function(){Wn(this,e)})}function $y(e,n){var r,i;return function(){var o=tt(this,e),s=o.tween;if(s!==r){i=r=s;for(var a=0,u=i.length;a<u;++a)if(i[a].name===n){i=i.slice(),i.splice(a,1);break}}o.tween=i}}function Iy(e,n,r){var i,o;if(typeof r!="function")throw new Error;return function(){var s=tt(this,e),a=s.tween;if(a!==i){o=(i=a).slice();for(var u={name:n,value:r},c=0,l=o.length;c<l;++c)if(o[c].name===n){o[c]=u;break}c===l&&o.push(u)}s.tween=o}}function My(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=Je(this.node(),r).tween,o=0,s=i.length,a;o<s;++o)if((a=i[o]).name===e)return a.value;return null}return this.each((n==null?$y:Iy)(r,e,n))}function Qi(e,n,r){var i=e._id;return e.each(function(){var o=tt(this,i);(o.value||(o.value={}))[n]=r.apply(this,arguments)}),function(o){return Je(o,i).value[n]}}function mu(e,n){var r;return(typeof n=="number"?pt:n instanceof mn?Qo:(r=mn(n))?(n=r,Qo):vy)(e,n)}function Oy(e){return function(){this.removeAttribute(e)}}function Ny(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Dy(e,n,r){var i,o=r+"",s;return function(){var a=this.getAttribute(e);return a===o?null:a===i?s:s=n(i=a,r)}}function jy(e,n,r){var i,o=r+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===o?null:a===i?s:s=n(i=a,r)}}function Zy(e,n,r){var i,o,s;return function(){var a,u=r(this),c;return u==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=u+"",a===c?null:a===i&&c===o?s:(o=c,s=n(i=a,u)))}}function qy(e,n,r){var i,o,s;return function(){var a,u=r(this),c;return u==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=u+"",a===c?null:a===i&&c===o?s:(o=c,s=n(i=a,u)))}}function Uy(e,n){var r=xr(e),i=r==="transform"?ky:mu;return this.attrTween(e,typeof n=="function"?(r.local?qy:Zy)(r,i,Qi(this,"attr."+e,n)):n==null?(r.local?Ny:Oy)(r):(r.local?jy:Dy)(r,i,n))}function Ly(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function Fy(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function Hy(e,n){var r,i;function o(){var s=n.apply(this,arguments);return s!==i&&(r=(i=s)&&Fy(e,s)),r}return o._value=n,o}function Vy(e,n){var r,i;function o(){var s=n.apply(this,arguments);return s!==i&&(r=(i=s)&&Ly(e,s)),r}return o._value=n,o}function By(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=xr(e);return this.tween(r,(i.local?Hy:Vy)(i,n))}function Wy(e,n){return function(){Yi(this,e).delay=+n.apply(this,arguments)}}function Gy(e,n){return n=+n,function(){Yi(this,e).delay=n}}function Jy(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Wy:Gy)(n,e)):Je(this.node(),n).delay}function Xy(e,n){return function(){tt(this,e).duration=+n.apply(this,arguments)}}function Ky(e,n){return n=+n,function(){tt(this,e).duration=n}}function Yy(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Xy:Ky)(n,e)):Je(this.node(),n).duration}function Qy(e,n){if(typeof n!="function")throw new Error;return function(){tt(this,e).ease=n}}function ev(e){var n=this._id;return arguments.length?this.each(Qy(n,e)):Je(this.node(),n).ease}function tv(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;tt(this,e).ease=r}}function nv(e){if(typeof e!="function")throw new Error;return this.each(tv(this._id,e))}function rv(e){typeof e!="function"&&(e=Ka(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var s=n[o],a=s.length,u=i[o]=[],c,l=0;l<a;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&u.push(c);return new lt(i,this._parents,this._name,this._id)}function iv(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),u=0;u<s;++u)for(var c=n[u],l=r[u],h=c.length,f=a[u]=new Array(h),d,p=0;p<h;++p)(d=c[p]||l[p])&&(f[p]=d);for(;u<i;++u)a[u]=n[u];return new lt(a,this._parents,this._name,this._id)}function ov(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function sv(e,n,r){var i,o,s=ov(n)?Yi:tt;return function(){var a=s(this,e),u=a.on;u!==i&&(o=(i=u).copy()).on(n,r),a.on=o}}function av(e,n){var r=this._id;return arguments.length<2?Je(this.node(),r).on.on(e):this.each(sv(r,e,n))}function uv(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function cv(){return this.on("end.remove",uv(this._id))}function lv(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Ji(e));for(var i=this._groups,o=i.length,s=new Array(o),a=0;a<o;++a)for(var u=i[a],c=u.length,l=s[a]=new Array(c),h,f,d=0;d<c;++d)(h=u[d])&&(f=e.call(h,h.__data__,d,u))&&("__data__"in h&&(f.__data__=h.__data__),l[d]=f,kr(l[d],n,r,d,l,Je(h,r)));return new lt(s,this._parents,n,r)}function fv(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Xa(e));for(var i=this._groups,o=i.length,s=[],a=[],u=0;u<o;++u)for(var c=i[u],l=c.length,h,f=0;f<l;++f)if(h=c[f]){for(var d=e.call(h,h.__data__,f,c),p,g=Je(h,r),_=0,y=d.length;_<y;++_)(p=d[_])&&kr(p,n,r,_,d,g);s.push(d),a.push(h)}return new lt(s,a,n,r)}var hv=Pn.prototype.constructor;function dv(){return new hv(this._groups,this._parents)}function pv(e,n){var r,i,o;return function(){var s=Ut(this,e),a=(this.style.removeProperty(e),Ut(this,e));return s===a?null:s===r&&a===i?o:o=n(r=s,i=a)}}function _u(e){return function(){this.style.removeProperty(e)}}function gv(e,n,r){var i,o=r+"",s;return function(){var a=Ut(this,e);return a===o?null:a===i?s:s=n(i=a,r)}}function mv(e,n,r){var i,o,s;return function(){var a=Ut(this,e),u=r(this),c=u+"";return u==null&&(c=u=(this.style.removeProperty(e),Ut(this,e))),a===c?null:a===i&&c===o?s:(o=c,s=n(i=a,u))}}function _v(e,n){var r,i,o,s="style."+n,a="end."+s,u;return function(){var c=tt(this,e),l=c.on,h=c.value[s]==null?u||(u=_u(n)):void 0;(l!==r||o!==h)&&(i=(r=l).copy()).on(a,o=h),c.on=i}}function yv(e,n,r){var i=(e+="")=="transform"?xy:mu;return n==null?this.styleTween(e,pv(e,i)).on("end.style."+e,_u(e)):typeof n=="function"?this.styleTween(e,mv(e,i,Qi(this,"style."+e,n))).each(_v(this._id,e)):this.styleTween(e,gv(e,i,n),r).on("end.style."+e,null)}function vv(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function bv(e,n,r){var i,o;function s(){var a=n.apply(this,arguments);return a!==o&&(i=(o=a)&&vv(e,a,r)),i}return s._value=n,s}function wv(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,bv(e,n,r??""))}function xv(e){return function(){this.textContent=e}}function kv(e){return function(){var n=e(this);this.textContent=n??""}}function Sv(e){return this.tween("text",typeof e=="function"?kv(Qi(this,"text",e)):xv(e==null?"":e+""))}function zv(e){return function(n){this.textContent=e.call(this,n)}}function Tv(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&zv(o)),n}return i._value=e,i}function Cv(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,Tv(e))}function Pv(){for(var e=this._name,n=this._id,r=yu(),i=this._groups,o=i.length,s=0;s<o;++s)for(var a=i[s],u=a.length,c,l=0;l<u;++l)if(c=a[l]){var h=Je(c,n);kr(c,e,r,l,a,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new lt(i,this._parents,e,r)}function Ev(){var e,n,r=this,i=r._id,o=r.size();return new Promise(function(s,a){var u={value:a},c={value:function(){--o===0&&s()}};r.each(function(){var l=tt(this,i),h=l.on;h!==e&&(n=(e=h).copy(),n._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),l.on=n}),o===0&&s()})}var Av=0;function lt(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function yu(){return++Av}var it=Pn.prototype;lt.prototype={constructor:lt,select:lv,selectAll:fv,selectChild:it.selectChild,selectChildren:it.selectChildren,filter:rv,merge:iv,selection:dv,transition:Pv,call:it.call,nodes:it.nodes,node:it.node,size:it.size,empty:it.empty,each:it.each,on:av,attr:Uy,attrTween:By,style:yv,styleTween:wv,text:Sv,textTween:Cv,remove:cv,tween:My,delay:Jy,duration:Yy,ease:ev,easeVarying:nv,end:Ev,[Symbol.iterator]:it[Symbol.iterator]};function Rv(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var $v={time:null,delay:0,duration:250,ease:Rv};function Iv(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function Mv(e){var n,r;e instanceof lt?(n=e._id,e=e._name):(n=yu(),(r=$v).time=Wi(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,s=0;s<o;++s)for(var a=i[s],u=a.length,c,l=0;l<u;++l)(c=a[l])&&kr(c,e,n,l,a,r||Iv(c,n));return new lt(i,this._parents,e,n)}Pn.prototype.interrupt=Ry;Pn.prototype.transition=Mv;const qn=e=>()=>e;function Ov(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function ut(e,n,r){this.k=e,this.x=n,this.y=r}ut.prototype={constructor:ut,scale:function(e){return e===1?this:new ut(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new ut(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var eo=new ut(1,0,0);Xe.prototype=ut.prototype;function Xe(e){for(;!e.__zoom;)if(!(e=e.parentNode))return eo;return e.__zoom}function Or(e){e.stopImmediatePropagation()}function Bt(e){e.preventDefault(),e.stopImmediatePropagation()}function Nv(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Dv(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,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]]):[[0,0],[e.clientWidth,e.clientHeight]]}function is(){return this.__zoom||eo}function jv(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Zv(){return navigator.maxTouchPoints||"ontouchstart"in this}function qv(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],s=e.invertY(n[0][1])-r[0][1],a=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Uv(){var e=Nv,n=Dv,r=qv,i=jv,o=Zv,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],u=250,c=Cy,l=Cn("start","zoom","end"),h,f,d,p=500,g=150,_=0,y=10;function m(z){z.property("__zoom",is).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",$).filter(o).on("touchstart.zoom",N).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(z,O,R,j){var F=z.selection?z.selection():z;F.property("__zoom",is),z!==F?v(z,O,R,j):F.interrupt().each(function(){k(this,arguments).event(j).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},m.scaleBy=function(z,O,R,j){m.scaleTo(z,function(){var F=this.__zoom.k,q=typeof O=="function"?O.apply(this,arguments):O;return F*q},R,j)},m.scaleTo=function(z,O,R,j){m.transform(z,function(){var F=n.apply(this,arguments),q=this.__zoom,V=R==null?b(F):typeof R=="function"?R.apply(this,arguments):R,L=q.invert(V),W=typeof O=="function"?O.apply(this,arguments):O;return r(C(w(q,W),V,L),F,a)},R,j)},m.translateBy=function(z,O,R,j){m.transform(z,function(){return r(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof R=="function"?R.apply(this,arguments):R),n.apply(this,arguments),a)},null,j)},m.translateTo=function(z,O,R,j,F){m.transform(z,function(){var q=n.apply(this,arguments),V=this.__zoom,L=j==null?b(q):typeof j=="function"?j.apply(this,arguments):j;return r(eo.translate(L[0],L[1]).scale(V.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof R=="function"?-R.apply(this,arguments):-R),q,a)},j,F)};function w(z,O){return O=Math.max(s[0],Math.min(s[1],O)),O===z.k?z:new ut(O,z.x,z.y)}function C(z,O,R){var j=O[0]-R[0]*z.k,F=O[1]-R[1]*z.k;return j===z.x&&F===z.y?z:new ut(z.k,j,F)}function b(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function v(z,O,R,j){z.on("start.zoom",function(){k(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(j).end()}).tween("zoom",function(){var F=this,q=arguments,V=k(F,q).event(j),L=n.apply(F,q),W=R==null?b(L):typeof R=="function"?R.apply(F,q):R,ee=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),K=F.__zoom,he=typeof O=="function"?O.apply(F,q):O,nt=c(K.invert(W).concat(ee/K.k),he.invert(W).concat(ee/he.k));return function(Fe){if(Fe===1)Fe=he;else{var rt=nt(Fe),Cr=ee/rt[2];Fe=new ut(Cr,W[0]-rt[0]*Cr,W[1]-rt[1]*Cr)}V.zoom(null,Fe)}})}function k(z,O,R){return!R&&z.__zooming||new x(z,O)}function x(z,O){this.that=z,this.args=O,this.active=0,this.sourceEvent=null,this.extent=n.apply(z,O),this.taps=0}x.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,O){return this.mouse&&z!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var O=De(this.that).datum();l.call(z,this.that,new Ov(z,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),O)}};function P(z,...O){if(!e.apply(this,arguments))return;var R=k(this,O).event(z),j=this.__zoom,F=Math.max(s[0],Math.min(s[1],j.k*Math.pow(2,i.apply(this,arguments)))),q=Ke(z);if(R.wheel)(R.mouse[0][0]!==q[0]||R.mouse[0][1]!==q[1])&&(R.mouse[1]=j.invert(R.mouse[0]=q)),clearTimeout(R.wheel);else{if(j.k===F)return;R.mouse=[q,j.invert(q)],Wn(this),R.start()}Bt(z),R.wheel=setTimeout(V,g),R.zoom("mouse",r(C(w(j,F),R.mouse[0],R.mouse[1]),R.extent,a));function V(){R.wheel=null,R.end()}}function M(z,...O){if(d||!e.apply(this,arguments))return;var R=z.currentTarget,j=k(this,O,!0).event(z),F=De(z.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",ee,!0),q=Ke(z,R),V=z.clientX,L=z.clientY;au(z.view),Or(z),j.mouse=[q,this.__zoom.invert(q)],Wn(this),j.start();function W(K){if(Bt(K),!j.moved){var he=K.clientX-V,nt=K.clientY-L;j.moved=he*he+nt*nt>_}j.event(K).zoom("mouse",r(C(j.that.__zoom,j.mouse[0]=Ke(K,R),j.mouse[1]),j.extent,a))}function ee(K){F.on("mousemove.zoom mouseup.zoom",null),uu(K.view,j.moved),Bt(K),j.event(K).end()}}function $(z,...O){if(e.apply(this,arguments)){var R=this.__zoom,j=Ke(z.changedTouches?z.changedTouches[0]:z,this),F=R.invert(j),q=R.k*(z.shiftKey?.5:2),V=r(C(w(R,q),j,F),n.apply(this,O),a);Bt(z),u>0?De(this).transition().duration(u).call(v,V,j,z):De(this).call(m.transform,V,j,z)}}function N(z,...O){if(e.apply(this,arguments)){var R=z.touches,j=R.length,F=k(this,O,z.changedTouches.length===j).event(z),q,V,L,W;for(Or(z),V=0;V<j;++V)L=R[V],W=Ke(L,this),W=[W,this.__zoom.invert(W),L.identifier],F.touch0?!F.touch1&&F.touch0[2]!==W[2]&&(F.touch1=W,F.taps=0):(F.touch0=W,q=!0,F.taps=1+!!h);h&&(h=clearTimeout(h)),q&&(F.taps<2&&(f=W[0],h=setTimeout(function(){h=null},p)),Wn(this),F.start())}}function D(z,...O){if(this.__zooming){var R=k(this,O).event(z),j=z.changedTouches,F=j.length,q,V,L,W;for(Bt(z),q=0;q<F;++q)V=j[q],L=Ke(V,this),R.touch0&&R.touch0[2]===V.identifier?R.touch0[0]=L:R.touch1&&R.touch1[2]===V.identifier&&(R.touch1[0]=L);if(V=R.that.__zoom,R.touch1){var ee=R.touch0[0],K=R.touch0[1],he=R.touch1[0],nt=R.touch1[1],Fe=(Fe=he[0]-ee[0])*Fe+(Fe=he[1]-ee[1])*Fe,rt=(rt=nt[0]-K[0])*rt+(rt=nt[1]-K[1])*rt;V=w(V,Math.sqrt(Fe/rt)),L=[(ee[0]+he[0])/2,(ee[1]+he[1])/2],W=[(K[0]+nt[0])/2,(K[1]+nt[1])/2]}else if(R.touch0)L=R.touch0[0],W=R.touch0[1];else return;R.zoom("touch",r(C(V,L,W),R.extent,a))}}function H(z,...O){if(this.__zooming){var R=k(this,O).event(z),j=z.changedTouches,F=j.length,q,V;for(Or(z),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),q=0;q<F;++q)V=j[q],R.touch0&&R.touch0[2]===V.identifier?delete R.touch0:R.touch1&&R.touch1[2]===V.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(V=Ke(V,this),Math.hypot(f[0]-V[0],f[1]-V[1])<y)){var L=De(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return m.wheelDelta=function(z){return arguments.length?(i=typeof z=="function"?z:qn(+z),m):i},m.filter=function(z){return arguments.length?(e=typeof z=="function"?z:qn(!!z),m):e},m.touchable=function(z){return arguments.length?(o=typeof z=="function"?z:qn(!!z),m):o},m.extent=function(z){return arguments.length?(n=typeof z=="function"?z:qn([[+z[0][0],+z[0][1]],[+z[1][0],+z[1][1]]]),m):n},m.scaleExtent=function(z){return arguments.length?(s[0]=+z[0],s[1]=+z[1],m):[s[0],s[1]]},m.translateExtent=function(z){return arguments.length?(a[0][0]=+z[0][0],a[1][0]=+z[1][0],a[0][1]=+z[0][1],a[1][1]=+z[1][1],m):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},m.constrain=function(z){return arguments.length?(r=z,m):r},m.duration=function(z){return arguments.length?(u=+z,m):u},m.interpolate=function(z){return arguments.length?(c=z,m):c},m.on=function(){var z=l.on.apply(l,arguments);return z===l?m:z},m.clickDistance=function(z){return arguments.length?(_=(z=+z)*z,m):Math.sqrt(_)},m.tapDistance=function(z){return arguments.length?(y=+z,m):y},m}class os extends Map{constructor(n,r=Hv){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),n!=null)for(const[i,o]of n)this.set(i,o)}get(n){return super.get(ss(this,n))}has(n){return super.has(ss(this,n))}set(n,r){return super.set(Lv(this,n),r)}delete(n){return super.delete(Fv(this,n))}}function ss({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):r}function Lv({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):(e.set(i,r),r)}function Fv({_intern:e,_key:n},r){const i=n(r);return e.has(i)&&(r=e.get(i),e.delete(i)),r}function Hv(e){return e!==null&&typeof e=="object"?e.valueOf():e}function as(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r<i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let o of e)(o=n(o,++i,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}return r}function us(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r>i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let o of e)(o=n(o,++i,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}return r}function Vv(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var Bv=typeof global=="object"&&global&&global.Object===Object&&global,Wv=typeof self=="object"&&self&&self.Object===Object&&self,vu=Bv||Wv||Function("return this")(),sr=vu.Symbol,bu=Object.prototype,Gv=bu.hasOwnProperty,Jv=bu.toString,Wt=sr?sr.toStringTag:void 0;function Xv(e){var n=Gv.call(e,Wt),r=e[Wt];try{e[Wt]=void 0;var i=!0}catch{}var o=Jv.call(e);return i&&(n?e[Wt]=r:delete e[Wt]),o}var Kv=Object.prototype,Yv=Kv.toString;function Qv(e){return Yv.call(e)}var eb="[object Null]",tb="[object Undefined]",cs=sr?sr.toStringTag:void 0;function nb(e){return e==null?e===void 0?tb:eb:cs&&cs in Object(e)?Xv(e):Qv(e)}function rb(e){return e!=null&&typeof e=="object"}var ib="[object Symbol]";function ob(e){return typeof e=="symbol"||rb(e)&&nb(e)==ib}var sb=/\s/;function ab(e){for(var n=e.length;n--&&sb.test(e.charAt(n)););return n}var ub=/^\s+/;function cb(e){return e&&e.slice(0,ab(e)+1).replace(ub,"")}function ar(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var ls=NaN,lb=/^[-+]0x[0-9a-f]+$/i,fb=/^0b[01]+$/i,hb=/^0o[0-7]+$/i,db=parseInt;function fs(e){if(typeof e=="number")return e;if(ob(e))return ls;if(ar(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=ar(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=cb(e);var r=fb.test(e);return r||hb.test(e)?db(e.slice(2),r?2:8):lb.test(e)?ls:+e}var Nr=function(){return vu.Date.now()},pb="Expected a function",gb=Math.max,mb=Math.min;function wu(e,n,r){var i,o,s,a,u,c,l=0,h=!1,f=!1,d=!0;if(typeof e!="function")throw new TypeError(pb);n=fs(n)||0,ar(r)&&(h=!!r.leading,f="maxWait"in r,s=f?gb(fs(r.maxWait)||0,n):s,d="trailing"in r?!!r.trailing:d);function p(k){var x=i,P=o;return i=o=void 0,l=k,a=e.apply(P,x),a}function g(k){return l=k,u=setTimeout(m,n),h?p(k):a}function _(k){var x=k-c,P=k-l,M=n-x;return f?mb(M,s-P):M}function y(k){var x=k-c,P=k-l;return c===void 0||x>=n||x<0||f&&P>=s}function m(){var k=Nr();if(y(k))return w(k);u=setTimeout(m,_(k))}function w(k){return u=void 0,d&&i?p(k):(i=o=void 0,a)}function C(){u!==void 0&&clearTimeout(u),l=0,i=c=o=u=void 0}function b(){return u===void 0?a:w(Nr())}function v(){var k=Nr(),x=y(k);if(i=arguments,o=this,c=k,x){if(u===void 0)return g(c);if(f)return clearTimeout(u),u=setTimeout(m,n),p(c)}return u===void 0&&(u=setTimeout(m,n)),a}return v.cancel=C,v.flush=b,v}var _b="Expected a function";function yb(e,n,r){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(_b);return ar(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),wu(e,n,{leading:i,maxWait:n,trailing:o})}var Tt=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Tt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Tt.Bounce.In(e*2)*.5:Tt.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),nn=function(){return performance.now()},xu=(function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(n){this._tweens[n.getId()]=n,this._tweensAddedDuringUpdate[n.getId()]=n},e.prototype.remove=function(n){delete this._tweens[n.getId()],delete this._tweensAddedDuringUpdate[n.getId()]},e.prototype.update=function(n,r){n===void 0&&(n=nn()),r===void 0&&(r=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<i.length;o++){var s=this._tweens[i[o]],a=!r;s&&s.update(n,a)===!1&&!r&&delete this._tweens[i[o]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},e})(),ei={Linear:function(e,n){var r=e.length-1,i=r*n,o=Math.floor(i),s=ei.Utils.Linear;return n<0?s(e[0],e[1],i):n>1?s(e[r],e[r-1],r-i):s(e[o],e[o+1>r?r:o+1],i-o)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},ku=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),ti=new xu,hs=(function(){function e(n,r){r===void 0&&(r=ti),this._object=n,this._group=r,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Tt.Linear.None,this._interpolationFunction=ei.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ku.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=nn()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var s in this._valuesEnd)o[s]=this._valuesEnd[s];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,i,o,s){for(var a in i){var u=n[a],c=Array.isArray(u),l=c?"array":typeof u,h=!c&&Array.isArray(i[a]);if(!(l==="undefined"||l==="function")){if(h){var f=i[a];if(f.length===0)continue;for(var d=[u],p=0,g=f.length;p<g;p+=1){var _=this._handleRelativeValue(u,f[p]);if(isNaN(_)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(_)}h&&(i[a]=d)}if((l==="object"||c)&&u&&!h){r[a]=c?[]:{};var y=u;for(var m in y)r[a][m]=y[m];o[a]=c?[]:{};var f=i[a];if(!this._isDynamic){var w={};for(var m in f)w[m]=f[m];i[a]=f=w}this._setupProperties(y,r[a],f,o[a],s)}else(typeof r[a]>"u"||s)&&(r[a]=u),c||(r[a]*=1),h?o[a]=i[a].slice().reverse():o[a]=r[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(n){return n===void 0&&(n=nn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this._group&&this._group.remove(this),this)},e.prototype.resume=function(n){return n===void 0&&(n=nn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;n<r;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n===void 0&&(n=ti),this._group=n,this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Tt.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=ei.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,r){var i=this,o;if(n===void 0&&(n=nn()),r===void 0&&(r=!0),this._isPaused)return!0;var s,a=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(n>a)return!1;r&&this.start(n,!0)}if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var u=n-this._startTime,c=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),l=this._duration+this._repeat*c,h=function(){if(i._duration===0||u>l)return 1;var y=Math.trunc(u/c),m=u-y*c,w=Math.min(m/i._duration,1);return w===0&&u===i._duration?1:w},f=h(),d=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||u>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((u-this._duration)/c)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=c*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var g=0,_=this._chainedTweens.length;g<_;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,r,i,o){for(var s in i)if(r[s]!==void 0){var a=r[s]||0,u=i[s],c=Array.isArray(n[s]),l=Array.isArray(u),h=!c&&l;h?n[s]=this._interpolationFunction(u,o):typeof u=="object"&&u?this._updateProperties(n[s],a,u,o):(u=this._handleRelativeValue(a,u),typeof u=="number"&&(n[s]=a+(u-a)*o))}},e.prototype._handleRelativeValue=function(n,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?n+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(n){var r=this._valuesStartRepeat[n],i=this._valuesEnd[n];typeof i=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(i):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=r},e})();ku.nextId;var et=ti;et.getAll.bind(et);et.removeAll.bind(et);et.add.bind(et);et.remove.bind(et);et.update.bind(et);function ds(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function vb(e){if(Array.isArray(e))return e}function bb(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function wb(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function xb(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,s,a,u=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(i=s.call(r)).done)&&(u.push(i.value),u.length!==n);c=!0);}catch(h){l=!0,o=h}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}function kb(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
85
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sb(e,n){return vb(e)||xb(e,n)||zb(e,n)||kb()}function zb(e,n){if(e){if(typeof e=="string")return ds(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ds(e,n):void 0}}var Tb=wb(function e(n,r){var i=r.default,o=i===void 0?null:i,s=r.triggerUpdate,a=s===void 0?!0:s,u=r.onChange,c=u===void 0?function(l,h){}:u;bb(this,e),this.name=n,this.defaultVal=o,this.triggerUpdate=a,this.onChange=c});function to(e){var n=e.stateInit,r=n===void 0?function(){return{}}:n,i=e.props,o=i===void 0?{}:i,s=e.methods,a=s===void 0?{}:s,u=e.aliases,c=u===void 0?{}:u,l=e.init,h=l===void 0?function(){}:l,f=e.update,d=f===void 0?function(){}:f,p=Object.keys(o).map(function(g){return new Tb(g,o[g])});return function g(){for(var _=arguments.length,y=new Array(_),m=0;m<_;m++)y[m]=arguments[m];var w=!!(this instanceof g&&this.constructor),C=w?y.shift():void 0,b=y[0],v=b===void 0?{}:b,k=Object.assign({},r instanceof Function?r(v):r,{initialised:!1}),x={};function P(N){return M(N,v),$(),P}var M=function(D,H){h.call(P,D,k,H),k.initialised=!0},$=wu(function(){k.initialised&&(d.call(P,k,x),x={})},1);return p.forEach(function(N){P[N.name]=D(N);function D(H){var z=H.name,O=H.triggerUpdate,R=O===void 0?!1:O,j=H.onChange,F=j===void 0?function(L,W){}:j,q=H.defaultVal,V=q===void 0?null:q;return function(L){var W=k[z];if(!arguments.length)return W;var ee=L===void 0?V:L;return k[z]=ee,F.call(P,ee,k,W),!x.hasOwnProperty(z)&&(x[z]=W),R&&$(),P}}}),Object.keys(a).forEach(function(N){P[N]=function(){for(var D,H=arguments.length,z=new Array(H),O=0;O<H;O++)z[O]=arguments[O];return(D=a[N]).call.apply(D,[P,k].concat(z))}}),Object.entries(c).forEach(function(N){var D=Sb(N,2),H=D[0],z=D[1];return P[H]=P[z]}),P.resetProps=function(){return p.forEach(function(N){P[N.name](N.defaultVal)}),P},P.resetProps(),k._rerender=$,w&&C&&P(C),P}}var Y=(function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}});function ur(e){"@babel/helpers - typeof";return ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ur(e)}var Cb=/^\s+/,Pb=/\s+$/;function U(e,n){if(e=e||"",n=n||{},e instanceof U)return e;if(!(this instanceof U))return new U(e,n);var r=Eb(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||r.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}U.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),r,i,o,s,a,u;return r=n.r/255,i=n.g/255,o=n.b/255,r<=.03928?s=r/12.92:s=Math.pow((r+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),o<=.03928?u=o/12.92:u=Math.pow((o+.055)/1.055,2.4),.2126*s+.7152*a+.0722*u},setAlpha:function(n){return this._a=Su(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=gs(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=gs(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),o=Math.round(n.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+o+"%)":"hsva("+r+", "+i+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var n=ps(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=ps(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),o=Math.round(n.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+o+"%)":"hsla("+r+", "+i+"%, "+o+"%, "+this._roundA+")"},toHex:function(n){return ms(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return Ib(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(ce(this._r,255)*100)+"%",g:Math.round(ce(this._g,255)*100)+"%",b:Math.round(ce(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(ce(this._r,255)*100)+"%, "+Math.round(ce(this._g,255)*100)+"%, "+Math.round(ce(this._b,255)*100)+"%)":"rgba("+Math.round(ce(this._r,255)*100)+"%, "+Math.round(ce(this._g,255)*100)+"%, "+Math.round(ce(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Vb[ms(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+_s(this._r,this._g,this._b,this._a),i=r,o=this._gradientType?"GradientType = 1, ":"";if(n){var s=U(n);i="#"+_s(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+r+",endColorstr="+i+")"},toString:function(n){var r=!!n;n=n||this._format;var i=!1,o=this._a<1&&this._a>=0,s=!r&&o&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return s?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(i=this.toRgbString()),n==="prgb"&&(i=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(i=this.toHexString()),n==="hex3"&&(i=this.toHexString(!0)),n==="hex4"&&(i=this.toHex8String(!0)),n==="hex8"&&(i=this.toHex8String()),n==="name"&&(i=this.toName()),n==="hsl"&&(i=this.toHslString()),n==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return U(this.toString())},_applyModification:function(n,r){var i=n.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(Db,arguments)},brighten:function(){return this._applyModification(jb,arguments)},darken:function(){return this._applyModification(Zb,arguments)},desaturate:function(){return this._applyModification(Mb,arguments)},saturate:function(){return this._applyModification(Ob,arguments)},greyscale:function(){return this._applyModification(Nb,arguments)},spin:function(){return this._applyModification(qb,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(Fb,arguments)},complement:function(){return this._applyCombination(Ub,arguments)},monochromatic:function(){return this._applyCombination(Hb,arguments)},splitcomplement:function(){return this._applyCombination(Lb,arguments)},triad:function(){return this._applyCombination(ys,[3])},tetrad:function(){return this._applyCombination(ys,[4])}};U.fromRatio=function(e,n){if(ur(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=rn(e[i]));e=r}return U(e,n)};function Eb(e){var n={r:0,g:0,b:0},r=1,i=null,o=null,s=null,a=!1,u=!1;return typeof e=="string"&&(e=Jb(e)),ur(e)=="object"&&(ot(e.r)&&ot(e.g)&&ot(e.b)?(n=Ab(e.r,e.g,e.b),a=!0,u=String(e.r).substr(-1)==="%"?"prgb":"rgb"):ot(e.h)&&ot(e.s)&&ot(e.v)?(i=rn(e.s),o=rn(e.v),n=$b(e.h,i,o),a=!0,u="hsv"):ot(e.h)&&ot(e.s)&&ot(e.l)&&(i=rn(e.s),s=rn(e.l),n=Rb(e.h,i,s),a=!0,u="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=Su(r),{ok:a,format:e.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function Ab(e,n,r){return{r:ce(e,255)*255,g:ce(n,255)*255,b:ce(r,255)*255}}function ps(e,n,r){e=ce(e,255),n=ce(n,255),r=ce(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),s,a,u=(i+o)/2;if(i==o)s=a=0;else{var c=i-o;switch(a=u>.5?c/(2-i-o):c/(i+o),i){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;case r:s=(e-n)/c+4;break}s/=6}return{h:s,s:a,l:u}}function Rb(e,n,r){var i,o,s;e=ce(e,360),n=ce(n,100),r=ce(r,100);function a(l,h,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?l+(h-l)*6*f:f<1/2?h:f<2/3?l+(h-l)*(2/3-f)*6:l}if(n===0)i=o=s=r;else{var u=r<.5?r*(1+n):r+n-r*n,c=2*r-u;i=a(c,u,e+1/3),o=a(c,u,e),s=a(c,u,e-1/3)}return{r:i*255,g:o*255,b:s*255}}function gs(e,n,r){e=ce(e,255),n=ce(n,255),r=ce(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),s,a,u=i,c=i-o;if(a=i===0?0:c/i,i==o)s=0;else{switch(i){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;case r:s=(e-n)/c+4;break}s/=6}return{h:s,s:a,v:u}}function $b(e,n,r){e=ce(e,360)*6,n=ce(n,100),r=ce(r,100);var i=Math.floor(e),o=e-i,s=r*(1-n),a=r*(1-o*n),u=r*(1-(1-o)*n),c=i%6,l=[r,a,s,s,u,r][c],h=[u,r,r,a,s,s][c],f=[s,s,u,r,r,a][c];return{r:l*255,g:h*255,b:f*255}}function ms(e,n,r,i){var o=[Ge(Math.round(e).toString(16)),Ge(Math.round(n).toString(16)),Ge(Math.round(r).toString(16))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function Ib(e,n,r,i,o){var s=[Ge(Math.round(e).toString(16)),Ge(Math.round(n).toString(16)),Ge(Math.round(r).toString(16)),Ge(zu(i))];return o&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function _s(e,n,r,i){var o=[Ge(zu(i)),Ge(Math.round(e).toString(16)),Ge(Math.round(n).toString(16)),Ge(Math.round(r).toString(16))];return o.join("")}U.equals=function(e,n){return!e||!n?!1:U(e).toRgbString()==U(n).toRgbString()};U.random=function(){return U.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Mb(e,n){n=n===0?0:n||10;var r=U(e).toHsl();return r.s-=n/100,r.s=Sr(r.s),U(r)}function Ob(e,n){n=n===0?0:n||10;var r=U(e).toHsl();return r.s+=n/100,r.s=Sr(r.s),U(r)}function Nb(e){return U(e).desaturate(100)}function Db(e,n){n=n===0?0:n||10;var r=U(e).toHsl();return r.l+=n/100,r.l=Sr(r.l),U(r)}function jb(e,n){n=n===0?0:n||10;var r=U(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(n/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(n/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(n/100)))),U(r)}function Zb(e,n){n=n===0?0:n||10;var r=U(e).toHsl();return r.l-=n/100,r.l=Sr(r.l),U(r)}function qb(e,n){var r=U(e).toHsl(),i=(r.h+n)%360;return r.h=i<0?360+i:i,U(r)}function Ub(e){var n=U(e).toHsl();return n.h=(n.h+180)%360,U(n)}function ys(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=U(e).toHsl(),i=[U(e)],o=360/n,s=1;s<n;s++)i.push(U({h:(r.h+s*o)%360,s:r.s,l:r.l}));return i}function Lb(e){var n=U(e).toHsl(),r=n.h;return[U(e),U({h:(r+72)%360,s:n.s,l:n.l}),U({h:(r+216)%360,s:n.s,l:n.l})]}function Fb(e,n,r){n=n||6,r=r||30;var i=U(e).toHsl(),o=360/r,s=[U(e)];for(i.h=(i.h-(o*n>>1)+720)%360;--n;)i.h=(i.h+o)%360,s.push(U(i));return s}function Hb(e,n){n=n||6;for(var r=U(e).toHsv(),i=r.h,o=r.s,s=r.v,a=[],u=1/n;n--;)a.push(U({h:i,s:o,v:s})),s=(s+u)%1;return a}U.mix=function(e,n,r){r=r===0?0:r||50;var i=U(e).toRgb(),o=U(n).toRgb(),s=r/100,a={r:(o.r-i.r)*s+i.r,g:(o.g-i.g)*s+i.g,b:(o.b-i.b)*s+i.b,a:(o.a-i.a)*s+i.a};return U(a)};U.readability=function(e,n){var r=U(e),i=U(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};U.isReadable=function(e,n,r){var i=U.readability(e,n),o,s;switch(s=!1,o=Xb(r),o.level+o.size){case"AAsmall":case"AAAlarge":s=i>=4.5;break;case"AAlarge":s=i>=3;break;case"AAAsmall":s=i>=7;break}return s};U.mostReadable=function(e,n,r){var i=null,o=0,s,a,u,c;r=r||{},a=r.includeFallbackColors,u=r.level,c=r.size;for(var l=0;l<n.length;l++)s=U.readability(e,n[l]),s>o&&(o=s,i=U(n[l]));return U.isReadable(e,i,{level:u,size:c})||!a?i:(r.includeFallbackColors=!1,U.mostReadable(e,["#fff","#000"],r))};var ni=U.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Vb=U.hexNames=Bb(ni);function Bb(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function Su(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function ce(e,n){Wb(e)&&(e="100%");var r=Gb(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function Sr(e){return Math.min(1,Math.max(0,e))}function Ee(e){return parseInt(e,16)}function Wb(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Gb(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Ge(e){return e.length==1?"0"+e:""+e}function rn(e){return e<=1&&(e=e*100+"%"),e}function zu(e){return Math.round(parseFloat(e)*255).toString(16)}function vs(e){return Ee(e)/255}var He=(function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function ot(e){return!!He.CSS_UNIT.exec(e)}function Jb(e){e=e.replace(Cb,"").replace(Pb,"").toLowerCase();var n=!1;if(ni[e])e=ni[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=He.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=He.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=He.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=He.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=He.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=He.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=He.hex8.exec(e))?{r:Ee(r[1]),g:Ee(r[2]),b:Ee(r[3]),a:vs(r[4]),format:n?"name":"hex8"}:(r=He.hex6.exec(e))?{r:Ee(r[1]),g:Ee(r[2]),b:Ee(r[3]),format:n?"name":"hex"}:(r=He.hex4.exec(e))?{r:Ee(r[1]+""+r[1]),g:Ee(r[2]+""+r[2]),b:Ee(r[3]+""+r[3]),a:vs(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=He.hex3.exec(e))?{r:Ee(r[1]+""+r[1]),g:Ee(r[2]+""+r[2]),b:Ee(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function Xb(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function ri(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function Kb(e){if(Array.isArray(e))return ri(e)}function Tu(e,n,r){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:r;throw new TypeError("Private element is not present on this object")}function Yb(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Qb(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function Me(e,n){return e.get(Tu(e,n))}function bs(e,n,r){Yb(e,n),n.set(e,r)}function ws(e,n,r){return e.set(Tu(e,n),r),r}function e1(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,s1(i.key),i)}}function t1(e,n,r){return n&&e1(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function n1(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function r1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
86
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i1(e){return Kb(e)||n1(e)||a1(e)||r1()}function o1(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function s1(e){var n=o1(e,"string");return typeof n=="symbol"?n:n+""}function a1(e,n){if(e){if(typeof e=="string")return ri(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ri(e,n):void 0}}var u1=123,c1=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},Cu=function(n,r,i){return(n<<16)+(r<<8)+i},l1=function(n){var r=U(n).toRgb(),i=r.r,o=r.g,s=r.b;return Cu(i,o,s)},xs=function(n,r){return n*u1%Math.pow(2,r)},wt=new WeakMap,st=new WeakMap,f1=(function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;Qb(this,e),bs(this,wt,void 0),bs(this,st,void 0),ws(st,this,n),this.reset()}return t1(e,[{key:"reset",value:function(){ws(wt,this,["__reserved for background__"])}},{key:"register",value:function(r){if(Me(wt,this).length>=Math.pow(2,24-Me(st,this)))return null;var i=Me(wt,this).length,o=xs(i,Me(st,this)),s=c1(i+(o<<24-Me(st,this)));return Me(wt,this).push(r),s}},{key:"lookup",value:function(r){if(!r)return null;var i=typeof r=="string"?l1(r):Cu.apply(void 0,i1(r));if(!i)return null;var o=i&Math.pow(2,24-Me(st,this))-1,s=i>>24-Me(st,this)&Math.pow(2,Me(st,this))-1;return xs(o,Me(st,this))!==s||o>=Me(wt,this).length?null:Me(wt,this)[o]}}])})(),An,le,Pu,Eu,kt,ks,Au,Ru,$u,no,ii,oi,_n={},Iu=[],h1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zr=Array.isArray;function Ye(e,n){for(var r in n)e[r]=n[r];return e}function ro(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function d1(e,n,r){var i,o,s,a={};for(s in n)s=="key"?i=n[s]:s=="ref"?o=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?An.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)a[s]===void 0&&(a[s]=e.defaultProps[s]);return sn(e,a,i,o,null)}function sn(e,n,r,i,o){var s={type:e,props:n,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Pu,__i:-1,__u:0};return o==null&&le.vnode!=null&&le.vnode(s),s}function Tr(e){return e.children}function Gn(e,n){this.props=e,this.context=n}function Lt(e,n){if(n==null)return e.__?Lt(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Lt(e):null}function Mu(e){var n,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return Mu(e)}}function Ss(e){(!e.__d&&(e.__d=!0)&&kt.push(e)&&!cr.__r++||ks!=le.debounceRendering)&&((ks=le.debounceRendering)||Au)(cr)}function cr(){for(var e,n,r,i,o,s,a,u=1;kt.length;)kt.length>u&&kt.sort(Ru),e=kt.shift(),u=kt.length,e.__d&&(r=void 0,i=void 0,o=(i=(n=e).__v).__e,s=[],a=[],n.__P&&((r=Ye({},i)).__v=i.__v+1,le.vnode&&le.vnode(r),io(n.__P,r,i,n.__n,n.__P.namespaceURI,32&i.__u?[o]:null,s,o??Lt(i),!!(32&i.__u),a),r.__v=i.__v,r.__.__k[r.__i]=r,Du(s,r,a),i.__e=i.__=null,r.__e!=o&&Mu(r)));cr.__r=0}function Ou(e,n,r,i,o,s,a,u,c,l,h){var f,d,p,g,_,y,m,w=i&&i.__k||Iu,C=n.length;for(c=p1(r,n,w,c,C),f=0;f<C;f++)(p=r.__k[f])!=null&&(d=p.__i==-1?_n:w[p.__i]||_n,p.__i=f,y=io(e,p,d,o,s,a,u,c,l,h),g=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&oo(d.ref,null,p),h.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),(m=!!(4&p.__u))||d.__k===p.__k?c=Nu(p,c,e,m):typeof p.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),p.__u&=-7);return r.__e=_,c}function p1(e,n,r,i,o){var s,a,u,c,l,h=r.length,f=h,d=0;for(e.__k=new Array(o),s=0;s<o;s++)(a=n[s])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[s]=sn(null,a,null,null,null):zr(a)?a=e.__k[s]=sn(Tr,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[s]=sn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[s]=a,c=s+d,a.__=e,a.__b=e.__b+1,u=null,(l=a.__i=g1(a,r,c,f))!=-1&&(f--,(u=r[l])&&(u.__u|=2)),u==null||u.__v==null?(l==-1&&(o>h?d--:o<h&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,a.__u|=4))):e.__k[s]=null;if(f)for(s=0;s<h;s++)(u=r[s])!=null&&(2&u.__u)==0&&(u.__e==i&&(i=Lt(u)),Zu(u,u));return i}function Nu(e,n,r,i){var o,s;if(typeof e.type=="function"){for(o=e.__k,s=0;o&&s<o.length;s++)o[s]&&(o[s].__=e,n=Nu(o[s],n,r,i));return n}e.__e!=n&&(i&&(n&&e.type&&!n.parentNode&&(n=Lt(e)),r.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function g1(e,n,r,i){var o,s,a,u=e.key,c=e.type,l=n[r],h=l!=null&&(2&l.__u)==0;if(l===null&&u==null||h&&u==l.key&&c==l.type)return r;if(i>(h?1:0)){for(o=r-1,s=r+1;o>=0||s<n.length;)if((l=n[a=o>=0?o--:s++])!=null&&(2&l.__u)==0&&u==l.key&&c==l.type)return a}return-1}function zs(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||h1.test(n)?r:r+"px"}function Un(e,n,r,i,o){var s,a;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(n in i)r&&n in r||zs(e.style,n,"");if(r)for(n in r)i&&r[n]==i[n]||zs(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")s=n!=(n=n.replace($u,"$1")),a=n.toLowerCase(),n=a in e||n=="onFocusOut"||n=="onFocusIn"?a.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+s]=r,r?i?r.u=i.u:(r.u=no,e.addEventListener(n,s?oi:ii,s)):e.removeEventListener(n,s?oi:ii,s);else{if(o=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function Ts(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n.t==null)n.t=no++;else if(n.t<r.u)return;return r(le.event?le.event(n):n)}}}function io(e,n,r,i,o,s,a,u,c,l){var h,f,d,p,g,_,y,m,w,C,b,v,k,x,P,M,$,N=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(c=!!(32&r.__u),s=[u=n.__e=r.__e]),(h=le.__b)&&h(n);e:if(typeof N=="function")try{if(m=n.props,w="prototype"in N&&N.prototype.render,C=(h=N.contextType)&&i[h.__c],b=h?C?C.props.value:h.__:i,r.__c?y=(f=n.__c=r.__c).__=f.__E:(w?n.__c=f=new N(m,b):(n.__c=f=new Gn(m,b),f.constructor=N,f.render=_1),C&&C.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),w&&f.__s==null&&(f.__s=f.state),w&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ye({},f.__s)),Ye(f.__s,N.getDerivedStateFromProps(m,f.__s))),p=f.props,g=f.state,f.__v=n,d)w&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),w&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(w&&N.getDerivedStateFromProps==null&&m!==p&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(m,b),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(m,f.__s,b)===!1){for(n.__v!=r.__v&&(f.props=m,f.state=f.__s,f.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(D){D&&(D.__=n)}),v=0;v<f._sb.length;v++)f.__h.push(f._sb[v]);f._sb=[],f.__h.length&&a.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(m,f.__s,b),w&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(p,g,_)})}if(f.context=b,f.props=m,f.__P=e,f.__e=!1,k=le.__r,x=0,w){for(f.state=f.__s,f.__d=!1,k&&k(n),h=f.render(f.props,f.state,f.context),P=0;P<f._sb.length;P++)f.__h.push(f._sb[P]);f._sb=[]}else do f.__d=!1,k&&k(n),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++x<25);f.state=f.__s,f.getChildContext!=null&&(i=Ye(Ye({},i),f.getChildContext())),w&&!d&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(p,g)),M=h,h!=null&&h.type===Tr&&h.key==null&&(M=ju(h.props.children)),u=Ou(e,zr(M)?M:[M],n,r,i,o,s,a,u,c,l),f.base=n.__e,n.__u&=-161,f.__h.length&&a.push(f),y&&(f.__E=f.__=null)}catch(D){if(n.__v=null,c||s!=null)if(D.then){for(n.__u|=c?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;s[s.indexOf(u)]=null,n.__e=u}else{for($=s.length;$--;)ro(s[$]);si(n)}else n.__e=r.__e,n.__k=r.__k,D.then||si(n);le.__e(D,n,r)}else s==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):u=n.__e=m1(r.__e,n,r,i,o,s,a,c,l);return(h=le.diffed)&&h(n),128&n.__u?void 0:u}function si(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(si)}function Du(e,n,r){for(var i=0;i<r.length;i++)oo(r[i],r[++i],r[++i]);le.__c&&le.__c(n,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(s){s.call(o)})}catch(s){le.__e(s,o.__v)}})}function ju(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:zr(e)?e.map(ju):Ye({},e)}function m1(e,n,r,i,o,s,a,u,c){var l,h,f,d,p,g,_,y=r.props||_n,m=n.props,w=n.type;if(w=="svg"?o="http://www.w3.org/2000/svg":w=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),s!=null){for(l=0;l<s.length;l++)if((p=s[l])&&"setAttribute"in p==!!w&&(w?p.localName==w:p.nodeType==3)){e=p,s[l]=null;break}}if(e==null){if(w==null)return document.createTextNode(m);e=document.createElementNS(o,w,m.is&&m),u&&(le.__m&&le.__m(n,s),u=!1),s=null}if(w==null)y===m||u&&e.data==m||(e.data=m);else{if(s=s&&An.call(e.childNodes),!u&&s!=null)for(y={},l=0;l<e.attributes.length;l++)y[(p=e.attributes[l]).name]=p.value;for(l in y)if(p=y[l],l!="children"){if(l=="dangerouslySetInnerHTML")f=p;else if(!(l in m)){if(l=="value"&&"defaultValue"in m||l=="checked"&&"defaultChecked"in m)continue;Un(e,l,null,p,o)}}for(l in m)p=m[l],l=="children"?d=p:l=="dangerouslySetInnerHTML"?h=p:l=="value"?g=p:l=="checked"?_=p:u&&typeof p!="function"||y[l]===p||Un(e,l,p,y[l],o);if(h)u||f&&(h.__html==f.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(f&&(e.innerHTML=""),Ou(n.type=="template"?e.content:e,zr(d)?d:[d],n,r,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":o,s,a,s?s[0]:r.__k&&Lt(r,0),u,c),s!=null)for(l=s.length;l--;)ro(s[l]);u||(l="value",w=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||w=="progress"&&!g||w=="option"&&g!=y[l])&&Un(e,l,g,y[l],o),l="checked",_!=null&&_!=e[l]&&Un(e,l,_,y[l],o))}return e}function oo(e,n,r){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(o){le.__e(o,r)}}function Zu(e,n,r){var i,o;if(le.unmount&&le.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||oo(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(s){le.__e(s,n)}i.base=i.__P=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&Zu(i[o],n,r||typeof e.type!="function");r||ro(e.__e),e.__c=e.__=e.__e=void 0}function _1(e,n,r){return this.constructor(e,r)}function y1(e,n,r){var i,o,s,a;n==document&&(n=document.documentElement),le.__&&le.__(e,n),o=(i=!1)?null:n.__k,s=[],a=[],io(n,e=n.__k=d1(Tr,null,[e]),o||_n,_n,n.namespaceURI,o?null:n.firstChild?An.call(n.childNodes):null,s,o?o.__e:n.firstChild,i,a),Du(s,e,a)}function qu(e,n,r){var i,o,s,a,u=Ye({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),n)s=="key"?i=n[s]:s=="ref"?o=n[s]:u[s]=n[s]===void 0&&a!=null?a[s]:n[s];return arguments.length>2&&(u.children=arguments.length>3?An.call(arguments,2):r),sn(e.type,u,i||e.key,o||e.ref,null)}An=Iu.slice,le={__e:function(e,n,r,i){for(var o,s,a;n=n.__;)if((o=n.__c)&&!o.__)try{if((s=o.constructor)&&s.getDerivedStateFromError!=null&&(o.setState(s.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(u){e=u}throw e}},Pu=0,Eu=function(e){return e!=null&&e.constructor===void 0},Gn.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ye({},this.state),typeof e=="function"&&(e=e(Ye({},r),this.props)),e&&Ye(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),Ss(this))},Gn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ss(this))},Gn.prototype.render=Tr,kt=[],Au=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ru=function(e,n){return e.__v.__b-n.__v.__b},cr.__r=0,$u=/(PointerCapture)$|Capture$/i,no=0,ii=Ts(!1),oi=Ts(!0);function Cs(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function v1(e){if(Array.isArray(e))return e}function b1(e,n,r){return(n=T1(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function w1(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,s,a,u=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(i=s.call(r)).done)&&(u.push(i.value),u.length!==n);c=!0);}catch(h){l=!0,o=h}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}function x1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
87
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ps(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function k1(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Ps(Object(r),!0).forEach(function(i){b1(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ps(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function S1(e,n){return v1(e)||w1(e,n)||C1(e,n)||x1()}function z1(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function T1(e){var n=z1(e,"string");return typeof n=="symbol"?n:n+""}function lr(e){"@babel/helpers - typeof";return lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},lr(e)}function C1(e,n){if(e){if(typeof e=="string")return Cs(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Cs(e,n):void 0}}var ai=function(n){if(lr(n)!=="object")return n;var r=qu(n);if(r.props){var i;r.props=k1({},r.props),r!=null&&(i=r.props)!==null&&i!==void 0&&i.children&&(r.props.children=Array.isArray(r.props.children)?r.props.children.map(ai):ai(r.props.children))}return r},P1=function(n){return Eu(qu(n))},E1=function(n,r){delete r.__k,y1(ai(n),r)};function A1(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var R1=`.float-tooltip-kap {
|
|
88
88
|
position: absolute;
|
|
89
89
|
width: max-content; /* prevent shrinking near right edge */
|
|
90
90
|
max-width: max(50%, 150px);
|
|
@@ -95,9 +95,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
95
95
|
background: rgba(0,0,0,0.6);
|
|
96
96
|
pointer-events: none;
|
|
97
97
|
}
|
|
98
|
-
`;E1(A1);var R1=to({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.style,s=o===void 0?{}:o,a=!!n&&lr(n)==="object"&&!!n.node&&typeof n.node=="function",u=De(a?n.node():n);u.style("position")==="static"&&u.style("position","relative"),r.tooltipEl=u.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(l){var h=k1(l,2),f=h[0],d=h[1];return r.tooltipEl.style(f,d)}),r.tooltipEl.style("left","-10000px").style("display","none");var c="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,u.on("mousemove.".concat(c),function(l){r.mouseInside=!0;var h=Ke(l),f=u.node(),d=f.offsetWidth,p=f.offsetHeight,g=[r.offsetX===null||r.offsetX===void 0?"-".concat(h[0]/d*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?p>130&&p-h[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",h[0]+"px").style("top",h[1]+"px").style("transform","translate(".concat(g.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),u.on("mouseover.".concat(c),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),u.on("mouseout.".concat(c),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):C1(n.content)?(n.tooltipEl.text(""),P1(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});const{abs:Jt,cos:at,sin:At,acos:$1,atan2:Gt,sqrt:ht,pow:Oe}=Math;function Xt(e){return e<0?-Oe(-e,1/3):Oe(e,1/3)}const Zu=Math.PI,Ln=2*Zu,dt=Zu/2,I1=1e-6,Dr=Number.MAX_SAFE_INTEGER||9007199254740991,jr=Number.MIN_SAFE_INTEGER||-9007199254740991,M1={x:0,y:0,z:0},I={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let i=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(i+=r.z*r.z),ht(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const i=n.length-1;if(e===1)return n[i].t=1,n[i];const o=1-e;let s=n;if(i===0)return n[0].t=e,n[0];if(i===1){const u={x:o*s[0].x+e*s[1].x,y:o*s[0].y+e*s[1].y,t:e};return r&&(u.z=o*s[0].z+e*s[1].z),u}if(i<4){let u=o*o,c=e*e,l,h,f,d=0;i===2?(s=[s[0],s[1],s[2],M1],l=u,h=o*e*2,f=c):i===3&&(l=u*o,h=u*e*3,f=o*c*3,d=e*c);const p={x:l*s[0].x+h*s[1].x+f*s[2].x+d*s[3].x,y:l*s[0].y+h*s[1].y+f*s[2].y+d*s[3].y,t:e};return r&&(p.z=l*s[0].z+h*s[1].z+f*s[2].z+d*s[3].z),p}const a=JSON.parse(JSON.stringify(n));for(;a.length>1;){for(let u=0;u<a.length-1;u++)a[u]={x:a[u].x+(a[u+1].x-a[u].x)*e,y:a[u].y+(a[u+1].y-a[u].y)*e},typeof a[u].z<"u"&&(a[u].z=a[u].z+(a[u+1].z-a[u].z)*e);a.splice(a.length-1,1)}return a[0].t=e,a[0]},computeWithRatios:function(e,n,r,i){const o=1-e,s=r,a=n;let u=s[0],c=s[1],l=s[2],h=s[3],f;if(u*=o,c*=e,a.length===2)return f=u+c,{x:(u*a[0].x+c*a[1].x)/f,y:(u*a[0].y+c*a[1].y)/f,z:i?(u*a[0].z+c*a[1].z)/f:!1,t:e};if(u*=o,c*=2*o,l*=e*e,a.length===3)return f=u+c+l,{x:(u*a[0].x+c*a[1].x+l*a[2].x)/f,y:(u*a[0].y+c*a[1].y+l*a[2].y)/f,z:i?(u*a[0].z+c*a[1].z+l*a[2].z)/f:!1,t:e};if(u*=o,c*=1.5*o,l*=3*o,h*=e*e*e,a.length===4)return f=u+c+l+h,{x:(u*a[0].x+c*a[1].x+l*a[2].x+h*a[3].x)/f,y:(u*a[0].y+c*a[1].y+l*a[2].y+h*a[3].y)/f,z:i?(u*a[0].z+c*a[1].z+l*a[2].z+h*a[3].z)/f:!1,t:e}},derive:function(e,n){const r=[];for(let i=e,o=i.length,s=o-1;o>1;o--,s--){const a=[];for(let u=0,c;u<s;u++)c={x:s*(i[u+1].x-i[u].x),y:s*(i[u+1].y-i[u].y)},n&&(c.z=s*(i[u+1].z-i[u].z)),a.push(c);r.push(a),i=a}return r},between:function(e,n,r){return n<=e&&e<=r||I.approximately(e,n)||I.approximately(e,r)},approximately:function(e,n,r){return Jt(e-n)<=(r||I1)},length:function(e){const r=I.Tvalues.length;let i=0;for(let o=0,s;o<r;o++)s=.5*I.Tvalues[o]+.5,i+=I.Cvalues[o]*I.arcfn(s,e);return .5*i},map:function(e,n,r,i,o){const s=r-n,a=o-i,u=e-n,c=u/s;return i+a*c},lerp:function(e,n,r){const i={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(i.z=n.z+e*(r.z-n.z)),i},pointToString:function(e){let n=e.x+"/"+e.y;return typeof e.z<"u"&&(n+="/"+e.z),n},pointsToString:function(e){return"["+e.map(I.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){const i=n.x-e.x,o=n.y-e.y,s=r.x-e.x,a=r.y-e.y,u=i*a-o*s,c=i*s+o*a;return Gt(u,c)},round:function(e,n){const r=""+e,i=r.indexOf(".");return parseFloat(r.substring(0,i+1+n))},dist:function(e,n){const r=e.x-n.x,i=e.y-n.y;return ht(r*r+i*i)},closest:function(e,n){let r=Oe(2,63),i,o;return e.forEach(function(s,a){o=I.dist(n,s),o<r&&(r=o,i=a)}),{mdist:r,mpos:i}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Oe(e,n)+Oe(1-e,n),i=r-1;return Jt(i/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Oe(1-e,n),i=Oe(e,n)+r;return r/i},lli8:function(e,n,r,i,o,s,a,u){const c=(e*i-n*r)*(o-a)-(e-r)*(o*u-s*a),l=(e*i-n*r)*(s-u)-(n-i)*(o*u-s*a),h=(e-r)*(s-u)-(n-i)*(o-a);return h==0?!1:{x:c/h,y:l/h}},lli4:function(e,n,r,i){const o=e.x,s=e.y,a=n.x,u=n.y,c=r.x,l=r.y,h=i.x,f=i.y;return I.lli8(o,s,a,u,c,l,h,f)},lli:function(e,n){return I.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new se(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=Dr,r=Dr,i=jr,o=jr;return e.forEach(function(s){const a=s.bbox();n>a.x.min&&(n=a.x.min),r>a.y.min&&(r=a.y.min),i<a.x.max&&(i=a.x.max),o<a.y.max&&(o=a.y.max)}),{x:{min:n,mid:(n+i)/2,max:i,size:i-n},y:{min:r,mid:(r+o)/2,max:o,size:o-r}}},shapeintersections:function(e,n,r,i,o){if(!I.bboxoverlap(n,i))return[];const s=[],a=[e.startcap,e.forward,e.back,e.endcap],u=[r.startcap,r.forward,r.back,r.endcap];return a.forEach(function(c){c.virtual||u.forEach(function(l){if(l.virtual)return;const h=c.intersects(l,o);h.length>0&&(h.c1=c,h.c2=l,h.s1=e,h.s2=r,s.push(h))})}),s},makeshape:function(e,n,r){const i=n.points.length,o=e.points.length,s=I.makeline(n.points[i-1],e.points[0]),a=I.makeline(e.points[o-1],n.points[0]),u={startcap:s,forward:e,back:n,endcap:a,bbox:I.findbbox([s,e,n,a])};return u.intersections=function(c){return I.shapeintersections(u,u.bbox,c,c.bbox,r)},u},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=Dr,o=jr,s,a;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let u=0,c=r.length;u<c;u++)s=r[u],a=e.get(s),a[n]<i&&(i=a[n]),a[n]>o&&(o=a[n]);return{min:i,mid:(i+o)/2,max:o,size:o-i}},align:function(e,n){const r=n.p1.x,i=n.p1.y,o=-Gt(n.p2.y-i,n.p2.x-r),s=function(a){return{x:(a.x-r)*at(o)-(a.y-i)*At(o),y:(a.x-r)*At(o)+(a.y-i)*at(o)}};return e.map(s)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,i=I.align(e,n),o=function(x){return 0<=x&&x<=1};if(r===2){const x=i[0].y,P=i[1].y,M=i[2].y,$=x-2*P+M;if($!==0){const N=-ht(P*P-x*M),D=-x+P,H=-(N+D)/$,z=-(-N+D)/$;return[H,z].filter(o)}else if(P!==M&&$===0)return[(2*P-M)/(2*P-2*M)].filter(o);return[]}const s=i[0].y,a=i[1].y,u=i[2].y,c=i[3].y;let l=-s+3*a-3*u+c,h=3*s-6*a+3*u,f=-3*s+3*a,d=s;if(I.approximately(l,0)){if(I.approximately(h,0))return I.approximately(f,0)?[]:[-d/f].filter(o);const x=ht(f*f-4*h*d),P=2*h;return[(x-f)/P,(-f-x)/P].filter(o)}h/=l,f/=l,d/=l;const p=(3*f-h*h)/3,g=p/3,_=(2*h*h*h-9*h*f+27*d)/27,y=_/2,m=y*y+g*g*g;let w,C,b,v,k;if(m<0){const x=-p/3,P=x*x*x,M=ht(P),$=-_/(2*M),N=$<-1?-1:$>1?1:$,D=$1(N),H=Xt(M),z=2*H;return b=z*at(D/3)-h/3,v=z*at((D+Ln)/3)-h/3,k=z*at((D+2*Ln)/3)-h/3,[b,v,k].filter(o)}else{if(m===0)return w=y<0?Xt(-y):-Xt(y),b=2*w-h/3,v=-w-h/3,[b,v].filter(o);{const x=ht(m);return w=Xt(-y+x),C=Xt(y+x),[w-C-h/3].filter(o)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],i=e[2],o=n-2*r+i;if(o!==0){const s=-ht(r*r-n*i),a=-n+r,u=-(s+a)/o,c=-(-s+a)/o;return[u,c]}else if(r!==i&&o===0)return[(2*r-i)/(2*(r-i))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,i,o){let s,a,u,c,l=0,h=0;const f=I.compute(e,n),d=I.compute(e,r),p=f.x*f.x+f.y*f.y;if(i?(s=ht(Oe(f.y*d.z-d.y*f.z,2)+Oe(f.z*d.x-d.z*f.x,2)+Oe(f.x*d.y-d.x*f.y,2)),a=Oe(p+f.z*f.z,3/2)):(s=f.x*d.y-f.y*d.x,a=Oe(p,3/2)),s===0||a===0)return{k:0,r:0};if(l=s/a,h=a/s,!o){const g=I.curvature(e-.001,n,r,i,!0).k,_=I.curvature(e+.001,n,r,i,!0).k;c=(_-l+(l-g))/2,u=(Jt(_-l)+Jt(l-g))/2}return{k:l,r:h,dk:c,adk:u}},inflections:function(e){if(e.length<4)return[];const n=I.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,o=n[1].x*n[2].y,s=n[3].x*n[2].y,a=18*(-3*r+2*i+3*o-s),u=18*(3*r-i-3*o),c=18*(o-r);if(I.approximately(a,0)){if(!I.approximately(u,0)){let d=-c/u;if(0<=d&&d<=1)return[d]}return[]}const l=2*a;if(I.approximately(l,0))return[];const h=u*u-4*a*c;if(h<0)return[];const f=Math.sqrt(h);return[(f-u)/l,-(u+f)/l].filter(function(d){return 0<=d&&d<=1})},bboxoverlap:function(e,n){const r=["x","y"],i=r.length;for(let o=0,s,a,u,c;o<i;o++)if(s=r[o],a=e[s].mid,u=n[s].mid,c=(e[s].size+n[s].size)/2,Jt(a-u)>=c)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const i=e.bbox(),o=n.bbox(),s=1e5,a=r||.5;if(i.x.size+i.y.size<a&&o.x.size+o.y.size<a)return[(s*(e._t1+e._t2)/2|0)/s+"/"+(s*(n._t1+n._t2)/2|0)/s];let u=e.split(.5),c=n.split(.5),l=[{left:u.left,right:c.left},{left:u.left,right:c.right},{left:u.right,right:c.right},{left:u.right,right:c.left}];l=l.filter(function(f){return I.bboxoverlap(f.left.bbox(),f.right.bbox())});let h=[];return l.length===0||(l.forEach(function(f){h=h.concat(I.pairiteration(f.left,f.right,a))}),h=h.filter(function(f,d){return h.indexOf(f)===d})),h},getccenter:function(e,n,r){const i=n.x-e.x,o=n.y-e.y,s=r.x-n.x,a=r.y-n.y,u=i*at(dt)-o*At(dt),c=i*At(dt)+o*at(dt),l=s*at(dt)-a*At(dt),h=s*At(dt)+a*at(dt),f=(e.x+n.x)/2,d=(e.y+n.y)/2,p=(n.x+r.x)/2,g=(n.y+r.y)/2,_=f+u,y=d+c,m=p+l,w=g+h,C=I.lli8(f,d,_,y,p,g,m,w),b=I.dist(C,e);let v=Gt(e.y-C.y,e.x-C.x),k=Gt(n.y-C.y,n.x-C.x),x=Gt(r.y-C.y,r.x-C.x),P;return v<x?((v>k||k>x)&&(v+=Ln),v>x&&(P=x,x=v,v=P)):x<k&&k<v?(P=x,x=v,v=P):x+=Ln,C.s=v,C.e=x,C.r=b,C},numberSort:function(e,n){return e-n}};class an{constructor(n){this.curves=[],this._3d=!1,n&&(this.curves=n,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(n){return I.pointsToString(n.points)}).join(", ")+"]"}addCurve(n){this.curves.push(n),this._3d=this._3d||n._3d}length(){return this.curves.map(function(n){return n.length()}).reduce(function(n,r){return n+r})}curve(n){return this.curves[n]}bbox(){const n=this.curves;for(var r=n[0].bbox(),i=1;i<n.length;i++)I.expandbox(r,n[i].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(i){r.push(...i.offset(n))}),new an(r)}}const{abs:Kt,min:Ps,max:Es,cos:O1,sin:N1,acos:D1,sqrt:Yt}=Math,j1=Math.PI;class se{constructor(n){let r=n&&n.forEach?n:Array.from(arguments).slice(),i=!1;if(typeof r[0]=="object"){i=r.length;const p=[];r.forEach(function(g){["x","y","z"].forEach(function(_){typeof g[_]<"u"&&p.push(g[_])})}),r=p}let o=!1;const s=r.length;if(i){if(i>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");o=!0}}else if(s!==6&&s!==8&&s!==9&&s!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const a=this._3d=!o&&(s===9||s===12)||n&&n[0]&&typeof n[0].z<"u",u=this.points=[];for(let p=0,g=a?3:2;p<s;p+=g){var c={x:r[p],y:r[p+1]};a&&(c.z=r[p+2]),u.push(c)}const l=this.order=u.length-1,h=this.dims=["x","y"];a&&h.push("z"),this.dimlen=h.length;const f=I.align(u,{p1:u[0],p2:u[l]}),d=I.dist(u[0],u[l]);this._linear=f.reduce((p,g)=>p+Kt(g.y),0)<d/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,i,o){if(typeof o>"u"&&(o=.5),o===0)return new se(r,r,i);if(o===1)return new se(n,r,r);const s=se.getABC(2,n,r,i,o);return new se(n,s.A,i)}static cubicFromPoints(n,r,i,o,s){typeof o>"u"&&(o=.5);const a=se.getABC(3,n,r,i,o);typeof s>"u"&&(s=I.dist(r,a.C));const u=s*(1-o)/o,c=I.dist(n,i),l=(i.x-n.x)/c,h=(i.y-n.y)/c,f=s*l,d=s*h,p=u*l,g=u*h,_={x:r.x-f,y:r.y-d},y={x:r.x+p,y:r.y+g},m=a.A,w={x:m.x+(_.x-m.x)/(1-o),y:m.y+(_.y-m.y)/(1-o)},C={x:m.x+(y.x-m.x)/o,y:m.y+(y.y-m.y)/o},b={x:n.x+(w.x-n.x)/o,y:n.y+(w.y-n.y)/o},v={x:i.x+(C.x-i.x)/(1-o),y:i.y+(C.y-i.y)/(1-o)};return new se(n,b,v,i)}static getUtils(){return I}getUtils(){return se.getUtils()}static get PolyBezier(){return an}valueOf(){return this.toString()}toString(){return I.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,i=n[0].y,o=["M",r,i,this.order===2?"Q":"C"];for(let s=1,a=n.length;s<a;s++)o.push(n[s].x),o.push(n[s].y);return o.join(" ")}setRatios(n){if(n.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=n,this._lut=[]}verify(){const n=this.coordDigest();n!==this._print&&(this._print=n,this.update())}coordDigest(){return this.points.map(function(n,r){return""+r+n.x+n.y+(n.z?n.z:0)}).join("")}update(){this._lut=[],this.dpoints=I.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=I.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return I.length(this.derivative.bind(this))}static getABC(n=2,r,i,o,s=.5){const a=I.projectionratio(s,n),u=1-a,c={x:a*r.x+u*o.x,y:a*r.y+u*o.y},l=I.abcratio(s,n);return{A:{x:i.x+(i.x-c.x)/l,y:i.y+(i.y-c.y)/l},B:i,C:c,S:r,E:o}}getABC(n,r){r=r||this.get(n);let i=this.points[0],o=this.points[this.order];return se.getABC(this.order,i,r,o,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,i,o;r<n;r++)o=r/(n-1),i=this.compute(o),i.t=o,this._lut.push(i);return this._lut}on(n,r){r=r||5;const i=this.getLUT(),o=[];for(let s=0,a,u=0;s<i.length;s++)a=i[s],I.dist(a,n)<r&&(o.push(a),u+=s/i.length);return o.length?t/=o.length:!1}project(n){const r=this.getLUT(),i=r.length-1,o=I.closest(r,n),s=o.mpos,a=(s-1)/i,u=(s+1)/i,c=.1/i;let l=o.mdist,h=a,f=h,d;l+=1;for(let p;h<u+c;h+=c)d=this.compute(h),p=I.dist(n,d),p<l&&(l=p,f=h);return f=f<0?0:f>1?1:f,d=this.compute(f),d.t=f,d.d=l,d}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?I.computeWithRatios(n,this.points,this.ratios,this._3d):I.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],i=n.length;for(let o=1,s,a;o<i;o++)s=n[o],a=n[o-1],r[o]={x:(i-o)/i*s.x+o/i*a.x,y:(i-o)/i*s.y+o/i*a.y};return r[i]=n[i-1],new se(r)}derivative(n){return I.compute(n,this.dpoints[0],this._3d)}dderivative(n){return I.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new se(I.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return I.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return I.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),i=Yt(r.x*r.x+r.y*r.y);return{t:n,x:-r.y/i,y:r.x/i}}__normal3(n){const r=this.derivative(n),i=this.derivative(n+.01),o=Yt(r.x*r.x+r.y*r.y+r.z*r.z),s=Yt(i.x*i.x+i.y*i.y+i.z*i.z);r.x/=o,r.y/=o,r.z/=o,i.x/=s,i.y/=s,i.z/=s;const a={x:i.y*r.z-i.z*r.y,y:i.z*r.x-i.x*r.z,z:i.x*r.y-i.y*r.x},u=Yt(a.x*a.x+a.y*a.y+a.z*a.z);a.x/=u,a.y/=u,a.z/=u;const c=[a.x*a.x,a.x*a.y-a.z,a.x*a.z+a.y,a.x*a.y+a.z,a.y*a.y,a.y*a.z-a.x,a.x*a.z-a.y,a.y*a.z+a.x,a.z*a.z];return{t:n,x:c[0]*r.x+c[1]*r.y+c[2]*r.z,y:c[3]*r.x+c[4]*r.y+c[5]*r.z,z:c[6]*r.x+c[7]*r.y+c[8]*r.z}}hull(n){let r=this.points,i=[],o=[],s=0;for(o[s++]=r[0],o[s++]=r[1],o[s++]=r[2],this.order===3&&(o[s++]=r[3]);r.length>1;){i=[];for(let a=0,u,c=r.length-1;a<c;a++)u=I.lerp(n,r[a],r[a+1]),o[s++]=u,i.push(u);r=i}return o}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;const i=this.hull(n),o={left:this.order===2?new se([i[0],i[3],i[5]]):new se([i[0],i[4],i[7],i[9]]),right:this.order===2?new se([i[5],i[4],i[2]]):new se([i[9],i[8],i[6],i[3]]),span:i};return o.left._t1=I.map(0,0,1,this._t1,this._t2),o.left._t2=I.map(n,0,1,this._t1,this._t2),o.right._t1=I.map(n,0,1,this._t1,this._t2),o.right._t2=I.map(1,0,1,this._t1,this._t2),r?(r=I.map(r,n,1,0,1),o.right.split(r).left):o}extrema(){const n={};let r=[];return this.dims.forEach((function(i){let o=function(a){return a[i]},s=this.dpoints[0].map(o);n[i]=I.droots(s),this.order===3&&(s=this.dpoints[1].map(o),n[i]=n[i].concat(I.droots(s))),n[i]=n[i].filter(function(a){return a>=0&&a<=1}),r=r.concat(n[i].sort(I.numberSort))}).bind(this)),n.values=r.sort(I.numberSort).filter(function(i,o){return r.indexOf(i)===o}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(i){r[i]=I.getminmax(this,i,n[i])}).bind(this)),r}overlaps(n){const r=this.bbox(),i=n.bbox();return I.bboxoverlap(r,i)}offset(n,r){if(typeof r<"u"){const i=this.get(n),o=this.normal(n),s={c:i,n:o,x:i.x+o.x*r,y:i.y+o.y*r};return this._3d&&(s.z=i.z+o.z*r),s}if(this._linear){const i=this.normal(0),o=this.points.map(function(s){const a={x:s.x+n*i.x,y:s.y+n*i.y};return s.z&&i.z&&(a.z=s.z+n*i.z),a});return[new se(o)]}return this.reduce().map(function(i){return i._linear?i.offset(n)[0]:i.scale(n)})}simple(){if(this.order===3){const o=I.angle(this.points[0],this.points[3],this.points[1]),s=I.angle(this.points[0],this.points[3],this.points[2]);if(o>0&&s<0||o<0&&s>0)return!1}const n=this.normal(0),r=this.normal(1);let i=n.x*r.x+n.y*r.y;return this._3d&&(i+=n.z*r.z),Kt(D1(i))<j1/3}reduce(){let n,r=0,i=0,o=.01,s,a=[],u=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),r=c[0],n=1;n<c.length;n++)i=c[n],s=this.split(r,i),s._t1=r,s._t2=i,a.push(s),r=i;return a.forEach(function(l){for(r=0,i=0;i<=1;)for(i=r+o;i<=1+o;i+=o)if(s=l.split(r,i),!s.simple()){if(i-=o,Kt(r-i)<o)return[];s=l.split(r,i),s._t1=I.map(r,0,1,l._t1,l._t2),s._t2=I.map(i,0,1,l._t1,l._t2),u.push(s),r=i;break}r<1&&(s=l.split(r,1),s._t1=I.map(r,0,1,l._t1,l._t2),s._t2=l._t2,u.push(s))}),u}translate(n,r,i){i=typeof i=="number"?i:r;const o=this.order;let s=this.points.map((a,u)=>(1-u/o)*r+u/o*i);return new se(this.points.map((a,u)=>({x:a.x+n.x*s[u],y:a.y+n.y*s[u]})))}scale(n){const r=this.order;let i=!1;if(typeof n=="function"&&(i=n),i&&r===2)return this.raise().scale(i);const o=this.clockwise,s=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);const a=i?i(0):n,u=i?i(1):n,c=[this.offset(0,10),this.offset(1,10)],l=[],h=I.lli4(c[0],c[0].c,c[1],c[1].c);if(!h)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(f){const d=l[f*r]=I.copy(s[f*r]);d.x+=(f?u:a)*c[f].n.x,d.y+=(f?u:a)*c[f].n.y}),i?([0,1].forEach(function(f){if(!(r===2&&f)){var d=s[f+1],p={x:d.x-h.x,y:d.y-h.y},g=i?i((f+1)/r):n;i&&!o&&(g=-g);var _=Yt(p.x*p.x+p.y*p.y);p.x/=_,p.y/=_,l[f+1]={x:d.x+g*p.x,y:d.y+g*p.y}}}),new se(l)):([0,1].forEach(f=>{if(r===2&&f)return;const d=l[f*r],p=this.derivative(f),g={x:d.x+p.x,y:d.y+p.y};l[f+1]=I.lli4(d,g,h,s[f+1])}),new se(l))}outline(n,r,i,o){if(r=r===void 0?n:r,this._linear){const v=this.normal(0),k=this.points[0],x=this.points[this.points.length-1];let P,M,$;i===void 0&&(i=n,o=r),P={x:k.x+v.x*n,y:k.y+v.y*n},$={x:x.x+v.x*i,y:x.y+v.y*i},M={x:(P.x+$.x)/2,y:(P.y+$.y)/2};const N=[P,M,$];P={x:k.x-v.x*r,y:k.y-v.y*r},$={x:x.x-v.x*o,y:x.y-v.y*o},M={x:(P.x+$.x)/2,y:(P.y+$.y)/2};const D=[$,M,P],H=I.makeline(D[2],N[0]),z=I.makeline(N[2],D[0]),O=[H,new se(N),z,new se(D)];return new an(O)}const s=this.reduce(),a=s.length,u=[];let c=[],l,h=0,f=this.length();const d=typeof i<"u"&&typeof o<"u";function p(v,k,x,P,M){return function($){const N=P/x,D=(P+M)/x,H=k-v;return I.map($,0,1,v+N*H,v+D*H)}}s.forEach(function(v){const k=v.length();d?(u.push(v.scale(p(n,i,f,h,k))),c.push(v.scale(p(-r,-o,f,h,k)))):(u.push(v.scale(n)),c.push(v.scale(-r))),h+=k}),c=c.map(function(v){return l=v.points,l[3]?v.points=[l[3],l[2],l[1],l[0]]:v.points=[l[2],l[1],l[0]],v}).reverse();const g=u[0].points[0],_=u[a-1].points[u[a-1].points.length-1],y=c[a-1].points[c[a-1].points.length-1],m=c[0].points[0],w=I.makeline(y,g),C=I.makeline(_,m),b=[w].concat(u).concat([C]).concat(c);return new an(b)}outlineshapes(n,r,i){r=r||n;const o=this.outline(n,r).curves,s=[];for(let a=1,u=o.length;a<u/2;a++){const c=I.makeshape(o[a],o[u-a],i);c.startcap.virtual=a>1,c.endcap.virtual=a<u/2-1,s.push(c)}return s}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof se&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(n){const r=Ps(n.p1.x,n.p2.x),i=Ps(n.p1.y,n.p2.y),o=Es(n.p1.x,n.p2.x),s=Es(n.p1.y,n.p2.y);return I.roots(this.points,n).filter(a=>{var u=this.get(a);return I.between(u.x,r,o)&&I.between(u.y,i,s)})}selfintersects(n){const r=this.reduce(),i=r.length-2,o=[];for(let s=0,a,u,c;s<i;s++)u=r.slice(s,s+1),c=r.slice(s+2),a=this.curveintersects(u,c,n),o.push(...a);return o}curveintersects(n,r,i){const o=[];n.forEach(function(a){r.forEach(function(u){a.overlaps(u)&&o.push({left:a,right:u})})});let s=[];return o.forEach(function(a){const u=I.pairiteration(a.left,a.right,i);u.length>0&&(s=s.concat(u))}),s}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,i,o){const s=(o-i)/4,a=this.get(i+s),u=this.get(o-s),c=I.dist(n,r),l=I.dist(n,a),h=I.dist(n,u);return Kt(l-c)+Kt(h-c)}_iterate(n,r){let i=0,o=1,s;do{s=0,o=1;let a=this.get(i),u,c,l,h,f=!1,d=!1,p,g=o,_=1;do if(d=f,h=l,g=(i+o)/2,u=this.get(g),c=this.get(o),l=I.getccenter(a,u,c),l.interval={start:i,end:o},f=this._error(l,a,i,o)<=n,p=d&&!f,p||(_=o),f){if(o>=1){if(l.interval.end=_=1,h=l,o>1){let m={x:l.x+l.r*O1(l.e),y:l.y+l.r*N1(l.e)};l.e+=I.angle({x:l.x,y:l.y},m,this.get(1))}break}o=o+(o-i)/2}else o=g;while(!p&&s++<100);if(s>=100)break;h=h||l,r.push(h),i=_}while(o<1);return r}}function ui(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function Z1(e){if(Array.isArray(e))return e}function q1(e){if(Array.isArray(e))return ui(e)}function U1(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function L1(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,s,a,u=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(i=s.call(r)).done)&&(u.push(i.value),u.length!==n);c=!0);}catch(h){l=!0,o=h}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}function F1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
99
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
100
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
98
|
+
`;A1(R1);var $1=to({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.style,s=o===void 0?{}:o,a=!!n&&lr(n)==="object"&&!!n.node&&typeof n.node=="function",u=De(a?n.node():n);u.style("position")==="static"&&u.style("position","relative"),r.tooltipEl=u.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(l){var h=S1(l,2),f=h[0],d=h[1];return r.tooltipEl.style(f,d)}),r.tooltipEl.style("left","-10000px").style("display","none");var c="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,u.on("mousemove.".concat(c),function(l){r.mouseInside=!0;var h=Ke(l),f=u.node(),d=f.offsetWidth,p=f.offsetHeight,g=[r.offsetX===null||r.offsetX===void 0?"-".concat(h[0]/d*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?p>130&&p-h[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",h[0]+"px").style("top",h[1]+"px").style("transform","translate(".concat(g.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),u.on("mouseover.".concat(c),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),u.on("mouseout.".concat(c),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):P1(n.content)?(n.tooltipEl.text(""),E1(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});const{abs:Gt,cos:at,sin:At,acos:I1,atan2:Jt,sqrt:ht,pow:Oe}=Math;function Xt(e){return e<0?-Oe(-e,1/3):Oe(e,1/3)}const Uu=Math.PI,Ln=2*Uu,dt=Uu/2,M1=1e-6,Dr=Number.MAX_SAFE_INTEGER||9007199254740991,jr=Number.MIN_SAFE_INTEGER||-9007199254740991,O1={x:0,y:0,z:0},I={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let i=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(i+=r.z*r.z),ht(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const i=n.length-1;if(e===1)return n[i].t=1,n[i];const o=1-e;let s=n;if(i===0)return n[0].t=e,n[0];if(i===1){const u={x:o*s[0].x+e*s[1].x,y:o*s[0].y+e*s[1].y,t:e};return r&&(u.z=o*s[0].z+e*s[1].z),u}if(i<4){let u=o*o,c=e*e,l,h,f,d=0;i===2?(s=[s[0],s[1],s[2],O1],l=u,h=o*e*2,f=c):i===3&&(l=u*o,h=u*e*3,f=o*c*3,d=e*c);const p={x:l*s[0].x+h*s[1].x+f*s[2].x+d*s[3].x,y:l*s[0].y+h*s[1].y+f*s[2].y+d*s[3].y,t:e};return r&&(p.z=l*s[0].z+h*s[1].z+f*s[2].z+d*s[3].z),p}const a=JSON.parse(JSON.stringify(n));for(;a.length>1;){for(let u=0;u<a.length-1;u++)a[u]={x:a[u].x+(a[u+1].x-a[u].x)*e,y:a[u].y+(a[u+1].y-a[u].y)*e},typeof a[u].z<"u"&&(a[u].z=a[u].z+(a[u+1].z-a[u].z)*e);a.splice(a.length-1,1)}return a[0].t=e,a[0]},computeWithRatios:function(e,n,r,i){const o=1-e,s=r,a=n;let u=s[0],c=s[1],l=s[2],h=s[3],f;if(u*=o,c*=e,a.length===2)return f=u+c,{x:(u*a[0].x+c*a[1].x)/f,y:(u*a[0].y+c*a[1].y)/f,z:i?(u*a[0].z+c*a[1].z)/f:!1,t:e};if(u*=o,c*=2*o,l*=e*e,a.length===3)return f=u+c+l,{x:(u*a[0].x+c*a[1].x+l*a[2].x)/f,y:(u*a[0].y+c*a[1].y+l*a[2].y)/f,z:i?(u*a[0].z+c*a[1].z+l*a[2].z)/f:!1,t:e};if(u*=o,c*=1.5*o,l*=3*o,h*=e*e*e,a.length===4)return f=u+c+l+h,{x:(u*a[0].x+c*a[1].x+l*a[2].x+h*a[3].x)/f,y:(u*a[0].y+c*a[1].y+l*a[2].y+h*a[3].y)/f,z:i?(u*a[0].z+c*a[1].z+l*a[2].z+h*a[3].z)/f:!1,t:e}},derive:function(e,n){const r=[];for(let i=e,o=i.length,s=o-1;o>1;o--,s--){const a=[];for(let u=0,c;u<s;u++)c={x:s*(i[u+1].x-i[u].x),y:s*(i[u+1].y-i[u].y)},n&&(c.z=s*(i[u+1].z-i[u].z)),a.push(c);r.push(a),i=a}return r},between:function(e,n,r){return n<=e&&e<=r||I.approximately(e,n)||I.approximately(e,r)},approximately:function(e,n,r){return Gt(e-n)<=(r||M1)},length:function(e){const r=I.Tvalues.length;let i=0;for(let o=0,s;o<r;o++)s=.5*I.Tvalues[o]+.5,i+=I.Cvalues[o]*I.arcfn(s,e);return .5*i},map:function(e,n,r,i,o){const s=r-n,a=o-i,u=e-n,c=u/s;return i+a*c},lerp:function(e,n,r){const i={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(i.z=n.z+e*(r.z-n.z)),i},pointToString:function(e){let n=e.x+"/"+e.y;return typeof e.z<"u"&&(n+="/"+e.z),n},pointsToString:function(e){return"["+e.map(I.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){const i=n.x-e.x,o=n.y-e.y,s=r.x-e.x,a=r.y-e.y,u=i*a-o*s,c=i*s+o*a;return Jt(u,c)},round:function(e,n){const r=""+e,i=r.indexOf(".");return parseFloat(r.substring(0,i+1+n))},dist:function(e,n){const r=e.x-n.x,i=e.y-n.y;return ht(r*r+i*i)},closest:function(e,n){let r=Oe(2,63),i,o;return e.forEach(function(s,a){o=I.dist(n,s),o<r&&(r=o,i=a)}),{mdist:r,mpos:i}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Oe(e,n)+Oe(1-e,n),i=r-1;return Gt(i/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Oe(1-e,n),i=Oe(e,n)+r;return r/i},lli8:function(e,n,r,i,o,s,a,u){const c=(e*i-n*r)*(o-a)-(e-r)*(o*u-s*a),l=(e*i-n*r)*(s-u)-(n-i)*(o*u-s*a),h=(e-r)*(s-u)-(n-i)*(o-a);return h==0?!1:{x:c/h,y:l/h}},lli4:function(e,n,r,i){const o=e.x,s=e.y,a=n.x,u=n.y,c=r.x,l=r.y,h=i.x,f=i.y;return I.lli8(o,s,a,u,c,l,h,f)},lli:function(e,n){return I.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new se(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=Dr,r=Dr,i=jr,o=jr;return e.forEach(function(s){const a=s.bbox();n>a.x.min&&(n=a.x.min),r>a.y.min&&(r=a.y.min),i<a.x.max&&(i=a.x.max),o<a.y.max&&(o=a.y.max)}),{x:{min:n,mid:(n+i)/2,max:i,size:i-n},y:{min:r,mid:(r+o)/2,max:o,size:o-r}}},shapeintersections:function(e,n,r,i,o){if(!I.bboxoverlap(n,i))return[];const s=[],a=[e.startcap,e.forward,e.back,e.endcap],u=[r.startcap,r.forward,r.back,r.endcap];return a.forEach(function(c){c.virtual||u.forEach(function(l){if(l.virtual)return;const h=c.intersects(l,o);h.length>0&&(h.c1=c,h.c2=l,h.s1=e,h.s2=r,s.push(h))})}),s},makeshape:function(e,n,r){const i=n.points.length,o=e.points.length,s=I.makeline(n.points[i-1],e.points[0]),a=I.makeline(e.points[o-1],n.points[0]),u={startcap:s,forward:e,back:n,endcap:a,bbox:I.findbbox([s,e,n,a])};return u.intersections=function(c){return I.shapeintersections(u,u.bbox,c,c.bbox,r)},u},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=Dr,o=jr,s,a;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let u=0,c=r.length;u<c;u++)s=r[u],a=e.get(s),a[n]<i&&(i=a[n]),a[n]>o&&(o=a[n]);return{min:i,mid:(i+o)/2,max:o,size:o-i}},align:function(e,n){const r=n.p1.x,i=n.p1.y,o=-Jt(n.p2.y-i,n.p2.x-r),s=function(a){return{x:(a.x-r)*at(o)-(a.y-i)*At(o),y:(a.x-r)*At(o)+(a.y-i)*at(o)}};return e.map(s)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,i=I.align(e,n),o=function(x){return 0<=x&&x<=1};if(r===2){const x=i[0].y,P=i[1].y,M=i[2].y,$=x-2*P+M;if($!==0){const N=-ht(P*P-x*M),D=-x+P,H=-(N+D)/$,z=-(-N+D)/$;return[H,z].filter(o)}else if(P!==M&&$===0)return[(2*P-M)/(2*P-2*M)].filter(o);return[]}const s=i[0].y,a=i[1].y,u=i[2].y,c=i[3].y;let l=-s+3*a-3*u+c,h=3*s-6*a+3*u,f=-3*s+3*a,d=s;if(I.approximately(l,0)){if(I.approximately(h,0))return I.approximately(f,0)?[]:[-d/f].filter(o);const x=ht(f*f-4*h*d),P=2*h;return[(x-f)/P,(-f-x)/P].filter(o)}h/=l,f/=l,d/=l;const p=(3*f-h*h)/3,g=p/3,_=(2*h*h*h-9*h*f+27*d)/27,y=_/2,m=y*y+g*g*g;let w,C,b,v,k;if(m<0){const x=-p/3,P=x*x*x,M=ht(P),$=-_/(2*M),N=$<-1?-1:$>1?1:$,D=I1(N),H=Xt(M),z=2*H;return b=z*at(D/3)-h/3,v=z*at((D+Ln)/3)-h/3,k=z*at((D+2*Ln)/3)-h/3,[b,v,k].filter(o)}else{if(m===0)return w=y<0?Xt(-y):-Xt(y),b=2*w-h/3,v=-w-h/3,[b,v].filter(o);{const x=ht(m);return w=Xt(-y+x),C=Xt(y+x),[w-C-h/3].filter(o)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],i=e[2],o=n-2*r+i;if(o!==0){const s=-ht(r*r-n*i),a=-n+r,u=-(s+a)/o,c=-(-s+a)/o;return[u,c]}else if(r!==i&&o===0)return[(2*r-i)/(2*(r-i))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,i,o){let s,a,u,c,l=0,h=0;const f=I.compute(e,n),d=I.compute(e,r),p=f.x*f.x+f.y*f.y;if(i?(s=ht(Oe(f.y*d.z-d.y*f.z,2)+Oe(f.z*d.x-d.z*f.x,2)+Oe(f.x*d.y-d.x*f.y,2)),a=Oe(p+f.z*f.z,3/2)):(s=f.x*d.y-f.y*d.x,a=Oe(p,3/2)),s===0||a===0)return{k:0,r:0};if(l=s/a,h=a/s,!o){const g=I.curvature(e-.001,n,r,i,!0).k,_=I.curvature(e+.001,n,r,i,!0).k;c=(_-l+(l-g))/2,u=(Gt(_-l)+Gt(l-g))/2}return{k:l,r:h,dk:c,adk:u}},inflections:function(e){if(e.length<4)return[];const n=I.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,o=n[1].x*n[2].y,s=n[3].x*n[2].y,a=18*(-3*r+2*i+3*o-s),u=18*(3*r-i-3*o),c=18*(o-r);if(I.approximately(a,0)){if(!I.approximately(u,0)){let d=-c/u;if(0<=d&&d<=1)return[d]}return[]}const l=2*a;if(I.approximately(l,0))return[];const h=u*u-4*a*c;if(h<0)return[];const f=Math.sqrt(h);return[(f-u)/l,-(u+f)/l].filter(function(d){return 0<=d&&d<=1})},bboxoverlap:function(e,n){const r=["x","y"],i=r.length;for(let o=0,s,a,u,c;o<i;o++)if(s=r[o],a=e[s].mid,u=n[s].mid,c=(e[s].size+n[s].size)/2,Gt(a-u)>=c)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const i=e.bbox(),o=n.bbox(),s=1e5,a=r||.5;if(i.x.size+i.y.size<a&&o.x.size+o.y.size<a)return[(s*(e._t1+e._t2)/2|0)/s+"/"+(s*(n._t1+n._t2)/2|0)/s];let u=e.split(.5),c=n.split(.5),l=[{left:u.left,right:c.left},{left:u.left,right:c.right},{left:u.right,right:c.right},{left:u.right,right:c.left}];l=l.filter(function(f){return I.bboxoverlap(f.left.bbox(),f.right.bbox())});let h=[];return l.length===0||(l.forEach(function(f){h=h.concat(I.pairiteration(f.left,f.right,a))}),h=h.filter(function(f,d){return h.indexOf(f)===d})),h},getccenter:function(e,n,r){const i=n.x-e.x,o=n.y-e.y,s=r.x-n.x,a=r.y-n.y,u=i*at(dt)-o*At(dt),c=i*At(dt)+o*at(dt),l=s*at(dt)-a*At(dt),h=s*At(dt)+a*at(dt),f=(e.x+n.x)/2,d=(e.y+n.y)/2,p=(n.x+r.x)/2,g=(n.y+r.y)/2,_=f+u,y=d+c,m=p+l,w=g+h,C=I.lli8(f,d,_,y,p,g,m,w),b=I.dist(C,e);let v=Jt(e.y-C.y,e.x-C.x),k=Jt(n.y-C.y,n.x-C.x),x=Jt(r.y-C.y,r.x-C.x),P;return v<x?((v>k||k>x)&&(v+=Ln),v>x&&(P=x,x=v,v=P)):x<k&&k<v?(P=x,x=v,v=P):x+=Ln,C.s=v,C.e=x,C.r=b,C},numberSort:function(e,n){return e-n}};class an{constructor(n){this.curves=[],this._3d=!1,n&&(this.curves=n,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(n){return I.pointsToString(n.points)}).join(", ")+"]"}addCurve(n){this.curves.push(n),this._3d=this._3d||n._3d}length(){return this.curves.map(function(n){return n.length()}).reduce(function(n,r){return n+r})}curve(n){return this.curves[n]}bbox(){const n=this.curves;for(var r=n[0].bbox(),i=1;i<n.length;i++)I.expandbox(r,n[i].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(i){r.push(...i.offset(n))}),new an(r)}}const{abs:Kt,min:Es,max:As,cos:N1,sin:D1,acos:j1,sqrt:Yt}=Math,Z1=Math.PI;class se{constructor(n){let r=n&&n.forEach?n:Array.from(arguments).slice(),i=!1;if(typeof r[0]=="object"){i=r.length;const p=[];r.forEach(function(g){["x","y","z"].forEach(function(_){typeof g[_]<"u"&&p.push(g[_])})}),r=p}let o=!1;const s=r.length;if(i){if(i>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");o=!0}}else if(s!==6&&s!==8&&s!==9&&s!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const a=this._3d=!o&&(s===9||s===12)||n&&n[0]&&typeof n[0].z<"u",u=this.points=[];for(let p=0,g=a?3:2;p<s;p+=g){var c={x:r[p],y:r[p+1]};a&&(c.z=r[p+2]),u.push(c)}const l=this.order=u.length-1,h=this.dims=["x","y"];a&&h.push("z"),this.dimlen=h.length;const f=I.align(u,{p1:u[0],p2:u[l]}),d=I.dist(u[0],u[l]);this._linear=f.reduce((p,g)=>p+Kt(g.y),0)<d/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,i,o){if(typeof o>"u"&&(o=.5),o===0)return new se(r,r,i);if(o===1)return new se(n,r,r);const s=se.getABC(2,n,r,i,o);return new se(n,s.A,i)}static cubicFromPoints(n,r,i,o,s){typeof o>"u"&&(o=.5);const a=se.getABC(3,n,r,i,o);typeof s>"u"&&(s=I.dist(r,a.C));const u=s*(1-o)/o,c=I.dist(n,i),l=(i.x-n.x)/c,h=(i.y-n.y)/c,f=s*l,d=s*h,p=u*l,g=u*h,_={x:r.x-f,y:r.y-d},y={x:r.x+p,y:r.y+g},m=a.A,w={x:m.x+(_.x-m.x)/(1-o),y:m.y+(_.y-m.y)/(1-o)},C={x:m.x+(y.x-m.x)/o,y:m.y+(y.y-m.y)/o},b={x:n.x+(w.x-n.x)/o,y:n.y+(w.y-n.y)/o},v={x:i.x+(C.x-i.x)/(1-o),y:i.y+(C.y-i.y)/(1-o)};return new se(n,b,v,i)}static getUtils(){return I}getUtils(){return se.getUtils()}static get PolyBezier(){return an}valueOf(){return this.toString()}toString(){return I.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,i=n[0].y,o=["M",r,i,this.order===2?"Q":"C"];for(let s=1,a=n.length;s<a;s++)o.push(n[s].x),o.push(n[s].y);return o.join(" ")}setRatios(n){if(n.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=n,this._lut=[]}verify(){const n=this.coordDigest();n!==this._print&&(this._print=n,this.update())}coordDigest(){return this.points.map(function(n,r){return""+r+n.x+n.y+(n.z?n.z:0)}).join("")}update(){this._lut=[],this.dpoints=I.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=I.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return I.length(this.derivative.bind(this))}static getABC(n=2,r,i,o,s=.5){const a=I.projectionratio(s,n),u=1-a,c={x:a*r.x+u*o.x,y:a*r.y+u*o.y},l=I.abcratio(s,n);return{A:{x:i.x+(i.x-c.x)/l,y:i.y+(i.y-c.y)/l},B:i,C:c,S:r,E:o}}getABC(n,r){r=r||this.get(n);let i=this.points[0],o=this.points[this.order];return se.getABC(this.order,i,r,o,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,i,o;r<n;r++)o=r/(n-1),i=this.compute(o),i.t=o,this._lut.push(i);return this._lut}on(n,r){r=r||5;const i=this.getLUT(),o=[];for(let s=0,a,u=0;s<i.length;s++)a=i[s],I.dist(a,n)<r&&(o.push(a),u+=s/i.length);return o.length?t/=o.length:!1}project(n){const r=this.getLUT(),i=r.length-1,o=I.closest(r,n),s=o.mpos,a=(s-1)/i,u=(s+1)/i,c=.1/i;let l=o.mdist,h=a,f=h,d;l+=1;for(let p;h<u+c;h+=c)d=this.compute(h),p=I.dist(n,d),p<l&&(l=p,f=h);return f=f<0?0:f>1?1:f,d=this.compute(f),d.t=f,d.d=l,d}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?I.computeWithRatios(n,this.points,this.ratios,this._3d):I.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],i=n.length;for(let o=1,s,a;o<i;o++)s=n[o],a=n[o-1],r[o]={x:(i-o)/i*s.x+o/i*a.x,y:(i-o)/i*s.y+o/i*a.y};return r[i]=n[i-1],new se(r)}derivative(n){return I.compute(n,this.dpoints[0],this._3d)}dderivative(n){return I.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new se(I.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return I.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return I.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),i=Yt(r.x*r.x+r.y*r.y);return{t:n,x:-r.y/i,y:r.x/i}}__normal3(n){const r=this.derivative(n),i=this.derivative(n+.01),o=Yt(r.x*r.x+r.y*r.y+r.z*r.z),s=Yt(i.x*i.x+i.y*i.y+i.z*i.z);r.x/=o,r.y/=o,r.z/=o,i.x/=s,i.y/=s,i.z/=s;const a={x:i.y*r.z-i.z*r.y,y:i.z*r.x-i.x*r.z,z:i.x*r.y-i.y*r.x},u=Yt(a.x*a.x+a.y*a.y+a.z*a.z);a.x/=u,a.y/=u,a.z/=u;const c=[a.x*a.x,a.x*a.y-a.z,a.x*a.z+a.y,a.x*a.y+a.z,a.y*a.y,a.y*a.z-a.x,a.x*a.z-a.y,a.y*a.z+a.x,a.z*a.z];return{t:n,x:c[0]*r.x+c[1]*r.y+c[2]*r.z,y:c[3]*r.x+c[4]*r.y+c[5]*r.z,z:c[6]*r.x+c[7]*r.y+c[8]*r.z}}hull(n){let r=this.points,i=[],o=[],s=0;for(o[s++]=r[0],o[s++]=r[1],o[s++]=r[2],this.order===3&&(o[s++]=r[3]);r.length>1;){i=[];for(let a=0,u,c=r.length-1;a<c;a++)u=I.lerp(n,r[a],r[a+1]),o[s++]=u,i.push(u);r=i}return o}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;const i=this.hull(n),o={left:this.order===2?new se([i[0],i[3],i[5]]):new se([i[0],i[4],i[7],i[9]]),right:this.order===2?new se([i[5],i[4],i[2]]):new se([i[9],i[8],i[6],i[3]]),span:i};return o.left._t1=I.map(0,0,1,this._t1,this._t2),o.left._t2=I.map(n,0,1,this._t1,this._t2),o.right._t1=I.map(n,0,1,this._t1,this._t2),o.right._t2=I.map(1,0,1,this._t1,this._t2),r?(r=I.map(r,n,1,0,1),o.right.split(r).left):o}extrema(){const n={};let r=[];return this.dims.forEach((function(i){let o=function(a){return a[i]},s=this.dpoints[0].map(o);n[i]=I.droots(s),this.order===3&&(s=this.dpoints[1].map(o),n[i]=n[i].concat(I.droots(s))),n[i]=n[i].filter(function(a){return a>=0&&a<=1}),r=r.concat(n[i].sort(I.numberSort))}).bind(this)),n.values=r.sort(I.numberSort).filter(function(i,o){return r.indexOf(i)===o}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(i){r[i]=I.getminmax(this,i,n[i])}).bind(this)),r}overlaps(n){const r=this.bbox(),i=n.bbox();return I.bboxoverlap(r,i)}offset(n,r){if(typeof r<"u"){const i=this.get(n),o=this.normal(n),s={c:i,n:o,x:i.x+o.x*r,y:i.y+o.y*r};return this._3d&&(s.z=i.z+o.z*r),s}if(this._linear){const i=this.normal(0),o=this.points.map(function(s){const a={x:s.x+n*i.x,y:s.y+n*i.y};return s.z&&i.z&&(a.z=s.z+n*i.z),a});return[new se(o)]}return this.reduce().map(function(i){return i._linear?i.offset(n)[0]:i.scale(n)})}simple(){if(this.order===3){const o=I.angle(this.points[0],this.points[3],this.points[1]),s=I.angle(this.points[0],this.points[3],this.points[2]);if(o>0&&s<0||o<0&&s>0)return!1}const n=this.normal(0),r=this.normal(1);let i=n.x*r.x+n.y*r.y;return this._3d&&(i+=n.z*r.z),Kt(j1(i))<Z1/3}reduce(){let n,r=0,i=0,o=.01,s,a=[],u=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),r=c[0],n=1;n<c.length;n++)i=c[n],s=this.split(r,i),s._t1=r,s._t2=i,a.push(s),r=i;return a.forEach(function(l){for(r=0,i=0;i<=1;)for(i=r+o;i<=1+o;i+=o)if(s=l.split(r,i),!s.simple()){if(i-=o,Kt(r-i)<o)return[];s=l.split(r,i),s._t1=I.map(r,0,1,l._t1,l._t2),s._t2=I.map(i,0,1,l._t1,l._t2),u.push(s),r=i;break}r<1&&(s=l.split(r,1),s._t1=I.map(r,0,1,l._t1,l._t2),s._t2=l._t2,u.push(s))}),u}translate(n,r,i){i=typeof i=="number"?i:r;const o=this.order;let s=this.points.map((a,u)=>(1-u/o)*r+u/o*i);return new se(this.points.map((a,u)=>({x:a.x+n.x*s[u],y:a.y+n.y*s[u]})))}scale(n){const r=this.order;let i=!1;if(typeof n=="function"&&(i=n),i&&r===2)return this.raise().scale(i);const o=this.clockwise,s=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);const a=i?i(0):n,u=i?i(1):n,c=[this.offset(0,10),this.offset(1,10)],l=[],h=I.lli4(c[0],c[0].c,c[1],c[1].c);if(!h)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(f){const d=l[f*r]=I.copy(s[f*r]);d.x+=(f?u:a)*c[f].n.x,d.y+=(f?u:a)*c[f].n.y}),i?([0,1].forEach(function(f){if(!(r===2&&f)){var d=s[f+1],p={x:d.x-h.x,y:d.y-h.y},g=i?i((f+1)/r):n;i&&!o&&(g=-g);var _=Yt(p.x*p.x+p.y*p.y);p.x/=_,p.y/=_,l[f+1]={x:d.x+g*p.x,y:d.y+g*p.y}}}),new se(l)):([0,1].forEach(f=>{if(r===2&&f)return;const d=l[f*r],p=this.derivative(f),g={x:d.x+p.x,y:d.y+p.y};l[f+1]=I.lli4(d,g,h,s[f+1])}),new se(l))}outline(n,r,i,o){if(r=r===void 0?n:r,this._linear){const v=this.normal(0),k=this.points[0],x=this.points[this.points.length-1];let P,M,$;i===void 0&&(i=n,o=r),P={x:k.x+v.x*n,y:k.y+v.y*n},$={x:x.x+v.x*i,y:x.y+v.y*i},M={x:(P.x+$.x)/2,y:(P.y+$.y)/2};const N=[P,M,$];P={x:k.x-v.x*r,y:k.y-v.y*r},$={x:x.x-v.x*o,y:x.y-v.y*o},M={x:(P.x+$.x)/2,y:(P.y+$.y)/2};const D=[$,M,P],H=I.makeline(D[2],N[0]),z=I.makeline(N[2],D[0]),O=[H,new se(N),z,new se(D)];return new an(O)}const s=this.reduce(),a=s.length,u=[];let c=[],l,h=0,f=this.length();const d=typeof i<"u"&&typeof o<"u";function p(v,k,x,P,M){return function($){const N=P/x,D=(P+M)/x,H=k-v;return I.map($,0,1,v+N*H,v+D*H)}}s.forEach(function(v){const k=v.length();d?(u.push(v.scale(p(n,i,f,h,k))),c.push(v.scale(p(-r,-o,f,h,k)))):(u.push(v.scale(n)),c.push(v.scale(-r))),h+=k}),c=c.map(function(v){return l=v.points,l[3]?v.points=[l[3],l[2],l[1],l[0]]:v.points=[l[2],l[1],l[0]],v}).reverse();const g=u[0].points[0],_=u[a-1].points[u[a-1].points.length-1],y=c[a-1].points[c[a-1].points.length-1],m=c[0].points[0],w=I.makeline(y,g),C=I.makeline(_,m),b=[w].concat(u).concat([C]).concat(c);return new an(b)}outlineshapes(n,r,i){r=r||n;const o=this.outline(n,r).curves,s=[];for(let a=1,u=o.length;a<u/2;a++){const c=I.makeshape(o[a],o[u-a],i);c.startcap.virtual=a>1,c.endcap.virtual=a<u/2-1,s.push(c)}return s}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof se&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(n){const r=Es(n.p1.x,n.p2.x),i=Es(n.p1.y,n.p2.y),o=As(n.p1.x,n.p2.x),s=As(n.p1.y,n.p2.y);return I.roots(this.points,n).filter(a=>{var u=this.get(a);return I.between(u.x,r,o)&&I.between(u.y,i,s)})}selfintersects(n){const r=this.reduce(),i=r.length-2,o=[];for(let s=0,a,u,c;s<i;s++)u=r.slice(s,s+1),c=r.slice(s+2),a=this.curveintersects(u,c,n),o.push(...a);return o}curveintersects(n,r,i){const o=[];n.forEach(function(a){r.forEach(function(u){a.overlaps(u)&&o.push({left:a,right:u})})});let s=[];return o.forEach(function(a){const u=I.pairiteration(a.left,a.right,i);u.length>0&&(s=s.concat(u))}),s}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,i,o){const s=(o-i)/4,a=this.get(i+s),u=this.get(o-s),c=I.dist(n,r),l=I.dist(n,a),h=I.dist(n,u);return Kt(l-c)+Kt(h-c)}_iterate(n,r){let i=0,o=1,s;do{s=0,o=1;let a=this.get(i),u,c,l,h,f=!1,d=!1,p,g=o,_=1;do if(d=f,h=l,g=(i+o)/2,u=this.get(g),c=this.get(o),l=I.getccenter(a,u,c),l.interval={start:i,end:o},f=this._error(l,a,i,o)<=n,p=d&&!f,p||(_=o),f){if(o>=1){if(l.interval.end=_=1,h=l,o>1){let m={x:l.x+l.r*N1(l.e),y:l.y+l.r*D1(l.e)};l.e+=I.angle({x:l.x,y:l.y},m,this.get(1))}break}o=o+(o-i)/2}else o=g;while(!p&&s++<100);if(s>=100)break;h=h||l,r.push(h),i=_}while(o<1);return r}}function ui(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function q1(e){if(Array.isArray(e))return e}function U1(e){if(Array.isArray(e))return ui(e)}function L1(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function F1(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,s,a,u=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(i=s.call(r)).done)&&(u.push(i.value),u.length!==n);c=!0);}catch(h){l=!0,o=h}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}function H1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
99
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
100
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B1(e,n){if(e==null)return{};var r,i,o=W1(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)r=s[i],n.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function W1(e,n){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.includes(i))continue;r[i]=e[i]}return r}function G1(e,n){return q1(e)||F1(e,n)||Lu(e,n)||H1()}function J1(e){return U1(e)||L1(e)||Lu(e)||V1()}function X1(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function K1(e){var n=X1(e,"string");return typeof n=="symbol"?n:n+""}function Lu(e,n){if(e){if(typeof e=="string")return ui(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ui(e,n):void 0}}var Y1=(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=(n instanceof Array?n.length?n:[void 0]:[n]).map(function(u){return{keyAccessor:u,isProp:!(u instanceof Function)}}),s=e.reduce(function(u,c){var l=u,h=c;return o.forEach(function(f,d){var p=f.keyAccessor,g=f.isProp,_;if(g){var y=h,m=y[p],w=B1(y,[p].map(K1));_=m,h=w}else _=p(h,d);d+1<o.length?(l.hasOwnProperty(_)||(l[_]={}),l=l[_]):r?(l.hasOwnProperty(_)||(l[_]=[]),l[_].push(h)):l[_]=h}),u},{});r instanceof Function&&(function u(c){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;l===o.length?Object.keys(c).forEach(function(h){return c[h]=r(c[h])}):Object.values(c).forEach(function(h){return u(h,l+1)})})(s);var a=s;return i&&(a=[],(function u(c){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];l.length===o.length?a.push({keys:l,vals:c}):Object.entries(c).forEach(function(h){var f=G1(h,2),d=f[0],p=f[1];return u(p,[].concat(J1(l),[d]))})})(s),n instanceof Array&&n.length===0&&a.length===1&&(a[0].keys=[])),a});function Q1(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}const Rs=Symbol("implicit");function Fu(){var e=new os,n=[],r=[],i=Rs;function o(s){let a=e.get(s);if(a===void 0){if(i!==Rs)return i;e.set(s,a=n.push(s)-1)}return r[a%r.length]}return o.domain=function(s){if(!arguments.length)return n.slice();n=[],e=new os;for(const a of s)e.has(a)||e.set(a,n.push(a)-1);return o},o.range=function(s){return arguments.length?(r=Array.from(s),o):r.slice()},o.unknown=function(s){return arguments.length?(i=s,o):i},o.copy=function(){return Fu(n,r).unknown(i)},Q1.apply(o,arguments),o}function ew(e){for(var n=e.length/6|0,r=new Array(n),i=0;i<n;)r[i]="#"+e.slice(i*6,++i*6);return r}const tw=ew("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function nw(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var rw=`.force-graph-container canvas {
|
|
101
101
|
display: block;
|
|
102
102
|
user-select: none;
|
|
103
103
|
outline: none;
|
|
@@ -120,10 +120,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
120
120
|
cursor: -moz-grabbing;
|
|
121
121
|
cursor: -webkit-grabbing;
|
|
122
122
|
}
|
|
123
|
-
`;
|
|
124
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
125
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $s(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function Rt(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?$s(Object(r),!0).forEach(function(i){yn(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$s(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function un(e,n){return rw(e)||sw(e,n)||Fu(e,n)||aw()}function je(e){return iw(e)||ow(e)||Fu(e)||uw()}function cw(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function lw(e){var n=cw(e,"string");return typeof n=="symbol"?n:n+""}function li(e){"@babel/helpers - typeof";return li=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},li(e)}function Fu(e,n){if(e){if(typeof e=="string")return ci(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ci(e,n):void 0}}var fw=Uu(ew);function Is(e,n,r){!n||typeof r!="string"||e.filter(function(i){return!i[r]}).forEach(function(i){i[r]=fw(n(i))})}function hw(e,n){var r=e.nodes,i=e.links,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=o.nodeFilter,a=s===void 0?function(){return!0}:s,u=o.onLoopError,c=u===void 0?function(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:u,l={};r.forEach(function(p){return l[n(p)]={data:p,out:[],depth:-1,skip:!a(p)}}),i.forEach(function(p){var g=p.source,_=p.target,y=b(g),m=b(_);if(!l.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!l.hasOwnProperty(m))throw"Missing target node with id: ".concat(m);var w=l[y],C=l[m];w.out.push(C);function b(v){return li(v)==="object"?n(v):v}});var h=[];d(Object.values(l));var f=Object.assign.apply(Object,[{}].concat(je(Object.entries(l).filter(function(p){var g=un(p,2),_=g[1];return!_.skip}).map(function(p){var g=un(p,2),_=g[0],y=g[1];return yn({},_,y.depth)}))));return f;function d(p){for(var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var b=p[m];if(g.indexOf(b)!==-1){var v=[].concat(je(g.slice(g.indexOf(b))),[b]).map(function(k){return n(k.data)});return h.some(function(k){return k.length===v.length&&k.every(function(x,P){return x===v[P]})})||(h.push(v),c(v)),1}_>b.depth&&(b.depth=_,d(b.out,[].concat(je(g),[b]),_+(b.skip?0:1)))},m=0,w=p.length;m<w;m++)y()}}var dw=2,we=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},Ms=function(n,r){if(!r.isShadow){var i=Y(r.linkDirectionalParticles);r.graphData.links.forEach(function(o){var s=Math.round(Math.abs(i(o)));s?o.__photons=je(Array(s)).map(function(){return{}}):delete o.__photons})}},fr=to({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,Ms(n,r)}},dagMode:{onChange:function(n,r){!n&&(r.graphData.nodes||[]).forEach(function(i){return i.fx=i.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:we},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:we},nodeColor:{default:"color",triggerUpdate:!1,onChange:we},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:we},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:we},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:we},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:we},linkColor:{default:"color",triggerUpdate:!1,onChange:we},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:we},linkWidth:{default:1,triggerUpdate:!1,onChange:we},linkCurvature:{default:0,triggerUpdate:!1,onChange:we},linkCanvasObject:{triggerUpdate:!1,onChange:we},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:we},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:we},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:we},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:we},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:Ms},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,r,i){return i===void 0?n.forceLayout.force(r):(n.forceLayout.force(r,i),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&r(),o(),!n.isShadow&&s(),!n.isShadow&&a(),i(),this;function r(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin?(n.engineRunning=!1,n.onEngineStop()):(n.forceLayout.tick(),n.onEngineTick()))}function i(){var u=Y(n.nodeVisibility),c=Y(n.nodeVal),l=Y(n.nodeColor),h=Y(n.nodeCanvasObjectMode),f=n.ctx,d=n.isShadow/n.globalScale,p=n.graphData.nodes.filter(u);f.save(),p.forEach(function(g){var _=h(g);if(n.nodeCanvasObject&&(_==="before"||_==="replace")&&(n.nodeCanvasObject(g,f,n.globalScale),_==="replace")){f.restore();return}var y=Math.sqrt(Math.max(0,c(g)||1))*n.nodeRelSize+d;f.beginPath(),f.arc(g.x,g.y,y,0,2*Math.PI,!1),f.fillStyle=l(g)||"rgba(31, 120, 180, 0.92)",f.fill(),n.nodeCanvasObject&&_==="after"&&n.nodeCanvasObject(g,n.ctx,n.globalScale)}),f.restore()}function o(){var u=Y(n.linkVisibility),c=Y(n.linkColor),l=Y(n.linkWidth),h=Y(n.linkLineDash),f=Y(n.linkCurvature),d=Y(n.linkCanvasObjectMode),p=n.ctx,g=n.isShadow*2,_=n.graphData.links.filter(u);_.forEach(k);var y=[],m=[],w=_;if(n.linkCanvasObject){var C=[],b=[];_.forEach(function(x){return({before:y,after:m,replace:C}[d(x)]||b).push(x)}),w=[].concat(je(y),m,b),y=y.concat(C)}p.save(),y.forEach(function(x){return n.linkCanvasObject(x,p,n.globalScale)}),p.restore();var v=K1(w,[c,l,h]);p.save(),Object.entries(v).forEach(function(x){var P=un(x,2),M=P[0],$=P[1],N=!M||M==="undefined"?"rgba(0,0,0,0.15)":M;Object.entries($).forEach(function(D){var H=un(D,2),z=H[0],O=H[1],R=(z||1)/n.globalScale+g;Object.entries(O).forEach(function(j){var F=un(j,2);F[0];var q=F[1],V=h(q[0]);p.beginPath(),q.forEach(function(L){var W=L.source,ee=L.target;if(!(!W||!ee||!W.hasOwnProperty("x")||!ee.hasOwnProperty("x"))){p.moveTo(W.x,W.y);var K=L.__controlPoints;K?p[K.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(p,je(K).concat([ee.x,ee.y])):p.lineTo(ee.x,ee.y)}}),p.strokeStyle=N,p.lineWidth=R,p.setLineDash(V||[]),p.stroke()})})}),p.restore(),p.save(),m.forEach(function(x){return n.linkCanvasObject(x,p,n.globalScale)}),p.restore();function k(x){var P=f(x);if(!P){x.__controlPoints=null;return}var M=x.source,$=x.target;if(!(!M||!$||!M.hasOwnProperty("x")||!$.hasOwnProperty("x"))){var N=Math.sqrt(Math.pow($.x-M.x,2)+Math.pow($.y-M.y,2));if(N>0){var D=Math.atan2($.y-M.y,$.x-M.x),H=N*P,z={x:(M.x+$.x)/2+H*Math.cos(D-Math.PI/2),y:(M.y+$.y)/2+H*Math.sin(D-Math.PI/2)};x.__controlPoints=[z.x,z.y]}else{var O=P*70;x.__controlPoints=[$.x,$.y-O,$.x+O,$.y]}}}}function s(){var u=1.6,c=.2,l=Y(n.linkDirectionalArrowLength),h=Y(n.linkDirectionalArrowRelPos),f=Y(n.linkVisibility),d=Y(n.linkDirectionalArrowColor||n.linkColor),p=Y(n.nodeVal),g=n.ctx;g.save(),n.graphData.links.filter(f).forEach(function(_){var y=l(_);if(!(!y||y<0)){var m=_.source,w=_.target;if(!(!m||!w||!m.hasOwnProperty("x")||!w.hasOwnProperty("x"))){var C=Math.sqrt(Math.max(0,p(m)||1))*n.nodeRelSize,b=Math.sqrt(Math.max(0,p(w)||1))*n.nodeRelSize,v=Math.min(1,Math.max(0,h(_))),k=d(_)||"rgba(0,0,0,0.28)",x=y/u/2,P=_.__controlPoints&&Rs(se,[m.x,m.y].concat(je(_.__controlPoints),[w.x,w.y])),M=P?function(R){return P.get(R)}:function(R){return{x:m.x+(w.x-m.x)*R||0,y:m.y+(w.y-m.y)*R||0}},$=P?P.length():Math.sqrt(Math.pow(w.x-m.x,2)+Math.pow(w.y-m.y,2)),N=C+y+($-C-b-y)*v,D=M(N/$),H=M((N-y)/$),z=M((N-y*(1-c))/$),O=Math.atan2(D.y-H.y,D.x-H.x)-Math.PI/2;g.beginPath(),g.moveTo(D.x,D.y),g.lineTo(H.x+x*Math.cos(O),H.y+x*Math.sin(O)),g.lineTo(z.x,z.y),g.lineTo(H.x-x*Math.cos(O),H.y-x*Math.sin(O)),g.fillStyle=k,g.fill()}}}),g.restore()}function a(){var u=Y(n.linkDirectionalParticles),c=Y(n.linkDirectionalParticleSpeed),l=Y(n.linkDirectionalParticleOffset),h=Y(n.linkDirectionalParticleWidth),f=Y(n.linkVisibility),d=Y(n.linkDirectionalParticleColor||n.linkColor),p=n.ctx;p.save(),n.graphData.links.filter(f).forEach(function(g){var _=u(g);if(!(!g.hasOwnProperty("__photons")||!g.__photons.length)){var y=g.source,m=g.target;if(!(!y||!m||!y.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var w=c(g),C=Math.abs(l(g)),b=g.__photons||[],v=Math.max(0,h(g)/2)/Math.sqrt(n.globalScale),k=d(g)||"rgba(0,0,0,0.28)";p.fillStyle=k;var x=g.__controlPoints?Rs(se,[y.x,y.y].concat(je(g.__controlPoints),[m.x,m.y])):null,P=0,M=!1;b.forEach(function($){var N=!!$.__singleHop;if($.hasOwnProperty("__progressRatio")||($.__progressRatio=N?0:(P+C)/_),!N&&P++,$.__progressRatio+=w,$.__progressRatio>=1)if(!N)$.__progressRatio=$.__progressRatio%1;else{M=!0;return}var D=$.__progressRatio,H=x?x.get(D):{x:y.x+(m.x-y.x)*D||0,y:y.y+(m.y-y.y)*D||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(H.x,H.y,g,p,n.globalScale):(p.beginPath(),p.arc(H.x,H.y,v,0,2*Math.PI,!1),p.fill())}),M&&(g.__photons=g.__photons.filter(function($){return!$.__singleHop||$.__progressRatio<=1}))}}}),p.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:p_().force("link",Fa()).force("charge",Ba()).force("center",Za()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Is(n.graphData.nodes,Y(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Is(n.graphData.links,Y(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(d){d.source=d[n.linkSource],d.target=d[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(d){return d[n.nodeId]}).links(n.graphData.links);var o=n.dagMode&&hw(n.graphData,function(d){return d[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),s=Math.max.apply(Math,je(Object.values(o||[]))),a=n.dagLevelDistance||n.graphData.nodes.length/(s||1)*dw*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var u=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return delete d[u]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var c=["rl","bu"].includes(n.dagMode),l=function(p){return(o[p[n.nodeId]]-s/2)*a*(c?-1:1)},h=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return d[h]=l(d)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?g_(function(d){var p=o[d[n.nodeId]]||-1;return(n.dagMode==="radialin"?s-p:p)*a}).strength(function(d){return n.dagNodeFilter(d)?1:0}):null);for(var f=0;f<n.warmupTicks&&!(n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin);f++)n.forceLayout.tick();this.resetCountdown(),n.onFinishUpdate()}});function Hu(e,n){var r=e instanceof Array?e:[e],i=new n;return i._destructor&&i._destructor(),{linkProp:function(s){return{default:i[s](),onChange:function(u,c){r.forEach(function(l){return c[l][s](u)})},triggerUpdate:!1}},linkMethod:function(s){return function(a){for(var u=arguments.length,c=new Array(u>1?u-1:0),l=1;l<u;l++)c[l-1]=arguments[l];var h=[];return r.forEach(function(f){var d=a[f],p=d[s].apply(d,c);p!==d&&h.push(p)}),h.length?h[0]:this}}}}var pw=800,gw=4,mw=5,Vu=Hu("forceGraph",fr),_w=Hu(["forceGraph","shadowGraph"],fr),yw=Object.assign.apply(Object,je(["nodeColor","nodeAutoColorBy","nodeCanvasObject","nodeCanvasObjectMode","linkColor","linkAutoColorBy","linkLineDash","linkWidth","linkCanvasObject","linkCanvasObjectMode","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleCanvasObject","dagMode","dagLevelDistance","dagNodeFilter","onDagError","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(e){return yn({},e,Vu.linkProp(e))})).concat(je(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return yn({},e,_w.linkProp(e))})))),vw=Object.assign.apply(Object,je(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return yn({},e,Vu.linkMethod(e))})));function Zr(e){if(e.canvas){var n=e.canvas.width,r=e.canvas.height;n===300&&r===150&&(n=r=0);var i=window.devicePixelRatio;n/=i,r/=i,[e.canvas,e.shadowCanvas].forEach(function(s){s.style.width="".concat(e.width,"px"),s.style.height="".concat(e.height,"px"),s.width=e.width*i,s.height=e.height*i,!n&&!r&&s.getContext("2d").scale(i,i)});var o=Xe(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/o,(e.height-r)/2/o),e.needsRedraw=!0}}function Bu(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function Os(e,n,r){e.save(),Bu(e),e.clearRect(0,0,n,r),e.restore()}var bw=to({props:Rt({width:{default:window.innerWidth,onChange:function(n,r){return Zr(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return Zr(r)},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(n,r){[n.nodes,n.links].every(function(o){return(o||[]).every(function(s){return!s.hasOwnProperty("__indexColor")})})&&r.colorTracker.reset(),[{type:"Node",objs:n.nodes},{type:"Link",objs:n.links}].forEach(i),r.forceGraph.graphData(n),r.shadowGraph.graphData(n);function i(o){var s=o.type,a=o.objs;a.filter(function(u){if(!u.hasOwnProperty("__indexColor"))return!0;var c=r.colorTracker.lookup(u.__indexColor);return!c||!c.hasOwnProperty("d")||c.d!==u}).forEach(function(u){u.__indexColor=r.colorTracker.register({type:s,d:u})})}},triggerUpdate:!1},backgroundColor:{onChange:function(n,r){r.canvas&&n&&(r.canvas.style.background=n)},triggerUpdate:!1},nodeLabel:{default:"name",triggerUpdate:!1},nodePointerAreaPaint:{onChange:function(n,r){r.shadowGraph.nodeCanvasObject(n?function(i,o,s){return n(i,i.__indexColor,o,s)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkPointerAreaPaint:{onChange:function(n,r){r.shadowGraph.linkCanvasObject(n?function(i,o,s){return n(i,i.__indexColor,o,s)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:4,triggerUpdate:!1},minZoom:{default:.01,onChange:function(n,r){r.zoom.scaleExtent([n,r.zoom.scaleExtent()[1]])},triggerUpdate:!1},maxZoom:{default:1e3,onChange:function(n,r){r.zoom.scaleExtent([r.zoom.scaleExtent()[0],n])},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},enableZoomInteraction:{default:!0,triggerUpdate:!1},enablePanInteraction:{default:!0,triggerUpdate:!1},enableZoomPanInteraction:{default:!0,triggerUpdate:!1},enablePointerInteraction:{default:!0,onChange:function(n,r){r.hoverObj=null},triggerUpdate:!1},autoPauseRedraw:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},onZoom:{triggerUpdate:!1},onZoomEnd:{triggerUpdate:!1},onRenderFramePre:{triggerUpdate:!1},onRenderFramePost:{triggerUpdate:!1}},yw),aliases:{stopAnimation:"pauseAnimation"},methods:Rt({graph2ScreenCoords:function(n,r,i){var o=Xe(n.canvas);return{x:r*o.k+o.x,y:i*o.k+o.y}},screen2GraphCoords:function(n,r,i){var o=Xe(n.canvas);return{x:(r-o.x)/o.k,y:(i-o.y)/o.k}},centerAt:function(n,r,i,o){if(!n.canvas)return null;if(r!==void 0||i!==void 0){var s=Object.assign({},r!==void 0?{x:r}:{},i!==void 0?{y:i}:{});return o?n.tweenGroup.add(new fs(a()).to(s,o).easing(Tt.Quadratic.Out).onUpdate(u).start()):u(s),this}return a();function a(){var c=Xe(n.canvas);return{x:(n.width/2-c.x)/c.k,y:(n.height/2-c.y)/c.k}}function u(c){var l=c.x,h=c.y;n.zoom.translateTo(n.zoom.__baseElem,l===void 0?a().x:l,h===void 0?a().y:h),n.needsRedraw=!0}},zoom:function(n,r,i){if(!n.canvas)return null;if(r!==void 0)return i?n.tweenGroup.add(new fs({k:o()}).to({k:r},i).easing(Tt.Quadratic.Out).onUpdate(function(a){var u=a.k;return s(u)}).start()):s(r),this;return o();function o(){return Xe(n.canvas).k}function s(a){n.zoom.scaleTo(n.zoom.__baseElem,a),n.needsRedraw=!0}},zoomToFit:function(n){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,s=new Array(o>3?o-3:0),a=3;a<o;a++)s[a-3]=arguments[a];var u=this.getGraphBbox.apply(this,s);if(u){var c={x:(u.x[0]+u.x[1])/2,y:(u.y[0]+u.y[1])/2},l=Math.max(1e-12,Math.min(1e12,(n.width-i*2)/(u.x[1]-u.x[0]),(n.height-i*2)/(u.y[1]-u.y[0])));this.centerAt(c.x,c.y,r),this.zoom(l,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},i=Y(n.nodeVal),o=function(u){return Math.sqrt(Math.max(0,i(u)||1))*n.nodeRelSize},s=n.graphData.nodes.filter(r).map(function(a){return{x:a.x,y:a.y,r:o(a)}});return s.length?{x:[as(s,function(a){return a.x-a.r}),ss(s,function(a){return a.x+a.r})],y:[as(s,function(a){return a.y-a.r}),ss(s,function(a){return a.y+a.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},vw),stateInit:function(){return{lastSetZoom:1,zoom:qv(),forceGraph:new fr,shadowGraph:new fr().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new l1,tweenGroup:new bu}},init:function(n,r){var i=this;n.innerHTML="";var o=document.createElement("div");o.classList.add("force-graph-container"),o.style.position="relative",n.appendChild(o),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),o.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var s=r.canvas.getContext("2d"),a=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),u={x:-1e12,y:-1e12},c=function(){var f=null,d=window.devicePixelRatio,p=u.x>0&&u.y>0?a.getImageData(u.x*d,u.y*d,1,1):null;return p&&(f=r.colorTracker.lookup(p.data)),f};De(r.canvas).call(ey().subject(function(){if(!r.enableNodeDrag)return null;var h=c();return h&&h.type==="Node"?h.d:null}).on("start",function(h){var f=h.subject;f.__initialDragPos={x:f.x,y:f.y,fx:f.fx,fy:f.fy},h.active||(f.fx=f.x,f.fy=f.y),r.canvas.classList.add("grabbable")}).on("drag",function(h){var f=h.subject,d=f.__initialDragPos,p=h,g=Xe(r.canvas).k,_={x:d.x+(p.x-d.x)/g-f.x,y:d.y+(p.y-d.y)/g-f.y};["x","y"].forEach(function(y){return f["f".concat(y)]=f[y]=d[y]+(p[y]-d[y])/g}),!(!f.__dragged&&mw>=Math.sqrt(Hv(["x","y"].map(function(y){return Math.pow(h[y]-d[y],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,f.__dragged=!0,r.onNodeDrag(f,_))}).on("end",function(h){var f=h.subject,d=f.__initialDragPos,p={x:f.x-d.x,y:f.y-d.y};d.fx===void 0&&(f.fx=void 0),d.fy===void 0&&(f.fy=void 0),delete f.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,f.__dragged&&(delete f.__dragged,r.onNodeDragEnd(f,p))})),r.zoom(r.zoom.__baseElem=De(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(h){return!h.button&&r.enableZoomPanInteraction&&(h.type!=="wheel"||Y(r.enableZoomInteraction)(h))&&(h.type==="wheel"||Y(r.enablePanInteraction)(h))}).on("zoom",function(h){var f=h.transform;[s,a].forEach(function(d){Bu(d),d.translate(f.x,f.y),d.scale(f.k,f.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Rt(Rt({},f),i.centerAt())),r.needsRedraw=!0}).on("end",function(h){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Rt(Rt({},h.transform),i.centerAt()))}),Zr(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){Xe(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=gw/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new R1(o),["pointermove","pointerdown"].forEach(function(h){return o.addEventListener(h,function(f){h==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=f),!r.isPointerDragging&&f.type==="pointermove"&&r.onBackgroundClick&&(f.pressure>0||r.isPointerPressed)&&(f.pointerType==="mouse"||f.movementX===void 0||[f.movementX,f.movementY].some(function(g){return Math.abs(g)>1}))&&(r.isPointerDragging=!0);var d=p(o);u.x=f.pageX-d.left,u.y=f.pageY-d.top;function p(g){var _=g.getBoundingClientRect(),y=window.pageXOffset||document.documentElement.scrollLeft,m=window.pageYOffset||document.documentElement.scrollTop;return{top:_.top+m,left:_.left+y}}},{passive:!0})}),o.addEventListener("pointerup",function(h){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var f=[h,r.pointerDownEvent];requestAnimationFrame(function(){if(h.button===0)if(r.hoverObj){var d=r["on".concat(r.hoverObj.type,"Click")];d&&d.apply(void 0,[r.hoverObj.d].concat(f))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,f);if(h.button===2)if(r.hoverObj){var p=r["on".concat(r.hoverObj.type,"RightClick")];p&&p.apply(void 0,[r.hoverObj.d].concat(f))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,f)})}},{passive:!0}),o.addEventListener("contextmenu",function(h){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(h.preventDefault(),!1)}),r.forceGraph(s),r.shadowGraph(a);var l=_b(function(){Os(a,r.width,r.height),r.shadowGraph.linkWidth(function(f){return Y(r.linkWidth)(f)+r.linkHoverPrecision});var h=Xe(r.canvas);r.shadowGraph.globalScale(h.k).tickFrame()},pw);r.flushShadowCanvas=l.flush,(this._animationCycle=function h(){var f=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(C){return C.__photons&&C.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var d=r.isPointerDragging?null:c();if(d!==r.hoverObj){var p=r.hoverObj,g=p?p.type:null,_=d?d.type:null;if(g&&g!==_){var y=r["on".concat(g,"Hover")];y&&y(null,p.d)}if(_){var m=r["on".concat(_,"Hover")];m&&m(d.d,g===_?p.d:null)}r.tooltip.content(d&&Y(r["".concat(d.type.toLowerCase(),"Label")])(d.d)||null),r.canvas.classList[(d&&r["on".concat(_,"Click")]||!d&&r.onBackgroundClick)&&Y(r.showPointerCursor)(d==null?void 0:d.d)?"add":"remove"]("clickable"),r.hoverObj=d}f&&l()}if(f){Os(s,r.width,r.height);var w=Xe(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(s,w),r.forceGraph.globalScale(w).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(s,w)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(h)})()},update:function(n){}});function Fn(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||"#000"}const Re={nodes:[],links:[]};let Pt=null,on=null;const Wu=document.getElementById("graph"),gt=document.getElementById("popup"),ww=gt.querySelector(".popup-title"),qr=gt.querySelector(".popup-error"),xw=document.getElementById("open-btn"),Ve=document.getElementById("expand-btn"),kw=document.getElementById("zoom-in"),Sw=document.getElementById("zoom-out"),zw=document.getElementById("reset-graph"),Ze=new bw(Wu).nodeId("url").nodeLabel("title").nodeColor(e=>{switch(e.state){case"expanded":return Fn("--node-expanded");case"error":return Fn("--node-error");default:return Fn("--node-default")}}).nodeVal(8).linkDirectionalArrowLength(6).linkDirectionalArrowRelPos(1).linkColor(()=>Fn("--link-color")).onNodeClick(Ew).onBackgroundClick(()=>Rn()).d3Force("charge",Ba().strength(-80)).d3Force("link",Fa().distance(60)).d3Force("collide",Ym(12)).d3Force("center",Za()).d3VelocityDecay(.3).cooldownTime(1/0).d3AlphaMin(0).d3Force("ambient",()=>{for(const e of Re.nodes)e.vx!==void 0&&e.vy!==void 0&&(e.vx+=(Math.random()-.5)*.1,e.vy+=(Math.random()-.5)*.1)}).graphData(Re);function Ju(){const{width:e,height:n}=Wu.getBoundingClientRect();Ze.width(e).height(n)}window.addEventListener("resize",Ju);Ju();function hr(e,n,r="default",i){if(Re.nodes.find(a=>a.url===e))return!1;const s={url:e,title:n,state:r};return i&&(s.x=i.x+(Math.random()-.5)*20,s.y=i.y+(Math.random()-.5)*20),Re.nodes.push(s),!0}function Tw(e,n){const r=Re.nodes.find(i=>i.url===e);r&&(r.title=n)}function fi(e,n,r){const i=Re.nodes.find(o=>o.url===e);i&&(i.state=n,i.errorMessage=r)}function Cw(e,n){return Re.links.find(i=>{const o=typeof i.source=="string"?i.source:i.source.url,s=typeof i.target=="string"?i.target:i.target.url;return o===e&&s===n})?!1:(Re.links.push({source:e,target:n}),!0)}function so(){Ze.graphData({nodes:[...Re.nodes],links:[...Re.links]})}function Pw(e,n,r){ww.textContent=e.title,e.state==="error"?(qr.textContent=e.errorMessage||"Failed to load page",qr.style.display="block",Ve.style.display="none"):(qr.style.display="none",Ve.style.display="inline-block",e.state==="expanded"?(Ve.setAttribute("disabled","true"),Ve.textContent="Expanded"):(Ve.removeAttribute("disabled"),Ve.textContent="Expand")),gt.style.display="block";const i=gt.getBoundingClientRect(),o=15,s=n<window.innerWidth/2?n+o:n-i.width-o,a=r<window.innerHeight/2?r+o:r-i.height-o;gt.style.left=`${s}px`,gt.style.top=`${a}px`}function Rn(){gt.style.display="none",Pt=null}function Ew(e,n){if(Pt===e.url){Rn();return}Pt=e.url,Pw(e,n.clientX,n.clientY)}document.addEventListener("keydown",e=>{e.key==="Escape"&>.style.display==="block"&&Rn()});const Gu=1.5;kw.addEventListener("click",()=>{const e=Ze.zoom();Ze.zoom(e*Gu,200)});Sw.addEventListener("click",()=>{const e=Ze.zoom();Ze.zoom(e/Gu,200)});const ft=new em({name:"Wiki Explorer",version:"1.0.0"});zw.addEventListener("click",async()=>{if(!on)return;const e=await ft.callServerTool({name:"get-first-degree-links",arguments:{url:on}});Re.nodes=[],Re.links=[],hr(on,on,"default",{x:0,y:0}),Ze.warmupTicks(100),ao(e),Ze.centerAt(0,0,500)});xw.addEventListener("click",async()=>{Pt&&(await ft.openLink({url:Pt}),Rn())});Ve.addEventListener("click",async()=>{if(!Pt)return;const e=Pt;Ve.setAttribute("disabled","true"),Ve.textContent="Loading...";try{const n=await ft.callServerTool({name:"get-first-degree-links",arguments:{url:e}});Ze.warmupTicks(0),ao(n)}catch(n){console.error("Expand error:",n),fi(e,"error","Request failed"),so()}finally{Ve.removeAttribute("disabled"),Ve.textContent="Expand",Rn()}});ft.ontoolinput=e=>{const n=e.arguments;n!=null&&n.url&&(on=n.url,hr(n.url,n.url,"default",{x:0,y:0}),Ze.warmupTicks(100),so(),Ze.centerAt(0,0,500))};ft.ontoolresult=e=>{Ze.warmupTicks(100),ao(e)};function ao(e){if(e.isError){console.error("Tool result error:",e);return}const n=e.structuredContent,{page:r,links:i,error:o}=n;if(hr(r.url,r.title),Tw(r.url,r.title),o)fi(r.url,"error",o);else{const s=Re.nodes.find(u=>u.url===r.url),a=s?{x:s.x??0,y:s.y??0}:void 0;for(const u of i)hr(u.url,u.title,"default",a),Cw(r.url,u.url);fi(r.url,"expanded")}so()}ft.onerror=e=>{console.error("[Wiki Explorer] App error:",e)};function Xu(e){e.safeAreaInsets&&(document.body.style.paddingTop=`${e.safeAreaInsets.top}px`,document.body.style.paddingRight=`${e.safeAreaInsets.right}px`,document.body.style.paddingBottom=`${e.safeAreaInsets.bottom}px`,document.body.style.paddingLeft=`${e.safeAreaInsets.left}px`)}ft.onhostcontextchanged=Xu;ft.connect().then(()=>{const e=ft.getHostContext();e&&Xu(e)});</script>
|
|
126
|
-
<style rel="stylesheet" crossorigin>*{box-sizing:border-box;margin:0;padding:0}html,body{font-family:system-ui,-apple-system,sans-serif;font-size:1rem;width:100%;height:100%;overflow:hidden}:root{--bg-color: #ffffff;--text-color: #333333;--border-color: #dddddd;--node-default: #4a90d9;--node-expanded: #2ecc71;--node-error: #e74c3c;--link-color: rgba(128, 128, 128, .5)}@media(prefers-color-scheme:dark){:root{--bg-color: #1e1e1e;--text-color: #e0e0e0;--border-color: #444444}}body{background-color:var(--bg-color);color:var(--text-color)}#graph{width:100%;height:100vh}#popup{display:none;position:fixed;background:var(--bg-color);border:1px solid var(--border-color);border-radius:8px;padding:16px;box-shadow:0 4px 12px #00000026;z-index:100;min-width:200px;max-width:400px}.popup-title{font-weight:600;margin-bottom:12px;word-wrap:break-word;color:var(--text-color)}.popup-error{display:none;color:var(--node-error);font-size:14px;padding:8px 0;border-top:1px solid var(--border-color);margin-bottom:8px}.popup-buttons{display:flex;gap:8px}.popup-buttons button{flex:1;padding:8px 16px;border:none;border-radius:6px;font-weight:600;cursor:pointer;transition:opacity .2s}.popup-buttons button:hover{opacity:.9}#open-btn{background-color:var(--node-default);color:#fff}#expand-btn{background-color:var(--node-expanded);color:#fff}.popup-buttons button:disabled{opacity:.5;cursor:not-allowed}#controls{position:fixed;bottom:24px;right:24px;display:flex;flex-direction:row;align-items:flex-end;gap:8px;z-index:100}#reset-graph{width:40px;height:40px;background:var(--bg-color);border:1px solid var(--border-color);border-radius:4px;color:var(--text-color);font-size:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 6px #0000004d;transition:background-color .15s}#reset-graph:hover{background:var(--border-color)}#reset-graph:active{background:var(--border-color);opacity:.8}#zoom-controls{display:flex;flex-direction:column;box-shadow:0 2px 6px #0000004d;border-radius:4px}#zoom-controls button{width:40px;height:40px;background:var(--bg-color);border:1px solid var(--border-color);color:var(--text-color);font-size:20px;font-weight:600;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .15s}#zoom-controls button:hover{background:var(--border-color)}#zoom-controls button:active{background:var(--border-color);opacity:.8}#zoom-in{border-radius:4px 4px 0 0;border-bottom:none}#zoom-out{border-radius:0 0 4px 4px}</style>
|
|
123
|
+
`;nw(rw);function ci(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function iw(e){if(Array.isArray(e))return e}function ow(e){if(Array.isArray(e))return ci(e)}function $s(e,n,r){if(Hu())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,n);var o=new(e.bind.apply(e,i));return o}function yn(e,n,r){return(n=fw(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Hu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hu=function(){return!!e})()}function sw(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function aw(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,s,a,u=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(i=s.call(r)).done)&&(u.push(i.value),u.length!==n);c=!0);}catch(h){l=!0,o=h}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}function uw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
124
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cw(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
125
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Is(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function Rt(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Is(Object(r),!0).forEach(function(i){yn(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Is(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function un(e,n){return iw(e)||aw(e,n)||Vu(e,n)||uw()}function je(e){return ow(e)||sw(e)||Vu(e)||cw()}function lw(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function fw(e){var n=lw(e,"string");return typeof n=="symbol"?n:n+""}function li(e){"@babel/helpers - typeof";return li=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},li(e)}function Vu(e,n){if(e){if(typeof e=="string")return ci(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ci(e,n):void 0}}var hw=Fu(tw);function Ms(e,n,r){!n||typeof r!="string"||e.filter(function(i){return!i[r]}).forEach(function(i){i[r]=hw(n(i))})}function dw(e,n){var r=e.nodes,i=e.links,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=o.nodeFilter,a=s===void 0?function(){return!0}:s,u=o.onLoopError,c=u===void 0?function(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:u,l={};r.forEach(function(p){return l[n(p)]={data:p,out:[],depth:-1,skip:!a(p)}}),i.forEach(function(p){var g=p.source,_=p.target,y=b(g),m=b(_);if(!l.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!l.hasOwnProperty(m))throw"Missing target node with id: ".concat(m);var w=l[y],C=l[m];w.out.push(C);function b(v){return li(v)==="object"?n(v):v}});var h=[];d(Object.values(l));var f=Object.assign.apply(Object,[{}].concat(je(Object.entries(l).filter(function(p){var g=un(p,2),_=g[1];return!_.skip}).map(function(p){var g=un(p,2),_=g[0],y=g[1];return yn({},_,y.depth)}))));return f;function d(p){for(var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var b=p[m];if(g.indexOf(b)!==-1){var v=[].concat(je(g.slice(g.indexOf(b))),[b]).map(function(k){return n(k.data)});return h.some(function(k){return k.length===v.length&&k.every(function(x,P){return x===v[P]})})||(h.push(v),c(v)),1}_>b.depth&&(b.depth=_,d(b.out,[].concat(je(g),[b]),_+(b.skip?0:1)))},m=0,w=p.length;m<w;m++)y()}}var pw=2,we=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},Os=function(n,r){if(!r.isShadow){var i=Y(r.linkDirectionalParticles);r.graphData.links.forEach(function(o){var s=Math.round(Math.abs(i(o)));s?o.__photons=je(Array(s)).map(function(){return{}}):delete o.__photons})}},fr=to({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,Os(n,r)}},dagMode:{onChange:function(n,r){!n&&(r.graphData.nodes||[]).forEach(function(i){return i.fx=i.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:we},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:we},nodeColor:{default:"color",triggerUpdate:!1,onChange:we},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:we},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:we},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:we},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:we},linkColor:{default:"color",triggerUpdate:!1,onChange:we},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:we},linkWidth:{default:1,triggerUpdate:!1,onChange:we},linkCurvature:{default:0,triggerUpdate:!1,onChange:we},linkCanvasObject:{triggerUpdate:!1,onChange:we},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:we},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:we},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:we},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:we},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:Os},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,r,i){return i===void 0?n.forceLayout.force(r):(n.forceLayout.force(r,i),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&r(),o(),!n.isShadow&&s(),!n.isShadow&&a(),i(),this;function r(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin?(n.engineRunning=!1,n.onEngineStop()):(n.forceLayout.tick(),n.onEngineTick()))}function i(){var u=Y(n.nodeVisibility),c=Y(n.nodeVal),l=Y(n.nodeColor),h=Y(n.nodeCanvasObjectMode),f=n.ctx,d=n.isShadow/n.globalScale,p=n.graphData.nodes.filter(u);f.save(),p.forEach(function(g){var _=h(g);if(n.nodeCanvasObject&&(_==="before"||_==="replace")&&(n.nodeCanvasObject(g,f,n.globalScale),_==="replace")){f.restore();return}var y=Math.sqrt(Math.max(0,c(g)||1))*n.nodeRelSize+d;f.beginPath(),f.arc(g.x,g.y,y,0,2*Math.PI,!1),f.fillStyle=l(g)||"rgba(31, 120, 180, 0.92)",f.fill(),n.nodeCanvasObject&&_==="after"&&n.nodeCanvasObject(g,n.ctx,n.globalScale)}),f.restore()}function o(){var u=Y(n.linkVisibility),c=Y(n.linkColor),l=Y(n.linkWidth),h=Y(n.linkLineDash),f=Y(n.linkCurvature),d=Y(n.linkCanvasObjectMode),p=n.ctx,g=n.isShadow*2,_=n.graphData.links.filter(u);_.forEach(k);var y=[],m=[],w=_;if(n.linkCanvasObject){var C=[],b=[];_.forEach(function(x){return({before:y,after:m,replace:C}[d(x)]||b).push(x)}),w=[].concat(je(y),m,b),y=y.concat(C)}p.save(),y.forEach(function(x){return n.linkCanvasObject(x,p,n.globalScale)}),p.restore();var v=Y1(w,[c,l,h]);p.save(),Object.entries(v).forEach(function(x){var P=un(x,2),M=P[0],$=P[1],N=!M||M==="undefined"?"rgba(0,0,0,0.15)":M;Object.entries($).forEach(function(D){var H=un(D,2),z=H[0],O=H[1],R=(z||1)/n.globalScale+g;Object.entries(O).forEach(function(j){var F=un(j,2);F[0];var q=F[1],V=h(q[0]);p.beginPath(),q.forEach(function(L){var W=L.source,ee=L.target;if(!(!W||!ee||!W.hasOwnProperty("x")||!ee.hasOwnProperty("x"))){p.moveTo(W.x,W.y);var K=L.__controlPoints;K?p[K.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(p,je(K).concat([ee.x,ee.y])):p.lineTo(ee.x,ee.y)}}),p.strokeStyle=N,p.lineWidth=R,p.setLineDash(V||[]),p.stroke()})})}),p.restore(),p.save(),m.forEach(function(x){return n.linkCanvasObject(x,p,n.globalScale)}),p.restore();function k(x){var P=f(x);if(!P){x.__controlPoints=null;return}var M=x.source,$=x.target;if(!(!M||!$||!M.hasOwnProperty("x")||!$.hasOwnProperty("x"))){var N=Math.sqrt(Math.pow($.x-M.x,2)+Math.pow($.y-M.y,2));if(N>0){var D=Math.atan2($.y-M.y,$.x-M.x),H=N*P,z={x:(M.x+$.x)/2+H*Math.cos(D-Math.PI/2),y:(M.y+$.y)/2+H*Math.sin(D-Math.PI/2)};x.__controlPoints=[z.x,z.y]}else{var O=P*70;x.__controlPoints=[$.x,$.y-O,$.x+O,$.y]}}}}function s(){var u=1.6,c=.2,l=Y(n.linkDirectionalArrowLength),h=Y(n.linkDirectionalArrowRelPos),f=Y(n.linkVisibility),d=Y(n.linkDirectionalArrowColor||n.linkColor),p=Y(n.nodeVal),g=n.ctx;g.save(),n.graphData.links.filter(f).forEach(function(_){var y=l(_);if(!(!y||y<0)){var m=_.source,w=_.target;if(!(!m||!w||!m.hasOwnProperty("x")||!w.hasOwnProperty("x"))){var C=Math.sqrt(Math.max(0,p(m)||1))*n.nodeRelSize,b=Math.sqrt(Math.max(0,p(w)||1))*n.nodeRelSize,v=Math.min(1,Math.max(0,h(_))),k=d(_)||"rgba(0,0,0,0.28)",x=y/u/2,P=_.__controlPoints&&$s(se,[m.x,m.y].concat(je(_.__controlPoints),[w.x,w.y])),M=P?function(R){return P.get(R)}:function(R){return{x:m.x+(w.x-m.x)*R||0,y:m.y+(w.y-m.y)*R||0}},$=P?P.length():Math.sqrt(Math.pow(w.x-m.x,2)+Math.pow(w.y-m.y,2)),N=C+y+($-C-b-y)*v,D=M(N/$),H=M((N-y)/$),z=M((N-y*(1-c))/$),O=Math.atan2(D.y-H.y,D.x-H.x)-Math.PI/2;g.beginPath(),g.moveTo(D.x,D.y),g.lineTo(H.x+x*Math.cos(O),H.y+x*Math.sin(O)),g.lineTo(z.x,z.y),g.lineTo(H.x-x*Math.cos(O),H.y-x*Math.sin(O)),g.fillStyle=k,g.fill()}}}),g.restore()}function a(){var u=Y(n.linkDirectionalParticles),c=Y(n.linkDirectionalParticleSpeed),l=Y(n.linkDirectionalParticleOffset),h=Y(n.linkDirectionalParticleWidth),f=Y(n.linkVisibility),d=Y(n.linkDirectionalParticleColor||n.linkColor),p=n.ctx;p.save(),n.graphData.links.filter(f).forEach(function(g){var _=u(g);if(!(!g.hasOwnProperty("__photons")||!g.__photons.length)){var y=g.source,m=g.target;if(!(!y||!m||!y.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var w=c(g),C=Math.abs(l(g)),b=g.__photons||[],v=Math.max(0,h(g)/2)/Math.sqrt(n.globalScale),k=d(g)||"rgba(0,0,0,0.28)";p.fillStyle=k;var x=g.__controlPoints?$s(se,[y.x,y.y].concat(je(g.__controlPoints),[m.x,m.y])):null,P=0,M=!1;b.forEach(function($){var N=!!$.__singleHop;if($.hasOwnProperty("__progressRatio")||($.__progressRatio=N?0:(P+C)/_),!N&&P++,$.__progressRatio+=w,$.__progressRatio>=1)if(!N)$.__progressRatio=$.__progressRatio%1;else{M=!0;return}var D=$.__progressRatio,H=x?x.get(D):{x:y.x+(m.x-y.x)*D||0,y:y.y+(m.y-y.y)*D||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(H.x,H.y,g,p,n.globalScale):(p.beginPath(),p.arc(H.x,H.y,v,0,2*Math.PI,!1),p.fill())}),M&&(g.__photons=g.__photons.filter(function($){return!$.__singleHop||$.__progressRatio<=1}))}}}),p.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:g_().force("link",Va()).force("charge",Ga()).force("center",Ua()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Ms(n.graphData.nodes,Y(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Ms(n.graphData.links,Y(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(d){d.source=d[n.linkSource],d.target=d[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(d){return d[n.nodeId]}).links(n.graphData.links);var o=n.dagMode&&dw(n.graphData,function(d){return d[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),s=Math.max.apply(Math,je(Object.values(o||[]))),a=n.dagLevelDistance||n.graphData.nodes.length/(s||1)*pw*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var u=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return delete d[u]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var c=["rl","bu"].includes(n.dagMode),l=function(p){return(o[p[n.nodeId]]-s/2)*a*(c?-1:1)},h=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return d[h]=l(d)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?m_(function(d){var p=o[d[n.nodeId]]||-1;return(n.dagMode==="radialin"?s-p:p)*a}).strength(function(d){return n.dagNodeFilter(d)?1:0}):null);for(var f=0;f<n.warmupTicks&&!(n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin);f++)n.forceLayout.tick();this.resetCountdown(),n.onFinishUpdate()}});function Bu(e,n){var r=e instanceof Array?e:[e],i=new n;return i._destructor&&i._destructor(),{linkProp:function(s){return{default:i[s](),onChange:function(u,c){r.forEach(function(l){return c[l][s](u)})},triggerUpdate:!1}},linkMethod:function(s){return function(a){for(var u=arguments.length,c=new Array(u>1?u-1:0),l=1;l<u;l++)c[l-1]=arguments[l];var h=[];return r.forEach(function(f){var d=a[f],p=d[s].apply(d,c);p!==d&&h.push(p)}),h.length?h[0]:this}}}}var gw=800,mw=4,_w=5,Wu=Bu("forceGraph",fr),yw=Bu(["forceGraph","shadowGraph"],fr),vw=Object.assign.apply(Object,je(["nodeColor","nodeAutoColorBy","nodeCanvasObject","nodeCanvasObjectMode","linkColor","linkAutoColorBy","linkLineDash","linkWidth","linkCanvasObject","linkCanvasObjectMode","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleCanvasObject","dagMode","dagLevelDistance","dagNodeFilter","onDagError","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(e){return yn({},e,Wu.linkProp(e))})).concat(je(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return yn({},e,yw.linkProp(e))})))),bw=Object.assign.apply(Object,je(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return yn({},e,Wu.linkMethod(e))})));function Zr(e){if(e.canvas){var n=e.canvas.width,r=e.canvas.height;n===300&&r===150&&(n=r=0);var i=window.devicePixelRatio;n/=i,r/=i,[e.canvas,e.shadowCanvas].forEach(function(s){s.style.width="".concat(e.width,"px"),s.style.height="".concat(e.height,"px"),s.width=e.width*i,s.height=e.height*i,!n&&!r&&s.getContext("2d").scale(i,i)});var o=Xe(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/o,(e.height-r)/2/o),e.needsRedraw=!0}}function Gu(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function Ns(e,n,r){e.save(),Gu(e),e.clearRect(0,0,n,r),e.restore()}var ww=to({props:Rt({width:{default:window.innerWidth,onChange:function(n,r){return Zr(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return Zr(r)},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(n,r){[n.nodes,n.links].every(function(o){return(o||[]).every(function(s){return!s.hasOwnProperty("__indexColor")})})&&r.colorTracker.reset(),[{type:"Node",objs:n.nodes},{type:"Link",objs:n.links}].forEach(i),r.forceGraph.graphData(n),r.shadowGraph.graphData(n);function i(o){var s=o.type,a=o.objs;a.filter(function(u){if(!u.hasOwnProperty("__indexColor"))return!0;var c=r.colorTracker.lookup(u.__indexColor);return!c||!c.hasOwnProperty("d")||c.d!==u}).forEach(function(u){u.__indexColor=r.colorTracker.register({type:s,d:u})})}},triggerUpdate:!1},backgroundColor:{onChange:function(n,r){r.canvas&&n&&(r.canvas.style.background=n)},triggerUpdate:!1},nodeLabel:{default:"name",triggerUpdate:!1},nodePointerAreaPaint:{onChange:function(n,r){r.shadowGraph.nodeCanvasObject(n?function(i,o,s){return n(i,i.__indexColor,o,s)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkPointerAreaPaint:{onChange:function(n,r){r.shadowGraph.linkCanvasObject(n?function(i,o,s){return n(i,i.__indexColor,o,s)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:4,triggerUpdate:!1},minZoom:{default:.01,onChange:function(n,r){r.zoom.scaleExtent([n,r.zoom.scaleExtent()[1]])},triggerUpdate:!1},maxZoom:{default:1e3,onChange:function(n,r){r.zoom.scaleExtent([r.zoom.scaleExtent()[0],n])},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},enableZoomInteraction:{default:!0,triggerUpdate:!1},enablePanInteraction:{default:!0,triggerUpdate:!1},enableZoomPanInteraction:{default:!0,triggerUpdate:!1},enablePointerInteraction:{default:!0,onChange:function(n,r){r.hoverObj=null},triggerUpdate:!1},autoPauseRedraw:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},onZoom:{triggerUpdate:!1},onZoomEnd:{triggerUpdate:!1},onRenderFramePre:{triggerUpdate:!1},onRenderFramePost:{triggerUpdate:!1}},vw),aliases:{stopAnimation:"pauseAnimation"},methods:Rt({graph2ScreenCoords:function(n,r,i){var o=Xe(n.canvas);return{x:r*o.k+o.x,y:i*o.k+o.y}},screen2GraphCoords:function(n,r,i){var o=Xe(n.canvas);return{x:(r-o.x)/o.k,y:(i-o.y)/o.k}},centerAt:function(n,r,i,o){if(!n.canvas)return null;if(r!==void 0||i!==void 0){var s=Object.assign({},r!==void 0?{x:r}:{},i!==void 0?{y:i}:{});return o?n.tweenGroup.add(new hs(a()).to(s,o).easing(Tt.Quadratic.Out).onUpdate(u).start()):u(s),this}return a();function a(){var c=Xe(n.canvas);return{x:(n.width/2-c.x)/c.k,y:(n.height/2-c.y)/c.k}}function u(c){var l=c.x,h=c.y;n.zoom.translateTo(n.zoom.__baseElem,l===void 0?a().x:l,h===void 0?a().y:h),n.needsRedraw=!0}},zoom:function(n,r,i){if(!n.canvas)return null;if(r!==void 0)return i?n.tweenGroup.add(new hs({k:o()}).to({k:r},i).easing(Tt.Quadratic.Out).onUpdate(function(a){var u=a.k;return s(u)}).start()):s(r),this;return o();function o(){return Xe(n.canvas).k}function s(a){n.zoom.scaleTo(n.zoom.__baseElem,a),n.needsRedraw=!0}},zoomToFit:function(n){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,s=new Array(o>3?o-3:0),a=3;a<o;a++)s[a-3]=arguments[a];var u=this.getGraphBbox.apply(this,s);if(u){var c={x:(u.x[0]+u.x[1])/2,y:(u.y[0]+u.y[1])/2},l=Math.max(1e-12,Math.min(1e12,(n.width-i*2)/(u.x[1]-u.x[0]),(n.height-i*2)/(u.y[1]-u.y[0])));this.centerAt(c.x,c.y,r),this.zoom(l,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},i=Y(n.nodeVal),o=function(u){return Math.sqrt(Math.max(0,i(u)||1))*n.nodeRelSize},s=n.graphData.nodes.filter(r).map(function(a){return{x:a.x,y:a.y,r:o(a)}});return s.length?{x:[us(s,function(a){return a.x-a.r}),as(s,function(a){return a.x+a.r})],y:[us(s,function(a){return a.y-a.r}),as(s,function(a){return a.y+a.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},bw),stateInit:function(){return{lastSetZoom:1,zoom:Uv(),forceGraph:new fr,shadowGraph:new fr().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new f1,tweenGroup:new xu}},init:function(n,r){var i=this;n.innerHTML="";var o=document.createElement("div");o.classList.add("force-graph-container"),o.style.position="relative",n.appendChild(o),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),o.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var s=r.canvas.getContext("2d"),a=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),u={x:-1e12,y:-1e12},c=function(){var f=null,d=window.devicePixelRatio,p=u.x>0&&u.y>0?a.getImageData(u.x*d,u.y*d,1,1):null;return p&&(f=r.colorTracker.lookup(p.data)),f};De(r.canvas).call(ty().subject(function(){if(!r.enableNodeDrag)return null;var h=c();return h&&h.type==="Node"?h.d:null}).on("start",function(h){var f=h.subject;f.__initialDragPos={x:f.x,y:f.y,fx:f.fx,fy:f.fy},h.active||(f.fx=f.x,f.fy=f.y),r.canvas.classList.add("grabbable")}).on("drag",function(h){var f=h.subject,d=f.__initialDragPos,p=h,g=Xe(r.canvas).k,_={x:d.x+(p.x-d.x)/g-f.x,y:d.y+(p.y-d.y)/g-f.y};["x","y"].forEach(function(y){return f["f".concat(y)]=f[y]=d[y]+(p[y]-d[y])/g}),!(!f.__dragged&&_w>=Math.sqrt(Vv(["x","y"].map(function(y){return Math.pow(h[y]-d[y],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,f.__dragged=!0,r.onNodeDrag(f,_))}).on("end",function(h){var f=h.subject,d=f.__initialDragPos,p={x:f.x-d.x,y:f.y-d.y};d.fx===void 0&&(f.fx=void 0),d.fy===void 0&&(f.fy=void 0),delete f.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,f.__dragged&&(delete f.__dragged,r.onNodeDragEnd(f,p))})),r.zoom(r.zoom.__baseElem=De(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(h){return!h.button&&r.enableZoomPanInteraction&&(h.type!=="wheel"||Y(r.enableZoomInteraction)(h))&&(h.type==="wheel"||Y(r.enablePanInteraction)(h))}).on("zoom",function(h){var f=h.transform;[s,a].forEach(function(d){Gu(d),d.translate(f.x,f.y),d.scale(f.k,f.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Rt(Rt({},f),i.centerAt())),r.needsRedraw=!0}).on("end",function(h){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Rt(Rt({},h.transform),i.centerAt()))}),Zr(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){Xe(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=mw/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new $1(o),["pointermove","pointerdown"].forEach(function(h){return o.addEventListener(h,function(f){h==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=f),!r.isPointerDragging&&f.type==="pointermove"&&r.onBackgroundClick&&(f.pressure>0||r.isPointerPressed)&&(f.pointerType==="mouse"||f.movementX===void 0||[f.movementX,f.movementY].some(function(g){return Math.abs(g)>1}))&&(r.isPointerDragging=!0);var d=p(o);u.x=f.pageX-d.left,u.y=f.pageY-d.top;function p(g){var _=g.getBoundingClientRect(),y=window.pageXOffset||document.documentElement.scrollLeft,m=window.pageYOffset||document.documentElement.scrollTop;return{top:_.top+m,left:_.left+y}}},{passive:!0})}),o.addEventListener("pointerup",function(h){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var f=[h,r.pointerDownEvent];requestAnimationFrame(function(){if(h.button===0)if(r.hoverObj){var d=r["on".concat(r.hoverObj.type,"Click")];d&&d.apply(void 0,[r.hoverObj.d].concat(f))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,f);if(h.button===2)if(r.hoverObj){var p=r["on".concat(r.hoverObj.type,"RightClick")];p&&p.apply(void 0,[r.hoverObj.d].concat(f))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,f)})}},{passive:!0}),o.addEventListener("contextmenu",function(h){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(h.preventDefault(),!1)}),r.forceGraph(s),r.shadowGraph(a);var l=yb(function(){Ns(a,r.width,r.height),r.shadowGraph.linkWidth(function(f){return Y(r.linkWidth)(f)+r.linkHoverPrecision});var h=Xe(r.canvas);r.shadowGraph.globalScale(h.k).tickFrame()},gw);r.flushShadowCanvas=l.flush,(this._animationCycle=function h(){var f=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(C){return C.__photons&&C.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var d=r.isPointerDragging?null:c();if(d!==r.hoverObj){var p=r.hoverObj,g=p?p.type:null,_=d?d.type:null;if(g&&g!==_){var y=r["on".concat(g,"Hover")];y&&y(null,p.d)}if(_){var m=r["on".concat(_,"Hover")];m&&m(d.d,g===_?p.d:null)}r.tooltip.content(d&&Y(r["".concat(d.type.toLowerCase(),"Label")])(d.d)||null),r.canvas.classList[(d&&r["on".concat(_,"Click")]||!d&&r.onBackgroundClick)&&Y(r.showPointerCursor)(d==null?void 0:d.d)?"add":"remove"]("clickable"),r.hoverObj=d}f&&l()}if(f){Ns(s,r.width,r.height);var w=Xe(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(s,w),r.forceGraph.globalScale(w).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(s,w)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(h)})()},update:function(n){}});function Fn(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||"#000"}const Re={nodes:[],links:[]};let Pt=null,on=null;const so=document.getElementById("graph"),gt=document.getElementById("popup"),xw=gt.querySelector(".popup-title"),qr=gt.querySelector(".popup-error"),kw=document.getElementById("open-btn"),Ve=document.getElementById("expand-btn"),Sw=document.getElementById("zoom-in"),zw=document.getElementById("zoom-out"),Tw=document.getElementById("reset-graph"),Ze=new ww(so).nodeId("url").nodeLabel("title").nodeColor(e=>{switch(e.state){case"expanded":return Fn("--node-expanded");case"error":return Fn("--node-error");default:return Fn("--node-default")}}).nodeVal(8).linkDirectionalArrowLength(6).linkDirectionalArrowRelPos(1).linkColor(()=>Fn("--link-color")).onNodeClick(Aw).onBackgroundClick(()=>Rn()).d3Force("charge",Ga().strength(-80)).d3Force("link",Va().distance(60)).d3Force("collide",Qm(12)).d3Force("center",Ua()).d3VelocityDecay(.3).cooldownTime(1/0).d3AlphaMin(0).d3Force("ambient",()=>{for(const e of Re.nodes)e.vx!==void 0&&e.vy!==void 0&&(e.vx+=(Math.random()-.5)*.1,e.vy+=(Math.random()-.5)*.1)}).graphData(Re),Ds=so.querySelector("canvas");if(Ds)for(const e of["touchstart","touchmove"])Ds.addEventListener(e,n=>n.preventDefault(),{passive:!1});function Ju(){const{width:e,height:n}=so.getBoundingClientRect();Ze.width(e).height(n)}window.addEventListener("resize",Ju);Ju();function hr(e,n,r="default",i){if(Re.nodes.find(a=>a.url===e))return!1;const s={url:e,title:n,state:r};return i&&(s.x=i.x+(Math.random()-.5)*20,s.y=i.y+(Math.random()-.5)*20),Re.nodes.push(s),!0}function Cw(e,n){const r=Re.nodes.find(i=>i.url===e);r&&(r.title=n)}function fi(e,n,r){const i=Re.nodes.find(o=>o.url===e);i&&(i.state=n,i.errorMessage=r)}function Pw(e,n){return Re.links.find(i=>{const o=typeof i.source=="string"?i.source:i.source.url,s=typeof i.target=="string"?i.target:i.target.url;return o===e&&s===n})?!1:(Re.links.push({source:e,target:n}),!0)}function ao(){Ze.graphData({nodes:[...Re.nodes],links:[...Re.links]})}function Ew(e,n,r){xw.textContent=e.title,e.state==="error"?(qr.textContent=e.errorMessage||"Failed to load page",qr.style.display="block",Ve.style.display="none"):(qr.style.display="none",Ve.style.display="inline-block",e.state==="expanded"?(Ve.setAttribute("disabled","true"),Ve.textContent="Expanded"):(Ve.removeAttribute("disabled"),Ve.textContent="Expand")),gt.style.display="block";const i=gt.getBoundingClientRect(),o=15,s=n<window.innerWidth/2?n+o:n-i.width-o,a=r<window.innerHeight/2?r+o:r-i.height-o;gt.style.left=`${s}px`,gt.style.top=`${a}px`}function Rn(){gt.style.display="none",Pt=null}function Aw(e,n){if(Pt===e.url){Rn();return}Pt=e.url,Ew(e,n.clientX,n.clientY)}document.addEventListener("keydown",e=>{e.key==="Escape"&>.style.display==="block"&&Rn()});const Xu=1.5;Sw.addEventListener("click",()=>{const e=Ze.zoom();Ze.zoom(e*Xu,200)});zw.addEventListener("click",()=>{const e=Ze.zoom();Ze.zoom(e/Xu,200)});const ft=new tm({name:"Wiki Explorer",version:"1.0.0"});Tw.addEventListener("click",async()=>{if(!on)return;const e=await ft.callServerTool({name:"get-first-degree-links",arguments:{url:on}});Re.nodes=[],Re.links=[],hr(on,on,"default",{x:0,y:0}),Ze.warmupTicks(100),uo(e),Ze.centerAt(0,0,500)});kw.addEventListener("click",async()=>{Pt&&(await ft.openLink({url:Pt}),Rn())});Ve.addEventListener("click",async()=>{if(!Pt)return;const e=Pt;Ve.setAttribute("disabled","true"),Ve.textContent="Loading...";try{const n=await ft.callServerTool({name:"get-first-degree-links",arguments:{url:e}});Ze.warmupTicks(0),uo(n)}catch(n){console.error("Expand error:",n),fi(e,"error","Request failed"),ao()}finally{Ve.removeAttribute("disabled"),Ve.textContent="Expand",Rn()}});ft.ontoolinput=e=>{const n=e.arguments;n!=null&&n.url&&(on=n.url,hr(n.url,n.url,"default",{x:0,y:0}),Ze.warmupTicks(100),ao(),Ze.centerAt(0,0,500))};ft.ontoolresult=e=>{Ze.warmupTicks(100),uo(e)};function uo(e){if(e.isError){console.error("Tool result error:",e);return}const n=e.structuredContent,{page:r,links:i,error:o}=n;if(hr(r.url,r.title),Cw(r.url,r.title),o)fi(r.url,"error",o);else{const s=Re.nodes.find(u=>u.url===r.url),a=s?{x:s.x??0,y:s.y??0}:void 0;for(const u of i)hr(u.url,u.title,"default",a),Pw(r.url,u.url);fi(r.url,"expanded")}ao()}ft.onerror=e=>{console.error("[Wiki Explorer] App error:",e)};function Ku(e){e.safeAreaInsets&&(document.body.style.paddingTop=`${e.safeAreaInsets.top}px`,document.body.style.paddingRight=`${e.safeAreaInsets.right}px`,document.body.style.paddingBottom=`${e.safeAreaInsets.bottom}px`,document.body.style.paddingLeft=`${e.safeAreaInsets.left}px`)}ft.onhostcontextchanged=Ku;ft.connect().then(()=>{const e=ft.getHostContext();e&&Ku(e)});</script>
|
|
126
|
+
<style rel="stylesheet" crossorigin>*{box-sizing:border-box;margin:0;padding:0}html,body{font-family:system-ui,-apple-system,sans-serif;font-size:1rem;width:100%;height:100%;overflow:hidden}:root{--bg-color: #ffffff;--text-color: #333333;--border-color: #dddddd;--node-default: #4a90d9;--node-expanded: #2ecc71;--node-error: #e74c3c;--link-color: rgba(128, 128, 128, .5)}@media(prefers-color-scheme:dark){:root{--bg-color: #1e1e1e;--text-color: #e0e0e0;--border-color: #444444}}body{background-color:var(--bg-color);color:var(--text-color)}#graph{width:100%;height:100vh;touch-action:none}#popup{display:none;position:fixed;background:var(--bg-color);border:1px solid var(--border-color);border-radius:8px;padding:16px;box-shadow:0 4px 12px #00000026;z-index:100;min-width:200px;max-width:400px}.popup-title{font-weight:600;margin-bottom:12px;word-wrap:break-word;color:var(--text-color)}.popup-error{display:none;color:var(--node-error);font-size:14px;padding:8px 0;border-top:1px solid var(--border-color);margin-bottom:8px}.popup-buttons{display:flex;gap:8px}.popup-buttons button{flex:1;padding:8px 16px;border:none;border-radius:6px;font-weight:600;cursor:pointer;transition:opacity .2s}.popup-buttons button:hover{opacity:.9}#open-btn{background-color:var(--node-default);color:#fff}#expand-btn{background-color:var(--node-expanded);color:#fff}.popup-buttons button:disabled{opacity:.5;cursor:not-allowed}#controls{position:fixed;bottom:24px;right:24px;display:flex;flex-direction:row;align-items:flex-end;gap:8px;z-index:100}#reset-graph{width:40px;height:40px;background:var(--bg-color);border:1px solid var(--border-color);border-radius:4px;color:var(--text-color);font-size:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 6px #0000004d;transition:background-color .15s}#reset-graph:hover{background:var(--border-color)}#reset-graph:active{background:var(--border-color);opacity:.8}#zoom-controls{display:flex;flex-direction:column;box-shadow:0 2px 6px #0000004d;border-radius:4px}#zoom-controls button{width:40px;height:40px;background:var(--bg-color);border:1px solid var(--border-color);color:var(--text-color);font-size:20px;font-weight:600;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .15s}#zoom-controls button:hover{background:var(--border-color)}#zoom-controls button:active{background:var(--border-color);opacity:.8}#zoom-in{border-radius:4px 4px 0 0;border-bottom:none}#zoom-out{border-radius:0 0 4px 4px}</style>
|
|
127
127
|
</head>
|
|
128
128
|
<body>
|
|
129
129
|
<div id="graph"></div>
|